Let people add plays from photos; library, editor, compose; full-page PDF

- Replace the static nginx site with a small Node server: serves public/,
  stores plays on a /data volume and exposes a JSON API. Writes need a
  shared UPLOAD_PASSWORD; unpublished plays are hidden without it.
- Page photos (shrunk to <=1.15 MP JPEG in the browser) are transcribed
  one request per page by a Claude vision model (claude-haiku-5-5 by
  default, CLAUDE_MODEL to change) into the play markup, then stitched
  together: speaker spellings unified, gaps in page numbers marked as
  missing pages, failed pages flagged. DAILY_PAGE_LIMIT caps spend.
- New pages: library (play menu), add (upload + progress), editor (text
  next to the photos, checks for [?] readings and one-off names, publish,
  delete). The reader loads plays from the API and remembers the chosen
  role per play; old /?postava= links still work.
- PDF export: text now flows across original pages and prints at the
  on-screen size, so A4 sheets are full instead of half empty; page
  numbers in the footer.
- docker-compose.yml + .env.example for one-click deploys; the 1931 play
  moves to seed/ and is copied into an empty volume on first start.
- Tests: parser leniency, transcription assembly, API end to end with a
  stubbed Claude client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HA82gVRDXpoukzgMFumoJt
This commit is contained in:
agent 2026-11-03 09:43:32 +00:00
parent 2608d10dd2
commit 46aa1236ed
32 changed files with 1761 additions and 160 deletions

19
.env.example Normal file
View file

@ -0,0 +1,19 @@
# Copy to .env (chmod 600) and fill in. Never commit .env.
# API key from https://platform.claude.com (Anthropic API, billed separately from a Claude subscription).
# Without it the app still works; uploaded photos just have to be typed up by hand.
ANTHROPIC_API_KEY=
# Password people need to add and edit plays. Without it uploading is switched off.
UPLOAD_PASSWORD=
# Vision model used for transcription. claude-sonnet-5-5 reads hard pages better at ~20x the price.
CLAUDE_MODEL=claude-haiku-5-5
# Safety cap on pages transcribed per day (all users together), and pages per play.
DAILY_PAGE_LIMIT=300
MAX_PAGES=80
# Host port, and the address it is published on.
PORT=3010
BIND_ADDRESS=127.0.0.1