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

43
public/add.html Normal file
View file

@ -0,0 +1,43 @@
<!doctype html>
<html lang="cs">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Přidat hru – Divadelní čtečka</title>
<link rel="stylesheet" href="app.css">
<script type="module" src="add.js"></script>
</head>
<body class="page-add">
<header class="topbar">
<nav class="crumbs"><a href="./">← Všechny hry</a></nav>
<h1>Přidat hru</h1>
</header>
<main class="wrap">
<p class="error" id="disabled" hidden></p>
<form id="form" class="stack">
<label class="field"><span>Název hry</span><input id="title" required maxlength="200" placeholder="např. Lucerna"></label>
<label class="field"><span>Poznámka <small class="muted">(nepovinné)</small></span><input id="note" maxlength="500" placeholder="autor, rok, co chybí…"></label>
<fieldset class="field">
<legend>Fotky stran</legend>
<p class="muted" id="ai-note">Každou stranu přečte umělá inteligence (Claude) a přepíše ji do textu. Text pak zkontrolujete a opravíte v editoru, než hru zveřejníte.</p>
<label class="dropzone" id="drop">
<input type="file" id="files" accept="image/*" multiple>
<span><b>Vyberte fotky</b> nebo je sem přetáhněte. Jedna fotka = jedna strana.</span>
</label>
<p class="muted small">Strany se seřadí podle názvu souboru; pořadí můžete změnit šipkami. Fotky se před nahráním zmenší.</p>
<ol class="thumbs" id="thumbs"></ol>
</fieldset>
<div class="actions">
<button class="primary" id="go" type="submit">Nahrát a přepsat</button>
</div>
<div class="progress" id="progress" hidden>
<progress id="bar" max="1" value="0"></progress>
<p id="status"></p>
</div>
<p class="error" id="error" hidden></p>
</form>
</main>
</body>
</html>