0cb315ea88
CI / build (push) Has been cancelled
Event photos can now be opened in Lumenroom, a WebGL2 develop module, from the photo editor's Advanced button. The dashboard signs a short-lived token scoped to one user and event; Lumenroom exchanges it, imports the event's photo list and proxies bytes on demand, so nothing is copied and the temporary catalog expires with the bridge session. Saving in Lumenroom renders the photo and writes it back as the event's edited JPEG, with the advanced recipe kept in event_photos.advanced_edit_json. Lumenroom is vendored under lumenroom/ and built as a second compose service, so one clone and `docker compose up -d --build` deploys both apps. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
195 lines
8.1 KiB
Markdown
195 lines
8.1 KiB
Markdown
# Lumenroom
|
||
|
||
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)
|
||
LUMENROOM_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; everyone else registers with `LUMENROOM_INVITE`. 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 lumenroom .
|
||
docker run -d --name lumenroom \
|
||
-p 8787:8787 \
|
||
-e LUMENROOM_INVITE=our-team \
|
||
-v lumenroom-data:/data \
|
||
lumenroom
|
||
```
|
||
|
||
Or with Compose, which wires up the volume and env vars for you:
|
||
|
||
```bash
|
||
LUMENROOM_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/lumenroom-$(date +%F).tar.gz -C /data .
|
||
```
|
||
|
||
Environment variables:
|
||
|
||
| Variable | Default | Purpose |
|
||
| --- | --- | --- |
|
||
| `PORT` | `8787` | Server port |
|
||
| `LUMENROOM_DATA` | `server/data` | Where originals, previews and the database live |
|
||
| `LUMENROOM_INVITE` | *(empty)* | Invite code for new accounts; empty closes registration |
|
||
| `LUMENROOM_MAX_UPLOAD` | `300 MB` | Upload ceiling (bytes) |
|
||
| `LUMENROOM_RAW_EDGE` | `6000` | Long edge of the editable proxy generated for raws |
|
||
| `LUMENROOM_RAW_WORKERS` | `4` (capped at cores−1) | Raws demosaiced at once; each worker holds a LibRaw instance |
|
||
| `LUMENROOM_RAW_IDLE_MS` | `90000` | Idle decoders are disposed after this, to hand memory back |
|
||
|
||
## 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> \
|
||
LUMENROOM_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 |
|
||
| `LUMENROOM_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
|
||
`LUMENROOM_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.
|
||
|
||
**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
|
||
- 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, copy/paste settings,
|
||
before/after
|
||
|
||
**Export** — format (JPEG/PNG/WebP), quality, resize by long edge or percent,
|
||
filename template (`{name}`, `{date}`, `{time}`, `{index}`), batch export of the
|
||
selection, full resolution through the same renderer.
|
||
|
||
## 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
|
||
`LUMENROOM_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,
|
||
`LUMENROOM_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/ db, api client, edits model, import/export, presets
|
||
components/ library grid, develop, panels, modals
|
||
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, masking/brushes, lens corrections, panoramas/HDR merge, or
|
||
tethered capture. Local adjustments are the biggest missing editor feature.
|
||
- 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.
|
||
- 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.
|
||
- File deletion is immediate; there is no trash or catalog backup.
|