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

72
public/edit.html Normal file
View file

@ -0,0 +1,72 @@
<!doctype html>
<html lang="cs">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Upravit hru – Divadelní čtečka</title>
<link rel="stylesheet" href="fonts/fonts.css">
<link rel="stylesheet" href="app.css">
<script type="module" src="edit.js"></script>
</head>
<body class="page-edit">
<header class="topbar">
<nav class="crumbs"><a href="./">← Všechny hry</a><a id="preview" target="_blank">Otevřít ve čtečce ↗</a></nav>
<div class="topbar-actions">
<span class="muted small" id="saved"></span>
<button id="save" class="primary">Uložit</button>
</div>
</header>
<main class="wrap wide">
<p class="error" id="error" hidden></p>
<div class="progress" id="progress" hidden>
<progress id="bar" max="1" value="0"></progress>
<p id="status"></p>
</div>
<div class="meta-row">
<label class="field grow"><span>Název</span><input id="title" maxlength="200"></label>
<label class="field grow"><span>Poznámka</span><input id="note" maxlength="500"></label>
<label class="field toggle"><input type="checkbox" id="published"> <span>Zveřejněno</span></label>
</div>
<div class="editor">
<section class="editor-text">
<textarea id="text" spellcheck="false" aria-label="Text hry"></textarea>
<details class="help">
<summary>Jak se text zapisuje</summary>
<table>
<tr><td><code>=5</code></td><td>začátek strany 5 (<code>!7</code> = strana 7 chybí)</td></tr>
<tr><td><code>@Lída</code></td><td>replika postavy Lída; další řádky jsou její text</td></tr>
<tr><td><code>&gt;(Odejde)</code></td><td>scénická poznámka; pokračování na dalším řádku začíná <code>&gt; </code></td></tr>
<tr><td><code>&gt;&nbsp;&nbsp;verš</code></td><td>verš / píseň (dvě mezery za <code>&gt;</code>)</td></tr>
<tr><td><code>#Pokoj u Lysáků</code></td><td>popis scény u levého okraje</td></tr>
<tr><td><code>~O p o n a</code></td><td>řádek na střed</td></tr>
<tr><td><code>.</code></td><td>prázdný řádek; ukončí repliku</td></tr>
</table>
<p>Rozdělené slovo na konci řádku nechte se spojovníkem (<code>nepří-</code>), čtečka ho spojí. Pomlčku jako interpunkci na konci řádku pište jako <code>–</code>.</p>
</details>
</section>
<aside class="editor-side">
<div class="photo" id="photo-box" hidden>
<div class="photo-nav">
<button id="img-prev" title="Předchozí fotka">◀</button>
<span id="img-label"></span>
<button id="img-next" title="Další fotka">▶</button>
<button id="img-jump" title="Najít tuto stranu v textu">Najít v textu</button>
</div>
<img id="img" alt="Fotka strany">
</div>
<div class="checks">
<h2>Kontrola</h2>
<p id="summary" class="muted"></p>
<ul id="issues"></ul>
<button id="retry" hidden>Přepsat nepovedené strany znovu</button>
</div>
<div class="danger">
<button id="delete">Smazat hru</button>
</div>
</aside>
</div>
</main>
</body>
</html>