cd52a2f82f
Browser-based photo catalog with an optional team server (SQLite + LibRaw). Local database, uploaded photos, build output and dependencies are gitignored. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
296 lines
15 KiB
Markdown
296 lines
15 KiB
Markdown
# Luminary
|
||
|
||
A browser-based photo catalog and editor built for a small team: events, ratings,
|
||
filtering, and a non-destructive RAW-capable develop module.
|
||
|
||
Two ways to run it:
|
||
|
||
| Mode | Storage | Raw support |
|
||
| --- | --- | --- |
|
||
| Browser only (`npm run dev`) | IndexedDB on this device | No — raw files need the server |
|
||
| Team server (`npm run server` + `npm run dev`) | SQLite + files on disk under `server/data` | Yes — LibRaw demosaic for all vendors |
|
||
|
||
## Quick start
|
||
|
||
```bash
|
||
npm install
|
||
|
||
# browser-only library
|
||
npm run dev # http://localhost:5173
|
||
|
||
# with the team server (enables raw + sharing)
|
||
LUMINARY_INVITE=our-team npm run server # http://localhost:8787
|
||
npm run dev # proxies /api to the server
|
||
```
|
||
|
||
Open the **Local only / Sign in** pill in the top bar. The first account becomes
|
||
the admin. After that, invite people from **Administration → Invites**: each link
|
||
is single-use, can be locked to an email address, expires automatically and can
|
||
be revoked. Setting `LUMINARY_INVITE` also enables a shared code for people who
|
||
prefer to register from the sign-in panel. Until you sign in, the app keeps
|
||
working exactly as it did before — entirely local.
|
||
|
||
### Production
|
||
|
||
```bash
|
||
npm run build # type-checks, then bundles into dist/
|
||
npm start # serves dist/ and the API from one process
|
||
```
|
||
|
||
### Docker
|
||
|
||
The image builds the UI and runs one Node process that serves both the app and
|
||
the API. Only `/data` needs to persist.
|
||
|
||
```bash
|
||
docker build -t luminary .
|
||
docker run -d --name luminary \
|
||
-p 8787:8787 \
|
||
-e LUMINARY_INVITE=our-team \
|
||
-v lumenroom-data:/data \
|
||
luminary
|
||
```
|
||
|
||
The named volume deliberately keeps its original `lumenroom-data` name so an
|
||
existing Luminary catalog upgrades in place.
|
||
|
||
Or with Compose, which wires up the volume and env vars for you:
|
||
|
||
```bash
|
||
LUMINARY_INVITE=our-team docker compose up -d --build
|
||
```
|
||
|
||
The container runs as the unprivileged `node` user (uid 1000), ships a
|
||
`HEALTHCHECK` on `/api/health`, and exposes port 8787. To put it behind a TLS
|
||
proxy, forward `X-Forwarded-Proto: https` so session cookies are marked `Secure`.
|
||
|
||
Back up the catalog by copying the volume:
|
||
|
||
```bash
|
||
docker run --rm -v lumenroom-data:/data -v "$PWD":/backup alpine \
|
||
tar czf /backup/luminary-$(date +%F).tar.gz -C /data .
|
||
```
|
||
|
||
Environment variables:
|
||
|
||
| Variable | Default | Purpose |
|
||
| --- | --- | --- |
|
||
| `PORT` | `8787` | Server port |
|
||
| `LUMINARY_DATA` | `server/data` | Where originals, previews and the database live |
|
||
| `LUMINARY_INVITE` | *(empty)* | Optional shared invite code for new accounts; personal invite links work without it |
|
||
| `LUMINARY_MAX_UPLOAD` | `300 MB` | Upload ceiling (bytes) |
|
||
| `LUMINARY_RAW_EDGE` | `6000` | Long edge of the editable proxy generated for raws |
|
||
| `LUMINARY_RAW_WORKERS` | `4` (capped at cores−1) | Raws demosaiced at once; each worker holds a LibRaw instance |
|
||
| `LUMINARY_RAW_IDLE_MS` | `90000` | Idle decoders are disposed after this, to hand memory back |
|
||
| `LUMINARY_QUOTA_BYTES` | `100 GiB` | Default per-account storage allowance (bytes) |
|
||
| `LUMINARY_QUOTA_WARN_RATIO` | `0.9` | Fraction of the quota that triggers the in-app and email warning |
|
||
| `LUMINARY_PUBLIC_URL` | *(empty)* | Public app URL included in notification emails |
|
||
| `LUMINARY_SMTP_USER` | *(empty)* | Gmail address used as the mail sender |
|
||
| `LUMINARY_SMTP_APP_PASSWORD` | *(empty)* | Gmail app password (not the normal account password) |
|
||
| `LUMINARY_SMTP_FROM` | sender address | Optional From address for notifications |
|
||
|
||
The pre-rebrand `LUMENROOM_*` environment variable names are still accepted as
|
||
fallbacks, so existing deployments can upgrade without changing their config.
|
||
|
||
## Bridge from the Media Team Hub
|
||
|
||
A separate dashboard can hand an event over to this editor without sharing
|
||
passwords or copying the library. The dashboard signs a short-lived token, sends
|
||
the browser to `/api/bridge/login?token=…`, and this server verifies it with the
|
||
shared `BRIDGE_SECRET`, creates or reuses a user by email, imports the event's
|
||
photo list and redirects into the app with that event open. Photo bytes are
|
||
proxied from the dashboard on demand, so the import is metadata only.
|
||
|
||
```bash
|
||
GLENLOCH_URL=https://media.example.org \
|
||
BRIDGE_SECRET=<same value as the dashboard> \
|
||
LUMINARY_INVITE=our-team \
|
||
docker compose up -d --build
|
||
```
|
||
|
||
| Variable | Default | Purpose |
|
||
| --- | --- | --- |
|
||
| `GLENLOCH_URL` | *(empty)* | Dashboard base URL; empty disables the bridge |
|
||
| `BRIDGE_SECRET` | *(empty)* | Shared HMAC secret for bridge tokens |
|
||
| `LUMINARY_BRIDGE_TTL_HOURS` | `12` | How long an imported bridge event survives |
|
||
|
||
The editor shows a banner with **Save to event** — it renders the open photo in
|
||
the browser and stores it on the dashboard event as the edited JPEG — and **Back
|
||
to dashboard**. Imported events and their catalog rows are temporary: expired
|
||
bridge events are swept on the next bridge login. Originals stay on the
|
||
dashboard's media storage; only previews and thumbnails are cached under
|
||
`LUMINARY_DATA`. RAW files are edited on a 4000 px JPEG proxy generated by the
|
||
dashboard and cached here; JPEG/PNG originals are streamed at full size. Bridge accounts have a random password hash, so they can only
|
||
be reached through the dashboard link, not the normal sign-in form.
|
||
|
||
## Features
|
||
|
||
**Library** — events in the sidebar (create, rename, delete, drag to reorder,
|
||
drop photos onto an event to move them), drag photos to reorder within a view,
|
||
star ratings, pick/reject flags, five color labels, filters (rating, unrated,
|
||
flag, labels, "edited only", free text over name/camera/lens/keywords), sorting
|
||
by capture date, import date, name, rating or manual order, multi-select with
|
||
shift-ranges and bulk actions. Right-click any photo for a menu with the star
|
||
rating, flags and color labels plus open, copy/paste settings, export and delete.
|
||
Deleted photos move to a Trash with restore, permanent delete and empty trash.
|
||
Select 2–4 photos and press **C** (or click Compare) for a full-screen survey;
|
||
double-click a frame to develop it. Selected photos can also be grouped into a
|
||
stack (`Stack`, or right-click → Stack selected): the grid collapses a stack to
|
||
one card with a count badge, and clicking the badge expands or collapses it.
|
||
Right-click → Unstack removes the grouping.
|
||
|
||
**Develop** — a WebGL2 multi-pass pipeline, per photo, non-destructive:
|
||
|
||
- white balance, exposure, contrast, highlights/shadows/whites/blacks
|
||
- texture, clarity, dehaze, vibrance, saturation, black & white mix
|
||
- RGB + per-channel tone curves
|
||
- 8-band HSL color mixer, split toning / color grading
|
||
- sharpening, luminance noise reduction
|
||
- vignette, grain
|
||
- crop with nine aspect ratios, straighten, 90° rotation, flips
|
||
- local adjustments (up to four layers): brush, linear gradient and radial
|
||
masks with feather, invert, luminance/hue/saturation ranges, and per-layer
|
||
exposure, contrast, highlights, shadows, temperature, tint and saturation;
|
||
masks follow crops, zoom, healing and lens correction, and Copy mask / Paste
|
||
mask carry one layer between photos
|
||
- full Lensfun lens profiles: distortion, transverse chromatic aberration and
|
||
vignetting from the official calibration database, with manual lens search,
|
||
"Match EXIF lens" auto-detection, per-correction switches and automatic
|
||
edge scaling; focal length and aperture are read from each photo. Save a
|
||
profile as the default for a camera + EXIF lens pair and matching imports
|
||
apply it automatically, the Optics panel can show a draggable before/after
|
||
split for the lens correction, and a Settings view lists and removes saved
|
||
camera-lens defaults
|
||
- manual perspective correction: vertical/horizontal keystone, fine rotation
|
||
and scale, applied while sampling the source
|
||
- spot healing brush (Q): click a blemish, drag to move it, Alt-drag the sample,
|
||
adjustable size and feather
|
||
- scroll-wheel zoom with a Fit / 100% readout, drag to pan, double-click to zoom
|
||
in or back out; right-click the canvas for zoom, crop, copy/paste and export
|
||
- histogram, presets (built-in + saved), history with undo, selective
|
||
copy/paste and batch sync, named snapshots, virtual copies, before/after
|
||
- on-device auto subject, sky and background masks (no model download), an
|
||
ISO/camera-aware noise starting point, edge-aware lens-softness compensation,
|
||
and an approximate paper soft-proof preview
|
||
- HDR merge with alignment, horizontal panorama stitching and focus stacking;
|
||
each result is added to the catalog as a new editable photo
|
||
- browser print layouts (A4, Letter, 5×7) rendered through the develop pipeline
|
||
|
||
**Proofing galleries** — turn any event into a public link (`/g/<token>`) from
|
||
**Share** in the top bar. Clients open it without an account, see only that
|
||
event's live photos, heart favourites, leave per-photo comments, mark a photo
|
||
approved or needing changes, and download the proof. Feedback appears on the
|
||
library grid and in the "Client picks", "Approved" and "Changes" filters.
|
||
Links can be revoked, which drops their picks and feedback.
|
||
|
||
**Team accounts** — the first signup becomes the admin. Admins create single-use
|
||
invite links (`/join/<token>`) with an optional email lock and 1–30 day expiry,
|
||
copy them from the admin panel, see who joined, and revoke a link at any time.
|
||
|
||
**Storage quotas and pruning** — every account starts with a 100 GB quota. At 90%
|
||
the user sees a warning in the app and receives at most one reminder email per
|
||
day. Admins can change a quota in **Administration → Quotas**, request the oldest
|
||
content be deleted, and schedule the cleanup. Scheduling sends the user a
|
||
warning email with the exact events and photos that will be removed, then waits
|
||
24 hours before deleting them. Content added after the warning is never included
|
||
in that prune. Email uses Gmail SMTP with a Google app password, configured in
|
||
the same tab or via the `LUMINARY_SMTP_*` variables above.
|
||
|
||
**Catalog workflow** — editable title, caption, creator, copyright and keyword
|
||
chips with a keyword library and reusable metadata presets. Save the current
|
||
filters and sort as a smart collection. Virtual copies share the master file
|
||
but keep independent edits; named snapshots preserve alternative looks.
|
||
|
||
**Export and print** — format (JPEG/PNG/WebP), quality, resize by long edge or
|
||
percent, filename template (`{name}`, `{date}`, `{time}`, `{index}`), saved
|
||
export recipes, output sharpening, watermark, embedded XMP metadata in JPEGs,
|
||
batch export as one ZIP (or separate files), and browser print layouts.
|
||
Full-resolution export runs through the same renderer.
|
||
|
||
## Lens profile data
|
||
|
||
Lens correction uses the official [Lensfun](https://lensfun.github.io/) database
|
||
and its WebAssembly build (`@neoanaloglabkk/lensfun-wasm`). The runtime assets
|
||
are served from `public/lensfun/`: the library is LGPL-3.0-or-later, the camera
|
||
and lens database is CC BY-SA 3.0, and the bundled notices and license texts sit
|
||
next to the assets. This is a non-commercial project; if the database is reused
|
||
or redistributed, keep the attribution and share-alike terms.
|
||
|
||
Profiles load lazily the first time the Optics panel needs one, so a library
|
||
that never uses them does not download the ~5 MB database.
|
||
|
||
## Raw support
|
||
|
||
The browser cannot decode camera raw, so the server does it:
|
||
|
||
1. The original file is stored byte-for-byte (`server/data/originals`).
|
||
2. LibRaw (`libraw-wasm`) demosaics it with the camera's white balance and
|
||
orientation, and `sharp` encodes an editable JPEG proxy (long edge
|
||
`LUMINARY_RAW_EDGE`).
|
||
3. If LibRaw cannot open a file, the largest JPEG embedded in the container is
|
||
used instead, so exotic or very new cameras still import. The grid marks such
|
||
photos `RAW` and the Info panel reports which engine produced the proxy.
|
||
|
||
Formats: CR2/CR3/CRW, NEF/NRW, ARW/SRF/SR2, ORF, RW2/RWL, RAF, PEF, DNG, SRW,
|
||
3FR, FFF, IIQ, X3F, ERF, K25/KDC, DCR, MOS, MRW, MEF.
|
||
|
||
**Parallel import.** Decoding runs in a small pool of LibRaw workers (default 4,
|
||
`LUMINARY_RAW_WORKERS`) and the browser uploads four files at a time, so a card
|
||
imports several times faster than one file after another. Measured on this repo
|
||
with 8 mixed raws (20 MP average):
|
||
|
||
| Workers | 8 files | Speedup | Peak memory |
|
||
| --- | --- | --- | --- |
|
||
| 1 (serial) | 19.2 s | 1.0× | — |
|
||
| 4 | 5.2 s | 3.7× | ~2.5 GB |
|
||
| 8 | 3.5 s | 5.4× | ~3.5 GB |
|
||
|
||
Raise the worker count on a big machine; keep it low on a small VPS, where each
|
||
worker can hold a few hundred MB while decoding. Workers idle for 90 s are
|
||
disposed and recreated on demand, so a burst of imports does not pin memory
|
||
forever. `GET /api/health` reports the pool size.
|
||
|
||
## Layout
|
||
|
||
```
|
||
src/
|
||
App.tsx state, filtering, sync, drag-and-drop, shortcuts
|
||
gl/renderer.ts WebGL2 pipeline (grade → blur → finish)
|
||
lib/lensfun.ts lazy Lensfun client, profile matching and CPU map math
|
||
lib/ db, api client, edits model, import/export, presets
|
||
components/ library grid, develop, panels, modals
|
||
public/lensfun/ vendored Lensfun WASM runtime, database and licenses
|
||
server/
|
||
index.mjs HTTP API + static hosting
|
||
db.mjs SQLite schema (node:sqlite, no native deps)
|
||
raw.mjs LibRaw decode + embedded-preview fallback
|
||
imaging.mjs sharp encoding, PNG fallback
|
||
```
|
||
|
||
## Limitations
|
||
|
||
- No cloud hosting or tethered capture. Compare is a still survey rather than a
|
||
synchronised zoom/pan view. Merge tools are translation-aligned and aimed at
|
||
bracketed, stacked or horizontal panorama sequences, not handheld multi-row
|
||
composites.
|
||
- Lens profiles are matched from the bundled Lensfun database. A photo whose
|
||
EXIF has no lens name needs a manual profile choice; a profile is built for
|
||
the photo's current focal length and aperture, not interpolated between
|
||
zoom positions. Camera defaults require both a camera and a lens name, and
|
||
only apply when the normalized EXIF pair matches one saved default.
|
||
- Raw editing works on the decoded proxy (6,000 px default), not the full sensor
|
||
mosaic; export size is bounded by the proxy.
|
||
- Temperature/tint are relative to the as-shot white balance.
|
||
- Auto masks are a lightweight on-device saliency/colour estimate, not a
|
||
downloaded segmentation model. They are a starting point that can be
|
||
feathered or inverted; complex hair and foliage edges still need a brush.
|
||
- Soft proofing approximates paper white, black point and a print gamut; it does
|
||
not apply a printer ICC profile. Use the browser print dialog for final ICC
|
||
handling.
|
||
- Denoise auto-profile is an ISO/camera-aware curve over the existing sliders,
|
||
not a calibrated per-sensor noise profile or a learned denoiser.
|
||
- Sync is whole-record: the last writer wins per photo. It is designed for a
|
||
handful of people sharing one catalog, not for concurrent batch workflows.
|
||
- Trash is a soft-delete inside the catalog; there is no automatic catalog
|
||
backup.
|