Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5b1c58ba2 | ||
|
|
64f55a8b1f | ||
|
|
a08b02c34b | ||
|
|
6d96900d81 | ||
|
|
d586fbd8ce | ||
|
|
b80dded55d | ||
|
|
fd47910d09 | ||
|
|
01b5606a3b | ||
|
|
fa17187af4 | ||
|
|
b1474bc33d | ||
|
|
ec596d442e | ||
|
|
bd9ffe6faa | ||
|
|
3389ba17f4 | ||
|
|
c05cea3a6d | ||
|
|
4fe61971e4 | ||
|
|
c3033479b5 | ||
|
|
2851c7d936 | ||
|
|
22ae3a68d6 | ||
|
|
dfa236390d | ||
|
|
b2467b87f5 | ||
|
|
4fed048843 | ||
|
|
f466df2c5c | ||
|
|
25da870601 | ||
|
|
fb24d171ae | ||
|
|
5a9d7735d4 | ||
|
|
4042fe6a64 | ||
|
|
7590be66a5 | ||
|
|
08e8875cb5 | ||
|
|
7a49e66c37 |
No files matched your search
@@ -1,3 +1,20 @@
|
||||
# Relative paths are resolved from the project directory.
|
||||
SENDEWERK_DB_PATH=.data/sendewerk.sqlite
|
||||
SENDEWERK_UPLOAD_DIR=.data/uploads
|
||||
SENDEWERK_MAIL_OUTBOX_DIR=.data/mail-outbox
|
||||
BODY_SIZE_LIMIT=6M
|
||||
|
||||
# Generate this locally and insert it here as described in README.md. Never commit .env.
|
||||
SENDEWERK_SETUP_TOKEN=
|
||||
SENDEWERK_APP_ORIGIN=http://localhost:5173
|
||||
|
||||
# "local" writes messages to the outbox and never contacts a mail server.
|
||||
SENDEWERK_MAIL_TRANSPORT=local
|
||||
SENDEWERK_MAIL_FROM=Sendewerk <sendewerk@localhost>
|
||||
|
||||
# Required only when SENDEWERK_MAIL_TRANSPORT=smtp is explicitly selected.
|
||||
SENDEWERK_SMTP_HOST=
|
||||
SENDEWERK_SMTP_PORT=587
|
||||
SENDEWERK_SMTP_SECURE=false
|
||||
SENDEWERK_SMTP_USER=
|
||||
SENDEWERK_SMTP_PASSWORD=
|
||||
@@ -3,7 +3,7 @@
|
||||
"title": "Sendewerk",
|
||||
"description": "Redaktionelle Planung und Durchführung von heinzlive-Sendungen.",
|
||||
"tagline": "Vom Fundstück bis zur Livesendung",
|
||||
"version": "0.1.0",
|
||||
"version": "0.7.2",
|
||||
"healthCheckPath": "/healthz",
|
||||
"httpPort": 3000,
|
||||
"addons": {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
Sendewerk ist die redaktionelle Webanwendung für den Weg vom vorbereiteten
|
||||
Inhalt bis zur moderierten und archivierten Sendung. Der aktuelle Stand umfasst
|
||||
ausschließlich Etappe 1: technisches Grundgerüst, persistente Beispieldaten
|
||||
und gekennzeichnete Gestaltungsvorschauen. Anmeldung, Bearbeitung und echte
|
||||
Live-Steuerung folgen in späteren Etappen.
|
||||
Etappe 1 bis 5: technisches Grundgerüst, Anmeldung und Rollen, einen
|
||||
persistenten Fundus, den Sendungsbaukasten sowie Live-Steuerung und eine
|
||||
abgesicherte Präsentationsausgabe. Abschluss und Archivierung folgen in Etappe 6.
|
||||
|
||||
## Voraussetzungen
|
||||
|
||||
@@ -20,6 +20,9 @@ nicht erforderlich.
|
||||
```sh
|
||||
npm ci
|
||||
cp .env.example .env
|
||||
SETUP_TOKEN="$(openssl rand -hex 32)"
|
||||
sed -i "s/^SENDEWERK_SETUP_TOKEN=.*/SENDEWERK_SETUP_TOKEN=$SETUP_TOKEN/" .env
|
||||
printf 'Betreiber-Setup-Token: %s\n' "$SETUP_TOKEN"
|
||||
npm run setup
|
||||
npm run dev
|
||||
```
|
||||
@@ -29,18 +32,125 @@ erstellt die konfigurierten Verzeichnisse, führt ausstehende Migrationen aus
|
||||
und lädt den reproduzierbaren Beispieldatensatz. Der Seed darf beliebig oft
|
||||
ausgeführt werden und ersetzt nur die von ihm verwalteten Beispieldaten.
|
||||
|
||||
Beim ersten Aufruf verlangt `/setup` den ausgegebenen Wert aus
|
||||
`SENDEWERK_SETUP_TOKEN` und legt genau einen Barkeeper an. Der Befehl schreibt
|
||||
den Wert in die nicht versionierte `.env`, damit auch spätere lokale Starts
|
||||
dieselbe Konfiguration verwenden. Nach erfolgreicher Einrichtung ist `/setup`
|
||||
dauerhaft geschlossen und der Token kann aus `.env` entfernt werden. Der Seed
|
||||
enthält bewusst kein Konto und kein Standardpasswort.
|
||||
|
||||
## Konfiguration
|
||||
|
||||
| Variable | Vorgabe | Bedeutung |
|
||||
| ---------------------- | ------------------------ | ----------------------------------- |
|
||||
| --------------------------- | ------------------------ | ---------------------------------------------------- |
|
||||
| `SENDEWERK_DB_PATH` | `.data/sendewerk.sqlite` | Pfad zur persistenten SQLite-Datei |
|
||||
| `SENDEWERK_UPLOAD_DIR` | `.data/uploads` | Persistentes Upload-Verzeichnis |
|
||||
| `SENDEWERK_MAIL_OUTBOX_DIR` | `.data/mail-outbox` | Lokale, nicht öffentlich ausgelieferte Testmail |
|
||||
| `BODY_SIZE_LIMIT` | `6M` | Requestlimit für private Bild-Uploads bis 5 MB |
|
||||
| `SENDEWERK_SETUP_TOKEN` | keine | einmaliges Betreibergeheimnis, mindestens 32 Zeichen |
|
||||
| `SENDEWERK_APP_ORIGIN` | `http://localhost:5173` | feste Origin für Links und Cookie-Sicherheit |
|
||||
| `SENDEWERK_MAIL_TRANSPORT` | `local` | `local` oder ausdrücklich `smtp` |
|
||||
| `SENDEWERK_MAIL_FROM` | lokaler Absender | Absender; bei SMTP verpflichtend |
|
||||
| `SENDEWERK_SMTP_HOST` | keine | SMTP-Server, nur im SMTP-Modus |
|
||||
| `SENDEWERK_SMTP_PORT` | `587` | SMTP-Port |
|
||||
| `SENDEWERK_SMTP_SECURE` | `false` | `true` für implizites TLS, üblicherweise Port 465 |
|
||||
| `SENDEWERK_SMTP_USER` | keine | optionaler SMTP-Benutzer |
|
||||
| `SENDEWERK_SMTP_PASSWORD` | keine | optionales SMTP-Passwort |
|
||||
| `HOST` | adapterabhängig | Bind-Adresse des Produktionsservers |
|
||||
| `PORT` | `3000` | Port des Produktionsservers |
|
||||
|
||||
Relative Sendewerk-Pfade werden vom Projektverzeichnis aus aufgelöst. In
|
||||
Cloudron liegen Datenbank und Uploads unter `/app/data`.
|
||||
|
||||
Der Vorgabemodus `local` baut keine Netzwerkverbindung auf. Einladungen und
|
||||
Passwort-Resets landen als JSON-Dateien in `.data/mail-outbox`; die enthaltenen
|
||||
Links sind Geheimnisse und dürfen nicht veröffentlicht werden. Echter Versand
|
||||
findet nur statt, wenn `SENDEWERK_MAIL_TRANSPORT=smtp` und die SMTP-Werte
|
||||
explizit gesetzt sind.
|
||||
|
||||
## Inhalte und private Bilder
|
||||
|
||||
Neue Gedanken oder Links lassen sich im Eingang schnell erfassen. Im Fundus
|
||||
stehen leere Pieces sowie Vorlagen für Gespräch, Reaction/Fundstück und
|
||||
Interaktion bereit. Der Editor speichert Änderungen nach kurzer Pause
|
||||
automatisch; ein sichtbarer Status meldet Erfolg, Fehler oder eine parallele
|
||||
Änderung. In diesem Fall muss die Seite neu geladen werden, bevor erneut
|
||||
gespeichert wird.
|
||||
|
||||
Bereits gesendete Pieces und Pieces mit einer Einplanung in einer noch nicht
|
||||
abgeschlossenen Sendung sind standardmäßig ausgeblendet. Als gesendet gilt nur
|
||||
eine erledigte Verwendung in einer abgeschlossenen Sendung; übersprungene oder
|
||||
reservierte Inhalte gelten nicht als gesendet. Über **Auch verwendete Inhalte
|
||||
zeigen** und **Auch eingeplante Inhalte zeigen** lassen sich beide Gruppen
|
||||
unabhängig einblenden. Dann erscheinen auch Datum, Sendung und die aufklappbare
|
||||
Verwendungshistorie.
|
||||
|
||||
Markdown ist in Einleitung, Recherche, Moderation, Überleitung und Präsentation
|
||||
möglich. Die Ausgabe wird serverseitig auf eine begrenzte Auswahl sicherer
|
||||
Elemente und Links reduziert. Bilder dürfen höchstens 5 MB groß sein und müssen
|
||||
als JPEG, PNG, WebP oder GIF erkannt werden. Sie liegen im konfigurierten
|
||||
Uploadverzeichnis und sind nur über eine angemeldete Route erreichbar.
|
||||
|
||||
Für die Präsentation kann ein Piece alternativ genau eine seiner vorhandenen
|
||||
Quellen als Linkkarte oder Video verwenden. Linktitel, Anreißer und Bildadresse
|
||||
lassen sich manuell korrigieren. **Vorschau laden** ruft Metadaten ausdrücklich
|
||||
neu ab; manuell geänderte Felder werden dabei nicht überschrieben. Die
|
||||
**Präsentation testen**-Ansicht öffnet den aktuellen Piece-Inhalt isoliert und
|
||||
verändert weder eine Sendung noch deren laufende Ausgabe.
|
||||
|
||||
## Sendungen planen
|
||||
|
||||
Unter **Sendungen** lässt sich ein neuer Stream leer, mit dem Standardablauf
|
||||
oder als Spieleabend anlegen. Abschnitte sind frei benennbar und können eine
|
||||
explizite Dauer erhalten; andernfalls ergibt sich ihre Dauer aus den
|
||||
eingeplanten Pieces. Die Reservebank zählt nie zur Planzeit.
|
||||
|
||||
Der sendefertige Fundus steht neben dem Ablauf. Pieces können mehrfach
|
||||
eingeplant und je Verwendung mit eigenem Titel, eigener Dauer und eigenen
|
||||
Redaktionstexten bearbeitet werden, ohne das Original zu verändern. Das
|
||||
Stift-Symbol öffnet dafür einen auch mobil scrollbaren Editor-Dialog. **Aus
|
||||
Fundus aktualisieren** übernimmt auf Wunsch Titel, Dauer und Redaktionstexte des
|
||||
aktuellen Originals; eigene Notizen, Live-Status und gemessene Zeiten bleiben
|
||||
erhalten. Abschnitte und Verwendungen lassen sich per Drag-and-drop sowie
|
||||
gleichwertig mit sichtbaren Schaltflächen und Auswahlfeldern verschieben.
|
||||
Twitch-Titel und Ankündigung sind kopierbar. Gleichzeitige Änderungen werden
|
||||
über die Revision der gesamten Sendung erkannt und nicht still überschrieben.
|
||||
|
||||
Die Quellspalte blendet gesendete und bereits in derselben Sendung eingeplante
|
||||
Originale zunächst aus; beide Gruppen lassen sich unabhängig wieder anzeigen.
|
||||
Eine konkrete Einplanung kann direkt hinter sich dupliziert werden. Dabei
|
||||
bleiben ihre angepassten Texte und ihre Dauer erhalten, während Live-Status und
|
||||
gemessene Zeiten neu beginnen. **Piece duplizieren** im Fundus erzeugt dagegen
|
||||
weiterhin einen eigenständigen Fundusinhalt.
|
||||
|
||||
## Live moderieren und präsentieren
|
||||
|
||||
Die Live-Steuerung öffnet sich aus einer geplanten Sendung. Sie zeigt
|
||||
Einleitung, Moderationsstichpunkte und Überleitung in einstellbarer
|
||||
Prompter-Schrift; die private Recherche bleibt standardmäßig geschlossen.
|
||||
Zeiten und Ablaufleiste können ausgeblendet werden. Schriftgröße, Sichtbarkeit
|
||||
und Leseposition bleiben im Browser erhalten.
|
||||
|
||||
Start, Erledigen, Überspringen und Zurück werden persistent mit tatsächlichen
|
||||
Zeitintervallen gespeichert. Wiederholte Befehle erzeugen keine doppelte
|
||||
Zeitbuchung. Offene Pieces und die Reserve lassen sich während der Sendung
|
||||
sortieren beziehungsweise als nächster Beitrag einfügen.
|
||||
|
||||
Das separate Präsentationsfenster unter `/heinzlive/...` verwendet einen langen,
|
||||
widerrufbaren Zufallstoken. Es ändert sich ausschließlich durch die Aktion
|
||||
**Präsentieren** und erhält nur den bei der Einplanung gespeicherten Text-, Link-
|
||||
oder Video-Snapshot. YouTube- und TikTok-Adressen werden auf validierte IDs
|
||||
reduziert und ohne Autoplay in offiziellen Player-Iframes dargestellt. Andere
|
||||
oder unvollständige Videoquellen erscheinen als Linkkarte. Recherche,
|
||||
Moderationsnotizen, eigene Notizen, Kontodaten und interne Dateipfade werden
|
||||
weder im HTML noch im JSON-Zustand ausgeliefert. Der Token ist ein
|
||||
Zugangsgeheimnis und darf nicht weitergegeben oder protokolliert werden.
|
||||
|
||||
Metadaten und externe Vorschaubilder werden ausschließlich serverseitig mit
|
||||
DNS-, Redirect-, Zeit- und Größenlimits abgerufen. Private und lokale
|
||||
Netzwerkziele sind gesperrt. Eingebettetes HTML oder Skripte einer Quellseite
|
||||
werden nicht übernommen.
|
||||
|
||||
## Befehle
|
||||
|
||||
| Befehl | Zweck |
|
||||
@@ -48,7 +158,7 @@ Cloudron liegen Datenbank und Uploads unter `/app/data`.
|
||||
| `npm run setup` | Verzeichnisse, Migrationen und Seed für lokale Entwicklung |
|
||||
| `npm run db:migrate` | Ausstehende Migrationen atomar ausführen |
|
||||
| `npm run db:seed` | Reproduzierbare Beispieldaten laden |
|
||||
| `npm run dev` | Entwicklungsserver starten |
|
||||
| `npm run dev` | Migrationen ausführen und Entwicklungsserver starten |
|
||||
| `npm run check` | Svelte- und TypeScript-Prüfung |
|
||||
| `npm run lint` | Formatierung und ESLint prüfen |
|
||||
| `npm test` | Verhaltenstests mit temporärer, getrennter Datenbank |
|
||||
@@ -61,6 +171,7 @@ Cloudron liegen Datenbank und Uploads unter `/app/data`.
|
||||
```sh
|
||||
npm ci
|
||||
npm run setup
|
||||
export SENDEWERK_APP_ORIGIN=http://localhost:3000
|
||||
npm run build
|
||||
HOST=127.0.0.1 PORT=3000 npm start
|
||||
```
|
||||
@@ -68,6 +179,12 @@ HOST=127.0.0.1 PORT=3000 npm start
|
||||
Der Healthcheck liegt unter <http://localhost:3000/healthz> und prüft auch den
|
||||
Datenbankzugriff.
|
||||
|
||||
Für lokales HTTP wird das Sitzungscookie gezielt ohne `Secure` gesetzt, bleibt
|
||||
aber `HttpOnly` und `SameSite=Lax`. Bei einer `https:`-Origin ist `Secure`
|
||||
automatisch aktiv. Die Build-Origin muss beim lokalen Produktionsbuild mit der
|
||||
später verwendeten Browser-Origin übereinstimmen; SvelteKits Origin-Prüfung
|
||||
bleibt aktiv.
|
||||
|
||||
Vor der ersten Browserprüfung wird der Testbrowser einmalig installiert:
|
||||
|
||||
```sh
|
||||
@@ -82,9 +199,17 @@ Das frühe Cloudron-Paket besteht aus `Dockerfile`, `CloudronManifest.json` und
|
||||
|
||||
```sh
|
||||
docker build -t sendewerk:local .
|
||||
docker run --rm -p 3000:3000 -v sendewerk-data:/app/data sendewerk:local
|
||||
docker run --rm -p 3000:3000 \
|
||||
-e SENDEWERK_APP_ORIGIN=http://localhost:3000 \
|
||||
-e SENDEWERK_SETUP_TOKEN="$(openssl rand -hex 32)" \
|
||||
-v sendewerk-data:/app/data sendewerk:local
|
||||
```
|
||||
|
||||
Auf Cloudron muss das Betreiber-Setup-Token vor dem ersten Browseraufruf als
|
||||
Umgebungsvariable gesetzt werden. `CLOUDRON_APP_ORIGIN` liefert dort die feste
|
||||
HTTPS-Origin. SMTP-Zugangsdaten werden ebenfalls ausschließlich als
|
||||
Laufzeitvariablen gesetzt, nicht in Manifest oder Image geschrieben.
|
||||
|
||||
Das ersetzt keinen Test auf einem echten Cloudron. Insbesondere Addon-Backup,
|
||||
Restore, Proxy-Origin und das read-only Laufzeitdateisystem können erst dort
|
||||
abschließend geprüft werden.
|
||||
@@ -101,5 +226,7 @@ Medien und redaktionellen Inhalten werden dadurch nicht verändert.
|
||||
|
||||
Die direkten Laufzeit- und Werkzeugabhängigkeiten verwenden MIT- oder
|
||||
Apache-2.0-Lizenzen: Svelte/SvelteKit, Vite, Vitest, ESLint und
|
||||
`better-sqlite3` sind MIT-lizenziert; TypeScript und Playwright stehen unter
|
||||
Apache-2.0. Die Lockdatei fixiert den tatsächlich installierten Baum.
|
||||
`better-sqlite3`, `@node-rs/argon2`, Marked, sanitize-html, file-type und
|
||||
Metascraper sind MIT-lizenziert; Nodemailer verwendet MIT-0, TypeScript und
|
||||
Playwright stehen unter Apache-2.0. Die Lockdatei fixiert den tatsächlich
|
||||
installierten Baum.
|
||||
@@ -0,0 +1,11 @@
|
||||
# Third-party notices
|
||||
|
||||
## Font Awesome Pro Plus 7.0.0
|
||||
|
||||
The icon metadata in `src/lib/icons/classic-regular.ts` and the SVG sprite in
|
||||
`static/icons/classic-regular.svg` are derived from Font Awesome Pro Plus 7.0.0
|
||||
Classic Regular. Font Awesome Pro is commercial software and remains subject to
|
||||
the Font Awesome Pro commercial license:
|
||||
https://fontawesome.com/license
|
||||
|
||||
The Sendewerk MIT license does not apply to that icon data.
|
||||
+600
-3
@@ -1,9 +1,102 @@
|
||||
# Abnahme
|
||||
|
||||
## Wartungsrelease 0.7.2
|
||||
|
||||
| Bereich | Nachweis | Stand |
|
||||
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| RSS-Auswahl im Eingang (#16) | Chromium wählt zwei Beiträge über Quellenfilter und zwei Seiten, öffnet den Originallink ohne Umschalten und importiert nur die Auswahl | erfüllt am 26.10.2026 |
|
||||
| Live-Menü nach Nutzerabsicht (#18) | Chromium prüft laufenden, pausierten und beendeten Zustand, direkte Timersteuerung, eingeklappte Ausgabe und erreichbare Navigation | erfüllt am 26.10.2026 |
|
||||
| RSS-/API-Verwaltung im Katalogstil (#21) | Chromium legt einen Feed an und bearbeitet ihn; API-Zugang, einmaliges Tokenkopieren und Berechtigungsänderung geprüft | erfüllt am 26.10.2026 |
|
||||
| Responsive Gestaltung und Farbschemata | RSS-Auswahl und Feed-Dialog mobil/dunkel, Verwaltung desktop/hell, Live-Menü mobil und bei 670 × 450 Pixeln geprüft | erfüllt am 26.10.2026 |
|
||||
| Erhalt von Daten, Rechten und Sicherheitslogik | 13 gezielte Feed-/Live-/Zugangstests sowie vollständiger Verhaltenstestlauf; keine Schemaänderung | erfüllt am 26.10.2026 |
|
||||
|
||||
- `npm test`: 60 von 60 Verhaltenstests erfolgreich.
|
||||
- `npm run lint`: erfolgreich.
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen.
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`.
|
||||
- `npm run test:e2e`: 20 von 20 Chromium-Abläufen erfolgreich.
|
||||
- Andere Browser und echte Mobilgeräte: offen.
|
||||
|
||||
## Wartungsrelease 0.7.1
|
||||
|
||||
| Bereich | Nachweis | Stand |
|
||||
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
|
||||
| Abschnittsdauer und Rückkehr zu früheren Pieces (#1) | Live-Verhaltenstests für geänderte Plandauer, Wiederaufnahme, Abschnittslaufzeit und Gesamtzeit; Chromium-Ablauf | erfüllt am 26.10.2026 |
|
||||
| Mobiler Live-Ablauf und Metadaten (#3, #13) | mobile Live-Regie ohne horizontalen Überlauf; viewportgebundenes Sheet, Safe-Area-/Standalone-Basis und Fokus in Chromium | Chromium erfüllt; Safari und installierte iOS-Webapp offen |
|
||||
| Mobile Sendungskarten (#5) | responsive Karten im vollständigen Chromium-Lauf bei 390 Pixeln geöffnet | erfüllt am 26.10.2026 |
|
||||
| Vorbereitung nach Einplanung (#6, #15) | Migration und Servertest für konkrete Usage-Snapshots; Chromium öffnet die Usage und entfernt sie nach „sendefertig“ | erfüllt am 26.10.2026 |
|
||||
| Kontextabhängige Präsentation (#8) | vier serverseitig getrennte Modi; Fundus-/Usage-Vorschauen sowie Link-, Video-, Text-/Bildausgabe in Chromium | erfüllt am 26.10.2026 |
|
||||
| Gastansicht und Freigaben (#11, #12) | gestalteter Einzeldialog, Verwaltungsreihenfolge und Kartenpadding per Chromium; Tokenersatz mit Invalidierungstest | erfüllt am 26.10.2026 |
|
||||
| Iconsuche (#14) | Suchfokus innerhalb der öffnenden Bedienaktion; Chromium bei mobilen und breiten Ansichten | erfüllt am 26.10.2026 |
|
||||
|
||||
- `npm test`: 60 von 60 Verhaltenstests erfolgreich.
|
||||
- `npm run lint`: erfolgreich.
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen.
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`.
|
||||
- `npm run test:e2e`: 19 von 19 Chromium-Abläufen erfolgreich.
|
||||
- Safari auf echtem iOS-Gerät: offen.
|
||||
- Installierte Webapp auf echtem iOS-Gerät: separat offen.
|
||||
|
||||
## Etappe 7
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Feedverwaltung und geplanter/manueller Abruf | Barkeeper-Oberfläche, Prozess-Scheduler und gemeinsame Abruffunktion | erfüllt am 25.10.2026 |
|
||||
| Getrennter Vorschau-Eingang | RSS-Beiträge erscheinen separat und werden nur nach Mehrfachauswahl zu Pieces | erfüllt am 25.10.2026 |
|
||||
| Kategoriezuordnung und Herkunft | Auswahlkategorien oder Feed-Standard sowie Original-URL als Piece-Quelle im Verhaltenstest | erfüllt am 25.10.2026 |
|
||||
| Dubletten und dauerhaftes Verwerfen | wiederholter Testabruf erzeugt keinen zweiten Eintrag und stellt Verworfenes nicht wieder her | erfüllt am 25.10.2026 |
|
||||
| HTML-Bereinigung und Abrufgrenzen | Testfeed entfernt fremdes HTML; Loopback wird vor Request blockiert; Größe, Zeit, Redirects und Eintragszahl sind begrenzt | erfüllt am 25.10.2026 |
|
||||
| Fehlerisolation | defekter lokaler Testfeed wird protokolliert, weiterer fälliger Feed trotzdem importiert | erfüllt am 25.10.2026 |
|
||||
| Versionierte REST-API und OpenAPI | `/api/v1` für Pieces, Sendungen und Einplanungen; `/api/v1/openapi.json` | erfüllt am 25.10.2026 |
|
||||
| Begrenzte und widerrufbare Zugänge | gehashte Tokens; Verhaltenstest für Lesen, verweigertes Schreiben und sofortigen Widerruf | erfüllt am 25.10.2026 |
|
||||
| Änderungsnachweis und Idempotenz | Audit-Ereignisse und persistente Idempotenz; identische Wiederholung liefert dasselbe Ergebnis | erfüllt am 25.10.2026 |
|
||||
| API-Rundlauf | echter HTTP-Test: lesen, anlegen, ändern, erneut lesen, einplanen und sortieren | erfüllt am 25.10.2026 |
|
||||
| Nutzung ohne KI | RSS und API sind optional; bestehende Redaktion funktioniert unverändert ohne externen Client | erfüllt am 25.10.2026 |
|
||||
| Konkrete ChatGPT-/Codex-Anbindung | keine Clientumgebung oder Zugangsdaten vorhanden | offen |
|
||||
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen.
|
||||
- `npm test`: 58 von 58 Verhaltenstests erfolgreich.
|
||||
- Gezielte Etappe-7-Tests: 6 von 6 erfolgreich.
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`.
|
||||
- `npm audit --omit=dev`: 0 gemeldete Schwachstellen.
|
||||
- Gezielte Chromium-Prüfung: Desktop-Verwaltung, mobiler Eingang und kompletter
|
||||
HTTP-API-Rundlauf erfolgreich, keine Konsolenfehler.
|
||||
- `npm run test:e2e`: auf dem Standardport wegen eines bereits laufenden fremden
|
||||
Prozesses nicht startbar; identische temporäre Konfiguration auf Port 4188 mit
|
||||
16 von 18 erfolgreichen Abläufen. Bekannte Fehler bleiben bei Live-Zeitanzeige
|
||||
und Abschluss/Freigabe bestehen.
|
||||
- `npm run lint`: nicht erfolgreich wegen acht bereits vorhandener
|
||||
Prettier-Abweichungen außerhalb der Etappe-7-Dateien; geänderte Dateien wurden
|
||||
separat formatiert.
|
||||
- Dokumentationsstatus: **API/MCP getestet, Client-Anbindung offen**. Konkret ist
|
||||
die REST-API getestet; ein zusätzlicher MCP-Adapter wurde nicht benötigt und
|
||||
keine echte ChatGPT-/Codex-Verbindung hergestellt.
|
||||
|
||||
## Wartungsrelease 0.6.1
|
||||
|
||||
| Bereich | Stand |
|
||||
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
||||
| Live-Timer, Kopfzeile, Drawer und Positionsanzeige | behoben |
|
||||
| Mobile Formulare und Iconsuche | behoben |
|
||||
| Vorbereitungsaufwand und Übersicht | behoben |
|
||||
| Bild-Präsentationsmodus | behoben |
|
||||
| Twitch-Tags je Abschnitt | behoben |
|
||||
| Sendungskarten und Gastabstände | behoben |
|
||||
| Gemeinsamer Freigabedialog einschließlich Live-Regie | behoben |
|
||||
| Editorzustand und Drag-and-drop | bestehende zustandserhaltende bzw. alternative Bedienwege unverändert; Browserprüfung offen |
|
||||
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen.
|
||||
- `npm test`: 52 von 52 Verhaltenstests erfolgreich.
|
||||
- `npm run build`: erfolgreich.
|
||||
- `npm run test:e2e`: zweiter Lauf mit 14 erfolgreichen Abläufen; Live-Regie und
|
||||
Abschluss/Freigaben schlugen fehl, zwei nachfolgende Abläufe wurden wegen des
|
||||
120-Sekunden-Zeitlimits nicht mehr ausgeführt. Die Browsermatrix ist offen.
|
||||
- Safari auf echtem iOS-Gerät: nicht verfügbar.
|
||||
|
||||
## Etappe 1
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ---------------------------- |
|
||||
| ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
|
||||
| Frischer Checkout startet ohne Cloudron | `npm ci` erfolgreich; README-Setup und lokaler Produktionsstart ausgeführt | erfüllt am 21.10.2026 |
|
||||
| Typprüfung und Build erfolgreich | `npm run check`, `npm run build` | erfüllt am 21.10.2026 |
|
||||
| Theme bleibt nach Neuladen erhalten | Playwright: System auf Hell wechseln, Reload, DOM und Schalterzustand prüfen | erfüllt am 21.10.2026 |
|
||||
@@ -11,7 +104,8 @@
|
||||
| Migration wiederholt ausführbar | lokal mehrfach ausgeführt; Verhaltenstest führt Migration zweimal in temporärer DB aus | erfüllt am 21.10.2026 |
|
||||
| Seed reproduzierbar | lokal und im Verhaltenstest zweimal ausgeführt; danach 4 Pieces, 1 Sendung und 3 Verwendungen | erfüllt am 21.10.2026 |
|
||||
| Tests verwenden getrennte Daten | Vitest und Playwright erzeugen je eigene Datenbank im Betriebssystem-Tempdir | erfüllt am 21.10.2026 |
|
||||
| Desktop und Smartphone ohne horizontales Scrollen | 4 Playwright-Abläufe; 1440x1000, 1280x900 und 390x844; Screenshots visuell kontrolliert | erfüllt am 21.10.2026 |
|
||||
| Desktop und Smartphone ohne horizontales Scrollen | 8 Playwright-Abläufe bei 390, 768, 960, 1280 und 1440 Pixeln; Screenshots visuell kontrolliert | erfüllt am 21.10.2026 |
|
||||
| Kompakte Arbeitsoberfläche in beiden Farbmodi | 390, 768 und 1440 Pixel jeweils in Light/Dark; einspaltige Mobilkarten, lange Titel, Metadatenumbrüche und Leerzustände | erfüllt am 21.10.2026 |
|
||||
| Cloudron-Pfade und Healthcheck vorbereitet | Manifestpfad `/app/data/sendewerk.sqlite`, `/healthz`, `start.sh`; JSON-Kernfelder und Bash-Syntax geprüft | vorbereitet; Container offen |
|
||||
| Echte Cloudron-Prüfung | Installation, Backup/Restore, Proxy und read-only Laufzeit | offen, kein Serverzugang |
|
||||
|
||||
@@ -23,7 +117,9 @@
|
||||
- `npm run lint`: erfolgreich
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- `npm run test:e2e`: 4 von 4 Browsertests erfolgreich
|
||||
- `npm run test:e2e`: 8 von 8 Browsertests erfolgreich; 390, 768 und 1440 Pixel
|
||||
jeweils in Light- und Darkmode sowie Tastaturbedienung, feste Navigation,
|
||||
einspaltige Funduskarten, lange Inhalte und Überläufe geprüft
|
||||
- Zwei getrennte `npm start`-Läufe: Healthcheck und persistente Daten erfolgreich
|
||||
- `bash -n start.sh` und programmatische Manifest-Kernfeldprüfung: erfolgreich
|
||||
|
||||
@@ -36,3 +132,504 @@
|
||||
- Ein zusätzlicher Python-Playwright-Lauf: nicht gestartet, weil das optionale
|
||||
Python-Modul `playwright` nicht installiert war. Die projektgebundene
|
||||
TypeScript-Playwright-Suite lief stattdessen vollständig erfolgreich.
|
||||
|
||||
## Etappe 2
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ------------------------------- | ----------------------------------------------------------------------------------- | --------------------- |
|
||||
| Erstadmin danach geschlossen | Browser-Setup sowie wiederholter Service-Aufruf geprüft; Seed enthält kein Konto | erfüllt am 21.10.2026 |
|
||||
| Login, Logout und lokales HTTP | Browserablauf; `HttpOnly`, `SameSite=Lax`, ohne `Secure` bei expliziter HTTP-Origin | erfüllt am 21.10.2026 |
|
||||
| Einladung und Reset | lokale Outbox bis Kontoaktivierung und neuem Login im Browser durchlaufen | erfüllt am 21.10.2026 |
|
||||
| Einmalige und abgelaufene Links | Verhaltenstests für Wiederverwendung und Ablauf von Einladung und Reset | erfüllt am 21.10.2026 |
|
||||
| Direkte Admin-Aktion verweigert | Thekencrew-POST auf Einladungsaction liefert 403 | erfüllt am 21.10.2026 |
|
||||
| Sperrung entzieht Zugriff | aktive Thekencrew-Sitzung wird gelöscht und beim nächsten Request abgewiesen | erfüllt am 21.10.2026 |
|
||||
| Keine echte Mail ungefragt | Browser- und Verhaltenstests nutzen ausschließlich temporäre lokale Outbox | erfüllt am 21.10.2026 |
|
||||
| Echter SMTP-Versand | nicht ausgeführt, keine Zugangsdaten bereitgestellt | offen |
|
||||
|
||||
## Ausgeführte Prüfungen Etappe 2
|
||||
|
||||
- `npm run lint`: erfolgreich
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm test`: 9 Auth-, Migrations-, Mail- und Dauer-Verhaltenstests erfolgreich
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- `npm run test:e2e`: 9 von 9 Browsertests erfolgreich; Erstadmin,
|
||||
Login/Logout, fremder Origin, Einladung, direkte Rollenprüfung, Sperrung,
|
||||
Reset sowie bestehende responsive Arbeitsansichten geprüft
|
||||
- Lokale Outbox in isolierten temporären Verzeichnissen geprüft
|
||||
- Lokaler Produktionsserver der Browsertests über HTTP gestartet; Healthcheck
|
||||
und Migration vor Start erfolgreich
|
||||
- `bash -n start.sh`: erfolgreich
|
||||
|
||||
## Etappe 3
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ----------------------------------------------- | ---------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Anlegen, Bearbeiten, Suchen, Filtern und Reload | Browserrundlauf mit Vorlage, Autosave, Quellen, Status, Suche und Neuladen | erfüllt am 21.10.2026 |
|
||||
| Taxonomien unabhängig | Format einzeln sowie Themen und Abschnittskategorien mehrfach gespeichert und gefiltert | erfüllt am 21.10.2026 |
|
||||
| Sicheres Markdown | Verhaltenstest und Browservorschau entfernen Skript/JavaScript, Formatierung bleibt erhalten | erfüllt am 21.10.2026 |
|
||||
| Private Bilder | Signatur-/Größenprüfung; anonymer Direktrequest erhält keinen Dateiinhalt | erfüllt am 21.10.2026 |
|
||||
| Sichtbare Speicherfehler | Actionfehler und Autosave-Fehlerstatus bleiben am Formular sichtbar | erfüllt am 21.10.2026 |
|
||||
| Konflikterkennung | zwei Browserseiten; veraltete Revision erhält Konflikt und überschreibt die neue Fassung nicht | erfüllt am 21.10.2026 |
|
||||
| Archiv und Wiederherstellung | Browserrundlauf blendet Piece aus und stellt den vorherigen Status wieder her | erfüllt am 21.10.2026 |
|
||||
| Duplikat | Verhaltenstest und Browser prüfen unabhängige Kopie samt Zuordnungen und Bild | erfüllt am 21.10.2026 |
|
||||
|
||||
## Ausgeführte Prüfungen Etappe 3
|
||||
|
||||
- `npm run lint`: erfolgreich
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm test`: 13 Tests in 3 Dateien erfolgreich
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- `npm run test:e2e`: 10 von 10 Browsertests erfolgreich
|
||||
- Browserprüfung bei 390, 768, 960, 1280 und 1440 Pixeln in beiden Themes ohne
|
||||
ungewollten horizontalen Überlauf
|
||||
- Mobile Darkmode-Aufnahme des Piece-Editors visuell kontrolliert
|
||||
- `bash -n start.sh` und `git diff --check`: erfolgreich
|
||||
|
||||
## Etappe 4
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ----------------------------------------- | ------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Spieleabend und mehrere JC-/Spieleblöcke | persistierte Spieleabend-Vorlage, Seed-Sendung und Browserrundlauf mit Standardablauf | erfüllt am 21.10.2026 |
|
||||
| Reihenfolge und Texte bleiben nach Reload | Verhaltenstests sowie Browsertest für Tastatur- und Drag-and-drop-Sortierung | erfüllt am 21.10.2026 |
|
||||
| Original bleibt unverändert | Service- und Browsertest planen dasselbe Piece mehrfach mit eigenen Titeln, Notizen, Dauern | erfüllt am 21.10.2026 |
|
||||
| Keine doppelte Dauer; Reserve zählt nicht | explizite und summierte Abschnitte sowie Reserve in Verhaltenstest und Browser geprüft | erfüllt am 21.10.2026 |
|
||||
| Entfernen betrifft nur Einplanung | Verhaltenstest löscht Verwendung und Abschnittskopie, nicht das Original | erfüllt am 21.10.2026 |
|
||||
| Sendungsänderung verändert keine Vorlage | tiefe Vorlagenkopie vor und nach Abschnittsänderung verglichen | erfüllt am 21.10.2026 |
|
||||
| Smartphone-Planungsablauf | Abschnittsanlage, Pane-Umschaltung und Überlauf bei 390 Pixeln geprüft | erfüllt am 21.10.2026 |
|
||||
| Gleichwertige Bedienwege | Drag-and-drop, Enter auf Verschiebeschaltfläche sowie klick-/touchbare Zielauswahl geprüft | erfüllt am 21.10.2026 |
|
||||
| Lokale Planungsaktualisierung | Quelle und Reserve per Drag-and-drop ohne Dokumentreload; lokaler Speicherzustand geprüft | erfüllt am 21.10.2026 |
|
||||
| Sichtbare Einfügeposition | Abschnitt, Fundusquelle und Reserve zeigen vor dem Drop Vorschau und transparentes Original | erfüllt am 21.10.2026 |
|
||||
| Piece-Dauer in Minuten | Fundus- und Verwendungseditor rechnen Minuten serverseitig in ganze Sekunden um | erfüllt am 21.10.2026 |
|
||||
| Gleichzeitige Änderungen | veraltete showweite Revision rollt die gesamte Mutation zurück | erfüllt am 21.10.2026 |
|
||||
|
||||
## Ausgeführte Prüfungen Etappe 4
|
||||
|
||||
- `npm run lint`: erfolgreich
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm test`: 18 Tests in 4 Dateien erfolgreich
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- `npm run test:e2e`: 11 von 11 Browsertests erfolgreich
|
||||
- Browserprüfung bei 390, 768, 960, 1280 und 1440 Pixeln in beiden Themes ohne
|
||||
ungewollten horizontalen Überlauf
|
||||
- Mobile Aufnahme des vollständigen Sendungsbaukastens visuell kontrolliert
|
||||
- `bash -n start.sh` und `git diff --check`: erfolgreich
|
||||
|
||||
## Etappe 5
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ------------------------------------- | ----------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Lesbare Moderation | Prompter-Schrift, Einleitung und Überleitung im Browser; Recherche initial geschlossen | erfüllt am 22.10.2026 |
|
||||
| Wiederherstellung | Live-Stand, Laufintervalle, Schriftgröße und Leseposition nach Neuladen geprüft | erfüllt am 22.10.2026 |
|
||||
| Keine doppelte Zeiterfassung | Verhaltenstest wiederholt dieselbe Befehls-ID und findet genau ein Zeitintervall | erfüllt am 22.10.2026 |
|
||||
| Explizite Präsentation | Zweitfenster bleibt nach Start leer und ändert sich erst durch „Präsentieren“ | erfüllt am 22.10.2026 |
|
||||
| Getrennte sichere Ausgabe | anonymer Browserkontext prüft Text, Bild, HTML, JSON und fremde Medien ohne private Daten | erfüllt am 22.10.2026 |
|
||||
| Reserve und Reihenfolge | Reserve als nächstes Piece eingefügt; offene Reihenfolge und serverseitige Live-Grenze geprüft | erfüllt am 22.10.2026 |
|
||||
| Popup- und Verbindungsfehler sichtbar | blockiertes Popup sowie unterbrochenes und wiederhergestelltes State-Polling im Browser geprüft | erfüllt am 22.10.2026 |
|
||||
| Persistente Linkvorschau | Quellwahl, manuelle Felder, Reload, fehlendes Bild und isolierte Testansicht im Browser geprüft | erfüllt am 22.10.2026 |
|
||||
| Sichere Metadatenabrufe | Tests sperren private IPv4-/IPv6-Ziele; Redirect-, Größen- und Zeitlimits sind implementiert | erfüllt am 22.10.2026 |
|
||||
| Validierte Videoplayer | YouTube-URL-Varianten, TikTok-ID, Zeitmarke und Playerwechsel automatisiert geprüft | erfüllt am 22.10.2026 |
|
||||
| Präsentationssnapshot | Einplanung, Duplikation und explizite Aktualisierung aus dem Original im Servicetest geprüft | erfüllt am 22.10.2026 |
|
||||
| Reale OBS-Browserquelle | lokale tokenisierte Browserausgabe vorhanden; kein OBS auf der Prüfmaschine | offen |
|
||||
| Reale Anbieterwiedergabe | automatisierte Tests fangen YouTube-/TikTok-Requests lokal ab | offen |
|
||||
|
||||
## Ausgeführte Prüfungen Etappe 5
|
||||
|
||||
- `npm run lint`: erfolgreich
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm test`: 29 Tests in 6 Dateien erfolgreich
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- `npm run test:e2e`: 14 von 14 Browsertests erfolgreich
|
||||
- Anonymer zweiter Chromium-Kontext mit Präsentationstext, Quelle, geschütztem
|
||||
Bild und gefiltertem JSON geprüft
|
||||
- Mobile Aufnahme der Live-Steuerung bei 390 × 844 Pixeln und Desktopaufnahme
|
||||
der heinzlive-Ausgabe visuell kontrolliert
|
||||
- Popup-Blockade sowie Verbindungsabbruch und automatische Wiederverbindung im
|
||||
Browser geprüft
|
||||
- YouTube-/TikTok-Iframes, Playerwechsel, mobile Hochformatausgabe,
|
||||
Linkkartenvorschau ohne Bild, isolierte Testansicht und private Datenfilterung
|
||||
mit lokal abgefangenen Anbieterrequests geprüft
|
||||
- SSRF-Blockade einer privaten Zieladresse über die sichtbare Editorfehlermeldung
|
||||
geprüft
|
||||
- `bash -n start.sh` und `git diff --check`: erfolgreich
|
||||
|
||||
## Gezielte Fundus- und Einplanungsanpassung
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ------------------------------------------- | ------------------------------------------------------------------------------------------ | --------------------- |
|
||||
| Gesendet korrekt abgeleitet | Servicetest schließt offene, übersprungene, Reserve- und nicht abgeschlossene Nutzung aus | erfüllt am 22.10.2026 |
|
||||
| Historie und Fundusfilter | Browser prüft letztes Datum, Sendungslink, weitere Verwendungen und Sofortfilter | erfüllt am 22.10.2026 |
|
||||
| Unabhängige Quellfilter | Browser kombiniert verwendet/eingeplant getrennt und erhält sie über Suchfilter | erfüllt am 22.10.2026 |
|
||||
| Reserve und Mehrfacheinplanung | Reserve zählt als eingeplant; bewusstes Wiedereinblenden erlaubt weitere Einplanung | erfüllt am 22.10.2026 |
|
||||
| Rückkehr nach Entfernen | Browser entfernt die letzte Reserveeinplanung und bietet das Original sofort wieder an | erfüllt am 22.10.2026 |
|
||||
| Angepasste Einplanung dupliziert | Service und Browser prüfen Position, Texte, Notizen, Dauer und Reload | erfüllt am 22.10.2026 |
|
||||
| Live-Zustand des Duplikats zurückgesetzt | Servicetest prüft `open`, neue ID und fehlende Zeitintervalle | erfüllt am 22.10.2026 |
|
||||
| Original unverändert | Piece-Anzahl und Original-ID vor und nach Einplanungsduplikation verglichen | erfüllt am 22.10.2026 |
|
||||
| Speicherfehler nicht als Erfolg dargestellt | veraltete Revision rollt Duplikation vollständig zurück | erfüllt am 22.10.2026 |
|
||||
| Globale aktive Einplanung ausgeblendet | Browser prüft den unabhängigen Filter über mehrere nicht abgeschlossene Sendungen | erfüllt am 22.10.2026 |
|
||||
| Snapshot ausdrücklich aktualisiert | Service prüft neue Originaltexte und erhaltene Notizen/Intervalle; Browser löst Aktion aus | erfüllt am 22.10.2026 |
|
||||
| Fehlendes Original atomar behandelt | Servicetest prüft Fehler und unveränderte Sendungsrevision | erfüllt am 22.10.2026 |
|
||||
| Verwendungsdialog responsiv | Browser prüft Desktop/Mobil, Reserve, erreichbare Aktionen und sichtbare Konfliktfehler | erfüllt am 22.10.2026 |
|
||||
|
||||
## Ausgeführte Prüfungen Fundus und Einplanung
|
||||
|
||||
- `npm test`: 22 Tests in 5 Dateien erfolgreich
|
||||
- `npm run lint`: erfolgreich
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- gezielter Playwright-Lauf: 4 von 4 Browsertests erfolgreich
|
||||
- `npm run test:e2e`: 12 von 12 Browsertests erfolgreich
|
||||
- Desktopansichten von Fundushistorie, kombinierten Sendungsfiltern und
|
||||
Verwendungsdialog sowie mobile Quellspalte und mobiler Dialog bei 390 × 844
|
||||
Pixeln visuell kontrolliert
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- `bash -n start.sh` und `git diff --check`: erfolgreich
|
||||
|
||||
## Redaktionelles Piece-Arbeitsblatt
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ---------------------------------------- | ------------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Schreiben steht im Mittelpunkt | Desktop- und Mobilprüfung zeigt Fundstück, Recherche und drei Sendungstexte im primären Lesefluss | erfüllt am 22.10.2026 |
|
||||
| Kontext bleibt vollständig erreichbar | Quellen, Einordnung, Präsentation und Bilder auf Desktop sowie als vier mobile Werkzeuge geprüft | erfüllt am 22.10.2026 |
|
||||
| Textfelder unabhängig bearbeitbar | Recherche und Moderationsstichpunkte im Browser gleichzeitig geöffnet und gespeichert | erfüllt am 22.10.2026 |
|
||||
| Bestehender Formvertrag bleibt erhalten | Autosave, Reload, Taxonomie, Quelle, Markdown, Upload, Archiv und Duplikat im Browser durchlaufen | erfüllt am 22.10.2026 |
|
||||
| Konflikte und Speicherfehler sichtbar | parallele Revision sowie Offline-Autosave mit erfolgreicher manueller Wiederholung geprüft | erfüllt am 22.10.2026 |
|
||||
| Schneller Video-Einstieg ohne Einordnung | Link im Eingang aufgenommen, direkt geöffnet, beschrieben und isoliert als Video getestet | erfüllt am 22.10.2026 |
|
||||
| Responsive Darstellung und beide Themes | 1440 × 1000 und 390 × 844 in Light/Dark ohne horizontalen Überlauf visuell kontrolliert | erfüllt am 22.10.2026 |
|
||||
|
||||
## Ausgeführte Prüfungen Piece-Arbeitsblatt
|
||||
|
||||
- `npm run lint`: erfolgreich
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm test`: 29 Tests in 6 Dateien erfolgreich
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- gezielter Playwright-Lauf für Autosave, Offline-Fehler, Konflikt und Upload:
|
||||
1 von 1 Browsertest erfolgreich
|
||||
- `npm run test:e2e`: 15 von 15 Browsertests erfolgreich
|
||||
- Desktop Light/Dark sowie Smartphone Light/Dark und mobiles
|
||||
Präsentationswerkzeug visuell kontrolliert; langer Titel bricht vollständig um,
|
||||
Werkzeugfläche ist opak und die Speicherleiste überdeckt mobil keine Eingaben
|
||||
- `bash -n start.sh` und `git diff --check`: erfolgreich
|
||||
|
||||
## Oberflächenrelease 0.5.4
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ------------------------------------------ | ---------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Klare Hierarchie in beiden Themes | Eingang, Fundus, Editor, Sendungsplan und Live-Steuerung in Light/Dark visuell kontrolliert | erfüllt am 22.10.2026 |
|
||||
| Exakte heinzlive-Darkmode-Farben | berechnete Theme-Tokens und Screenshots der dunklen Arbeitsansichten geprüft | erfüllt am 22.10.2026 |
|
||||
| Responsive Darstellung ohne Seitenüberlauf | Chromium-Messung bei 1440 × 1000 und 390 × 844 Pixeln auf allen gezielt geprüften Ansichten | erfüllt am 22.10.2026 |
|
||||
| Sendungsplan-Aktionen bleiben erreichbar | drei sichtbare Aktionen einer Planzeile liegen waagerecht auf gleicher Höhe; Mobilbild geprüft | erfüllt am 22.10.2026 |
|
||||
| Fokus und reduzierte Bewegung | sichtbarer Cyan-Fokusring und bestehende `prefers-reduced-motion`-Regeln im Stylesheet geprüft | erfüllt am 22.10.2026 |
|
||||
|
||||
## Ausgeführte Prüfungen Oberflächenrelease 0.5.4
|
||||
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- gezielter Chromium-Lauf für Eingang, Fundus, Piece-Editor, Sendungsplan und
|
||||
Live-Steuerung bei 1440 × 1000 und 390 × 844 Pixeln in Light/Dark ohne
|
||||
Konsolenfehler oder horizontalen Seitenüberlauf
|
||||
- Desktop- und Mobilaufnahmen aller genannten Ansichten visuell kontrolliert
|
||||
- vollständige Unit- und E2E-Matrix nicht erneut ausgeführt, weil dieser Release
|
||||
ausschließlich Darstellung und redaktionelle Kurztexte verändert
|
||||
- `git diff --check`: erfolgreich
|
||||
|
||||
## Oberflächenkorrektur 0.5.5
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ------------------------------------- | ------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Nachtblau und Glaswirkung erkennbar | berechnete Transparenz/Unschärfe und Desktop-/Mobilaufnahmen in Darkmode geprüft | erfüllt am 22.10.2026 |
|
||||
| Schreibfelder im Ruhezustand sichtbar | deckende Feldfarbe, feine Kontur, Innenabstand und Textcursor im Piece-Editor geprüft | erfüllt am 22.10.2026 |
|
||||
| Goldener Tastaturfokus | berechnete Fokusfarbe und Fokus-Schatten am Titelfeld geprüft; Cyanrahmen nicht mehr aktiv | erfüllt am 22.10.2026 |
|
||||
| Inhaltsgerechte Feldhöhen | kurze Einleitung ist niedriger als ausführliche Moderationsfläche; beide bleiben skalierbar | erfüllt am 22.10.2026 |
|
||||
| Lightmode und Smartphone erhalten | fünf Arbeitsansichten bei 1440 × 1000 und 390 × 844 Pixeln ohne Seitenüberlauf geprüft | erfüllt am 22.10.2026 |
|
||||
|
||||
## Ausgeführte Prüfungen Oberflächenkorrektur 0.5.5
|
||||
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- gezielter Chromium-Lauf in Light/Dark und Desktop/Mobil ohne Konsolenfehler
|
||||
oder horizontalen Seitenüberlauf; Glas-, Feld- und Fokuswerte zusätzlich
|
||||
programmatisch geprüft
|
||||
- vollständige Unit- und E2E-Matrix gemäß Auftrag nicht erneut ausgeführt
|
||||
- `git diff --check`: erfolgreich
|
||||
|
||||
## Oberflächenkorrektur 0.5.6
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| --------------------------------------------- | ------------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Gold-/Violettlicht und Glasflächen sichtbar | Fundus und Editor in Light/Dark auf Desktop und Mobil visuell sowie über berechnete Werte geprüft | erfüllt am 22.10.2026 |
|
||||
| Schreibflächen ruhig und eindeutig abgegrenzt | deckende Feldfarbe, Kontur und goldener Fokus im geöffneten Piece-Editor geprüft | erfüllt am 22.10.2026 |
|
||||
| Neuanlage und Suche unmittelbar erreichbar | sichtbare Fundusaktionen sowie geöffnete Vorlagenauswahl auf Desktop und Mobil geprüft | erfüllt am 22.10.2026 |
|
||||
| Zusatzfilter und Zeilenaktionen zugänglich | native Aufklappelemente für Filter und Aktionen per Browserinteraktion geprüft | erfüllt am 22.10.2026 |
|
||||
| Funduszeilen per Tastatur zu öffnen | erster Titeleintrag fokussiert, mit Eingabetaste geöffnet und Editoraufruf geprüft | erfüllt am 22.10.2026 |
|
||||
| Lightmode und Smartphone ohne Seitenüberlauf | Chromium-Messung bei 1440 × 1000 und 390 × 844 Pixeln in beiden Themes | erfüllt am 22.10.2026 |
|
||||
|
||||
## Ausgeführte Prüfungen Oberflächenkorrektur 0.5.6
|
||||
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- gezielter Chromium-Lauf für Fundus und geöffneten Piece-Editor bei
|
||||
1440 × 1000 und 390 × 844 Pixeln in Light/Dark ohne Konsolenfehler oder
|
||||
horizontalen Seitenüberlauf
|
||||
- Neuanlage, Zusatzfilter, Aktionsmenü, Tastaturöffnung, Glaswerte und goldener
|
||||
Fokus automatisiert kontrolliert; alle erzeugten Desktop-/Mobilaufnahmen
|
||||
visuell geprüft
|
||||
- Produktionsbuild sowie vollständige Unit- und E2E-Matrix gemäß Auftrag nicht
|
||||
ausgeführt
|
||||
- `git diff --check`: erfolgreich
|
||||
|
||||
## Materialkorrektur 0.5.7
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| -------------------------------------------- | ------------------------------------------------------------------------------------------------ | --------------------- |
|
||||
| Hintergrundlicht im Arbeitsbereich sichtbar | Fundus und Sendungsplanung ohne Popup in Dark/Light auf Desktop und Mobil visuell geprüft | erfüllt am 23.10.2026 |
|
||||
| Popup erhält die Lichtstimmung | Editor mit leichtem `46%`-Backdrop und `6px` Blur gegen Ansicht ohne Popup verglichen | erfüllt am 23.10.2026 |
|
||||
| Verschachtelte Ablaufkarten werden dunkler | berechnete RGBA-Werte von Außenglas, Abschnitt, Piece und Aktionsgruppe kontrolliert | erfüllt am 23.10.2026 |
|
||||
| Graue Sonderflächen entfernt | aktive Tabs, private Recherche, Quellen-/Materialflächen und Aktionsgruppen visuell geprüft | erfüllt am 23.10.2026 |
|
||||
| Schreibfelder bleiben ruhig und klar | deckende Feldfüllung, feine Kontur und unveränderter Goldfokus in beiden Editorbereichen geprüft | erfüllt am 23.10.2026 |
|
||||
| Lightmode und Smartphone ohne Seitenüberlauf | Chromium-Messung bei 1440 × 1000 und 390 × 844 Pixeln in beiden Themes | erfüllt am 23.10.2026 |
|
||||
|
||||
## Ausgeführte Prüfungen Materialkorrektur 0.5.7
|
||||
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- berechnete Styles vor und nach der Korrektur für App-Hintergrund, Navigation,
|
||||
Ablauf-Panel, Abschnitte, Pieces, Aktionsgruppen, Dialog, Backdrop, Tabs,
|
||||
Rechercheflächen und Schreibfelder kontrolliert
|
||||
- gezielter Chromium-Lauf für Sendungsplanung sowie Piece-Editor mit
|
||||
„Sendungstext“ und „Recherche & Quellen“ bei 1440 × 1000 und 390 × 844 Pixeln
|
||||
in Light/Dark ohne Konsolenfehler oder horizontalen Seitenüberlauf
|
||||
- Desktop-/Mobilaufnahmen mit und ohne Popup visuell verglichen
|
||||
- vollständige Funktionstests gemäß Auftrag nicht ausgeführt
|
||||
- `git diff --check`: erfolgreich
|
||||
|
||||
## Redaktionelle Arbeitsabläufe 0.5.8
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ------------------------------------------ | ------------------------------------------------------------------------------------------------ | --------------------- |
|
||||
| Persistente unabhängige Piece-Vorlagen | Servicetests prüfen Snapshot, Revision, Neuanlage, Wiederverwendung und Löschen | erfüllt am 23.10.2026 |
|
||||
| Atomare idempotente Direktanlage | Verhaltenstests prüfen Wiederholung derselben Befehls-ID und vollständigen Rollback | erfüllt am 23.10.2026 |
|
||||
| Interner und öffentlicher Titel getrennt | Service- und Browserabläufe prüfen getrennte Werte, Snapshots und Fallback | erfüllt am 23.10.2026 |
|
||||
| Entfernen betrifft nur konkrete Verwendung | Browser prüft Bestätigung, Rückgabe in Fundus und unverändertes Original | erfüllt am 23.10.2026 |
|
||||
| Beliebige Live-Verwendung auswählbar | Verhaltenstests wählen ersten und erledigten Eintrag über stabile Usage-ID | erfüllt am 23.10.2026 |
|
||||
| Stabiler widerrufbarer OBS-Kanal | Servicetests prüfen Wiederöffnung/Rotation; anonymer Browser prüft Fragmenttausch und Cookie | erfüllt am 23.10.2026 |
|
||||
| Private Quellen und Uploads bleiben intern | HTML- und JSON-Prüfung enthält weder implizite Quellen, Uploadnamen noch interne Redaktionstexte | erfüllt am 23.10.2026 |
|
||||
| Responsive und gleichwertig bedienbar | Chromium prüft Desktop/Mobil, Light/Dark, Drag-and-drop sowie Klick- und Tastaturalternativen | erfüllt am 23.10.2026 |
|
||||
| Reale OBS- und Anbieterwiedergabe | Keine OBS-Installation und keine echten Anbieteraufrufe in der lokalen Prüfumgebung | offen |
|
||||
|
||||
## Ausgeführte Prüfungen 0.5.8
|
||||
|
||||
- `npm run lint`: nach Formatierung erfolgreich
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm test`: 33 Tests in 6 Dateien erfolgreich
|
||||
- `npm run test:e2e`: 15 von 15 Chromium-Browsertests erfolgreich
|
||||
- Browsermatrix bei 390, 768, 960, 1280 und 1440 Pixeln einschließlich
|
||||
Light/Dark, horizontalem Überlauf, Tastaturbedienung, Planung, Live-Steuerung
|
||||
und anonymer Ausgabe geprüft; Screenshots wurden durch die Suite erzeugt
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- `npm run db:migrate`: Migrationen `0007_editorial_workflows.sql` und
|
||||
`0008_durable_planning_commands.sql` erfolgreich auf der zuvor gesicherten
|
||||
lokalen Entwicklungsdatenbank angewendet
|
||||
- `bash -n start.sh`: erfolgreich
|
||||
- reale OBS-Browserquelle und echte YouTube-/TikTok-Wiedergabe nicht ausgeführt;
|
||||
Anbieterrequests wurden in den Browsertests lokal abgefangen
|
||||
|
||||
## Live-Werkbank 0.5.9
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Favorit ist globale Originaleigenschaft | Service prüft Revision/Status; Browser prüft Stern, Sortierung und weiterhin wirksamen Planfilter | erfüllt am 23.10.2026 |
|
||||
| Werkzeugkatalog und Rechte | Barkeeper-Verwaltung serverseitig geschützt; Browser prüft Anlage, Formatbezug und Deaktivierung | erfüllt am 23.10.2026 |
|
||||
| Deaktivierte Zuordnung bleibt bearbeitbar | Browser öffnet das Piece erneut und findet Werkzeug, Arbeitslink, Notiz und Deaktivierungsstatus | erfüllt am 23.10.2026 |
|
||||
| Relationen werden unveränderlich gesnapshottet | Service ändert Quelle, Werkzeug und Thema und sieht Änderungen erst nach expliziter Aktualisierung | erfüllt am 23.10.2026 |
|
||||
| Private Live-Materialien bleiben privat | Live-Steuerung zeigt Snapshot-Quelle; anonymes HTML/JSON enthält den privaten Materiallink nicht | erfüllt am 23.10.2026 |
|
||||
| Thematische Publikum-Dachzeile | Usage-Themen werden stabil projiziert; Chromium zeigt „Gaming“ oberhalb des Präsentationstitels | erfüllt am 23.10.2026 |
|
||||
| Persistenter Abschnitts-Countdown | kontrollierte Testzeit prüft eingefrorenes Soll, Reload, Piece-Wechsel und Abschluss ohne Reset | erfüllt am 23.10.2026 |
|
||||
| Responsive Bedienung | komplette Browsermatrix und gezielter Werkzeugeditor bei 390 × 844 ohne horizontalen Überlauf | erfüllt am 23.10.2026 |
|
||||
| Reale OBS- und Anbieterwiedergabe | Keine OBS-Installation und keine echten Anbieteraufrufe in der lokalen Prüfumgebung | offen |
|
||||
|
||||
## Ausgeführte Prüfungen 0.5.9
|
||||
|
||||
- `npm run lint`: erfolgreich
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm test`: 37 Tests in 7 Dateien erfolgreich
|
||||
- `npm run test:e2e`: 16 von 16 Chromium-Browsertests erfolgreich
|
||||
- zusätzlicher gezielter Chromium-Lauf des Werkzeugeditors bei 390 × 844 Pixeln:
|
||||
1 von 1 erfolgreich, ohne horizontalen Überlauf
|
||||
- Browsermatrix bei 390, 768, 960, 1280 und 1440 Pixeln einschließlich
|
||||
Light/Dark, Planung, Live-Steuerung, anonymer Ausgabe und privater Materialien
|
||||
erfolgreich; Screenshots wurden durch die Suite erzeugt
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- lokale Entwicklungsdatenbank vorab nach
|
||||
`.data/backups/0.5.9-pre-migration/sendewerk.sqlite` gesichert;
|
||||
`npm run db:migrate` hat `0009_live_workbench.sql` erfolgreich angewendet
|
||||
- `bash -n start.sh` und `git diff --check`: erfolgreich
|
||||
- reale OBS-Browserquelle und echte YouTube-/TikTok-Wiedergabe nicht ausgeführt;
|
||||
Anbieterrequests wurden in den Browsertests lokal abgefangen
|
||||
|
||||
## Editor-Erlebnis 0.5.10
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ------------------------------------------- | ------------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Titel direkt und per Tastatur bearbeitbar | Chromium prüft Vorlage, Inline-Titel, Autosave, Schließen und erneutes Öffnen | erfüllt am 23.10.2026 |
|
||||
| Gemeinsame Themen- und Werkzeugauswahl | Browser prüft Auswahl, Speicherung und deaktivierte Werkzeugzuordnung; Svelte-Check ist warnfrei | erfüllt am 23.10.2026 |
|
||||
| Themenicons lokal und persistent | Migration und Servicetests prüfen Iconwert und Snapshot; Verwaltung nutzt lokalen Iconpicker | erfüllt am 23.10.2026 |
|
||||
| Präsentationsbild ausdrücklich gewählt | Browser lädt Bild hoch, aktualisiert Usage und sieht nur dieses Bild in anonymer Ausgabe | erfüllt am 23.10.2026 |
|
||||
| Medien- und Usage-Snapshots bleiben stabil | Servicetest entfernt Originalmedium und erhält bestehende Usage-Ausgabe | erfüllt am 23.10.2026 |
|
||||
| Piece-Löschen ist wiederherstellbar | Servicetest prüft Revision, Soft Delete, Listenausblendung, Medienzugriff und Wiederherstellung | erfüllt am 23.10.2026 |
|
||||
| Live-Verwendungen sicher entfernbar | Servicetests erlauben nur offene, nie gelaufene, nicht aktuelle oder präsentierte Verwendungen | erfüllt am 23.10.2026 |
|
||||
| Leere OBS-Ausgabe ist transparent | Chromium prüft leeren Renderer vor und nach Präsentation sowie versteckten Verbindungsstatus | erfüllt am 23.10.2026 |
|
||||
| Responsive Bedienung | vollständige Browsermatrix prüft 390 bis 1440 Pixel, Light/Dark und horizontalen Überlauf | erfüllt am 23.10.2026 |
|
||||
| Reales OBS, reale Anbieter und echtes iOS | In der lokalen Prüfumgebung nicht verfügbar | offen |
|
||||
| Werkzeugkatalog entspricht Themenverwaltung | Kompakte Iconzeilen und gemeinsamer Anlegen-/Bearbeitendialog wurden auf Desktop/Mobil verglichen | erfüllt am 23.10.2026 |
|
||||
| Vollständige Classic-Regular-Auswahl | Generierung liefert 3.671 Icons; seltenes Icon wurde gesucht, gespeichert und im Piece angezeigt | erfüllt am 23.10.2026 |
|
||||
| Formatwahl nutzt gemeinsamen Picker | Browser ordnet Quiz im Dialog zu und erhält Format sowie Deaktivierungszustand nach Reload | erfüllt am 23.10.2026 |
|
||||
|
||||
## Ausgeführte Prüfungen 0.5.10
|
||||
|
||||
- `npm run lint`: erfolgreich
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm test`: 40 Tests in 7 Dateien erfolgreich
|
||||
- `npm run test:e2e`: 16 von 16 Chromium-Browsertests erfolgreich
|
||||
- Browsermatrix bei 390, 768, 960, 1280 und 1440 Pixeln einschließlich
|
||||
Light/Dark, mobiler Navigation, Dialogen, Planung, Live-Steuerung, anonymer
|
||||
Ausgabe, Medienauswahl und privater Datenfilterung erfolgreich; Screenshots
|
||||
wurden durch die Suite erzeugt
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- lokale Entwicklungsdatenbank vorab nach
|
||||
`.data/backups/0.5.10-pre-migration/sendewerk.sqlite` gesichert;
|
||||
`npm run db:migrate` hat `0010_editor_experience.sql` erfolgreich angewendet
|
||||
- vor der Werkzeugmigration zusätzlich nach
|
||||
`.data/backups/0.5.10-tool-icons-pre-migration/sendewerk.sqlite` gesichert;
|
||||
`npm run db:migrate` hat `0011_tool_icons.sql` erfolgreich angewendet
|
||||
- Werkzeugkatalog, Anlegen-/Bearbeitendialog, geöffnete Iconauswahl und
|
||||
Piece-Werkzeugauswahl bei 1280 × 720 und 390 × 844 Pixeln visuell direkt mit
|
||||
der Themenverwaltung verglichen; keine horizontale Überlauffläche festgestellt
|
||||
- `bash -n start.sh`: erfolgreich
|
||||
- reale OBS-Browserquelle, echte YouTube-/TikTok-Wiedergabe und Safari auf einem
|
||||
iOS-Gerät nicht ausgeführt; Anbieterrequests wurden lokal abgefangen
|
||||
|
||||
## Verwaltungskorrektur 0.5.11
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ------------------------------------------ | ---------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Werkzeugdialog ist initial geschlossen | Chromium prüft den Dialog vor jeder Bedienaktion bei 390 und 1280 Pixeln | erfüllt am 23.10.2026 |
|
||||
| Dialog öffnet nur nach bewusster Aktion | Browser legt ein Werkzeug an und öffnet ein bestehendes Werkzeug anschließend zum Ändern | erfüllt am 23.10.2026 |
|
||||
| Bestehender Werkzeugablauf bleibt erhalten | Browser prüft Icon, Format, Deaktivierung und Piece-Zuordnung nach erneutem Laden | erfüllt am 23.10.2026 |
|
||||
| Themen-Iconpicker bleibt im Viewport | Chromium prüft Öffnen und Auswahl bei 390, 960 und 1280 Pixeln | erfüllt am 23.10.2026 |
|
||||
|
||||
## Kompakte Live-Regie 0.5.12
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Globale Navigation bleibt aus der Regie | Chromium findet weder Seitenleiste noch mobilen App-Header oder Bottomnavigation | erfüllt am 24.10.2026 |
|
||||
| Kleines Desktopfenster bleibt zweispaltig | Chromium prüft Moderation, Ablauf und feste Aktionen bei 900 × 450 Pixeln | erfüllt am 24.10.2026 |
|
||||
| Niedrige Desktophöhe wird berücksichtigt | 900 × 450 aktiviert kompakte Abstände ohne Transform oder CSS-Zoom | erfüllt am 24.10.2026 |
|
||||
| Zweizeiliger Kopf gewinnt Inhaltsfläche | Chromium begrenzt die Kopfhöhe bei 670 × 450 und prüft die unveränderte feste Aktionsleiste | erfüllt am 24.10.2026 |
|
||||
| Lange Kopftitel bleiben kontrolliert | Abschnitt und Folgetitel kürzen einzeilig und öffnen vollständig per Klick, Enter und Escape | erfüllt am 24.10.2026 |
|
||||
| Regiemenü bleibt sichtbar und erreichbar | Browser prüft Viewportgrenzen, Scrollzugang, Sendungsname und Aktionen bei 1280, 670 und 390 Pixeln | erfüllt am 24.10.2026 |
|
||||
| Menü schließt zugänglich | Escape und Außenklick schließen das Popover und führen den Fokus zum Auslöser zurück | erfüllt am 24.10.2026 |
|
||||
| Lange Inhalte scrollen innerhalb der Fläche | Synthetischer Langtext und zusätzliche Ablaufabschnitte erzeugen zwei unabhängige Scroller | erfüllt am 24.10.2026 |
|
||||
| Mobile Regie verwendet ein Ablauf-Sheet | 390 × 700 prüft Endlage, Fokus, Escape, Aktionsschließen und Wechsel auf 900 Pixel | erfüllt am 24.10.2026 |
|
||||
| Leseposition bleibt am Piece | Nach tiefem Scrollen beginnt ein direkt gewähltes anderes Piece am oberen Rand | erfüllt am 24.10.2026 |
|
||||
| Zustände sind ausgeschrieben | Ablauf prüft Kommend, Aktuell, Erledigt und Übersprungen | erfüllt am 24.10.2026 |
|
||||
| Erstes und letztes Piece direkt wählbar | Browser wechselt per stabiler Usage-ID auf Desktop und aus dem mobilen Sheet in beide Richtungen | erfüllt am 24.10.2026 |
|
||||
| Navigation veröffentlicht nicht automatisch | Öffentliche Ausgabe bleibt bei direkter Auswahl unverändert | erfüllt am 24.10.2026 |
|
||||
| Zurück ist reine Betrachtungsnavigation | Browser prüft unverändertes aktuelles Piece, Countdown und Ausgabe sowie gesperrte Fortschrittsaktionen | erfüllt am 24.10.2026 |
|
||||
| Timer und Livezustand überleben Reload | Aktuelles Piece und laufender Abschnittscountdown bleiben nach Neuladen erhalten | erfüllt am 24.10.2026 |
|
||||
| Wiederaufnahme nur bei Unterbrechung | Während eines aktiven Pieces fehlt die Aktion; nach unterbrochenem Stand ist sie prominent | erfüllt am 24.10.2026 |
|
||||
| Sendungsende ist eindeutig | Letztes Piece zeigt Endaktion ohne horizontalen Überlauf; danach fehlen Weiter-Aktionen | erfüllt am 24.10.2026 |
|
||||
| Liste und Kalender nutzen dieselben Daten | Chromium wechselt zwischen beiden Ansichten; Sendungslinks bleiben identisch erreichbar | erfüllt am 24.10.2026 |
|
||||
| Kalenderpräferenz bleibt am Konto | Service- und Browsertest prüfen Standardwert, Speicherung und Reload | erfüllt am 24.10.2026 |
|
||||
| Monat und Berliner Tage sind korrekt | Unit-Tests prüfen Monatsgrenzen und UTC-Zuordnung; Browser prüft Monatswechsel und heutigen Tag | erfüllt am 24.10.2026 |
|
||||
| Mehrere und terminlose Sendungen bleiben sichtbar | Desktopkalender und mobile Agenda zeigen zwei Termine am Tag; eigener Bereich zeigt offenen Termin | erfüllt am 24.10.2026 |
|
||||
|
||||
## Ausgeführte Prüfungen 0.5.12
|
||||
|
||||
- `npm run lint`: erfolgreich
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm test`: 44 Tests in 8 Dateien erfolgreich
|
||||
- gezielte Kalender- und Live-Regie-Läufe: 2 von 2 Chromium-Tests erfolgreich
|
||||
- `npm run test:e2e`: 17 von 17 Chromium-Browsertests erfolgreich
|
||||
- Browserprüfungen der Live-Regie bei 1440 × 900, 900 × 450, 670 × 450 und
|
||||
390 × 700 Pixeln sowie des Kalenders bei 1440 × 1000 und 390 × 844 Pixeln
|
||||
erfolgreich
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- Versionsgleichheit `0.5.12` in Paket, Lockdatei und Cloudron-Manifest geprüft
|
||||
- `bash -n start.sh` und `git diff --check`: erfolgreich
|
||||
- reale OBS-Browserquelle, echte YouTube-/TikTok-Wiedergabe und Safari auf einem
|
||||
iOS-Gerät nicht ausgeführt; Anbieterrequests wurden lokal abgefangen
|
||||
|
||||
## Erweiterte Live-Steuerung 0.5.12
|
||||
|
||||
| Kriterium | Stand |
|
||||
| ---------------------------------------------- | ---------------------------- |
|
||||
| Gemeinsame persistente Pause | implementiert, nicht geprüft |
|
||||
| Abschnitts- und Gesamtreset bleiben unabhängig | implementiert, nicht geprüft |
|
||||
| Gesamt-/Restzeit ohne Doppelerfassung | implementiert, nicht geprüft |
|
||||
| Ende, Wiederaufnahme und neuer Lauf getrennt | implementiert, nicht geprüft |
|
||||
| Privates Feld „Interaktion“ durch alle Kopien | implementiert, nicht geprüft |
|
||||
| Öffentliche Positivliste unverändert | implementiert, nicht geprüft |
|
||||
| Classic-Regular-Icons und Drawer-Schließen | gezielt im Browser geprüft |
|
||||
|
||||
Für die ursprüngliche Erweiterung wurden auf ausdrücklichen Auftrag zunächst
|
||||
keine Prüfungen ausgeführt. Die nachfolgenden Korrekturen weisen inzwischen
|
||||
Migration, Typen, Build, bestehendes Liveverhalten und die betroffenen
|
||||
Oberflächen gezielt nach; die übrigen neuen Timer- und Statusfälle bleiben ohne
|
||||
vollständige erneute Matrix.
|
||||
|
||||
## Live-500-Korrektur 0.5.12
|
||||
|
||||
- Ursache auf einer schreibgeschützt untersuchten lokalen Datenbank bestätigt:
|
||||
`0013` war protokolliert, `live_show_timer_runs` fehlte jedoch.
|
||||
- `0014_live_show_timer_repair.sql` auf einer Kopie dieser Datenbank angewendet
|
||||
und erneut ausgeführt; Tabelle und Indizes wurden angelegt, 13 bestehende
|
||||
Intervalle genau einmal übernommen und ein offenes Intervall erhalten.
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen.
|
||||
- `npm run test:unit -- --run src/lib/server/live.spec.ts`: 6 Tests erfolgreich.
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`.
|
||||
|
||||
## Live-Icons und kompakte Sendungskarten 0.5.12
|
||||
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen.
|
||||
- `npm run test:unit -- --run src/lib/server/live.spec.ts`: 6 Tests erfolgreich.
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`.
|
||||
- Gezielter Chromium-Ablauf der Sendungsübersicht mit Desktopkalender, mobiler
|
||||
Agenda und Rückkehr zur Liste: erfolgreich.
|
||||
- Vollständiger bestehender Live-Regie-Ablauf einschließlich 900 × 450,
|
||||
670 × 450 und 390 × 700 Pixeln: erfolgreich; Iconleiste, Kopfhöhe,
|
||||
Viewportgrenzen und horizontaler Überlauf geprüft.
|
||||
- Zusätzliche visuelle Chromium-Prüfung bei 656 × 400 und 390 × 700 Pixeln:
|
||||
Sendungskarte unter 130 Pixel hoch, Menü-/Ausgabe-/Timericons sichtbar und
|
||||
Pausebutton wechselt bedienbar zu Fortsetzen.
|
||||
|
||||
## Etappe 6
|
||||
|
||||
| Kriterium | Nachweis | Stand |
|
||||
| -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | --------------------- |
|
||||
| Spätere Originaländerung verändert Historie nicht | Verhaltenstest ändert Piece und Abschnittskategorie nach Abschluss; historische Snapshots bleiben gleich | erfüllt am 25.10.2026 |
|
||||
| Abschluss nicht doppelt; übersprungen ist nicht gesendet | idempotente Befehlswiederholung, fremde Befehls-ID und materialisierte Usage-Historie im Verhaltenstest | erfüllt am 25.10.2026 |
|
||||
| Bewusste Auswahl archiviert nur gewählte Originale | Abschlusskandidaten und explizite Archivauswahl im Service; Dialog trennt gesendet, übersprungen und offen | erfüllt am 25.10.2026 |
|
||||
| Archivierte Sendung stabil und duplizierbar | Service- und Browsertest prüfen Nur-Lese-Ansicht sowie neuen Entwurf ohne Live-, Historien- oder Freigabedaten | erfüllt am 25.10.2026 |
|
||||
| Gast sieht genau eine Sendung und nur erlaubte Felder | anonymer Chromium-Kontext und Scope-Verhaltenstests für Ablauf, Moderation und Recherche | erfüllt am 25.10.2026 |
|
||||
| Gast-Schreibzugriff und fremde IDs abgelehnt | anonymer direkter POST erhält 403; fremde Medien-ID erhält 404 | erfüllt am 25.10.2026 |
|
||||
| Passwort, Ablauf und Widerruf schützen direkte Aufrufe | Service- und Browsertests prüfen Seite, Gast-Sitzung und direkten Medienrequest vor und nach Widerruf | erfüllt am 25.10.2026 |
|
||||
| Barkeeper verwaltet Freigaben | Anlage, Bearbeitung und Löschung direkt in der Sendung sowie gruppiert in der Verwaltung im Browser geprüft | erfüllt am 25.10.2026 |
|
||||
| Offene Sendungen sind sicher freigebbar | Service und anonymer Browser prüfen aktuellen Plan vor Abschluss und stabilen Stand danach | erfüllt am 25.10.2026 |
|
||||
| Bestehende Abschlüsse werden einmalig übernommen | Upgrade-Test wendet `0015` auf einen Stand bis `0014` zweimal an und findet genau eine Historie | erfüllt am 25.10.2026 |
|
||||
| Bestehende Freigaben bleiben bei Erweiterung erhalten | Migration `0016` ersetzt nur die Fremdschlüsselgrenze und kopiert Freigaben sowie Gast-Sitzungen | erfüllt am 25.10.2026 |
|
||||
|
||||
## Ausgeführte Prüfungen Etappe 6
|
||||
|
||||
- `npm run check`: 0 Fehler und 0 Warnungen
|
||||
- `npm test`: 52 Tests in 11 Dateien erfolgreich
|
||||
- gezielter Chromium-Ablauf für Abschluss, Archiv, historische Ansicht,
|
||||
offene und abgeschlossene Freigabe, Bearbeitung und Löschung in beiden
|
||||
Barkeeper-Oberflächen, Passwort, privaten Scope, Reserve-Medienschutz, fremde
|
||||
ID und Gast-POST: 1 von 1 erfolgreich
|
||||
- `npm run test:e2e`: nach Korrektur eines bestehenden, auf den 24. Oktober
|
||||
festgelegten „Heute“-Fixtures 18 von 18 Chromium-Browsertests erfolgreich
|
||||
- Browserprüfung von Sendungsfreigabe und Gastansicht bei 390 × 844 Pixeln sowie
|
||||
der Verwaltung bei 1280 × 900 Pixeln ohne horizontalen Überlauf; Screenshots
|
||||
visuell kontrolliert
|
||||
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`
|
||||
- `npm run lint`: Prettier und ESLint erfolgreich
|
||||
- Versionsgleichheit `0.6.0` in Paket, Lockdatei und Cloudron-Manifest geprüft
|
||||
- `bash -n start.sh` und `git diff --check`: erfolgreich
|
||||
+423
-24
@@ -3,7 +3,7 @@
|
||||
## Systemgrenze
|
||||
|
||||
Sendewerk ist ein einzelner SvelteKit-Prozess. Browserseiten, serverseitige
|
||||
Actions, spätere REST-Endpunkte und Hintergrundaufgaben verwenden dieselbe
|
||||
Actions, REST-Endpunkte und Hintergrundaufgaben verwenden dieselbe
|
||||
Geschäftslogik. SQLite und ein lokales Upload-Verzeichnis sind die einzigen
|
||||
persistenten Laufzeitabhängigkeiten. Externe Mail-, RSS- oder KI-Dienste sind
|
||||
nicht Voraussetzung für Kernfunktionen.
|
||||
@@ -11,7 +11,7 @@ nicht Voraussetzung für Kernfunktionen.
|
||||
```text
|
||||
Browser -> SvelteKit-Routen -> Anwendungsdienste -> SQLite
|
||||
| -> Upload-Verzeichnis
|
||||
+-> später: Mail/RSS über Adapter
|
||||
+-> Mail/RSS über begrenzte Adapter
|
||||
```
|
||||
|
||||
Servercode lebt unter `src/lib/server` und darf nicht in Browser-Bundles
|
||||
@@ -31,18 +31,19 @@ spätere API dieselben Regeln verwenden.
|
||||
- Zeitpunkte werden als ISO-8601-UTC-Text gespeichert. Dauern sind nichtnegative
|
||||
ganze Sekunden. Zeitzonendarstellung ist `Europe/Berlin`.
|
||||
|
||||
## Geplantes Gesamtdatenmodell
|
||||
## Gesamtdatenmodell
|
||||
|
||||
Etappe 1 materialisiert nur den für echte Vorschau- und Seed-Daten benötigten
|
||||
Kern. Folgende Grenzen sind für spätere Migrationen bereits festgelegt.
|
||||
Die ersten sieben Etappen materialisieren Identität, Inhaltsverwaltung,
|
||||
Sendungsplanung, Live-Durchführung, Historie, Lesefreigaben, RSS-Import und eine
|
||||
technische API. Folgende Grenzen gelten für umgesetzte und spätere Bereiche.
|
||||
|
||||
| Bereich | Geplante Entitäten und Beziehungen |
|
||||
| ----------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Identität | `users`, Rollen, Sessions, Einladungen, Reset-Tokens, Sperren und technische Zugänge; Tokens nur gehasht |
|
||||
| Taxonomie | getrennte `section_categories`, `formats`, `topics`; Pieces und Vorschläge über Zuordnungstabellen mehrfach verknüpft |
|
||||
| Inhalt | `pieces` mit Status und Dauer; Quellen, Medien, private Recherche, Moderation, Präsentation und Vorlagen als getrennte Daten |
|
||||
| Sendungsbau | `shows`, geordnete `show_sections`, kopierte `piece_usages`, Reservebank und Sendungsvorlagen; Original-ID bleibt Referenz |
|
||||
| Live | expliziter Live-Stand, aktuelles Element, Status je Verwendung, tatsächliche Zeiten und getrennte Präsentationsausgabe |
|
||||
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Identität | `users`, Rollen, Sessions, Einladungen, Reset-Tokens und Sperren sowie getrennte technische Zugänge |
|
||||
| Taxonomie | getrennte `section_categories`, `formats`, `topics` samt optionalem Themenicon; Pieces und Vorschläge mehrfach verknüpft |
|
||||
| Inhalt | `pieces` mit Status, Soft Delete, Favorit, Revision, Texten, Quellen, Werkzeugen und privaten Medien; Vorlagen speichern Snapshots |
|
||||
| Sendungsbau | `shows`, geordnete `show_sections`, `piece_usages` samt Quellen-/Werkzeug-/Themen-/Mediensnapshots, Reservebank und Vorlagen |
|
||||
| Live | expliziter Live-Stand, aktuelles Element, tatsächliche Piece-Zeiten, persistente Abschnitts-/Gesamttimer und getrennte Präsentationsausgabe |
|
||||
| Historie | unveränderliche Abschluss-Snapshots und Verwendungshistorie; Übersprungenes zählt nicht als gesendet |
|
||||
| Freigaben | widerrufbare, gehashte Lesetokens mit Sendung, Umfang, Passwortoption und Ablaufzeit |
|
||||
| RSS | Feedquellen, Abrufläufe und externe Einträge mit stabiler Herkunfts-ID sowie Status neu/übernommen/verworfen |
|
||||
@@ -63,22 +64,420 @@ oder eine explizite Abschnittsdauer. Beides wird nie addiert. Reserveelemente
|
||||
zählen erst nach dem Einplanen. Geplante und tatsächliche Dauer bleiben
|
||||
getrennt.
|
||||
|
||||
Ein Live-Abschnittstimer entsteht ausschließlich beim tatsächlichen Eintritt in
|
||||
einen Abschnitt mit positiver expliziter Dauer. Er speichert dieses Soll als
|
||||
unveränderlichen Wert und summiert eigene Laufintervalle; Piece-Wechsel im
|
||||
selben Abschnitt erzeugen deshalb weder Reset noch doppelte Piece-Laufzeit.
|
||||
Der Gesamttimer speichert ebenfalls mehrere Laufintervalle. Eine gemeinsame
|
||||
Pause schließt die offenen Piece-, Abschnitts- und Gesamtintervalle; Fortsetzen
|
||||
öffnet neue Intervalle, ohne die Pause als Laufzeit zu zählen. Abschnitts- und
|
||||
Gesamtreset ersetzen ausschließlich die jeweilige Zeitbasis.
|
||||
|
||||
## Anmeldung und Rechte
|
||||
|
||||
Etappe 2 ergänzt lokale Konten mit den festen Rollen `barkeeper` und
|
||||
`thekencrew`. Passwörter werden mit Argon2id gespeichert. Sitzungs-, Einladungs-
|
||||
und Reset-Tokens entstehen aus kryptografischem Zufall; in SQLite liegt jeweils
|
||||
nur ihr SHA-256-Hash. Der Browser erhält ausschließlich das rohe Sitzungstoken
|
||||
in einem `HttpOnly`-, `SameSite=Lax`-Cookie.
|
||||
|
||||
`hooks.server.ts` löst die Sitzung für jeden Request auf. Die Datenbankabfrage
|
||||
verbindet die Session immer mit dem aktuellen Nutzerzustand, sodass Sperren und
|
||||
Rollenwechsel ohne verzögerte Token-Erneuerung wirken. Geschützte Routen
|
||||
erfordern eine Anmeldung; Verwaltungs-Loads und jede Verwaltungs-Action prüfen
|
||||
zusätzlich die Barkeeper-Rolle. Sperrung und Passwortwechsel löschen bestehende
|
||||
Sessions transaktional.
|
||||
|
||||
Der Erstadmin benötigt sowohl eine leere Nutzertabelle als auch ein extern
|
||||
konfiguriertes Setup-Token. Einladungs- und Reset-Links sind 24 Stunden gültig,
|
||||
werden erst beim bestätigenden POST verbraucht und sind genau einmal nutzbar.
|
||||
Fehlgeschlagene Loginversuche werden pro E-Mail-Schlüssel und Clientadresse in
|
||||
einem Zeitfenster begrenzt, ohne das Konto dauerhaft zu sperren.
|
||||
|
||||
Mail verwendet einen Adapter: `local` schreibt geschützte Dateien in den
|
||||
konfigurierten Outbox-Pfad, `smtp` nutzt Nodemailer nur nach expliziter Auswahl.
|
||||
Die feste Anwendungs-Origin erzeugt Links und bestimmt den `Secure`-Status der
|
||||
Cookies; sie wird nicht aus ungeprüften Request-Headern übernommen.
|
||||
|
||||
Technische Zugänge sind keine Browsersitzungen. Sie besitzen zufällige
|
||||
Bearer-Tokens, von denen nur SHA-256-Hashes gespeichert werden, und genau einen
|
||||
der Umfänge `read` oder `read_write`. Widerruf wirkt beim nächsten Request.
|
||||
`/api/v1` umgeht lediglich den Browser-Loginredirect; jeder Endpunkt prüft Token
|
||||
und erforderlichen Umfang selbst. Schreibzugriffe hinterlassen ein
|
||||
`audit_event`; Neuanlage und Planungsänderungen verlangen zusätzlich einen je
|
||||
Zugang eindeutigen, persistent gespeicherten Idempotenzschlüssel.
|
||||
|
||||
## RSS-Import
|
||||
|
||||
`src/lib/server/feeds.ts` bildet Abruf, XML-Verarbeitung und Übernahme gemeinsam
|
||||
für manuelle Aktionen und den Prozess-Scheduler ab. Der Scheduler startet beim
|
||||
ersten Request und prüft minütlich höchstens zehn fällige aktive Feeds. Jeder
|
||||
Feed wird getrennt behandelt, sodass ein Fehler weitere Abrufe nicht stoppt.
|
||||
HTTP-Abrufe erlauben nur HTTP(S) auf Standardports, prüfen DNS sowie jedes
|
||||
Redirectziel gegen interne Adressen und begrenzen Laufzeit, Redirects und
|
||||
Antwortgröße. RSS/Atom wird mit deaktivierter Entity-Verarbeitung gelesen;
|
||||
höchstens 200 Einträge je Antwort werden berücksichtigt und fremdes HTML wird zu
|
||||
reinem Text reduziert.
|
||||
|
||||
`feed_entries` ist ein eigener Eingang. `(feed_id, external_id)` verhindert
|
||||
Dubletten; Aktualisierungen ändern den redaktionellen Status nicht. `discarded`
|
||||
bleibt deshalb auch nach späteren Abrufen erhalten. Erst die bewusste
|
||||
Mehrfachauswahl erzeugt innerhalb einer Transaktion normale Inbox-Pieces mit
|
||||
Kategorien und Original-URL als Quelle und setzt den Eintrag auf `imported`.
|
||||
|
||||
## Technische REST-API
|
||||
|
||||
Die Routen unter `/api/v1` bilden keine zweite Fachlogik, sondern rufen
|
||||
`content.ts` und `shows.ts` auf. Piece- und Sendungsrevisionen schützen weiterhin
|
||||
vor verlorenen Änderungen. `api_idempotency` speichert Request-Hash, Status und
|
||||
JSON-Antwort, sodass wiederholte Schreibbefehle dasselbe Ergebnis liefern und
|
||||
ein gleicher Schlüssel mit verändertem Inhalt abgewiesen wird. Die OpenAPI-3.1-
|
||||
Beschreibung ist unter `/api/v1/openapi.json` erreichbar. Ein MCP-Adapter oder
|
||||
produktspezifischer KI-Client gehört nicht zur Laufzeit und ist nicht
|
||||
Voraussetzung für die Bedienung.
|
||||
|
||||
## Inhalte, Markdown und Medien
|
||||
|
||||
Etappe 3 führt die Inhaltslogik in `src/lib/server/content.ts` zusammen. Listen
|
||||
erhalten ausschließlich kompakte Piece-Daten; private Recherche und vollständige
|
||||
Redaktionstexte werden nur an den angemeldeten Editor ausgeliefert. Themen und
|
||||
Abschnittskategorien sind Mehrfachzuordnungen, das Format bleibt eine einzelne
|
||||
unabhängige Zuordnung. Quellen werden gemeinsam mit einem Piece atomar ersetzt.
|
||||
`is_favorite` ist eine globale Eigenschaft des Originals und keine Nutzung oder
|
||||
Historienmarkierung. Der Werkzeugkatalog liegt getrennt von Formaten; Formate
|
||||
sind nur Eignungszuordnungen. `piece_tools` hält pro Piece den privaten
|
||||
Arbeitslink und eine Notiz, während Deaktivierung das Katalogobjekt und alle
|
||||
bestehenden Zuordnungen erhält. Ein serverseitig validiertes `icon_name` gehört
|
||||
zum Werkzeugkatalog und wird im Originaleditor angezeigt, ohne bestehende
|
||||
Usage-Snapshots nachträglich zu verändern.
|
||||
Ein Piece kann für die Präsentation Text oder genau eine vorhandene Quelle als
|
||||
Linkkarte beziehungsweise Video auswählen. Abgerufene Metadaten und Kennzeichen
|
||||
für manuell korrigierte Felder liegen am Piece; ein erneuter Abruf überschreibt
|
||||
diese Felder nicht.
|
||||
|
||||
Piece-Vorlagen liegen als validierte JSON-Snapshots in `piece_templates`. Jeder
|
||||
Speichervorgang kopiert den vollständigen Vorlageninhalt tief und erhöht bei
|
||||
einer Aktualisierung die Revision; spätere Änderungen am Ausgangs-Piece wirken
|
||||
nicht auf die Vorlage zurück. Die leere Vorlage bleibt virtuell. Interner Titel
|
||||
und optionaler Präsentationstitel sind getrennte Felder; ohne öffentlichen Titel
|
||||
verwendet die Präsentationsprojektion den internen Titel als Fallback.
|
||||
|
||||
Jedes Piece besitzt eine ganzzahlige Revision. Speichern, Archivieren und
|
||||
Medienänderungen verwenden ein bedingtes Update auf die erwartete Revision.
|
||||
Eine veraltete Bearbeitung liefert einen Konflikt und verändert weder Piece noch
|
||||
Zuordnungen. Archivieren merkt sich den vorherigen Arbeitsstatus für die
|
||||
Wiederherstellung. Duplikate erhalten neue IDs und unabhängige Bilddateien.
|
||||
Piece-Dauern werden in den Fundus- und Verwendungseditoren als Minuten erfasst,
|
||||
an der Servergrenze auf volle Sekunden gerundet und ausschließlich als ganze
|
||||
Sekunden persistiert.
|
||||
|
||||
Markdown wird roh gespeichert, mit Marked serverseitig gerendert und danach mit
|
||||
sanitize-html auf eine kleine Allowlist reduziert. Bilder werden nicht über
|
||||
Markdown eingebettet. Uploads akzeptieren höchstens 5 MB und nur anhand ihrer
|
||||
Dateisignatur erkannte JPEG-, PNG-, WebP- oder GIF-Dateien. Interne Dateinamen
|
||||
sind zufällige IDs; Originalnamen werden nie als Pfad verwendet. `/media/[id]`
|
||||
prüft die Anmeldung und liefert private Antworten mit `no-store`, `nosniff`,
|
||||
Same-Origin-Ressourcenrichtlinie und restriktiver CSP aus.
|
||||
|
||||
Ein Piece kann genau eines seiner aktiven Medien ausdrücklich als
|
||||
Präsentationsbild auswählen. Die Auswahl liegt in `piece_presentation_media`;
|
||||
das Entfernen setzt am Medium einen Zeitstempel statt die Datei zu löschen.
|
||||
Damit bleiben bereits erzeugte `usage_media_snapshots` auflösbar, während neue
|
||||
Einplanungen und der Originaleditor nur aktive Medien berücksichtigen. Das
|
||||
Soft Delete eines Pieces setzt ebenfalls nur `deleted_at_utc`: normale Listen
|
||||
und neue Einplanungen schließen es aus, bestehende Verwendungsreferenzen und
|
||||
Snapshots bleiben unverändert erhalten.
|
||||
|
||||
## Sendungsbau
|
||||
|
||||
Etappe 4 bündelt alle Planungsmutationen in `src/lib/server/shows.ts`. Eine
|
||||
Sendung ist die Konflikt- und Transaktionsgrenze: Jede Änderung an Metadaten,
|
||||
Abschnitten, Verwendungen oder Reihenfolge vergleicht die erwartete Revision und
|
||||
erhöht sie atomar. Abgeschlossene Sendungen sind bereits an dieser Grenze gegen
|
||||
weitere Bearbeitung geschützt.
|
||||
|
||||
Beim Einplanen werden Titel, Dauer, Einleitung, Recherche, Moderation,
|
||||
Interaktion, Überleitung und der vollständige Präsentationszustand aus dem sendefertigen
|
||||
Piece kopiert. Dazu gehören Modus, ausgewählte Quelladresse samt Zeitmarke,
|
||||
Metadaten und validierte Anbieter-ID. Zusätzlich speichern eigene geordnete
|
||||
Tabellen alle Quellen, Werkzeugnamen samt Start-/Arbeitslink und Notiz, die
|
||||
Themennamen samt Icon sowie das ausdrücklich ausgewählte Präsentationsmedium.
|
||||
Eigene Notizen liegen ausschließlich an
|
||||
der Verwendung. Die Referenz zum Original bleibt für Historie und
|
||||
Nachvollziehbarkeit erhalten, wird aber nicht live gespiegelt. Eine explizite
|
||||
Aktualisierung aus dem Fundus ersetzt Titel, Dauer, alle fünf Redaktionstexte
|
||||
und den Präsentationszustand atomar aus dem referenzierten Original. Eigene
|
||||
Notizen, Status und vorhandene Live-Intervalle werden dabei nicht verändert;
|
||||
fehlt das Original oder ist die Sendungsrevision veraltet, wird die gesamte
|
||||
Mutation verworfen.
|
||||
Eine Einplanung zu duplizieren kopiert genau diesen Snapshot mit derselben
|
||||
Original-ID direkt hinter das Ausgangselement. Die neue Verwendung erhält den
|
||||
Status `open`, eine neue ID und damit weder Live-Referenzen noch Zeitintervalle.
|
||||
|
||||
Die Verwendungshistorie wird nicht separat gepflegt. Sie wird über die
|
||||
Original-ID aus Verwendungen mit Status `done` in abgeschlossenen Sendungen
|
||||
abgeleitet; Reservebank und alle anderen Verwendungs- oder Sendungsstatus sind
|
||||
ausgeschlossen. Über dieselbe Original-ID wird unabhängig davon ermittelt, ob
|
||||
mindestens eine Verwendung in einer noch nicht abgeschlossenen Sendung liegt.
|
||||
Der allgemeine Fundus blendet diesen globalen Kontext standardmäßig aus. Die
|
||||
Quellspalte einer Sendung betrachtet für ihren separaten Einplanungsfilter nur
|
||||
die aktuelle Sendung einschließlich Reservebank.
|
||||
|
||||
Jede Sendung besitzt intern genau einen ausgeblendeten Reserveabschnitt. Dadurch
|
||||
verwenden Plan und Reserve dieselbe geprüfte Verwendungslogik, während die
|
||||
Reserve in der öffentlichen Struktur und allen Dauerberechnungen getrennt
|
||||
bleibt. Positionen werden nach jeder Transaktion kollisionsfrei normalisiert.
|
||||
Eine explizite Abschnittsdauer ersetzt die Summe der Verwendungen vollständig.
|
||||
|
||||
Sendungsvorlagen und ihre Abschnitte sind eigene Tabellen. Beim Anlegen werden
|
||||
die Abschnitte mit neuen IDs kopiert; spätere Änderungen an der Sendung können
|
||||
die Vorlage deshalb nicht verändern.
|
||||
|
||||
Die Sendungsübersicht leitet Liste, Desktop-Monatsraster und mobile Monatsagenda
|
||||
aus derselben `listShows()`-Abfrage ab. UTC-Zeitpunkte werden erst für Gruppierung
|
||||
und Anzeige nach `Europe/Berlin` in zivile Kalendertage übersetzt. Sendungen ohne
|
||||
Startzeit bleiben in einem eigenen Bereich sichtbar. `users.show_overview_view`
|
||||
speichert ausschließlich die kontobezogene Darstellungspräferenz; der gewählte
|
||||
Monat bleibt URL-Zustand und verändert keine Sendungsdaten.
|
||||
|
||||
Die Direktanlage aus einer Sendung erzeugt Piece und Verwendung innerhalb einer
|
||||
verschachtelbaren SQLite-Transaktion. `planning_commands` speichert die
|
||||
Befehls-ID und das Ergebnis, sodass ein wiederholter Request dieselben IDs
|
||||
zurückgibt und weder ein zweites Piece noch eine zweite Einplanung erzeugt.
|
||||
|
||||
Die Editorformulare bleiben progressive SvelteKit-Form-Actions, werden im
|
||||
Browser aber mit `use:enhance` gesendet. Der Verwendungseditor liegt in einem
|
||||
nativen Dialog, den ein beschrifteter Icon-Button öffnet. Dadurch bleibt das
|
||||
Dokument bei Planungsmutationen bestehen; nur die serverseitigen Seitendaten
|
||||
werden aktualisiert. Ladeanzeige und FLIP-Animation liegen am betroffenen
|
||||
Abschnitt oder an der betroffenen Verwendung. Eindeutige Drag-Griffe übertragen
|
||||
entweder eine Quellenkopie, einen Abschnitt oder eine Verwendung auf dieselben
|
||||
serverseitig geprüften Actions wie die alternativen Schaltflächen. Während des
|
||||
Ziehens bleibt das Original transparent an seinem Ausgangsort; eine flüchtige
|
||||
Vorschau in der Liste belegt bereits die anhand der Zeigerposition berechnete
|
||||
Zielhöhe und verdrängt dadurch die benachbarten Elemente. Persistiert wird erst
|
||||
beim Loslassen.
|
||||
|
||||
Die Ausschlussfilter für gesendete und bereits eingeplante Pieces arbeiten
|
||||
clientseitig auf der serverseitig berechneten Kontextmenge. Ihr Zustand wird
|
||||
ohne Navigation in die URL übernommen und bei nachfolgenden Suchfiltern
|
||||
mitgesendet. Planmutationen invalidieren anschließend die Seitendaten, sodass
|
||||
das Entfernen der letzten Einplanung ein Original unmittelbar wieder anbietet.
|
||||
|
||||
## Live-Modus und Präsentationsgrenze
|
||||
|
||||
`src/lib/server/live.ts` ist die Transaktionsgrenze der Live-Durchführung. Der
|
||||
Live-Stand besitzt eine eigene Revision. Jeder steuernde Befehl trägt zusätzlich
|
||||
eine vom Browser erzeugte Befehls-ID; `(show_id, command_id)` ist eindeutig und
|
||||
liefert bei Wiederholung das bereits gespeicherte Ergebnis. Tatsächliche Zeiten
|
||||
liegen als mehrere Start-/Endintervalle je Verwendung vor. Damit bleiben
|
||||
Zurückgehen, Wiederaufnahme und bereits abgeschlossene Laufzeit getrennt von der
|
||||
geplanten Dauer nachvollziehbar.
|
||||
|
||||
`live_show_timer_runs` hält die unabhängige Gesamtzeit. Pause und Fortsetzen
|
||||
behandeln Gesamt-, Abschnitts- und Piece-Intervalle gemeinsam. Beenden schließt
|
||||
laufende Intervalle und setzt `ended_at_utc`, finalisiert die Sendung aber noch
|
||||
nicht. Eine ausdrückliche Wiederaufnahme bewahrt Zeiten und Fortschritt; nur
|
||||
„Neuer Durchlauf“ verwirft Laufintervalle und setzt die Piece-Status zurück. Die
|
||||
Restzeitschätzung verwendet je Abschnitt entweder die positive Abschnittsdauer
|
||||
oder die verbleibenden Piece-Dauern und zählt beide nie zusammen.
|
||||
|
||||
Die interne Route `/live` benötigt weiterhin eine aktive Sitzung und darf
|
||||
Recherche, Moderation und eigene Arbeitsdaten lesen. Die separate Ausgabe nutzt
|
||||
den stabilen Kanal `/heinzlive/default` in einem reduzierten Layout ohne
|
||||
Navigation oder Nutzerdaten. Der geheime 256-Bit-Schlüssel steht nur im
|
||||
URL-Fragment und wird per POST gegen ein `HttpOnly`-, `SameSite=Strict`-Cookie
|
||||
getauscht. SQLite speichert seinen SHA-256-Hash für die Zugangsprüfung sowie den
|
||||
rohen Schlüssel, weil die angemeldete Steuerung dieselbe stabile OBS-Adresse
|
||||
erneut ausgeben können muss. Datenbank und Sicherungen sind deshalb Teil der
|
||||
Geheimnisgrenze. Eine Rotation widerruft den bisherigen Schlüssel, normales
|
||||
erneutes Öffnen behält ihn bei.
|
||||
Das private Markdownfeld „Interaktion“ wird am Original und als
|
||||
Verwendungssnapshot gespeichert und ausschließlich in der authentifizierten
|
||||
Live-Regie gerendert. Page, Polling-JSON und Proxyrouten leiten ihre Daten aus einer eigenen
|
||||
Positivliste ab. Private Quellen-/Werkzeug-Snapshots, Arbeitslinks, Notizen und
|
||||
Uploads werden nicht veröffentlicht; nur Themennamen sowie die ausdrücklich
|
||||
gewählte Link- oder Videoquelle und deren erlaubte Vorschau-URL können die
|
||||
Grenze passieren.
|
||||
Lokale Betrachtungsnavigation, Fortschaltung oder Wiederaufnahme verändern den
|
||||
Präsentationsstand nicht. Zurück und die Auswahl einer Ablaufzeile wechseln nur
|
||||
den im Browser betrachteten Verwendungssnapshot; tatsächliches Live-Piece,
|
||||
Status, Timer und Ausgabe bleiben serverseitig unverändert. Die öffentliche
|
||||
Projektion liest ausschließlich den ausdrücklich präsentierten
|
||||
Verwendungssnapshot; spätere Änderungen am Original erscheinen erst nach einer
|
||||
ausdrücklichen Snapshot-Aktualisierung.
|
||||
|
||||
Linkmetadaten werden nur auf ausdrückliche Aktion durch
|
||||
`src/lib/server/presentation.ts` geladen. Jeder HTTP(S)-Abruf löst den Zielhost
|
||||
serverseitig auf, sperrt lokale und private IPv4-/IPv6-Ziele und bindet den
|
||||
Request an die geprüfte Adresse. Dieselbe Prüfung gilt nach höchstens drei
|
||||
Redirects. Zeit- und Größenlimits begrenzen HTML, Anbieter-Metadaten und Bilder.
|
||||
Externe Vorschaubilder gelangen nur über token- beziehungsweise
|
||||
sitzungsgebundene Proxyrouten in die Ausgabe; fremdes HTML und fremde Skripte
|
||||
werden nie übernommen.
|
||||
|
||||
Videoquellen werden aus der gespeicherten URL erneut auf eine streng validierte
|
||||
YouTube- oder TikTok-ID reduziert. Der Browser erhält nur daraus erzeugte
|
||||
offizielle Embed-URLs, startet sie nicht automatisch und ersetzt das Iframe bei
|
||||
jedem Inhaltswechsel. YouTube erhält die Startsekunde als Embed-Parameter;
|
||||
TikTok wird nach dessen Bereitschaft über die offizielle Player-`postMessage`-
|
||||
Schnittstelle positioniert. Nicht unterstützte oder unvollständige Videoquellen
|
||||
fallen auf eine normale Linkkarte zurück. Eine authentifizierte Testansicht
|
||||
verwendet denselben Renderer, schreibt aber keinen Live-Zustand.
|
||||
|
||||
Die Ausgabe synchronisiert ihren kleinen öffentlichen Zustand per
|
||||
`no-store`-Polling. Der letzte gültige Inhalt bleibt bei einem Verbindungsfehler
|
||||
sichtbar; die Oberfläche kennzeichnet den Abbruch und versucht die Verbindung
|
||||
mit verlangsamtem Intervall erneut. Private Live-Daten werden nicht Teil dieses
|
||||
Zustandsobjekts.
|
||||
|
||||
## Abschluss, Historie und Lesefreigaben
|
||||
|
||||
`src/lib/server/completion.ts` ist die Transaktionsgrenze des endgültigen
|
||||
Sendungsabschlusses. Er verlangt einen beendeten Live-Lauf sowie passende Show-
|
||||
und Live-Revisionen. Eine Befehls-ID in `show_finalizations` macht Wiederholungen
|
||||
idempotent. In derselben Transaktion werden offene Intervalle geschlossen,
|
||||
Abschnittskategorien eingefroren, ausschließlich erledigte Verwendungen außerhalb
|
||||
der Reservebank in `piece_usage_history` materialisiert, bewusst gewählte
|
||||
Fundus-Originale archiviert und die Sendung auf `completed` gesetzt. Jede normale
|
||||
Planungs- und Live-Mutation sperrt diesen Zustand.
|
||||
|
||||
Die eigentlichen Sendungstexte, Quellen, Werkzeuge, Themen und Medien liegen
|
||||
weiterhin in den beim Einplanen erzeugten Usage-Snapshots. Finalisierung friert
|
||||
die zuvor noch katalogabhängige Abschnittskategorie ein. Abgeschlossene
|
||||
Sendungen werden ausschließlich gelesen oder vollständig in einen neuen Entwurf
|
||||
dupliziert. Das Duplikat erhält neue Show-, Abschnitts-, Usage- und Relations-IDs,
|
||||
offene Usage-Status und weder Live-, Historien- noch Freigabedaten.
|
||||
|
||||
`src/lib/server/shares.ts` erzeugt für Barkeeper zufällige 256-Bit-Lesetokens;
|
||||
SQLite speichert nur SHA-256-Hashes. Eine Freigabe verweist direkt auf eine
|
||||
Sendung und darf deshalb bereits im Entwurf, im bereiten oder im laufenden
|
||||
Zustand entstehen. Der Umfang ist eine Positivliste aus `rundown`, `moderation`
|
||||
oder `research`. Optionale Passwörter liegen als Argon2id-Hash vor. Nach
|
||||
erfolgreicher Prüfung entsteht eine höchstens zwölf Stunden gültige, ebenfalls
|
||||
nur gehashte Gast-Sitzung; Fehlversuche werden pro Link und Clientadresse
|
||||
begrenzt. Änderungen an Umfang, Passwort oder Ablauf invalidieren bestehende
|
||||
Gast-Sitzungen. Ablauf und Löschung werden bei jedem HTML-, Seitendaten- und
|
||||
Medienrequest erneut geprüft.
|
||||
|
||||
Die öffentliche Route `/freigabe/[token]` erhält keine interne Sendungs-ID und
|
||||
keinen ungefilterten `Show`-Datensatz. Sie projiziert genau die am Token gebundene
|
||||
Sendung und nur die Felder ihres Umfangs. Vor dem Abschluss werden aktuelle
|
||||
Sendungs- und Usage-Snapshots bei jedem Aufruf neu gelesen; danach liefert
|
||||
dieselbe Projektion die durch die Finalisierung stabilisierten Snapshots. Die
|
||||
separate Medienroute akzeptiert ausschließlich das ausdrücklich gewählte
|
||||
Präsentationsmedium einer eingeplanten Nicht-Reserve-Verwendung derselben
|
||||
Sendung. Private `/media`-Dateien bleiben weiterhin an eine Redaktionssitzung
|
||||
gebunden.
|
||||
|
||||
Die wiederverwendbare Barkeeper-Komponente `ShareManagement.svelte` liegt direkt
|
||||
in der Sendungsbearbeitung und in der Verwaltung. Beide Routen verwenden
|
||||
dieselben Servicefunktionen für Anlage, Bearbeitung und Löschung; die
|
||||
Sendungsroute bindet Mutationen zusätzlich an ihre eigene Sendungs-ID. Die
|
||||
Verwaltung gruppiert bestehende Freigaben nach Sendung und zeigt deren aktuellen
|
||||
Status und Termin.
|
||||
|
||||
## Oberflächenstruktur
|
||||
|
||||
Die Hauptnavigation umfasst Eingang, Fundus, Sendungen, Archiv und Verwaltung.
|
||||
Auf breiten Ansichten stehen Fundus und Ablauf nebeneinander. Auf schmalen
|
||||
Ansichten werden sie über eine gut erreichbare Umschaltung einzeln gezeigt.
|
||||
Der Live-Modus ist eine eigene, fokussierte Ansicht; die spätere
|
||||
Präsentationsausgabe erhält eine separate, strikt reduzierte Datenansicht.
|
||||
Auf dem Desktop bleibt eine feste Seitenleiste sichtbar; Verwaltung liegt an
|
||||
ihrem unteren Ende. Bis einschließlich `52rem` ersetzen eine obere Leiste und
|
||||
die untere Hauptnavigation die Seitenleiste vollständig. Auf breiten Ansichten
|
||||
stehen Fundus und Ablauf nebeneinander. Bis einschließlich `72rem` werden sie
|
||||
über eine gut erreichbare Umschaltung einzeln gezeigt, damit auch schmale
|
||||
Desktopfenster ohne horizontalen Überlauf bedienbar bleiben.
|
||||
Die Sendungsübersicht schaltet über zwei gleichwertige Formularaktionen zwischen
|
||||
Liste und Kalender um. Auf breiten Ansichten erscheint ein siebenspaltiges
|
||||
Monatsraster ohne Termin-Drag-and-drop; bis `52rem` ersetzt es eine lineare,
|
||||
touchfreundliche Agenda desselben Monats.
|
||||
Der Live-Modus ist eine eigene, fokussierte Arbeitsansicht. Die
|
||||
Präsentationsausgabe verwendet eine separate, strikt reduzierte Datenansicht
|
||||
ohne interne Anwendungsnavigation.
|
||||
|
||||
Etappe 1 zeigt Fundus, Sendungsbau und Live-Modus als sichtbare
|
||||
`Gestaltungsvorschau`. Die Daten kommen bereits aus SQLite, mutierende
|
||||
Fachabläufe werden jedoch nicht vorgetäuscht.
|
||||
Die private Route `/live` verwendet ebenfalls einen eigenen authentifizierten
|
||||
Layoutmodus ohne allgemeine Seitenleiste, mobilen App-Header oder
|
||||
Bottomnavigation. Ihre Regiefläche belegt die verfügbare Viewporthöhe als Raster
|
||||
aus fester Statuszeile, unabhängig scrollender Piece- und Ablaufspalte sowie
|
||||
fester Aktionszeile. Die Breite entscheidet über zwei Spalten oder das mobile
|
||||
Sheet; eine geringe Desktophöhe verdichtet zusätzlich Abstände und Leisten,
|
||||
ohne Schrift oder Oberfläche zu skalieren. Unterhalb des schmalen Breakpoints
|
||||
wird ausschließlich die Ablaufspalte als modales Sheet mit Fokusbegrenzung
|
||||
eingeblendet; beim Wechsel auf einen breiteren Viewport wird dieser Modalzustand
|
||||
aufgehoben. Die lokale Betrachtungsnavigation ist keine Live-Action; erst
|
||||
Präsentieren, Überspringen und Erledigen schreiben den jeweiligen getrennten
|
||||
Zustand. Die öffentliche `/heinzlive`-Projektion bleibt unverändert. Lokale
|
||||
Lesepositionen sind an die jeweilige Verwendung gebunden und werden nicht
|
||||
zwischen Pieces übertragen.
|
||||
|
||||
## Sicherheitsgrenzen ab den Folgeetappen
|
||||
Der Live-Kopf besteht aus zwei regulären Rasterzeilen. Abschnitt und folgendes
|
||||
Piece sind einzeilig gekürzte, fokussierbare Schaltflächen, die ihren vollständigen
|
||||
Text lokal aufklappen. Das Regiemenü wird bei Bedarf als fest am Viewport
|
||||
positionierter Dialog neben dem Kopf gerendert. Dadurch unterliegt es weder dem
|
||||
Overflow der Regiefläche noch dem durch Glasfilter erzeugten Stacking Context;
|
||||
seine maximale Höhe bleibt an den Viewport gebunden und intern scrollbar.
|
||||
|
||||
Authentifizierung und Autorisierung werden serverseitig an jeder Route und
|
||||
Action geprüft. Markdown und fremdes HTML werden vor Ausgabe bereinigt.
|
||||
Uploadzugriff folgt denselben Rechten. Netzwerkabrufe erhalten Schutz gegen
|
||||
interne Ziele, Größen-/Zeitlimits und kontrollierte Redirects. Diese Regeln
|
||||
sind geplant, aber nicht Bestandteil der Etappe-1-Vorschauen.
|
||||
Icons werden aus dem lokalen Font-Awesome-Classic-Regular-Sprite unter
|
||||
`static/icons` gerendert. Die Verwaltung lädt zusätzlich die durchsuchbaren
|
||||
Metadaten aller 3.671 Icons, zeigt je Suchergebnis aber höchstens 120 Einträge
|
||||
gleichzeitig. Allgemeine Seiten wie Login oder Navigation laden den Katalog
|
||||
nicht in ihren Client-Chunk.
|
||||
|
||||
Der eigenständige Piece-Editor ordnet denselben Formvertrag als redaktionelles
|
||||
Arbeitsblatt an. Titel, Fundstück, private Recherche sowie Einleitung,
|
||||
Moderationsstichpunkte und Überleitung bilden die primäre Schreibfläche.
|
||||
Quellen, Einordnung, Präsentation und eine Bildzusammenfassung liegen auf breiten
|
||||
Ansichten in einer kontextuellen Seitenleiste; auf kleinen Ansichten öffnen
|
||||
dieselben DOM-Formfelder als fokussierbare Werkzeugflächen und werden dabei nicht
|
||||
neu erzeugt oder ausgehängt. `EditorialMarkdownField` hält Lese- und
|
||||
Bearbeitungszustand je Textfeld lokal, während alle Werte weiterhin gemeinsam
|
||||
über die bestehende `save`-Action und Piece-Revision gespeichert werden. Die
|
||||
separate Bild-Action und alle Präsentationsactions bleiben eigene serverseitige
|
||||
Mutationen.
|
||||
|
||||
## Sicherheitsgrenzen
|
||||
|
||||
Authentifizierung und Autorisierung werden seit Etappe 2 serverseitig an jeder
|
||||
betroffenen Route und Action geprüft. Markdown und fremdes HTML werden vor
|
||||
Ausgabe bereinigt. Uploadzugriff folgt denselben Rechten. Netzwerkabrufe für
|
||||
Präsentationsmetadaten und Vorschaubilder schützen interne Ziele auch nach
|
||||
DNS-Auflösung und Redirects und besitzen Größen-, Zeit- und Redirectlimits.
|
||||
|
||||
## Wartungsfelder 0.6.1
|
||||
|
||||
Migration `0017` ergänzt den optionalen Vorbereitungsaufwand am Original und
|
||||
kommagetrennt validierte Twitch-Tags am Abschnitt. Der Bildmodus wird wegen der
|
||||
bestehenden SQLite-Check-Constraints als zusätzliches Kennzeichen an Original
|
||||
und Usage-Snapshot gespeichert; nach außen bleibt er der eindeutige Modus
|
||||
`image`. Öffentlich passiert weiterhin nur das ausdrücklich gewählte
|
||||
Präsentationsmedium.
|
||||
|
||||
## Wartungskorrekturen 0.7.1
|
||||
|
||||
Migration `0019` ergänzt `preparation_status_snapshot` und
|
||||
`preparation_effort_snapshot` an `piece_usages` und übernimmt für vorhandene
|
||||
Einplanungen einmalig die damaligen Originalwerte. Danach ist ausschließlich die
|
||||
konkrete Sendungsfassung maßgeblich. Einplanen, Duplizieren und bewusstes
|
||||
Aktualisieren aus dem Fundus kopieren beide Werte; der Usage-Editor ändert sie
|
||||
unabhängig. Die Übersicht berücksichtigt vorbereitende Nicht-Reserve-Usages
|
||||
aktiver Sendungen, priorisiert zuerst deren Termin und führt direkt zum Editor.
|
||||
|
||||
Ein Freigabe-Ersatzlink rotiert ausschließlich den gehashten Token derselben
|
||||
Freigabe. Umfang, Passwort-Hash und Ablauf bleiben erhalten, der alte Token und
|
||||
alle bisherigen Gastsitzungen werden in derselben Transaktion ungültig. Der neue
|
||||
Klartexttoken wird weiterhin nur in der Action-Antwort ausgegeben.
|
||||
|
||||
## Bedienkorrekturen 0.7.2
|
||||
|
||||
Der RSS-Auswahldialog erhält weiterhin ausschließlich `new`-Einträge aus
|
||||
`listFeedEntries`. Quellenfilter, Seiteneinteilung und noch nicht bestätigte
|
||||
Auswahl sind flüchtiger Browserzustand. Erst das Formular im erreichbaren
|
||||
Dialogfuß übergibt die gewählten IDs an die unveränderte transaktionale
|
||||
Übernahme; dadurch bleiben persistenter Dublettenschutz, Herkunft und
|
||||
Standardkategorien die einzige fachliche Wahrheit.
|
||||
|
||||
Feed- und Zugangsdialoge verwenden dieselben globalen Management-Dialog- und
|
||||
Katalogstile wie Werkzeuge. Das Bearbeiten eines technischen Zugangs ändert nur
|
||||
Name und Umfang des bestehenden gehashten Tokens und wird auditiert. Die
|
||||
Live-Route projiziert zusätzlich nur, ob der feste Ausgabekanal getrennt, mit
|
||||
dieser oder mit einer anderen Sendung verbunden ist. Das Öffnen von Menü und
|
||||
Ausgabedetails führt selbst keine Mutation aus.
|
||||
+452
-1
@@ -1,6 +1,6 @@
|
||||
# Entscheidungen
|
||||
|
||||
Stand der Quellenprüfung: 21. Oktober 2026. Verwendet wurden offizielle
|
||||
Stand der Quellenprüfung: 22. Oktober 2026. Verwendet wurden offizielle
|
||||
Dokumentationen und die npm-Registry für konkrete Paket-Metadaten.
|
||||
|
||||
## D-001: SvelteKit 3 und Node-Unterstützung
|
||||
@@ -81,3 +81,454 @@ Vorschauseiten lesen echte persistente SQLite-Seed-Daten, bieten aber keine
|
||||
funktionslosen Speichern- oder Live-Schaltflächen. Ein sichtbarer Hinweis
|
||||
grenzt Gestaltungsvorschauen von den späteren Fachfunktionen ab. Damit wird
|
||||
keine noch nicht implementierte Funktion als fertig dargestellt.
|
||||
|
||||
## D-007: Arbeitsansicht nach verfügbarem Platz
|
||||
|
||||
Die feste Desktop-Seitenleiste wird bis `52rem` verwendet und dann vollständig
|
||||
durch mobile Kopf- und Fußnavigation ersetzt. Der Sendungsbau schaltet bereits
|
||||
bis `72rem` von zwei Spalten auf eine bedienbare Pane-Umschaltung um. Dadurch
|
||||
bleibt die Desktopnavigation in schmalen Fenstern erhalten, ohne Fundus und
|
||||
Ablauf zusammenzudrücken.
|
||||
|
||||
Der Fundus erscheint auf dem Desktop als kompakte Liste und auf kleinen
|
||||
Bildschirmen als Kartenfolge. Vorschau- und Schreibschutzinformationen sind in
|
||||
einem nativen, tastaturbedienbaren `details`-Element gebündelt. Diese
|
||||
Darstellungsentscheidung ändert weder Datenmodell noch Funktionsumfang.
|
||||
|
||||
## D-008: Widerrufbare Datenbanksitzungen und Argon2id
|
||||
|
||||
Sendewerk verwendet Datenbanksitzungen statt JWT. SvelteKit empfiehlt diesen
|
||||
Ansatz, wenn sofortiger Widerruf wichtiger als eine zusätzliche Datenbankabfrage
|
||||
ist. Ein zufälliges Sitzungstoken liegt nur als SHA-256-Hash in SQLite; der
|
||||
Browser erhält es als `HttpOnly`-, `SameSite=Lax`-Cookie. Nutzerstatus und Rolle
|
||||
werden bei jedem Request erneut verbunden. Lokal erlaubt eine explizite
|
||||
`http:`-Origin Cookies ohne `Secure`, bei `https:` wird `Secure` gesetzt.
|
||||
|
||||
Passwörter hasht `@node-rs/argon2` 2.2.2 mit Argon2id und den dokumentierten
|
||||
Paketparametern. Zufallstokens und SHA-256 stammen aus `node:crypto`; eigene
|
||||
Kryptoprimitive werden nicht implementiert.
|
||||
|
||||
Quellen:
|
||||
|
||||
- <https://svelte.dev/docs/kit/auth>
|
||||
- <https://svelte.dev/docs/kit/hooks>
|
||||
- <https://github.com/napi-rs/node-rs/tree/main/packages/argon2>
|
||||
|
||||
## D-009: Form-Actions, geschlossenes Setup und Rollenprüfung
|
||||
|
||||
Alle Auth-Schreibvorgänge verwenden POST-Form-Actions beziehungsweise einen
|
||||
POST-Endpunkt. SvelteKits gleichursprüngliche Formularprüfung bleibt aktiv. Der
|
||||
Erstadmin erfordert ein mindestens 32 Zeichen langes Betreiber-Setup-Token und
|
||||
eine transaktional geprüfte leere Nutzertabelle. Danach bleibt `/setup`
|
||||
geschlossen. Barkeeper-Rechte werden in jeder Verwaltungsaktion erneut geprüft;
|
||||
UI-Sichtbarkeit ist keine Sicherheitsgrenze.
|
||||
|
||||
Quelle: <https://svelte.dev/docs/kit/form-actions>
|
||||
|
||||
## D-010: Lokale Mail-Outbox als sichere Vorgabe
|
||||
|
||||
Der Mailmodus ist standardmäßig `local` und schreibt Einladungs-/Resetnachrichten
|
||||
in einen konfigurierten persistenten Pfad. Dadurch wird lokal keine echte Mail
|
||||
ungefragt versandt. Nur die explizite Auswahl `smtp` initialisiert Nodemailer;
|
||||
bei SMTP sind Host und Absender verpflichtend. Outbox-Dateien sind private
|
||||
Geheimnisträger und werden weder versioniert noch über eine Route ausgeliefert.
|
||||
|
||||
Nodemailer 10.1.7 unterstützt Node 20 oder neuer und ist MIT-0-lizenziert.
|
||||
Quelle: <https://github.com/nodemailer/nodemailer>
|
||||
|
||||
## D-011: Form-Actions und optimistische Piece-Revisionen
|
||||
|
||||
Piece-Schreibvorgänge bleiben normale SvelteKit-Form-Actions und funktionieren
|
||||
damit ohne clientseitiges JavaScript. `use:enhance` ergänzt den Editor um
|
||||
verzögertes Autospeichern und sichtbare Zustände. Vor interner Navigation wird
|
||||
eine ausstehende Änderung gespeichert; beim Verlassen der Seite greift die
|
||||
Browserwarnung. Jede Mutation vergleicht eine erwartete ganzzahlige Revision in
|
||||
derselben SQLite-Transaktion. Veraltete Änderungen liefern 409 und überschreiben
|
||||
keine aktuelleren Inhalte oder Zuordnungen.
|
||||
|
||||
Quelle: <https://svelte.dev/docs/kit/form-actions>
|
||||
|
||||
## D-012: Markdown immer nach dem Parsen bereinigen
|
||||
|
||||
Marked 18.1.1 rendert die gespeicherten Markdown-Texte serverseitig. Marked
|
||||
weist ausdrücklich darauf hin, dass seine HTML-Ausgabe nicht bereinigt ist.
|
||||
Darum reduziert sanitize-html 2.18.1 das Ergebnis anschließend auf ausgewählte
|
||||
Text-, Listen-, Code- und Linkelemente. Skripte, Bilder, Ereignisattribute,
|
||||
relative Protokoll-URLs und andere Schemata werden nicht zugelassen.
|
||||
|
||||
Quellen:
|
||||
|
||||
- <https://github.com/markedjs/marked>
|
||||
- <https://github.com/apostrophecms/apostrophe/tree/main/packages/sanitize-html>
|
||||
|
||||
## D-013: Private Rasterbilder außerhalb statischer Assets
|
||||
|
||||
Uploads liegen ausschließlich im konfigurierten privaten Uploadverzeichnis und
|
||||
werden über zufällige interne Namen adressiert. file-type 22.2.0 erkennt den Typ
|
||||
aus dem Dateiinhalt; Client-MIME und Originalname entscheiden nicht über Typ oder
|
||||
Pfad. Zugelassen sind JPEG, PNG, WebP und GIF bis 5 MB. SVG und allgemeine
|
||||
Dokumente bleiben ausgeschlossen. Eine authentifizierte ID-Route liefert Bilder
|
||||
mit sicherheitsrelevanten Headern aus. Das Adapter-Requestlimit liegt mit 6 MB
|
||||
knapp oberhalb des fachlichen Dateilimits.
|
||||
|
||||
Quelle: <https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload>
|
||||
|
||||
## D-014: Sendung als transaktionales Aggregat
|
||||
|
||||
Eine ganzzahlige Revision auf `shows` schützt in Etappe 4 sämtliche Metadaten,
|
||||
Abschnitte, Verwendungen und Reihenfolgen gemeinsam. Jede Mutation erhöht die
|
||||
Revision in derselben SQLite-Transaktion. Damit können voneinander abhängige
|
||||
Listenänderungen nicht teilweise gespeichert oder durch einen veralteten
|
||||
Browserstand unbemerkt überschrieben werden.
|
||||
|
||||
Verwendungen speichern vollständige redaktionelle Text- und Dauerkopien. Die
|
||||
Original-ID bleibt Referenz, ist aber keine Live-Datenquelle. Eine interne,
|
||||
eindeutige Reservesection pro Sendung erlaubt dieselben geprüften Verschiebe-
|
||||
und Löschoperationen für Plan und Reserve; Dauerabfragen schließen sie aus.
|
||||
|
||||
## D-015: Drag-and-drop nur als zusätzliche Bedienung
|
||||
|
||||
Abschnitte, Verwendungen und gefilterte Quellen können über eindeutige Griffe
|
||||
gezogen werden. Dieselben Ergebnisse sind mit sichtbaren
|
||||
Hoch-/Runter-Schaltflächen und Zielauswahl erreichbar. Diese Bedienelemente
|
||||
funktionieren mit einfachem Klick, Touch und Tastatur auch ohne Drag-and-drop
|
||||
oder clientseitige Spezialgesten. Das folgt WCAG 2.2 SC 2.5.7;
|
||||
Tastaturzugang allein wäre keine ausreichende Zeigeralternative. Die
|
||||
zugehörigen Form-Actions werden progressiv verbessert: Ohne JavaScript bleiben
|
||||
normale POSTs möglich, mit JavaScript erfolgt die Aktualisierung ohne
|
||||
Dokumentreload und mit lokalem Speicherzustand.
|
||||
|
||||
Quellen:
|
||||
|
||||
- <https://www.w3.org/WAI/WCAG22/Understanding/dragging-movements>
|
||||
- <https://svelte.dev/docs/kit/form-actions>
|
||||
|
||||
## D-016: Live-Befehle idempotent, tatsächliche Zeiten als Intervalle
|
||||
|
||||
Die Live-Steuerung verwendet eine eigene Revision und zusätzlich eine pro
|
||||
Bedienaktion erzeugte Befehls-ID. Die Datenbank akzeptiert jede Kombination aus
|
||||
Sendung und Befehls-ID nur einmal. Ein nach Verbindungsabbruch wiederholter
|
||||
Befehl liefert dieselbe Ergebnisrevision und erzeugt weder einen zweiten
|
||||
Statuswechsel noch ein zweites Zeitintervall. Laufzeit wird nicht als einzelner
|
||||
überschreibbarer Wert, sondern als Summe abgeschlossener und höchstens eines
|
||||
aktiven Intervalls ermittelt. Dadurch bleiben Zurückgehen und Wiederaufnahme
|
||||
korrekt.
|
||||
|
||||
## D-017: Präsentationsausgabe als Positivliste mit gehashtem Zugang
|
||||
|
||||
Die heinzlive-Ausgabe ist kein eingeschränkter Aufruf der internen Live-Ansicht,
|
||||
sondern eine eigene Datenprojektion. Zulässig sind ausschließlich ausdrücklich
|
||||
präsentierter Titel und Präsentationstext, öffentliche Quellen sowie zugehörige
|
||||
Bilder und Alternativtexte. Recherche, Einleitung, Moderation, eigene Notizen,
|
||||
Ablauf, Nutzer und interne Dateinamen werden nicht in HTML oder JSON übernommen.
|
||||
Ein zufälliger 256-Bit-Token steht in der URL, während SQLite nur seinen
|
||||
SHA-256-Hash speichert. Medienzugriff prüft Token, aktuelle Präsentation und
|
||||
Bildzuordnung gemeinsam. Synchronisierung erfolgt über kleines `no-store`-
|
||||
Polling statt über eine dauerhaft offene Serververbindung.
|
||||
|
||||
## D-018: Verwendung aus bestehenden Sendungsdaten ableiten
|
||||
|
||||
„Gesendet“ ist kein Zustand am Fundus-Piece. Die Anzeige wird ausschließlich
|
||||
aus der vorhandenen Original-ID, einer erledigten Verwendung außerhalb der
|
||||
Reservebank und dem Status `completed` ihrer Sendung abgeleitet. Dadurch können
|
||||
Einplanung, Reserve und Überspringen ein Original nicht versehentlich als
|
||||
gesendet markieren, und mehrere tatsächliche Verwendungen bleiben als Historie
|
||||
sichtbar.
|
||||
|
||||
Eine Duplikation im Sendungsablauf kopiert den konkreten Verwendungssnapshot und
|
||||
nicht das Original-Piece. Die neue ID, der Status `open` und fehlende
|
||||
Live-Intervalle trennen sie von der bisherigen Durchführung. Der allgemeine
|
||||
Verwendungseditor darf den Live-Status nicht mehr aus Formulardaten schreiben;
|
||||
Statuswechsel bleiben der Live-Geschäftslogik vorbehalten.
|
||||
|
||||
Eine bestehende Einplanung wird nicht automatisch mit späteren Änderungen am
|
||||
Original synchronisiert. Die ausdrücklich ausgelöste Aktion **Aus Fundus
|
||||
aktualisieren** überschreibt nur Titel, Dauer und Redaktionstexte. Eigene
|
||||
Notizen, Status und Messintervalle bleiben erhalten. Alle Zuordnungen und Filter
|
||||
verwenden ausschließlich `original_piece_id`, niemals veränderliche Titel. Im
|
||||
allgemeinen Fundus gilt „eingeplant“ global für jede nicht abgeschlossene
|
||||
Sendung; im Sendungsbau gilt es lokal für die aktuelle Sendung samt Reserve.
|
||||
|
||||
## D-019: Lokale Linkmetadaten und streng abgeleitete Video-Embeds
|
||||
|
||||
Sendewerk verwendet Metascraper ausschließlich serverseitig, um Titel,
|
||||
Beschreibung, Bild und Herausgeber einer ausdrücklich gewählten vorhandenen
|
||||
Quelle zu ermitteln. Die Ergebnisse werden gespeichert und nicht bei jedem
|
||||
Seitenaufruf neu geladen. Manuell korrigierte Felder haben Vorrang. Ein eigener
|
||||
HTTP(S)-Client prüft Protokoll, Port, DNS-Ergebnisse und jedes Redirectziel,
|
||||
bindet den Request an die geprüfte öffentliche Adresse und begrenzt Redirects,
|
||||
Laufzeit und Antwortgröße. Damit ist weder ein externer Vorschaudienst noch die
|
||||
Übernahme fremden HTMLs erforderlich.
|
||||
|
||||
Player werden nur für streng erkannte YouTube- und TikTok-URLs erzeugt. Aus der
|
||||
validierten Anbieter-ID baut Sendewerk die offiziellen Embed-Adressen selbst;
|
||||
gespeichertes oder fremd geliefertes Embed-HTML wird nicht verwendet. YouTube
|
||||
nutzt die datenschutzreduzierte `youtube-nocookie.com`-Adresse und den
|
||||
`start`-Parameter. TikTok erhält eine Startposition nach `onPlayerReady` über
|
||||
die dokumentierte Player-`postMessage`-API. Autoplay bleibt ausgeschaltet, und
|
||||
ein Inhaltswechsel ersetzt das Iframe vollständig.
|
||||
|
||||
Quellen:
|
||||
|
||||
- <https://github.com/microlinkhq/metascraper>
|
||||
- <https://developers.google.com/youtube/player_parameters>
|
||||
- <https://developers.google.com/youtube/terms/required-minimum-functionality>
|
||||
- <https://developers.tiktok.com/doc/embed-player>
|
||||
- <https://developers.tiktok.com/doc/embed-videos>
|
||||
- <https://owasp.org/www-community/attacks/Server_Side_Request_Forgery>
|
||||
|
||||
## D-020: Stabile Ausgabekanal-Adresse mit Fragment-Schlüssel
|
||||
|
||||
OBS soll eine dauerhaft konfigurierte Adresse verwenden können, ohne dass ein
|
||||
Zugangsschlüssel in HTTP-Requests, Serverlogs oder Referer-Headern erscheint.
|
||||
Darum bleibt die Kanaladresse `/heinzlive/default` stabil und trägt den
|
||||
zufälligen Schlüssel ausschließlich als URL-Fragment. Ein kleiner Browser-POST
|
||||
tauscht ihn gegen ein `HttpOnly`-, `SameSite=Strict`-Cookie; danach greifen
|
||||
Seite, Polling und erlaubte Proxys nur mit diesem Cookie zu. Für die Prüfung
|
||||
liegt ein SHA-256-Hash vor. Der rohe Schlüssel muss zusätzlich in SQLite
|
||||
gespeichert werden, weil die angemeldete Steuerung dieselbe stabile OBS-Adresse
|
||||
nach einem Neustart erneut ausgeben können muss. Damit sind Datenbank und
|
||||
Sicherungen bewusst Teil der Geheimnisgrenze. Wiederholtes Öffnen behält den
|
||||
Schlüssel, eine ausdrückliche Rotation widerruft ihn sofort.
|
||||
|
||||
Die öffentliche Projektion folgt einer engeren Positivliste als der interne
|
||||
Piece-Snapshot. Weder private Uploads noch alle Piece-Quellen werden implizit
|
||||
veröffentlicht. Passieren dürfen nur öffentlicher Text, Präsentationstitel sowie
|
||||
die ausdrücklich gewählte und erneut validierte Link- oder Videoquelle mit
|
||||
erlaubten Vorschaufeldern.
|
||||
|
||||
## D-021: Vorlagen-Snapshots und idempotente Direktanlage
|
||||
|
||||
Persistente Piece-Vorlagen speichern validierte, tief kopierte JSON-Snapshots
|
||||
mit eigener Revision. Damit bleiben sie unabhängig von späteren Änderungen am
|
||||
Ausgangs-Piece, ohne für jedes optionale Piece-Feld eine zweite Tabellenstruktur
|
||||
zu benötigen. Die virtuelle leere Vorlage wird nicht persistiert.
|
||||
|
||||
Eine Direktanlage im Sendungsplan ist ein einzelner fachlicher Befehl. Piece,
|
||||
Verwendung und Sendungsrevision werden in derselben SQLite-Transaktion
|
||||
geschrieben. `planning_commands` macht die Befehls-ID eindeutig und speichert
|
||||
das Ergebnis, damit Wiederholungen nach Verbindungsabbrüchen keine Dubletten
|
||||
erzeugen. Interner und öffentlicher Titel werden getrennt gespeichert und beim
|
||||
Einplanen getrennt in den Verwendungssnapshot kopiert.
|
||||
|
||||
## D-022: Werkzeuge und Live-Abschnittszeit als eigene Snapshot-Grenzen
|
||||
|
||||
Favoriten bleiben ein boolesches Merkmal des Fundus-Originals. Sie ändern weder
|
||||
Revision, Status noch Verwendungshistorie und werden nicht pro Konto
|
||||
dupliziert. Der Werkzeugkatalog ist eine eigene Entität: Formatbeziehungen
|
||||
beschreiben nur die Eignung, während Piece-Zuordnungen den privaten Arbeitslink
|
||||
und die Notiz tragen. Katalogeinträge werden deaktiviert statt gelöscht, damit
|
||||
bestehende Piece- und Sendungsbezüge lesbar bleiben.
|
||||
|
||||
Beim Einplanen kopieren eigene Relationstabellen alle Quellen, Werkzeuge und
|
||||
sortierten Themennamen an die Verwendung. Damit können Katalognamen, URLs,
|
||||
Themen und Originalzuordnungen später geändert werden, ohne eine vorbereitete
|
||||
Sendung still umzuschreiben. Nur die bewusste Aktion **Aus Fundus aktualisieren**
|
||||
ersetzt diese Snapshots. Die öffentliche Positivliste darf daraus ausschließlich
|
||||
die Themen-Dachzeile übernehmen; private Materiallinks und Werkzeugdaten bleiben
|
||||
auf der authentifizierten Live-Route.
|
||||
|
||||
Der Abschnitts-Countdown verwendet von den Piece-Laufintervallen getrennte
|
||||
`live_section_timers` und `live_section_timer_runs`. Beim ersten tatsächlichen
|
||||
Eintritt wird eine positive explizite Abschnittsdauer eingefroren. Weitere
|
||||
Pieces desselben Abschnitts nutzen denselben Timer; Abschnittswechsel schließen
|
||||
ihn. So bleiben Reload und Wiederaufnahme persistent, ohne die vorhandene
|
||||
Piece-Zeiterfassung doppelt zu zählen.
|
||||
|
||||
## D-023: Ausdrückliche Medienauswahl und wiederherstellbares Entfernen
|
||||
|
||||
Ein privater Piece-Upload wird nicht allein durch seine Existenz öffentlich.
|
||||
Das Original verweist ausdrücklich auf höchstens ein aktives
|
||||
Präsentationsmedium. Beim Einplanen oder bewussten Aktualisieren wird diese
|
||||
Auswahl mit Medium-ID und Alternativtext an die Verwendung kopiert. Die
|
||||
öffentliche Route akzeptiert nur das Medium des aktuell präsentierten
|
||||
Usage-Snapshots; Originalname, interner Speicherpfad und andere Uploads bleiben
|
||||
außerhalb der Projektion.
|
||||
|
||||
Medien und Pieces werden nicht physisch gelöscht, solange bestehende
|
||||
Sendungsfassungen auf ihre unveränderlichen Snapshots angewiesen sein können.
|
||||
Zeitstempel blenden sie aus aktuellen Arbeitslisten und neuen Einplanungen aus,
|
||||
erhalten aber Referenzen und ermöglichen die Wiederherstellung von Pieces. Eine
|
||||
Verwendung oder ein Abschnitt darf dagegen nur entfernt werden, solange keine
|
||||
betroffene Verwendung jemals live gelaufen ist und weder aktuell noch
|
||||
präsentiert wird.
|
||||
|
||||
Der lokale Iconkatalog enthält die vollständige Classic-Regular-Familie mit
|
||||
3.671 Icons. Ein generierter Metadatenkatalog ermöglicht Suche und serverseitige
|
||||
Validierung, während ein statischer SVG-Sprite über den gemeinsamen
|
||||
`currentColor`-Renderer dargestellt wird. So lädt die Navigation nicht sämtliche
|
||||
Pfaddaten in ihren JavaScript-Chunk. Es gibt weder einen externen Laufzeitabruf
|
||||
noch eine Laufzeitabhängigkeit vom benachbarten Quellverzeichnis; Herkunft und
|
||||
Lizenz stehen in `THIRD_PARTY_NOTICES.md`.
|
||||
|
||||
## D-024: Private Live-Regie als fokussierter Viewport
|
||||
|
||||
Die authentifizierte Live-Steuerung nutzt einen eigenen Root-Layoutmodus und
|
||||
rendert die allgemeine App-Navigation nicht. Kopf- und Aktionszeile bleiben fest;
|
||||
Moderation und Ablauf sind die einzigen unabhängig scrollenden Arbeitsflächen.
|
||||
Die Umschaltung zum mobilen Sheet hängt von der Fensterbreite ab, damit ein
|
||||
breites, niedriges Desktopfenster weiterhin zwei Spalten verwendet. Die Höhe
|
||||
steuert dort unabhängig die Dichte von Abständen und Bedienleisten. Textgröße
|
||||
und Gesamtoberfläche werden nicht skaliert.
|
||||
|
||||
Der Kopf verwendet genau zwei kompakte Informationszeilen. Lange Kontexttitel
|
||||
bleiben im Ruhezustand einzeilig und werden auf bewusste Klick- oder
|
||||
Tastaturaktion lokal vollständig sichtbar. Das Regiemenü ist kein verschachteltes
|
||||
`details` innerhalb der Glasfläche, sondern ein explizit gesteuertes,
|
||||
viewportgebundenes Popover. So bleiben Z-Index, Maximalhöhe, Escape,
|
||||
Außenklick und Fokus-Rückkehr unabhängig von Overflow und Filter-Stacking-
|
||||
Contexts kontrollierbar.
|
||||
|
||||
Diese Darstellung ist keine neue Live-Zustandsgrenze. Zurück und die direkte
|
||||
Auswahl im Ablauf sind reine lokale Betrachtungsnavigation. Sie verändern weder
|
||||
aktuelles Live-Piece noch Status, Zeitintervalle, Abschnittstimer oder Ausgabe.
|
||||
Während ein anderes Piece betrachtet wird, bleiben Fortschrittsaktionen
|
||||
gesperrt; Präsentieren darf dagegen weiterhin ausdrücklich genau das betrachtete
|
||||
Piece ausgeben. Start, Erledigen, Überspringen, Reserveeinfügung und Präsentation
|
||||
bleiben serverseitige Actions mit ihren bisherigen Revisions- und
|
||||
Idempotenzregeln.
|
||||
|
||||
## D-025: Gemeinsame Sendungsdaten für Liste und Kalender
|
||||
|
||||
Listenansicht, Desktop-Monatsraster und mobile Monatsagenda werden aus derselben
|
||||
kompakten Sendungsliste abgeleitet. Es gibt kein zweites Kalenderdatenmodell und
|
||||
keine Bibliothek für Terminverwaltung. UTC-Zeitpunkte werden mit
|
||||
`Europe/Berlin` einem zivilen Tag zugeordnet; der ausgewählte Monat bleibt als
|
||||
URL-Parameter navigierbar. Mehrere Sendungen eines Tages werden vollständig und
|
||||
chronologisch gezeigt, Sendungen ohne Startzeit separat.
|
||||
|
||||
Die Präferenz `list` oder `calendar` gehört zum angemeldeten Konto und wird als
|
||||
kleines geprüftes Feld an `users` gespeichert. Sie ist weder Bestandteil einer
|
||||
Sendung noch Browserzustand. Der Kalender dient nur der Navigation und erhält
|
||||
bewusst kein Drag-and-drop, damit eine Terminänderung ausschließlich über die
|
||||
bestehende serverseitig validierte Sendungsbearbeitung erfolgt.
|
||||
|
||||
## D-026: Gemeinsame Live-Pause und getrennte Zeitbasen
|
||||
|
||||
Piece-Laufzeit, Abschnittszeit und Gesamtzeit bleiben getrennte persistente
|
||||
Intervallmengen. Pause schließt in einer Live-Transaktion alle offenen
|
||||
Intervalle, Fortsetzen eröffnet sie am gespeicherten Fortschritt erneut. Dadurch
|
||||
zählt weder Browserwechsel noch eine beliebig lange Pause zur Sendezeit. Ein
|
||||
Abschnittsreset ersetzt nur den aktiven Abschnittstimer; ein Gesamtreset löscht
|
||||
nur die Gesamtlaufintervalle. Beide ändern weder Piece-Status noch Reihenfolge,
|
||||
Restplanung oder Präsentationsstand.
|
||||
|
||||
Die Restzeit ist eine Ableitung, kein zweiter Ablaufplan. Für jeden verbleibenden
|
||||
Abschnitt gilt entweder dessen positive explizite Dauer oder die Summe seiner
|
||||
verbleibenden Piece-Dauern. Bereits abgeschlossene Abschnitte werden ausgelassen,
|
||||
ungeplante Abschnitte werden sichtbar gezählt und eine Überziehung reduziert
|
||||
nicht die geplante Zeit kommender Inhalte.
|
||||
|
||||
`ended_at_utc` beendet einen Durchlauf, nicht automatisch dessen offene Pieces.
|
||||
Wiederaufnahme und neuer Durchlauf sind deshalb getrennte Befehle: Erstere
|
||||
bewahrt Intervalle und Fortschritt, letzterer setzt beides ausdrücklich zurück.
|
||||
Das private Markdownfeld „Interaktion“ folgt derselben Original-/Snapshotgrenze
|
||||
wie Moderation und Überleitung, ist aber nicht Teil der öffentlichen
|
||||
Präsentations-Positivliste.
|
||||
|
||||
## D-027: Abschlusszustand und Freigaben als eigene Sicherheitsgrenzen
|
||||
|
||||
Ein beendeter Live-Lauf ist wiederaufnehmbar und deshalb nicht identisch mit
|
||||
einer historischen Sendung. Erst eine eigene transaktionale Finalisierung setzt
|
||||
`shows.status` auf `completed`. Eine dauerhaft gespeicherte Befehls-ID verhindert
|
||||
Doppelverbuchung; Usage-Historie enthält nur `done`, nie `skipped` oder Reserve.
|
||||
Bestehende Usage-Snapshots bleiben Inhaltsquelle, während Abschnittskategorien
|
||||
beim Abschluss zusätzlich eingefroren werden. Historische Sendungen werden nicht
|
||||
erneut bearbeitet, sondern mit neuen IDs und zurückgesetztem Laufzustand kopiert.
|
||||
|
||||
Lesefreigaben sind keine abgeschwächten Redaktionssitzungen. Sie verwenden eine
|
||||
eigene Positivprojektion mit drei kumulativen Umfängen. Roh-Tokens und
|
||||
Gast-Sitzungstokens stehen nie in SQLite, optionale Passwörter verwenden Argon2id.
|
||||
Passwort, Ablauf und Widerruf werden zentral vor Seite, Seitendaten und Medium
|
||||
geprüft. Präsentationsmedien sind an Freigabe, Sendung und Usage-Snapshot
|
||||
gebunden; beliebige Fundus-Dateien bleiben ausgeschlossen.
|
||||
|
||||
Freigaben verweisen auf `shows` statt ausschließlich auf Finalisierungen. Damit
|
||||
kann ein Barkeeper bereits einen Entwurf oder eine laufende Planung teilen. Die
|
||||
Gastprojektion liest bei jedem Aufruf die aktuellen Sendungssnapshots; der
|
||||
spätere Abschluss stabilisiert genau diese bestehende Datenquelle, ohne Token
|
||||
oder URL zu wechseln. Bearbeitungen behalten den Link, invalidieren aber
|
||||
vorhandene Passwortsitzungen. Vollständiges Löschen ist der unmittelbare
|
||||
Widerruf. Die Sendungsbearbeitung und die zentrale Verwaltung verwenden dieselbe
|
||||
Geschäftslogik und bleiben Barkeepern vorbehalten.
|
||||
|
||||
## D-028: Additive Wartungsfelder und gemeinsamer Freigabedialog
|
||||
|
||||
Vorbereitungsaufwand und Twitch-Tags sind optionale additive Felder. Der neue
|
||||
Bildmodus verwendet ein separates boolesches Kennzeichen, damit bestehende
|
||||
Tabellen und Daten trotz älterer Modus-Check-Constraints ohne riskanten
|
||||
Tabellenumbau erhalten bleiben. Freigabeverwaltung bleibt eine gemeinsame
|
||||
Komponente und öffnet in allen drei internen Einstiegen als nativer Dialog.
|
||||
|
||||
## D-029: RSS als persistenter Eingang mit begrenztem Abruf
|
||||
|
||||
Externe Feeds schreiben nie direkt in den Fundus. Quelle und stabiler
|
||||
Eintragsschlüssel werden in einem eigenen Eingang gespeichert; dessen Zustand
|
||||
`discarded` oder `imported` wird bei einem erneuten Abruf nicht zurückgesetzt.
|
||||
Erst eine bewusste Auswahl erzeugt über `content.ts` ein normales Piece samt
|
||||
Originalquelle und gewählten Kategorien. Dadurch bleiben redaktionelle
|
||||
Entscheidung, Dublettenschutz und Herkunft nachvollziehbar.
|
||||
|
||||
Manueller und geplanter Abruf verwenden denselben Adapter. Wie bei
|
||||
Linkmetadaten werden private Ziele, Nichtstandardports und ungeprüfte Redirects
|
||||
gesperrt; zusätzlich gelten enge Zeit-, Größen- und Mengenlimits. XML-Entities
|
||||
bleiben deaktiviert und fremdes HTML wird nicht gespeichert. Ein Fehler wird am
|
||||
betroffenen Feed persistiert und unterbricht keine weiteren fälligen Feeds.
|
||||
|
||||
## D-030: Technische Tokens, Scopes und persistente Idempotenz
|
||||
|
||||
Externe Assistenz erhält keine simulierte Redaktionssitzung und keine
|
||||
Sonderrechte. Eigene zufällige Bearer-Tokens liegen nur gehasht vor, sind sofort
|
||||
widerrufbar und erlauben entweder Lesen oder Lesen und Schreiben. REST-Routen
|
||||
unter `/api/v1` verwenden die bestehenden Inhalts- und Sendungsdienste, damit
|
||||
Validierung, Revisionen und Transaktionen identisch bleiben. Jede erfolgreiche
|
||||
Mutation wird mit technischem Akteur, Aktion und Ziel protokolliert.
|
||||
|
||||
Neuanlage, Einplanung und Sortierung verlangen einen `Idempotency-Key`.
|
||||
Zugang, Schlüssel, Hash des Requestinhalts und vollständige Antwort werden in
|
||||
derselben SQLite-Transaktion gespeichert. Eine identische Wiederholung erhält
|
||||
dieselbe Antwort; ein veränderter Request mit demselben Schlüssel wird
|
||||
abgewiesen. OpenAPI 3.1 beschreibt diese Grenze maschinenlesbar. Ein MCP-Adapter
|
||||
oder ein bestimmter KI-Client wird nicht vorgetäuscht: Die Anwendung bleibt ohne
|
||||
KI vollständig nutzbar und eine konkrete Client-Verbindung muss separat geprüft
|
||||
werden.
|
||||
|
||||
## D-031: Usage-basierte Vorbereitung und rotierende Freigabelinks
|
||||
|
||||
Die Sendungsübersicht erzeugt keinen zusätzlichen Vorbereitungszustand. Sie
|
||||
projiziert konkrete Usage-Snapshots aktiver Sendungen, deren Fundus-Original noch
|
||||
`preparing` ist. So bleiben bestehende Daten und Snapshots unverändert, während
|
||||
ungeplante Fundus-Arbeit aus der Sendungsübersicht verschwindet.
|
||||
|
||||
Weil Freigabetokens nur gehasht gespeichert werden, kann ein bestehender Link
|
||||
nicht erneut angezeigt werden. Ein Ersatzlink rotiert deshalb den Token derselben
|
||||
Freigabe transaktional und löscht alle Gastsitzungen; Sichtumfang, Passwort und
|
||||
Ablauf werden nicht stillschweigend verändert.
|
||||
|
||||
## D-032: Vorbereitung als Eigenschaft der konkreten Einplanung
|
||||
|
||||
Die erste 0.7.1-Umsetzung aus D-031 leitete den Vorbereitungszustand noch vom
|
||||
veränderlichen Fundus-Original ab. Das widerspricht der bestehenden Kopierregel
|
||||
für Sendungsfassungen und verhindert unterschiedliche Arbeitsstände bei
|
||||
Mehrfachverwendung. D-032 ersetzt deshalb diesen Teil von D-031: Status und
|
||||
Aufwand werden mit Migration `0019` additiv an `piece_usages` gespeichert.
|
||||
|
||||
Vorbereitende und sendefertige Originale dürfen eingeplant werden. Einplanung,
|
||||
Duplikation und ausdrückliches Aktualisieren kopieren den Zustand, während der
|
||||
Usage-Editor ihn danach unabhängig ändert. `piece_usages.status` bleibt davon
|
||||
getrennt und beschreibt weiterhin ausschließlich den Livezustand `open`,
|
||||
`current`, `done` oder `skipped`.
|
||||
|
||||
## D-033: Auswahlzustand flüchtig, Verwaltungslogik gemeinsam
|
||||
|
||||
Quellenfilter, Pagination und Mehrfachauswahl des RSS-Dialogs bleiben lokaler
|
||||
UI-Zustand. Persistiert wird erst durch die bestehende transaktionale
|
||||
Importaktion, damit Blättern oder Öffnen eines externen Links niemals
|
||||
redaktionelle Inhalte erzeugt. Die Verwaltung ruft weiterhin dieselben Feed-
|
||||
und Zugangsdienste auf; neue Dialoge ersetzen nur die dauerhaft ausgebreiteten
|
||||
Formulare. Ein technischer Zugang darf Name und Umfang ändern, behält dabei aber
|
||||
seinen ausschließlich gehasht gespeicherten Token und erzeugt ein Auditereignis.
|
||||
|
||||
Das Live-Menü zeigt einen rein gelesenen Verbindungsstatus des Ausgabekanals.
|
||||
Nur die bereits vorhandenen expliziten Verbinden-, Rotieren- und Trennenaktionen
|
||||
verändern öffentliche Ausgabe. Navigation zur Planung bleibt davon getrennt.
|
||||
@@ -0,0 +1,385 @@
|
||||
# Release Notes
|
||||
|
||||
## 0.7.2 - RSS-Auswahl, Live-Menü und Schnittstellenverwaltung
|
||||
|
||||
Veröffentlicht am 26. Oktober 2026
|
||||
|
||||
- Der Eingang zeigt neue RSS-Beiträge in einer kompakten Katalogfläche. Ein
|
||||
großzügiger, mobil vollflächiger Dialog filtert mehrere Quellen vor der
|
||||
Seiteneinteilung, zeigt 20 Beiträge je Seite und behält die barrierefrei
|
||||
erkennbare Auswahl über Quellen- und Seitenwechsel. Erst die ausdrückliche
|
||||
Übernahme erzeugt Eingangspieces; Herkunft, Kategorien, Verwerfen und
|
||||
Dublettenschutz bleiben erhalten (#16).
|
||||
- Das Live-Menü folgt der Nutzerabsicht: Sendungssteuerung, kompakte Ansicht,
|
||||
Lesefreigaben, standardmäßig eingeklappte OBS-Ausgabe und getrennte Navigation
|
||||
sind klar geordnet. Pause/Fortsetzen sowie Abschnitts- und Gesamtreset liegen
|
||||
direkt bei den Timern. Laufend, pausiert und beendet werden eindeutig
|
||||
unterschieden; Navigation allein verändert weder Lauf noch Ausgabe (#18).
|
||||
- RSS-Feeds und technische API-Zugänge verwenden Panel, Typografie,
|
||||
Eintragskarten, Classic-Regular-Icons und Dialograhmen des Werkzeugkatalogs.
|
||||
Feeds und Zugänge lassen sich in Dialogen anlegen und bearbeiten; Abruf,
|
||||
Löschen beziehungsweise Widerruf bleiben kompakte Iconaktionen. Neue
|
||||
API-Tokens erscheinen unmittelbar einmalig und kopierbar, während weiterhin
|
||||
nur ihr Hash gespeichert wird (#21).
|
||||
- Paket, Lockdatei und Cloudron-Manifest tragen Version `0.7.2`. Es ist keine
|
||||
Datenbankmigration erforderlich. 60 Verhaltenstests und 20 Chromium-Abläufe
|
||||
sind erfolgreich; echte Browser-/Geräteprüfungen außerhalb von Chromium
|
||||
bleiben offen.
|
||||
|
||||
## 0.7.1 - Bedienung und Live-Korrekturen
|
||||
|
||||
Veröffentlicht am 25. Oktober 2026, Korrekturstand 26. Oktober 2026
|
||||
|
||||
- Live-Abschnittszeiten übernehmen geänderte Plandauern. Frühere erledigte oder
|
||||
übersprungene Pieces können offiziell wiederaufgenommen werden, ohne ihre
|
||||
Abschnittslaufzeit oder die Gesamtzeit zurückzusetzen (#1).
|
||||
- Mobiler Live-Ablauf, lange Metadaten und Sendungskarten halten ihre verfügbare
|
||||
Breite ein. Der Ablauf bleibt als fokussierbares Sheet bedienbar (#3, #5, #13).
|
||||
- „Noch vorzubereiten“ speichert Status und Aufwand an der konkreten Einplanung,
|
||||
priorisiert aktive Sendungen nach Termin und verlinkt mit den Themenicons direkt
|
||||
in den Usage-Editor. Vorbereitende Originale können regulär eingeplant werden;
|
||||
Mehrfachverwendungen bleiben unabhängig (#6, #15).
|
||||
- Fundus- und Usage-Editor unterscheiden Text, Nur Bild, Linkvorschau und Video
|
||||
durch kontextsensitive Eingaben und passende Vorschauen (#8).
|
||||
- Gast- und historische Abschnitte besitzen klar gepolsterte äußere Glaskarten.
|
||||
Die Freigabeverwaltung liegt direkt vor dem Werkzeugkatalog; der gemeinsame
|
||||
Dialog und seine Formfelder folgen ohne nativen Doppelrahmen dem Sendewerk-
|
||||
Design. Einmalige Links lassen sich kopieren und sicher ersetzen (#11, #12).
|
||||
- Die Iconsuche ist nach dem Öffnen sofort sichtbar und fokussiert (#14).
|
||||
- RSS-Feeds und technische Zugänge verwenden in der Verwaltung kompakte
|
||||
Hinzufügen-Einstiege und dieselbe visuelle Listenlogik wie der Werkzeugkatalog.
|
||||
- Mobiles Live-Sheet und Backdrop sind am Viewport verankert. Viewport-Fit,
|
||||
Standalone-Metadaten und Web-App-Manifest aktivieren iOS-Safe-Areas; ein echter
|
||||
Safari-/Home-Bildschirm-Test bleibt mangels Gerät offen (#3, #13).
|
||||
- Paket, Lockdatei und Cloudron-Manifest tragen Version `0.7.1`. Migration
|
||||
`0019_usage_preparation.sql` ergänzt additive Usage-Snapshots. 60
|
||||
Verhaltenstests und 19 Chromium-Abläufe sind
|
||||
erfolgreich; echtes Safari und die installierte Webapp auf iOS bleiben offen.
|
||||
|
||||
## 0.7.0 - RSS-Import und externe Assistenz
|
||||
|
||||
Veröffentlicht am 25. Oktober 2026
|
||||
|
||||
- Barkeeper verwalten RSS-/Atom-Feeds mit Intervall und Standardkategorie;
|
||||
sichere manuelle und geplante Abrufe laufen fehlerisoliert.
|
||||
- Neue Beiträge landen in einem getrennten Auswahlbereich im Eingang. Erst eine
|
||||
bewusste Übernahme erzeugt Pieces, während dauerhaftes Verwerfen, Herkunft,
|
||||
Kategorien und Dublettenschutz erhalten bleiben.
|
||||
- Abrufe sperren interne Ziele und begrenzen Ports, Redirects, Laufzeit,
|
||||
Antwortgröße und Eintragszahl. Fremdes Feed-HTML wird zu Text bereinigt.
|
||||
- Die versionierte REST-API `/api/v1` liest und ändert Pieces, Sendungen und
|
||||
Einplanungen über getrennte technische Lese- oder Schreibzugänge.
|
||||
- Technische Tokens werden nur einmal gezeigt und gehasht gespeichert. Widerruf,
|
||||
Audit-Ereignisse, Revisionen und persistente Idempotenz schützen Änderungen.
|
||||
- `/api/v1/openapi.json` beschreibt die Schnittstelle für externe Clients.
|
||||
Sendewerk bleibt ohne KI nutzbar; eine konkrete ChatGPT-/Codex-Anbindung ist
|
||||
weiterhin offen.
|
||||
- Migration `0018_rss_and_api.sql` ergänzt Feed-, Zugangs-, Audit- und
|
||||
Idempotenzdaten. Paket, Lockdatei und Cloudron-Manifest tragen Version `0.7.0`.
|
||||
|
||||
## 0.6.1 - Redaktionelle Wartung
|
||||
|
||||
Veröffentlicht am 25. Oktober 2026
|
||||
|
||||
- Live-Countdowns übernehmen geänderte Abschnittsplanzeiten, ohne Laufzeit zu verlieren; die mobile Regie gruppiert ihre Kopfaktionen robuster und zeigt den Ablauf als oberstes Sheet.
|
||||
- Mobile Formularfelder und die Iconsuche vermeiden iOS-Fokuszoom; Sendungskarten und Gastansicht erhalten klarere Abstände.
|
||||
- Pieces führen optionalen Vorbereitungsaufwand, die Sendungsübersicht bündelt offene Vorbereitung und Abschnitte speichern kopierbare Twitch-Tags.
|
||||
- Präsentationen können ein ausdrücklich gewähltes Bild ohne Begleittext ausgeben; Originale und Sendungsfassungen bleiben getrennte Snapshots.
|
||||
- Lesefreigaben öffnen in Sendung, Verwaltung und Live-Regie über denselben Dialog.
|
||||
- Migration `0017_maintenance_fields.sql` ergänzt ausschließlich optionale, rückwärtskompatible Felder.
|
||||
|
||||
## 0.6.0 - Abschluss, Archiv und Freigaben
|
||||
|
||||
Veröffentlicht am 25. Oktober 2026
|
||||
|
||||
Sendewerk 0.6.0 trennt das wiederaufnehmbare Ende eines Live-Laufs vom
|
||||
unveränderlichen redaktionellen Abschluss. Abgeschlossene Sendungen erhalten
|
||||
eine stabile Historie, liegen im Archiv und können als neuer Entwurf dupliziert
|
||||
werden. Barkeeper geben genau eine geplante, laufende oder historische Sendung
|
||||
über widerrufbare, optional passwortgeschützte Leselinks frei.
|
||||
|
||||
### Abschluss und Historie
|
||||
|
||||
- Ein Abschlussdialog zeigt gesendete, übersprungene und offene Pieces getrennt
|
||||
und bietet ausschließlich gesendete Originale zur bewussten Archivierung an.
|
||||
- Finalisierung ist transaktional und idempotent. Übersprungene Pieces und die
|
||||
Reservebank werden nicht als gesendet verbucht.
|
||||
- Usage-Texte, Relationen, Kategorien und tatsächliche Zeiten bleiben nach dem
|
||||
Abschluss stabil, auch wenn Fundus-Originale oder Kataloge später wechseln.
|
||||
- Historische Sendungen sind intern nur lesbar. Die Duplikation erzeugt einen
|
||||
unabhängigen Entwurf mit offenen Pieces und ohne früheren Lauf- oder
|
||||
Freigabezustand.
|
||||
|
||||
### Archiv und Freigaben
|
||||
|
||||
- Das Archiv zeigt abgeschlossene Sendungen neben archivierten und gelöschten
|
||||
Pieces und bietet die Duplikation direkt an.
|
||||
- Barkeeper erstellen Leselinks direkt in der Sendungsbearbeitung oder zentral
|
||||
in der Verwaltung für Ablauf, Moderation oder vollständige Recherche, optional
|
||||
mit Passwort und Ablaufzeit.
|
||||
- Noch nicht abgeschlossene Sendungen zeigen Gästen beim nächsten Aufruf den
|
||||
aktuellen Plan. Nach dem Abschluss bleibt derselbe Link auf dem stabilen
|
||||
historischen Stand.
|
||||
- Freigaben lassen sich in nach Sendung gruppierten Verwaltungskarten bearbeiten
|
||||
und endgültig löschen; Passwortänderungen beenden vorhandene Gast-Sitzungen.
|
||||
- Tokens und Gast-Sitzungen liegen nur gehasht vor; Passwörter verwenden
|
||||
Argon2id und Fehlversuche sind begrenzt.
|
||||
- Gastseiten projizieren genau eine Sendung. Private Originaldaten, Nutzer,
|
||||
interne IDs und Felder außerhalb des gewählten Umfangs werden nicht geliefert.
|
||||
- Direkte Medienaufrufe prüfen dieselbe Freigabe, Passwortsitzung, Ablaufzeit und
|
||||
den Widerruf erneut und erlauben nur das freigegebene Präsentationsmedium.
|
||||
|
||||
### Technik und Prüfung
|
||||
|
||||
- Migration `0015_completion_archive_and_shares.sql` übernimmt bestehende
|
||||
abgeschlossene Sendungen und ergänzt Finalisierung, Historie,
|
||||
Duplikationsbefehle, Freigaben, Gast-Sitzungen und
|
||||
Passwortversuchsbegrenzung.
|
||||
- Migration `0016_shares_for_active_shows.sql` erhält vorhandene Freigaben und
|
||||
erweitert ihre Referenz auf alle Sendungszustände.
|
||||
- Paket, Lockdatei und Cloudron-Manifest tragen gemeinsam Version `0.6.0`.
|
||||
- 52 Verhaltenstests und 18 Chromium-Abläufe decken den bisherigen Umfang sowie
|
||||
Abschluss, Archiv und anonyme Lesefreigaben ab.
|
||||
|
||||
## 0.5.12 - Live-Regie und Sendungskalender
|
||||
|
||||
Veröffentlicht am 24. Oktober 2026
|
||||
|
||||
Sendewerk 0.5.12 macht aus der privaten Live-Steuerung eine kompakte Regieansicht
|
||||
für Vollbild, Smartphone und kleine Desktopfenster neben OBS oder Firebot. Die
|
||||
Sendungsübersicht erhält zusätzlich eine kontobezogen gespeicherte Listen- und
|
||||
Kalenderansicht. Die öffentliche heinzlive-Ausgabe und die gespeicherten
|
||||
Livezustände bleiben technisch getrennt.
|
||||
|
||||
### Highlights
|
||||
|
||||
- Ausgabe, Gesamtzeit, Abschnittszeit und Menü tragen in der Live-Kopfleiste
|
||||
jetzt die passenden lokalen Classic-Regular-Icons. Pause beziehungsweise
|
||||
Fortsetzen ist zusätzlich als direkter Iconbutton neben der Abschnittszeit
|
||||
erreichbar.
|
||||
- Die Live-Regie verwendet die gesamte Fensterfläche ohne normale
|
||||
App-Seitenleiste, mobilen App-Header oder Bottomnavigation.
|
||||
- Zwei kompakte Kopfzeilen halten Abschnitt, „Danach“, Menü, Ausgabe,
|
||||
Abschnittscountdown und Ablauf gleichzeitig erreichbar. Der Sendungsname ist
|
||||
in das Menü gewandert.
|
||||
- Lange Abschnitts- und Folgetitel bleiben einzeilig gekürzt und lassen sich per
|
||||
Klick oder Tastatur vollständig aufklappen, ohne benachbarte Bedienelemente zu
|
||||
überlagern.
|
||||
- Moderation und Ablauf bleiben auch bei einem nur 900 × 450 Pixel großen
|
||||
Desktopfenster nebeneinander. Lange Inhalte scrollen innerhalb ihrer
|
||||
Arbeitsfläche; Kopf- und Aktionszeile bleiben sichtbar.
|
||||
- Niedrige Desktopfenster verdichten Abstände und Bedienleisten anhand der
|
||||
verfügbaren Höhe, ohne Text oder die gesamte Oberfläche zu skalieren.
|
||||
- Die feste Fußleiste ist auf „Zurück“, „Präsentieren“, „Überspringen“ und
|
||||
„Erledigen & weiter“ reduziert. Das nächste Piece steht in der Kopfzeile, das
|
||||
Leeren der Präsentation direkt am Ausgabezustand.
|
||||
- Auf dem Smartphone öffnet „Ablauf · Piece X/Y“ den Ablauf als separates Sheet,
|
||||
während das aktuelle Piece die Hauptfläche bleibt. Fokusführung, Escape und
|
||||
der Wechsel zurück auf eine breite Ansicht schließen den Modalzustand sauber.
|
||||
|
||||
### Moderation und Materialien
|
||||
|
||||
- Interner Titel, Einleitung, Moderationsstichpunkte und Überleitung erscheinen
|
||||
in klarer Lesereihenfolge. Leere Bereiche werden weggelassen.
|
||||
- Recherche, Quellen, Werkzeuge und eigene Notizen sind kompakt beschriftet und
|
||||
werden nur bei Bedarf geöffnet.
|
||||
- Die Prompter-Schriftgröße bleibt einstellbar und wird weiterhin lokal
|
||||
gespeichert. Texte werden nicht automatisch verkleinert.
|
||||
- Piece-Position, Piece-Titel und Zeit stehen in einer gemeinsamen kompakten
|
||||
Kopfzeile; dadurch beginnt die Einleitung weiter oben.
|
||||
|
||||
### Ablauf und Liveverhalten
|
||||
|
||||
- Pause und Fortsetzen steuern Piece-, Abschnitts- und Gesamtzeit gemeinsam und
|
||||
zählen Pausen auch nach Reload oder Navigation nicht mit.
|
||||
- Gelaufene Gesamtzeit und geschätzte Restzeit lassen sich direkt umschalten;
|
||||
die Auswahl bleibt lokal erhalten. Ungeplante verbleibende Abschnitte sind
|
||||
sichtbar, ohne Abschnitts- und Piece-Dauern doppelt zu zählen.
|
||||
- Abschnitts- und Gesamtzeit lassen sich getrennt nach Bestätigung zurücksetzen.
|
||||
Ablaufposition, Piece-Status, Restplanung und Präsentation bleiben dabei
|
||||
unverändert.
|
||||
- Sendungen lassen sich ausdrücklich vorbereiten, starten, pausieren und
|
||||
beenden. Nach dem Ende sind „Lauf fortsetzen“ und „Neuer Durchlauf“ getrennte
|
||||
Aktionen; offene Pieces werden beim Beenden nicht automatisch erledigt.
|
||||
- Abschnitte sind kompakt aufklappbar; der aktuelle Abschnitt ist geöffnet und
|
||||
das aktive Piece bleibt in der Ablaufspalte sichtbar.
|
||||
- Pieces kennzeichnen tatsächliches Live-Piece, lokal betrachtetes Piece und
|
||||
ausgegebenes Piece getrennt. Jeder Eintrag lässt sich zur Betrachtung wählen,
|
||||
einschließlich des ersten Eintrags.
|
||||
- Die Reserve bleibt zusammengeklappt erreichbar. Dauerhafte Sortierpfeile und
|
||||
die separate große „Als Nächstes“-Karte entfallen; Umsortieren bleibt über
|
||||
eine kompakte Aktion am jeweiligen Eintrag erreichbar.
|
||||
- Die lokal gespeicherte Leseposition gehört zum jeweiligen Piece. Eine direkte
|
||||
Auswahl beginnt daher oben, ohne die Position des vorherigen Textes zu erben.
|
||||
- „Zurück“ und direkte Ablaufwahl verändern weder aktuelles Live-Piece noch
|
||||
Erledigungsstatus, Timer oder Ausgabe. Bei einem nur betrachteten früheren
|
||||
Piece bleiben Überspringen und Erledigen gesperrt. Nur „Präsentieren“ oder
|
||||
„Präsentation leeren“ verändert die öffentliche Ausgabe.
|
||||
- Abschnittstimer, tatsächliche Laufzeiten, Livefortschritt und Wiederaufnahme
|
||||
verwenden unverändert die vorhandenen persistenten Zustände.
|
||||
- „Live-Stand wiederaufnehmen“ erscheint nur bei einem tatsächlich
|
||||
unterbrochenen Ablauf, nicht während eines aktiven Pieces.
|
||||
|
||||
### Einstellungen
|
||||
|
||||
- Ausgabekanal verbinden, Schlüssel erneuern, Kanal trennen, Theme wechseln,
|
||||
Zeiten ein-/ausblenden und „Zur Planung“ bleiben im Regiemenü erreichbar.
|
||||
- Das Regiemenü erscheint als viewportgebundenes Popover sicher über den
|
||||
Glasflächen. Es bleibt in kleinen Fenstern scrollbar erreichbar und schließt
|
||||
mit Escape oder Außenklick; der Fokus kehrt zum Menüauslöser zurück.
|
||||
|
||||
### Interaktion
|
||||
|
||||
- „Interaktion“ ergänzt Piece und Sendungsfassung als optionales privates
|
||||
Markdownfeld zwischen Moderationsstichpunkten und Überleitung.
|
||||
- Vorlagen, Duplikate, Einplanungen und die bewusste Aktualisierung aus dem
|
||||
Fundus übernehmen das Feld jeweils als unabhängigen Snapshot.
|
||||
- Die private Live-Regie zeigt das Feld nur bei Inhalt. Die öffentliche
|
||||
heinzlive-Ausgabe übernimmt es nicht.
|
||||
|
||||
### Sendungsübersicht
|
||||
|
||||
- Sendungskarten bleiben auf kleinen Bildschirmen kompakt: Status, Titel und
|
||||
Termin stehen neben den horizontal angeordneten Abschnitts- und Zeitangaben,
|
||||
statt die Karte durch vollständiges Stapeln unnötig zu erhöhen.
|
||||
- „Liste | Kalender“ schaltet zwischen der bekannten Sendungsliste und einer
|
||||
Monatsansicht um; die Auswahl bleibt am angemeldeten Konto gespeichert.
|
||||
- Auf dem Desktop zeigt ein vollständiges Montag-bis-Sonntag-Raster alle Termine
|
||||
des Monats. Mehrere Sendungen pro Tag bleiben vollständig sichtbar und nach
|
||||
Uhrzeit sortiert.
|
||||
- Auf dem Smartphone wird derselbe Monat als chronologische Agenda dargestellt.
|
||||
Vorheriger Monat, nächster Monat und der Sprung zu heute bleiben erreichbar.
|
||||
- Die Gruppierung verwendet `Europe/Berlin`. Sendungen ohne Startzeit stehen in
|
||||
einem eigenen Bereich und verschwinden weder aus Liste noch Kalender.
|
||||
- Der Kalender ist eine Navigationsansicht. Termine werden weiterhin nur über
|
||||
die bestehende Sendungsbearbeitung geändert; Termin-Drag-and-drop wurde nicht
|
||||
ergänzt.
|
||||
|
||||
### Update und Kompatibilität
|
||||
|
||||
- `0012_show_overview_view.sql` ergänzt ausschließlich die kontobezogene
|
||||
Listen-/Kalenderpräferenz mit dem sicheren Standardwert `list`.
|
||||
- Es ist keine Änderung der Konfiguration erforderlich.
|
||||
- `0013_live_controls_and_interaction.sql` ergänzt das private Interaktionsfeld
|
||||
und persistente Gesamtzeitintervalle. Bestehende Piece-Laufintervalle werden
|
||||
als Gesamtzeit übernommen.
|
||||
- Bestehende Sendungen, Livezustände, Abschnittstimer, Ausgabekanäle und
|
||||
Präsentationssnapshots bleiben erhalten.
|
||||
- Paket, Lockdatei und Cloudron-Manifest tragen gemeinsam Version `0.5.12`.
|
||||
|
||||
### Prüfung
|
||||
|
||||
- Die ergänzte Iconleiste, Pause/Fortsetzen und die kompakte Sendungskarte wurden
|
||||
gezielt in Chromium bei 670 × 450, 390 × 700 und 656 × 400 Pixeln geprüft.
|
||||
Typprüfung, sechs Live-Verhaltenstests und Produktionsbuild sind erfolgreich.
|
||||
- Die vollständige Matrix wurde für diese Ergänzung nicht erneut ausgeführt; die
|
||||
folgenden Gesamtnachweise stammen vom vorherigen 0.5.12-Stand.
|
||||
- 44 Unit- und Verhaltenstests sowie 17 Chromium-E2E-Abläufe sind erfolgreich.
|
||||
- Die Live-Regie wurde bei 1440 × 900, 900 × 450, 670 × 450 und 390 × 700 Pixeln
|
||||
mit langen Titeln, sichtbarem Regiemenü, unabhängigen Scrollflächen und
|
||||
mobilem Ablauf-Sheet geprüft; der Kalender zusätzlich bei 1440 × 1000 und
|
||||
390 × 844 Pixeln.
|
||||
- Reales OBS, echte YouTube-/TikTok-Wiedergabe und Safari auf einem iOS-Gerät
|
||||
standen nicht zur Verfügung.
|
||||
|
||||
## 0.5.11 - Verwaltungskorrektur
|
||||
|
||||
Veröffentlicht am 23. Oktober 2026
|
||||
|
||||
- Der Dialog „Werkzeug hinzufügen“ bleibt beim Aufruf der Verwaltungsseite
|
||||
wieder zuverlässig geschlossen.
|
||||
- Der Dialog erscheint erst, wenn ein neues Werkzeug angelegt oder ein
|
||||
bestehendes Werkzeug bearbeitet wird.
|
||||
- Die Iconauswahl unter „Inhaltliche Zuordnung“ bleibt auf Desktop und
|
||||
Smartphone vollständig im sichtbaren Browserbereich.
|
||||
- Die Korrektur gilt gleichermaßen für Desktop- und Smartphone-Ansichten und
|
||||
verändert keine vorhandenen Werkzeuge oder Zuordnungen.
|
||||
|
||||
## 0.5.10 - Editor-Erlebnis
|
||||
|
||||
Veröffentlicht am 23. Oktober 2026
|
||||
|
||||
Sendewerk 0.5.10 beschleunigt die tägliche Redaktionsarbeit und schärft die
|
||||
Grenze zwischen privaten Medien und der öffentlichen Präsentation. Titel,
|
||||
Themen, Werkzeuge und Präsentationsbilder lassen sich direkter bearbeiten; die
|
||||
wichtigsten Listen und Dialoge benötigen auf Desktop und Smartphone weniger
|
||||
Platz. Bestehende Sendungsfassungen bleiben bei späteren Änderungen am Fundus
|
||||
stabil.
|
||||
|
||||
### Highlights
|
||||
|
||||
- Titel von Fundus- und Sendungsfassungen lassen sich direkt in der jeweiligen
|
||||
Ansicht ändern. Die Bedienung funktioniert auch vollständig per Tastatur.
|
||||
- Themen und Werkzeuge verwenden kompakte, durchsuchbare Auswahlflächen. Der
|
||||
Werkzeugkatalog folgt nun demselben Bedienmuster wie die Themenverwaltung.
|
||||
- Für Themen, Werkzeuge, Navigation und Aktionen stehen 3.671 lokal
|
||||
bereitgestellte Classic-Regular-Icons zur Verfügung. Zur Laufzeit werden
|
||||
keine Icons von externen Diensten geladen.
|
||||
- Präsentationsbilder werden bewusst aus den aktiven Piece-Medien gewählt und
|
||||
beim Einplanen in die Sendungsfassung übernommen. Private Uploads werden nicht
|
||||
allein durch das Hochladen öffentlich.
|
||||
- Pieces lassen sich wiederherstellbar löschen. Bereits vorbereitete
|
||||
Sendungsfassungen und ihre Medien-Snapshots bleiben dabei erhalten.
|
||||
- Die heinzlive-Ausgabe kann ausdrücklich geleert werden. Im leeren Zustand ist
|
||||
sie vollständig transparent und zeigt auch keinen Verbindungsstatus.
|
||||
|
||||
### Redaktion und Verwaltung
|
||||
|
||||
- Der Werkzeugkatalog entspricht der Themenverwaltung: kompakte Glasfläche,
|
||||
Icon, Name, Status und Bearbeitungsaktion statt dauerhaft offener Formulare.
|
||||
- Anlegen und Bearbeiten eines Werkzeugs verwenden denselben responsiven Dialog
|
||||
für Name, Start-URL, Beschreibung, Icon, passende Formate und Aktivstatus.
|
||||
- Die Formatzuordnung nutzt dieselbe durchsuchbare Mehrfachauswahl wie andere
|
||||
Zuordnungen. Deaktivierte Werkzeuge und bestehende Piece-Zuordnungen bleiben
|
||||
erhalten.
|
||||
- Fundus, Eingang, Archiv, Vorlagen und Sendungsansichten sind kompakter und
|
||||
bleiben per Klick, Touch und Tastatur bedienbar.
|
||||
|
||||
### Pieces und Präsentation
|
||||
|
||||
- Präsentationsbilder werden ausdrücklich aus aktiven Piece-Medien ausgewählt
|
||||
und unveränderlich an Sendungsfassungen kopiert.
|
||||
- Entfernte Medien bleiben für bestehende Sendungsfassungen verfügbar, werden
|
||||
aber nicht mehr für neue Einplanungen angeboten.
|
||||
- Pieces können wiederherstellbar gelöscht werden. Offene, nie live gelaufene
|
||||
Verwendungen und Abschnitte lassen sich unter geschützten Bedingungen
|
||||
entfernen.
|
||||
- Themenicons werden zusammen mit der jeweiligen Sendungsfassung gespeichert.
|
||||
Spätere Änderungen an Thema, Werkzeug oder Original-Piece verändern eine
|
||||
vorbereitete Sendung weiterhin nur nach ausdrücklicher Aktualisierung aus dem
|
||||
Fundus.
|
||||
|
||||
### Live-Ausgabe
|
||||
|
||||
- Eine leere heinzlive-Ausgabe ist vollständig transparent und zeigt weder
|
||||
Renderer noch Verbindungsstatus.
|
||||
- Eine aktive Präsentation lässt sich unabhängig vom aktuell laufenden Piece
|
||||
leeren.
|
||||
|
||||
### Update und Kompatibilität
|
||||
|
||||
- `0010_editor_experience.sql` ergänzt Themenicons, Medien-Snapshots und Soft
|
||||
Delete.
|
||||
- `0011_tool_icons.sql` ergänzt persistente Werkzeugicons mit einem sicheren
|
||||
Standardwert. Werkzeug-IDs, Formatbeziehungen, Piece-Zuordnungen und
|
||||
Deaktivierungszustände bleiben erhalten.
|
||||
- Die Migrationen laufen beim nächsten Serverstart automatisch. Vor dem Update
|
||||
sollte wie üblich eine konsistente Sicherung der SQLite-Datenbank und des
|
||||
Upload-Verzeichnisses angelegt werden.
|
||||
- Für dieses Release sind keine manuellen Datenkonvertierungen und keine
|
||||
Änderungen an der Konfiguration erforderlich.
|
||||
|
||||
### Prüfung
|
||||
|
||||
- 40 Unit- und Verhaltenstests sowie 16 Chromium-E2E-Abläufe erfolgreich.
|
||||
- Werkzeugverwaltung, Iconauswahl und Piece-Werkzeugauswahl wurden zusätzlich
|
||||
bei 1280 × 720 und 390 × 844 Pixeln visuell mit der Themenverwaltung
|
||||
verglichen.
|
||||
- Reales OBS, echte YouTube-/TikTok-Wiedergabe und Safari auf einem iOS-Gerät
|
||||
standen nicht zur Verfügung.
|
||||
|
||||
### Noch nicht enthalten
|
||||
|
||||
Der Abschluss und die Archivierung vollständiger Sendungen, externe
|
||||
Lesefreigaben, RSS-Import und API gehören zu späteren Etappen und sind nicht Teil
|
||||
von 0.5.10.
|
||||
+518
-7
@@ -2,8 +2,388 @@
|
||||
|
||||
## Aktueller Umfang
|
||||
|
||||
Etappe 1 ist abgeschlossen. Architektur, Gesamtdatenmodell, Entscheidungen und
|
||||
lokaler Betriebsweg sind dokumentiert. Etappe 2 wurde nicht begonnen.
|
||||
Etappe 1 bis Etappe 7 sind abgeschlossen. Architektur, Gesamtdatenmodell,
|
||||
Anmeldung, Rollen, persistente Inhaltsbearbeitung, Sendungsplanung,
|
||||
Live-Steuerung, Präsentationsausgabe, unveränderliche Sendungshistorie,
|
||||
Archiv, sichere Lesefreigaben, RSS-Import und technische REST-Zugänge sind
|
||||
dokumentiert.
|
||||
|
||||
## Bedienkorrekturen 0.7.2
|
||||
|
||||
- Der RSS-Importeingang ist eine kompakte Katalogfläche. Die eigentliche Auswahl
|
||||
öffnet einen responsiven Dialog mit kombinierbaren Quellenfiltern, 20 Beiträgen
|
||||
pro Seite, tastaturbedienbaren Auswahlkarten und einer festen bewussten
|
||||
Übernahme. Auswahl bleibt beim Filtern und Blättern erhalten; importierte oder
|
||||
verworfene Beiträge verschwinden über den bestehenden persistenten Status.
|
||||
- Das Live-Menü trennt Sendungssteuerung, Ansicht, Lesefreigaben,
|
||||
OBS-Ausgabekanal und Navigation. Pause/Fortsetzen und beide Timerresets liegen
|
||||
bei den Zeitflächen. Der Menüstatus unterscheidet Entwurf, Bereit, Läuft,
|
||||
Pausiert, Lauf beendet und historischen Abschluss; der OBS-Bereich bleibt bis
|
||||
zur bewussten Aktion eingeklappt.
|
||||
- Feedquellen und technische Zugänge verwenden dieselben Katalogkarten und
|
||||
Dialoggrundlagen wie Werkzeuge. Beide lassen sich anlegen und bearbeiten;
|
||||
Feeds behalten Abruf/Löschen, Zugänge ihren sofortigen Widerruf. Ein neuer
|
||||
API-Token wird im Dialog einmalig angezeigt und kann direkt kopiert werden.
|
||||
|
||||
Geprüft wurden 60 von 60 Verhaltenstests, Lint, Typprüfung, Produktionsbuild und
|
||||
20 von 20 Chromium-Abläufe. Der neue Ablauf prüft RSS-Auswahl über mehrere
|
||||
Quellen und Seiten, Übernahme ohne erneutes Angebot, Feed- und Zugangsanlage
|
||||
samt Bearbeitung und Tokenkopie. Das Live-Menü wurde laufend, pausiert und
|
||||
beendet sowie bei kleinem Desktopfenster und mobil geprüft. Die betroffenen
|
||||
Flächen wurden in hellem und dunklem Farbschema kontrolliert. Andere Browser und
|
||||
echte Mobilgeräte bleiben offen.
|
||||
|
||||
## Fehlerkorrekturen 0.7.1
|
||||
|
||||
- Explizite Abschnittsdauern werden während der Live-Regie nach Änderungen
|
||||
synchronisiert. Erledigte oder übersprungene Pieces lassen sich bewusst
|
||||
wiederaufnehmen; frühere Abschnitts- und Gesamtzeiten bleiben dabei erhalten.
|
||||
- Der mobile Ablauf liegt innerhalb eines isolierten Live-Containers, lange
|
||||
Metadaten verbreitern die Regie nicht mehr und das Sheet ist am mobilen
|
||||
Viewport verankert. `viewport-fit=cover`, Standalone-Metadaten und Manifest
|
||||
aktivieren Safe Areas auch beim Start vom Home-Bildschirm. Sendungskarten
|
||||
stapeln ihre Inhalte auf kleinen Bildschirmen eindeutig.
|
||||
- Die Vorbereitung liegt als eigener Status- und Aufwandsnapshot an der konkreten
|
||||
Einplanung. Vorbereitende Fundus-Pieces lassen sich planen; Originaländerungen,
|
||||
Duplikation und bewusste Aktualisierung folgen der bestehenden Snapshotregel.
|
||||
Usage-Titel, Sendung, Abschnitt, Termin und Themenicons führen direkt in den
|
||||
Usage-Editor; „sendefertig“ entfernt die Fassung aus der Übersicht.
|
||||
- Text, Nur Bild, Linkvorschau und Video besitzen in Fundus- und Usage-Editor
|
||||
kontextsensitive Felder und Vorschauen. Ausgeblendete Werte bleiben beim
|
||||
Moduswechsel erhalten.
|
||||
- Die Iconsuche fokussiert innerhalb der öffnenden Klick-/Tastaturaktion das
|
||||
Suchfeld. RSS-Feeds und technische Zugänge verwenden gestaltete Formfelder.
|
||||
- Lesefreigaben öffnen nach Serverantworten wieder mit dem einmalig sichtbaren
|
||||
Link, bieten Kopieren und sichere Ersatzlinks. Ersatzlinks invalidieren den
|
||||
alten Token und dessen Gastsitzungen. Die Verwaltung zeigt Freigaben direkt
|
||||
vor dem Werkzeugkatalog; der Dialog besitzt nur eine gestaltete Glasfläche.
|
||||
Gast- und historische Abschnitte besitzen äußere Karten mit Innenabstand.
|
||||
|
||||
Geprüft wurden 60 von 60 Verhaltenstests, Lint, Typprüfung, Produktionsbuild und
|
||||
19 von 19 Chromium-Abläufe. Die Browsermatrix öffnete beide Piece-Editoren,
|
||||
Sendungsübersicht, Verwaltung und Freigabedialoge, Gastansicht sowie Live-Regie
|
||||
bei Desktop- und Mobilbreiten. Safari und die installierte Webapp auf einem
|
||||
echten iOS-Gerät bleiben mangels Gerät getrennt offen.
|
||||
|
||||
## RSS-Import und externe Assistenz 0.7.0
|
||||
|
||||
- Barkeeper verwalten RSS-/Atom-Feeds mit Standardkategorie, Aktivierung und
|
||||
Abrufintervall; manueller Abruf und ein begrenzter Prozess-Scheduler verwenden
|
||||
dieselbe Fehler- und Dublettenlogik.
|
||||
- Feedabrufe prüfen Protokoll, Port, DNS und Redirects, begrenzen Laufzeit,
|
||||
Antwortgröße und Eintragszahl und lassen Fehler anderer Feeds unberührt.
|
||||
- Fremdes HTML wird entfernt. Beiträge bleiben mit stabiler Herkunft im
|
||||
getrennten Importeingang, bis die Redaktion sie auswählt, kategorisiert und
|
||||
als normale Pieces übernimmt oder dauerhaft verwirft.
|
||||
- `/api/v1` bietet Pieces und Sendungen über gehashte, widerrufbare technische
|
||||
Bearer-Tokens mit reinen Lese- oder Lese-/Schreibrechten an. Mutationen nutzen
|
||||
bestehende Dienste, Audit-Ereignisse, Revisionen und persistente
|
||||
Idempotenzschlüssel.
|
||||
- Die maschinenlesbare Beschreibung liegt unter `/api/v1/openapi.json`; eine
|
||||
ChatGPT-/Codex- oder andere konkrete Client-Anbindung wurde nicht eingerichtet.
|
||||
- Migration `0018_rss_and_api.sql` ergänzt ausschließlich additive Tabellen und
|
||||
Indizes. Sendewerk bleibt ohne KI und ohne konfigurierte Feeds vollständig
|
||||
nutzbar.
|
||||
|
||||
Geprüft wurden 58 Verhaltenstests, Typprüfung, Produktionsbuild, Dependency-
|
||||
Audit, vier RSS- und zwei Zugangssicherheitstests sowie ein echter HTTP-Rundlauf
|
||||
lesen → anlegen → idempotent wiederholen → ändern → erneut lesen → einplanen →
|
||||
sortieren. Desktop-Verwaltung und mobiler Eingang wurden in Chromium ohne
|
||||
Konsolenfehler geprüft. In der bestehenden Gesamtmatrix waren 16 von 18 Abläufen
|
||||
erfolgreich; die bereits bekannte Live-Zeitanzeige und der Ablauf
|
||||
Abschluss/Freigabe schlugen weiterhin fehl. Der globale Lintlauf bleibt an acht
|
||||
vorhandenen Formatierungsabweichungen außerhalb dieser Etappe offen.
|
||||
|
||||
## Wartungsrelease 0.6.1
|
||||
|
||||
- Abschnitts-Countdown, mobile Live-Kopfzeile und Ablauf-Sheet wurden korrigiert; die doppelte Piece-Positionsanzeige entfällt.
|
||||
- Optionaler Vorbereitungsaufwand, kompakte Vorbereitungsliste und Abschnitts-Twitch-Tags sind additiv persistiert.
|
||||
- Der Präsentationsmodus `image` gibt ausschließlich das bewusst gewählte Snapshot-Medium aus.
|
||||
- Mobile Eingaben, Iconsuche, Sendungskarten und Gastabstände wurden angepasst.
|
||||
- Lesefreigaben verwenden einen gemeinsamen Dialog und sind auch aus der Live-Regie erreichbar.
|
||||
|
||||
Geprüft wurden 52 Verhaltenstests, Typprüfung und Produktionsbuild. Im zweiten
|
||||
Chromium-Lauf waren 14 Abläufe erfolgreich; zwei Abläufe schlugen vor dem
|
||||
Zeitlimit fehl, zwei weitere wurden nicht mehr ausgeführt. Die vollständige
|
||||
Browsermatrix bleibt damit offen.
|
||||
|
||||
## Abschluss, Archiv und Freigaben 0.6.0
|
||||
|
||||
- das Ende eines Live-Laufs bleibt wiederaufnehmbar; erst der getrennte,
|
||||
idempotente Abschluss friert Sendung, Kategorien, tatsächliche Verwendungen
|
||||
und Zeiten unveränderlich ein
|
||||
- der Abschlussdialog zählt gesendete, übersprungene und offene Pieces getrennt
|
||||
und archiviert Fundus-Originale ausschließlich nach bewusster Auswahl
|
||||
- die Verwendungshistorie wird beim Abschluss materialisiert; übersprungene
|
||||
Verwendungen und die Reservebank zählen nicht als gesendet
|
||||
- abgeschlossene Sendungen liegen getrennt im Archiv, sind intern nur lesbar und
|
||||
lassen sich mit neuen IDs, offenen Verwendungen und ohne Live- oder
|
||||
Freigabezustand in einen neuen Entwurf duplizieren
|
||||
- Barkeeper verwalten gehashte Leselinks direkt in der Sendungsbearbeitung und
|
||||
gesammelt in der Verwaltung; Umfang, Passwort und Ablauf lassen sich ändern,
|
||||
Freigaben vollständig löschen
|
||||
- Entwürfe, bereite und laufende Sendungen lassen sich bereits freigeben;
|
||||
Planänderungen werden beim nächsten Gastaufruf sichtbar, während der Abschluss
|
||||
denselben Link auf den unveränderlichen historischen Stand festlegt
|
||||
- passwortgeschützte Freigaben verwenden kurzlebige, gehashte Gast-Sitzungen und
|
||||
begrenzen Fehlversuche pro Link und Clientadresse
|
||||
- Gastseiten liefern genau eine positiv projizierte Sendung ohne interne IDs,
|
||||
Originaldaten oder nicht freigegebene Felder; geschützte Präsentationsmedien
|
||||
prüfen Umfang, Passwortsitzung, Ablauf und Widerruf bei jedem Direktaufruf
|
||||
- bestehende abgeschlossene Sendungen werden durch Migration `0015` mit
|
||||
eingefrorener Historie übernommen; Migration `0016` erweitert bestehende
|
||||
Freigaben verlustfrei auf noch nicht abgeschlossene Sendungen
|
||||
|
||||
Die lokale Prüfmatrix umfasst 52 Verhaltenstests und 18 Chromium-Abläufe.
|
||||
Abschluss, Archiv, historische Nur-Lese-Ansicht, Passwortfreigabe,
|
||||
Scope-Begrenzung, direkter Medienzugriff, fremde IDs, Gast-Schreibversuch und
|
||||
Widerruf wurden zusätzlich in einem anonymen Browserkontext geprüft. Der
|
||||
erweiterte Ablauf prüft außerdem offene Sendungen, aktuelle Planänderungen,
|
||||
Bearbeiten und Löschen in beiden Barkeeper-Oberflächen sowie Desktop- und
|
||||
Smartphone-Layout.
|
||||
|
||||
## Live-Regie und Sendungskalender 0.5.12
|
||||
|
||||
- die Live-Kopfleiste zeigt Classic-Regular-Icons für Ausgabe, Gesamtzeit,
|
||||
Abschnitt, Menü und Ablauf; Pause/Fortsetzen liegt zusätzlich als direkter,
|
||||
beschrifteter Iconbutton neben der Abschnittszeit
|
||||
- Sendungskarten ordnen Fakten auf kleinen Bildschirmen wieder horizontal an und
|
||||
vermeiden dadurch die zuvor unnötig hohe Kartenfläche
|
||||
- Reparaturmigration `0014_live_show_timer_repair.sql` ergänzt fehlende
|
||||
Gesamttimertabellen auch dann, wenn `0013` bereits in einem früheren
|
||||
Zwischenstand protokolliert wurde; der 500-Fehler beim Laden von `/live` ist
|
||||
damit behoben
|
||||
- gemeinsame persistente Pause für Piece-, Abschnitts- und Gesamttimer;
|
||||
Fortsetzen zählt Pausenzeit weder nach Navigation noch nach Reload mit
|
||||
- getrennte bestätigungspflichtige Resets für Abschnitts- und Gesamtzeit, ohne
|
||||
Piece-Status, Ablaufposition, Restplanung oder Präsentationsstand zu verändern
|
||||
- umschaltbare, lokal gemerkte Anzeige von gelaufener Gesamtzeit und geschätzter
|
||||
Restzeit; Abschnitte ohne eigene Planung werden kenntlich gemacht und
|
||||
Abschnitts- sowie Piece-Dauern nie doppelt addiert
|
||||
- explizite Sendungssteuerung für Entwurf, Bereit, Start, Pause, Ende,
|
||||
Wiederaufnahme eines beendeten Laufs und klar getrennten neuen Durchlauf
|
||||
- optionales privates Markdownfeld „Interaktion“ zwischen Moderation und
|
||||
Überleitung; Original, Vorlage, Sendungsfassung, Duplikation und bewusste
|
||||
Fundus-Aktualisierung führen jeweils unabhängige Snapshots
|
||||
- „Interaktion“, Timer- und Sendungssteuerung bleiben aus der öffentlichen
|
||||
heinzlive-Projektion ausgeschlossen
|
||||
- fokussierte private Liveansicht ohne normale App-Seitenleiste oder mobile
|
||||
Bottomnavigation; Planung, Theme, Schriftgröße, Zeitdarstellung und
|
||||
Ausgabekanal bleiben über das kompakte Regiemenü erreichbar
|
||||
- zweizeilige feste Kopfzeile: Abschnitt und „Danach“ teilen sich die erste
|
||||
Zeile mit dem Menü; Ausgabe, Abschnittscountdown und Ablaufschalter bilden die
|
||||
zweite Zeile. Der Sendungsname steht platzsparend im Menü
|
||||
- lange Abschnitts- und Folgetitel sind regulär einzeilig gekürzt und lassen
|
||||
sich per Klick oder Tastatur vollständig aufklappen
|
||||
- feste, auf vier Kernaktionen reduzierte Fußleiste mit Zurück, Präsentieren,
|
||||
Überspringen und kontextgerechtem Erledigen; das Leeren der Präsentation liegt
|
||||
direkt beim Ausgabezustand
|
||||
- aktuelle Moderation und schmale Ablaufspalte bleiben auch bei 900 × 450 Pixeln
|
||||
nebeneinander; beide Arbeitsflächen scrollen unabhängig, ohne die ganze Seite
|
||||
oder einzelne Textblöcke zu verschachtelten Scrollcontainern zu machen
|
||||
- bei niedrigen Desktopfenstern werden Abstände und Bedienleisten anhand der
|
||||
verfügbaren Höhe verdichtet, ohne Text oder Gesamtoberfläche zu skalieren
|
||||
- auf schmalen Ansichten bleibt das Piece die Hauptfläche und der Ablauf öffnet
|
||||
als separates, safe-area-fähiges Sheet mit Fokusführung und Escape-Schließen
|
||||
- kompakter aufklappbarer Ablauf mit ausgeschriebenen Zuständen, lokaler
|
||||
Betrachtung jedes Pieces, automatisch sichtbarem aktuellen Eintrag und
|
||||
zusammengeklappter Reserve; Sortierung bleibt in einer kompakten Aktion
|
||||
erreichbar, dauerhafte Sortierpfeile entfallen
|
||||
- die Leseposition wird je Piece lokal erhalten; ein erstmals gewähltes Piece
|
||||
beginnt oben statt an der Position des vorherigen Textes
|
||||
- Piece-Position, Titel und Zeit teilen sich einen kompakten Piece-Kopf, ohne die
|
||||
einstellbare Moderationsschrift zu verkleinern
|
||||
- das Regiemenü liegt als viewportgebundenes Popover sicher über den Glasflächen,
|
||||
bleibt scrollbar erreichbar und schließt per Escape oder Außenklick mit
|
||||
Fokus-Rückkehr zum Auslöser
|
||||
- Recherche, Quellen, Werkzeuge und eigene Notizen erscheinen nur bei Bedarf;
|
||||
leere Moderationsbereiche werden nicht dargestellt
|
||||
- Zurück und direkte Ablaufwahl verändern weder tatsächliches Live-Piece noch
|
||||
Status, Timer oder öffentliche Ausgabe; Überspringen und Erledigen bleiben bei
|
||||
einem nur betrachteten früheren Piece gesperrt
|
||||
- Liste und Kalender teilen dieselben Sendungsdaten; der Desktop zeigt ein
|
||||
vollständiges Monatsraster, das Smartphone eine chronologische Monatsagenda
|
||||
- Monatswechsel, heutiger Tag, mehrere Termine pro Tag und Sendungen ohne Termin
|
||||
bleiben sichtbar; die bevorzugte Listen- oder Kalenderansicht wird je Konto
|
||||
gespeichert
|
||||
- die Wiederaufnahmeaktion erscheint nur bei tatsächlich unterbrochenem
|
||||
Live-Stand statt während eines laufenden Pieces
|
||||
|
||||
Etappe 6 bleibt unverändert unbegonnen.
|
||||
|
||||
Die bestehende lokale Prüfmatrix umfasst 44 Verhaltenstests und 17
|
||||
Chromium-Abläufe. Die nachträgliche Icon-, Pause- und Kartenkorrektur wurde
|
||||
zusätzlich mit Typprüfung, sechs Live-Verhaltenstests, Produktionsbuild und
|
||||
gezielten Chromium-Abläufen bei 670 × 450, 390 × 700 und 656 × 400 Pixeln
|
||||
geprüft. Die vollständige Matrix wurde dafür nicht erneut ausgeführt.
|
||||
Reales OBS, echte YouTube-/TikTok-Wiedergabe sowie Safari auf einem iOS-Gerät
|
||||
bleiben mangels verfügbarer Umgebung offen.
|
||||
|
||||
## Verwaltungskorrektur 0.5.11
|
||||
|
||||
- der Werkzeugdialog bleibt beim Laden geschlossen und öffnet erst nach einer
|
||||
bewussten Aktion
|
||||
- die Themen-Iconauswahl bleibt bei mobilen und breiten Ansichten vollständig
|
||||
innerhalb des Viewports
|
||||
|
||||
## Editor-Erlebnis 0.5.10
|
||||
|
||||
- direkte, tastaturbedienbare Titelbearbeitung in Fundus- und Sendungsfassungen
|
||||
sowie gemeinsame kompakte Auswahlflächen für Themen und Werkzeuge
|
||||
- vollständiger lokaler Classic-Regular-Katalog mit 3.671 Icons für Navigation,
|
||||
Aktionen sowie frei wählbare Themen- und Werkzeugicons; durchsuchbare
|
||||
Metadaten und SVG-Sprite vermeiden externe Laufzeitabhängigkeiten
|
||||
- kompakter Werkzeugkatalog nach dem Muster der Themenverwaltung; Anlegen und
|
||||
Bearbeiten teilen einen responsiven Dialog mit gestalteter Icon- und
|
||||
Formatauswahl, bestehende Zuordnungen und Deaktivierung bleiben erhalten
|
||||
- Präsentationsbilder werden bewusst aus aktiven Piece-Medien ausgewählt und als
|
||||
unveränderlicher Usage-Snapshot eingeplant; private Bilder werden dadurch
|
||||
weder implizit noch nach späterer Originaländerung öffentlich
|
||||
- entfernte Medien bleiben für bestehende Sendungsfassungen erhalten, während
|
||||
neue Einplanungen nur aktive Medien übernehmen
|
||||
- wiederherstellbares Soft Delete für Pieces sowie geschütztes Entfernen offener,
|
||||
nie live gelaufener Verwendungen und Abschnitte
|
||||
- kompaktere Fundus-, Eingangs-, Archiv-, Vorlagen- und Sendungsansichten mit
|
||||
mobilen, touch- und tastaturbedienbaren Alternativen
|
||||
- transparente leere heinzlive-Ausgabe ohne sichtbaren Renderer oder
|
||||
Verbindungsstatus; die Steuerung kann eine aktive Präsentation unabhängig vom
|
||||
aktuellen Piece leeren
|
||||
|
||||
Etappe 6 bleibt unverändert unbegonnen. Die lokale Prüfmatrix umfasst 40
|
||||
Verhaltenstests und 16 Chromium-Abläufe. Reales OBS, echte
|
||||
YouTube-/TikTok-Wiedergabe sowie Safari auf einem iOS-Gerät bleiben mangels
|
||||
verfügbarer Umgebung offen.
|
||||
|
||||
## Live-Werkbank 0.5.9
|
||||
|
||||
- globale Favoriten am Fundus-Original mit stabiler Vorsortierung; verwendete
|
||||
Favoriten bleiben sichtbar, geplante Favoriten respektieren weiterhin den
|
||||
Einplanungsfilter
|
||||
- Barkeeper-Werkzeugkatalog mit Start-URL, Beschreibung, passenden Formaten und
|
||||
verlustfreier Deaktivierung; Arbeitslink und Notiz bleiben für die gesamte
|
||||
Thekencrew im gemeinsamen Piece- und Verwendungseditor bearbeitbar
|
||||
- vollständige, voneinander unabhängige Usage-Snapshots für Quellen, Werkzeuge
|
||||
und alphabetisch stabilisierte Themen; spätere Original- oder
|
||||
Katalogänderungen wirken erst nach bewusster Aktualisierung aus dem Fundus
|
||||
- kompakte private Materialliste in der Live-Steuerung mit Arbeitslink vor
|
||||
Start-URL und verständlichem Zustand ohne URL
|
||||
- responsive Themen-Dachzeile in der Publikumsausgabe; ohne Thema bleibt sie
|
||||
vollständig aus, während Präsentations- und interner Titel getrennt bleiben
|
||||
- persistenter Abschnitts-Countdown für positive explizite Abschnittsdauern mit
|
||||
eingefrorenem Soll, sekündlicher Anzeige, Goldwarnung ab zwei Minuten und
|
||||
roter Überziehung ohne Ton, Blinken oder automatische Weiterschaltung
|
||||
|
||||
Etappe 6 bleibt unverändert unbegonnen. Reales OBS und echte
|
||||
YouTube-/TikTok-Wiedergabe bleiben mangels verfügbarer Umgebung offen.
|
||||
|
||||
Die lokale Prüfmatrix umfasst 37 Verhaltenstests und 16 Chromium-Abläufe.
|
||||
Desktop, Smartphone, Light/Dark, Favoritenfilter, Werkzeug-Deaktivierung,
|
||||
Snapshot-Stabilität, private Live-Materialien, öffentliche Themenprojektion und
|
||||
persistente Abschnittszeit wurden geprüft.
|
||||
|
||||
## Redaktionelle Arbeitsabläufe 0.5.8
|
||||
|
||||
- persistente Piece-Vorlagen als unabhängige, revisionierte Snapshots; eigene
|
||||
Vorlagen lassen sich aus Fundus-Pieces speichern, erneut verwenden und löschen
|
||||
- atomare, idempotente Piece-Neuanlage direkt in einer Sendung einschließlich
|
||||
Einplanung; fehlgeschlagene Schritte hinterlassen weder Piece noch Verwendung
|
||||
- getrennte interne und öffentliche Titel an Piece und Verwendung; ein leerer
|
||||
Präsentationstitel fällt kontrolliert auf den internen Titel zurück
|
||||
- präzises Entfernen einzelner Verwendungen mit Bestätigung sowie zusätzlicher
|
||||
Drag-and-drop-Rückgabe in den Fundusbereich
|
||||
- Auswahl jedes konkreten Ablauf-Pieces in der Live-Steuerung, einschließlich
|
||||
erstem und bereits erledigtem Eintrag
|
||||
- stabiler OBS-Ausgabekanal `/heinzlive/default` mit geheimem URL-Fragment,
|
||||
HttpOnly-Cookie-Austausch und ausdrücklicher Schlüsselrotation
|
||||
- öffentliche Ausgabe als Positivliste: implizite Piece-Quellen und private
|
||||
Uploads werden nicht mehr veröffentlicht; nur ausdrücklich gewählte
|
||||
Link-/Videoquellen und deren erlaubte Vorschau bleiben sichtbar
|
||||
|
||||
Die vollständige lokale Prüfmatrix umfasst 33 Verhaltenstests und 15
|
||||
Chromium-Abläufe. Desktop, Mobil, Light/Dark, Tastatur- und Touchalternativen,
|
||||
Planung, Live-Ausgabe sowie anonyme Ausgabedaten wurden geprüft. Reales OBS und
|
||||
echte YouTube-/TikTok-Wiedergabe bleiben mangels verfügbarer Umgebung offen.
|
||||
|
||||
## Materialkorrektur 0.5.7
|
||||
|
||||
- statische Gold-/Blauviolettlichter so positioniert und verstärkt, dass sie im
|
||||
eigentlichen Arbeitsbereich statt fast ausschließlich hinter der Navigation
|
||||
sichtbar werden
|
||||
- gemeinsame Materialtokens auf Außenglas, dunkle Innenfläche und tiefe
|
||||
Ablaufkarte reduziert; verschachtelte Abschnitte, Pieces und Aktionsgruppen
|
||||
werden nach innen dunkler statt heller und blaugrau
|
||||
- aktive Editortabs transparent goldgetönt und private Recherche sowie
|
||||
Quellen-/Materialbereiche auf transparente Nachtblauflächen zurückgeführt
|
||||
- Dialog-Backdrop von starker Abdunklung und Unschärfe auf eine leichtere
|
||||
Trennung reduziert, sodass die Lichtstimmung bei geöffnetem Editor erhalten
|
||||
bleibt
|
||||
- deckende Schreibfelder, Goldfokus, Lightmode, Mobilansicht und lesbare
|
||||
Komponentenfüllungen ohne verfügbaren Blur bleiben erhalten
|
||||
|
||||
Die berechneten Hintergründe, Transparenzen, Filter und Begrenzungseigenschaften
|
||||
wurden vor und nach der Korrektur in Chromium kontrolliert. Sendungsplanung,
|
||||
Sendungstext und Recherche wurden bei 1440 × 1000 und 390 × 844 Pixeln in beiden
|
||||
Themes visuell geprüft.
|
||||
|
||||
## Oberflächenkorrektur 0.5.6
|
||||
|
||||
- sichtbare statische Gold- und Blauviolettlichter hinter den halbtransparenten
|
||||
Navigations- und Editorflächen
|
||||
- klarere Glaswirkung in Navigation sowie Kopf, Tabs und Fuß des Piece-Editors;
|
||||
Schreibflächen bleiben deckend, ruhig und goldfokussiert
|
||||
- Fundus mit dauerhaft sichtbarer Suche und Neuanlage, aufklappbaren Zusatzfiltern
|
||||
und inhaltsorientierten, vollständig anklickbaren Zeilen
|
||||
- vorhandene Vorschaubilder beziehungsweise kleine Symbolplatzhalter sowie
|
||||
gebündelte Menüs für Duplizieren und Archivieren
|
||||
- bestehende Server-Actions, Filterlogik und Editor-Bereiche unverändert
|
||||
|
||||
Geprüft wurden `npm run check` sowie Fundus und geöffneter Piece-Editor in
|
||||
Chromium bei 1440 × 1000 und 390 × 844 Pixeln in Light/Dark. Die gezielte
|
||||
Kontrolle umfasste Tastaturöffnung, Menüs, Fokus, Glaswerte, Seitenüberlauf und
|
||||
visuell geprüfte Screenshots. Produktionsbuild und vollständige Testmatrix wurden
|
||||
gemäß Auftrag nicht ausgeführt.
|
||||
|
||||
## Oberflächenkorrektur 0.5.5
|
||||
|
||||
- dunkle Grundfläche mit sehr zurückhaltenden Gold-/Cyan-Lichtfeldern innerhalb
|
||||
der Anwendung statt gleichmäßig deckender Blauflächen
|
||||
- Navigation, große Arbeitsflächen und Piece-Dialog als dunkles beziehungsweise
|
||||
helles Glas mit feiner Lichtkante, Unschärfe und ruhigem Schatten
|
||||
- Gold für Dialogkontur, Fokus, aktive Zustände und Hauptaktionen; Cyan nur noch
|
||||
für ergänzende redaktionelle Hinweise und Links
|
||||
- klar abgegrenzte, weitgehend deckende Schreibfelder mit Goldfokus, Platzhaltern
|
||||
und nach Textrolle abgestuften Höhen
|
||||
- bestehende nachträgliche CSS-Override-Schicht entfernt und die Gestaltung in
|
||||
gemeinsame Tokens und ursprüngliche Komponentenregeln zurückgeführt
|
||||
|
||||
Geprüft wurden Typen, Produktionsbuild sowie gezielte Chromium-Ansichten von
|
||||
Eingang, Fundus, Piece-Editor, Sendungsplanung und Live-Steuerung bei 1440 × 1000
|
||||
und 390 × 844 Pixeln in beiden Themes. Die vollständige Unit- und E2E-Matrix
|
||||
bleibt wie beauftragt Schritt 3 vorbehalten.
|
||||
|
||||
## Oberflächenrelease 0.5.4
|
||||
|
||||
- gemeinsame Light-/Dark-Tokens für ruhige Arbeitsflächen, Cyan als
|
||||
Interaktionsfarbe und Gold für die jeweilige Hauptaktion
|
||||
- Darkmode im heinzlive-Farbraum mit Hintergrund `#0B1220`, Flächen `#152238`,
|
||||
Text `#FFF7E8`, Sekundärtext `#A9B6C8`, Gold `#E7B957`, Cyan `#67DDE8` und
|
||||
Grenzen `#30435C`
|
||||
- vereinheitlichte Navigation, Formulare, Meldungen, Listen, Sendungsplan,
|
||||
Live-Steuerung und Piece-Dialoge ohne Änderung der Bedienlogik
|
||||
- kompaktere Planzeilen mit sichtbarem Drag-Griff und waagerechter Aktionsgruppe;
|
||||
Klick-, Touch- und Tastaturalternativen bleiben erhalten
|
||||
- verständliche Kontextnamen „Fundusfassung“ und „Sendungsfassung“ sowie weniger
|
||||
technische Erläuterungen im redaktionellen Arbeitsfluss
|
||||
- dezente Speicheraktion im gespeicherten Zustand und hervorgehobene Aktion bei
|
||||
ungespeicherten Änderungen, Fehlern oder Konflikten
|
||||
|
||||
Für diesen Design-Release wurden `npm run check`, `npm run build` und gezielte
|
||||
Chromium-Sichtkontrollen auf Eingang, Fundus, Piece-Editor, Sendungsplan und
|
||||
Live-Steuerung bei 1440 × 1000 sowie 390 × 844 Pixeln in Light/Dark ausgeführt.
|
||||
Konsolenfehler und horizontaler Seitenüberlauf traten dabei nicht auf. Die
|
||||
vollständige Unit- und E2E-Matrix wurde für die rein visuelle Änderung bewusst
|
||||
nicht erneut ausgeführt; die fachlichen Nachweise der Etappen 1 bis 5 bleiben
|
||||
unverändert.
|
||||
|
||||
## Umgesetzter Stand Etappe 1
|
||||
|
||||
@@ -13,6 +393,8 @@ lokaler Betriebsweg sind dokumentiert. Etappe 2 wurde nicht begonnen.
|
||||
- persistentes Light-/Dark-/System-Theme
|
||||
- responsive Navigation und gekennzeichnete Vorschauen für Fundus,
|
||||
Sendungsbau und Live-Modus
|
||||
- kompakte Desktop-Arbeitsansicht mit fester Seitenleiste, Fundusliste und
|
||||
zweigeteiltem Sendungsbau; auf schmalen Ansichten Umschaltung statt Engpass
|
||||
- Healthcheck, Produktionsstart und frühes Cloudron-Paket
|
||||
- getrennte Unit-/Integrations- und Browser-Testdaten
|
||||
|
||||
@@ -20,12 +402,132 @@ Die Vorschauen lesen echte Daten aus SQLite. Suche und mobile Pane-Umschaltung
|
||||
funktionieren lokal; redaktionelle Schreiboperationen bleiben bewusst den
|
||||
späteren Etappen vorbehalten.
|
||||
|
||||
## Nicht Bestandteil dieser Etappe
|
||||
Die abschließende Oberflächenüberarbeitung von Etappe 1 reduziert große
|
||||
Seitenköpfe und verschachtelte Karten, bündelt den Schreibschutzhinweis
|
||||
aufklappbar und hält Entwicklungsinformationen aus der Arbeitsoberfläche heraus.
|
||||
Eingang und Archiv zeigen kurze Leerzustände, die Verwaltung trennt
|
||||
Abschnittskategorien, Formate und Themen kompakt.
|
||||
|
||||
Anmeldung, Rollen, echte Inhaltsbearbeitung, Autospeichern, Sendungsplanung,
|
||||
Live-Steuerung, Präsentationsfenster, Archivabschluss, Freigaben, RSS und API.
|
||||
Die Vorschauen dürfen nicht als Implementierung dieser Funktionen verstanden
|
||||
werden.
|
||||
Die abschließende responsive Prüfung verdichtet Seitenleiste, Navigation und
|
||||
Funduszeilen weiter. Mobile Funduskarten sind intern einspaltig; lange Titel,
|
||||
Beschreibungen und Metadaten bleiben ohne feste Kartenhöhe sichtbar. Suche und
|
||||
Statusfilter sind gleich hoch, und die Filtergruppe wird nur als Ganzes
|
||||
umgebrochen.
|
||||
|
||||
## Noch nicht umgesetzt
|
||||
|
||||
Archivabschluss, Freigaben, RSS und API. Diese späteren Bereiche dürfen nicht
|
||||
als bereits implementiert verstanden werden.
|
||||
|
||||
## Umgesetzter Stand Etappe 2
|
||||
|
||||
- einmalige Erstadmin-Einrichtung mit externem Betreiber-Token
|
||||
- Login und POST-Logout mit widerrufbaren Datenbanksitzungen
|
||||
- Rollen Barkeeper und Thekencrew mit serverseitiger Prüfung
|
||||
- Einladungen und Passwortreset über befristete, einmalige Links
|
||||
- Kontensperrung mit sofortigem Entzug bestehender Sitzungen
|
||||
- zeitfensterbasiertes Login-Rate-Limit ohne dauerhafte Kontensperre
|
||||
- lokale Mail-Outbox als Vorgabe und explizit konfigurierbarer SMTP-Versand
|
||||
- responsive Authentifizierungs- und Kontenverwaltungsoberflächen
|
||||
|
||||
## Umgesetzter Stand Etappe 3
|
||||
|
||||
- persistente Piece-Neuanlage aus leerem Entwurf oder drei redaktionellen Vorlagen
|
||||
- Schnellaufnahme von Gedanken und HTTP-/HTTPS-Links im Eingang
|
||||
- vollständiger Editor für Quellen, Dauer in Minuten, Status und getrennte
|
||||
Einleitung, Recherche, Moderation, Überleitung und Präsentation
|
||||
- serverseitig bereinigte Markdown-Vorschau
|
||||
- unabhängige Themen, Formate und Abschnittskategorien mit Barkeeper-Verwaltung
|
||||
- serverseitige Suche und Filter nach Status, Format, Thema und Abschnitt
|
||||
- Autospeichern mit sichtbarem Zustand und Warten vor interner Navigation
|
||||
- optimistische Revisionen verhindern unbemerktes Überschreiben
|
||||
- Duplizieren einschließlich Quellen, Taxonomie und Bildern
|
||||
- Archivieren und Wiederherstellen in den vorherigen Arbeitsstatus
|
||||
- private Rasterbilder mit Größen-/Signaturprüfung und geschützter Auslieferung
|
||||
- erweiterter Seed mit Eingangs-, Archiv-, Markdown- und Recherchebeispielen
|
||||
- standardmäßig ausgeblendete gesendete Pieces mit verlinkter, aufklappbarer
|
||||
Verwendungshistorie; gesendet bedeutet erledigt in abgeschlossener Sendung
|
||||
- standardmäßig ausgeblendete Pieces, die in mindestens einer noch nicht
|
||||
abgeschlossenen Sendung eingeplant sind, mit unabhängigem Sofortfilter
|
||||
- Fundus-Originale und sendungsspezifische Verwendungen nutzen denselben
|
||||
großzügigen Dialograhmen mit den Bereichen „Sendungstext“, „Recherche &
|
||||
Quellen“ und „Präsentation“; der jeweilige Speicherkontext ist sichtbar und
|
||||
Original sowie Verwendung bleiben getrennte Revisionsgrenzen
|
||||
- Titel, Einleitung, Moderationsstichpunkte und Überleitung sind ohne
|
||||
vorgeschaltete Lese-/Bearbeitungsschalter direkt beschreibbar; eine kleine
|
||||
Markdown-Leiste ergänzt Formatierung ohne Änderung des Speicherformats
|
||||
- Recherche, Quellen, verwendungseigene Notizen und Material sind in einem
|
||||
Bereich gebündelt; öffentliche Texte, Darstellungswahl und tatsächliche
|
||||
Vorschau stehen gemeinsam im Präsentationsbereich
|
||||
- der Dialog bleibt innerhalb der Desktop-Fensterhöhe, hält Kopf,
|
||||
Bereichsnavigation und Aktionen sichtbar und nutzt mobil die volle
|
||||
Bildschirmfläche; Bereichswechsel hängen Eingaben nicht aus und merken die
|
||||
jeweilige Scrollposition
|
||||
- die Schnellaufnahme akzeptiert Gedanke oder URL, bleibt nach dem Ablegen im
|
||||
Eingang und öffnet die Ausarbeitung erst über eine bewusste Aktion
|
||||
|
||||
Für diese gezielte Überarbeitung wurden `npm run check` sowie kurze
|
||||
Chromium-Sichtkontrollen des Original- und Verwendungseditors bei 1440 × 1000
|
||||
und 390 × 844 Pixeln ausgeführt. Dabei waren Dialoggrenzen, feste Bedienbereiche,
|
||||
alle drei Arbeitsbereiche und horizontaler Überlauf unauffällig. Die vollständige
|
||||
Unit-, E2E- und Build-Matrix ist gemäß Auftrag noch offen.
|
||||
|
||||
## Umgesetzter Stand Etappe 4
|
||||
|
||||
- Sendungsübersicht mit leerem Start, Standardablauf und Spieleabend-Vorlage
|
||||
- frei benennbare, kategorisierte und sortierbare Abschnitte einschließlich
|
||||
eigenständiger Spieleblöcke
|
||||
- Einplanung ausschließlich sendefertiger Pieces als unabhängige Text- und
|
||||
Dauerkopien; Mehrfachverwendung desselben Originals ist möglich
|
||||
- showweite Reservebank, die nicht in Abschnitts- oder Gesamtdauer einfließt
|
||||
- explizite Abschnittsdauer ersetzt die Piece-Summe statt sie zu addieren
|
||||
- Bearbeiten, Entfernen sowie Verschieben innerhalb und zwischen Abschnitten
|
||||
- zugänglicher Stift-Dialog für alle sendungsspezifischen Felder und Aktionen,
|
||||
auf Desktop zweispaltig und auf kleinen Bildschirmen einspaltig scrollbar
|
||||
- explizites Aktualisieren eines Verwendungssnapshots aus dem Original für
|
||||
Titel, Dauer und Redaktionstexte bei erhaltenen Notizen und Live-Daten
|
||||
- Duplizieren einer konkreten Einplanung direkt hinter dem Ausgangselement mit
|
||||
erhaltenen Anpassungen, aber zurückgesetztem Live-Zustand
|
||||
- Piece-Dauern werden im Editor in Minuten eingegeben und intern weiterhin als
|
||||
ganze Sekunden gespeichert
|
||||
- Drag-and-drop über eindeutige Griffe, auch direkt aus gefilterten Quellen,
|
||||
mit positionsgenauer Einfügevorschau, transparentem Original und
|
||||
gleichwertigen Klick-, Touch- und Tastaturaktionen
|
||||
- Planungsmutationen ohne Dokumentreload mit lokalem Speicherzustand und
|
||||
animierter Neusortierung der betroffenen Elemente
|
||||
- unabhängige Sofortfilter für verwendete sowie in der aktuellen Sendung schon
|
||||
eingeplante Originale einschließlich Reservebank
|
||||
- kopierbare Twitch-Titel und Ankündigungstexte
|
||||
- showweite optimistische Revision schützt Metadaten, Reihenfolge und Inhalte
|
||||
vor unbemerktem parallelem Überschreiben
|
||||
- realistischer Seed mit Standardablauf und eigenständigem Spieleabend
|
||||
|
||||
## Umgesetzter Stand Etappe 5
|
||||
|
||||
- fokussierte Moderationsansicht mit Prompter-Schrift, Einleitung, Moderation,
|
||||
Überleitung und standardmäßig geschlossener privater Recherche
|
||||
- ausblendbare Zeit- und Ablaufanzeige sowie persistente lokale Leseposition
|
||||
- aktuelles und nächstes Piece samt Abschnitt und geplantem Zeitbedarf
|
||||
- persistenter Live-Stand mit tatsächlichen Laufintervallen, Erledigen,
|
||||
Überspringen, Zurück und Wiederaufnahme
|
||||
- idempotente Live-Befehle verhindern doppelte Wirkung bei Wiederholung
|
||||
- serverseitig geschützte Umsortierung offener Pieces und Reserveeinfügung
|
||||
- explizite Präsentationsaktion; normale Live-Navigation verändert die Ausgabe
|
||||
nicht
|
||||
- getrennte, tokenisierte heinzlive-Ausgabe mit Polling, Verbindungsanzeige,
|
||||
Präsentationstext, Quellen und erlaubten Bildern
|
||||
- wählbare Text-, Linkkarten- und Videodarstellung aus genau einer vorhandenen
|
||||
Piece-Quelle mit manuell korrigierbaren, persistenten Metadaten
|
||||
- ausdrückliches serverseitiges Neuladen von Linkmetadaten über Metascraper mit
|
||||
DNS-, Redirect-, Zeit-, Größen- und Privatnetzschutz
|
||||
- validierte YouTube- und TikTok-IDs, offizielle Player-Iframes ohne Autoplay
|
||||
sowie Linkkarten-Fallback für nicht unterstützte Videoquellen
|
||||
- unveränderliche Präsentationssnapshots je Einplanung und explizite
|
||||
Aktualisierung aus dem Fundus
|
||||
- isolierte Präsentationstestansicht ohne Änderung des Live-Stands sowie
|
||||
tokengebundene, serverseitig geschützte Proxys für externe Vorschaubilder
|
||||
- Ausgabe-HTML, JSON und Medienzugriff enthalten keine Recherche,
|
||||
Moderationsnotizen, eigenen Notizen, Kontodaten oder internen Dateipfade
|
||||
|
||||
## Bekannte offene Betriebsprüfung
|
||||
|
||||
@@ -35,6 +537,15 @@ durchgeführt werden. Auch der lokale Container-Smoke-Test blieb offen, weil
|
||||
auf der Prüfmaschine kein Docker-Daemon lief. Manifestkernfelder und
|
||||
Startskript-Syntax wurden lokal geprüft.
|
||||
|
||||
Eine reale OBS-Browserquelle stand nicht zur Verfügung. Die tokenisierte
|
||||
Präsentationsausgabe wurde stattdessen in einem anonymen zweiten Chromium-
|
||||
Browserkontext einschließlich Bild, JSON-Filterung, Polling und sichtbarem
|
||||
Verbindungsabbruch geprüft.
|
||||
|
||||
Die automatisierten Playerprüfungen fingen YouTube- und TikTok-Requests lokal
|
||||
ab. URL-Erkennung, Iframe-Wechsel, Zeitmarkenübergabe und mobile Ausgabe sind
|
||||
damit geprüft, nicht jedoch die reale Wiedergabe oder Verfügbarkeit der Anbieter.
|
||||
|
||||
## Verifizierte Umgebung
|
||||
|
||||
- Node.js 22.23.1, npm 10.9.8
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
CREATE TABLE users (
|
||||
id TEXT PRIMARY KEY,
|
||||
email TEXT NOT NULL,
|
||||
email_normalized TEXT NOT NULL UNIQUE,
|
||||
display_name TEXT NOT NULL,
|
||||
password_hash TEXT NOT NULL,
|
||||
role TEXT NOT NULL CHECK (role IN ('barkeeper', 'thekencrew')),
|
||||
locked_at_utc TEXT,
|
||||
password_changed_at_utc TEXT NOT NULL,
|
||||
created_at_utc TEXT NOT NULL,
|
||||
updated_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE sessions (
|
||||
token_hash TEXT PRIMARY KEY,
|
||||
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
created_at_utc TEXT NOT NULL,
|
||||
expires_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX sessions_user_idx ON sessions(user_id);
|
||||
CREATE INDEX sessions_expiry_idx ON sessions(expires_at_utc);
|
||||
|
||||
CREATE TABLE invitations (
|
||||
id TEXT PRIMARY KEY,
|
||||
email TEXT NOT NULL,
|
||||
email_normalized TEXT NOT NULL,
|
||||
role TEXT NOT NULL CHECK (role IN ('barkeeper', 'thekencrew')),
|
||||
token_hash TEXT NOT NULL UNIQUE,
|
||||
created_by_user_id TEXT NOT NULL REFERENCES users(id),
|
||||
created_at_utc TEXT NOT NULL,
|
||||
expires_at_utc TEXT NOT NULL,
|
||||
accepted_at_utc TEXT,
|
||||
revoked_at_utc TEXT
|
||||
);
|
||||
|
||||
CREATE INDEX invitations_email_idx ON invitations(email_normalized, created_at_utc);
|
||||
|
||||
CREATE TABLE password_reset_tokens (
|
||||
id TEXT PRIMARY KEY,
|
||||
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
token_hash TEXT NOT NULL UNIQUE,
|
||||
created_at_utc TEXT NOT NULL,
|
||||
expires_at_utc TEXT NOT NULL,
|
||||
consumed_at_utc TEXT
|
||||
);
|
||||
|
||||
CREATE INDEX password_resets_user_idx ON password_reset_tokens(user_id, created_at_utc);
|
||||
|
||||
CREATE TABLE login_attempts (
|
||||
id TEXT PRIMARY KEY,
|
||||
email_key TEXT NOT NULL,
|
||||
address_key TEXT NOT NULL,
|
||||
attempted_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX login_attempts_email_idx ON login_attempts(email_key, attempted_at_utc);
|
||||
CREATE INDEX login_attempts_address_idx ON login_attempts(address_key, attempted_at_utc);
|
||||
@@ -0,0 +1,23 @@
|
||||
ALTER TABLE pieces ADD COLUMN research_text TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE pieces ADD COLUMN revision INTEGER NOT NULL DEFAULT 1 CHECK (revision >= 1);
|
||||
ALTER TABLE pieces ADD COLUMN archived_from_status TEXT CHECK (
|
||||
archived_from_status IS NULL OR archived_from_status IN ('inbox', 'preparing', 'ready')
|
||||
);
|
||||
|
||||
CREATE TABLE piece_media (
|
||||
id TEXT PRIMARY KEY,
|
||||
piece_id TEXT NOT NULL REFERENCES pieces(id) ON DELETE CASCADE,
|
||||
storage_name TEXT NOT NULL UNIQUE,
|
||||
original_name TEXT NOT NULL,
|
||||
mime_type TEXT NOT NULL CHECK (mime_type IN ('image/jpeg', 'image/png', 'image/webp', 'image/gif')),
|
||||
byte_size INTEGER NOT NULL CHECK (byte_size > 0 AND byte_size <= 5242880),
|
||||
alt_text TEXT NOT NULL DEFAULT '',
|
||||
position INTEGER NOT NULL CHECK (position >= 0),
|
||||
created_at_utc TEXT NOT NULL,
|
||||
UNIQUE (piece_id, position)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_piece_media_piece ON piece_media(piece_id, position);
|
||||
CREATE INDEX idx_piece_topics_topic ON piece_topics(topic_id, piece_id);
|
||||
CREATE INDEX idx_piece_categories_category ON piece_category_suggestions(category_id, piece_id);
|
||||
CREATE INDEX idx_piece_sources_piece ON piece_sources(piece_id, position);
|
||||
@@ -0,0 +1,152 @@
|
||||
CREATE TABLE shows_v4 (
|
||||
id TEXT PRIMARY KEY,
|
||||
title TEXT NOT NULL,
|
||||
starts_at_utc TEXT,
|
||||
twitch_title TEXT NOT NULL DEFAULT '',
|
||||
announcement_text TEXT NOT NULL DEFAULT '',
|
||||
status TEXT NOT NULL CHECK (status IN ('draft', 'ready', 'live', 'completed')),
|
||||
revision INTEGER NOT NULL DEFAULT 1 CHECK (revision >= 1),
|
||||
created_at_utc TEXT NOT NULL,
|
||||
updated_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE show_sections_v4 (
|
||||
id TEXT PRIMARY KEY,
|
||||
show_id TEXT NOT NULL REFERENCES shows_v4(id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
category_id TEXT REFERENCES section_categories(id) ON DELETE SET NULL,
|
||||
position INTEGER NOT NULL CHECK (position >= 0),
|
||||
explicit_duration_seconds INTEGER CHECK (
|
||||
explicit_duration_seconds IS NULL OR
|
||||
(explicit_duration_seconds >= 0 AND explicit_duration_seconds <= 86400)
|
||||
),
|
||||
is_reserve_bank INTEGER NOT NULL DEFAULT 0 CHECK (is_reserve_bank IN (0, 1)),
|
||||
UNIQUE (show_id, position)
|
||||
);
|
||||
|
||||
CREATE TABLE piece_usages_v4 (
|
||||
id TEXT PRIMARY KEY,
|
||||
show_section_id TEXT NOT NULL REFERENCES show_sections_v4(id) ON DELETE CASCADE,
|
||||
original_piece_id TEXT REFERENCES pieces(id) ON DELETE SET NULL,
|
||||
position INTEGER NOT NULL CHECK (position >= 0),
|
||||
status TEXT NOT NULL CHECK (status IN ('open', 'current', 'done', 'skipped')),
|
||||
duration_seconds INTEGER NOT NULL CHECK (duration_seconds >= 0 AND duration_seconds <= 86400),
|
||||
title_snapshot TEXT NOT NULL,
|
||||
intro_snapshot TEXT NOT NULL DEFAULT '',
|
||||
research_snapshot TEXT NOT NULL DEFAULT '',
|
||||
moderation_snapshot TEXT NOT NULL DEFAULT '',
|
||||
transition_snapshot TEXT NOT NULL DEFAULT '',
|
||||
presentation_snapshot TEXT NOT NULL DEFAULT '',
|
||||
own_notes TEXT NOT NULL DEFAULT '',
|
||||
is_reserve INTEGER NOT NULL DEFAULT 0 CHECK (is_reserve IN (0, 1)),
|
||||
UNIQUE (show_section_id, position)
|
||||
);
|
||||
|
||||
INSERT INTO shows_v4 (
|
||||
id, title, starts_at_utc, twitch_title, announcement_text, status, revision,
|
||||
created_at_utc, updated_at_utc
|
||||
)
|
||||
SELECT id, title, starts_at_utc, twitch_title, announcement_text, status, 1,
|
||||
created_at_utc, updated_at_utc
|
||||
FROM shows;
|
||||
|
||||
INSERT INTO show_sections_v4 (
|
||||
id, show_id, name, category_id, position, explicit_duration_seconds, is_reserve_bank
|
||||
)
|
||||
SELECT id, show_id, name, category_id, position, explicit_duration_seconds, 0
|
||||
FROM show_sections;
|
||||
|
||||
INSERT INTO show_sections_v4 (
|
||||
id, show_id, name, category_id, position, explicit_duration_seconds, is_reserve_bank
|
||||
)
|
||||
SELECT 'reserve-bank-' || id, id, 'Reservebank', NULL,
|
||||
COALESCE((SELECT max(position) + 1 FROM show_sections WHERE show_id = shows.id), 0), NULL, 1
|
||||
FROM shows;
|
||||
|
||||
INSERT INTO piece_usages_v4 (
|
||||
id, show_section_id, original_piece_id, position, status, duration_seconds,
|
||||
title_snapshot, intro_snapshot, research_snapshot, moderation_snapshot,
|
||||
transition_snapshot, presentation_snapshot, own_notes, is_reserve
|
||||
)
|
||||
SELECT
|
||||
u.id,
|
||||
CASE WHEN u.is_reserve = 1 THEN 'reserve-bank-' || s.show_id ELSE u.show_section_id END,
|
||||
u.original_piece_id,
|
||||
CASE WHEN u.is_reserve = 1 THEN
|
||||
(
|
||||
SELECT count(*) - 1
|
||||
FROM piece_usages earlier
|
||||
JOIN show_sections earlier_section ON earlier_section.id = earlier.show_section_id
|
||||
WHERE earlier.is_reserve = 1 AND earlier_section.show_id = s.show_id
|
||||
AND (earlier_section.position < s.position OR
|
||||
(earlier_section.position = s.position AND earlier.position < u.position) OR
|
||||
(earlier_section.position = s.position AND earlier.position = u.position AND earlier.id <= u.id))
|
||||
)
|
||||
ELSE u.position END,
|
||||
u.status,
|
||||
u.duration_seconds,
|
||||
u.title_snapshot,
|
||||
u.intro_snapshot,
|
||||
COALESCE(p.research_text, ''),
|
||||
u.moderation_snapshot,
|
||||
u.transition_snapshot,
|
||||
u.presentation_snapshot,
|
||||
'',
|
||||
u.is_reserve
|
||||
FROM piece_usages u
|
||||
JOIN show_sections s ON s.id = u.show_section_id
|
||||
LEFT JOIN pieces p ON p.id = u.original_piece_id;
|
||||
|
||||
DROP TABLE piece_usages;
|
||||
DROP TABLE show_sections;
|
||||
DROP TABLE shows;
|
||||
|
||||
ALTER TABLE shows_v4 RENAME TO shows;
|
||||
ALTER TABLE show_sections_v4 RENAME TO show_sections;
|
||||
ALTER TABLE piece_usages_v4 RENAME TO piece_usages;
|
||||
|
||||
CREATE INDEX idx_shows_status_start ON shows(status, starts_at_utc);
|
||||
CREATE INDEX idx_sections_show ON show_sections(show_id, position);
|
||||
CREATE INDEX idx_usages_section ON piece_usages(show_section_id, position);
|
||||
CREATE UNIQUE INDEX idx_one_reserve_bank_per_show
|
||||
ON show_sections(show_id) WHERE is_reserve_bank = 1;
|
||||
|
||||
CREATE TABLE show_templates (
|
||||
id TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
description TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE TABLE show_template_sections (
|
||||
id TEXT PRIMARY KEY,
|
||||
template_id TEXT NOT NULL REFERENCES show_templates(id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
category_id TEXT REFERENCES section_categories(id) ON DELETE SET NULL,
|
||||
position INTEGER NOT NULL CHECK (position >= 0),
|
||||
explicit_duration_seconds INTEGER CHECK (
|
||||
explicit_duration_seconds IS NULL OR
|
||||
(explicit_duration_seconds >= 0 AND explicit_duration_seconds <= 86400)
|
||||
),
|
||||
UNIQUE (template_id, position)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_show_template_sections_template
|
||||
ON show_template_sections(template_id, position);
|
||||
|
||||
INSERT INTO show_templates (id, name, description) VALUES
|
||||
('template-default', 'Standardablauf', 'Start, zwei JC-Blöcke und zwei Spiele.'),
|
||||
('template-games', 'Spieleabend', 'Ein ruhiger Einstieg und drei flexible Spieleblöcke.');
|
||||
|
||||
INSERT INTO show_template_sections (
|
||||
id, template_id, name, category_id, position, explicit_duration_seconds
|
||||
) VALUES
|
||||
('template-default-start', 'template-default', 'Start', NULL, 0, 300),
|
||||
('template-default-jc-reaction', 'template-default', 'JC / Reaction', NULL, 1, NULL),
|
||||
('template-default-game-1', 'template-default', 'Spiel 1', NULL, 2, 3600),
|
||||
('template-default-jc', 'template-default', 'JC', NULL, 3, NULL),
|
||||
('template-default-game-2', 'template-default', 'Spiel 2', NULL, 4, 3600),
|
||||
('template-games-start', 'template-games', 'Start', NULL, 0, 300),
|
||||
('template-games-game-1', 'template-games', 'Spiel 1', NULL, 1, 2700),
|
||||
('template-games-break', 'template-games', 'Pause & Chat', NULL, 2, 600),
|
||||
('template-games-game-2', 'template-games', 'Spiel 2', NULL, 3, 2700),
|
||||
('template-games-game-3', 'template-games', 'Spiel 3', NULL, 4, 2700);
|
||||
@@ -0,0 +1,45 @@
|
||||
CREATE TABLE show_live_states (
|
||||
show_id TEXT PRIMARY KEY REFERENCES shows(id) ON DELETE CASCADE,
|
||||
revision INTEGER NOT NULL DEFAULT 0 CHECK (revision >= 0),
|
||||
current_usage_id TEXT REFERENCES piece_usages(id) ON DELETE SET NULL,
|
||||
started_at_utc TEXT,
|
||||
ended_at_utc TEXT,
|
||||
presentation_usage_id TEXT REFERENCES piece_usages(id) ON DELETE SET NULL,
|
||||
presentation_revision INTEGER NOT NULL DEFAULT 0 CHECK (presentation_revision >= 0),
|
||||
updated_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE live_usage_runs (
|
||||
id TEXT PRIMARY KEY,
|
||||
show_id TEXT NOT NULL REFERENCES shows(id) ON DELETE CASCADE,
|
||||
usage_id TEXT NOT NULL REFERENCES piece_usages(id) ON DELETE CASCADE,
|
||||
started_at_utc TEXT NOT NULL,
|
||||
ended_at_utc TEXT,
|
||||
CHECK (ended_at_utc IS NULL OR ended_at_utc >= started_at_utc)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX idx_one_active_live_run_per_show
|
||||
ON live_usage_runs(show_id) WHERE ended_at_utc IS NULL;
|
||||
CREATE INDEX idx_live_runs_usage ON live_usage_runs(usage_id, started_at_utc);
|
||||
|
||||
CREATE TABLE live_commands (
|
||||
show_id TEXT NOT NULL REFERENCES shows(id) ON DELETE CASCADE,
|
||||
command_id TEXT NOT NULL,
|
||||
action TEXT NOT NULL,
|
||||
result_revision INTEGER NOT NULL CHECK (result_revision >= 0),
|
||||
created_at_utc TEXT NOT NULL,
|
||||
PRIMARY KEY (show_id, command_id)
|
||||
);
|
||||
|
||||
CREATE TABLE presentation_access_tokens (
|
||||
id TEXT PRIMARY KEY,
|
||||
show_id TEXT NOT NULL REFERENCES shows(id) ON DELETE CASCADE,
|
||||
token_hash TEXT NOT NULL UNIQUE,
|
||||
created_at_utc TEXT NOT NULL,
|
||||
revoked_at_utc TEXT
|
||||
);
|
||||
|
||||
CREATE INDEX idx_presentation_tokens_show
|
||||
ON presentation_access_tokens(show_id, revoked_at_utc);
|
||||
|
||||
UPDATE piece_usages SET status = 'open' WHERE status = 'current';
|
||||
@@ -0,0 +1,28 @@
|
||||
ALTER TABLE pieces ADD COLUMN presentation_mode TEXT NOT NULL DEFAULT 'text'
|
||||
CHECK (presentation_mode IN ('text', 'link', 'video'));
|
||||
ALTER TABLE pieces ADD COLUMN presentation_source_position INTEGER;
|
||||
ALTER TABLE pieces ADD COLUMN presentation_title TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE pieces ADD COLUMN presentation_description TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE pieces ADD COLUMN presentation_image_url TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE pieces ADD COLUMN presentation_site_name TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE pieces ADD COLUMN presentation_provider TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE pieces ADD COLUMN presentation_provider_id TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE pieces ADD COLUMN presentation_title_manual INTEGER NOT NULL DEFAULT 0
|
||||
CHECK (presentation_title_manual IN (0, 1));
|
||||
ALTER TABLE pieces ADD COLUMN presentation_description_manual INTEGER NOT NULL DEFAULT 0
|
||||
CHECK (presentation_description_manual IN (0, 1));
|
||||
ALTER TABLE pieces ADD COLUMN presentation_image_manual INTEGER NOT NULL DEFAULT 0
|
||||
CHECK (presentation_image_manual IN (0, 1));
|
||||
ALTER TABLE pieces ADD COLUMN presentation_metadata_fetched_at_utc TEXT;
|
||||
|
||||
ALTER TABLE piece_usages ADD COLUMN presentation_mode_snapshot TEXT NOT NULL DEFAULT 'text'
|
||||
CHECK (presentation_mode_snapshot IN ('text', 'link', 'video'));
|
||||
ALTER TABLE piece_usages ADD COLUMN presentation_source_label_snapshot TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE piece_usages ADD COLUMN presentation_source_url_snapshot TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE piece_usages ADD COLUMN presentation_source_timecode_snapshot INTEGER;
|
||||
ALTER TABLE piece_usages ADD COLUMN presentation_title_meta_snapshot TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE piece_usages ADD COLUMN presentation_description_snapshot TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE piece_usages ADD COLUMN presentation_image_url_snapshot TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE piece_usages ADD COLUMN presentation_site_name_snapshot TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE piece_usages ADD COLUMN presentation_provider_snapshot TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE piece_usages ADD COLUMN presentation_provider_id_snapshot TEXT NOT NULL DEFAULT '';
|
||||
@@ -0,0 +1,58 @@
|
||||
ALTER TABLE pieces ADD COLUMN output_title TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE piece_usages ADD COLUMN output_title_snapshot TEXT NOT NULL DEFAULT '';
|
||||
|
||||
CREATE TABLE piece_templates (
|
||||
id TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
description TEXT NOT NULL DEFAULT '',
|
||||
snapshot_json TEXT NOT NULL CHECK (json_valid(snapshot_json)),
|
||||
revision INTEGER NOT NULL DEFAULT 1 CHECK (revision >= 1),
|
||||
created_at_utc TEXT NOT NULL,
|
||||
updated_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO piece_templates (
|
||||
id, name, description, snapshot_json, revision, created_at_utc, updated_at_utc
|
||||
) VALUES
|
||||
(
|
||||
'talk', 'Gespräch',
|
||||
'Leitfragen, Recherche und eine klare Überleitung.',
|
||||
'{"title":"Unbenanntes Gespräch","formatId":"format-talk","moderationNotes":"## Leitfragen\n\n- ","categoryIds":["cat-jc"]}',
|
||||
1, '2026-10-23T00:00:00.000Z', '2026-10-23T00:00:00.000Z'
|
||||
),
|
||||
(
|
||||
'find', 'Reaction / Fundstück',
|
||||
'Quelle, Einordnung und präsentierbare Kernaussage.',
|
||||
'{"title":"Neues Fundstück","formatId":"format-find","presentationText":"## Kernaussage\n\n","categoryIds":["cat-reaction"]}',
|
||||
1, '2026-10-23T00:00:00.000Z', '2026-10-23T00:00:00.000Z'
|
||||
),
|
||||
(
|
||||
'interaction', 'Interaktion',
|
||||
'Quiz, Publikumsfrage oder kleines Spiel.',
|
||||
'{"title":"Neue Interaktion","formatId":"format-quiz","moderationNotes":"## Ablauf\n\n1. ","categoryIds":["cat-game"]}',
|
||||
1, '2026-10-23T00:00:00.000Z', '2026-10-23T00:00:00.000Z'
|
||||
);
|
||||
|
||||
CREATE TABLE planning_commands (
|
||||
show_id TEXT NOT NULL REFERENCES shows(id) ON DELETE CASCADE,
|
||||
command_id TEXT NOT NULL,
|
||||
piece_id TEXT NOT NULL REFERENCES pieces(id) ON DELETE CASCADE,
|
||||
usage_id TEXT NOT NULL REFERENCES piece_usages(id) ON DELETE CASCADE,
|
||||
result_revision INTEGER NOT NULL CHECK (result_revision >= 1),
|
||||
created_at_utc TEXT NOT NULL,
|
||||
PRIMARY KEY (show_id, command_id)
|
||||
);
|
||||
|
||||
CREATE TABLE presentation_channels (
|
||||
id TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
access_key TEXT NOT NULL,
|
||||
key_hash TEXT NOT NULL UNIQUE,
|
||||
show_id TEXT REFERENCES shows(id) ON DELETE SET NULL,
|
||||
revision INTEGER NOT NULL DEFAULT 0 CHECK (revision >= 0),
|
||||
created_at_utc TEXT NOT NULL,
|
||||
updated_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
UPDATE presentation_access_tokens
|
||||
SET revoked_at_utc = COALESCE(revoked_at_utc, '2026-10-23T00:00:00.000Z');
|
||||
@@ -0,0 +1,18 @@
|
||||
CREATE TABLE planning_commands_durable (
|
||||
show_id TEXT NOT NULL REFERENCES shows(id) ON DELETE CASCADE,
|
||||
command_id TEXT NOT NULL,
|
||||
piece_id TEXT NOT NULL,
|
||||
usage_id TEXT NOT NULL,
|
||||
result_revision INTEGER NOT NULL CHECK (result_revision >= 1),
|
||||
created_at_utc TEXT NOT NULL,
|
||||
PRIMARY KEY (show_id, command_id)
|
||||
);
|
||||
|
||||
INSERT INTO planning_commands_durable (
|
||||
show_id, command_id, piece_id, usage_id, result_revision, created_at_utc
|
||||
)
|
||||
SELECT show_id, command_id, piece_id, usage_id, result_revision, created_at_utc
|
||||
FROM planning_commands;
|
||||
|
||||
DROP TABLE planning_commands;
|
||||
ALTER TABLE planning_commands_durable RENAME TO planning_commands;
|
||||
@@ -0,0 +1,102 @@
|
||||
ALTER TABLE pieces ADD COLUMN is_favorite INTEGER NOT NULL DEFAULT 0
|
||||
CHECK (is_favorite IN (0, 1));
|
||||
|
||||
CREATE TABLE tools (
|
||||
id TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
start_url TEXT NOT NULL DEFAULT '',
|
||||
description TEXT NOT NULL DEFAULT '',
|
||||
is_active INTEGER NOT NULL DEFAULT 1 CHECK (is_active IN (0, 1)),
|
||||
created_at_utc TEXT NOT NULL,
|
||||
updated_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE tool_formats (
|
||||
tool_id TEXT NOT NULL REFERENCES tools(id) ON DELETE CASCADE,
|
||||
format_id TEXT NOT NULL REFERENCES formats(id) ON DELETE CASCADE,
|
||||
PRIMARY KEY (tool_id, format_id)
|
||||
);
|
||||
|
||||
CREATE TABLE piece_tools (
|
||||
id TEXT PRIMARY KEY,
|
||||
piece_id TEXT NOT NULL REFERENCES pieces(id) ON DELETE CASCADE,
|
||||
tool_id TEXT NOT NULL REFERENCES tools(id) ON DELETE RESTRICT,
|
||||
work_url TEXT NOT NULL DEFAULT '',
|
||||
note TEXT NOT NULL DEFAULT '',
|
||||
position INTEGER NOT NULL CHECK (position >= 0),
|
||||
UNIQUE (piece_id, tool_id),
|
||||
UNIQUE (piece_id, position)
|
||||
);
|
||||
|
||||
CREATE TABLE usage_source_snapshots (
|
||||
id TEXT PRIMARY KEY,
|
||||
usage_id TEXT NOT NULL REFERENCES piece_usages(id) ON DELETE CASCADE,
|
||||
label TEXT NOT NULL,
|
||||
url TEXT NOT NULL,
|
||||
timecode_seconds INTEGER CHECK (timecode_seconds IS NULL OR timecode_seconds >= 0),
|
||||
position INTEGER NOT NULL CHECK (position >= 0),
|
||||
UNIQUE (usage_id, position)
|
||||
);
|
||||
|
||||
CREATE TABLE usage_tool_snapshots (
|
||||
id TEXT PRIMARY KEY,
|
||||
usage_id TEXT NOT NULL REFERENCES piece_usages(id) ON DELETE CASCADE,
|
||||
original_tool_id TEXT REFERENCES tools(id) ON DELETE SET NULL,
|
||||
name TEXT NOT NULL,
|
||||
start_url TEXT NOT NULL DEFAULT '',
|
||||
work_url TEXT NOT NULL DEFAULT '',
|
||||
note TEXT NOT NULL DEFAULT '',
|
||||
position INTEGER NOT NULL CHECK (position >= 0),
|
||||
UNIQUE (usage_id, position)
|
||||
);
|
||||
|
||||
CREATE TABLE usage_topic_snapshots (
|
||||
usage_id TEXT NOT NULL REFERENCES piece_usages(id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
position INTEGER NOT NULL CHECK (position >= 0),
|
||||
PRIMARY KEY (usage_id, position)
|
||||
);
|
||||
|
||||
CREATE TABLE live_section_timers (
|
||||
id TEXT PRIMARY KEY,
|
||||
show_id TEXT NOT NULL REFERENCES shows(id) ON DELETE CASCADE,
|
||||
section_id TEXT NOT NULL REFERENCES show_sections(id) ON DELETE CASCADE,
|
||||
planned_duration_seconds INTEGER NOT NULL CHECK (planned_duration_seconds > 0),
|
||||
started_at_utc TEXT NOT NULL,
|
||||
ended_at_utc TEXT,
|
||||
CHECK (ended_at_utc IS NULL OR ended_at_utc >= started_at_utc)
|
||||
);
|
||||
|
||||
CREATE TABLE live_section_timer_runs (
|
||||
id TEXT PRIMARY KEY,
|
||||
timer_id TEXT NOT NULL REFERENCES live_section_timers(id) ON DELETE CASCADE,
|
||||
started_at_utc TEXT NOT NULL,
|
||||
ended_at_utc TEXT,
|
||||
CHECK (ended_at_utc IS NULL OR ended_at_utc >= started_at_utc)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_piece_tools_piece ON piece_tools(piece_id, position);
|
||||
CREATE INDEX idx_tool_formats_format ON tool_formats(format_id, tool_id);
|
||||
CREATE INDEX idx_usage_sources_usage ON usage_source_snapshots(usage_id, position);
|
||||
CREATE INDEX idx_usage_tools_usage ON usage_tool_snapshots(usage_id, position);
|
||||
CREATE UNIQUE INDEX idx_one_open_section_timer_per_show
|
||||
ON live_section_timers(show_id) WHERE ended_at_utc IS NULL;
|
||||
CREATE UNIQUE INDEX idx_one_open_run_per_section_timer
|
||||
ON live_section_timer_runs(timer_id) WHERE ended_at_utc IS NULL;
|
||||
|
||||
INSERT INTO usage_source_snapshots (
|
||||
id, usage_id, label, url, timecode_seconds, position
|
||||
)
|
||||
SELECT lower(hex(randomblob(16))), u.id, ps.label, ps.url, ps.timecode_seconds, ps.position
|
||||
FROM piece_usages u
|
||||
JOIN piece_sources ps ON ps.piece_id = u.original_piece_id;
|
||||
|
||||
INSERT INTO usage_topic_snapshots (usage_id, name, position)
|
||||
SELECT usage_id, name, position
|
||||
FROM (
|
||||
SELECT u.id AS usage_id, t.name,
|
||||
row_number() OVER (PARTITION BY u.id ORDER BY t.name, t.id) - 1 AS position
|
||||
FROM piece_usages u
|
||||
JOIN piece_topics pt ON pt.piece_id = u.original_piece_id
|
||||
JOIN topics t ON t.id = pt.topic_id
|
||||
);
|
||||
@@ -0,0 +1,49 @@
|
||||
ALTER TABLE topics ADD COLUMN icon_name TEXT NOT NULL DEFAULT '';
|
||||
|
||||
ALTER TABLE pieces ADD COLUMN deleted_at_utc TEXT;
|
||||
|
||||
ALTER TABLE piece_media ADD COLUMN removed_at_utc TEXT;
|
||||
|
||||
CREATE TABLE piece_presentation_media (
|
||||
piece_id TEXT PRIMARY KEY REFERENCES pieces(id) ON DELETE CASCADE,
|
||||
media_id TEXT NOT NULL UNIQUE REFERENCES piece_media(id) ON DELETE RESTRICT
|
||||
);
|
||||
|
||||
CREATE TRIGGER validate_piece_presentation_media_insert
|
||||
BEFORE INSERT ON piece_presentation_media
|
||||
WHEN NOT EXISTS (
|
||||
SELECT 1 FROM piece_media
|
||||
WHERE id = NEW.media_id AND piece_id = NEW.piece_id AND removed_at_utc IS NULL
|
||||
)
|
||||
BEGIN
|
||||
SELECT RAISE(ABORT, 'presentation media does not belong to piece');
|
||||
END;
|
||||
|
||||
CREATE TRIGGER validate_piece_presentation_media_update
|
||||
BEFORE UPDATE ON piece_presentation_media
|
||||
WHEN NOT EXISTS (
|
||||
SELECT 1 FROM piece_media
|
||||
WHERE id = NEW.media_id AND piece_id = NEW.piece_id AND removed_at_utc IS NULL
|
||||
)
|
||||
BEGIN
|
||||
SELECT RAISE(ABORT, 'presentation media does not belong to piece');
|
||||
END;
|
||||
|
||||
ALTER TABLE usage_topic_snapshots ADD COLUMN icon_name TEXT NOT NULL DEFAULT '';
|
||||
|
||||
CREATE TABLE usage_media_snapshots (
|
||||
id TEXT PRIMARY KEY,
|
||||
usage_id TEXT NOT NULL REFERENCES piece_usages(id) ON DELETE CASCADE,
|
||||
original_media_id TEXT NOT NULL REFERENCES piece_media(id) ON DELETE RESTRICT,
|
||||
alt_text TEXT NOT NULL DEFAULT '',
|
||||
position INTEGER NOT NULL CHECK (position >= 0),
|
||||
is_presentation INTEGER NOT NULL DEFAULT 0 CHECK (is_presentation IN (0, 1)),
|
||||
UNIQUE (usage_id, position)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_pieces_deleted_at ON pieces(deleted_at_utc);
|
||||
CREATE INDEX idx_piece_media_active ON piece_media(piece_id, position)
|
||||
WHERE removed_at_utc IS NULL;
|
||||
CREATE INDEX idx_usage_media_usage ON usage_media_snapshots(usage_id, position);
|
||||
CREATE UNIQUE INDEX idx_one_presentation_media_per_usage
|
||||
ON usage_media_snapshots(usage_id) WHERE is_presentation = 1;
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE tools ADD COLUMN icon_name TEXT NOT NULL DEFAULT 'wrench';
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE users
|
||||
ADD COLUMN show_overview_view TEXT NOT NULL DEFAULT 'list'
|
||||
CHECK (show_overview_view IN ('list', 'calendar'));
|
||||
@@ -0,0 +1,21 @@
|
||||
ALTER TABLE pieces ADD COLUMN interaction_text TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE piece_usages ADD COLUMN interaction_snapshot TEXT NOT NULL DEFAULT '';
|
||||
|
||||
CREATE TABLE live_show_timer_runs (
|
||||
id TEXT PRIMARY KEY,
|
||||
show_id TEXT NOT NULL REFERENCES shows(id) ON DELETE CASCADE,
|
||||
started_at_utc TEXT NOT NULL,
|
||||
ended_at_utc TEXT,
|
||||
CHECK (ended_at_utc IS NULL OR ended_at_utc >= started_at_utc)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX idx_one_open_show_timer_run
|
||||
ON live_show_timer_runs(show_id)
|
||||
WHERE ended_at_utc IS NULL;
|
||||
|
||||
CREATE INDEX idx_live_show_timer_runs_show
|
||||
ON live_show_timer_runs(show_id, started_at_utc);
|
||||
|
||||
INSERT INTO live_show_timer_runs (id, show_id, started_at_utc, ended_at_utc)
|
||||
SELECT 'migrated-' || id, show_id, started_at_utc, ended_at_utc
|
||||
FROM live_usage_runs;
|
||||
@@ -0,0 +1,18 @@
|
||||
CREATE TABLE IF NOT EXISTS live_show_timer_runs (
|
||||
id TEXT PRIMARY KEY,
|
||||
show_id TEXT NOT NULL REFERENCES shows(id) ON DELETE CASCADE,
|
||||
started_at_utc TEXT NOT NULL,
|
||||
ended_at_utc TEXT,
|
||||
CHECK (ended_at_utc IS NULL OR ended_at_utc >= started_at_utc)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_one_open_show_timer_run
|
||||
ON live_show_timer_runs(show_id)
|
||||
WHERE ended_at_utc IS NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_live_show_timer_runs_show
|
||||
ON live_show_timer_runs(show_id, started_at_utc);
|
||||
|
||||
INSERT OR IGNORE INTO live_show_timer_runs (id, show_id, started_at_utc, ended_at_utc)
|
||||
SELECT 'migrated-' || id, show_id, started_at_utc, ended_at_utc
|
||||
FROM live_usage_runs;
|
||||
@@ -0,0 +1,115 @@
|
||||
ALTER TABLE shows ADD COLUMN completed_at_utc TEXT;
|
||||
|
||||
ALTER TABLE show_sections ADD COLUMN category_name_snapshot TEXT;
|
||||
ALTER TABLE show_sections ADD COLUMN category_color_snapshot TEXT;
|
||||
|
||||
CREATE TABLE show_finalizations (
|
||||
show_id TEXT PRIMARY KEY REFERENCES shows(id) ON DELETE CASCADE,
|
||||
command_id TEXT NOT NULL,
|
||||
source_revision INTEGER NOT NULL CHECK (source_revision >= 1),
|
||||
finalized_by_user_id TEXT REFERENCES users(id) ON DELETE SET NULL,
|
||||
finalized_at_utc TEXT NOT NULL,
|
||||
UNIQUE (show_id, command_id)
|
||||
);
|
||||
|
||||
CREATE TABLE show_finalization_archived_pieces (
|
||||
show_id TEXT NOT NULL REFERENCES show_finalizations(show_id) ON DELETE CASCADE,
|
||||
piece_id TEXT NOT NULL REFERENCES pieces(id) ON DELETE RESTRICT,
|
||||
PRIMARY KEY (show_id, piece_id)
|
||||
);
|
||||
|
||||
CREATE TABLE piece_usage_history (
|
||||
usage_id TEXT PRIMARY KEY REFERENCES piece_usages(id) ON DELETE RESTRICT,
|
||||
show_id TEXT NOT NULL REFERENCES shows(id) ON DELETE RESTRICT,
|
||||
original_piece_id TEXT NOT NULL REFERENCES pieces(id) ON DELETE RESTRICT,
|
||||
show_title_snapshot TEXT NOT NULL,
|
||||
usage_title_snapshot TEXT NOT NULL,
|
||||
used_at_utc TEXT NOT NULL,
|
||||
actual_duration_seconds INTEGER NOT NULL CHECK (actual_duration_seconds >= 0)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_piece_usage_history_original
|
||||
ON piece_usage_history(original_piece_id, used_at_utc DESC);
|
||||
|
||||
CREATE TABLE show_duplication_commands (
|
||||
source_show_id TEXT NOT NULL REFERENCES show_finalizations(show_id) ON DELETE CASCADE,
|
||||
command_id TEXT NOT NULL,
|
||||
created_show_id TEXT NOT NULL REFERENCES shows(id) ON DELETE CASCADE,
|
||||
created_at_utc TEXT NOT NULL,
|
||||
PRIMARY KEY (source_show_id, command_id)
|
||||
);
|
||||
|
||||
CREATE TABLE show_shares (
|
||||
id TEXT PRIMARY KEY,
|
||||
show_id TEXT NOT NULL REFERENCES show_finalizations(show_id) ON DELETE CASCADE,
|
||||
token_hash TEXT NOT NULL UNIQUE,
|
||||
scope TEXT NOT NULL CHECK (scope IN ('rundown', 'moderation', 'research')),
|
||||
password_hash TEXT,
|
||||
expires_at_utc TEXT,
|
||||
revoked_at_utc TEXT,
|
||||
created_by_user_id TEXT NOT NULL REFERENCES users(id) ON DELETE RESTRICT,
|
||||
created_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX idx_show_shares_show ON show_shares(show_id, created_at_utc DESC);
|
||||
|
||||
CREATE TABLE show_share_sessions (
|
||||
token_hash TEXT PRIMARY KEY,
|
||||
share_id TEXT NOT NULL REFERENCES show_shares(id) ON DELETE CASCADE,
|
||||
created_at_utc TEXT NOT NULL,
|
||||
expires_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX idx_show_share_sessions_share ON show_share_sessions(share_id, expires_at_utc);
|
||||
|
||||
CREATE TABLE share_password_attempts (
|
||||
id TEXT PRIMARY KEY,
|
||||
share_key TEXT NOT NULL,
|
||||
address_key TEXT NOT NULL,
|
||||
attempted_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX idx_share_password_attempts_share
|
||||
ON share_password_attempts(share_key, attempted_at_utc);
|
||||
CREATE INDEX idx_share_password_attempts_address
|
||||
ON share_password_attempts(address_key, attempted_at_utc);
|
||||
|
||||
UPDATE show_sections
|
||||
SET category_name_snapshot = (
|
||||
SELECT name FROM section_categories WHERE id = show_sections.category_id
|
||||
),
|
||||
category_color_snapshot = (
|
||||
SELECT color FROM section_categories WHERE id = show_sections.category_id
|
||||
)
|
||||
WHERE show_id IN (SELECT id FROM shows WHERE status = 'completed');
|
||||
|
||||
UPDATE shows
|
||||
SET completed_at_utc = COALESCE(
|
||||
(SELECT ended_at_utc FROM show_live_states WHERE show_id = shows.id),
|
||||
updated_at_utc
|
||||
)
|
||||
WHERE status = 'completed';
|
||||
|
||||
INSERT INTO show_finalizations (
|
||||
show_id, command_id, source_revision, finalized_by_user_id, finalized_at_utc
|
||||
)
|
||||
SELECT id, 'migration-' || id, revision, NULL, completed_at_utc
|
||||
FROM shows
|
||||
WHERE status = 'completed';
|
||||
|
||||
INSERT INTO piece_usage_history (
|
||||
usage_id, show_id, original_piece_id, show_title_snapshot, usage_title_snapshot,
|
||||
used_at_utc, actual_duration_seconds
|
||||
)
|
||||
SELECT u.id, sh.id, u.original_piece_id, sh.title, u.title_snapshot,
|
||||
COALESCE(sh.starts_at_utc, sh.completed_at_utc),
|
||||
COALESCE((
|
||||
SELECT sum(max(0, CAST((julianday(COALESCE(r.ended_at_utc, sh.completed_at_utc)) -
|
||||
julianday(r.started_at_utc)) * 86400 AS INTEGER)))
|
||||
FROM live_usage_runs r WHERE r.usage_id = u.id
|
||||
), 0)
|
||||
FROM piece_usages u
|
||||
JOIN show_sections s ON s.id = u.show_section_id
|
||||
JOIN shows sh ON sh.id = s.show_id
|
||||
WHERE sh.status = 'completed' AND s.is_reserve_bank = 0
|
||||
AND u.status = 'done' AND u.original_piece_id IS NOT NULL;
|
||||
@@ -0,0 +1,43 @@
|
||||
DROP INDEX idx_show_share_sessions_share;
|
||||
DROP INDEX idx_show_shares_show;
|
||||
|
||||
ALTER TABLE show_share_sessions RENAME TO show_share_sessions_v15;
|
||||
ALTER TABLE show_shares RENAME TO show_shares_v15;
|
||||
|
||||
CREATE TABLE show_shares (
|
||||
id TEXT PRIMARY KEY,
|
||||
show_id TEXT NOT NULL REFERENCES shows(id) ON DELETE CASCADE,
|
||||
token_hash TEXT NOT NULL UNIQUE,
|
||||
scope TEXT NOT NULL CHECK (scope IN ('rundown', 'moderation', 'research')),
|
||||
password_hash TEXT,
|
||||
expires_at_utc TEXT,
|
||||
revoked_at_utc TEXT,
|
||||
created_by_user_id TEXT NOT NULL REFERENCES users(id) ON DELETE RESTRICT,
|
||||
created_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX idx_show_shares_show ON show_shares(show_id, created_at_utc DESC);
|
||||
|
||||
CREATE TABLE show_share_sessions (
|
||||
token_hash TEXT PRIMARY KEY,
|
||||
share_id TEXT NOT NULL REFERENCES show_shares(id) ON DELETE CASCADE,
|
||||
created_at_utc TEXT NOT NULL,
|
||||
expires_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX idx_show_share_sessions_share ON show_share_sessions(share_id, expires_at_utc);
|
||||
|
||||
INSERT INTO show_shares (
|
||||
id, show_id, token_hash, scope, password_hash, expires_at_utc, revoked_at_utc,
|
||||
created_by_user_id, created_at_utc
|
||||
)
|
||||
SELECT id, show_id, token_hash, scope, password_hash, expires_at_utc, revoked_at_utc,
|
||||
created_by_user_id, created_at_utc
|
||||
FROM show_shares_v15;
|
||||
|
||||
INSERT INTO show_share_sessions (token_hash, share_id, created_at_utc, expires_at_utc)
|
||||
SELECT token_hash, share_id, created_at_utc, expires_at_utc
|
||||
FROM show_share_sessions_v15;
|
||||
|
||||
DROP TABLE show_share_sessions_v15;
|
||||
DROP TABLE show_shares_v15;
|
||||
@@ -0,0 +1,10 @@
|
||||
ALTER TABLE pieces ADD COLUMN preparation_effort TEXT CHECK (
|
||||
preparation_effort IS NULL OR preparation_effort IN ('low', 'medium', 'high')
|
||||
);
|
||||
ALTER TABLE pieces ADD COLUMN presentation_image_only INTEGER NOT NULL DEFAULT 0
|
||||
CHECK (presentation_image_only IN (0, 1));
|
||||
ALTER TABLE piece_usages ADD COLUMN presentation_image_only_snapshot INTEGER NOT NULL DEFAULT 0
|
||||
CHECK (presentation_image_only_snapshot IN (0, 1));
|
||||
|
||||
ALTER TABLE show_sections ADD COLUMN twitch_tags TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE show_template_sections ADD COLUMN twitch_tags TEXT NOT NULL DEFAULT '';
|
||||
@@ -0,0 +1,66 @@
|
||||
CREATE TABLE feed_sources (
|
||||
id TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
url TEXT NOT NULL UNIQUE,
|
||||
is_enabled INTEGER NOT NULL DEFAULT 1 CHECK (is_enabled IN (0, 1)),
|
||||
refresh_interval_minutes INTEGER NOT NULL DEFAULT 60 CHECK (refresh_interval_minutes BETWEEN 15 AND 10080),
|
||||
default_category_id TEXT REFERENCES section_categories(id) ON DELETE SET NULL,
|
||||
etag TEXT NOT NULL DEFAULT '',
|
||||
last_modified TEXT NOT NULL DEFAULT '',
|
||||
last_fetched_at_utc TEXT,
|
||||
next_fetch_at_utc TEXT,
|
||||
last_error TEXT NOT NULL DEFAULT '',
|
||||
created_at_utc TEXT NOT NULL,
|
||||
updated_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE feed_entries (
|
||||
id TEXT PRIMARY KEY,
|
||||
feed_id TEXT NOT NULL REFERENCES feed_sources(id) ON DELETE CASCADE,
|
||||
external_id TEXT NOT NULL,
|
||||
title TEXT NOT NULL,
|
||||
url TEXT NOT NULL,
|
||||
summary TEXT NOT NULL DEFAULT '',
|
||||
published_at_utc TEXT,
|
||||
status TEXT NOT NULL DEFAULT 'new' CHECK (status IN ('new', 'imported', 'discarded')),
|
||||
piece_id TEXT REFERENCES pieces(id) ON DELETE SET NULL,
|
||||
first_seen_at_utc TEXT NOT NULL,
|
||||
updated_at_utc TEXT NOT NULL,
|
||||
UNIQUE (feed_id, external_id)
|
||||
);
|
||||
|
||||
CREATE INDEX feed_entries_status_idx ON feed_entries(status, first_seen_at_utc DESC);
|
||||
CREATE INDEX feed_sources_due_idx ON feed_sources(is_enabled, next_fetch_at_utc);
|
||||
|
||||
CREATE TABLE technical_accesses (
|
||||
id TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
token_hash TEXT NOT NULL UNIQUE,
|
||||
permissions TEXT NOT NULL CHECK (permissions IN ('read', 'read_write')),
|
||||
created_by_user_id TEXT NOT NULL REFERENCES users(id),
|
||||
created_at_utc TEXT NOT NULL,
|
||||
last_used_at_utc TEXT,
|
||||
revoked_at_utc TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE api_idempotency (
|
||||
access_id TEXT NOT NULL REFERENCES technical_accesses(id) ON DELETE CASCADE,
|
||||
request_key TEXT NOT NULL,
|
||||
request_hash TEXT NOT NULL,
|
||||
status_code INTEGER NOT NULL,
|
||||
response_json TEXT NOT NULL CHECK (json_valid(response_json)),
|
||||
created_at_utc TEXT NOT NULL,
|
||||
PRIMARY KEY (access_id, request_key)
|
||||
);
|
||||
|
||||
CREATE TABLE audit_events (
|
||||
id TEXT PRIMARY KEY,
|
||||
actor_type TEXT NOT NULL CHECK (actor_type IN ('user', 'technical')),
|
||||
actor_id TEXT NOT NULL,
|
||||
action TEXT NOT NULL,
|
||||
target_type TEXT NOT NULL,
|
||||
target_id TEXT NOT NULL,
|
||||
created_at_utc TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX audit_events_created_idx ON audit_events(created_at_utc DESC);
|
||||
@@ -0,0 +1,17 @@
|
||||
ALTER TABLE piece_usages ADD COLUMN preparation_status_snapshot TEXT NOT NULL DEFAULT 'ready'
|
||||
CHECK (preparation_status_snapshot IN ('preparing', 'ready'));
|
||||
|
||||
ALTER TABLE piece_usages ADD COLUMN preparation_effort_snapshot TEXT
|
||||
CHECK (preparation_effort_snapshot IS NULL OR preparation_effort_snapshot IN ('low', 'medium', 'high'));
|
||||
|
||||
UPDATE piece_usages
|
||||
SET preparation_status_snapshot = CASE
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM pieces p
|
||||
WHERE p.id = piece_usages.original_piece_id AND p.status = 'preparing'
|
||||
) THEN 'preparing'
|
||||
ELSE 'ready'
|
||||
END,
|
||||
preparation_effort_snapshot = (
|
||||
SELECT p.preparation_effort FROM pieces p WHERE p.id = piece_usages.original_piece_id
|
||||
);
|
||||
Generated
+2247
-15
File diff suppressed because it is too large.
Load diff
+17
-5
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "sendewerk",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"version": "0.7.2",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=22.17 <25"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"dev": "npm run db:migrate && node --env-file-if-exists=.env ./node_modules/vite/bin/vite.js dev",
|
||||
"build": "node --env-file-if-exists=.env ./node_modules/vite/bin/vite.js build",
|
||||
"preview": "node --env-file-if-exists=.env ./node_modules/vite/bin/vite.js preview",
|
||||
"start": "npm run db:migrate && node --env-file-if-exists=.env build",
|
||||
"setup": "npm run db:migrate && npm run db:seed",
|
||||
"db:migrate": "node --env-file-if-exists=.env scripts/migrate.mjs",
|
||||
@@ -24,7 +24,18 @@
|
||||
"test:e2e": "playwright test"
|
||||
},
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^13.0.3"
|
||||
"@node-rs/argon2": "^2.2.2",
|
||||
"better-sqlite3": "^13.0.3",
|
||||
"fast-xml-parser": "^5.11.2",
|
||||
"file-type": "^22.2.0",
|
||||
"marked": "^18.1.1",
|
||||
"metascraper": "^5.58.5",
|
||||
"metascraper-description": "^5.58.4",
|
||||
"metascraper-image": "^5.58.4",
|
||||
"metascraper-publisher": "^5.58.4",
|
||||
"metascraper-title": "^5.58.4",
|
||||
"nodemailer": "^10.1.7",
|
||||
"sanitize-html": "^2.18.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
@@ -34,6 +45,7 @@
|
||||
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
||||
"@types/better-sqlite3": "^7.6.13",
|
||||
"@types/node": "^22.18.13",
|
||||
"@types/sanitize-html": "^2.16.2",
|
||||
"eslint": "^10.4.1",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-svelte": "^3.19.0",
|
||||
|
||||
+10
-1
@@ -3,7 +3,11 @@ import { mkdtempSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
|
||||
const dataDirectory = mkdtempSync(path.join(tmpdir(), 'sendewerk-e2e-'));
|
||||
const dataDirectory =
|
||||
process.env.SENDEWERK_E2E_DATA_DIR || mkdtempSync(path.join(tmpdir(), 'sendewerk-e2e-'));
|
||||
const mailOutboxDirectory = path.join(dataDirectory, 'mail-outbox');
|
||||
process.env.SENDEWERK_E2E_DATA_DIR = dataDirectory;
|
||||
process.env.SENDEWERK_E2E_OUTBOX_DIR = mailOutboxDirectory;
|
||||
|
||||
export default defineConfig({
|
||||
testDir: 'tests',
|
||||
@@ -18,6 +22,11 @@ export default defineConfig({
|
||||
env: {
|
||||
SENDEWERK_DB_PATH: path.join(dataDirectory, 'e2e.sqlite'),
|
||||
SENDEWERK_UPLOAD_DIR: path.join(dataDirectory, 'uploads'),
|
||||
SENDEWERK_MAIL_OUTBOX_DIR: mailOutboxDirectory,
|
||||
SENDEWERK_MAIL_TRANSPORT: 'local',
|
||||
SENDEWERK_APP_ORIGIN: 'http://127.0.0.1:4173',
|
||||
SENDEWERK_SETUP_TOKEN: 'e2e-only-setup-token-32-characters',
|
||||
ORIGIN: 'http://127.0.0.1:4173',
|
||||
HOST: '127.0.0.1',
|
||||
PORT: '4173'
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import { copyFileSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const sourceRoot = process.argv[2];
|
||||
if (!sourceRoot) {
|
||||
throw new Error('Usage: node scripts/generate-classic-regular-icons.mjs <font-awesome-web-root>');
|
||||
}
|
||||
|
||||
const javascript = readFileSync(path.join(sourceRoot, 'js', 'regular.js'), 'utf8');
|
||||
const metadata = JSON.parse(readFileSync(path.join(sourceRoot, 'metadata', 'icons.json'), 'utf8'));
|
||||
const start = javascript.indexOf(' var icons = ') + ' var icons = '.length;
|
||||
const end = javascript.indexOf('\n };', start) + '\n }'.length;
|
||||
if (start < ' var icons = '.length || end < start)
|
||||
throw new Error('Classic Regular icons not found');
|
||||
|
||||
const definitions = JSON.parse(javascript.slice(start, end));
|
||||
const icons = Object.keys(definitions)
|
||||
.map((name) => {
|
||||
const details = metadata[name];
|
||||
return {
|
||||
name,
|
||||
label: details?.label ?? name.replaceAll('-', ' '),
|
||||
terms: details?.search?.terms ?? []
|
||||
};
|
||||
})
|
||||
.sort((left, right) => left.label.localeCompare(right.label, 'en'));
|
||||
|
||||
const output = `// Generated from Font Awesome Pro Plus 7.0.0 Classic Regular metadata.
|
||||
// Covered by the Font Awesome Pro commercial license; see THIRD_PARTY_NOTICES.md.
|
||||
export type ClassicRegularIcon = {
|
||||
\tname: string;
|
||||
\tlabel: string;
|
||||
\tterms: readonly string[];
|
||||
};
|
||||
|
||||
export const classicRegularIcons: readonly ClassicRegularIcon[] = ${JSON.stringify(icons)};
|
||||
|
||||
export type IconName = string;
|
||||
|
||||
export const classicRegularIconNames = new Set<string>(
|
||||
classicRegularIcons.map((icon) => icon.name)
|
||||
);
|
||||
`;
|
||||
|
||||
writeFileSync('src/lib/icons/classic-regular.ts', output);
|
||||
mkdirSync('static/icons', { recursive: true });
|
||||
copyFileSync(
|
||||
path.join(sourceRoot, 'sprites-full', 'regular.svg'),
|
||||
'static/icons/classic-regular.svg'
|
||||
);
|
||||
console.log(`Generated ${icons.length} Classic Regular icons.`);
|
||||
+183
-10
@@ -124,9 +124,49 @@ export function seed(databasePath = getPaths().database) {
|
||||
'Pixel als bewusste Entscheidung.',
|
||||
timestamp,
|
||||
timestamp
|
||||
],
|
||||
[
|
||||
'piece-inbox-link',
|
||||
'Indie-Showcase nachhören',
|
||||
'Ein Fundstück aus dem letzten Showcase, das noch eingeordnet werden muss.',
|
||||
'format-find',
|
||||
'inbox',
|
||||
0,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
timestamp,
|
||||
timestamp
|
||||
],
|
||||
[
|
||||
'piece-archive-demo',
|
||||
'Controller mit eingebautem Bildschirm',
|
||||
'Ein früheres Fundstück, das bewusst im Archiv liegt.',
|
||||
'format-find',
|
||||
'archived',
|
||||
300,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
timestamp,
|
||||
timestamp
|
||||
]
|
||||
]
|
||||
);
|
||||
database
|
||||
.prepare('UPDATE pieces SET research_text = ? WHERE id = ?')
|
||||
.run(
|
||||
'## Recherche\n\n- Herstellerangaben gegen unabhängige Tests prüfen\n- Fokus auf Bedienidee statt Leistungsdaten',
|
||||
'piece-console'
|
||||
);
|
||||
database
|
||||
.prepare('UPDATE pieces SET presentation_text = ? WHERE id = ?')
|
||||
.run(
|
||||
'## Weniger Leistung, mehr Idee\n\nDie Kurbel ist Teil des Spiels, nicht nur Dekoration.',
|
||||
'piece-console'
|
||||
);
|
||||
|
||||
database.prepare('DELETE FROM piece_topics WHERE piece_id LIKE ?').run('piece-%');
|
||||
const addTopic = database.prepare(
|
||||
@@ -137,7 +177,9 @@ export function seed(databasePath = getPaths().database) {
|
||||
['piece-effects', 'topic-film'],
|
||||
['piece-quiz', 'topic-gaming'],
|
||||
['piece-pixels', 'topic-gaming'],
|
||||
['piece-pixels', 'topic-internet']
|
||||
['piece-pixels', 'topic-internet'],
|
||||
['piece-inbox-link', 'topic-gaming'],
|
||||
['piece-archive-demo', 'topic-gaming']
|
||||
])
|
||||
addTopic.run(...values);
|
||||
|
||||
@@ -149,7 +191,9 @@ export function seed(databasePath = getPaths().database) {
|
||||
['piece-console', 'cat-jc'],
|
||||
['piece-effects', 'cat-reaction'],
|
||||
['piece-quiz', 'cat-jc'],
|
||||
['piece-pixels', 'cat-reaction']
|
||||
['piece-pixels', 'cat-reaction'],
|
||||
['piece-inbox-link', 'cat-reaction'],
|
||||
['piece-archive-demo', 'cat-reaction']
|
||||
])
|
||||
addCategory.run(...values);
|
||||
|
||||
@@ -173,7 +217,47 @@ export function seed(databasePath = getPaths().database) {
|
||||
95,
|
||||
0
|
||||
],
|
||||
['source-pixels', 'piece-pixels', 'Galerie', 'https://example.com/pixels', null, 0]
|
||||
['source-pixels', 'piece-pixels', 'Galerie', 'https://example.com/pixels', null, 0],
|
||||
[
|
||||
'source-inbox-showcase',
|
||||
'piece-inbox-link',
|
||||
'Showcase-Aufzeichnung',
|
||||
'https://example.com/showcase',
|
||||
120,
|
||||
0
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
replace(
|
||||
'show_templates',
|
||||
['id', 'name', 'description'],
|
||||
[
|
||||
['template-default', 'Standardablauf', 'Start, zwei JC-Blöcke und zwei Spiele.'],
|
||||
['template-games', 'Spieleabend', 'Ein ruhiger Einstieg und drei flexible Spieleblöcke.']
|
||||
]
|
||||
);
|
||||
replace(
|
||||
'show_template_sections',
|
||||
['id', 'template_id', 'name', 'category_id', 'position', 'explicit_duration_seconds'],
|
||||
[
|
||||
['template-default-start', 'template-default', 'Start', 'cat-jc', 0, 300],
|
||||
[
|
||||
'template-default-jc-reaction',
|
||||
'template-default',
|
||||
'JC / Reaction',
|
||||
'cat-reaction',
|
||||
1,
|
||||
null
|
||||
],
|
||||
['template-default-game-1', 'template-default', 'Spiel 1', 'cat-game', 2, 3600],
|
||||
['template-default-jc', 'template-default', 'JC', 'cat-jc', 3, null],
|
||||
['template-default-game-2', 'template-default', 'Spiel 2', 'cat-game', 4, 3600],
|
||||
['template-games-start', 'template-games', 'Start', 'cat-jc', 0, 300],
|
||||
['template-games-game-1', 'template-games', 'Spiel 1', 'cat-game', 1, 2700],
|
||||
['template-games-break', 'template-games', 'Pause & Chat', 'cat-jc', 2, 600],
|
||||
['template-games-game-2', 'template-games', 'Spiel 2', 'cat-game', 3, 2700],
|
||||
['template-games-game-3', 'template-games', 'Spiel 3', 'cat-game', 4, 2700]
|
||||
]
|
||||
);
|
||||
|
||||
@@ -186,6 +270,7 @@ export function seed(databasePath = getPaths().database) {
|
||||
'twitch_title',
|
||||
'announcement_text',
|
||||
'status',
|
||||
'revision',
|
||||
'created_at_utc',
|
||||
'updated_at_utc'
|
||||
],
|
||||
@@ -197,6 +282,18 @@ export function seed(databasePath = getPaths().database) {
|
||||
'Kleine Welten, große Ideen | heinzlive',
|
||||
'Heute schauen wir auf Hardware mit Kurbel, handgemachte Filmtricks und Pixel mit Haltung.',
|
||||
'ready',
|
||||
1,
|
||||
timestamp,
|
||||
timestamp
|
||||
],
|
||||
[
|
||||
'show-games-evening',
|
||||
'Spieleabend: Kurbeln & Pixel',
|
||||
'2026-10-16T18:00:00.000Z',
|
||||
'Kurbeln, Pixel und ein langer Spieleabend | heinzlive',
|
||||
'Heute spielen wir uns von ungewöhnlicher Hardware bis zu moderner Pixelart.',
|
||||
'draft',
|
||||
1,
|
||||
timestamp,
|
||||
timestamp
|
||||
]
|
||||
@@ -205,11 +302,25 @@ export function seed(databasePath = getPaths().database) {
|
||||
|
||||
replace(
|
||||
'show_sections',
|
||||
['id', 'show_id', 'name', 'category_id', 'position', 'explicit_duration_seconds'],
|
||||
[
|
||||
['section-start', 'show-october', 'Ankommen & Warmwerden', 'cat-jc', 0, 300],
|
||||
['section-stories', 'show-october', 'Kleine Welten', 'cat-reaction', 1, null],
|
||||
['section-game', 'show-october', 'Spiel 1', 'cat-game', 2, 3600]
|
||||
'id',
|
||||
'show_id',
|
||||
'name',
|
||||
'category_id',
|
||||
'position',
|
||||
'explicit_duration_seconds',
|
||||
'is_reserve_bank'
|
||||
],
|
||||
[
|
||||
['section-start', 'show-october', 'Ankommen & Warmwerden', 'cat-jc', 0, 300, 0],
|
||||
['section-stories', 'show-october', 'Kleine Welten', 'cat-reaction', 1, null, 0],
|
||||
['section-game', 'show-october', 'Spiel 1', 'cat-game', 2, 3600, 0],
|
||||
['reserve-bank-show-october', 'show-october', 'Reservebank', null, 3, null, 1],
|
||||
['games-start', 'show-games-evening', 'Start', 'cat-jc', 0, 300, 0],
|
||||
['games-first', 'show-games-evening', 'Spiel 1', 'cat-game', 1, 2700, 0],
|
||||
['games-chat', 'show-games-evening', 'Pause & Chat', 'cat-jc', 2, 600, 0],
|
||||
['games-second', 'show-games-evening', 'Spiel 2', 'cat-game', 3, 2700, 0],
|
||||
['reserve-bank-show-games-evening', 'show-games-evening', 'Reservebank', null, 4, null, 1]
|
||||
]
|
||||
);
|
||||
|
||||
@@ -224,9 +335,11 @@ export function seed(databasePath = getPaths().database) {
|
||||
'duration_seconds',
|
||||
'title_snapshot',
|
||||
'intro_snapshot',
|
||||
'research_snapshot',
|
||||
'moderation_snapshot',
|
||||
'transition_snapshot',
|
||||
'presentation_snapshot',
|
||||
'own_notes',
|
||||
'is_reserve'
|
||||
],
|
||||
[
|
||||
@@ -235,13 +348,15 @@ export function seed(databasePath = getPaths().database) {
|
||||
'section-stories',
|
||||
'piece-console',
|
||||
0,
|
||||
'current',
|
||||
'open',
|
||||
480,
|
||||
'Die kleine Konsole mit dem großen Dreh',
|
||||
'Eine Kurbel, ein gelber Knopf und sehr viel Charme: Was macht kleine Hardware spannend?',
|
||||
'## Recherche\n\n- Herstellerangaben gegen unabhängige Tests prüfen\n- Fokus auf Bedienidee statt Leistungsdaten',
|
||||
'Erst Formfaktor zeigen, dann über bewusst gesetzte Grenzen sprechen.',
|
||||
'Von der kleinen Konsole geht es zur ganz großen Leinwand.',
|
||||
'Weniger Leistung, mehr Idee.',
|
||||
'',
|
||||
0
|
||||
],
|
||||
[
|
||||
@@ -253,27 +368,85 @@ export function seed(databasePath = getPaths().database) {
|
||||
720,
|
||||
'Warum praktische Effekte wieder auffallen',
|
||||
'Man sieht manchmal gerade deshalb weniger Trick, weil wieder mehr vor der Kamera passiert.',
|
||||
'',
|
||||
'Beispiele vergleichen, nicht analog gegen digital ausspielen.',
|
||||
'Nach so viel Handarbeit wird es spielerisch.',
|
||||
'Wenn das Licht wirklich auf ein Modell fällt.',
|
||||
'',
|
||||
0
|
||||
],
|
||||
[
|
||||
'usage-reserve',
|
||||
'section-stories',
|
||||
'reserve-bank-show-october',
|
||||
'piece-pixels',
|
||||
2,
|
||||
0,
|
||||
'open',
|
||||
540,
|
||||
'Pixelart, die nicht nostalgisch sein will',
|
||||
'Pixel sind längst keine technische Notlösung mehr.',
|
||||
'',
|
||||
'Großaufnahmen vorbereiten, drei Stilmittel benennen.',
|
||||
'Genug Theorie, jetzt spielen wir selbst.',
|
||||
'Pixel als bewusste Entscheidung.',
|
||||
'Ersatz, falls ein Spiel technisch ausfällt.',
|
||||
1
|
||||
],
|
||||
[
|
||||
'usage-games-console',
|
||||
'games-first',
|
||||
'piece-console',
|
||||
0,
|
||||
'open',
|
||||
480,
|
||||
'Die kleine Konsole mit dem großen Dreh',
|
||||
'Wir beginnen mit Hardware, die ihr Spielprinzip gleich mitbringt.',
|
||||
'Kurbelmechanik und verfügbare Spiele prüfen.',
|
||||
'Konsole zeigen und Publikum nach Lieblingsmechaniken fragen.',
|
||||
'Danach wechseln wir von Mechanik zu Grafik.',
|
||||
'Eine Kurbel verändert, wie wir spielen.',
|
||||
'Controller vor Sendungsbeginn laden.',
|
||||
0
|
||||
],
|
||||
[
|
||||
'usage-games-pixels',
|
||||
'games-second',
|
||||
'piece-pixels',
|
||||
0,
|
||||
'open',
|
||||
540,
|
||||
'Pixelart, die nicht nostalgisch sein will',
|
||||
'Unser zweites Spiel nutzt Pixel nicht als Rückblick.',
|
||||
'Drei aktuelle Beispiele vergleichen.',
|
||||
'Auf Licht, Bewegung und Materialwirkung achten.',
|
||||
'Zum Schluss sammeln wir eure Empfehlungen.',
|
||||
'Pixel als bewusste Entscheidung.',
|
||||
'',
|
||||
0
|
||||
]
|
||||
]
|
||||
);
|
||||
database.prepare('DELETE FROM usage_source_snapshots').run();
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO usage_source_snapshots
|
||||
(id, usage_id, label, url, timecode_seconds, position)
|
||||
SELECT 'seed-source-' || u.id || '-' || ps.position, u.id, ps.label, ps.url,
|
||||
ps.timecode_seconds, ps.position
|
||||
FROM piece_usages u JOIN piece_sources ps ON ps.piece_id = u.original_piece_id`
|
||||
)
|
||||
.run();
|
||||
database.prepare('DELETE FROM usage_topic_snapshots').run();
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO usage_topic_snapshots (usage_id, name, position)
|
||||
SELECT usage_id, name, position FROM (
|
||||
SELECT u.id AS usage_id, t.name,
|
||||
row_number() OVER (PARTITION BY u.id ORDER BY t.name, t.id) - 1 AS position
|
||||
FROM piece_usages u JOIN piece_topics pt ON pt.piece_id = u.original_piece_id
|
||||
JOIN topics t ON t.id = pt.topic_id
|
||||
)`
|
||||
)
|
||||
.run();
|
||||
});
|
||||
|
||||
seedDatabase();
|
||||
|
||||
+7138
-433
File diff suppressed because it is too large.
Load diff
Vendored
+11
-1
@@ -1,5 +1,15 @@
|
||||
import type { AuthUser } from '#lib/server/auth.js';
|
||||
|
||||
declare global {
|
||||
namespace App {}
|
||||
namespace App {
|
||||
interface Locals {
|
||||
user: AuthUser | null;
|
||||
}
|
||||
interface PageData {
|
||||
user?: AuthUser | null;
|
||||
presentationMode?: boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
+5
-1
@@ -2,8 +2,12 @@
|
||||
<html lang="de" data-theme="light" data-theme-preference="system">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||
<meta name="theme-color" content="#f4f1eb" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
||||
<meta name="apple-mobile-web-app-title" content="Sendewerk" />
|
||||
<link rel="manifest" href="%sveltekit.assets%/manifest.webmanifest" />
|
||||
<script>
|
||||
(function () {
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
import { randomBytes } from 'node:crypto';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import type { Handle } from '@sveltejs/kit/hooks';
|
||||
import { deleteSession, getSessionUser, hasUsers, SESSION_COOKIE } from '#lib/server/auth.js';
|
||||
import { startFeedScheduler } from '#lib/server/feeds.js';
|
||||
|
||||
const publicPaths = new Set([
|
||||
'/',
|
||||
'/healthz',
|
||||
'/login',
|
||||
'/setup',
|
||||
'/einladung',
|
||||
'/passwort-vergessen',
|
||||
'/passwort-zuruecksetzen'
|
||||
]);
|
||||
|
||||
export const handle: Handle = async ({ event, resolve }) => {
|
||||
startFeedScheduler();
|
||||
const presentationPath = event.url.pathname.startsWith('/heinzlive/');
|
||||
const sharePath = event.url.pathname.startsWith('/freigabe/');
|
||||
const shareMediaPath = /^\/freigabe\/[^/]+\/media\/[^/]+$/.test(event.url.pathname);
|
||||
const apiPath = event.url.pathname.startsWith('/api/v1/');
|
||||
const presentationTestPath = /^\/fundus\/[^/]+\/praesentation(?:\/|$)/.test(event.url.pathname);
|
||||
const token = event.cookies.get(SESSION_COOKIE);
|
||||
event.locals.user = getSessionUser(token);
|
||||
if (token && !event.locals.user) deleteSession(event.cookies);
|
||||
|
||||
if (
|
||||
!presentationPath &&
|
||||
!sharePath &&
|
||||
!publicPaths.has(event.url.pathname) &&
|
||||
!apiPath &&
|
||||
!event.locals.user
|
||||
) {
|
||||
redirect(303, hasUsers() ? '/login' : '/setup');
|
||||
}
|
||||
|
||||
const sharePageNonce = sharePath && !shareMediaPath ? randomBytes(16).toString('base64') : null;
|
||||
const response = await resolve(
|
||||
event,
|
||||
sharePageNonce
|
||||
? {
|
||||
transformPageChunk: ({ html }) =>
|
||||
html.replaceAll('<script', `<script nonce="${sharePageNonce}"`)
|
||||
}
|
||||
: undefined
|
||||
);
|
||||
response.headers.set('Referrer-Policy', 'same-origin');
|
||||
response.headers.set('X-Content-Type-Options', 'nosniff');
|
||||
response.headers.set('X-Frame-Options', 'DENY');
|
||||
if (presentationPath || presentationTestPath) {
|
||||
response.headers.set('Cache-Control', 'no-store');
|
||||
response.headers.set('Referrer-Policy', 'strict-origin-when-cross-origin');
|
||||
response.headers.set(
|
||||
'Content-Security-Policy',
|
||||
"frame-src https://www.youtube-nocookie.com https://www.youtube.com https://www.tiktok.com; frame-ancestors 'none'"
|
||||
);
|
||||
}
|
||||
if (sharePath) {
|
||||
response.headers.set('Cache-Control', 'private, no-store');
|
||||
response.headers.set('Referrer-Policy', 'same-origin');
|
||||
if (!shareMediaPath) {
|
||||
response.headers.set(
|
||||
'Content-Security-Policy',
|
||||
`default-src 'self'; script-src 'self' 'nonce-${sharePageNonce}'; style-src 'self' 'unsafe-inline'; img-src 'self'; frame-ancestors 'none'`
|
||||
);
|
||||
}
|
||||
}
|
||||
if (event.url.pathname === '/einladung' || event.url.pathname === '/passwort-zuruecksetzen') {
|
||||
response.headers.set('Cache-Control', 'no-store');
|
||||
}
|
||||
return response;
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
berlinDateKey,
|
||||
buildCalendarDays,
|
||||
formatMonthLabel,
|
||||
normalizeMonthKey,
|
||||
shiftMonth
|
||||
} from './calendar.js';
|
||||
|
||||
describe('show calendar', () => {
|
||||
it('groups UTC instants by their Berlin civil date', () => {
|
||||
expect(berlinDateKey('2026-09-30T22:30:00.000Z')).toBe('2026-10-01');
|
||||
expect(berlinDateKey('2026-12-31T23:30:00.000Z')).toBe('2027-01-01');
|
||||
});
|
||||
|
||||
it('builds a Monday-first six-week month without dropping boundary days', () => {
|
||||
const days = buildCalendarDays('2026-10', '2026-10-24');
|
||||
expect(days).toHaveLength(42);
|
||||
expect(days[0]).toMatchObject({ date: '2026-09-28', inSelectedMonth: false });
|
||||
expect(days.find((day) => day.date === '2026-10-24')?.isToday).toBe(true);
|
||||
expect(days.at(-1)?.date).toBe('2026-11-08');
|
||||
});
|
||||
|
||||
it('moves across year boundaries and validates month keys', () => {
|
||||
expect(shiftMonth('2026-12', 1)).toBe('2027-01');
|
||||
expect(shiftMonth('2026-01', -1)).toBe('2025-12');
|
||||
expect(normalizeMonthKey('2026-13', '2026-10')).toBe('2026-10');
|
||||
expect(normalizeMonthKey('2026-02', '2026-10')).toBe('2026-02');
|
||||
expect(formatMonthLabel('2026-10')).toBe('Oktober 2026');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,75 @@
|
||||
export const BERLIN_TIME_ZONE = 'Europe/Berlin';
|
||||
|
||||
export type CalendarDay = {
|
||||
date: string;
|
||||
dayNumber: number;
|
||||
inSelectedMonth: boolean;
|
||||
isToday: boolean;
|
||||
};
|
||||
|
||||
const berlinDateFormatter = new Intl.DateTimeFormat('en-CA', {
|
||||
timeZone: BERLIN_TIME_ZONE,
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit'
|
||||
});
|
||||
|
||||
function padded(value: number) {
|
||||
return String(value).padStart(2, '0');
|
||||
}
|
||||
|
||||
function dateParts(value: string | Date) {
|
||||
const parts = berlinDateFormatter.formatToParts(
|
||||
typeof value === 'string' ? new Date(value) : value
|
||||
);
|
||||
const read = (type: Intl.DateTimeFormatPartTypes) =>
|
||||
Number(parts.find((part) => part.type === type)?.value);
|
||||
return { year: read('year'), month: read('month'), day: read('day') };
|
||||
}
|
||||
|
||||
export function berlinDateKey(value: string | Date) {
|
||||
const parts = dateParts(value);
|
||||
return `${parts.year}-${padded(parts.month)}-${padded(parts.day)}`;
|
||||
}
|
||||
|
||||
export function berlinMonthKey(value: string | Date) {
|
||||
return berlinDateKey(value).slice(0, 7);
|
||||
}
|
||||
|
||||
export function normalizeMonthKey(value: string | null | undefined, fallback: string) {
|
||||
if (!value || !/^\d{4}-(0[1-9]|1[0-2])$/.test(value)) return fallback;
|
||||
return value;
|
||||
}
|
||||
|
||||
export function shiftMonth(monthKey: string, delta: number) {
|
||||
const [year, month] = monthKey.split('-').map(Number);
|
||||
const shifted = new Date(Date.UTC(year, month - 1 + delta, 1));
|
||||
return `${shifted.getUTCFullYear()}-${padded(shifted.getUTCMonth() + 1)}`;
|
||||
}
|
||||
|
||||
export function formatMonthLabel(monthKey: string) {
|
||||
const [year, month] = monthKey.split('-').map(Number);
|
||||
return new Intl.DateTimeFormat('de-DE', {
|
||||
timeZone: 'UTC',
|
||||
month: 'long',
|
||||
year: 'numeric'
|
||||
}).format(new Date(Date.UTC(year, month - 1, 1)));
|
||||
}
|
||||
|
||||
export function buildCalendarDays(monthKey: string, todayKey: string): CalendarDay[] {
|
||||
const [year, month] = monthKey.split('-').map(Number);
|
||||
const first = new Date(Date.UTC(year, month - 1, 1));
|
||||
const mondayOffset = (first.getUTCDay() + 6) % 7;
|
||||
const start = new Date(Date.UTC(year, month - 1, 1 - mondayOffset));
|
||||
return Array.from({ length: 42 }, (_, index) => {
|
||||
const date = new Date(start);
|
||||
date.setUTCDate(start.getUTCDate() + index);
|
||||
const dateKey = `${date.getUTCFullYear()}-${padded(date.getUTCMonth() + 1)}-${padded(date.getUTCDate())}`;
|
||||
return {
|
||||
date: dateKey,
|
||||
dayNumber: date.getUTCDate(),
|
||||
inSelectedMonth: dateKey.startsWith(monthKey),
|
||||
isToday: dateKey === todayKey
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<script lang="ts">
|
||||
let { name, label, size = '1em' }: { name: string; label?: string; size?: string } = $props();
|
||||
</script>
|
||||
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
role={label ? 'img' : undefined}
|
||||
aria-label={label}
|
||||
aria-hidden={label ? undefined : 'true'}
|
||||
class="app-icon"
|
||||
>
|
||||
<use href={`/icons/classic-regular.svg#${name || 'circle'}`} />
|
||||
</svg>
|
||||
|
||||
<style>
|
||||
.app-icon {
|
||||
display: inline-block;
|
||||
flex: none;
|
||||
fill: currentColor;
|
||||
vertical-align: -0.125em;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,90 @@
|
||||
<script lang="ts">
|
||||
import AppIcon from './AppIcon.svelte';
|
||||
|
||||
type Item = {
|
||||
id: string;
|
||||
name: string;
|
||||
iconName?: string;
|
||||
description?: string;
|
||||
meta?: string;
|
||||
};
|
||||
|
||||
let {
|
||||
items,
|
||||
selectedIds,
|
||||
label,
|
||||
fieldName,
|
||||
onselectionchange
|
||||
}: {
|
||||
items: Item[];
|
||||
selectedIds: string[];
|
||||
label: string;
|
||||
fieldName?: string;
|
||||
onselectionchange: (ids: string[]) => void;
|
||||
} = $props();
|
||||
let query = $state('');
|
||||
let menu: HTMLDetailsElement;
|
||||
let filtered = $derived(
|
||||
items.filter((item) =>
|
||||
`${item.name} ${item.description ?? ''} ${item.meta ?? ''}`
|
||||
.toLocaleLowerCase('de')
|
||||
.includes(query.trim().toLocaleLowerCase('de'))
|
||||
)
|
||||
);
|
||||
let selected = $derived(items.filter((item) => selectedIds.includes(item.id)));
|
||||
|
||||
function toggle(id: string) {
|
||||
onselectionchange(
|
||||
selectedIds.includes(id)
|
||||
? selectedIds.filter((selectedId) => selectedId !== id)
|
||||
: [...selectedIds, id]
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="choice-picker">
|
||||
{#if fieldName}
|
||||
{#each selectedIds as id (id)}<input type="hidden" name={fieldName} value={id} />{/each}
|
||||
{/if}
|
||||
{#if selected.length}
|
||||
<div class="choice-picker-selected" aria-label={`${label}: ausgewählt`}>
|
||||
{#each selected as item (item.id)}
|
||||
<span
|
||||
>{#if item.iconName}<AppIcon name={item.iconName} />{/if}{item.name}</span
|
||||
>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<details bind:this={menu} class="choice-picker-menu">
|
||||
<summary>{selected.length ? `${label} ändern` : `${label} auswählen`}</summary>
|
||||
<div class="choice-picker-popover">
|
||||
<label class="choice-picker-search">
|
||||
<span class="sr-only">{label} durchsuchen</span>
|
||||
<AppIcon name="magnifying-glass" />
|
||||
<input type="search" placeholder={`${label} durchsuchen`} bind:value={query} />
|
||||
</label>
|
||||
<div class="choice-picker-options">
|
||||
{#each filtered as item (item.id)}
|
||||
<label class:active={selectedIds.includes(item.id)}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={selectedIds.includes(item.id)}
|
||||
onchange={() => toggle(item.id)}
|
||||
/>
|
||||
{#if item.iconName}<AppIcon name={item.iconName} size="1.2em" />{/if}
|
||||
<span
|
||||
><strong>{item.name}</strong>{#if item.description}<small>{item.description}</small
|
||||
>{/if}</span
|
||||
>
|
||||
{#if item.meta}<small>{item.meta}</small>{/if}
|
||||
</label>
|
||||
{:else}<p>Keine Treffer.</p>{/each}
|
||||
</div>
|
||||
<button
|
||||
class="choice-picker-close text-button"
|
||||
type="button"
|
||||
onclick={() => (menu.open = false)}>Auswahl schließen</button
|
||||
>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
@@ -0,0 +1,108 @@
|
||||
<script lang="ts">
|
||||
import { tick } from 'svelte';
|
||||
import AppIcon from './AppIcon.svelte';
|
||||
|
||||
type Feed = {
|
||||
id: string;
|
||||
name: string;
|
||||
url: string;
|
||||
isEnabled: boolean;
|
||||
refreshIntervalMinutes: number;
|
||||
defaultCategoryId: string | null;
|
||||
};
|
||||
|
||||
let { categories }: { categories: { id: string; name: string }[] } = $props();
|
||||
let dialog: HTMLDialogElement;
|
||||
let nameInput: HTMLInputElement;
|
||||
let feed = $state<Feed | null>(null);
|
||||
let name = $state('');
|
||||
let url = $state('');
|
||||
let refreshIntervalMinutes = $state(60);
|
||||
let defaultCategoryId = $state('');
|
||||
let isEnabled = $state(true);
|
||||
|
||||
export async function showModal(selectedFeed: Feed | null = null) {
|
||||
feed = selectedFeed;
|
||||
name = selectedFeed?.name ?? '';
|
||||
url = selectedFeed?.url ?? '';
|
||||
refreshIntervalMinutes = selectedFeed?.refreshIntervalMinutes ?? 60;
|
||||
defaultCategoryId = selectedFeed?.defaultCategoryId ?? '';
|
||||
isEnabled = selectedFeed?.isEnabled ?? true;
|
||||
dialog.showModal();
|
||||
await tick();
|
||||
nameInput.focus();
|
||||
}
|
||||
|
||||
function close() {
|
||||
dialog.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<dialog
|
||||
bind:this={dialog}
|
||||
class="management-dialog feed-editor-dialog"
|
||||
aria-labelledby="feed-dialog-title"
|
||||
onclick={(event) => event.target === dialog && close()}
|
||||
>
|
||||
<header>
|
||||
<div class="management-dialog-title">
|
||||
<span class="management-dialog-icon"><AppIcon name="rss" /></span>
|
||||
<div>
|
||||
<p class="eyebrow">RSS-Quelle</p>
|
||||
<h2 id="feed-dialog-title">{feed?.name || 'Feed hinzufügen'}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<button class="dialog-close" type="button" aria-label="Feeddialog schließen" onclick={close}
|
||||
><AppIcon name="xmark" /></button
|
||||
>
|
||||
</header>
|
||||
<form class="management-dialog-form" method="POST" action="?/saveFeed">
|
||||
{#if feed}<input type="hidden" name="feedId" value={feed.id} />{/if}
|
||||
<div class="management-dialog-fields">
|
||||
<label
|
||||
>Name<input
|
||||
bind:this={nameInput}
|
||||
bind:value={name}
|
||||
name="name"
|
||||
required
|
||||
maxlength="120"
|
||||
/></label
|
||||
>
|
||||
<label
|
||||
>Feed-URL<input bind:value={url} name="url" type="url" required maxlength="2000" /></label
|
||||
>
|
||||
<label
|
||||
>Intervall in Minuten<input
|
||||
bind:value={refreshIntervalMinutes}
|
||||
name="refreshIntervalMinutes"
|
||||
type="number"
|
||||
min="15"
|
||||
max="10080"
|
||||
required
|
||||
/></label
|
||||
>
|
||||
<label
|
||||
>Standardkategorie<select bind:value={defaultCategoryId} name="defaultCategoryId"
|
||||
><option value="">Keine</option>{#each categories as category (category.id)}<option
|
||||
value={category.id}>{category.name}</option
|
||||
>{/each}</select
|
||||
></label
|
||||
>
|
||||
</div>
|
||||
<div class="management-dialog-selections">
|
||||
<label class="toggle-row"
|
||||
><input type="checkbox" name="isEnabled" value="1" bind:checked={isEnabled} /><span
|
||||
><strong>Automatischer Abruf</strong><small
|
||||
>Der Feed wird im festgelegten Intervall sicher abgerufen.</small
|
||||
></span
|
||||
></label
|
||||
>
|
||||
</div>
|
||||
<footer>
|
||||
<button class="secondary-button" type="button" onclick={close}>Abbrechen</button>
|
||||
<button class="primary-button" type="submit"
|
||||
>{feed ? 'Änderungen speichern' : 'Feed anlegen'}</button
|
||||
>
|
||||
</footer>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -0,0 +1,64 @@
|
||||
<script lang="ts">
|
||||
import { classicRegularIcons } from '#lib/icons/classic-regular.js';
|
||||
import AppIcon from './AppIcon.svelte';
|
||||
|
||||
let { name = $bindable(), inputName = 'iconName' }: { name: string; inputName?: string } =
|
||||
$props();
|
||||
let query = $state('');
|
||||
let menu: HTMLDetailsElement;
|
||||
let searchInput: HTMLInputElement;
|
||||
let filtered = $derived(
|
||||
classicRegularIcons.filter((icon) =>
|
||||
`${icon.name} ${icon.label} ${icon.terms.join(' ')}`
|
||||
.toLocaleLowerCase('de')
|
||||
.includes(query.trim().toLocaleLowerCase('de'))
|
||||
)
|
||||
);
|
||||
let visible = $derived(filtered.slice(0, 120));
|
||||
|
||||
function openAndFocus(event: MouseEvent) {
|
||||
if (menu.open) return;
|
||||
event.preventDefault();
|
||||
menu.open = true;
|
||||
searchInput.focus({ preventScroll: true });
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="icon-picker">
|
||||
<input type="hidden" name={inputName} value={name} />
|
||||
<details
|
||||
bind:this={menu}
|
||||
ontoggle={() => {
|
||||
if (menu.open) queueMicrotask(() => searchInput.focus());
|
||||
}}
|
||||
>
|
||||
<summary onclick={openAndFocus}><AppIcon name={name || 'circle'} /> Icon auswählen</summary>
|
||||
<div class="icon-picker-popover">
|
||||
<label
|
||||
><span class="sr-only">Icons durchsuchen</span><input
|
||||
type="search"
|
||||
placeholder="Icon suchen"
|
||||
bind:value={query}
|
||||
bind:this={searchInput}
|
||||
/></label
|
||||
>
|
||||
<div class="icon-picker-grid">
|
||||
{#each visible as icon (icon.name)}
|
||||
<button
|
||||
type="button"
|
||||
class:active={name === icon.name}
|
||||
title={icon.label}
|
||||
onclick={() => {
|
||||
name = icon.name;
|
||||
menu.open = false;
|
||||
}}><AppIcon name={icon.name} /><span>{icon.label}</span></button
|
||||
>
|
||||
{/each}
|
||||
</div>
|
||||
{#if filtered.length > visible.length}<p class="icon-picker-hint">
|
||||
{visible.length} von {filtered.length} Icons sichtbar. Suche verwenden, um weitere Icons zu
|
||||
finden.
|
||||
</p>{/if}
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
@@ -0,0 +1,70 @@
|
||||
<script lang="ts">
|
||||
import { tick } from 'svelte';
|
||||
import AppIcon from './AppIcon.svelte';
|
||||
|
||||
let {
|
||||
value = $bindable(),
|
||||
form,
|
||||
name = 'title',
|
||||
label = 'Titel',
|
||||
oncommit
|
||||
}: {
|
||||
value: string;
|
||||
form: string;
|
||||
name?: string;
|
||||
label?: string;
|
||||
oncommit?: () => void;
|
||||
} = $props();
|
||||
|
||||
let editing = $state(false);
|
||||
let original = $state('');
|
||||
let input = $state<HTMLInputElement>();
|
||||
let trigger = $state<HTMLButtonElement>();
|
||||
|
||||
async function edit() {
|
||||
original = value;
|
||||
editing = true;
|
||||
await tick();
|
||||
input?.focus();
|
||||
input?.select();
|
||||
}
|
||||
|
||||
async function finish(commit: boolean) {
|
||||
if (!editing) return;
|
||||
if (!commit) value = original;
|
||||
editing = false;
|
||||
if (commit && value !== original) oncommit?.();
|
||||
await tick();
|
||||
trigger?.focus();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="inline-title-editor">
|
||||
<input type="hidden" {form} {name} {value} />
|
||||
{#if editing}
|
||||
<label>
|
||||
<span class="sr-only">{label}</span>
|
||||
<input
|
||||
bind:this={input}
|
||||
bind:value
|
||||
maxlength="200"
|
||||
required
|
||||
onkeydown={(event) => {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
void finish(true);
|
||||
} else if (event.key === 'Escape') {
|
||||
event.preventDefault();
|
||||
void finish(false);
|
||||
}
|
||||
}}
|
||||
onblur={() => void finish(true)}
|
||||
/>
|
||||
</label>
|
||||
{:else}
|
||||
<button bind:this={trigger} type="button" class="inline-title-trigger" onclick={edit}>
|
||||
<span>{value}</span><AppIcon name="pen" size="0.9em" />
|
||||
<span class="sr-only">{label} bearbeiten</span>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -0,0 +1,85 @@
|
||||
<script lang="ts">
|
||||
import { tick } from 'svelte';
|
||||
import AppIcon from './AppIcon.svelte';
|
||||
|
||||
let {
|
||||
name,
|
||||
label,
|
||||
value = $bindable(),
|
||||
rows = 4,
|
||||
placeholder = '',
|
||||
privateField = false,
|
||||
form
|
||||
}: {
|
||||
name: string;
|
||||
label: string;
|
||||
value: string;
|
||||
rows?: number;
|
||||
placeholder?: string;
|
||||
privateField?: boolean;
|
||||
form?: string;
|
||||
} = $props();
|
||||
|
||||
let textarea: HTMLTextAreaElement;
|
||||
|
||||
async function replaceSelection(before: string, after = before, fallback = 'Text') {
|
||||
const start = textarea.selectionStart;
|
||||
const end = textarea.selectionEnd;
|
||||
const selected = value.slice(start, end) || fallback;
|
||||
value = `${value.slice(0, start)}${before}${selected}${after}${value.slice(end)}`;
|
||||
await tick();
|
||||
textarea.focus();
|
||||
textarea.setSelectionRange(start + before.length, start + before.length + selected.length);
|
||||
textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
}
|
||||
|
||||
async function addList() {
|
||||
const start = textarea.selectionStart;
|
||||
const end = textarea.selectionEnd;
|
||||
const selected = value.slice(start, end) || 'Stichpunkt';
|
||||
const replacement = selected
|
||||
.split('\n')
|
||||
.map((line) => `- ${line}`)
|
||||
.join('\n');
|
||||
value = `${value.slice(0, start)}${replacement}${value.slice(end)}`;
|
||||
await tick();
|
||||
textarea.focus();
|
||||
textarea.setSelectionRange(start + 2, start + replacement.length);
|
||||
textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class:private-field={privateField} class="markdown-editor-field">
|
||||
<div class="markdown-editor-heading">
|
||||
<span
|
||||
>{label}{#if privateField}<small>Nur intern</small>{/if}</span
|
||||
>
|
||||
<span class="markdown-toolbar" role="toolbar" aria-label={`${label} formatieren`}>
|
||||
<button type="button" aria-label="Fett" title="Fett" onclick={() => replaceSelection('**')}
|
||||
><strong>B</strong></button
|
||||
>
|
||||
<button type="button" aria-label="Kursiv" title="Kursiv" onclick={() => replaceSelection('_')}
|
||||
><em>I</em></button
|
||||
>
|
||||
<button type="button" aria-label="Liste" title="Liste" onclick={addList}
|
||||
><AppIcon name="list-check" /> Liste</button
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Link"
|
||||
title="Link"
|
||||
onclick={() => replaceSelection('[', '](https://)', 'Linktext')}
|
||||
><AppIcon name="link" /> Link</button
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
<textarea
|
||||
bind:this={textarea}
|
||||
aria-label={label}
|
||||
{name}
|
||||
{rows}
|
||||
{placeholder}
|
||||
{form}
|
||||
maxlength="50000"
|
||||
bind:value></textarea>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
let { html }: { html: string } = $props();
|
||||
</script>
|
||||
|
||||
<!-- html is produced exclusively by the allowlist sanitizer in $lib/server/markdown.ts. -->
|
||||
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
||||
<div class="markdown-preview">{@html html}</div>
|
||||
@@ -1,32 +1,21 @@
|
||||
<script lang="ts">
|
||||
import AppIcon from './AppIcon.svelte';
|
||||
|
||||
let { name }: { name: string } = $props();
|
||||
const aliases: Record<string, string> = {
|
||||
library: 'folder-open',
|
||||
shows: 'calendar-days',
|
||||
archive: 'box-archive',
|
||||
settings: 'gear',
|
||||
edit: 'pen'
|
||||
};
|
||||
let iconName = $derived(aliases[name] ?? name);
|
||||
</script>
|
||||
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
{#if name === 'inbox'}
|
||||
<path d="M4 5.5h16v13H4zM4 14h4l1.5 2h5l1.5-2h4" />
|
||||
{:else if name === 'library'}
|
||||
<path d="M5 4.5h4v15H5zM10.5 4.5h4v15h-4zM16 5.5l3-1 3.5 14-3 1z" />
|
||||
{:else if name === 'shows'}
|
||||
<path d="M4 6.5h16v13H4zM8 3.5v6M16 3.5v6M4 10h16" />
|
||||
{:else if name === 'archive'}
|
||||
<path d="M4 7h16v13H4zM3 4h18v4H3zM9 12h6" />
|
||||
{:else if name === 'settings'}
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
<path
|
||||
d="M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6 7 7M17 17l1.4 1.4M18.4 5.6 17 7M7 17l-1.4 1.4"
|
||||
/>
|
||||
{/if}
|
||||
</svg>
|
||||
<AppIcon name={iconName} size="1.25rem" />
|
||||
|
||||
<style>
|
||||
svg {
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
stroke-width: 1.7;
|
||||
:global(.app-icon) {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,82 @@
|
||||
<script lang="ts">
|
||||
import { tick, type Snippet } from 'svelte';
|
||||
import AppIcon from './AppIcon.svelte';
|
||||
|
||||
let {
|
||||
labelledby,
|
||||
activeSection = $bindable(),
|
||||
onrequestclose,
|
||||
header,
|
||||
children,
|
||||
footer
|
||||
}: {
|
||||
labelledby: string;
|
||||
activeSection: 'script' | 'research' | 'presentation';
|
||||
onrequestclose: () => void;
|
||||
header: Snippet;
|
||||
children: Snippet;
|
||||
footer: Snippet;
|
||||
} = $props();
|
||||
|
||||
let dialog: HTMLDialogElement;
|
||||
let workspace: HTMLDivElement;
|
||||
const scrollPositions = { script: 0, research: 0, presentation: 0 };
|
||||
|
||||
async function selectSection(section: typeof activeSection) {
|
||||
scrollPositions[activeSection] = workspace.scrollTop;
|
||||
activeSection = section;
|
||||
await tick();
|
||||
workspace.scrollTop = scrollPositions[section];
|
||||
}
|
||||
|
||||
export function showModal() {
|
||||
if (!dialog.open) dialog.showModal();
|
||||
}
|
||||
|
||||
export function close() {
|
||||
dialog.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<dialog
|
||||
bind:this={dialog}
|
||||
class="piece-editor-dialog"
|
||||
aria-labelledby={labelledby}
|
||||
oncancel={(event) => {
|
||||
event.preventDefault();
|
||||
onrequestclose();
|
||||
}}
|
||||
onclick={(event) => event.target === dialog && onrequestclose()}
|
||||
>
|
||||
<header class="piece-dialog-header">
|
||||
<div class="piece-dialog-heading">{@render header()}</div>
|
||||
<button
|
||||
class="dialog-close"
|
||||
type="button"
|
||||
aria-label="Editor schließen"
|
||||
onclick={onrequestclose}><AppIcon name="xmark" /></button
|
||||
>
|
||||
</header>
|
||||
<nav class="piece-dialog-tabs" aria-label="Editorbereiche">
|
||||
<button
|
||||
type="button"
|
||||
class:active={activeSection === 'script'}
|
||||
aria-current={activeSection === 'script' ? 'page' : undefined}
|
||||
onclick={() => selectSection('script')}>Sendungstext</button
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class:active={activeSection === 'research'}
|
||||
aria-current={activeSection === 'research' ? 'page' : undefined}
|
||||
onclick={() => selectSection('research')}>Recherche & Quellen</button
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class:active={activeSection === 'presentation'}
|
||||
aria-current={activeSection === 'presentation' ? 'page' : undefined}
|
||||
onclick={() => selectSection('presentation')}>Präsentation</button
|
||||
>
|
||||
</nav>
|
||||
<div bind:this={workspace} class="piece-dialog-workspace">{@render children()}</div>
|
||||
<footer class="piece-dialog-footer">{@render footer()}</footer>
|
||||
</dialog>
|
||||
@@ -0,0 +1,36 @@
|
||||
<script lang="ts">
|
||||
import { resolve } from '$app/paths';
|
||||
import type { SentPieceUsage } from '#lib/server/shows.js';
|
||||
|
||||
let { history }: { history: SentPieceUsage[] } = $props();
|
||||
|
||||
function berlinDate(value: string) {
|
||||
return new Intl.DateTimeFormat('de-DE', {
|
||||
timeZone: 'Europe/Berlin',
|
||||
dateStyle: 'medium'
|
||||
}).format(new Date(value));
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if history.length}
|
||||
<div class="piece-usage-history">
|
||||
<p>
|
||||
<strong>Gesendet am {berlinDate(history[0].usedAtUtc)}</strong>
|
||||
in <a href={resolve('/sendungen/[id]', { id: history[0].showId })}>{history[0].showTitle}</a>
|
||||
{#if history.length > 1}<span>+ {history.length - 1} weitere</span>{/if}
|
||||
</p>
|
||||
{#if history.length > 1}
|
||||
<details>
|
||||
<summary>Vollständige Verwendungshistorie</summary>
|
||||
<ul>
|
||||
{#each history as usage (usage.usageId)}
|
||||
<li>
|
||||
<time datetime={usage.usedAtUtc}>{berlinDate(usage.usedAtUtc)}</time>
|
||||
<a href={resolve('/sendungen/[id]', { id: usage.showId })}>{usage.showTitle}</a>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</details>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -0,0 +1,119 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import type { PresentationContent } from '#lib/server/presentation.js';
|
||||
|
||||
let {
|
||||
content,
|
||||
imageSrc = ''
|
||||
}: {
|
||||
content: PresentationContent & {
|
||||
sources?: { label: string; url: string }[];
|
||||
images?: { id: string; altText: string }[];
|
||||
};
|
||||
imageSrc?: string;
|
||||
} = $props();
|
||||
let frame = $state<HTMLIFrameElement>();
|
||||
let playerUnavailable = $state(false);
|
||||
let imageUnavailable = $state(false);
|
||||
|
||||
onMount(() => {
|
||||
const receive = (event: MessageEvent) => {
|
||||
if (content.provider !== 'tiktok' || event.origin !== 'https://www.tiktok.com') return;
|
||||
if (event.source !== frame?.contentWindow || typeof event.data !== 'object' || !event.data)
|
||||
return;
|
||||
const message = event.data as { type?: string; value?: unknown };
|
||||
if (message.type === 'onPlayerReady' && content.source?.timecodeSeconds) {
|
||||
frame.contentWindow?.postMessage(
|
||||
{
|
||||
type: 'seekTo',
|
||||
value: content.source.timecodeSeconds,
|
||||
'x-tiktok-player': true
|
||||
},
|
||||
'https://www.tiktok.com'
|
||||
);
|
||||
}
|
||||
if (message.type === 'onPlayerError') playerUnavailable = true;
|
||||
};
|
||||
addEventListener('message', receive);
|
||||
return () => removeEventListener('message', receive);
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if content.mode === 'text'}
|
||||
<article class="output-content output-text">
|
||||
{#if content.topics.length}<p class="output-topics">{content.topics.join(' · ')}</p>{/if}
|
||||
<h1>{content.title}</h1>
|
||||
<!-- HTML is produced exclusively by the server-side allowlist sanitizer. -->
|
||||
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
||||
<div class="output-copy">{@html content.html}</div>
|
||||
{#if content.images?.length}<div class="output-images">
|
||||
{#each content.images as image (image.id)}
|
||||
<img src={`${imageSrc}/${image.id}`} alt={image.altText} />
|
||||
{/each}
|
||||
</div>{/if}
|
||||
{#if content.sources?.length}<footer class="output-sources">
|
||||
<span>Quellen</span>
|
||||
{#each content.sources as source, index (`${index}-${source.url}`)}
|
||||
<!-- The URL is a server-validated external HTTP(S) source. -->
|
||||
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
|
||||
<a href={source.url} target="_blank" rel="noopener noreferrer">{source.label}</a>
|
||||
{/each}
|
||||
</footer>{/if}
|
||||
</article>
|
||||
{:else if content.mode === 'image'}
|
||||
<article class="output-content output-image-only">
|
||||
{#if imageSrc}<img src={imageSrc} alt={content.images?.[0]?.altText ?? content.title} />{/if}
|
||||
</article>
|
||||
{:else if content.mode === 'link'}
|
||||
<article class="output-content output-link-card">
|
||||
{#if imageSrc && !imageUnavailable}<div class="output-link-image">
|
||||
<img src={imageSrc} alt="" onerror={() => (imageUnavailable = true)} />
|
||||
</div>{/if}
|
||||
<div class="output-link-copy">
|
||||
{#if content.topics.length}<p class="output-topics">{content.topics.join(' · ')}</p>{/if}
|
||||
<p class="output-kicker">{content.siteName || content.source?.label || 'Webseite'}</p>
|
||||
<h1>{content.previewTitle || content.title}</h1>
|
||||
{#if content.description}<p>{content.description}</p>{/if}
|
||||
<!-- The URL is a server-validated external HTTP(S) source. -->
|
||||
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
|
||||
{#if content.source}<a href={content.source.url} target="_blank" rel="noopener noreferrer"
|
||||
>Original öffnen</a
|
||||
>{/if}
|
||||
</div>
|
||||
</article>
|
||||
{:else}
|
||||
<article class:portrait={content.provider === 'tiktok'} class="output-content output-video">
|
||||
<header>
|
||||
{#if content.topics.length}<p class="output-topics">{content.topics.join(' · ')}</p>{/if}
|
||||
<p class="output-kicker">{content.siteName || content.source?.label || 'Video'}</p>
|
||||
<h1>{content.previewTitle || content.title}</h1>
|
||||
</header>
|
||||
{#if content.embedUrl && !playerUnavailable}
|
||||
<div class="output-player">
|
||||
<iframe
|
||||
bind:this={frame}
|
||||
title={content.previewTitle || content.title}
|
||||
src={content.embedUrl}
|
||||
allow="encrypted-media; fullscreen; picture-in-picture"
|
||||
allowfullscreen
|
||||
onerror={() => (playerUnavailable = true)}
|
||||
></iframe>
|
||||
</div>
|
||||
{:else}
|
||||
<section class="output-fallback">
|
||||
<strong>Video kann nicht eingebettet werden</strong>
|
||||
<p>Der Anbieter oder diese URL ist für die eingebettete Wiedergabe nicht verfügbar.</p>
|
||||
<!-- The URL is a server-validated external HTTP(S) source. -->
|
||||
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
|
||||
{#if content.source}<a href={content.source.url} target="_blank" rel="noopener noreferrer"
|
||||
>Original öffnen</a
|
||||
>{/if}
|
||||
</section>
|
||||
{/if}
|
||||
{#if content.source}<footer class="output-video-source">
|
||||
<!-- The URL is a server-validated external HTTP(S) source. -->
|
||||
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
|
||||
<a href={content.source.url} target="_blank" rel="noopener noreferrer">Original öffnen</a>
|
||||
</footer>{/if}
|
||||
</article>
|
||||
{/if}
|
||||
@@ -2,12 +2,13 @@
|
||||
let { area }: { area: string } = $props();
|
||||
</script>
|
||||
|
||||
<aside class="preview-notice" aria-label="Hinweis zur Gestaltungsvorschau">
|
||||
<details class="preview-notice">
|
||||
<summary>
|
||||
<span class="preview-dot" aria-hidden="true"></span>
|
||||
<div>
|
||||
<strong>Gestaltungsvorschau: {area}</strong>
|
||||
<strong>Vorschau · {area}</strong>
|
||||
<span class="preview-chevron" aria-hidden="true">⌄</span>
|
||||
</summary>
|
||||
<p>
|
||||
In Etappe 1 schreibgeschützt. Die gezeigten Inhalte stammen aus der lokalen SQLite-Datenbank.
|
||||
Diese Ansicht ist schreibgeschützt. Bearbeiten und Speichern folgen in einer späteren Etappe.
|
||||
</p>
|
||||
</div>
|
||||
</aside>
|
||||
</details>
|
||||
@@ -0,0 +1,219 @@
|
||||
<script lang="ts">
|
||||
/* eslint-disable svelte/no-navigation-without-resolve -- RSS links are validated external URLs. */
|
||||
import { onMount, tick } from 'svelte';
|
||||
import AppIcon from './AppIcon.svelte';
|
||||
import ChoicePicker from './ChoicePicker.svelte';
|
||||
|
||||
type FeedEntry = {
|
||||
id: string;
|
||||
feedId: string;
|
||||
feedName: string;
|
||||
title: string;
|
||||
url: string;
|
||||
summary: string;
|
||||
publishedAtUtc: string | null;
|
||||
};
|
||||
|
||||
let {
|
||||
entries,
|
||||
categories,
|
||||
form = null
|
||||
}: {
|
||||
entries: FeedEntry[];
|
||||
categories: { id: string; name: string }[];
|
||||
form?: { intent?: string; feedError?: string } | null;
|
||||
} = $props();
|
||||
let dialog: HTMLDialogElement;
|
||||
let closeButton: HTMLButtonElement;
|
||||
let selectedIds = $state<string[]>([]);
|
||||
let selectedFeedIds = $state<string[]>([]);
|
||||
let categoryIds = $state<string[]>([]);
|
||||
let page = $state(1);
|
||||
const pageSize = 20;
|
||||
let feeds = $derived(
|
||||
Array.from(new Map(entries.map((entry) => [entry.feedId, entry.feedName])).entries()).map(
|
||||
([id, name]) => ({ id, name })
|
||||
)
|
||||
);
|
||||
let filteredEntries = $derived(entries.filter((entry) => selectedFeedIds.includes(entry.feedId)));
|
||||
let pageCount = $derived(Math.max(1, Math.ceil(filteredEntries.length / pageSize)));
|
||||
let visibleEntries = $derived(filteredEntries.slice((page - 1) * pageSize, page * pageSize));
|
||||
let allSourcesSelected = $derived(feeds.length > 0 && selectedFeedIds.length === feeds.length);
|
||||
|
||||
onMount(() => {
|
||||
selectedFeedIds = feeds.map((feed) => feed.id);
|
||||
if (form?.intent === 'feedImport' && form.feedError) void showModal();
|
||||
});
|
||||
|
||||
export async function showModal() {
|
||||
if (!selectedFeedIds.length) selectedFeedIds = feeds.map((feed) => feed.id);
|
||||
if (!dialog.open) dialog.showModal();
|
||||
await tick();
|
||||
closeButton.focus();
|
||||
}
|
||||
|
||||
function close() {
|
||||
dialog.close();
|
||||
}
|
||||
|
||||
function selectAllSources() {
|
||||
selectedFeedIds = feeds.map((feed) => feed.id);
|
||||
page = 1;
|
||||
}
|
||||
|
||||
function toggleSource(id: string) {
|
||||
selectedFeedIds = selectedFeedIds.includes(id)
|
||||
? selectedFeedIds.filter((feedId) => feedId !== id)
|
||||
: [...selectedFeedIds, id];
|
||||
page = 1;
|
||||
}
|
||||
|
||||
function toggleEntry(id: string) {
|
||||
selectedIds = selectedIds.includes(id)
|
||||
? selectedIds.filter((entryId) => entryId !== id)
|
||||
: [...selectedIds, id];
|
||||
}
|
||||
|
||||
function handleEntryKeydown(event: KeyboardEvent, id: string) {
|
||||
if (event.key !== 'Enter' && event.key !== ' ') return;
|
||||
event.preventDefault();
|
||||
toggleEntry(id);
|
||||
}
|
||||
</script>
|
||||
|
||||
<dialog
|
||||
bind:this={dialog}
|
||||
class="management-dialog rss-selection-dialog"
|
||||
aria-labelledby="rss-selection-title"
|
||||
onclick={(event) => event.target === dialog && close()}
|
||||
>
|
||||
<header>
|
||||
<div class="management-dialog-title">
|
||||
<span class="management-dialog-icon"><AppIcon name="rss" /></span>
|
||||
<div>
|
||||
<p class="eyebrow">RSS-Importeingang</p>
|
||||
<h2 id="rss-selection-title">RSS-Beiträge auswählen</h2>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
bind:this={closeButton}
|
||||
class="dialog-close"
|
||||
type="button"
|
||||
aria-label="RSS-Auswahl schließen"
|
||||
onclick={close}><AppIcon name="xmark" /></button
|
||||
>
|
||||
</header>
|
||||
<form class="rss-selection-form" method="POST" action="?/importFeeds">
|
||||
{#each selectedIds as id (id)}<input type="hidden" name="entryIds" value={id} />{/each}
|
||||
<div class="rss-selection-content">
|
||||
{#if form?.intent === 'feedImport' && form.feedError}<div
|
||||
class="form-message error"
|
||||
role="alert"
|
||||
>
|
||||
{form.feedError}
|
||||
</div>{/if}
|
||||
<nav class="rss-source-filters" aria-label="RSS-Quellen filtern">
|
||||
<button
|
||||
type="button"
|
||||
class:active={allSourcesSelected}
|
||||
aria-pressed={allSourcesSelected}
|
||||
onclick={selectAllSources}>Alle Quellen</button
|
||||
>
|
||||
{#each feeds as feed (feed.id)}
|
||||
<button
|
||||
type="button"
|
||||
class:active={selectedFeedIds.includes(feed.id)}
|
||||
aria-pressed={selectedFeedIds.includes(feed.id)}
|
||||
onclick={() => toggleSource(feed.id)}>{feed.name}</button
|
||||
>
|
||||
{/each}
|
||||
</nav>
|
||||
|
||||
<div class="rss-result-summary" aria-live="polite">
|
||||
<strong>{filteredEntries.length} verfügbare Beiträge</strong>
|
||||
<span>Seite {page} von {pageCount}</span>
|
||||
</div>
|
||||
<div
|
||||
class="rss-entry-list"
|
||||
role="listbox"
|
||||
aria-label="Verfügbare RSS-Beiträge"
|
||||
aria-multiselectable="true"
|
||||
>
|
||||
{#each visibleEntries as entry (entry.id)}
|
||||
<div
|
||||
class:selected={selectedIds.includes(entry.id)}
|
||||
class="rss-entry"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
aria-selected={selectedIds.includes(entry.id)}
|
||||
onclick={() => toggleEntry(entry.id)}
|
||||
onkeydown={(event) => handleEntryKeydown(event, entry.id)}
|
||||
>
|
||||
<div class="rss-entry-state" aria-hidden="true">
|
||||
<AppIcon name={selectedIds.includes(entry.id) ? 'check' : 'plus'} />
|
||||
</div>
|
||||
<div class="rss-entry-copy">
|
||||
<small
|
||||
>{entry.feedName}{entry.publishedAtUtc
|
||||
? ` · ${new Date(entry.publishedAtUtc).toLocaleDateString('de-DE')}`
|
||||
: ''}</small
|
||||
>
|
||||
<strong>{entry.title}</strong>
|
||||
{#if entry.summary}<p>{entry.summary}</p>{/if}
|
||||
<a
|
||||
href={entry.url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
onclick={(event) => event.stopPropagation()}
|
||||
onkeydown={(event) => event.stopPropagation()}>Original öffnen</a
|
||||
>
|
||||
</div>
|
||||
{#if selectedIds.includes(entry.id)}<span class="rss-selected-label">Ausgewählt</span
|
||||
>{/if}
|
||||
</div>
|
||||
{:else}<p class="empty-copy">
|
||||
Für diese Quellenauswahl sind keine Beiträge verfügbar.
|
||||
</p>{/each}
|
||||
</div>
|
||||
{#if pageCount > 1}<nav class="rss-pagination" aria-label="RSS-Beitragsseiten">
|
||||
<button
|
||||
class="secondary-button"
|
||||
type="button"
|
||||
disabled={page === 1}
|
||||
onclick={() => (page -= 1)}>Zurück</button
|
||||
>
|
||||
<span
|
||||
>{(page - 1) * pageSize + 1}–{Math.min(page * pageSize, filteredEntries.length)} von {filteredEntries.length}</span
|
||||
>
|
||||
<button
|
||||
class="secondary-button"
|
||||
type="button"
|
||||
disabled={page === pageCount}
|
||||
onclick={() => (page += 1)}>Weiter</button
|
||||
>
|
||||
</nav>{/if}
|
||||
<div class="rss-category-selection">
|
||||
<span class="field-label">Kategorien für die Auswahl</span>
|
||||
<small>Ohne Auswahl gilt die Standardkategorie der jeweiligen Quelle.</small>
|
||||
<ChoicePicker
|
||||
items={categories}
|
||||
selectedIds={categoryIds}
|
||||
label="Kategorien"
|
||||
fieldName="categoryIds"
|
||||
onselectionchange={(ids) => (categoryIds = ids)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="rss-selection-actions">
|
||||
<button
|
||||
class="text-button danger-text"
|
||||
type="submit"
|
||||
formaction="?/discardFeeds"
|
||||
disabled={!selectedIds.length}>Auswahl verwerfen</button
|
||||
>
|
||||
<button class="primary-button" type="submit" disabled={!selectedIds.length}>
|
||||
Auswahl in den Eingang übernehmen ({selectedIds.length})
|
||||
</button>
|
||||
</footer>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -0,0 +1,330 @@
|
||||
<script lang="ts">
|
||||
import { resolve } from '$app/paths';
|
||||
import { onMount } from 'svelte';
|
||||
import AppIcon from './AppIcon.svelte';
|
||||
|
||||
type ShareShow = {
|
||||
id: string;
|
||||
title: string;
|
||||
startsAtUtc: string | null;
|
||||
status: string;
|
||||
};
|
||||
|
||||
type ShareItem = {
|
||||
id: string;
|
||||
showId: string;
|
||||
showTitle: string;
|
||||
showStatus: string;
|
||||
showStartsAtUtc: string | null;
|
||||
scope: 'rundown' | 'moderation' | 'research';
|
||||
isPasswordProtected: boolean;
|
||||
expiresAtUtc: string | null;
|
||||
revokedAtUtc: string | null;
|
||||
createdAtUtc: string;
|
||||
};
|
||||
|
||||
let {
|
||||
shows,
|
||||
shares,
|
||||
fixedShowId = '',
|
||||
catalogPanel = false,
|
||||
form = null
|
||||
}: {
|
||||
shows: ShareShow[];
|
||||
shares: ShareItem[];
|
||||
fixedShowId?: string;
|
||||
catalogPanel?: boolean;
|
||||
form?: {
|
||||
intent?: string;
|
||||
error?: string;
|
||||
success?: string | boolean;
|
||||
shareUrl?: string;
|
||||
} | null;
|
||||
} = $props();
|
||||
|
||||
let visibleShows = $derived(
|
||||
fixedShowId
|
||||
? shows.filter((show) => show.id === fixedShowId)
|
||||
: shows.filter((show) => shares.some((share) => share.showId === show.id))
|
||||
);
|
||||
let dialog: HTMLDialogElement;
|
||||
let copyMessage = $state('');
|
||||
|
||||
onMount(() => {
|
||||
if (form?.intent?.toLowerCase().includes('share')) dialog.showModal();
|
||||
});
|
||||
|
||||
async function copyShareUrl() {
|
||||
if (!form?.shareUrl) return;
|
||||
await navigator.clipboard.writeText(new URL(form.shareUrl, window.location.origin).href);
|
||||
copyMessage = 'Link kopiert.';
|
||||
}
|
||||
|
||||
function germanDate(value: string | null, fallback = 'Termin offen') {
|
||||
return value
|
||||
? new Intl.DateTimeFormat('de-DE', {
|
||||
timeZone: 'Europe/Berlin',
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'short'
|
||||
}).format(new Date(value))
|
||||
: fallback;
|
||||
}
|
||||
|
||||
function berlinInput(value: string | null) {
|
||||
if (!value) return '';
|
||||
const parts = new Intl.DateTimeFormat('en-CA', {
|
||||
timeZone: 'Europe/Berlin',
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hourCycle: 'h23'
|
||||
}).formatToParts(new Date(value));
|
||||
const read = (type: Intl.DateTimeFormatPartTypes) =>
|
||||
parts.find((part) => part.type === type)?.value ?? '';
|
||||
return `${read('year')}-${read('month')}-${read('day')}T${read('hour')}:${read('minute')}`;
|
||||
}
|
||||
|
||||
function statusLabel(status: string) {
|
||||
if (status === 'draft') return 'Entwurf';
|
||||
if (status === 'ready') return 'Bereit';
|
||||
if (status === 'live') return 'Live';
|
||||
return 'Abgeschlossen';
|
||||
}
|
||||
|
||||
function scopeLabel(scope: ShareItem['scope']) {
|
||||
if (scope === 'rundown') return 'Nur Ablauf';
|
||||
if (scope === 'moderation') return 'Ablauf und Moderation';
|
||||
return 'Vollständig mit Recherche';
|
||||
}
|
||||
|
||||
function shareState(share: ShareItem) {
|
||||
if (share.revokedAtUtc) return 'Widerrufen';
|
||||
if (share.expiresAtUtc && new Date(share.expiresAtUtc) <= new Date()) return 'Abgelaufen';
|
||||
return 'Aktiv';
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if catalogPanel}
|
||||
<section class="quiet-panel share-catalog-panel">
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Gastzugänge</p>
|
||||
<h2>Lesefreigaben</h2>
|
||||
</div>
|
||||
<button
|
||||
class="compact-add-button share-dialog-trigger"
|
||||
type="button"
|
||||
aria-label="Lesefreigaben"
|
||||
onclick={() => dialog.showModal()}
|
||||
>
|
||||
<AppIcon name="link" /> Freigaben verwalten
|
||||
</button>
|
||||
</div>
|
||||
<p class="catalog-note">
|
||||
Sendungen gezielt als widerrufbaren Leselink mit wählbarem Informationsumfang teilen.
|
||||
</p>
|
||||
</section>
|
||||
{:else}
|
||||
<button
|
||||
class="secondary-button share-dialog-trigger"
|
||||
type="button"
|
||||
onclick={() => dialog.showModal()}
|
||||
>
|
||||
<AppIcon name="link" /> Lesefreigaben
|
||||
</button>
|
||||
{/if}
|
||||
<dialog bind:this={dialog} class="share-management-dialog">
|
||||
<section class="share-management" aria-labelledby={`share-title-${fixedShowId || 'all'}`}>
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Gastzugänge</p>
|
||||
<h2 id={`share-title-${fixedShowId || 'all'}`}>Lesefreigaben</h2>
|
||||
</div>
|
||||
<span class="mail-mode">Aktualisiert sich bis zum Abschluss</span>
|
||||
<button
|
||||
class="dialog-close"
|
||||
type="button"
|
||||
aria-label="Lesefreigaben schließen"
|
||||
onclick={() => dialog.close()}
|
||||
>
|
||||
<AppIcon name="xmark" />
|
||||
</button>
|
||||
</div>
|
||||
<p class="share-intro">
|
||||
Der Gast sieht nur diese Sendung und den gewählten Informationsumfang. Der vollständige Link
|
||||
wird aus Sicherheitsgründen nur direkt nach dem Anlegen angezeigt.
|
||||
</p>
|
||||
{#if form?.intent?.toLowerCase().includes('share') && form.error}<div
|
||||
class="form-message error"
|
||||
role="alert"
|
||||
>
|
||||
{form.error}
|
||||
</div>{/if}
|
||||
{#if form?.intent?.toLowerCase().includes('share') && typeof form.success === 'string'}<div
|
||||
class="form-message success"
|
||||
role="status"
|
||||
>
|
||||
{form.success}
|
||||
</div>{/if}
|
||||
{#if form?.shareUrl}<div class="form-message success share-result" role="status">
|
||||
<strong>Neuer Leselink</strong>
|
||||
<!-- The server returns only a same-origin share path created by this action. -->
|
||||
<div>
|
||||
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
|
||||
<a href={form.shareUrl}>{form.shareUrl}</a><button
|
||||
class="secondary-button"
|
||||
type="button"
|
||||
onclick={copyShareUrl}><AppIcon name="copy" /> Kopieren</button
|
||||
>
|
||||
</div>
|
||||
{#if copyMessage}<small>{copyMessage}</small>{/if}
|
||||
</div>{/if}
|
||||
|
||||
<form class="share-create-form" method="POST" action="?/createShare">
|
||||
{#if fixedShowId}
|
||||
<input type="hidden" name="showId" value={fixedShowId} />
|
||||
{:else}
|
||||
<label
|
||||
>Sendung<select name="showId" required>
|
||||
<option value="">Sendung wählen</option>
|
||||
{#each shows as show (show.id)}<option value={show.id}
|
||||
>{show.title} · {statusLabel(show.status)}</option
|
||||
>{/each}
|
||||
</select></label
|
||||
>
|
||||
{/if}
|
||||
<label
|
||||
>Informationsumfang<select name="scope">
|
||||
<option value="rundown">Nur Ablauf</option>
|
||||
<option value="moderation">Ablauf und Moderation</option>
|
||||
<option value="research">Vollständig mit Recherche</option>
|
||||
</select></label
|
||||
>
|
||||
<label
|
||||
>Optionales Passwort<input
|
||||
name="password"
|
||||
type="password"
|
||||
minlength="12"
|
||||
maxlength="256"
|
||||
autocomplete="new-password"
|
||||
/></label
|
||||
>
|
||||
<label>Optionaler Ablauf<input name="expiresAt" type="datetime-local" /></label>
|
||||
<button class="primary-button" type="submit" disabled={!shows.length}>Leselink anlegen</button
|
||||
>
|
||||
</form>
|
||||
|
||||
{#if visibleShows.length}
|
||||
<div class="share-show-list">
|
||||
{#each visibleShows as show (show.id)}
|
||||
<article class="share-show-card">
|
||||
<header>
|
||||
<div>
|
||||
<a href={resolve('/sendungen/[id]', { id: show.id })}>{show.title}</a>
|
||||
<small>{germanDate(show.startsAtUtc)} Uhr</small>
|
||||
</div>
|
||||
<span class={`show-state ${show.status}`}>{statusLabel(show.status)}</span>
|
||||
</header>
|
||||
<div class="share-list">
|
||||
{#each shares.filter((share) => share.showId === show.id) as share (share.id)}
|
||||
<details class="share-row">
|
||||
<summary>
|
||||
<span class="share-row-icon"><AppIcon name="link" /></span>
|
||||
<span>
|
||||
<strong>{scopeLabel(share.scope)}</strong>
|
||||
<small
|
||||
>{share.isPasswordProtected ? 'Mit Passwort' : 'Ohne Passwort'} · {germanDate(
|
||||
share.expiresAtUtc,
|
||||
'ohne Ablauf'
|
||||
)}</small
|
||||
>
|
||||
</span>
|
||||
<span class:locked={shareState(share) !== 'Aktiv'}>{shareState(share)}</span>
|
||||
<AppIcon name="pen" />
|
||||
</summary>
|
||||
<div class="share-edit-area">
|
||||
{#if share.revokedAtUtc}
|
||||
<p>Diese Freigabe ist widerrufen und kann nur noch gelöscht werden.</p>
|
||||
{:else}
|
||||
<form class="share-edit-form" method="POST" action="?/updateShare">
|
||||
<input type="hidden" name="shareId" value={share.id} />
|
||||
<input type="hidden" name="showId" value={show.id} />
|
||||
<label
|
||||
>Informationsumfang<select name="scope" value={share.scope}>
|
||||
<option value="rundown">Nur Ablauf</option>
|
||||
<option value="moderation">Ablauf und Moderation</option>
|
||||
<option value="research">Vollständig mit Recherche</option>
|
||||
</select></label
|
||||
>
|
||||
<label
|
||||
>Passwort<select name="passwordMode">
|
||||
<option value="keep">Unverändert</option>
|
||||
<option value="remove">Kein Passwort</option>
|
||||
<option value="replace">Neues Passwort setzen</option>
|
||||
</select></label
|
||||
>
|
||||
<label
|
||||
>Neues Passwort<input
|
||||
name="password"
|
||||
type="password"
|
||||
minlength="12"
|
||||
maxlength="256"
|
||||
autocomplete="new-password"
|
||||
/></label
|
||||
>
|
||||
<label
|
||||
>Ablauf<input
|
||||
name="expiresAt"
|
||||
type="datetime-local"
|
||||
value={berlinInput(share.expiresAtUtc)}
|
||||
/><small>Leer lassen, um den Ablauf zu entfernen.</small></label
|
||||
>
|
||||
<button class="secondary-button" type="submit">Freigabe speichern</button>
|
||||
</form>
|
||||
{/if}
|
||||
{#if !share.revokedAtUtc}<form
|
||||
method="POST"
|
||||
action="?/replaceShare"
|
||||
onsubmit={(event) => {
|
||||
if (
|
||||
!confirm('Ersatzlink anlegen? Der bisherige Link wird sofort ungültig.')
|
||||
)
|
||||
event.preventDefault();
|
||||
}}
|
||||
>
|
||||
<input type="hidden" name="shareId" value={share.id} />
|
||||
<input type="hidden" name="showId" value={show.id} />
|
||||
<button class="text-button" type="submit">Ersatzlink anlegen</button>
|
||||
</form>{/if}
|
||||
<form
|
||||
method="POST"
|
||||
action="?/deleteShare"
|
||||
onsubmit={(event) => {
|
||||
if (
|
||||
!confirm('Freigabe endgültig löschen? Der Leselink wird sofort ungültig.')
|
||||
)
|
||||
event.preventDefault();
|
||||
}}
|
||||
>
|
||||
<input type="hidden" name="shareId" value={share.id} />
|
||||
<input type="hidden" name="showId" value={show.id} />
|
||||
<button class="text-button danger-text" type="submit">Freigabe löschen</button
|
||||
>
|
||||
</form>
|
||||
</div>
|
||||
</details>
|
||||
{/each}
|
||||
{#if !shares.some((share) => share.showId === show.id)}
|
||||
<p class="quiet-copy">Für diese Sendung gibt es noch keine Lesefreigabe.</p>
|
||||
{/if}
|
||||
</div>
|
||||
</article>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<p class="quiet-copy">Noch keine Lesefreigaben angelegt.</p>
|
||||
{/if}
|
||||
</section>
|
||||
</dialog>
|
||||
@@ -0,0 +1,128 @@
|
||||
<script lang="ts">
|
||||
import { onMount, tick } from 'svelte';
|
||||
import AppIcon from './AppIcon.svelte';
|
||||
type TechnicalAccess = {
|
||||
id: string;
|
||||
name: string;
|
||||
permissions: 'read' | 'read_write';
|
||||
};
|
||||
|
||||
let {
|
||||
form = null
|
||||
}: {
|
||||
form?: {
|
||||
intent?: string;
|
||||
error?: string;
|
||||
success?: string | boolean;
|
||||
technicalToken?: string;
|
||||
} | null;
|
||||
} = $props();
|
||||
let dialog: HTMLDialogElement;
|
||||
let nameInput = $state<HTMLInputElement>();
|
||||
let copyMessage = $state('');
|
||||
let access = $state<TechnicalAccess | null>(null);
|
||||
let name = $state('');
|
||||
let permissions = $state<'read' | 'read_write'>('read');
|
||||
|
||||
onMount(() => {
|
||||
if (form?.intent === 'technicalAccess' && (form.error || form.technicalToken)) void showModal();
|
||||
});
|
||||
|
||||
export async function showModal(selectedAccess: TechnicalAccess | null = null) {
|
||||
access = selectedAccess;
|
||||
name = selectedAccess?.name ?? '';
|
||||
permissions = selectedAccess?.permissions ?? 'read';
|
||||
if (!dialog.open) dialog.showModal();
|
||||
await tick();
|
||||
(form?.technicalToken && !access
|
||||
? dialog.querySelector<HTMLButtonElement>('.token-copy')
|
||||
: nameInput
|
||||
)?.focus();
|
||||
}
|
||||
|
||||
function close() {
|
||||
dialog.close();
|
||||
}
|
||||
|
||||
async function copyToken() {
|
||||
if (!form?.technicalToken) return;
|
||||
try {
|
||||
await navigator.clipboard.writeText(form.technicalToken);
|
||||
copyMessage = 'Token kopiert.';
|
||||
} catch {
|
||||
copyMessage = 'Kopieren wurde vom Browser blockiert.';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<dialog
|
||||
bind:this={dialog}
|
||||
class="management-dialog technical-access-dialog"
|
||||
aria-labelledby="technical-access-dialog-title"
|
||||
onclick={(event) => event.target === dialog && close()}
|
||||
>
|
||||
<header>
|
||||
<div class="management-dialog-title">
|
||||
<span class="management-dialog-icon"><AppIcon name="key" /></span>
|
||||
<div>
|
||||
<p class="eyebrow">Externe Assistenz</p>
|
||||
<h2 id="technical-access-dialog-title">{access?.name || 'API-Zugang hinzufügen'}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<button class="dialog-close" type="button" aria-label="Zugangsdialog schließen" onclick={close}
|
||||
><AppIcon name="xmark" /></button
|
||||
>
|
||||
</header>
|
||||
{#if form?.technicalToken && !access}
|
||||
<div class="technical-token-result">
|
||||
<div class="form-message success" role="status">
|
||||
<strong>Token, einmalig sichtbar</strong>
|
||||
<p>Jetzt kopieren und sicher hinterlegen. Sendewerk speichert weiterhin nur den Hash.</p>
|
||||
</div>
|
||||
<code>{form.technicalToken}</code>
|
||||
<button class="primary-button token-copy" type="button" onclick={copyToken}
|
||||
><AppIcon name="copy" /> Token kopieren</button
|
||||
>
|
||||
{#if copyMessage}<small role="status">{copyMessage}</small>{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<form
|
||||
class="management-dialog-form"
|
||||
method="POST"
|
||||
action={access ? '?/updateTechnicalAccess' : '?/createTechnicalAccess'}
|
||||
>
|
||||
{#if access}<input type="hidden" name="accessId" value={access.id} />{/if}
|
||||
{#if form?.intent === 'technicalAccess' && form.error}<div
|
||||
class="form-message error dialog-form-message"
|
||||
role="alert"
|
||||
>
|
||||
{form.error}
|
||||
</div>{/if}
|
||||
<div class="management-dialog-fields">
|
||||
<label
|
||||
>Name<input
|
||||
bind:this={nameInput}
|
||||
bind:value={name}
|
||||
name="name"
|
||||
required
|
||||
maxlength="120"
|
||||
placeholder="Redaktionsassistenz"
|
||||
/></label
|
||||
>
|
||||
<label
|
||||
>Berechtigung<select bind:value={permissions} name="permissions"
|
||||
><option value="read">Nur lesen</option><option value="read_write"
|
||||
>Lesen und schreiben</option
|
||||
></select
|
||||
></label
|
||||
>
|
||||
</div>
|
||||
<footer>
|
||||
<button class="secondary-button" type="button" onclick={close}>Abbrechen</button>
|
||||
<button class="primary-button" type="submit"
|
||||
>{access ? 'Änderungen speichern' : 'Zugang anlegen'}</button
|
||||
>
|
||||
</footer>
|
||||
</form>
|
||||
{/if}
|
||||
</dialog>
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import AppIcon from './AppIcon.svelte';
|
||||
|
||||
type Preference = 'system' | 'light' | 'dark';
|
||||
const preferences: Preference[] = ['system', 'light', 'dark'];
|
||||
@@ -42,8 +43,10 @@
|
||||
onclick={cycle}
|
||||
aria-label={`Darstellung: ${labels[preference]}`}
|
||||
>
|
||||
<span class="theme-symbol" aria-hidden="true">
|
||||
{preference === 'system' ? '◐' : preference === 'light' ? '○' : '●'}
|
||||
</span>
|
||||
<span class="theme-symbol" aria-hidden="true"
|
||||
><AppIcon
|
||||
name={preference === 'system' ? 'display' : preference === 'light' ? 'sun' : 'moon'}
|
||||
/></span
|
||||
>
|
||||
<span>{labels[preference]}</span>
|
||||
</button>
|
||||
@@ -0,0 +1,125 @@
|
||||
<script lang="ts">
|
||||
import { tick } from 'svelte';
|
||||
import AppIcon from './AppIcon.svelte';
|
||||
import ChoicePicker from './ChoicePicker.svelte';
|
||||
import IconPicker from './IconPicker.svelte';
|
||||
|
||||
type Format = { id: string; name: string };
|
||||
type Tool = {
|
||||
id: string;
|
||||
name: string;
|
||||
startUrl: string;
|
||||
description: string;
|
||||
iconName: string;
|
||||
isActive: boolean;
|
||||
formatIds: string[];
|
||||
};
|
||||
|
||||
let { formats }: { formats: Format[] } = $props();
|
||||
let dialog: HTMLDialogElement;
|
||||
let nameInput: HTMLInputElement;
|
||||
let tool = $state<Tool | null>(null);
|
||||
let name = $state('');
|
||||
let startUrl = $state('');
|
||||
let description = $state('');
|
||||
let iconName = $state('wrench');
|
||||
let isActive = $state(true);
|
||||
let formatIds = $state<string[]>([]);
|
||||
|
||||
export async function showModal(selectedTool: Tool | null = null) {
|
||||
tool = selectedTool;
|
||||
name = selectedTool?.name ?? '';
|
||||
startUrl = selectedTool?.startUrl ?? '';
|
||||
description = selectedTool?.description ?? '';
|
||||
iconName = selectedTool?.iconName || 'wrench';
|
||||
isActive = selectedTool?.isActive ?? true;
|
||||
formatIds = [...(selectedTool?.formatIds ?? [])];
|
||||
dialog.showModal();
|
||||
await tick();
|
||||
nameInput.focus();
|
||||
}
|
||||
|
||||
function close() {
|
||||
dialog.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<dialog
|
||||
bind:this={dialog}
|
||||
class="management-dialog tool-editor-dialog"
|
||||
aria-labelledby="tool-dialog-title"
|
||||
onclick={(event) => event.target === dialog && close()}
|
||||
>
|
||||
<header>
|
||||
<div class="management-dialog-title">
|
||||
<span class="management-dialog-icon"><AppIcon name={iconName || 'wrench'} /></span>
|
||||
<div>
|
||||
<p class="eyebrow">{tool ? 'Werkzeug bearbeiten' : 'Werkzeug hinzufügen'}</p>
|
||||
<h2 id="tool-dialog-title">{tool?.name || 'Neues Werkzeug'}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<button class="dialog-close" type="button" aria-label="Werkzeugdialog schließen" onclick={close}
|
||||
><AppIcon name="xmark" /></button
|
||||
>
|
||||
</header>
|
||||
<form
|
||||
class="management-dialog-form"
|
||||
method="POST"
|
||||
action={tool ? '?/updateTool' : '?/createTool'}
|
||||
>
|
||||
{#if tool}<input type="hidden" name="toolId" value={tool.id} />{/if}
|
||||
<div class="management-dialog-fields">
|
||||
<label
|
||||
>Name<input
|
||||
bind:this={nameInput}
|
||||
bind:value={name}
|
||||
name="name"
|
||||
required
|
||||
maxlength="120"
|
||||
/></label
|
||||
>
|
||||
<label
|
||||
>Start-URL<input
|
||||
bind:value={startUrl}
|
||||
name="startUrl"
|
||||
type="url"
|
||||
maxlength="2000"
|
||||
placeholder="https://…"
|
||||
/></label
|
||||
>
|
||||
<label class="wide-field"
|
||||
>Beschreibung<textarea bind:value={description} name="description" rows="3" maxlength="2000"
|
||||
></textarea></label
|
||||
>
|
||||
</div>
|
||||
<div class="management-dialog-selections">
|
||||
<div>
|
||||
<span class="field-label">Icon</span>
|
||||
<IconPicker bind:name={iconName} />
|
||||
</div>
|
||||
<div>
|
||||
<span class="field-label">Passende Formate</span>
|
||||
<ChoicePicker
|
||||
items={formats}
|
||||
selectedIds={formatIds}
|
||||
label="Formate"
|
||||
fieldName="formatIds"
|
||||
onselectionchange={(ids) => (formatIds = ids)}
|
||||
/>
|
||||
</div>
|
||||
<label class="toggle-row"
|
||||
><input type="checkbox" name="isActive" value="1" bind:checked={isActive} /><span
|
||||
><strong>Aktiv</strong><small
|
||||
>Deaktivierte Werkzeuge bleiben in bestehenden Pieces erhalten.</small
|
||||
></span
|
||||
></label
|
||||
>
|
||||
</div>
|
||||
<footer>
|
||||
<button class="secondary-button" type="button" onclick={close}>Abbrechen</button>
|
||||
<button class="primary-button" type="submit"
|
||||
>{tool ? 'Änderungen speichern' : 'Werkzeug anlegen'}</button
|
||||
>
|
||||
</footer>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -0,0 +1,490 @@
|
||||
<script lang="ts">
|
||||
import { enhance, type SubmitFunction } from '$app/forms';
|
||||
import { onMount, untrack } from 'svelte';
|
||||
import MarkdownEditorField from './MarkdownEditorField.svelte';
|
||||
import InlineTitleEditor from './InlineTitleEditor.svelte';
|
||||
import NavIcon from './NavIcon.svelte';
|
||||
import PieceEditorDialog from './PieceEditorDialog.svelte';
|
||||
import PresentationDisplay from './PresentationDisplay.svelte';
|
||||
import type { PieceUsage } from '#lib/server/shows.js';
|
||||
|
||||
let {
|
||||
usage,
|
||||
revision,
|
||||
sectionId,
|
||||
sections,
|
||||
error,
|
||||
enhanceCommand,
|
||||
open = false
|
||||
}: {
|
||||
usage: PieceUsage;
|
||||
revision: number;
|
||||
sectionId: string;
|
||||
sections: { id: string; name: string }[];
|
||||
error?: string;
|
||||
enhanceCommand: SubmitFunction;
|
||||
open?: boolean;
|
||||
} = $props();
|
||||
|
||||
let formId = $derived(`usage-editor-form-${usage.id}`);
|
||||
let editor: { showModal: () => void; close: () => void };
|
||||
let activeSection = $state<'script' | 'research' | 'presentation'>('script');
|
||||
let draft = $state(
|
||||
untrack(() => ({ ...usage, tools: usage.tools.map((tool) => ({ ...tool })) }))
|
||||
);
|
||||
let dirty = $state(false);
|
||||
let selectedSourceId = $state(
|
||||
untrack(
|
||||
() => usage.sources.find((source) => source.url === usage.presentationSourceUrl)?.id ?? ''
|
||||
)
|
||||
);
|
||||
onMount(() => {
|
||||
if (open) editor.showModal();
|
||||
});
|
||||
let selectedMedia = $derived(
|
||||
draft.media.find((media) => media.id === draft.presentationMediaId) ?? null
|
||||
);
|
||||
|
||||
function durationInMinutes(seconds: number) {
|
||||
return Number((seconds / 60).toFixed(2));
|
||||
}
|
||||
|
||||
function previewHtml(value: string) {
|
||||
return value
|
||||
.replaceAll('&', '&')
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll("'", ''')
|
||||
.replaceAll('\n', '<br>');
|
||||
}
|
||||
|
||||
function requestClose() {
|
||||
if (dirty && !confirm('Ungespeicherte Änderungen verwerfen und Editor schließen?')) return;
|
||||
dirty = false;
|
||||
editor.close();
|
||||
}
|
||||
|
||||
function presentationSourceChanged(event: Event) {
|
||||
selectedSourceId = (event.currentTarget as HTMLSelectElement).value;
|
||||
const source = draft.sources.find((item) => item.id === selectedSourceId);
|
||||
if (!source) return;
|
||||
draft.presentationSourceLabel = source.label;
|
||||
draft.presentationSourceUrl = source.url;
|
||||
draft.presentationSourceTimecodeSeconds = source.timecodeSeconds;
|
||||
}
|
||||
|
||||
let previewContent = $derived({
|
||||
mode: draft.presentationMode,
|
||||
topics: draft.topics.map((topic) => topic.name),
|
||||
title: draft.outputTitle || draft.title,
|
||||
html: previewHtml(draft.presentation),
|
||||
source: draft.presentationSourceUrl
|
||||
? {
|
||||
label: draft.presentationSourceLabel,
|
||||
url: draft.presentationSourceUrl,
|
||||
timecodeSeconds: draft.presentationSourceTimecodeSeconds
|
||||
}
|
||||
: null,
|
||||
previewTitle: draft.presentationTitle,
|
||||
description: draft.presentationDescription,
|
||||
imageUrl: draft.presentationMode === 'link' ? draft.presentationImageUrl : '',
|
||||
siteName: draft.presentationSiteName,
|
||||
provider: draft.presentationProvider,
|
||||
providerId: draft.presentationProviderId,
|
||||
embedUrl: '',
|
||||
sources: [],
|
||||
images: selectedMedia
|
||||
? [{ id: selectedMedia.originalMediaId, altText: selectedMedia.altText }]
|
||||
: []
|
||||
});
|
||||
let previewImageSrc = $derived(
|
||||
selectedMedia && draft.presentationMode === 'text'
|
||||
? '/media'
|
||||
: selectedMedia && draft.presentationMode === 'image'
|
||||
? `/media/${selectedMedia.originalMediaId}`
|
||||
: ''
|
||||
);
|
||||
|
||||
const enhanceEditor: SubmitFunction = async (input) => {
|
||||
const finish = await enhanceCommand(input);
|
||||
return async (result) => {
|
||||
if (finish) await finish(result);
|
||||
if (result.result.type === 'success') dirty = false;
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<button
|
||||
class="usage-edit-button"
|
||||
type="button"
|
||||
aria-label={`${usage.title} bearbeiten und verschieben`}
|
||||
title="Bearbeiten und verschieben"
|
||||
onclick={() => editor.showModal()}
|
||||
>
|
||||
<NavIcon name="edit" />
|
||||
</button>
|
||||
|
||||
<PieceEditorDialog
|
||||
bind:this={editor}
|
||||
bind:activeSection
|
||||
labelledby={`usage-editor-title-${usage.id}`}
|
||||
onrequestclose={requestClose}
|
||||
>
|
||||
{#snippet header()}
|
||||
<p class="eyebrow">Sendungsfassung</p>
|
||||
<InlineTitleEditor form={formId} bind:value={draft.title} oncommit={() => (dirty = true)} />
|
||||
<h2 class="sr-only" id={`usage-editor-title-${usage.id}`}>{draft.title}</h2>
|
||||
{/snippet}
|
||||
|
||||
<form
|
||||
id={formId}
|
||||
use:enhance={enhanceEditor}
|
||||
method="POST"
|
||||
action="?/updateUsage"
|
||||
class="piece-dialog-form"
|
||||
oninput={() => (dirty = true)}
|
||||
onchange={() => (dirty = true)}
|
||||
>
|
||||
<input type="hidden" name="revision" value={revision} />
|
||||
<input type="hidden" name="usageId" value={usage.id} />
|
||||
|
||||
<section class="piece-editor-panel" hidden={activeSection !== 'script'}>
|
||||
<div class="piece-panel-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Für die Moderation</p>
|
||||
<h3>Sendungstext</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="piece-writing-stack">
|
||||
<MarkdownEditorField
|
||||
name="intro"
|
||||
label="Einleitung"
|
||||
placeholder="Wie beginnt dieses Thema in der Sendung?"
|
||||
bind:value={draft.intro}
|
||||
/>
|
||||
<MarkdownEditorField
|
||||
name="moderation"
|
||||
label="Moderationsstichpunkte"
|
||||
placeholder="Argumente, Fragen und Ablaufpunkte"
|
||||
rows={10}
|
||||
bind:value={draft.moderation}
|
||||
/>
|
||||
<MarkdownEditorField
|
||||
name="interaction"
|
||||
label="Interaktion"
|
||||
placeholder="Welche Frage möchtest du dem Chat stellen?"
|
||||
privateField
|
||||
bind:value={draft.interaction}
|
||||
/>
|
||||
<MarkdownEditorField
|
||||
name="transition"
|
||||
label="Überleitung"
|
||||
placeholder="Wie geht es zum nächsten Thema weiter?"
|
||||
bind:value={draft.transition}
|
||||
/>
|
||||
</div>
|
||||
<details class="piece-meta-details">
|
||||
<summary>Dauer und Einplanung</summary>
|
||||
<div class="piece-meta-grid">
|
||||
<label
|
||||
>Vorbereitungsstatus<select
|
||||
name="preparationStatus"
|
||||
bind:value={draft.preparationStatus}
|
||||
>
|
||||
<option value="preparing">In Vorbereitung</option>
|
||||
<option value="ready">Sendefertig</option>
|
||||
</select></label
|
||||
>
|
||||
<label
|
||||
>Vorbereitungsaufwand<select
|
||||
name="preparationEffort"
|
||||
bind:value={draft.preparationEffort}
|
||||
>
|
||||
<option value={null}>Nicht angegeben</option>
|
||||
<option value="low">Gering</option>
|
||||
<option value="medium">Mittel</option>
|
||||
<option value="high">Hoch</option>
|
||||
</select></label
|
||||
>
|
||||
<label
|
||||
>Dauer in Minuten<input
|
||||
name="durationMinutes"
|
||||
type="number"
|
||||
min="0"
|
||||
max="1440"
|
||||
step="any"
|
||||
value={durationInMinutes(usage.durationSeconds)}
|
||||
/></label
|
||||
>
|
||||
</div>
|
||||
</details>
|
||||
</section>
|
||||
|
||||
<section class="piece-editor-panel" hidden={activeSection !== 'research'}>
|
||||
<div class="piece-panel-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Nicht öffentlich</p>
|
||||
<h3>Recherche & Quellen</h3>
|
||||
</div>
|
||||
<small>Diese Inhalte bleiben innerhalb der Redaktion.</small>
|
||||
</div>
|
||||
<div class="piece-writing-stack">
|
||||
<MarkdownEditorField
|
||||
name="research"
|
||||
label="Private Recherche"
|
||||
placeholder="Hintergrund, Prüfung und offene Fragen"
|
||||
rows={10}
|
||||
privateField
|
||||
bind:value={draft.research}
|
||||
/>
|
||||
<MarkdownEditorField
|
||||
name="ownNotes"
|
||||
label="Interne Notizen zu dieser Verwendung"
|
||||
placeholder="Absprachen und Hinweise nur für diese Sendung"
|
||||
privateField
|
||||
bind:value={draft.ownNotes}
|
||||
/>
|
||||
</div>
|
||||
<section class="piece-source-summary">
|
||||
<p class="eyebrow">Snapshot-Quellen</p>
|
||||
{#if draft.sources.length}
|
||||
{#each draft.sources as source (source.id)}<div>
|
||||
<strong>{source.label}</strong><small>{source.url}</small>
|
||||
</div>{/each}
|
||||
{:else}<p>Für diese Verwendung wurden keine Quellen kopiert.</p>{/if}
|
||||
</section>
|
||||
<section class="piece-source-editor">
|
||||
<div class="piece-subsection-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Snapshot</p>
|
||||
<h3>Werkzeuge</h3>
|
||||
</div>
|
||||
<small>Name und Start-URL bleiben Teil der Sendungsfassung.</small>
|
||||
</div>
|
||||
{#if draft.tools.length}<div class="source-list">
|
||||
{#each draft.tools as tool (tool.id)}<div class="source-row tool-assignment-row">
|
||||
<input type="hidden" name="usageToolId" value={tool.id} />
|
||||
<div class="tool-assignment-name">
|
||||
<strong>{tool.name}</strong>{#if tool.startUrl}<small>{tool.startUrl}</small>{/if}
|
||||
</div>
|
||||
<label
|
||||
>Arbeitslink<input
|
||||
name="toolWorkUrl"
|
||||
type="url"
|
||||
maxlength="2000"
|
||||
placeholder={tool.startUrl || 'https://…'}
|
||||
bind:value={tool.workUrl}
|
||||
/></label
|
||||
>
|
||||
<label>Notiz<input name="toolNote" maxlength="2000" bind:value={tool.note} /></label
|
||||
>
|
||||
</div>{/each}
|
||||
</div>{:else}<p class="context-empty">Keine Werkzeuge in dieser Sendungsfassung.</p>{/if}
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section class="piece-editor-panel" hidden={activeSection !== 'presentation'}>
|
||||
<div class="piece-panel-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Öffentliche Ausgabe</p>
|
||||
<h3>Präsentation</h3>
|
||||
</div>
|
||||
<small>Private Recherche und Notizen werden nicht ausgegeben.</small>
|
||||
</div>
|
||||
<div class="piece-presentation-layout">
|
||||
<div class="piece-presentation-controls">
|
||||
<p class="field-label">Präsentationsart</p>
|
||||
<div class="presentation-mode-picker" role="group" aria-label="Darstellung">
|
||||
{#each [['text', 'Text'], ['image', 'Nur Bild'], ['link', 'Linkvorschau'], ['video', 'Video']] as mode (mode[0])}
|
||||
<label
|
||||
><input
|
||||
type="radio"
|
||||
name="presentationMode"
|
||||
value={mode[0]}
|
||||
bind:group={draft.presentationMode}
|
||||
/>{mode[1]}</label
|
||||
>
|
||||
{/each}
|
||||
</div>
|
||||
{#if draft.presentationMode === 'text'}
|
||||
<label
|
||||
>Öffentliche Überschrift<input
|
||||
name="outputTitle"
|
||||
maxlength="300"
|
||||
placeholder="Optional, sonst interner Titel"
|
||||
bind:value={draft.outputTitle}
|
||||
/></label
|
||||
>
|
||||
<MarkdownEditorField
|
||||
name="presentation"
|
||||
label="Öffentlicher Vorspann"
|
||||
placeholder="Text für die Publikumsausgabe"
|
||||
bind:value={draft.presentation}
|
||||
/>
|
||||
{:else}
|
||||
<input type="hidden" name="outputTitle" value={draft.outputTitle} />
|
||||
<input type="hidden" name="presentation" value={draft.presentation} />
|
||||
{/if}
|
||||
<input
|
||||
type="hidden"
|
||||
name="presentationSourceLabel"
|
||||
value={draft.presentationSourceLabel}
|
||||
/>
|
||||
<input type="hidden" name="presentationSourceUrl" value={draft.presentationSourceUrl} />
|
||||
<input
|
||||
type="hidden"
|
||||
name="presentationSourceTimecodeSeconds"
|
||||
value={draft.presentationSourceTimecodeSeconds ?? ''}
|
||||
/>
|
||||
<input type="hidden" name="presentationSiteName" value={draft.presentationSiteName} />
|
||||
<input type="hidden" name="presentationMediaId" value={draft.presentationMediaId ?? ''} />
|
||||
{#if draft.presentationMode === 'link' || draft.presentationMode === 'video'}
|
||||
<div class="presentation-settings">
|
||||
<label class="wide-field"
|
||||
>{draft.presentationMode === 'video' ? 'Video-URL' : 'Quelle/URL'}<select
|
||||
bind:value={selectedSourceId}
|
||||
onchange={presentationSourceChanged}
|
||||
>
|
||||
<option value="">Quelle auswählen</option>
|
||||
{#each draft.sources as source (source.id)}
|
||||
<option value={source.id}>{source.label || source.url}</option>
|
||||
{/each}
|
||||
</select></label
|
||||
>
|
||||
<label
|
||||
>{draft.presentationMode === 'video' ? 'Videotitel' : 'Kartentitel'}<input
|
||||
name="presentationTitle"
|
||||
maxlength="300"
|
||||
placeholder="Optionaler Anzeigetitel"
|
||||
bind:value={draft.presentationTitle}
|
||||
/></label
|
||||
>
|
||||
{#if draft.presentationMode === 'link'}
|
||||
<label
|
||||
>Vorschaubild-URL<input
|
||||
name="presentationImageUrl"
|
||||
type="url"
|
||||
maxlength="2000"
|
||||
placeholder="Aus der Linkvorschau"
|
||||
bind:value={draft.presentationImageUrl}
|
||||
/></label
|
||||
>
|
||||
{:else}
|
||||
<input
|
||||
type="hidden"
|
||||
name="presentationImageUrl"
|
||||
value={draft.presentationImageUrl}
|
||||
/>
|
||||
{/if}
|
||||
<label class="wide-field"
|
||||
>Anreißer<textarea
|
||||
name="presentationDescription"
|
||||
rows="3"
|
||||
maxlength="1000"
|
||||
placeholder="Kurzer Text zur Vorschau"
|
||||
bind:value={draft.presentationDescription}></textarea></label
|
||||
>
|
||||
</div>
|
||||
{:else}
|
||||
<input type="hidden" name="presentationTitle" value={draft.presentationTitle} />
|
||||
<input
|
||||
type="hidden"
|
||||
name="presentationDescription"
|
||||
value={draft.presentationDescription}
|
||||
/>
|
||||
<input type="hidden" name="presentationImageUrl" value={draft.presentationImageUrl} />
|
||||
{/if}
|
||||
</div>
|
||||
{#if draft.media.length && ['text', 'image'].includes(draft.presentationMode)}<fieldset
|
||||
class="usage-media-picker"
|
||||
>
|
||||
<legend>Hochgeladenes Präsentationsbild</legend>
|
||||
{#if draft.presentationMode === 'text'}<label
|
||||
><input
|
||||
type="radio"
|
||||
checked={!draft.presentationMediaId}
|
||||
onchange={() => {
|
||||
draft.presentationMediaId = null;
|
||||
dirty = true;
|
||||
}}
|
||||
/> Kein Bild</label
|
||||
>{/if}
|
||||
<div class="media-grid">
|
||||
{#each draft.media as media (media.id)}<label class="media-presentation-choice"
|
||||
><input
|
||||
type="radio"
|
||||
checked={draft.presentationMediaId === media.id}
|
||||
onchange={() => {
|
||||
draft.presentationMediaId = media.id;
|
||||
dirty = true;
|
||||
}}
|
||||
/><img src={`/media/${media.originalMediaId}`} alt={media.altText} /><span
|
||||
>Auswählen</span
|
||||
></label
|
||||
>{/each}
|
||||
</div>
|
||||
</fieldset>{/if}
|
||||
<aside class="piece-presentation-preview" aria-label="Präsentationsvorschau">
|
||||
<PresentationDisplay content={previewContent} imageSrc={previewImageSrc} />
|
||||
</aside>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
|
||||
{#snippet footer()}
|
||||
<div class="piece-dialog-secondary-actions">
|
||||
<form use:enhance={enhanceCommand} method="POST" action="?/refreshUsage">
|
||||
<input type="hidden" name="revision" value={revision} />
|
||||
<input type="hidden" name="usageId" value={usage.id} />
|
||||
<button class="text-button" type="submit" disabled={!usage.originalPieceId || dirty}
|
||||
>Aus Fundus aktualisieren</button
|
||||
>
|
||||
</form>
|
||||
<form use:enhance={enhanceCommand} method="POST" action="?/duplicateUsage">
|
||||
<input type="hidden" name="revision" value={revision} /><input
|
||||
type="hidden"
|
||||
name="usageId"
|
||||
value={usage.id}
|
||||
/>
|
||||
<button class="text-button" type="submit" disabled={dirty}>Duplizieren</button>
|
||||
</form>
|
||||
<form use:enhance={enhanceCommand} method="POST" action="?/moveUsage">
|
||||
<input type="hidden" name="revision" value={revision} /><input
|
||||
type="hidden"
|
||||
name="usageId"
|
||||
value={usage.id}
|
||||
/><input type="hidden" name="position" value="9999" />
|
||||
<label
|
||||
><span class="sr-only">Ziel</span><select name="sectionId"
|
||||
><option value="">Reservebank</option>{#each sections as target (target.id)}<option
|
||||
value={target.id}
|
||||
selected={target.id === sectionId}>{target.name}</option
|
||||
>{/each}</select
|
||||
></label
|
||||
>
|
||||
<button class="text-button" type="submit" disabled={dirty}>Verschieben</button>
|
||||
</form>
|
||||
<form
|
||||
use:enhance={enhanceCommand}
|
||||
method="POST"
|
||||
action="?/removeUsage"
|
||||
onsubmit={(event) =>
|
||||
!confirm('Piece aus dieser Sendung entfernen?') && event.preventDefault()}
|
||||
>
|
||||
<input type="hidden" name="revision" value={revision} /><input
|
||||
type="hidden"
|
||||
name="usageId"
|
||||
value={usage.id}
|
||||
/>
|
||||
<button class="text-button danger-text" type="submit" disabled={dirty}
|
||||
>Aus Sendung entfernen</button
|
||||
>
|
||||
</form>
|
||||
</div>
|
||||
<div class="piece-dialog-primary-action">
|
||||
{#if error}<span class="problem" role="alert">{error}</span>{/if}
|
||||
<button class="primary-button" type="submit" form={formId}>Verwendung speichern</button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</PieceEditorDialog>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,47 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
|
||||
export async function apiBody(request: Request) {
|
||||
const type = request.headers.get('content-type') ?? '';
|
||||
if (!type.includes('application/json')) throw new Error('API_JSON_REQUIRED');
|
||||
try {
|
||||
return (await request.json()) as Record<string, unknown>;
|
||||
} catch {
|
||||
throw new Error('API_INVALID_JSON');
|
||||
}
|
||||
}
|
||||
|
||||
export function apiFailure(cause: unknown) {
|
||||
const code = cause instanceof Error ? cause.message : 'API_ERROR';
|
||||
const status =
|
||||
code === 'API_UNAUTHORIZED'
|
||||
? 401
|
||||
: code === 'API_FORBIDDEN'
|
||||
? 403
|
||||
: code === 'NOT_FOUND'
|
||||
? 404
|
||||
: code === 'CONFLICT' || code === 'API_IDEMPOTENCY_CONFLICT'
|
||||
? 409
|
||||
: 400;
|
||||
return json(
|
||||
{
|
||||
error: {
|
||||
code,
|
||||
message:
|
||||
status === 401
|
||||
? 'Authentifizierung erforderlich.'
|
||||
: status === 403
|
||||
? 'Diese Berechtigung fehlt.'
|
||||
: status === 404
|
||||
? 'Nicht gefunden.'
|
||||
: 'Anfrage konnte nicht verarbeitet werden.'
|
||||
}
|
||||
},
|
||||
{ status }
|
||||
);
|
||||
}
|
||||
|
||||
export function pageInput(url: URL) {
|
||||
const limit = Math.min(100, Math.max(1, Number(url.searchParams.get('limit') ?? 50) || 50));
|
||||
const offset = Math.max(0, Number(url.searchParams.get('offset') ?? 0) || 0);
|
||||
return { limit, offset };
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
import Database from 'better-sqlite3';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { readFileSync, readdirSync, mkdtempSync, rmSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import type { Cookies } from '@sveltejs/kit';
|
||||
|
||||
const temporaryDirectories: string[] = [];
|
||||
let directory: string;
|
||||
let databasePath: string;
|
||||
|
||||
function testCookies(): Cookies {
|
||||
const values = new Map<string, string>();
|
||||
return {
|
||||
get: (name: string) => values.get(name),
|
||||
getAll: () => Array.from(values, ([name, value]) => ({ name, value })),
|
||||
set: (name: string, value: string) => {
|
||||
values.set(name, value);
|
||||
},
|
||||
delete: (name: string) => {
|
||||
values.delete(name);
|
||||
},
|
||||
serialize: () => ''
|
||||
} as unknown as Cookies;
|
||||
}
|
||||
|
||||
function tokenFromLatestMail(): string {
|
||||
const outbox = path.join(directory, 'outbox');
|
||||
const files = readdirSync(outbox).sort();
|
||||
const message = JSON.parse(readFileSync(path.join(outbox, files.at(-1)!), 'utf8')) as {
|
||||
text: string;
|
||||
};
|
||||
const match = message.text.match(/[?&]token=([^\s]+)/);
|
||||
if (!match) throw new Error('Testmail enthält keinen Token.');
|
||||
return decodeURIComponent(match[1]);
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
directory = mkdtempSync(path.join(tmpdir(), 'sendewerk-auth-test-'));
|
||||
temporaryDirectories.push(directory);
|
||||
databasePath = path.join(directory, 'test.sqlite');
|
||||
process.env.SENDEWERK_DB_PATH = databasePath;
|
||||
process.env.SENDEWERK_UPLOAD_DIR = path.join(directory, 'uploads');
|
||||
process.env.SENDEWERK_MAIL_OUTBOX_DIR = path.join(directory, 'outbox');
|
||||
process.env.SENDEWERK_MAIL_TRANSPORT = 'local';
|
||||
process.env.SENDEWERK_APP_ORIGIN = 'http://localhost:5173';
|
||||
process.env.SENDEWERK_SETUP_TOKEN = 'a'.repeat(32);
|
||||
execFileSync(process.execPath, ['scripts/migrate.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const { closeDatabase } = await import('./database.js');
|
||||
closeDatabase();
|
||||
for (const name of [
|
||||
'SENDEWERK_DB_PATH',
|
||||
'SENDEWERK_UPLOAD_DIR',
|
||||
'SENDEWERK_MAIL_OUTBOX_DIR',
|
||||
'SENDEWERK_MAIL_TRANSPORT',
|
||||
'SENDEWERK_MAIL_FROM',
|
||||
'SENDEWERK_SMTP_HOST',
|
||||
'SENDEWERK_APP_ORIGIN',
|
||||
'SENDEWERK_SETUP_TOKEN'
|
||||
]) {
|
||||
delete process.env[name];
|
||||
}
|
||||
for (const temporaryDirectory of temporaryDirectories.splice(0)) {
|
||||
rmSync(temporaryDirectory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
describe('authentication', () => {
|
||||
it('stores the show overview preference per user', async () => {
|
||||
const { createFirstAdmin, getShowOverviewView, setShowOverviewView } =
|
||||
await import('./auth.js');
|
||||
const user = await createFirstAdmin({
|
||||
setupToken: 'a'.repeat(32),
|
||||
email: 'calendar@example.test',
|
||||
displayName: 'Kalender Test',
|
||||
password: 'a-valid-password-123'
|
||||
});
|
||||
expect(getShowOverviewView(user.id)).toBe('list');
|
||||
expect(setShowOverviewView(user.id, 'calendar')).toBe('calendar');
|
||||
expect(getShowOverviewView(user.id)).toBe('calendar');
|
||||
expect(() => setShowOverviewView(user.id, 'invalid')).toThrow('INVALID_VIEW');
|
||||
});
|
||||
|
||||
it('creates the first Barkeeper once and stores no plaintext secret', async () => {
|
||||
const { createFirstAdmin } = await import('./auth.js');
|
||||
const password = 'Ein-sehr-langes-Testpasswort';
|
||||
const user = await createFirstAdmin({
|
||||
setupToken: 'a'.repeat(32),
|
||||
email: 'Bar@example.org',
|
||||
displayName: 'Erster Barkeeper',
|
||||
password
|
||||
});
|
||||
const database = new Database(databasePath, { readonly: true });
|
||||
const row = database.prepare('SELECT * FROM users').get() as {
|
||||
role: string;
|
||||
email_normalized: string;
|
||||
password_hash: string;
|
||||
};
|
||||
database.close();
|
||||
|
||||
expect(user.role).toBe('barkeeper');
|
||||
expect(row.email_normalized).toBe('bar@example.org');
|
||||
expect(row.password_hash).not.toContain(password);
|
||||
await expect(
|
||||
createFirstAdmin({
|
||||
setupToken: 'a'.repeat(32),
|
||||
email: 'second@example.org',
|
||||
displayName: 'Zweiter Admin',
|
||||
password
|
||||
})
|
||||
).rejects.toThrow('SETUP_CLOSED');
|
||||
});
|
||||
|
||||
it('accepts an invitation only once and rejects an expired invitation', async () => {
|
||||
const { acceptInvitation, createFirstAdmin, inviteUser } = await import('./auth.js');
|
||||
const admin = await createFirstAdmin({
|
||||
setupToken: 'a'.repeat(32),
|
||||
email: 'admin@example.org',
|
||||
displayName: 'Admin',
|
||||
password: 'Admin-Passwort-1234'
|
||||
});
|
||||
await inviteUser(admin, 'crew@example.org', 'thekencrew');
|
||||
const firstToken = tokenFromLatestMail();
|
||||
const crew = await acceptInvitation({
|
||||
token: firstToken,
|
||||
displayName: 'Crew',
|
||||
password: 'Crew-Passwort-1234'
|
||||
});
|
||||
expect(crew.role).toBe('thekencrew');
|
||||
await expect(
|
||||
acceptInvitation({
|
||||
token: firstToken,
|
||||
displayName: 'Crew',
|
||||
password: 'Crew-Passwort-1234'
|
||||
})
|
||||
).rejects.toThrow('TOKEN_INVALID');
|
||||
|
||||
await inviteUser(admin, 'late@example.org', 'thekencrew');
|
||||
const expiredToken = tokenFromLatestMail();
|
||||
const database = new Database(databasePath);
|
||||
database.prepare("UPDATE invitations SET expires_at_utc = '2000-01-01T00:00:00.000Z'").run();
|
||||
database.close();
|
||||
await expect(
|
||||
acceptInvitation({
|
||||
token: expiredToken,
|
||||
displayName: 'Zu spät',
|
||||
password: 'Crew-Passwort-1234'
|
||||
})
|
||||
).rejects.toThrow('TOKEN_INVALID');
|
||||
});
|
||||
|
||||
it('revokes active sessions immediately when a user is locked', async () => {
|
||||
const { createFirstAdmin, createSession, getSessionUser, setUserLocked, SESSION_COOKIE } =
|
||||
await import('./auth.js');
|
||||
const admin = await createFirstAdmin({
|
||||
setupToken: 'a'.repeat(32),
|
||||
email: 'admin@example.org',
|
||||
displayName: 'Admin',
|
||||
password: 'Admin-Passwort-1234'
|
||||
});
|
||||
const database = new Database(databasePath);
|
||||
const crewId = crypto.randomUUID();
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO users (id, email, email_normalized, display_name, password_hash, role,
|
||||
password_changed_at_utc, created_at_utc, updated_at_utc)
|
||||
SELECT ?, 'crew@example.org', 'crew@example.org', 'Crew', password_hash, 'thekencrew',
|
||||
password_changed_at_utc, created_at_utc, updated_at_utc FROM users WHERE id = ?`
|
||||
)
|
||||
.run(crewId, admin.id);
|
||||
database.close();
|
||||
const cookies = testCookies();
|
||||
createSession(crewId, cookies);
|
||||
const token = cookies.get(SESSION_COOKIE);
|
||||
expect(getSessionUser(token)?.id).toBe(crewId);
|
||||
|
||||
setUserLocked(admin, crewId, true);
|
||||
expect(getSessionUser(token)).toBeNull();
|
||||
});
|
||||
|
||||
it('uses password reset links once and invalidates prior sessions', async () => {
|
||||
const {
|
||||
authenticate,
|
||||
createFirstAdmin,
|
||||
createSession,
|
||||
getSessionUser,
|
||||
requestPasswordReset,
|
||||
resetPassword,
|
||||
SESSION_COOKIE
|
||||
} = await import('./auth.js');
|
||||
const admin = await createFirstAdmin({
|
||||
setupToken: 'a'.repeat(32),
|
||||
email: 'admin@example.org',
|
||||
displayName: 'Admin',
|
||||
password: 'Altes-Passwort-1234'
|
||||
});
|
||||
const cookies = testCookies();
|
||||
createSession(admin.id, cookies);
|
||||
const sessionToken = cookies.get(SESSION_COOKIE);
|
||||
await requestPasswordReset(admin.email);
|
||||
const expiredToken = tokenFromLatestMail();
|
||||
const database = new Database(databasePath);
|
||||
database
|
||||
.prepare("UPDATE password_reset_tokens SET expires_at_utc = '2000-01-01T00:00:00.000Z'")
|
||||
.run();
|
||||
database.close();
|
||||
await expect(resetPassword(expiredToken, 'Neues-Passwort-1234')).rejects.toThrow(
|
||||
'TOKEN_INVALID'
|
||||
);
|
||||
await requestPasswordReset(admin.email);
|
||||
const resetToken = tokenFromLatestMail();
|
||||
await resetPassword(resetToken, 'Neues-Passwort-1234');
|
||||
|
||||
expect(getSessionUser(sessionToken)).toBeNull();
|
||||
expect(await authenticate(admin.email, 'Altes-Passwort-1234')).toBeNull();
|
||||
expect(await authenticate(admin.email, 'Neues-Passwort-1234')).not.toBeNull();
|
||||
await expect(resetPassword(resetToken, 'Noch-ein-Passwort-1234')).rejects.toThrow(
|
||||
'TOKEN_INVALID'
|
||||
);
|
||||
});
|
||||
|
||||
it('rate limits repeated failed login attempts without locking the account', async () => {
|
||||
const { authenticate, createFirstAdmin, loginIsRateLimited, reserveLoginAttempt } =
|
||||
await import('./auth.js');
|
||||
await createFirstAdmin({
|
||||
setupToken: 'a'.repeat(32),
|
||||
email: 'admin@example.org',
|
||||
displayName: 'Admin',
|
||||
password: 'Admin-Passwort-1234'
|
||||
});
|
||||
for (let attempt = 0; attempt < 5; attempt += 1) {
|
||||
expect(reserveLoginAttempt('admin@example.org', '127.0.0.1')).toBe(true);
|
||||
expect(await authenticate('admin@example.org', 'falsch')).toBeNull();
|
||||
}
|
||||
expect(loginIsRateLimited('admin@example.org', '127.0.0.1')).toBe(true);
|
||||
const database = new Database(databasePath, { readonly: true });
|
||||
const user = database.prepare('SELECT locked_at_utc FROM users').get() as {
|
||||
locked_at_utc: string | null;
|
||||
};
|
||||
database.close();
|
||||
expect(user.locked_at_utc).toBeNull();
|
||||
});
|
||||
|
||||
it('denies administrative operations to Thekencrew', async () => {
|
||||
const { requireBarkeeper } = await import('./auth.js');
|
||||
expect(() =>
|
||||
requireBarkeeper({
|
||||
id: 'crew',
|
||||
email: 'crew@example.org',
|
||||
displayName: 'Crew',
|
||||
role: 'thekencrew',
|
||||
lockedAtUtc: null
|
||||
})
|
||||
).toThrow();
|
||||
});
|
||||
|
||||
it('never falls back to local delivery when SMTP was selected', async () => {
|
||||
process.env.SENDEWERK_MAIL_TRANSPORT = 'smtp';
|
||||
process.env.SENDEWERK_MAIL_FROM = '';
|
||||
process.env.SENDEWERK_SMTP_HOST = '';
|
||||
const { sendMail } = await import('./mail.js');
|
||||
await expect(
|
||||
sendMail({ to: 'test@example.org', subject: 'Test', text: 'Keine echte Nachricht' })
|
||||
).rejects.toThrow('SMTP-Konfiguration');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,628 @@
|
||||
import { hash, verify } from '@node-rs/argon2';
|
||||
import { createHash, randomBytes, randomUUID, timingSafeEqual } from 'node:crypto';
|
||||
import { error } from '@sveltejs/kit';
|
||||
import type { Cookies } from '@sveltejs/kit';
|
||||
import { getAuthConfig } from './config.js';
|
||||
import { getDatabase } from './database.js';
|
||||
import { sendMail } from './mail.js';
|
||||
|
||||
export const SESSION_COOKIE = 'sendewerk_session';
|
||||
export const INVITATION_COOKIE = 'sendewerk_invitation';
|
||||
export const RESET_COOKIE = 'sendewerk_password_reset';
|
||||
const SESSION_DURATION_MS = 30 * 24 * 60 * 60 * 1000;
|
||||
const LINK_DURATION_MS = 24 * 60 * 60 * 1000;
|
||||
const LOGIN_WINDOW_MS = 15 * 60 * 1000;
|
||||
const EMAIL_ATTEMPT_LIMIT = 5;
|
||||
const ADDRESS_ATTEMPT_LIMIT = 20;
|
||||
const RESET_WINDOW_MS = 60 * 60 * 1000;
|
||||
const RESET_EMAIL_LIMIT = 3;
|
||||
const RESET_ADDRESS_LIMIT = 10;
|
||||
const PASSWORD_OPTIONS = {
|
||||
algorithm: 2,
|
||||
memoryCost: 19_456,
|
||||
timeCost: 2,
|
||||
parallelism: 1,
|
||||
outputLen: 32
|
||||
} as const;
|
||||
|
||||
export type Role = 'barkeeper' | 'thekencrew';
|
||||
export type ShowOverviewView = 'list' | 'calendar';
|
||||
export type AuthUser = {
|
||||
id: string;
|
||||
email: string;
|
||||
displayName: string;
|
||||
role: Role;
|
||||
lockedAtUtc: string | null;
|
||||
};
|
||||
|
||||
type UserRow = {
|
||||
id: string;
|
||||
email: string;
|
||||
display_name: string;
|
||||
password_hash: string;
|
||||
role: Role;
|
||||
locked_at_utc: string | null;
|
||||
};
|
||||
|
||||
type InvitationRow = {
|
||||
id: string;
|
||||
email: string;
|
||||
role: Role;
|
||||
expires_at_utc: string;
|
||||
accepted_at_utc: string | null;
|
||||
revoked_at_utc: string | null;
|
||||
};
|
||||
|
||||
function toUser(row: UserRow): AuthUser {
|
||||
return {
|
||||
id: row.id,
|
||||
email: row.email,
|
||||
displayName: row.display_name,
|
||||
role: row.role,
|
||||
lockedAtUtc: row.locked_at_utc
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizeEmail(email: string): string {
|
||||
return email.trim().toLowerCase();
|
||||
}
|
||||
|
||||
export function getShowOverviewView(userId: string): ShowOverviewView {
|
||||
const row = getDatabase()
|
||||
.prepare('SELECT show_overview_view FROM users WHERE id = ?')
|
||||
.get(userId) as { show_overview_view: ShowOverviewView } | undefined;
|
||||
if (!row) throw new Error('NOT_FOUND');
|
||||
return row.show_overview_view;
|
||||
}
|
||||
|
||||
export function setShowOverviewView(userId: string, view: string): ShowOverviewView {
|
||||
if (view !== 'list' && view !== 'calendar') throw new Error('INVALID_VIEW');
|
||||
const result = getDatabase()
|
||||
.prepare('UPDATE users SET show_overview_view = ?, updated_at_utc = ? WHERE id = ?')
|
||||
.run(view, nowUtc(), userId);
|
||||
if (!result.changes) throw new Error('NOT_FOUND');
|
||||
return view;
|
||||
}
|
||||
|
||||
export function validEmail(email: string): boolean {
|
||||
return email.length <= 254 && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
||||
}
|
||||
|
||||
export function validDisplayName(name: string): boolean {
|
||||
return name.trim().length >= 2 && name.trim().length <= 80;
|
||||
}
|
||||
|
||||
export function validPassword(password: string): boolean {
|
||||
return password.length >= 12 && Buffer.byteLength(password, 'utf8') <= 256;
|
||||
}
|
||||
|
||||
export function isRole(value: string): value is Role {
|
||||
return value === 'barkeeper' || value === 'thekencrew';
|
||||
}
|
||||
|
||||
export async function hashPassword(password: string): Promise<string> {
|
||||
return hash(password, PASSWORD_OPTIONS);
|
||||
}
|
||||
|
||||
export async function verifyPassword(passwordHash: string, password: string): Promise<boolean> {
|
||||
return verify(passwordHash, password, PASSWORD_OPTIONS);
|
||||
}
|
||||
|
||||
const dummyPasswordHash = hashPassword(randomBytes(32).toString('hex'));
|
||||
|
||||
export function createToken(): string {
|
||||
return randomBytes(32).toString('base64url');
|
||||
}
|
||||
|
||||
export function hashToken(token: string): string {
|
||||
return createHash('sha256').update(token).digest('hex');
|
||||
}
|
||||
|
||||
function nowUtc(): string {
|
||||
return new Date().toISOString();
|
||||
}
|
||||
|
||||
function futureUtc(durationMs: number): string {
|
||||
return new Date(Date.now() + durationMs).toISOString();
|
||||
}
|
||||
|
||||
export function hasUsers(): boolean {
|
||||
const row = getDatabase().prepare('SELECT count(*) AS count FROM users').get() as {
|
||||
count: number;
|
||||
};
|
||||
return row.count > 0;
|
||||
}
|
||||
|
||||
export function setupIsConfigured(): boolean {
|
||||
return getAuthConfig().setupToken.length >= 32;
|
||||
}
|
||||
|
||||
function setupTokenMatches(candidate: string): boolean {
|
||||
const configured = getAuthConfig().setupToken;
|
||||
if (configured.length < 32 || candidate.length !== configured.length) return false;
|
||||
return timingSafeEqual(Buffer.from(candidate), Buffer.from(configured));
|
||||
}
|
||||
|
||||
export async function createFirstAdmin(input: {
|
||||
setupToken: string;
|
||||
email: string;
|
||||
displayName: string;
|
||||
password: string;
|
||||
}): Promise<AuthUser> {
|
||||
if (!setupTokenMatches(input.setupToken)) throw new Error('SETUP_TOKEN_INVALID');
|
||||
const email = input.email.trim();
|
||||
const emailNormalized = normalizeEmail(email);
|
||||
const displayName = input.displayName.trim();
|
||||
if (!validEmail(email) || !validDisplayName(displayName) || !validPassword(input.password)) {
|
||||
throw new Error('VALIDATION');
|
||||
}
|
||||
const passwordHash = await hashPassword(input.password);
|
||||
const database = getDatabase();
|
||||
const create = database.transaction(() => {
|
||||
const count = database.prepare('SELECT count(*) AS count FROM users').get() as {
|
||||
count: number;
|
||||
};
|
||||
if (count.count !== 0) throw new Error('SETUP_CLOSED');
|
||||
const id = randomUUID();
|
||||
const timestamp = nowUtc();
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO users (
|
||||
id, email, email_normalized, display_name, password_hash, role,
|
||||
password_changed_at_utc, created_at_utc, updated_at_utc
|
||||
) VALUES (?, ?, ?, ?, ?, 'barkeeper', ?, ?, ?)`
|
||||
)
|
||||
.run(id, email, emailNormalized, displayName, passwordHash, timestamp, timestamp, timestamp);
|
||||
return { id, email, displayName, role: 'barkeeper', lockedAtUtc: null } satisfies AuthUser;
|
||||
});
|
||||
return create();
|
||||
}
|
||||
|
||||
function sessionCookieOptions(expires?: Date) {
|
||||
return {
|
||||
path: '/',
|
||||
httpOnly: true,
|
||||
sameSite: 'lax' as const,
|
||||
secure: getAuthConfig().secureCookies,
|
||||
expires
|
||||
};
|
||||
}
|
||||
|
||||
function linkCookieOptions() {
|
||||
return {
|
||||
path: '/',
|
||||
httpOnly: true,
|
||||
sameSite: 'strict' as const,
|
||||
secure: getAuthConfig().secureCookies,
|
||||
maxAge: 10 * 60
|
||||
};
|
||||
}
|
||||
|
||||
export function storeLinkToken(cookies: Cookies, name: string, token: string): void {
|
||||
cookies.set(name, token, linkCookieOptions());
|
||||
}
|
||||
|
||||
export function readLinkToken(cookies: Cookies, name: string): string {
|
||||
return cookies.get(name) || '';
|
||||
}
|
||||
|
||||
export function deleteLinkToken(cookies: Cookies, name: string): void {
|
||||
cookies.delete(name, { ...linkCookieOptions(), maxAge: 0 });
|
||||
}
|
||||
|
||||
export function createSession(userId: string, cookies: Cookies): void {
|
||||
const token = createToken();
|
||||
const expires = new Date(Date.now() + SESSION_DURATION_MS);
|
||||
getDatabase()
|
||||
.prepare(
|
||||
'INSERT INTO sessions (token_hash, user_id, created_at_utc, expires_at_utc) VALUES (?, ?, ?, ?)'
|
||||
)
|
||||
.run(hashToken(token), userId, nowUtc(), expires.toISOString());
|
||||
cookies.set(SESSION_COOKIE, token, sessionCookieOptions(expires));
|
||||
}
|
||||
|
||||
export function deleteSession(cookies: Cookies): void {
|
||||
const token = cookies.get(SESSION_COOKIE);
|
||||
if (token)
|
||||
getDatabase().prepare('DELETE FROM sessions WHERE token_hash = ?').run(hashToken(token));
|
||||
cookies.delete(SESSION_COOKIE, sessionCookieOptions());
|
||||
}
|
||||
|
||||
export function getSessionUser(token: string | undefined): AuthUser | null {
|
||||
if (!token) return null;
|
||||
const database = getDatabase();
|
||||
const row = database
|
||||
.prepare(
|
||||
`SELECT u.id, u.email, u.display_name, u.password_hash, u.role, u.locked_at_utc
|
||||
FROM sessions s
|
||||
JOIN users u ON u.id = s.user_id
|
||||
WHERE s.token_hash = ? AND s.expires_at_utc > ? AND u.locked_at_utc IS NULL`
|
||||
)
|
||||
.get(hashToken(token), nowUtc()) as UserRow | undefined;
|
||||
if (!row) return null;
|
||||
return toUser(row);
|
||||
}
|
||||
|
||||
function rateKey(value: string): string {
|
||||
return hashToken(value || 'unknown');
|
||||
}
|
||||
|
||||
export function loginIsRateLimited(email: string, address: string): boolean {
|
||||
const database = getDatabase();
|
||||
const since = new Date(Date.now() - LOGIN_WINDOW_MS).toISOString();
|
||||
database.prepare('DELETE FROM login_attempts WHERE attempted_at_utc < ?').run(since);
|
||||
const emailCount = database
|
||||
.prepare(
|
||||
'SELECT count(*) AS count FROM login_attempts WHERE email_key = ? AND attempted_at_utc >= ?'
|
||||
)
|
||||
.get(rateKey(normalizeEmail(email)), since) as { count: number };
|
||||
const addressCount = database
|
||||
.prepare(
|
||||
'SELECT count(*) AS count FROM login_attempts WHERE address_key = ? AND attempted_at_utc >= ?'
|
||||
)
|
||||
.get(rateKey(address), since) as { count: number };
|
||||
return emailCount.count >= EMAIL_ATTEMPT_LIMIT || addressCount.count >= ADDRESS_ATTEMPT_LIMIT;
|
||||
}
|
||||
|
||||
export function reserveLoginAttempt(email: string, address: string): boolean {
|
||||
const database = getDatabase();
|
||||
const reserve = database.transaction(() => {
|
||||
if (loginIsRateLimited(email, address)) return false;
|
||||
database
|
||||
.prepare(
|
||||
'INSERT INTO login_attempts (id, email_key, address_key, attempted_at_utc) VALUES (?, ?, ?, ?)'
|
||||
)
|
||||
.run(randomUUID(), rateKey(normalizeEmail(email)), rateKey(address), nowUtc());
|
||||
return true;
|
||||
});
|
||||
return reserve();
|
||||
}
|
||||
|
||||
export async function authenticate(email: string, password: string): Promise<AuthUser | null> {
|
||||
const database = getDatabase();
|
||||
const normalized = normalizeEmail(email);
|
||||
const row = database
|
||||
.prepare(
|
||||
`SELECT id, email, display_name, password_hash, role, locked_at_utc
|
||||
FROM users WHERE email_normalized = ?`
|
||||
)
|
||||
.get(normalized) as UserRow | undefined;
|
||||
const matches = row
|
||||
? await verifyPassword(row.password_hash, password)
|
||||
: await verifyPassword(await dummyPasswordHash, password);
|
||||
if (!row || !matches || row.locked_at_utc) {
|
||||
return null;
|
||||
}
|
||||
database.prepare('DELETE FROM login_attempts WHERE email_key = ?').run(rateKey(normalized));
|
||||
return toUser(row);
|
||||
}
|
||||
|
||||
export function requireUser(user: AuthUser | null): AuthUser {
|
||||
if (!user) error(401, 'Anmeldung erforderlich');
|
||||
return user;
|
||||
}
|
||||
|
||||
export function requireBarkeeper(user: AuthUser | null): AuthUser {
|
||||
const authenticated = requireUser(user);
|
||||
if (authenticated.role !== 'barkeeper') error(403, 'Diese Aktion erfordert Barkeeper-Rechte.');
|
||||
return authenticated;
|
||||
}
|
||||
|
||||
function requireCurrentBarkeeper(actor: AuthUser): AuthUser {
|
||||
const row = getDatabase()
|
||||
.prepare(
|
||||
`SELECT id, email, display_name, password_hash, role, locked_at_utc
|
||||
FROM users WHERE id = ? AND role = 'barkeeper' AND locked_at_utc IS NULL`
|
||||
)
|
||||
.get(actor.id) as UserRow | undefined;
|
||||
if (!row) error(403, 'Diese Aktion erfordert aktive Barkeeper-Rechte.');
|
||||
return toUser(row);
|
||||
}
|
||||
|
||||
export function listUsers(): AuthUser[] {
|
||||
const rows = getDatabase()
|
||||
.prepare(
|
||||
`SELECT id, email, display_name, password_hash, role, locked_at_utc
|
||||
FROM users ORDER BY display_name COLLATE NOCASE`
|
||||
)
|
||||
.all() as UserRow[];
|
||||
return rows.map(toUser);
|
||||
}
|
||||
|
||||
export function listOpenInvitations() {
|
||||
return getDatabase()
|
||||
.prepare(
|
||||
`SELECT id, email, role, expires_at_utc
|
||||
FROM invitations
|
||||
WHERE accepted_at_utc IS NULL AND revoked_at_utc IS NULL AND expires_at_utc > ?
|
||||
ORDER BY created_at_utc DESC`
|
||||
)
|
||||
.all(nowUtc()) as Array<{ id: string; email: string; role: Role; expires_at_utc: string }>;
|
||||
}
|
||||
|
||||
export async function inviteUser(
|
||||
actor: AuthUser,
|
||||
emailValue: string,
|
||||
role: Role
|
||||
): Promise<'local' | 'smtp'> {
|
||||
actor = requireCurrentBarkeeper(actor);
|
||||
const email = emailValue.trim();
|
||||
const normalized = normalizeEmail(email);
|
||||
if (!validEmail(email) || !isRole(role)) throw new Error('VALIDATION');
|
||||
const database = getDatabase();
|
||||
if (database.prepare('SELECT 1 FROM users WHERE email_normalized = ?').get(normalized)) {
|
||||
throw new Error('USER_EXISTS');
|
||||
}
|
||||
const token = createToken();
|
||||
const id = randomUUID();
|
||||
const timestamp = nowUtc();
|
||||
const expiresAt = futureUtc(LINK_DURATION_MS);
|
||||
const store = database.transaction(() => {
|
||||
database
|
||||
.prepare(
|
||||
`UPDATE invitations SET revoked_at_utc = ?
|
||||
WHERE email_normalized = ? AND accepted_at_utc IS NULL AND revoked_at_utc IS NULL`
|
||||
)
|
||||
.run(timestamp, normalized);
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO invitations (
|
||||
id, email, email_normalized, role, token_hash, created_by_user_id,
|
||||
created_at_utc, expires_at_utc
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(id, email, normalized, role, hashToken(token), actor.id, timestamp, expiresAt);
|
||||
});
|
||||
store();
|
||||
const link = new URL(
|
||||
`/einladung?token=${encodeURIComponent(token)}`,
|
||||
getAuthConfig().origin
|
||||
).toString();
|
||||
try {
|
||||
return await sendMail({
|
||||
to: email,
|
||||
subject: 'Einladung zu Sendewerk',
|
||||
text: `Du wurdest zu Sendewerk eingeladen. Der Link ist 24 Stunden gültig und einmalig nutzbar:\n\n${link}`
|
||||
});
|
||||
} catch (mailError) {
|
||||
database.prepare('UPDATE invitations SET revoked_at_utc = ? WHERE id = ?').run(nowUtc(), id);
|
||||
throw mailError;
|
||||
}
|
||||
}
|
||||
|
||||
export function getInvitation(token: string): InvitationRow | null {
|
||||
if (!token || token.length > 100) return null;
|
||||
return (
|
||||
(getDatabase()
|
||||
.prepare(
|
||||
`SELECT id, email, role, expires_at_utc, accepted_at_utc, revoked_at_utc
|
||||
FROM invitations WHERE token_hash = ?`
|
||||
)
|
||||
.get(hashToken(token)) as InvitationRow | undefined) ?? null
|
||||
);
|
||||
}
|
||||
|
||||
export async function acceptInvitation(input: {
|
||||
token: string;
|
||||
displayName: string;
|
||||
password: string;
|
||||
}): Promise<AuthUser> {
|
||||
const invitation = getInvitation(input.token);
|
||||
const displayName = input.displayName.trim();
|
||||
if (
|
||||
!invitation ||
|
||||
invitation.accepted_at_utc ||
|
||||
invitation.revoked_at_utc ||
|
||||
invitation.expires_at_utc <= nowUtc()
|
||||
) {
|
||||
throw new Error('TOKEN_INVALID');
|
||||
}
|
||||
if (!validDisplayName(displayName) || !validPassword(input.password))
|
||||
throw new Error('VALIDATION');
|
||||
const passwordHash = await hashPassword(input.password);
|
||||
const database = getDatabase();
|
||||
const accept = database.transaction(() => {
|
||||
const current = database
|
||||
.prepare(
|
||||
`SELECT id, email, role, expires_at_utc, accepted_at_utc, revoked_at_utc
|
||||
FROM invitations WHERE id = ?`
|
||||
)
|
||||
.get(invitation.id) as InvitationRow;
|
||||
if (current.accepted_at_utc || current.revoked_at_utc || current.expires_at_utc <= nowUtc()) {
|
||||
throw new Error('TOKEN_INVALID');
|
||||
}
|
||||
const id = randomUUID();
|
||||
const timestamp = nowUtc();
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO users (
|
||||
id, email, email_normalized, display_name, password_hash, role,
|
||||
password_changed_at_utc, created_at_utc, updated_at_utc
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(
|
||||
id,
|
||||
current.email,
|
||||
normalizeEmail(current.email),
|
||||
displayName,
|
||||
passwordHash,
|
||||
current.role,
|
||||
timestamp,
|
||||
timestamp,
|
||||
timestamp
|
||||
);
|
||||
database
|
||||
.prepare('UPDATE invitations SET accepted_at_utc = ? WHERE id = ?')
|
||||
.run(timestamp, current.id);
|
||||
return {
|
||||
id,
|
||||
email: current.email,
|
||||
displayName,
|
||||
role: current.role,
|
||||
lockedAtUtc: null
|
||||
} satisfies AuthUser;
|
||||
});
|
||||
return accept();
|
||||
}
|
||||
|
||||
export function reservePasswordResetRequest(email: string, address: string): boolean {
|
||||
const database = getDatabase();
|
||||
const since = new Date(Date.now() - RESET_WINDOW_MS).toISOString();
|
||||
const emailKey = rateKey(`reset-email:${normalizeEmail(email)}`);
|
||||
const addressKey = rateKey(`reset-address:${address}`);
|
||||
const reserve = database.transaction(() => {
|
||||
database.prepare('DELETE FROM login_attempts WHERE attempted_at_utc < ?').run(since);
|
||||
const emailCount = database
|
||||
.prepare(
|
||||
'SELECT count(*) AS count FROM login_attempts WHERE email_key = ? AND attempted_at_utc >= ?'
|
||||
)
|
||||
.get(emailKey, since) as { count: number };
|
||||
const addressCount = database
|
||||
.prepare(
|
||||
'SELECT count(*) AS count FROM login_attempts WHERE address_key = ? AND attempted_at_utc >= ?'
|
||||
)
|
||||
.get(addressKey, since) as { count: number };
|
||||
if (emailCount.count >= RESET_EMAIL_LIMIT || addressCount.count >= RESET_ADDRESS_LIMIT)
|
||||
return false;
|
||||
database
|
||||
.prepare(
|
||||
'INSERT INTO login_attempts (id, email_key, address_key, attempted_at_utc) VALUES (?, ?, ?, ?)'
|
||||
)
|
||||
.run(randomUUID(), emailKey, addressKey, nowUtc());
|
||||
return true;
|
||||
});
|
||||
return reserve();
|
||||
}
|
||||
|
||||
export async function requestPasswordReset(emailValue: string): Promise<void> {
|
||||
const normalized = normalizeEmail(emailValue);
|
||||
const database = getDatabase();
|
||||
const row = database
|
||||
.prepare('SELECT id, email FROM users WHERE email_normalized = ?')
|
||||
.get(normalized) as { id: string; email: string } | undefined;
|
||||
if (!row) return;
|
||||
const token = createToken();
|
||||
const id = randomUUID();
|
||||
const timestamp = nowUtc();
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO password_reset_tokens
|
||||
(id, user_id, token_hash, created_at_utc, expires_at_utc)
|
||||
VALUES (?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(id, row.id, hashToken(token), timestamp, futureUtc(LINK_DURATION_MS));
|
||||
const link = new URL(
|
||||
`/passwort-zuruecksetzen?token=${encodeURIComponent(token)}`,
|
||||
getAuthConfig().origin
|
||||
).toString();
|
||||
try {
|
||||
await sendMail({
|
||||
to: row.email,
|
||||
subject: 'Sendewerk-Passwort zurücksetzen',
|
||||
text: `Mit diesem 24 Stunden gültigen, einmaligen Link kannst du dein Passwort zurücksetzen:\n\n${link}`
|
||||
});
|
||||
} catch (mailError) {
|
||||
database.prepare('DELETE FROM password_reset_tokens WHERE id = ?').run(id);
|
||||
throw mailError;
|
||||
}
|
||||
}
|
||||
|
||||
export function passwordResetIsValid(token: string): boolean {
|
||||
if (!token || token.length > 100) return false;
|
||||
return Boolean(
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`SELECT 1 FROM password_reset_tokens
|
||||
WHERE token_hash = ? AND consumed_at_utc IS NULL AND expires_at_utc > ?`
|
||||
)
|
||||
.get(hashToken(token), nowUtc())
|
||||
);
|
||||
}
|
||||
|
||||
export async function resetPassword(token: string, password: string): Promise<void> {
|
||||
if (!passwordResetIsValid(token)) throw new Error('TOKEN_INVALID');
|
||||
if (!validPassword(password)) throw new Error('VALIDATION');
|
||||
const passwordHash = await hashPassword(password);
|
||||
const database = getDatabase();
|
||||
const reset = database.transaction(() => {
|
||||
const row = database
|
||||
.prepare(
|
||||
`SELECT id, user_id FROM password_reset_tokens
|
||||
WHERE token_hash = ? AND consumed_at_utc IS NULL AND expires_at_utc > ?`
|
||||
)
|
||||
.get(hashToken(token), nowUtc()) as { id: string; user_id: string } | undefined;
|
||||
if (!row) throw new Error('TOKEN_INVALID');
|
||||
const timestamp = nowUtc();
|
||||
database
|
||||
.prepare(
|
||||
`UPDATE users SET password_hash = ?, password_changed_at_utc = ?, updated_at_utc = ?
|
||||
WHERE id = ?`
|
||||
)
|
||||
.run(passwordHash, timestamp, timestamp, row.user_id);
|
||||
database
|
||||
.prepare(
|
||||
'UPDATE password_reset_tokens SET consumed_at_utc = ? WHERE user_id = ? AND consumed_at_utc IS NULL'
|
||||
)
|
||||
.run(timestamp, row.user_id);
|
||||
database.prepare('DELETE FROM sessions WHERE user_id = ?').run(row.user_id);
|
||||
});
|
||||
reset();
|
||||
}
|
||||
|
||||
function activeBarkeeperCount(): number {
|
||||
const row = getDatabase()
|
||||
.prepare(
|
||||
"SELECT count(*) AS count FROM users WHERE role = 'barkeeper' AND locked_at_utc IS NULL"
|
||||
)
|
||||
.get() as { count: number };
|
||||
return row.count;
|
||||
}
|
||||
|
||||
export function setUserLocked(actor: AuthUser, userId: string, locked: boolean): void {
|
||||
actor = requireCurrentBarkeeper(actor);
|
||||
const database = getDatabase();
|
||||
const row = database.prepare('SELECT role, locked_at_utc FROM users WHERE id = ?').get(userId) as
|
||||
{ role: Role; locked_at_utc: string | null } | undefined;
|
||||
if (!row) throw new Error('NOT_FOUND');
|
||||
if (locked && actor.id === userId) throw new Error('SELF_LOCK');
|
||||
if (locked && row.role === 'barkeeper' && !row.locked_at_utc && activeBarkeeperCount() <= 1) {
|
||||
throw new Error('LAST_BARKEEPER');
|
||||
}
|
||||
const update = database.transaction(() => {
|
||||
database
|
||||
.prepare('UPDATE users SET locked_at_utc = ?, updated_at_utc = ? WHERE id = ?')
|
||||
.run(locked ? nowUtc() : null, nowUtc(), userId);
|
||||
if (locked) database.prepare('DELETE FROM sessions WHERE user_id = ?').run(userId);
|
||||
});
|
||||
update();
|
||||
}
|
||||
|
||||
export function setUserRole(actor: AuthUser, userId: string, role: Role): void {
|
||||
requireCurrentBarkeeper(actor);
|
||||
if (!isRole(role)) throw new Error('VALIDATION');
|
||||
const database = getDatabase();
|
||||
const row = database.prepare('SELECT role, locked_at_utc FROM users WHERE id = ?').get(userId) as
|
||||
{ role: Role; locked_at_utc: string | null } | undefined;
|
||||
if (!row) throw new Error('NOT_FOUND');
|
||||
if (
|
||||
row.role === 'barkeeper' &&
|
||||
role === 'thekencrew' &&
|
||||
!row.locked_at_utc &&
|
||||
activeBarkeeperCount() <= 1
|
||||
) {
|
||||
throw new Error('LAST_BARKEEPER');
|
||||
}
|
||||
database
|
||||
.prepare('UPDATE users SET role = ?, updated_at_utc = ? WHERE id = ?')
|
||||
.run(role, nowUtc(), userId);
|
||||
}
|
||||
|
||||
export function revokeInvitation(actor: AuthUser, invitationId: string): void {
|
||||
requireCurrentBarkeeper(actor);
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`UPDATE invitations SET revoked_at_utc = ?
|
||||
WHERE id = ? AND accepted_at_utc IS NULL AND revoked_at_utc IS NULL`
|
||||
)
|
||||
.run(nowUtc(), invitationId);
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { mkdtempSync, rmSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import type { AuthUser } from './auth.js';
|
||||
import { finalizeShow, getCompletionSummary } from './completion.js';
|
||||
import { closeDatabase, getDatabase } from './database.js';
|
||||
import {
|
||||
addPieceUsage,
|
||||
addShowSection,
|
||||
createShow,
|
||||
duplicateCompletedShow,
|
||||
getPieceUsageContexts,
|
||||
getShow
|
||||
} from './shows.js';
|
||||
|
||||
let directory: string;
|
||||
const actor: AuthUser = {
|
||||
id: 'completion-actor',
|
||||
email: 'completion@example.test',
|
||||
displayName: 'Abschluss Test',
|
||||
role: 'barkeeper',
|
||||
lockedAtUtc: null
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
directory = mkdtempSync(path.join(tmpdir(), 'sendewerk-completion-test-'));
|
||||
process.env.SENDEWERK_DB_PATH = path.join(directory, 'test.sqlite');
|
||||
process.env.SENDEWERK_UPLOAD_DIR = path.join(directory, 'uploads');
|
||||
execFileSync(process.execPath, ['scripts/migrate.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
execFileSync(process.execPath, ['scripts/seed.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO users (id, email, email_normalized, display_name, password_hash, role,
|
||||
password_changed_at_utc, created_at_utc, updated_at_utc)
|
||||
VALUES (?, ?, ?, ?, 'unused', 'barkeeper', ?, ?, ?)`
|
||||
)
|
||||
.run(
|
||||
actor.id,
|
||||
actor.email,
|
||||
actor.email,
|
||||
actor.displayName,
|
||||
...Array(3).fill(new Date().toISOString())
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
closeDatabase();
|
||||
delete process.env.SENDEWERK_DB_PATH;
|
||||
delete process.env.SENDEWERK_UPLOAD_DIR;
|
||||
rmSync(directory, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
function endedShow() {
|
||||
const created = createShow({ title: 'Finale Sendung', startsAtUtc: null, templateId: null });
|
||||
const section = addShowSection(created.id, created.revision, {
|
||||
name: 'Gesendeter Block',
|
||||
categoryId: 'cat-jc',
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
const done = addPieceUsage(created.id, section.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: section.id
|
||||
});
|
||||
const skipped = addPieceUsage(created.id, done.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: section.id
|
||||
});
|
||||
const database = getDatabase();
|
||||
database.prepare("UPDATE piece_usages SET status = 'done' WHERE id = ?").run(done.id);
|
||||
database.prepare("UPDATE piece_usages SET status = 'skipped' WHERE id = ?").run(skipped.id);
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO show_live_states
|
||||
(show_id, revision, started_at_utc, ended_at_utc, presentation_revision, updated_at_utc)
|
||||
VALUES (?, 0, ?, ?, 0, ?)`
|
||||
)
|
||||
.run(
|
||||
created.id,
|
||||
'2026-10-25T18:00:00.000Z',
|
||||
'2026-10-25T19:00:00.000Z',
|
||||
'2026-10-25T19:00:00.000Z'
|
||||
);
|
||||
return { showId: created.id, doneUsageId: done.id, revision: skipped.revision };
|
||||
}
|
||||
|
||||
describe('show completion', () => {
|
||||
it('finalizes once, records only sent usages and archives only the explicit selection', () => {
|
||||
const prepared = endedShow();
|
||||
expect(getCompletionSummary(prepared.showId)).toMatchObject({
|
||||
doneCount: 1,
|
||||
skippedCount: 1,
|
||||
candidates: [{ pieceId: 'piece-console', usageCount: 1 }]
|
||||
});
|
||||
const first = finalizeShow({
|
||||
showId: prepared.showId,
|
||||
commandId: 'complete-once',
|
||||
expectedShowRevision: prepared.revision,
|
||||
expectedLiveRevision: 0,
|
||||
archivePieceIds: ['piece-console'],
|
||||
actor,
|
||||
now: new Date('2026-10-25T19:05:00.000Z')
|
||||
});
|
||||
expect(first.duplicate).toBe(false);
|
||||
expect(
|
||||
finalizeShow({
|
||||
showId: prepared.showId,
|
||||
commandId: 'complete-once',
|
||||
expectedShowRevision: prepared.revision,
|
||||
expectedLiveRevision: 0,
|
||||
archivePieceIds: ['piece-console'],
|
||||
actor
|
||||
}).duplicate
|
||||
).toBe(true);
|
||||
expect(() =>
|
||||
finalizeShow({
|
||||
showId: prepared.showId,
|
||||
commandId: 'different-command',
|
||||
expectedShowRevision: prepared.revision,
|
||||
expectedLiveRevision: 0,
|
||||
archivePieceIds: [],
|
||||
actor
|
||||
})
|
||||
).toThrow('SHOW_COMPLETED');
|
||||
const database = getDatabase();
|
||||
expect(
|
||||
(
|
||||
database
|
||||
.prepare('SELECT count(*) AS count FROM piece_usage_history WHERE show_id = ?')
|
||||
.get(prepared.showId) as { count: number }
|
||||
).count
|
||||
).toBe(1);
|
||||
expect(database.prepare('SELECT status FROM pieces WHERE id = ?').get('piece-console')).toEqual(
|
||||
{ status: 'archived' }
|
||||
);
|
||||
expect(getPieceUsageContexts(['piece-console'])['piece-console'].sentHistory).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('keeps historical snapshots stable and duplicates them into an editable clean run', () => {
|
||||
const prepared = endedShow();
|
||||
finalizeShow({
|
||||
showId: prepared.showId,
|
||||
commandId: 'freeze',
|
||||
expectedShowRevision: prepared.revision,
|
||||
expectedLiveRevision: 0,
|
||||
archivePieceIds: [],
|
||||
actor
|
||||
});
|
||||
const historical = getShow(prepared.showId)!;
|
||||
getDatabase()
|
||||
.prepare("UPDATE section_categories SET name = 'Später geändert' WHERE id = 'cat-jc'")
|
||||
.run();
|
||||
getDatabase()
|
||||
.prepare("UPDATE pieces SET title = 'Später geändert' WHERE id = 'piece-console'")
|
||||
.run();
|
||||
const unchanged = getShow(prepared.showId)!;
|
||||
expect(unchanged.sections[0].category).toBe(historical.sections[0].category);
|
||||
expect(unchanged.sections[0].usages[0].title).toBe(historical.sections[0].usages[0].title);
|
||||
|
||||
const copy = duplicateCompletedShow(prepared.showId, 'copy-once');
|
||||
expect(duplicateCompletedShow(prepared.showId, 'copy-once').id).toBe(copy.id);
|
||||
expect(getShow(copy.id)).toMatchObject({
|
||||
status: 'draft',
|
||||
startsAtUtc: null,
|
||||
sections: [
|
||||
{
|
||||
category: historical.sections[0].category,
|
||||
usages: [{ status: 'open' }, { status: 'open' }]
|
||||
}
|
||||
]
|
||||
});
|
||||
expect(
|
||||
getDatabase().prepare('SELECT 1 FROM show_finalizations WHERE show_id = ?').get(copy.id)
|
||||
).toBeUndefined();
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`UPDATE piece_usages SET status = 'done'
|
||||
WHERE show_section_id IN (SELECT id FROM show_sections WHERE show_id = ?)`
|
||||
)
|
||||
.run(copy.id);
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO show_live_states
|
||||
(show_id, revision, started_at_utc, ended_at_utc, presentation_revision, updated_at_utc)
|
||||
VALUES (?, 0, ?, ?, 0, ?)`
|
||||
)
|
||||
.run(
|
||||
copy.id,
|
||||
'2026-10-26T18:00:00.000Z',
|
||||
'2026-10-26T19:00:00.000Z',
|
||||
'2026-10-26T19:00:00.000Z'
|
||||
);
|
||||
finalizeShow({
|
||||
showId: copy.id,
|
||||
commandId: 'finalize-copy',
|
||||
expectedShowRevision: 1,
|
||||
expectedLiveRevision: 0,
|
||||
archivePieceIds: [],
|
||||
actor
|
||||
});
|
||||
expect(getShow(copy.id)?.sections[0].category).toBe(historical.sections[0].category);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,210 @@
|
||||
import type { AuthUser } from './auth.js';
|
||||
import { getDatabase } from './database.js';
|
||||
|
||||
export type CompletionCandidate = {
|
||||
pieceId: string;
|
||||
title: string;
|
||||
usageCount: number;
|
||||
};
|
||||
|
||||
export type CompletionSummary = {
|
||||
doneCount: number;
|
||||
skippedCount: number;
|
||||
openCount: number;
|
||||
candidates: CompletionCandidate[];
|
||||
};
|
||||
|
||||
export function isShowFinalized(showId: string): boolean {
|
||||
return Boolean(
|
||||
getDatabase().prepare('SELECT 1 FROM show_finalizations WHERE show_id = ?').get(showId)
|
||||
);
|
||||
}
|
||||
|
||||
export function getCompletionSummary(showId: string): CompletionSummary {
|
||||
const database = getDatabase();
|
||||
if (!database.prepare('SELECT 1 FROM shows WHERE id = ?').get(showId))
|
||||
throw new Error('NOT_FOUND');
|
||||
const counts = database
|
||||
.prepare(
|
||||
`SELECT
|
||||
sum(CASE WHEN u.status = 'done' THEN 1 ELSE 0 END) AS done_count,
|
||||
sum(CASE WHEN u.status = 'skipped' THEN 1 ELSE 0 END) AS skipped_count,
|
||||
sum(CASE WHEN u.status IN ('open', 'current') THEN 1 ELSE 0 END) AS open_count
|
||||
FROM piece_usages u JOIN show_sections s ON s.id = u.show_section_id
|
||||
WHERE s.show_id = ? AND s.is_reserve_bank = 0`
|
||||
)
|
||||
.get(showId) as {
|
||||
done_count: number | null;
|
||||
skipped_count: number | null;
|
||||
open_count: number | null;
|
||||
};
|
||||
const candidates = database
|
||||
.prepare(
|
||||
`SELECT u.original_piece_id AS piece_id, p.title, count(*) AS usage_count
|
||||
FROM piece_usages u
|
||||
JOIN show_sections s ON s.id = u.show_section_id
|
||||
JOIN pieces p ON p.id = u.original_piece_id
|
||||
WHERE s.show_id = ? AND s.is_reserve_bank = 0 AND u.status = 'done'
|
||||
AND p.status != 'archived' AND p.deleted_at_utc IS NULL
|
||||
GROUP BY u.original_piece_id, p.title ORDER BY p.title COLLATE NOCASE`
|
||||
)
|
||||
.all(showId) as { piece_id: string; title: string; usage_count: number }[];
|
||||
return {
|
||||
doneCount: counts.done_count ?? 0,
|
||||
skippedCount: counts.skipped_count ?? 0,
|
||||
openCount: counts.open_count ?? 0,
|
||||
candidates: candidates.map((candidate) => ({
|
||||
pieceId: candidate.piece_id,
|
||||
title: candidate.title,
|
||||
usageCount: candidate.usage_count
|
||||
}))
|
||||
};
|
||||
}
|
||||
|
||||
export function getHistoricalActualDurations(showId: string): Record<string, number> {
|
||||
return Object.fromEntries(
|
||||
(
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`SELECT usage_id, actual_duration_seconds FROM piece_usage_history WHERE show_id = ?`
|
||||
)
|
||||
.all(showId) as { usage_id: string; actual_duration_seconds: number }[]
|
||||
).map((row) => [row.usage_id, row.actual_duration_seconds])
|
||||
);
|
||||
}
|
||||
|
||||
export function finalizeShow(input: {
|
||||
showId: string;
|
||||
commandId: string;
|
||||
expectedShowRevision: number;
|
||||
expectedLiveRevision: number;
|
||||
archivePieceIds: string[];
|
||||
actor: AuthUser;
|
||||
now?: Date;
|
||||
}) {
|
||||
if (!input.commandId || input.commandId.length > 200) throw new Error('INVALID_COMMAND');
|
||||
if (!Number.isInteger(input.expectedShowRevision) || input.expectedShowRevision < 1) {
|
||||
throw new Error('INVALID_REVISION');
|
||||
}
|
||||
if (!Number.isInteger(input.expectedLiveRevision) || input.expectedLiveRevision < 0) {
|
||||
throw new Error('INVALID_REVISION');
|
||||
}
|
||||
const archivePieceIds = [...new Set(input.archivePieceIds.filter(Boolean))];
|
||||
const database = getDatabase();
|
||||
return database.transaction(() => {
|
||||
const existing = database
|
||||
.prepare('SELECT command_id FROM show_finalizations WHERE show_id = ?')
|
||||
.get(input.showId) as { command_id: string } | undefined;
|
||||
if (existing) {
|
||||
if (existing.command_id !== input.commandId) throw new Error('SHOW_COMPLETED');
|
||||
return { duplicate: true };
|
||||
}
|
||||
const state = database
|
||||
.prepare(
|
||||
`SELECT sh.revision AS show_revision, ls.revision AS live_revision, ls.ended_at_utc
|
||||
FROM shows sh JOIN show_live_states ls ON ls.show_id = sh.id WHERE sh.id = ?`
|
||||
)
|
||||
.get(input.showId) as
|
||||
{ show_revision: number; live_revision: number; ended_at_utc: string | null } | undefined;
|
||||
if (!state) throw new Error('NOT_FOUND');
|
||||
if (!state.ended_at_utc) throw new Error('NOT_ENDED');
|
||||
if (
|
||||
state.show_revision !== input.expectedShowRevision ||
|
||||
state.live_revision !== input.expectedLiveRevision
|
||||
) {
|
||||
throw new Error('CONFLICT');
|
||||
}
|
||||
|
||||
const candidates = getCompletionSummary(input.showId).candidates.map(
|
||||
(candidate) => candidate.pieceId
|
||||
);
|
||||
if (archivePieceIds.some((pieceId) => !candidates.includes(pieceId))) {
|
||||
throw new Error('INVALID_ARCHIVE_SELECTION');
|
||||
}
|
||||
const now = (input.now ?? new Date()).toISOString();
|
||||
database
|
||||
.prepare(
|
||||
`UPDATE live_usage_runs SET ended_at_utc = ? WHERE show_id = ? AND ended_at_utc IS NULL`
|
||||
)
|
||||
.run(now, input.showId);
|
||||
database
|
||||
.prepare(
|
||||
`UPDATE live_show_timer_runs SET ended_at_utc = ? WHERE show_id = ? AND ended_at_utc IS NULL`
|
||||
)
|
||||
.run(now, input.showId);
|
||||
database
|
||||
.prepare(
|
||||
`UPDATE live_section_timer_runs SET ended_at_utc = ?
|
||||
WHERE ended_at_utc IS NULL AND timer_id IN (
|
||||
SELECT id FROM live_section_timers WHERE show_id = ?
|
||||
)`
|
||||
)
|
||||
.run(now, input.showId);
|
||||
database
|
||||
.prepare(
|
||||
`UPDATE live_section_timers SET ended_at_utc = ? WHERE show_id = ? AND ended_at_utc IS NULL`
|
||||
)
|
||||
.run(now, input.showId);
|
||||
database
|
||||
.prepare(
|
||||
`UPDATE show_sections SET
|
||||
category_name_snapshot = COALESCE(category_name_snapshot,
|
||||
(SELECT name FROM section_categories WHERE id = show_sections.category_id)),
|
||||
category_color_snapshot = COALESCE(category_color_snapshot,
|
||||
(SELECT color FROM section_categories WHERE id = show_sections.category_id))
|
||||
WHERE show_id = ?`
|
||||
)
|
||||
.run(input.showId);
|
||||
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO piece_usage_history (
|
||||
usage_id, show_id, original_piece_id, show_title_snapshot, usage_title_snapshot,
|
||||
used_at_utc, actual_duration_seconds
|
||||
)
|
||||
SELECT u.id, sh.id, u.original_piece_id, sh.title, u.title_snapshot,
|
||||
COALESCE(sh.starts_at_utc, ?),
|
||||
COALESCE((
|
||||
SELECT sum(max(0, CAST((julianday(COALESCE(r.ended_at_utc, ?)) -
|
||||
julianday(r.started_at_utc)) * 86400 AS INTEGER)))
|
||||
FROM live_usage_runs r WHERE r.usage_id = u.id
|
||||
), 0)
|
||||
FROM piece_usages u
|
||||
JOIN show_sections s ON s.id = u.show_section_id
|
||||
JOIN shows sh ON sh.id = s.show_id
|
||||
WHERE sh.id = ? AND s.is_reserve_bank = 0 AND u.status = 'done'
|
||||
AND u.original_piece_id IS NOT NULL`
|
||||
)
|
||||
.run(now, now, input.showId);
|
||||
|
||||
const archivePiece = database.prepare(
|
||||
`UPDATE pieces SET archived_from_status = status, status = 'archived', revision = revision + 1,
|
||||
updated_at_utc = ? WHERE id = ? AND status != 'archived' AND deleted_at_utc IS NULL`
|
||||
);
|
||||
for (const pieceId of archivePieceIds) {
|
||||
archivePiece.run(now, pieceId);
|
||||
}
|
||||
|
||||
const updated = database
|
||||
.prepare(
|
||||
`UPDATE shows SET status = 'completed', completed_at_utc = ?, revision = revision + 1,
|
||||
updated_at_utc = ? WHERE id = ? AND revision = ? AND status != 'completed'`
|
||||
)
|
||||
.run(now, now, input.showId, input.expectedShowRevision);
|
||||
if (updated.changes !== 1) throw new Error('CONFLICT');
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO show_finalizations
|
||||
(show_id, command_id, source_revision, finalized_by_user_id, finalized_at_utc)
|
||||
VALUES (?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(input.showId, input.commandId, input.expectedShowRevision, input.actor.id, now);
|
||||
const recordArchivedPiece = database.prepare(
|
||||
'INSERT INTO show_finalization_archived_pieces (show_id, piece_id) VALUES (?, ?)'
|
||||
);
|
||||
for (const pieceId of archivePieceIds) {
|
||||
recordArchivedPiece.run(input.showId, pieceId);
|
||||
}
|
||||
return { duplicate: false };
|
||||
})();
|
||||
}
|
||||
@@ -7,6 +7,38 @@ function configuredPath(value: string | undefined, fallback: string): string {
|
||||
export function getServerPaths() {
|
||||
return {
|
||||
database: configuredPath(process.env.SENDEWERK_DB_PATH, '.data/sendewerk.sqlite'),
|
||||
uploads: configuredPath(process.env.SENDEWERK_UPLOAD_DIR, '.data/uploads')
|
||||
uploads: configuredPath(process.env.SENDEWERK_UPLOAD_DIR, '.data/uploads'),
|
||||
mailOutbox: configuredPath(process.env.SENDEWERK_MAIL_OUTBOX_DIR, '.data/mail-outbox')
|
||||
};
|
||||
}
|
||||
|
||||
export function getAuthConfig() {
|
||||
const configuredOrigin = process.env.SENDEWERK_APP_ORIGIN || process.env.CLOUDRON_APP_ORIGIN;
|
||||
if (process.env.NODE_ENV === 'production' && !configuredOrigin) {
|
||||
throw new Error('SENDEWERK_APP_ORIGIN muss im Produktionsbetrieb gesetzt sein.');
|
||||
}
|
||||
const origin = new URL(configuredOrigin || 'http://localhost:5173');
|
||||
return {
|
||||
origin,
|
||||
setupToken: process.env.SENDEWERK_SETUP_TOKEN || '',
|
||||
secureCookies: origin.protocol === 'https:'
|
||||
};
|
||||
}
|
||||
|
||||
export function getMailConfig() {
|
||||
const transport = process.env.SENDEWERK_MAIL_TRANSPORT || 'local';
|
||||
if (transport !== 'local' && transport !== 'smtp') {
|
||||
throw new Error('SENDEWERK_MAIL_TRANSPORT muss local oder smtp sein.');
|
||||
}
|
||||
return {
|
||||
transport,
|
||||
from:
|
||||
process.env.SENDEWERK_MAIL_FROM ||
|
||||
(transport === 'local' ? 'Sendewerk <sendewerk@localhost>' : ''),
|
||||
host: process.env.SENDEWERK_SMTP_HOST || '',
|
||||
port: Number(process.env.SENDEWERK_SMTP_PORT || '587'),
|
||||
secure: process.env.SENDEWERK_SMTP_SECURE === 'true',
|
||||
user: process.env.SENDEWERK_SMTP_USER || '',
|
||||
password: process.env.SENDEWERK_SMTP_PASSWORD || ''
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,380 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { existsSync, mkdtempSync, rmSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import {
|
||||
createPiece,
|
||||
createTaxonomy,
|
||||
deletePieceImage,
|
||||
deleteTaxonomy,
|
||||
duplicatePiece,
|
||||
getMediaFile,
|
||||
getPiece,
|
||||
getTaxonomy,
|
||||
listPieceTemplates,
|
||||
listPieces,
|
||||
loadPiecePresentationMetadata,
|
||||
savePiece,
|
||||
savePieceAsTemplate,
|
||||
setPieceArchived,
|
||||
setPieceDeleted,
|
||||
setPieceFavorite,
|
||||
uploadPieceImage,
|
||||
updateTaxonomy,
|
||||
type PieceInput
|
||||
} from './content.js';
|
||||
import { closeDatabase, getDatabase } from './database.js';
|
||||
import { renderMarkdown } from './markdown.js';
|
||||
|
||||
let directory: string;
|
||||
|
||||
beforeEach(() => {
|
||||
directory = mkdtempSync(path.join(tmpdir(), 'sendewerk-content-test-'));
|
||||
process.env.SENDEWERK_DB_PATH = path.join(directory, 'test.sqlite');
|
||||
process.env.SENDEWERK_UPLOAD_DIR = path.join(directory, 'uploads');
|
||||
execFileSync(process.execPath, ['scripts/migrate.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
execFileSync(process.execPath, ['scripts/seed.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
closeDatabase();
|
||||
delete process.env.SENDEWERK_DB_PATH;
|
||||
delete process.env.SENDEWERK_UPLOAD_DIR;
|
||||
rmSync(directory, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
function completeInput(overrides: Partial<PieceInput> = {}): PieceInput {
|
||||
return {
|
||||
title: 'Getestetes Piece',
|
||||
outputTitle: '',
|
||||
summary: 'Eine persistente Kurzbeschreibung.',
|
||||
formatId: 'format-talk',
|
||||
status: 'ready',
|
||||
durationSeconds: 420,
|
||||
intro: '**Starker Einstieg**',
|
||||
researchText: 'Private Recherche',
|
||||
moderationNotes: '- Punkt eins',
|
||||
transitionText: 'Weiter geht es.',
|
||||
presentationText: '## Sichtbare Aussage',
|
||||
presentationMode: 'text',
|
||||
presentationSourcePosition: null,
|
||||
presentationTitle: '',
|
||||
presentationDescription: '',
|
||||
presentationImageUrl: '',
|
||||
presentationSiteName: '',
|
||||
presentationProvider: '',
|
||||
presentationProviderId: '',
|
||||
presentationTitleManual: false,
|
||||
presentationDescriptionManual: false,
|
||||
presentationImageManual: false,
|
||||
presentationMetadataFetchedAtUtc: null,
|
||||
topicIds: ['topic-gaming', 'topic-internet'],
|
||||
categoryIds: ['cat-jc', 'cat-reaction'],
|
||||
sources: [
|
||||
{ label: 'Dokumentation', url: 'https://example.com/dokumentation', timecodeSeconds: 75 }
|
||||
],
|
||||
...overrides,
|
||||
preparationEffort: overrides.preparationEffort ?? null
|
||||
};
|
||||
}
|
||||
|
||||
describe('content management', () => {
|
||||
it('sorts global favorites first without changing their revision', () => {
|
||||
const before = getPiece('piece-console')!;
|
||||
setPieceFavorite('piece-console', true);
|
||||
const pieces = listPieces({ statuses: ['ready'] });
|
||||
expect(pieces[0]).toMatchObject({ id: 'piece-console', isFavorite: true });
|
||||
expect(getPiece('piece-console')).toMatchObject({
|
||||
isFavorite: true,
|
||||
revision: before.revision,
|
||||
status: before.status
|
||||
});
|
||||
});
|
||||
|
||||
it('persists independently versioned templates and copies their complete snapshot', () => {
|
||||
const sourceId = createPiece('talk');
|
||||
const source = getPiece(sourceId)!;
|
||||
savePiece(
|
||||
sourceId,
|
||||
source.revision,
|
||||
completeInput({
|
||||
title: 'Interner Vorlagentitel',
|
||||
outputTitle: 'Titel für die Ausgabe',
|
||||
presentationText: 'Unveränderlicher Vorlagentext'
|
||||
})
|
||||
);
|
||||
const created = savePieceAsTemplate(sourceId, 'Eigene Vorlage', 'Redaktioneller Stand');
|
||||
const template = listPieceTemplates().find((entry) => entry.id === created.id)!;
|
||||
expect(template).toMatchObject({ name: 'Eigene Vorlage', revision: 1 });
|
||||
|
||||
const changed = getPiece(sourceId)!;
|
||||
savePiece(sourceId, changed.revision, {
|
||||
...changed,
|
||||
status: 'ready',
|
||||
presentationText: 'Spätere Änderung'
|
||||
});
|
||||
const copyId = createPiece(created.id);
|
||||
expect(getPiece(copyId)).toMatchObject({
|
||||
title: 'Interner Vorlagentitel',
|
||||
outputTitle: 'Titel für die Ausgabe',
|
||||
presentationText: 'Unveränderlicher Vorlagentext',
|
||||
sources: [
|
||||
{ label: 'Dokumentation', url: 'https://example.com/dokumentation', timecodeSeconds: 75 }
|
||||
]
|
||||
});
|
||||
|
||||
const updated = savePieceAsTemplate(sourceId, 'Eigene Vorlage', 'Neuer Stand', created.id, 1);
|
||||
expect(updated.revision).toBe(2);
|
||||
expect(() =>
|
||||
savePieceAsTemplate(sourceId, 'Eigene Vorlage', 'Veraltet', created.id, 1)
|
||||
).toThrow('CONFLICT');
|
||||
});
|
||||
|
||||
it('persists complete pieces and rejects stale revisions atomically', () => {
|
||||
const id = createPiece('talk');
|
||||
const initial = getPiece(id)!;
|
||||
const saved = savePiece(id, initial.revision, completeInput());
|
||||
const piece = getPiece(id)!;
|
||||
|
||||
expect(saved.revision).toBe(2);
|
||||
expect(piece).toMatchObject({
|
||||
title: 'Getestetes Piece',
|
||||
status: 'ready',
|
||||
researchText: 'Private Recherche',
|
||||
topicIds: ['topic-gaming', 'topic-internet'],
|
||||
categoryIds: ['cat-jc', 'cat-reaction']
|
||||
});
|
||||
expect(piece.sources).toEqual([
|
||||
{ label: 'Dokumentation', url: 'https://example.com/dokumentation', timecodeSeconds: 75 }
|
||||
]);
|
||||
expect(() =>
|
||||
savePiece(id, initial.revision, completeInput({ title: 'Veralteter Titel', topicIds: [] }))
|
||||
).toThrow('CONFLICT');
|
||||
expect(getPiece(id)).toMatchObject({
|
||||
title: 'Getestetes Piece',
|
||||
topicIds: ['topic-gaming', 'topic-internet']
|
||||
});
|
||||
});
|
||||
|
||||
it('stores fetched preview metadata and preserves manual corrections on reload', async () => {
|
||||
const id = createPiece('find');
|
||||
const initial = getPiece(id)!;
|
||||
const saved = savePiece(
|
||||
id,
|
||||
initial.revision,
|
||||
completeInput({
|
||||
presentationMode: 'link',
|
||||
presentationSourcePosition: 0,
|
||||
presentationTitle: 'Manueller Titel',
|
||||
presentationTitleManual: true
|
||||
})
|
||||
);
|
||||
const loaded = await loadPiecePresentationMetadata(id, saved.revision, async () => ({
|
||||
title: 'Automatischer Titel',
|
||||
description: 'Geladener Anreißer',
|
||||
imageUrl: 'https://example.com/vorschau.jpg',
|
||||
siteName: 'Example',
|
||||
provider: '',
|
||||
providerId: ''
|
||||
}));
|
||||
expect(getPiece(id)).toMatchObject({
|
||||
revision: loaded.revision,
|
||||
presentationTitle: 'Manueller Titel',
|
||||
presentationDescription: 'Geladener Anreißer',
|
||||
presentationImageUrl: 'https://example.com/vorschau.jpg',
|
||||
presentationSiteName: 'Example'
|
||||
});
|
||||
|
||||
await loadPiecePresentationMetadata(id, loaded.revision, async () => ({
|
||||
title: 'Anderer automatischer Titel',
|
||||
description: 'Aktualisierter Anreißer',
|
||||
imageUrl: '',
|
||||
siteName: 'Example',
|
||||
provider: '',
|
||||
providerId: ''
|
||||
}));
|
||||
expect(getPiece(id)).toMatchObject({
|
||||
presentationTitle: 'Manueller Titel',
|
||||
presentationDescription: 'Aktualisierter Anreißer'
|
||||
});
|
||||
});
|
||||
|
||||
it('searches independent taxonomies and archives, restores and duplicates pieces', async () => {
|
||||
createTaxonomy('topic', 'Technikgeschichte', 'microchip');
|
||||
const topic = getTaxonomy().topics.find((entry) => entry.name === 'Technikgeschichte')!;
|
||||
expect(topic.iconName).toBe('microchip');
|
||||
updateTaxonomy('topic', topic.id, 'Computergeschichte', 'microchip');
|
||||
expect(getTaxonomy().topics.find((entry) => entry.id === topic.id)).toMatchObject({
|
||||
name: 'Computergeschichte',
|
||||
iconName: 'microchip'
|
||||
});
|
||||
expect(() => updateTaxonomy('topic', topic.id, 'Computergeschichte', '../unsafe')).toThrow(
|
||||
'INVALID_ICON'
|
||||
);
|
||||
const sourceId = createPiece('find');
|
||||
const source = getPiece(sourceId)!;
|
||||
savePiece(
|
||||
sourceId,
|
||||
source.revision,
|
||||
completeInput({
|
||||
title: 'Seltene Hardware',
|
||||
formatId: 'format-find',
|
||||
topicIds: [topic.id],
|
||||
categoryIds: ['cat-reaction']
|
||||
})
|
||||
);
|
||||
|
||||
expect(
|
||||
listPieces({ statuses: ['ready'], query: 'dokumentation', topicId: topic.id })
|
||||
).toHaveLength(1);
|
||||
expect(listPieces({ statuses: ['ready'], query: '%' })).toHaveLength(0);
|
||||
expect(() => deleteTaxonomy('topic', topic.id)).toThrow('TAXONOMY_IN_USE');
|
||||
createTaxonomy('topic', 'Unbenutzt');
|
||||
const unused = getTaxonomy().topics.find((entry) => entry.name === 'Unbenutzt')!;
|
||||
deleteTaxonomy('topic', unused.id);
|
||||
expect(getTaxonomy().topics.some((entry) => entry.id === unused.id)).toBe(false);
|
||||
expect(() => deleteTaxonomy('format', 'format-find')).toThrow('TAXONOMY_IN_USE');
|
||||
const duplicateId = await duplicatePiece(sourceId);
|
||||
expect(getPiece(duplicateId)).toMatchObject({
|
||||
title: 'Kopie von Seltene Hardware',
|
||||
status: 'preparing',
|
||||
topicIds: [topic.id]
|
||||
});
|
||||
const current = getPiece(sourceId)!;
|
||||
setPieceArchived(sourceId, current.revision, true);
|
||||
expect(listPieces({ statuses: ['ready'] }).some((piece) => piece.id === sourceId)).toBe(false);
|
||||
const archived = listPieces({ statuses: ['archived'] }).find((piece) => piece.id === sourceId)!;
|
||||
setPieceArchived(sourceId, archived.revision, false);
|
||||
expect(getPiece(sourceId)?.status).toBe('ready');
|
||||
});
|
||||
|
||||
it('sanitizes dangerous markdown while preserving useful formatting', () => {
|
||||
const html = renderMarkdown(
|
||||
'# Verbotene Ebene\n\n**sicher** <script>globalThis.compromised = true</script> [Link](javascript:alert(1))'
|
||||
);
|
||||
expect(html).toContain('<strong>sicher</strong>');
|
||||
expect(html).not.toContain('<script');
|
||||
expect(html).not.toContain('javascript:');
|
||||
expect(html).not.toContain('<h1');
|
||||
});
|
||||
|
||||
it('accepts signed raster images, rejects disguised files and keeps storage private', async () => {
|
||||
const id = createPiece();
|
||||
const png = Buffer.from(
|
||||
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=',
|
||||
'base64'
|
||||
);
|
||||
const uploaded = await uploadPieceImage(
|
||||
id,
|
||||
1,
|
||||
new File([png], '../bild.png', { type: 'text/html' }),
|
||||
'Ein heller Pixel',
|
||||
true
|
||||
);
|
||||
const piece = getPiece(id)!;
|
||||
expect(piece.media).toHaveLength(1);
|
||||
expect(piece.media[0]).toMatchObject({ mimeType: 'image/png', altText: 'Ein heller Pixel' });
|
||||
expect(piece.presentationMediaId).toBe(uploaded.id);
|
||||
const media = await getMediaFile(piece.media[0].id);
|
||||
expect(media?.data.equals(png)).toBe(true);
|
||||
expect(existsSync(path.join(directory, 'uploads', '../bild.png'))).toBe(false);
|
||||
|
||||
await expect(
|
||||
uploadPieceImage(
|
||||
id,
|
||||
piece.revision,
|
||||
new File(['<script>alert(1)</script>'], 'angriff.png', { type: 'image/png' }),
|
||||
''
|
||||
)
|
||||
).rejects.toThrow('INVALID_IMAGE_TYPE');
|
||||
const stored = getDatabase()
|
||||
.prepare('SELECT storage_name FROM piece_media WHERE id = ?')
|
||||
.get(piece.media[0].id) as { storage_name: string };
|
||||
await deletePieceImage(id, piece.media[0].id, piece.revision);
|
||||
expect(getPiece(id)?.media).toHaveLength(0);
|
||||
expect(getPiece(id)?.presentationMediaId).toBeNull();
|
||||
expect(await getMediaFile(piece.media[0].id)).toBeNull();
|
||||
expect(existsSync(path.join(directory, 'uploads', stored.storage_name))).toBe(true);
|
||||
});
|
||||
|
||||
it('selects presentation media atomically, copies active media and omits media from templates', async () => {
|
||||
const id = createPiece();
|
||||
const png = Buffer.from(
|
||||
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=',
|
||||
'base64'
|
||||
);
|
||||
const selected = await uploadPieceImage(
|
||||
id,
|
||||
1,
|
||||
new File([png], 'auswahl.png', { type: 'image/png' }),
|
||||
'Auswahl',
|
||||
true
|
||||
);
|
||||
const second = await uploadPieceImage(
|
||||
id,
|
||||
selected.revision,
|
||||
new File([png], 'entfernt.png', { type: 'image/png' }),
|
||||
'Entfernt'
|
||||
);
|
||||
await deletePieceImage(id, second.id, second.revision);
|
||||
const source = getPiece(id)!;
|
||||
expect(() =>
|
||||
savePiece(id, source.revision, {
|
||||
...source,
|
||||
title: 'Darf nicht gespeichert werden',
|
||||
status: 'preparing',
|
||||
presentationMediaId: 'fremdes-medium'
|
||||
})
|
||||
).toThrow('presentation media does not belong to piece');
|
||||
expect(getPiece(id)).toMatchObject({
|
||||
title: 'Neues Piece',
|
||||
revision: source.revision,
|
||||
presentationMediaId: selected.id
|
||||
});
|
||||
|
||||
savePiece(id, source.revision, {
|
||||
...source,
|
||||
status: 'preparing',
|
||||
presentationMode: 'image'
|
||||
});
|
||||
const duplicateId = await duplicatePiece(id);
|
||||
const duplicate = getPiece(duplicateId)!;
|
||||
expect(duplicate.media).toHaveLength(1);
|
||||
expect(duplicate.presentationMediaId).toBe(duplicate.media[0].id);
|
||||
expect(duplicate.presentationMediaId).not.toBe(selected.id);
|
||||
expect(duplicate.presentationMode).toBe('image');
|
||||
|
||||
const template = savePieceAsTemplate(id, 'Ohne Medienreferenz', 'Nur Inhaltsdaten');
|
||||
const snapshot = getDatabase()
|
||||
.prepare('SELECT snapshot_json FROM piece_templates WHERE id = ?')
|
||||
.get(template.id) as { snapshot_json: string };
|
||||
expect(JSON.parse(snapshot.snapshot_json)).not.toHaveProperty('presentationMediaId');
|
||||
expect(getPiece(createPiece(template.id))?.presentationMediaId).toBeNull();
|
||||
});
|
||||
|
||||
it('soft-deletes pieces behind revisions and keeps their original media private', async () => {
|
||||
const id = createPiece();
|
||||
const png = Buffer.from(
|
||||
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=',
|
||||
'base64'
|
||||
);
|
||||
const uploaded = await uploadPieceImage(
|
||||
id,
|
||||
1,
|
||||
new File([png], 'privat.png', { type: 'image/png' }),
|
||||
'Privat'
|
||||
);
|
||||
const deleted = setPieceDeleted(id, uploaded.revision, true);
|
||||
expect(getPiece(id)).toBeNull();
|
||||
expect(listPieces({ statuses: ['preparing'] }).some((piece) => piece.id === id)).toBe(false);
|
||||
expect(await getMediaFile(uploaded.id)).toBeNull();
|
||||
expect(() => setPieceFavorite(id, true)).toThrow('NOT_FOUND');
|
||||
expect(() => savePiece(id, deleted.revision, completeInput())).toThrow('NOT_FOUND');
|
||||
expect(() => setPieceDeleted(id, uploaded.revision, false)).toThrow('CONFLICT');
|
||||
|
||||
const restored = setPieceDeleted(id, deleted.revision, false);
|
||||
expect(getPiece(id)).toMatchObject({ id, revision: restored.revision });
|
||||
expect((await getMediaFile(uploaded.id))?.data.equals(png)).toBe(true);
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,6 @@
|
||||
import Database from 'better-sqlite3';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { mkdtempSync, rmSync } from 'node:fs';
|
||||
import { mkdtempSync, readdirSync, readFileSync, rmSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
@@ -47,12 +47,28 @@ describe('database setup', () => {
|
||||
(SELECT count(*) FROM schema_migrations) AS migrations,
|
||||
(SELECT count(*) FROM pieces) AS pieces,
|
||||
(SELECT count(*) FROM shows) AS shows,
|
||||
(SELECT count(*) FROM piece_usages) AS usages`
|
||||
(SELECT count(*) FROM piece_usages) AS usages,
|
||||
(SELECT count(*) FROM show_templates) AS templates,
|
||||
(SELECT count(*) FROM show_sections WHERE is_reserve_bank = 1) AS reserve_banks`
|
||||
)
|
||||
.get() as { migrations: number; pieces: number; shows: number; usages: number };
|
||||
.get() as {
|
||||
migrations: number;
|
||||
pieces: number;
|
||||
shows: number;
|
||||
usages: number;
|
||||
templates: number;
|
||||
reserve_banks: number;
|
||||
};
|
||||
database.close();
|
||||
|
||||
expect(counts).toEqual({ migrations: 1, pieces: 4, shows: 1, usages: 3 });
|
||||
expect(counts).toEqual({
|
||||
migrations: 19,
|
||||
pieces: 6,
|
||||
shows: 2,
|
||||
usages: 5,
|
||||
templates: 2,
|
||||
reserve_banks: 2
|
||||
});
|
||||
expect(databasePath).not.toBe(path.resolve('.data/sendewerk.sqlite'));
|
||||
});
|
||||
|
||||
@@ -74,4 +90,97 @@ describe('database setup', () => {
|
||||
expect(show.totalDurationSeconds).toBe(5100);
|
||||
expect(show.sections[1].usages.find((usage) => usage.isReserve)?.durationSeconds).toBe(540);
|
||||
});
|
||||
|
||||
it('upgrades existing completed shows into stable finalizations exactly once', () => {
|
||||
const directory = mkdtempSync(path.join(tmpdir(), 'sendewerk-upgrade-test-'));
|
||||
temporaryDirectories.push(directory);
|
||||
const databasePath = path.join(directory, 'test.sqlite');
|
||||
const environment = {
|
||||
...process.env,
|
||||
SENDEWERK_DB_PATH: databasePath,
|
||||
SENDEWERK_UPLOAD_DIR: path.join(directory, 'uploads')
|
||||
};
|
||||
const database = new Database(databasePath);
|
||||
database.pragma('foreign_keys = ON');
|
||||
database.exec(
|
||||
'CREATE TABLE schema_migrations (name TEXT PRIMARY KEY, applied_at_utc TEXT NOT NULL)'
|
||||
);
|
||||
const migrationDirectory = path.resolve('migrations');
|
||||
const oldMigrations = readdirSync(migrationDirectory)
|
||||
.filter(
|
||||
(name) =>
|
||||
/^\d+.+\.sql$/.test(name) && !name.startsWith('0015_') && !name.startsWith('0016_')
|
||||
)
|
||||
.sort();
|
||||
for (const name of oldMigrations) {
|
||||
database.exec(readFileSync(path.join(migrationDirectory, name), 'utf8'));
|
||||
database
|
||||
.prepare('INSERT INTO schema_migrations (name, applied_at_utc) VALUES (?, ?)')
|
||||
.run(name, new Date().toISOString());
|
||||
}
|
||||
database.close();
|
||||
execFileSync(process.execPath, ['scripts/seed.mjs'], { cwd: process.cwd(), env: environment });
|
||||
|
||||
const legacy = new Database(databasePath);
|
||||
legacy.pragma('foreign_keys = ON');
|
||||
const usage = legacy
|
||||
.prepare(
|
||||
`SELECT u.id FROM piece_usages u JOIN show_sections s ON s.id = u.show_section_id
|
||||
WHERE s.show_id = 'show-october' AND s.is_reserve_bank = 0 LIMIT 1`
|
||||
)
|
||||
.get() as { id: string };
|
||||
legacy.prepare("UPDATE piece_usages SET status = 'done' WHERE id = ?").run(usage.id);
|
||||
legacy.prepare("UPDATE shows SET status = 'completed' WHERE id = 'show-october'").run();
|
||||
const completionMigration = '0015_completion_archive_and_shares.sql';
|
||||
legacy.exec(readFileSync(path.join(migrationDirectory, completionMigration), 'utf8'));
|
||||
legacy
|
||||
.prepare('INSERT INTO schema_migrations (name, applied_at_utc) VALUES (?, ?)')
|
||||
.run(completionMigration, new Date().toISOString());
|
||||
const now = new Date().toISOString();
|
||||
legacy
|
||||
.prepare(
|
||||
`INSERT INTO users (id, email, email_normalized, display_name, password_hash, role,
|
||||
password_changed_at_utc, created_at_utc, updated_at_utc)
|
||||
VALUES ('upgrade-barkeeper', 'upgrade@example.test', 'upgrade@example.test',
|
||||
'Upgrade', 'unused', 'barkeeper', ?, ?, ?)`
|
||||
)
|
||||
.run(now, now, now);
|
||||
legacy
|
||||
.prepare(
|
||||
`INSERT INTO show_shares
|
||||
(id, show_id, token_hash, scope, password_hash, expires_at_utc, revoked_at_utc,
|
||||
created_by_user_id, created_at_utc)
|
||||
VALUES ('upgrade-share', 'show-october', 'upgrade-token-hash', 'rundown', NULL,
|
||||
NULL, NULL, 'upgrade-barkeeper', ?)`
|
||||
)
|
||||
.run(now);
|
||||
legacy
|
||||
.prepare(
|
||||
`INSERT INTO show_share_sessions (token_hash, share_id, created_at_utc, expires_at_utc)
|
||||
VALUES ('upgrade-session-hash', 'upgrade-share', ?, ?)`
|
||||
)
|
||||
.run(now, new Date(Date.now() + 60_000).toISOString());
|
||||
legacy.close();
|
||||
|
||||
for (let run = 0; run < 2; run += 1) {
|
||||
execFileSync(process.execPath, ['scripts/migrate.mjs'], {
|
||||
cwd: process.cwd(),
|
||||
env: environment
|
||||
});
|
||||
}
|
||||
const upgraded = new Database(databasePath, { readonly: true });
|
||||
expect(
|
||||
upgraded
|
||||
.prepare(
|
||||
`SELECT
|
||||
(SELECT count(*) FROM show_finalizations WHERE show_id = 'show-october') AS finalizations,
|
||||
(SELECT count(*) FROM piece_usage_history WHERE show_id = 'show-october') AS history,
|
||||
(SELECT count(*) FROM show_shares WHERE id = 'upgrade-share') AS shares,
|
||||
(SELECT count(*) FROM show_share_sessions WHERE token_hash = 'upgrade-session-hash') AS sessions`
|
||||
)
|
||||
.get()
|
||||
).toEqual({ finalizations: 1, history: 1, shares: 1, sessions: 1 });
|
||||
expect(upgraded.pragma('foreign_key_check')).toEqual([]);
|
||||
upgraded.close();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,134 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { mkdtempSync, rmSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { closeDatabase, getDatabase } from './database.js';
|
||||
import {
|
||||
discardFeedEntries,
|
||||
fetchDueFeeds,
|
||||
fetchFeed,
|
||||
importFeedEntries,
|
||||
listFeedEntries,
|
||||
saveFeedSource
|
||||
} from './feeds.js';
|
||||
import { getPiece } from './content.js';
|
||||
|
||||
vi.mock('node:dns/promises', () => ({
|
||||
lookup: vi.fn(async () => [{ address: '93.184.216.34', family: 4 }])
|
||||
}));
|
||||
|
||||
const validFeed = `<?xml version="1.0"?><rss version="2.0"><channel><title>Test</title><item>
|
||||
<guid>entry-1</guid><title>Ein Beitrag</title><link>https://example.org/post</link>
|
||||
<description><![CDATA[<p>Kurz <strong>und</strong> gut.</p><script>evil()</script>]]></description>
|
||||
<pubDate>Sat, 24 Oct 2026 12:00:00 GMT</pubDate></item></channel></rss>`;
|
||||
|
||||
let directory: string;
|
||||
|
||||
beforeEach(() => {
|
||||
directory = mkdtempSync(path.join(tmpdir(), 'sendewerk-feed-test-'));
|
||||
process.env.SENDEWERK_DB_PATH = path.join(directory, 'test.sqlite');
|
||||
process.env.SENDEWERK_UPLOAD_DIR = path.join(directory, 'uploads');
|
||||
execFileSync(process.execPath, ['scripts/migrate.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
execFileSync(process.execPath, ['scripts/seed.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals();
|
||||
closeDatabase();
|
||||
delete process.env.SENDEWERK_DB_PATH;
|
||||
delete process.env.SENDEWERK_UPLOAD_DIR;
|
||||
rmSync(directory, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
describe('RSS import inbox', () => {
|
||||
it('keeps one entry across fetches and preserves a discard decision', async () => {
|
||||
vi.stubGlobal(
|
||||
'fetch',
|
||||
vi.fn(
|
||||
async () => new Response(validFeed, { headers: { 'content-type': 'application/rss+xml' } })
|
||||
)
|
||||
);
|
||||
const feedId = saveFeedSource(null, {
|
||||
name: 'Feed',
|
||||
url: 'https://example.org/feed.xml',
|
||||
isEnabled: true,
|
||||
refreshIntervalMinutes: 60,
|
||||
defaultCategoryId: null
|
||||
});
|
||||
await fetchFeed(feedId);
|
||||
const [entry] = listFeedEntries();
|
||||
expect(entry.title).toBe('Ein Beitrag');
|
||||
expect(discardFeedEntries([entry.id])).toBe(1);
|
||||
await fetchFeed(feedId);
|
||||
expect(listFeedEntries()).toHaveLength(0);
|
||||
expect(listFeedEntries('discarded')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('sanitizes foreign HTML and retains the original source on explicit import', async () => {
|
||||
vi.stubGlobal(
|
||||
'fetch',
|
||||
vi.fn(async () => new Response(validFeed))
|
||||
);
|
||||
const feedId = saveFeedSource(null, {
|
||||
name: 'Feed',
|
||||
url: 'https://example.org/feed.xml',
|
||||
isEnabled: true,
|
||||
refreshIntervalMinutes: 60,
|
||||
defaultCategoryId: 'cat-jc'
|
||||
});
|
||||
await fetchFeed(feedId);
|
||||
const [entry] = listFeedEntries();
|
||||
const [pieceId] = importFeedEntries([entry.id], []);
|
||||
const piece = getPiece(pieceId)!;
|
||||
expect(piece.summary).toContain('Kurz und gut.');
|
||||
expect(piece.summary).not.toContain('<script>');
|
||||
expect(piece.sources).toEqual([
|
||||
{ label: 'RSS: Originalbeitrag', url: 'https://example.org/post', timecodeSeconds: null }
|
||||
]);
|
||||
expect(piece.categoryIds).toEqual(['cat-jc']);
|
||||
});
|
||||
|
||||
it('isolates a broken feed while fetching other due feeds', async () => {
|
||||
vi.stubGlobal(
|
||||
'fetch',
|
||||
vi.fn(
|
||||
async (url: URL) => new Response(url.href.includes('broken') ? '<not-feed />' : validFeed)
|
||||
)
|
||||
);
|
||||
saveFeedSource(null, {
|
||||
name: 'A broken',
|
||||
url: 'https://example.org/broken.xml',
|
||||
isEnabled: true,
|
||||
refreshIntervalMinutes: 60,
|
||||
defaultCategoryId: null
|
||||
});
|
||||
saveFeedSource(null, {
|
||||
name: 'B valid',
|
||||
url: 'https://example.org/valid.xml',
|
||||
isEnabled: true,
|
||||
refreshIntervalMinutes: 60,
|
||||
defaultCategoryId: null
|
||||
});
|
||||
await fetchDueFeeds();
|
||||
expect(listFeedEntries()).toHaveLength(1);
|
||||
const errors = getDatabase()
|
||||
.prepare("SELECT count(*) AS count FROM feed_sources WHERE last_error <> ''")
|
||||
.get() as { count: number };
|
||||
expect(errors.count).toBe(1);
|
||||
});
|
||||
|
||||
it('blocks loopback targets before sending a request', async () => {
|
||||
const request = vi.fn();
|
||||
vi.stubGlobal('fetch', request);
|
||||
const feedId = saveFeedSource(null, {
|
||||
name: 'Local',
|
||||
url: 'http://127.0.0.1/feed.xml',
|
||||
isEnabled: false,
|
||||
refreshIntervalMinutes: 60,
|
||||
defaultCategoryId: null
|
||||
});
|
||||
await expect(fetchFeed(feedId)).rejects.toThrow('FEED_BLOCKED');
|
||||
expect(request).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,457 @@
|
||||
import { createHash, randomUUID } from 'node:crypto';
|
||||
import { lookup } from 'node:dns/promises';
|
||||
import { isIP } from 'node:net';
|
||||
import sanitizeHtml from 'sanitize-html';
|
||||
import { XMLParser } from 'fast-xml-parser';
|
||||
import { createPiece, getPiece, savePiece } from './content.js';
|
||||
import { getDatabase } from './database.js';
|
||||
|
||||
const MAX_FEED_BYTES = 2 * 1024 * 1024;
|
||||
const FETCH_TIMEOUT_MS = 8_000;
|
||||
const MAX_REDIRECTS = 3;
|
||||
|
||||
export type FeedSource = {
|
||||
id: string;
|
||||
name: string;
|
||||
url: string;
|
||||
isEnabled: boolean;
|
||||
refreshIntervalMinutes: number;
|
||||
defaultCategoryId: string | null;
|
||||
lastFetchedAtUtc: string | null;
|
||||
nextFetchAtUtc: string | null;
|
||||
lastError: string;
|
||||
};
|
||||
|
||||
export type FeedEntry = {
|
||||
id: string;
|
||||
feedId: string;
|
||||
feedName: string;
|
||||
title: string;
|
||||
url: string;
|
||||
summary: string;
|
||||
publishedAtUtc: string | null;
|
||||
status: 'new' | 'imported' | 'discarded';
|
||||
pieceId: string | null;
|
||||
defaultCategoryId: string | null;
|
||||
};
|
||||
|
||||
function clean(value: unknown, maximum: number) {
|
||||
return String(value ?? '')
|
||||
.trim()
|
||||
.slice(0, maximum);
|
||||
}
|
||||
|
||||
function validHttpUrl(value: string) {
|
||||
try {
|
||||
const url = new URL(value);
|
||||
return ['http:', 'https:'].includes(url.protocol) && !url.username && !url.password;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function privateIpv4(address: string) {
|
||||
const p = address.split('.').map(Number);
|
||||
return (
|
||||
p[0] === 0 ||
|
||||
p[0] === 10 ||
|
||||
p[0] === 127 ||
|
||||
(p[0] === 169 && p[1] === 254) ||
|
||||
(p[0] === 172 && p[1] >= 16 && p[1] <= 31) ||
|
||||
(p[0] === 192 && p[1] === 168) ||
|
||||
p[0] >= 224
|
||||
);
|
||||
}
|
||||
|
||||
function privateAddress(address: string) {
|
||||
if (isIP(address) === 4) return privateIpv4(address);
|
||||
const value = address.toLowerCase().split('%')[0];
|
||||
if (value === '::' || value === '::1' || value.startsWith('fc') || value.startsWith('fd'))
|
||||
return true;
|
||||
if (/^fe[89ab]/.test(value)) return true;
|
||||
const mapped = value.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/)?.[1];
|
||||
return mapped ? privateIpv4(mapped) : false;
|
||||
}
|
||||
|
||||
async function assertPublic(url: URL) {
|
||||
if (!validHttpUrl(url.href) || (url.port && !['80', '443'].includes(url.port)))
|
||||
throw new Error('FEED_BLOCKED');
|
||||
const hostname = url.hostname.replace(/^\[|\]$/g, '');
|
||||
if (hostname === 'localhost' || hostname.endsWith('.localhost')) throw new Error('FEED_BLOCKED');
|
||||
const addresses = isIP(hostname)
|
||||
? [{ address: hostname }]
|
||||
: await lookup(hostname, { all: true, verbatim: true });
|
||||
if (!addresses.length || addresses.some((entry) => privateAddress(entry.address)))
|
||||
throw new Error('FEED_BLOCKED');
|
||||
}
|
||||
|
||||
async function fetchXml(
|
||||
input: string,
|
||||
headers: Record<string, string>,
|
||||
redirects = 0
|
||||
): Promise<{ xml: string; etag: string; lastModified: string; unchanged: boolean }> {
|
||||
const url = new URL(input);
|
||||
await assertPublic(url);
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
Accept: 'application/rss+xml, application/atom+xml, application/xml, text/xml',
|
||||
...headers
|
||||
},
|
||||
redirect: 'manual',
|
||||
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS)
|
||||
});
|
||||
if ([301, 302, 303, 307, 308].includes(response.status)) {
|
||||
if (redirects >= MAX_REDIRECTS) throw new Error('FEED_REDIRECT');
|
||||
const location = response.headers.get('location');
|
||||
if (!location) throw new Error('FEED_FETCH');
|
||||
return fetchXml(new URL(location, url).href, headers, redirects + 1);
|
||||
}
|
||||
if (response.status === 304)
|
||||
return {
|
||||
xml: '',
|
||||
etag: headers['If-None-Match'] ?? '',
|
||||
lastModified: headers['If-Modified-Since'] ?? '',
|
||||
unchanged: true
|
||||
};
|
||||
if (!response.ok) throw new Error(`FEED_HTTP_${response.status}`);
|
||||
const declared = Number(response.headers.get('content-length') ?? 0);
|
||||
if (declared > MAX_FEED_BYTES) throw new Error('FEED_TOO_LARGE');
|
||||
const buffer = Buffer.from(await response.arrayBuffer());
|
||||
if (buffer.length > MAX_FEED_BYTES) throw new Error('FEED_TOO_LARGE');
|
||||
return {
|
||||
xml: buffer.toString('utf8'),
|
||||
etag: response.headers.get('etag') ?? '',
|
||||
lastModified: response.headers.get('last-modified') ?? '',
|
||||
unchanged: false
|
||||
};
|
||||
}
|
||||
|
||||
function values<T>(value: T | T[] | undefined): T[] {
|
||||
return value === undefined ? [] : Array.isArray(value) ? value : [value];
|
||||
}
|
||||
|
||||
function textFrom(value: unknown): string {
|
||||
if (typeof value === 'string' || typeof value === 'number') return String(value);
|
||||
if (value && typeof value === 'object') {
|
||||
const record = value as Record<string, unknown>;
|
||||
return textFrom(record['#text'] ?? record.__cdata ?? '');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function entryLink(value: unknown) {
|
||||
for (const link of values(
|
||||
value as Record<string, unknown> | Record<string, unknown>[] | string | undefined
|
||||
)) {
|
||||
if (typeof link === 'string') return link;
|
||||
if (link && typeof link === 'object') {
|
||||
const href = clean((link as Record<string, unknown>)['@_href'], 2_000);
|
||||
const rel = clean((link as Record<string, unknown>)['@_rel'], 30);
|
||||
if (href && (!rel || rel === 'alternate')) return href;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function parseDate(value: unknown) {
|
||||
const raw = textFrom(value);
|
||||
if (!raw) return null;
|
||||
const date = new Date(raw);
|
||||
return Number.isNaN(date.valueOf()) ? null : date.toISOString();
|
||||
}
|
||||
|
||||
function parseFeed(xml: string) {
|
||||
let document: Record<string, unknown>;
|
||||
try {
|
||||
document = new XMLParser({
|
||||
ignoreAttributes: false,
|
||||
processEntities: false,
|
||||
trimValues: true
|
||||
}).parse(xml) as Record<string, unknown>;
|
||||
} catch {
|
||||
throw new Error('INVALID_FEED');
|
||||
}
|
||||
const rssChannel = (document.rss as Record<string, unknown> | undefined)?.channel as
|
||||
Record<string, unknown> | undefined;
|
||||
const atom = document.feed as Record<string, unknown> | undefined;
|
||||
if (!rssChannel && !atom) throw new Error('INVALID_FEED');
|
||||
const rawEntries = values(
|
||||
(rssChannel?.item ?? atom?.entry) as
|
||||
Record<string, unknown> | Record<string, unknown>[] | undefined
|
||||
);
|
||||
return rawEntries.slice(0, 200).flatMap((entry) => {
|
||||
const title = clean(textFrom(entry.title), 300);
|
||||
const url = clean(entryLink(entry.link) || textFrom(entry.link), 2_000);
|
||||
if (!title || !validHttpUrl(url)) return [];
|
||||
const guid = clean(textFrom(entry.guid ?? entry.id), 2_000);
|
||||
const externalId = guid || createHash('sha256').update(url).digest('hex');
|
||||
const rawSummary = textFrom(entry.description ?? entry.summary ?? entry.content);
|
||||
const summary = clean(
|
||||
sanitizeHtml(rawSummary, { allowedTags: [], allowedAttributes: {} }),
|
||||
5_000
|
||||
);
|
||||
return [
|
||||
{
|
||||
externalId,
|
||||
title,
|
||||
url,
|
||||
summary,
|
||||
publishedAtUtc: parseDate(entry.pubDate ?? entry.published ?? entry.updated)
|
||||
}
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
export function listFeedSources(): FeedSource[] {
|
||||
return (
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`SELECT id, name, url, is_enabled, refresh_interval_minutes,
|
||||
default_category_id, last_fetched_at_utc, next_fetch_at_utc, last_error FROM feed_sources ORDER BY name`
|
||||
)
|
||||
.all() as Array<Record<string, unknown>>
|
||||
).map((row) => ({
|
||||
id: String(row.id),
|
||||
name: String(row.name),
|
||||
url: String(row.url),
|
||||
isEnabled: row.is_enabled === 1,
|
||||
refreshIntervalMinutes: Number(row.refresh_interval_minutes),
|
||||
defaultCategoryId: row.default_category_id ? String(row.default_category_id) : null,
|
||||
lastFetchedAtUtc: row.last_fetched_at_utc ? String(row.last_fetched_at_utc) : null,
|
||||
nextFetchAtUtc: row.next_fetch_at_utc ? String(row.next_fetch_at_utc) : null,
|
||||
lastError: String(row.last_error)
|
||||
}));
|
||||
}
|
||||
|
||||
export function saveFeedSource(
|
||||
id: string | null,
|
||||
input: {
|
||||
name: string;
|
||||
url: string;
|
||||
isEnabled: boolean;
|
||||
refreshIntervalMinutes: number;
|
||||
defaultCategoryId: string | null;
|
||||
}
|
||||
) {
|
||||
const name = clean(input.name, 120);
|
||||
const url = clean(input.url, 2_000);
|
||||
if (
|
||||
!name ||
|
||||
!validHttpUrl(url) ||
|
||||
!Number.isInteger(input.refreshIntervalMinutes) ||
|
||||
input.refreshIntervalMinutes < 15 ||
|
||||
input.refreshIntervalMinutes > 10080
|
||||
)
|
||||
throw new Error('INVALID_FEED');
|
||||
const database = getDatabase();
|
||||
if (
|
||||
input.defaultCategoryId &&
|
||||
!database.prepare('SELECT 1 FROM section_categories WHERE id = ?').get(input.defaultCategoryId)
|
||||
)
|
||||
throw new Error('INVALID_TAXONOMY');
|
||||
const now = new Date().toISOString();
|
||||
if (!id) {
|
||||
id = randomUUID();
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO feed_sources (id, name, url, is_enabled, refresh_interval_minutes,
|
||||
default_category_id, next_fetch_at_utc, created_at_utc, updated_at_utc) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(
|
||||
id,
|
||||
name,
|
||||
url,
|
||||
input.isEnabled ? 1 : 0,
|
||||
input.refreshIntervalMinutes,
|
||||
input.defaultCategoryId,
|
||||
input.isEnabled ? now : null,
|
||||
now,
|
||||
now
|
||||
);
|
||||
} else {
|
||||
const result = database
|
||||
.prepare(
|
||||
`UPDATE feed_sources SET name = ?, url = ?, is_enabled = ?, refresh_interval_minutes = ?,
|
||||
default_category_id = ?, next_fetch_at_utc = CASE WHEN ? = 1 THEN COALESCE(next_fetch_at_utc, ?) ELSE NULL END,
|
||||
updated_at_utc = ? WHERE id = ?`
|
||||
)
|
||||
.run(
|
||||
name,
|
||||
url,
|
||||
input.isEnabled ? 1 : 0,
|
||||
input.refreshIntervalMinutes,
|
||||
input.defaultCategoryId,
|
||||
input.isEnabled ? 1 : 0,
|
||||
now,
|
||||
now,
|
||||
id
|
||||
);
|
||||
if (!result.changes) throw new Error('NOT_FOUND');
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
export function deleteFeedSource(id: string) {
|
||||
if (!getDatabase().prepare('DELETE FROM feed_sources WHERE id = ?').run(id).changes)
|
||||
throw new Error('NOT_FOUND');
|
||||
}
|
||||
|
||||
export function listFeedEntries(status: 'new' | 'imported' | 'discarded' = 'new'): FeedEntry[] {
|
||||
return (
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`SELECT e.id, e.feed_id, f.name AS feed_name, e.title, e.url, e.summary,
|
||||
e.published_at_utc, e.status, e.piece_id, f.default_category_id FROM feed_entries e
|
||||
JOIN feed_sources f ON f.id = e.feed_id WHERE e.status = ? ORDER BY COALESCE(e.published_at_utc, e.first_seen_at_utc) DESC`
|
||||
)
|
||||
.all(status) as Array<Record<string, unknown>>
|
||||
).map((row) => ({
|
||||
id: String(row.id),
|
||||
feedId: String(row.feed_id),
|
||||
feedName: String(row.feed_name),
|
||||
title: String(row.title),
|
||||
url: String(row.url),
|
||||
summary: String(row.summary),
|
||||
publishedAtUtc: row.published_at_utc ? String(row.published_at_utc) : null,
|
||||
status: row.status as FeedEntry['status'],
|
||||
pieceId: row.piece_id ? String(row.piece_id) : null,
|
||||
defaultCategoryId: row.default_category_id ? String(row.default_category_id) : null
|
||||
}));
|
||||
}
|
||||
|
||||
export async function fetchFeed(feedId: string) {
|
||||
const database = getDatabase();
|
||||
const feed = database.prepare('SELECT * FROM feed_sources WHERE id = ?').get(feedId) as
|
||||
Record<string, unknown> | undefined;
|
||||
if (!feed) throw new Error('NOT_FOUND');
|
||||
const now = new Date();
|
||||
try {
|
||||
const response = await fetchXml(String(feed.url), {
|
||||
...(feed.etag ? { 'If-None-Match': String(feed.etag) } : {}),
|
||||
...(feed.last_modified ? { 'If-Modified-Since': String(feed.last_modified) } : {})
|
||||
});
|
||||
let inserted = 0;
|
||||
if (!response.unchanged) {
|
||||
const add =
|
||||
database.prepare(`INSERT INTO feed_entries (id, feed_id, external_id, title, url, summary,
|
||||
published_at_utc, first_seen_at_utc, updated_at_utc) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON CONFLICT(feed_id, external_id) DO UPDATE SET title = excluded.title, url = excluded.url,
|
||||
summary = excluded.summary, published_at_utc = excluded.published_at_utc, updated_at_utc = excluded.updated_at_utc`);
|
||||
for (const entry of parseFeed(response.xml)) {
|
||||
const existed = database
|
||||
.prepare('SELECT 1 FROM feed_entries WHERE feed_id = ? AND external_id = ?')
|
||||
.get(feedId, entry.externalId);
|
||||
add.run(
|
||||
randomUUID(),
|
||||
feedId,
|
||||
entry.externalId,
|
||||
entry.title,
|
||||
entry.url,
|
||||
entry.summary,
|
||||
entry.publishedAtUtc,
|
||||
now.toISOString(),
|
||||
now.toISOString()
|
||||
);
|
||||
if (!existed) inserted += 1;
|
||||
}
|
||||
}
|
||||
const next = new Date(
|
||||
now.getTime() + Number(feed.refresh_interval_minutes) * 60_000
|
||||
).toISOString();
|
||||
database
|
||||
.prepare(
|
||||
`UPDATE feed_sources SET etag = ?, last_modified = ?, last_fetched_at_utc = ?,
|
||||
next_fetch_at_utc = ?, last_error = '', updated_at_utc = ? WHERE id = ?`
|
||||
)
|
||||
.run(
|
||||
response.etag,
|
||||
response.lastModified,
|
||||
now.toISOString(),
|
||||
next,
|
||||
now.toISOString(),
|
||||
feedId
|
||||
);
|
||||
return { inserted, unchanged: response.unchanged };
|
||||
} catch (cause) {
|
||||
const message = cause instanceof Error ? cause.message.slice(0, 500) : 'FEED_FETCH';
|
||||
const next = new Date(
|
||||
now.getTime() + Number(feed.refresh_interval_minutes) * 60_000
|
||||
).toISOString();
|
||||
database
|
||||
.prepare(
|
||||
'UPDATE feed_sources SET last_fetched_at_utc = ?, next_fetch_at_utc = ?, last_error = ?, updated_at_utc = ? WHERE id = ?'
|
||||
)
|
||||
.run(now.toISOString(), next, message, now.toISOString(), feedId);
|
||||
throw cause;
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchDueFeeds() {
|
||||
const rows = getDatabase()
|
||||
.prepare(
|
||||
`SELECT id FROM feed_sources WHERE is_enabled = 1
|
||||
AND (next_fetch_at_utc IS NULL OR next_fetch_at_utc <= ?) ORDER BY next_fetch_at_utc LIMIT 10`
|
||||
)
|
||||
.all(new Date().toISOString()) as { id: string }[];
|
||||
for (const row of rows) await fetchFeed(row.id).catch(() => undefined);
|
||||
}
|
||||
|
||||
export function importFeedEntries(entryIds: string[], categoryIds: string[]) {
|
||||
const database = getDatabase();
|
||||
const categories = [...new Set(categoryIds.filter(Boolean))];
|
||||
if (categories.length > 20) throw new Error('INVALID_TAXONOMY');
|
||||
for (const category of categories)
|
||||
if (!database.prepare('SELECT 1 FROM section_categories WHERE id = ?').get(category))
|
||||
throw new Error('INVALID_TAXONOMY');
|
||||
return database.transaction(() =>
|
||||
entryIds.map((entryId) => {
|
||||
const entry = database
|
||||
.prepare(
|
||||
`SELECT e.*, f.default_category_id FROM feed_entries e JOIN feed_sources f ON f.id = e.feed_id
|
||||
WHERE e.id = ? AND e.status = 'new'`
|
||||
)
|
||||
.get(entryId) as Record<string, unknown> | undefined;
|
||||
if (!entry) throw new Error('NOT_FOUND');
|
||||
const pieceId = createPiece('blank');
|
||||
const piece = getPiece(pieceId)!;
|
||||
const assigned = categories.length
|
||||
? categories
|
||||
: entry.default_category_id
|
||||
? [String(entry.default_category_id)]
|
||||
: [];
|
||||
savePiece(pieceId, piece.revision, {
|
||||
...piece,
|
||||
title: String(entry.title),
|
||||
summary: String(entry.summary),
|
||||
status: 'inbox',
|
||||
categoryIds: assigned,
|
||||
sources: [{ label: 'RSS: Originalbeitrag', url: String(entry.url), timecodeSeconds: null }]
|
||||
});
|
||||
database
|
||||
.prepare(
|
||||
"UPDATE feed_entries SET status = 'imported', piece_id = ?, updated_at_utc = ? WHERE id = ?"
|
||||
)
|
||||
.run(pieceId, new Date().toISOString(), entryId);
|
||||
return pieceId;
|
||||
})
|
||||
)();
|
||||
}
|
||||
|
||||
export function discardFeedEntries(entryIds: string[]) {
|
||||
const database = getDatabase();
|
||||
const update = database.prepare(
|
||||
"UPDATE feed_entries SET status = 'discarded', updated_at_utc = ? WHERE id = ? AND status = 'new'"
|
||||
);
|
||||
const now = new Date().toISOString();
|
||||
return database.transaction(() =>
|
||||
entryIds.reduce((count, id) => count + update.run(now, id).changes, 0)
|
||||
)();
|
||||
}
|
||||
|
||||
let schedulerStarted = false;
|
||||
export function startFeedScheduler() {
|
||||
if (schedulerStarted || process.env.NODE_ENV === 'test') return;
|
||||
schedulerStarted = true;
|
||||
void fetchDueFeeds();
|
||||
setInterval(() => void fetchDueFeeds(), 60_000).unref();
|
||||
}
|
||||
@@ -0,0 +1,384 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import { closeDatabase, getDatabase } from './database.js';
|
||||
import {
|
||||
completeCurrent,
|
||||
clearPresentationChannel,
|
||||
getLiveView,
|
||||
getPresentationChannelStatus,
|
||||
getPresentationChannelView,
|
||||
getPresentationMedia,
|
||||
getPresentationView,
|
||||
goBack,
|
||||
issuePresentationAccess,
|
||||
moveOpenUsage,
|
||||
presentationChannelAccess,
|
||||
presentUsage,
|
||||
resumeUsage,
|
||||
rotatePresentationChannelKey,
|
||||
selectUsage,
|
||||
skipCurrent,
|
||||
startOrResumeLive
|
||||
} from './live.js';
|
||||
|
||||
let directory: string;
|
||||
|
||||
beforeEach(() => {
|
||||
directory = mkdtempSync(path.join(tmpdir(), 'sendewerk-live-test-'));
|
||||
process.env.SENDEWERK_DB_PATH = path.join(directory, 'test.sqlite');
|
||||
process.env.SENDEWERK_UPLOAD_DIR = path.join(directory, 'uploads');
|
||||
execFileSync(process.execPath, ['scripts/migrate.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
execFileSync(process.execPath, ['scripts/seed.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
closeDatabase();
|
||||
delete process.env.SENDEWERK_DB_PATH;
|
||||
delete process.env.SENDEWERK_UPLOAD_DIR;
|
||||
rmSync(directory, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
describe('live mode', () => {
|
||||
it('keeps elapsed section time while applying an updated section plan', () => {
|
||||
getDatabase()
|
||||
.prepare(
|
||||
"UPDATE show_sections SET explicit_duration_seconds = 300 WHERE id = 'section-stories'"
|
||||
)
|
||||
.run();
|
||||
const start = new Date('2026-10-23T18:00:00.000Z');
|
||||
startOrResumeLive('show-october', 'timer-start', 0, start);
|
||||
let live = getLiveView('show-october', new Date('2026-10-23T18:01:40.000Z'));
|
||||
expect(live.sectionTimer).toMatchObject({
|
||||
sectionId: 'section-stories',
|
||||
plannedDurationSeconds: 300,
|
||||
elapsedSeconds: 100
|
||||
});
|
||||
getDatabase()
|
||||
.prepare(
|
||||
"UPDATE show_sections SET explicit_duration_seconds = 600 WHERE id = 'section-stories'"
|
||||
)
|
||||
.run();
|
||||
live = getLiveView('show-october', new Date('2026-10-23T18:01:40.000Z'));
|
||||
expect(live.sectionTimer).toMatchObject({
|
||||
plannedDurationSeconds: 600,
|
||||
elapsedSeconds: 100
|
||||
});
|
||||
completeCurrent(
|
||||
'show-october',
|
||||
'timer-next-piece',
|
||||
live.liveRevision,
|
||||
new Date('2026-10-23T18:02:00.000Z')
|
||||
);
|
||||
live = getLiveView('show-october', new Date('2026-10-23T18:04:00.000Z'));
|
||||
expect(live.current?.id).toBe('usage-effects');
|
||||
expect(live.sectionTimer).toMatchObject({
|
||||
plannedDurationSeconds: 600,
|
||||
elapsedSeconds: 240
|
||||
});
|
||||
completeCurrent(
|
||||
'show-october',
|
||||
'timer-finish',
|
||||
live.liveRevision,
|
||||
new Date('2026-10-23T18:06:00.000Z')
|
||||
);
|
||||
expect(
|
||||
getLiveView('show-october', new Date('2026-10-23T18:07:00.000Z')).sectionTimer
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it('selects any rundown usage by stable id, including the first and completed entries', () => {
|
||||
let live = getLiveView('show-october');
|
||||
expect(() =>
|
||||
selectUsage('show-october', 'usage-effects', 'select-before-start', live.liveRevision)
|
||||
).toThrow('NOT_STARTED');
|
||||
startOrResumeLive('show-october', 'start-selection', live.liveRevision);
|
||||
live = getLiveView('show-october');
|
||||
selectUsage('show-october', 'usage-effects', 'select-second', live.liveRevision);
|
||||
live = getLiveView('show-october');
|
||||
expect(live.current?.id).toBe('usage-effects');
|
||||
|
||||
selectUsage('show-october', 'usage-console', 'select-first', live.liveRevision);
|
||||
live = getLiveView('show-october');
|
||||
expect(live.current?.id).toBe('usage-console');
|
||||
completeCurrent('show-october', 'complete-first', live.liveRevision);
|
||||
live = getLiveView('show-october');
|
||||
expect(
|
||||
live.sections
|
||||
.flatMap((section) => section.usages)
|
||||
.find((usage) => usage.id === 'usage-console')?.status
|
||||
).toBe('done');
|
||||
|
||||
expect(() =>
|
||||
selectUsage('show-october', 'usage-console', 'return-to-completed', live.liveRevision)
|
||||
).toThrow('INVALID_STATUS');
|
||||
resumeUsage('show-october', 'usage-console', 'resume-completed', live.liveRevision);
|
||||
expect(getLiveView('show-october').current).toMatchObject({
|
||||
id: 'usage-console',
|
||||
status: 'current'
|
||||
});
|
||||
});
|
||||
|
||||
it('resumes a completed piece and its earlier section timer without resetting total time', () => {
|
||||
const database = getDatabase();
|
||||
database
|
||||
.prepare(
|
||||
"UPDATE show_sections SET explicit_duration_seconds = 300 WHERE id = 'section-stories'"
|
||||
)
|
||||
.run();
|
||||
database
|
||||
.prepare("UPDATE show_sections SET explicit_duration_seconds = 200 WHERE id = 'section-game'")
|
||||
.run();
|
||||
database
|
||||
.prepare(
|
||||
"UPDATE piece_usages SET show_section_id = 'section-game', position = 0 WHERE id = 'usage-effects'"
|
||||
)
|
||||
.run();
|
||||
const start = new Date('2026-10-23T18:00:00.000Z');
|
||||
startOrResumeLive('show-october', 'resume-start', 0, start);
|
||||
completeCurrent('show-october', 'resume-next', 1, new Date('2026-10-23T18:01:00.000Z'));
|
||||
let live = getLiveView('show-october', new Date('2026-10-23T18:01:30.000Z'));
|
||||
expect(live.current?.id).toBe('usage-effects');
|
||||
resumeUsage(
|
||||
'show-october',
|
||||
'usage-console',
|
||||
'resume-earlier',
|
||||
live.liveRevision,
|
||||
new Date('2026-10-23T18:01:30.000Z')
|
||||
);
|
||||
live = getLiveView('show-october', new Date('2026-10-23T18:02:00.000Z'));
|
||||
expect(live.current).toMatchObject({ id: 'usage-console', status: 'current' });
|
||||
expect(live.completedCount).toBe(0);
|
||||
expect(live.sectionTimer).toMatchObject({
|
||||
sectionId: 'section-stories',
|
||||
plannedDurationSeconds: 300,
|
||||
elapsedSeconds: 90
|
||||
});
|
||||
expect(live.totalTimer.elapsedSeconds).toBe(120);
|
||||
});
|
||||
|
||||
it('keeps one stable output channel until its key is explicitly rotated', () => {
|
||||
expect(getPresentationChannelStatus('show-october')).toBe('disconnected');
|
||||
const key = issuePresentationAccess('show-october');
|
||||
expect(getPresentationChannelStatus('show-october')).toBe('connected');
|
||||
expect(issuePresentationAccess('show-october')).toBe(key);
|
||||
expect(presentationChannelAccess('default', key)).toBe(true);
|
||||
expect(getPresentationChannelView('default')).toEqual({
|
||||
revision: 1_000_000_000,
|
||||
content: null
|
||||
});
|
||||
|
||||
const replacement = rotatePresentationChannelKey('show-october');
|
||||
expect(replacement).not.toBe(key);
|
||||
expect(presentationChannelAccess('default', key)).toBe(false);
|
||||
expect(presentationChannelAccess('default', replacement)).toBe(true);
|
||||
startOrResumeLive('show-october', 'start-channel', 0);
|
||||
presentUsage('show-october', 'usage-console', 'present-channel', 1);
|
||||
expect(getPresentationChannelView('default')?.content).not.toBeNull();
|
||||
clearPresentationChannel();
|
||||
expect(getPresentationChannelStatus('show-october')).toBe('disconnected');
|
||||
expect(getPresentationChannelView('default')?.content).toBeNull();
|
||||
issuePresentationAccess('show-october');
|
||||
expect(getPresentationChannelView('default')?.content).toBeNull();
|
||||
});
|
||||
|
||||
it('restores live state, records actual intervals and applies commands only once', () => {
|
||||
const started = new Date('2026-10-22T18:00:00.000Z');
|
||||
const initial = getLiveView('show-october', started);
|
||||
expect(initial.current).toBeNull();
|
||||
|
||||
expect(startOrResumeLive('show-october', 'start-command', 0, started)).toEqual({
|
||||
revision: 1,
|
||||
duplicate: false
|
||||
});
|
||||
expect(startOrResumeLive('show-october', 'start-command', 0, started)).toEqual({
|
||||
revision: 1,
|
||||
duplicate: true
|
||||
});
|
||||
let live = getLiveView('show-october', new Date('2026-10-22T18:05:00.000Z'));
|
||||
expect(live.current?.id).toBe('usage-console');
|
||||
expect(live.current?.actualDurationSeconds).toBe(300);
|
||||
expect(() =>
|
||||
moveOpenUsage('show-october', 'usage-effects', live.show.revision, {
|
||||
sectionId: 'section-stories',
|
||||
position: 0
|
||||
})
|
||||
).toThrow('LIVE_ORDER_LOCKED');
|
||||
|
||||
completeCurrent('show-october', 'complete-console', 1, new Date('2026-10-22T18:05:00.000Z'));
|
||||
completeCurrent('show-october', 'complete-console', 1, new Date('2026-10-22T18:05:00.000Z'));
|
||||
live = getLiveView('show-october', new Date('2026-10-22T18:06:00.000Z'));
|
||||
expect(live.current?.id).toBe('usage-effects');
|
||||
expect(
|
||||
live.sections
|
||||
.flatMap((section) => section.usages)
|
||||
.find((usage) => usage.id === 'usage-console')
|
||||
).toMatchObject({ status: 'done', actualDurationSeconds: 300 });
|
||||
expect(
|
||||
getDatabase()
|
||||
.prepare('SELECT count(*) AS count FROM live_usage_runs WHERE usage_id = ?')
|
||||
.get('usage-console')
|
||||
).toEqual({ count: 1 });
|
||||
|
||||
expect(() => skipCurrent('show-october', 'stale-command', 1)).toThrow('CONFLICT');
|
||||
skipCurrent('show-october', 'skip-effects', 2, new Date('2026-10-22T18:06:00.000Z'));
|
||||
live = getLiveView('show-october', new Date('2026-10-22T18:07:00.000Z'));
|
||||
expect(live.current).toBeNull();
|
||||
expect(live.completedCount).toBe(2);
|
||||
|
||||
goBack('show-october', 'back-effects', 3, new Date('2026-10-22T18:07:00.000Z'));
|
||||
live = getLiveView('show-october', new Date('2026-10-22T18:08:00.000Z'));
|
||||
expect(live.current).toMatchObject({ id: 'usage-effects', status: 'current' });
|
||||
expect(live.current?.actualDurationSeconds).toBe(120);
|
||||
});
|
||||
|
||||
it('changes presentation only explicitly and exposes no private fields', async () => {
|
||||
const uploads = process.env.SENDEWERK_UPLOAD_DIR!;
|
||||
mkdirSync(uploads, { recursive: true });
|
||||
writeFileSync(path.join(uploads, 'presentation.png'), Buffer.from('test-image'));
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO piece_media (id, piece_id, storage_name, original_name, mime_type,
|
||||
byte_size, alt_text, position, created_at_utc) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(
|
||||
'presentation-image',
|
||||
'piece-console',
|
||||
'presentation.png',
|
||||
'private-original-name.png',
|
||||
'image/png',
|
||||
10,
|
||||
'Konsole auf dem Tisch',
|
||||
0,
|
||||
'2026-10-22T18:00:00.000Z'
|
||||
);
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO usage_tool_snapshots
|
||||
(id, usage_id, original_tool_id, name, start_url, work_url, note, position)
|
||||
VALUES ('private-live-tool', 'usage-console', NULL, 'Privates Werkzeug', '',
|
||||
'https://private.example.test/board', 'PRIVATE_TOOL_NOTE', 0)`
|
||||
)
|
||||
.run();
|
||||
|
||||
const token = issuePresentationAccess('show-october');
|
||||
expect(getPresentationView(token)).toEqual({ revision: 0, content: null });
|
||||
startOrResumeLive('show-october', 'start-output', 0);
|
||||
expect(getPresentationView(token)).toEqual({ revision: 0, content: null });
|
||||
|
||||
presentUsage('show-october', 'usage-console', 'present-console', 1);
|
||||
const output = getPresentationView(token)!;
|
||||
expect(output.content).toMatchObject({
|
||||
title: 'Die kleine Konsole mit dem großen Dreh',
|
||||
topics: ['Gaming'],
|
||||
images: [],
|
||||
sources: []
|
||||
});
|
||||
const serialized = JSON.stringify(output);
|
||||
expect(serialized).toContain('Weniger Leistung, mehr Idee.');
|
||||
expect(serialized).not.toContain('Herstellerangaben');
|
||||
expect(serialized).not.toContain('Moderationsstichpunkte');
|
||||
expect(serialized).not.toContain('private-original-name');
|
||||
expect(serialized).not.toContain('presentation.png');
|
||||
expect(serialized).not.toContain('https://example.com/console');
|
||||
expect(serialized).not.toContain('https://private.example.test/board');
|
||||
expect(serialized).not.toContain('PRIVATE_TOOL_NOTE');
|
||||
|
||||
const media = await getPresentationMedia(token, 'presentation-image');
|
||||
expect(media).toBeNull();
|
||||
expect(await getPresentationMedia(token, 'unknown-image')).toBeNull();
|
||||
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO usage_media_snapshots
|
||||
(id, usage_id, original_media_id, alt_text, position, is_presentation)
|
||||
VALUES ('presentation-snapshot', 'usage-console', 'presentation-image',
|
||||
'Konsole auf dem Tisch', 0, 1)`
|
||||
)
|
||||
.run();
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`UPDATE piece_usages SET presentation_mode_snapshot = 'text',
|
||||
presentation_image_only_snapshot = 1,
|
||||
presentation_image_url_snapshot = 'https://private.example.test/not-for-image-mode'
|
||||
WHERE id = 'usage-console'`
|
||||
)
|
||||
.run();
|
||||
presentUsage(
|
||||
'show-october',
|
||||
'usage-console',
|
||||
'present-image-only',
|
||||
getLiveView('show-october').liveRevision
|
||||
);
|
||||
expect(getPresentationView(token)?.content).toMatchObject({
|
||||
mode: 'image',
|
||||
imageUrl: '',
|
||||
images: [{ id: 'presentation-snapshot', altText: 'Konsole auf dem Tisch' }],
|
||||
sources: []
|
||||
});
|
||||
expect(await getPresentationMedia(token, 'presentation-snapshot')).toMatchObject({
|
||||
mimeType: 'image/png',
|
||||
byteSize: 10,
|
||||
altText: 'Konsole auf dem Tisch'
|
||||
});
|
||||
|
||||
const replacementToken = issuePresentationAccess('show-october');
|
||||
expect(replacementToken).toBe(token);
|
||||
expect(getPresentationView(token)?.content?.title).toBe(
|
||||
'Die kleine Konsole mit dem großen Dreh'
|
||||
);
|
||||
expect(getPresentationView(replacementToken)?.content?.title).toBe(
|
||||
'Die kleine Konsole mit dem großen Dreh'
|
||||
);
|
||||
});
|
||||
|
||||
it('projects only snapshotted link and video data and changes players explicitly', () => {
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`UPDATE piece_usages SET presentation_mode_snapshot = 'video',
|
||||
presentation_source_label_snapshot = 'YouTube',
|
||||
presentation_source_url_snapshot = 'https://youtu.be/dQw4w9WgXcQ',
|
||||
presentation_source_timecode_snapshot = 75,
|
||||
presentation_title_meta_snapshot = 'Videotitel',
|
||||
presentation_site_name_snapshot = 'YouTube',
|
||||
presentation_provider_snapshot = 'youtube',
|
||||
presentation_provider_id_snapshot = 'dQw4w9WgXcQ'
|
||||
WHERE id = 'usage-console'`
|
||||
)
|
||||
.run();
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`UPDATE piece_usages SET presentation_mode_snapshot = 'link',
|
||||
presentation_source_label_snapshot = 'Artikel',
|
||||
presentation_source_url_snapshot = 'https://example.com/artikel',
|
||||
presentation_title_meta_snapshot = 'Linktitel',
|
||||
presentation_description_snapshot = 'Öffentlicher Anreißer',
|
||||
presentation_site_name_snapshot = 'Example'
|
||||
WHERE id = 'usage-effects'`
|
||||
)
|
||||
.run();
|
||||
const token = issuePresentationAccess('show-october');
|
||||
presentUsage('show-october', 'usage-console', 'present-video', 0);
|
||||
expect(getPresentationView(token)?.content).toMatchObject({
|
||||
mode: 'video',
|
||||
previewTitle: 'Videotitel',
|
||||
embedUrl: 'https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?start=75',
|
||||
source: { url: 'https://youtu.be/dQw4w9WgXcQ', timecodeSeconds: 75 }
|
||||
});
|
||||
|
||||
presentUsage('show-october', 'usage-effects', 'present-link', 1);
|
||||
const link = getPresentationView(token)!;
|
||||
expect(link.content).toMatchObject({
|
||||
mode: 'link',
|
||||
previewTitle: 'Linktitel',
|
||||
description: 'Öffentlicher Anreißer',
|
||||
embedUrl: '',
|
||||
source: { label: 'Artikel', url: 'https://example.com/artikel' }
|
||||
});
|
||||
const serialized = JSON.stringify(link);
|
||||
expect(serialized).not.toContain('Herstellerangaben');
|
||||
expect(serialized).not.toContain('Moderationsstichpunkte');
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,49 @@
|
||||
import { mkdir, writeFile } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import nodemailer from 'nodemailer';
|
||||
import { getMailConfig, getServerPaths } from './config.js';
|
||||
|
||||
export type MailMessage = {
|
||||
to: string;
|
||||
subject: string;
|
||||
text: string;
|
||||
};
|
||||
|
||||
export async function sendMail(message: MailMessage): Promise<'local' | 'smtp'> {
|
||||
const config = getMailConfig();
|
||||
if (config.transport === 'local') {
|
||||
const outbox = getServerPaths().mailOutbox;
|
||||
await mkdir(outbox, { recursive: true, mode: 0o700 });
|
||||
const filename = `${new Date().toISOString().replaceAll(':', '-')}-${randomUUID()}.json`;
|
||||
await writeFile(
|
||||
path.join(outbox, filename),
|
||||
JSON.stringify({ from: config.from, ...message }, null, 2),
|
||||
{ encoding: 'utf8', mode: 0o600 }
|
||||
);
|
||||
return 'local';
|
||||
}
|
||||
|
||||
if (
|
||||
!config.host ||
|
||||
!config.from ||
|
||||
!Number.isInteger(config.port) ||
|
||||
config.port < 1 ||
|
||||
config.port > 65_535 ||
|
||||
Boolean(config.user) !== Boolean(config.password)
|
||||
) {
|
||||
throw new Error('Die SMTP-Konfiguration ist unvollständig.');
|
||||
}
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: config.host,
|
||||
port: config.port,
|
||||
secure: config.secure,
|
||||
requireTLS: !config.secure,
|
||||
connectionTimeout: 10_000,
|
||||
greetingTimeout: 10_000,
|
||||
socketTimeout: 20_000,
|
||||
auth: config.user ? { user: config.user, pass: config.password } : undefined
|
||||
});
|
||||
await transporter.sendMail({ from: config.from, ...message });
|
||||
return 'smtp';
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { marked } from 'marked';
|
||||
import sanitizeHtml from 'sanitize-html';
|
||||
|
||||
export function renderMarkdown(markdown: string): string {
|
||||
const rendered = marked.parse(markdown, {
|
||||
async: false,
|
||||
breaks: true,
|
||||
gfm: true
|
||||
}) as string;
|
||||
return sanitizeHtml(rendered, {
|
||||
allowedTags: [
|
||||
'p',
|
||||
'br',
|
||||
'strong',
|
||||
'em',
|
||||
'del',
|
||||
'blockquote',
|
||||
'ul',
|
||||
'ol',
|
||||
'li',
|
||||
'h2',
|
||||
'h3',
|
||||
'h4',
|
||||
'code',
|
||||
'pre',
|
||||
'a',
|
||||
'hr'
|
||||
],
|
||||
allowedAttributes: {
|
||||
a: ['href', 'title', 'target', 'rel']
|
||||
},
|
||||
allowedSchemes: ['http', 'https', 'mailto'],
|
||||
allowProtocolRelative: false,
|
||||
enforceHtmlBoundary: true,
|
||||
transformTags: {
|
||||
a: (_tagName, attributes) => ({
|
||||
tagName: 'a',
|
||||
attribs: { ...attributes, target: '_blank', rel: 'noopener noreferrer' }
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
buildEmbedUrl,
|
||||
detectVideoProvider,
|
||||
extractMetadataFromHtml,
|
||||
fetchPresentationMetadata
|
||||
} from './presentation.js';
|
||||
|
||||
describe('presentation metadata and providers', () => {
|
||||
it('recognizes supported YouTube URL forms and creates privacy-enhanced embeds with start time', () => {
|
||||
for (const url of [
|
||||
'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
|
||||
'https://youtu.be/dQw4w9WgXcQ',
|
||||
'https://www.youtube.com/shorts/dQw4w9WgXcQ',
|
||||
'https://youtube.com/live/dQw4w9WgXcQ'
|
||||
]) {
|
||||
expect(detectVideoProvider(url)).toEqual({ provider: 'youtube', id: 'dQw4w9WgXcQ' });
|
||||
}
|
||||
expect(buildEmbedUrl('youtube', 'dQw4w9WgXcQ', 75)).toBe(
|
||||
'https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?start=75'
|
||||
);
|
||||
expect(detectVideoProvider('https://evil.example/watch?v=dQw4w9WgXcQ')).toBeNull();
|
||||
expect(detectVideoProvider('https://youtube.com/watch?v=invalid')).toBeNull();
|
||||
});
|
||||
|
||||
it('recognizes canonical TikTok videos without inventing a start parameter', () => {
|
||||
expect(
|
||||
detectVideoProvider('https://www.tiktok.com/@scout2015/video/6718335390845095173')
|
||||
).toEqual({ provider: 'tiktok', id: '6718335390845095173' });
|
||||
expect(buildEmbedUrl('tiktok', '6718335390845095173', 90)).toBe(
|
||||
'https://www.tiktok.com/player/v1/6718335390845095173?autoplay=0&controls=1'
|
||||
);
|
||||
});
|
||||
|
||||
it('extracts generic metadata from local HTML and tolerates a missing image', async () => {
|
||||
const metadata = await extractMetadataFromHtml(
|
||||
`<!doctype html><html><head>
|
||||
<meta property="og:title" content="Lokale Vorschau">
|
||||
<meta property="og:description" content="Ein kurzer Anreißer">
|
||||
<meta property="og:site_name" content="Testseite">
|
||||
</head></html>`,
|
||||
'https://example.com/artikel'
|
||||
);
|
||||
expect(metadata).toMatchObject({
|
||||
title: 'Lokale Vorschau',
|
||||
description: 'Ein kurzer Anreißer',
|
||||
imageUrl: '',
|
||||
siteName: 'Testseite'
|
||||
});
|
||||
});
|
||||
|
||||
it('rejects malformed and private metadata targets before a network request', async () => {
|
||||
await expect(fetchPresentationMetadata('keine-url')).rejects.toThrow('FETCH_INVALID_URL');
|
||||
await expect(fetchPresentationMetadata('http://127.0.0.1/private')).rejects.toThrow(
|
||||
'FETCH_BLOCKED'
|
||||
);
|
||||
await expect(fetchPresentationMetadata('http://[::1]/private')).rejects.toThrow(
|
||||
'FETCH_BLOCKED'
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,275 @@
|
||||
import { lookup } from 'node:dns/promises';
|
||||
import { isIP } from 'node:net';
|
||||
import http from 'node:http';
|
||||
import https from 'node:https';
|
||||
import metascraper from 'metascraper';
|
||||
import description from 'metascraper-description';
|
||||
import image from 'metascraper-image';
|
||||
import publisher from 'metascraper-publisher';
|
||||
import title from 'metascraper-title';
|
||||
|
||||
export type PresentationMode = 'text' | 'image' | 'link' | 'video';
|
||||
export type VideoProvider = 'youtube' | 'tiktok';
|
||||
|
||||
export type PresentationMetadata = {
|
||||
title: string;
|
||||
description: string;
|
||||
imageUrl: string;
|
||||
siteName: string;
|
||||
provider: VideoProvider | '';
|
||||
providerId: string;
|
||||
};
|
||||
|
||||
export type PresentationSource = {
|
||||
label: string;
|
||||
url: string;
|
||||
timecodeSeconds: number | null;
|
||||
};
|
||||
|
||||
export type PresentationContent = {
|
||||
mode: PresentationMode;
|
||||
topics: string[];
|
||||
title: string;
|
||||
html: string;
|
||||
source: PresentationSource | null;
|
||||
previewTitle: string;
|
||||
description: string;
|
||||
imageUrl: string;
|
||||
siteName: string;
|
||||
provider: VideoProvider | '';
|
||||
providerId: string;
|
||||
embedUrl: string;
|
||||
};
|
||||
|
||||
const scrape = metascraper([title(), description({ truncateLength: 500 }), image(), publisher()]);
|
||||
const MAX_HTML_BYTES = 1024 * 1024;
|
||||
const MAX_IMAGE_BYTES = 5 * 1024 * 1024;
|
||||
const REQUEST_TIMEOUT_MS = 5_000;
|
||||
const MAX_REDIRECTS = 3;
|
||||
|
||||
function isPrivateIpv4(address: string) {
|
||||
const parts = address.split('.').map(Number);
|
||||
return (
|
||||
parts[0] === 0 ||
|
||||
parts[0] === 10 ||
|
||||
parts[0] === 127 ||
|
||||
(parts[0] === 169 && parts[1] === 254) ||
|
||||
(parts[0] === 172 && parts[1] >= 16 && parts[1] <= 31) ||
|
||||
(parts[0] === 192 && parts[1] === 168) ||
|
||||
(parts[0] === 100 && parts[1] >= 64 && parts[1] <= 127) ||
|
||||
parts[0] >= 224
|
||||
);
|
||||
}
|
||||
|
||||
function isPrivateAddress(address: string) {
|
||||
if (isIP(address) === 4) return isPrivateIpv4(address);
|
||||
const normalized = address.toLowerCase().split('%')[0];
|
||||
if (normalized === '::' || normalized === '::1') return true;
|
||||
if (normalized.startsWith('fc') || normalized.startsWith('fd') || normalized.startsWith('fe8')) {
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
normalized.startsWith('fe9') ||
|
||||
normalized.startsWith('fea') ||
|
||||
normalized.startsWith('feb')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
const mapped = normalized.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/)?.[1];
|
||||
return mapped ? isPrivateIpv4(mapped) : false;
|
||||
}
|
||||
|
||||
async function publicAddress(url: URL) {
|
||||
if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password) {
|
||||
throw new Error('FETCH_BLOCKED');
|
||||
}
|
||||
if (url.port && url.port !== (url.protocol === 'https:' ? '443' : '80')) {
|
||||
throw new Error('FETCH_BLOCKED');
|
||||
}
|
||||
const hostname = url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname;
|
||||
if (hostname === 'localhost' || hostname.endsWith('.localhost')) {
|
||||
throw new Error('FETCH_BLOCKED');
|
||||
}
|
||||
const addresses = isIP(hostname)
|
||||
? [{ address: hostname, family: isIP(hostname) }]
|
||||
: await lookup(hostname, { all: true, verbatim: true }).catch(() => {
|
||||
throw new Error('FETCH_UNAVAILABLE');
|
||||
});
|
||||
if (!addresses.length || addresses.some((entry) => isPrivateAddress(entry.address))) {
|
||||
throw new Error('FETCH_BLOCKED');
|
||||
}
|
||||
return addresses[0];
|
||||
}
|
||||
|
||||
async function requestPublic(
|
||||
input: string,
|
||||
accept: string,
|
||||
maximumBytes: number,
|
||||
redirects = 0
|
||||
): Promise<{ url: string; contentType: string; data: Buffer }> {
|
||||
let url: URL;
|
||||
try {
|
||||
url = new URL(input);
|
||||
} catch {
|
||||
throw new Error('FETCH_INVALID_URL');
|
||||
}
|
||||
const target = await publicAddress(url);
|
||||
const client = url.protocol === 'https:' ? https : http;
|
||||
return new Promise((resolve, reject) => {
|
||||
const request = client.get(
|
||||
url,
|
||||
{
|
||||
headers: {
|
||||
Accept: accept,
|
||||
'User-Agent': 'Sendewerk/0.5.1 (+https://git.hnz.io/hnzio/sendewerk)'
|
||||
},
|
||||
lookup: (_hostname, _options, callback) =>
|
||||
callback(null, target.address, target.family as 4 | 6)
|
||||
},
|
||||
(response) => {
|
||||
const status = response.statusCode ?? 0;
|
||||
if (status >= 300 && status < 400 && response.headers.location) {
|
||||
response.resume();
|
||||
if (redirects >= MAX_REDIRECTS) return reject(new Error('FETCH_REDIRECTS'));
|
||||
const next = new URL(response.headers.location, url).href;
|
||||
requestPublic(next, accept, maximumBytes, redirects + 1).then(resolve, reject);
|
||||
return;
|
||||
}
|
||||
if (status < 200 || status >= 300) {
|
||||
response.resume();
|
||||
return reject(new Error('FETCH_UNAVAILABLE'));
|
||||
}
|
||||
const chunks: Buffer[] = [];
|
||||
let size = 0;
|
||||
response.on('data', (chunk: Buffer) => {
|
||||
size += chunk.length;
|
||||
if (size > maximumBytes) {
|
||||
request.destroy(new Error('FETCH_TOO_LARGE'));
|
||||
return;
|
||||
}
|
||||
chunks.push(chunk);
|
||||
});
|
||||
response.on('end', () =>
|
||||
resolve({
|
||||
url: url.href,
|
||||
contentType: String(response.headers['content-type'] ?? ''),
|
||||
data: Buffer.concat(chunks)
|
||||
})
|
||||
);
|
||||
}
|
||||
);
|
||||
request.setTimeout(REQUEST_TIMEOUT_MS, () => request.destroy(new Error('FETCH_TIMEOUT')));
|
||||
request.on('error', reject);
|
||||
});
|
||||
}
|
||||
|
||||
export function detectVideoProvider(input: string): {
|
||||
provider: VideoProvider;
|
||||
id: string;
|
||||
} | null {
|
||||
let url: URL;
|
||||
try {
|
||||
url = new URL(input);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
if (url.protocol !== 'https:' || url.username || url.password || url.port) return null;
|
||||
const host = url.hostname.toLowerCase();
|
||||
let youtubeId = '';
|
||||
if (host === 'youtu.be') youtubeId = url.pathname.split('/').filter(Boolean)[0] ?? '';
|
||||
if (host === 'youtube.com' || host === 'www.youtube.com' || host === 'm.youtube.com') {
|
||||
if (url.pathname === '/watch') youtubeId = url.searchParams.get('v') ?? '';
|
||||
else if (/^\/(shorts|embed|live)\//.test(url.pathname)) {
|
||||
youtubeId = url.pathname.split('/').filter(Boolean)[1] ?? '';
|
||||
}
|
||||
}
|
||||
if (/^[A-Za-z0-9_-]{11}$/.test(youtubeId)) {
|
||||
return { provider: 'youtube', id: youtubeId };
|
||||
}
|
||||
if (host === 'tiktok.com' || host === 'www.tiktok.com' || host === 'm.tiktok.com') {
|
||||
const id = url.pathname.match(/\/video\/(\d+)/)?.[1] ?? '';
|
||||
if (/^\d+$/.test(id)) return { provider: 'tiktok', id };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function buildEmbedUrl(
|
||||
provider: VideoProvider | '',
|
||||
providerId: string,
|
||||
timecodeSeconds: number | null
|
||||
) {
|
||||
if (provider === 'youtube' && /^[A-Za-z0-9_-]{11}$/.test(providerId)) {
|
||||
const url = new URL(`https://www.youtube-nocookie.com/embed/${providerId}`);
|
||||
if (timecodeSeconds && timecodeSeconds > 0)
|
||||
url.searchParams.set('start', String(timecodeSeconds));
|
||||
return url.href;
|
||||
}
|
||||
if (provider === 'tiktok' && /^\d+$/.test(providerId)) {
|
||||
const url = new URL(`https://www.tiktok.com/player/v1/${providerId}`);
|
||||
url.searchParams.set('autoplay', '0');
|
||||
url.searchParams.set('controls', '1');
|
||||
return url.href;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
export async function extractMetadataFromHtml(
|
||||
html: string,
|
||||
url: string
|
||||
): Promise<PresentationMetadata> {
|
||||
const metadata = await scrape({ html, url });
|
||||
return {
|
||||
title: String(metadata.title ?? '').slice(0, 300),
|
||||
description: String(metadata.description ?? '').slice(0, 1_000),
|
||||
imageUrl: String(metadata.image ?? '').slice(0, 2_000),
|
||||
siteName: String(metadata.publisher ?? new URL(url).hostname).slice(0, 200),
|
||||
provider: '',
|
||||
providerId: ''
|
||||
};
|
||||
}
|
||||
|
||||
async function providerMetadata(url: string, provider: VideoProvider) {
|
||||
const endpoint =
|
||||
provider === 'youtube'
|
||||
? `https://www.youtube.com/oembed?format=json&url=${encodeURIComponent(url)}`
|
||||
: `https://www.tiktok.com/oembed?url=${encodeURIComponent(url)}`;
|
||||
const response = await requestPublic(endpoint, 'application/json', 256 * 1024);
|
||||
if (!response.contentType.toLowerCase().includes('json')) throw new Error('FETCH_INVALID_TYPE');
|
||||
const value = JSON.parse(response.data.toString('utf8')) as Record<string, unknown>;
|
||||
return {
|
||||
title: String(value.title ?? '').slice(0, 300),
|
||||
description: '',
|
||||
imageUrl: String(value.thumbnail_url ?? '').slice(0, 2_000),
|
||||
siteName: String(value.provider_name ?? (provider === 'youtube' ? 'YouTube' : 'TikTok')).slice(
|
||||
0,
|
||||
200
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
export async function fetchPresentationMetadata(url: string): Promise<PresentationMetadata> {
|
||||
const video = detectVideoProvider(url);
|
||||
if (video) {
|
||||
const metadata = await providerMetadata(url, video.provider);
|
||||
return { ...metadata, provider: video.provider, providerId: video.id };
|
||||
}
|
||||
const response = await requestPublic(url, 'text/html,application/xhtml+xml', MAX_HTML_BYTES);
|
||||
const contentType = response.contentType.toLowerCase();
|
||||
if (!contentType.includes('text/html') && !contentType.includes('application/xhtml+xml')) {
|
||||
throw new Error('FETCH_INVALID_TYPE');
|
||||
}
|
||||
return extractMetadataFromHtml(response.data.toString('utf8'), response.url);
|
||||
}
|
||||
|
||||
export async function fetchPresentationImage(url: string) {
|
||||
const response = await requestPublic(
|
||||
url,
|
||||
'image/jpeg,image/png,image/webp,image/gif',
|
||||
MAX_IMAGE_BYTES
|
||||
);
|
||||
const mimeType = response.contentType.split(';')[0].trim().toLowerCase();
|
||||
if (!['image/jpeg', 'image/png', 'image/webp', 'image/gif'].includes(mimeType)) {
|
||||
throw new Error('FETCH_INVALID_TYPE');
|
||||
}
|
||||
return { data: response.data, mimeType };
|
||||
}
|
||||
+46
-88
@@ -1,4 +1,5 @@
|
||||
import { getDatabase } from './database.js';
|
||||
import { getShow as getShowById, listShows } from './shows.js';
|
||||
|
||||
export type PreviewPiece = {
|
||||
id: string;
|
||||
@@ -85,7 +86,7 @@ export function getPieces(): PreviewPiece[] {
|
||||
(SELECT count(*) FROM piece_sources ps WHERE ps.piece_id = p.id) AS source_count
|
||||
FROM pieces p
|
||||
LEFT JOIN formats f ON f.id = p.format_id
|
||||
WHERE p.status != 'archived'
|
||||
WHERE p.status IN ('preparing', 'ready') AND p.deleted_at_utc IS NULL
|
||||
ORDER BY CASE p.status WHEN 'ready' THEN 0 ELSE 1 END, p.title`
|
||||
)
|
||||
.all() as PieceRow[];
|
||||
@@ -104,96 +105,49 @@ export function getPieces(): PreviewPiece[] {
|
||||
}));
|
||||
}
|
||||
|
||||
type ShowRow = {
|
||||
id: string;
|
||||
title: string;
|
||||
starts_at_utc: string;
|
||||
twitch_title: string;
|
||||
announcement_text: string;
|
||||
status: string;
|
||||
};
|
||||
|
||||
type SectionRow = {
|
||||
id: string;
|
||||
name: string;
|
||||
category: string | null;
|
||||
category_color: string | null;
|
||||
explicit_duration_seconds: number | null;
|
||||
};
|
||||
|
||||
type UsageRow = {
|
||||
id: string;
|
||||
show_section_id: string;
|
||||
title_snapshot: string;
|
||||
duration_seconds: number;
|
||||
status: PreviewUsage['status'];
|
||||
intro_snapshot: string;
|
||||
moderation_snapshot: string;
|
||||
transition_snapshot: string;
|
||||
is_reserve: number;
|
||||
};
|
||||
|
||||
export function getShow(): PreviewShow {
|
||||
const database = getDatabase();
|
||||
const show = database
|
||||
.prepare(
|
||||
`SELECT id, title, starts_at_utc, twitch_title, announcement_text, status
|
||||
FROM shows ORDER BY starts_at_utc DESC LIMIT 1`
|
||||
)
|
||||
.get() as ShowRow | undefined;
|
||||
|
||||
export function getShow(showId?: string): PreviewShow {
|
||||
const latest = showId ? null : listShows().find((show) => show.startsAtUtc !== null);
|
||||
const show = getShowById(showId ?? latest?.id ?? '');
|
||||
if (!show) throw new Error('No preview show found. Run npm run db:seed.');
|
||||
|
||||
const sectionRows = database
|
||||
.prepare(
|
||||
`SELECT s.id, s.name, c.name AS category, c.color AS category_color,
|
||||
s.explicit_duration_seconds
|
||||
FROM show_sections s
|
||||
LEFT JOIN section_categories c ON c.id = s.category_id
|
||||
WHERE s.show_id = ? ORDER BY s.position`
|
||||
)
|
||||
.all(show.id) as SectionRow[];
|
||||
const usageRows = database
|
||||
.prepare(
|
||||
`SELECT id, show_section_id, title_snapshot, duration_seconds, status,
|
||||
intro_snapshot, moderation_snapshot, transition_snapshot, is_reserve
|
||||
FROM piece_usages WHERE show_section_id IN (
|
||||
SELECT id FROM show_sections WHERE show_id = ?
|
||||
) ORDER BY position`
|
||||
)
|
||||
.all(show.id) as UsageRow[];
|
||||
|
||||
const sections = sectionRows.map((section) => {
|
||||
const usages = usageRows
|
||||
.filter((usage) => usage.show_section_id === section.id)
|
||||
.map((usage) => ({
|
||||
id: usage.id,
|
||||
title: usage.title_snapshot,
|
||||
durationSeconds: usage.duration_seconds,
|
||||
status: usage.status,
|
||||
intro: usage.intro_snapshot,
|
||||
moderation: usage.moderation_snapshot,
|
||||
transition: usage.transition_snapshot,
|
||||
isReserve: usage.is_reserve === 1
|
||||
}));
|
||||
const plannedUsages = usages.filter((usage) => !usage.isReserve);
|
||||
return {
|
||||
const sections: PreviewSection[] = show.sections.map((section) => ({
|
||||
id: section.id,
|
||||
name: section.name,
|
||||
category: section.category ?? 'Offen',
|
||||
categoryColor: section.category_color ?? '#8b8f98',
|
||||
durationSeconds:
|
||||
section.explicit_duration_seconds ??
|
||||
plannedUsages.reduce((total, usage) => total + usage.durationSeconds, 0),
|
||||
usages
|
||||
};
|
||||
});
|
||||
categoryColor: section.categoryColor ?? '#8b8f98',
|
||||
durationSeconds: section.durationSeconds,
|
||||
usages: section.usages.map((usage) => ({
|
||||
id: usage.id,
|
||||
title: usage.title,
|
||||
durationSeconds: usage.durationSeconds,
|
||||
status: usage.status,
|
||||
intro: usage.intro,
|
||||
moderation: usage.moderation,
|
||||
transition: usage.transition,
|
||||
isReserve: false
|
||||
}))
|
||||
}));
|
||||
const reserveHost = sections[Math.min(1, sections.length - 1)];
|
||||
if (reserveHost) {
|
||||
reserveHost.usages.push(
|
||||
...show.reserve.map((usage) => ({
|
||||
id: usage.id,
|
||||
title: usage.title,
|
||||
durationSeconds: usage.durationSeconds,
|
||||
status: usage.status,
|
||||
intro: usage.intro,
|
||||
moderation: usage.moderation,
|
||||
transition: usage.transition,
|
||||
isReserve: true
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
id: show.id,
|
||||
title: show.title,
|
||||
startsAtUtc: show.starts_at_utc,
|
||||
startsAtBerlin: new Intl.DateTimeFormat('de-DE', {
|
||||
startsAtUtc: show.startsAtUtc ?? '',
|
||||
startsAtBerlin: show.startsAtUtc
|
||||
? new Intl.DateTimeFormat('de-DE', {
|
||||
timeZone: 'Europe/Berlin',
|
||||
weekday: 'short',
|
||||
day: '2-digit',
|
||||
@@ -201,12 +155,13 @@ export function getShow(): PreviewShow {
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
}).format(new Date(show.starts_at_utc)),
|
||||
twitchTitle: show.twitch_title,
|
||||
announcement: show.announcement_text,
|
||||
}).format(new Date(show.startsAtUtc))
|
||||
: 'Termin offen',
|
||||
twitchTitle: show.twitchTitle,
|
||||
announcement: show.announcementText,
|
||||
status: show.status,
|
||||
sections,
|
||||
totalDurationSeconds: sections.reduce((total, section) => total + section.durationSeconds, 0)
|
||||
totalDurationSeconds: show.totalDurationSeconds
|
||||
};
|
||||
}
|
||||
|
||||
@@ -220,9 +175,12 @@ export function getTaxonomy() {
|
||||
id: string;
|
||||
name: string;
|
||||
}[],
|
||||
topics: database.prepare('SELECT id, name FROM topics ORDER BY name').all() as {
|
||||
topics: database
|
||||
.prepare('SELECT id, name, icon_name AS iconName FROM topics ORDER BY name')
|
||||
.all() as {
|
||||
id: string;
|
||||
name: string;
|
||||
iconName: string;
|
||||
}[]
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import type { AuthUser } from './auth.js';
|
||||
import { finalizeShow } from './completion.js';
|
||||
import { closeDatabase, getDatabase } from './database.js';
|
||||
import {
|
||||
authenticateShare,
|
||||
createShare,
|
||||
deleteShare,
|
||||
getSharedMedia,
|
||||
getSharedShow,
|
||||
revokeShare,
|
||||
replaceShareToken,
|
||||
updateShare
|
||||
} from './shares.js';
|
||||
import { addPieceUsage, addShowSection, createShow } from './shows.js';
|
||||
|
||||
let directory: string;
|
||||
const actor: AuthUser = {
|
||||
id: 'share-actor',
|
||||
email: 'share@example.test',
|
||||
displayName: 'Freigabe Test',
|
||||
role: 'barkeeper',
|
||||
lockedAtUtc: null
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
directory = mkdtempSync(path.join(tmpdir(), 'sendewerk-shares-test-'));
|
||||
process.env.SENDEWERK_DB_PATH = path.join(directory, 'test.sqlite');
|
||||
process.env.SENDEWERK_UPLOAD_DIR = path.join(directory, 'uploads');
|
||||
execFileSync(process.execPath, ['scripts/migrate.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
execFileSync(process.execPath, ['scripts/seed.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
const now = new Date().toISOString();
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO users (id, email, email_normalized, display_name, password_hash, role,
|
||||
password_changed_at_utc, created_at_utc, updated_at_utc)
|
||||
VALUES (?, ?, ?, ?, 'unused', 'barkeeper', ?, ?, ?)`
|
||||
)
|
||||
.run(actor.id, actor.email, actor.email, actor.displayName, now, now, now);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
closeDatabase();
|
||||
delete process.env.SENDEWERK_DB_PATH;
|
||||
delete process.env.SENDEWERK_UPLOAD_DIR;
|
||||
rmSync(directory, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
function finalizedShow() {
|
||||
const created = createShow({
|
||||
title: 'Freigegebene Sendung',
|
||||
startsAtUtc: null,
|
||||
templateId: null
|
||||
});
|
||||
const section = addShowSection(created.id, created.revision, {
|
||||
name: 'Freigabeblock',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
const usage = addPieceUsage(created.id, section.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: section.id
|
||||
});
|
||||
const reserveUsage = addPieceUsage(created.id, usage.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: null
|
||||
});
|
||||
const database = getDatabase();
|
||||
database.prepare("UPDATE piece_usages SET status = 'done' WHERE id = ?").run(usage.id);
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO show_live_states
|
||||
(show_id, revision, started_at_utc, ended_at_utc, presentation_revision, updated_at_utc)
|
||||
VALUES (?, 0, ?, ?, 0, ?)`
|
||||
)
|
||||
.run(
|
||||
created.id,
|
||||
'2026-10-25T18:00:00.000Z',
|
||||
'2026-10-25T19:00:00.000Z',
|
||||
'2026-10-25T19:00:00.000Z'
|
||||
);
|
||||
finalizeShow({
|
||||
showId: created.id,
|
||||
commandId: `finalize-${created.id}`,
|
||||
expectedShowRevision: reserveUsage.revision,
|
||||
expectedLiveRevision: 0,
|
||||
archivePieceIds: [],
|
||||
actor
|
||||
});
|
||||
return { showId: created.id, usageId: usage.id, reserveUsageId: reserveUsage.id };
|
||||
}
|
||||
|
||||
describe('show shares', () => {
|
||||
it('shares an unfinished show and keeps its current plan visible', async () => {
|
||||
const created = createShow({
|
||||
title: 'Offene Freigabe',
|
||||
startsAtUtc: null,
|
||||
templateId: null
|
||||
});
|
||||
const shared = await createShare(actor, {
|
||||
showId: created.id,
|
||||
scope: 'rundown',
|
||||
password: '',
|
||||
expiresAtUtc: null
|
||||
});
|
||||
const initiallyEmpty = getSharedShow(shared.token);
|
||||
expect(initiallyEmpty.status).toBe('authorized');
|
||||
if (initiallyEmpty.status !== 'authorized') throw new Error('share unavailable');
|
||||
expect(initiallyEmpty.share.isCompleted).toBe(false);
|
||||
expect(initiallyEmpty.share.sections).toEqual([]);
|
||||
|
||||
const section = addShowSection(created.id, created.revision, {
|
||||
name: 'Nachträglich geplant',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
addPieceUsage(created.id, section.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: section.id
|
||||
});
|
||||
const updatedPlan = getSharedShow(shared.token);
|
||||
expect(updatedPlan.status).toBe('authorized');
|
||||
if (updatedPlan.status !== 'authorized') throw new Error('share unavailable');
|
||||
expect(updatedPlan.share.sections[0]).toMatchObject({
|
||||
name: 'Nachträglich geplant',
|
||||
usages: [{ title: 'Die kleine Konsole mit dem großen Dreh' }]
|
||||
});
|
||||
|
||||
await updateShare(actor, shared.id, {
|
||||
scope: 'moderation',
|
||||
passwordMode: 'replace',
|
||||
password: 'neues-freigabe-passwort',
|
||||
expiresAtUtc: null
|
||||
});
|
||||
expect(getSharedShow(shared.token).status).toBe('password');
|
||||
const session = await authenticateShare(shared.token, 'neues-freigabe-passwort', '192.0.2.20');
|
||||
expect(getSharedShow(shared.token, session.token).status).toBe('authorized');
|
||||
const replacementToken = replaceShareToken(actor, shared.id, created.id);
|
||||
expect(getSharedShow(shared.token, session.token).status).toBe('unavailable');
|
||||
expect(getSharedShow(replacementToken).status).toBe('password');
|
||||
const replacementSession = await authenticateShare(
|
||||
replacementToken,
|
||||
'neues-freigabe-passwort',
|
||||
'192.0.2.20'
|
||||
);
|
||||
expect(getSharedShow(replacementToken, replacementSession.token).status).toBe('authorized');
|
||||
deleteShare(actor, shared.id, created.id);
|
||||
expect(getSharedShow(replacementToken, replacementSession.token).status).toBe('unavailable');
|
||||
});
|
||||
|
||||
it('projects exactly the selected information scope', async () => {
|
||||
const prepared = finalizedShow();
|
||||
const rundown = await createShare(actor, {
|
||||
showId: prepared.showId,
|
||||
scope: 'rundown',
|
||||
password: '',
|
||||
expiresAtUtc: null
|
||||
});
|
||||
const basic = getSharedShow(rundown.token);
|
||||
expect(basic.status).toBe('authorized');
|
||||
if (basic.status !== 'authorized') throw new Error('share unavailable');
|
||||
const basicUsage = basic.share.sections[0].usages[0];
|
||||
expect(basicUsage).not.toHaveProperty('moderationHtml');
|
||||
expect(basicUsage).not.toHaveProperty('researchHtml');
|
||||
expect(JSON.stringify(basic)).not.toContain('originalPieceId');
|
||||
expect(JSON.stringify(basic)).not.toContain(prepared.showId);
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO usage_tool_snapshots
|
||||
(id, usage_id, original_tool_id, name, start_url, work_url, note, position)
|
||||
VALUES ('private-share-tool', ?, NULL, 'Schnittwerkzeug',
|
||||
'https://private.example/start', 'https://private.example/work?secret=1',
|
||||
'Freigegebene Werkzeugnotiz', 0)`
|
||||
)
|
||||
.run(prepared.usageId);
|
||||
|
||||
const research = await createShare(actor, {
|
||||
showId: prepared.showId,
|
||||
scope: 'research',
|
||||
password: '',
|
||||
expiresAtUtc: null
|
||||
});
|
||||
const full = getSharedShow(research.token);
|
||||
expect(full.status).toBe('authorized');
|
||||
if (full.status !== 'authorized') throw new Error('share unavailable');
|
||||
expect(full.share.sections[0].usages[0]).toHaveProperty('moderationHtml');
|
||||
expect(full.share.sections[0].usages[0]).toHaveProperty('researchHtml');
|
||||
expect(full.share.sections[0].usages[0]).not.toHaveProperty('ownNotesHtml');
|
||||
expect(JSON.stringify(full)).not.toContain('private.example');
|
||||
expect(JSON.stringify(full)).toContain('Freigegebene Werkzeugnotiz');
|
||||
});
|
||||
|
||||
it('enforces password, expiry and revocation for page and direct media access', async () => {
|
||||
const prepared = finalizedShow();
|
||||
const database = getDatabase();
|
||||
mkdirSync(process.env.SENDEWERK_UPLOAD_DIR!, { recursive: true });
|
||||
writeFileSync(path.join(process.env.SENDEWERK_UPLOAD_DIR!, 'shared.png'), Buffer.from('image'));
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO piece_media
|
||||
(id, piece_id, storage_name, original_name, mime_type, byte_size, alt_text, position, created_at_utc)
|
||||
VALUES ('share-media', 'piece-console', 'shared.png', 'shared.png', 'image/png', 5, 'Freigegeben', 99, ?)`
|
||||
)
|
||||
.run(new Date().toISOString());
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO usage_media_snapshots
|
||||
(id, usage_id, original_media_id, alt_text, position, is_presentation)
|
||||
VALUES ('share-snapshot', ?, 'share-media', 'Freigegeben', 99, 1)`
|
||||
)
|
||||
.run(prepared.usageId);
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO usage_media_snapshots
|
||||
(id, usage_id, original_media_id, alt_text, position, is_presentation)
|
||||
VALUES ('reserve-share-snapshot', ?, 'share-media', 'Private Reserve', 99, 1)`
|
||||
)
|
||||
.run(prepared.reserveUsageId);
|
||||
const created = await createShare(actor, {
|
||||
showId: prepared.showId,
|
||||
scope: 'research',
|
||||
password: 'ein-sicheres-passwort',
|
||||
expiresAtUtc: new Date(Date.now() + 60_000).toISOString()
|
||||
});
|
||||
expect(getSharedShow(created.token).status).toBe('password');
|
||||
expect(getSharedShow(created.token)).not.toHaveProperty('share');
|
||||
expect(await getSharedMedia(created.token, undefined, 'share-snapshot')).toBeNull();
|
||||
await expect(authenticateShare(created.token, 'falsch', '127.0.0.1')).rejects.toThrow(
|
||||
'INVALID_PASSWORD'
|
||||
);
|
||||
const session = await authenticateShare(created.token, 'ein-sicheres-passwort', '127.0.0.1');
|
||||
expect(getSharedShow(created.token, session.token).status).toBe('authorized');
|
||||
expect((await getSharedMedia(created.token, session.token, 'share-snapshot'))?.byteSize).toBe(
|
||||
5
|
||||
);
|
||||
expect(await getSharedMedia(created.token, session.token, 'foreign-media')).toBeNull();
|
||||
expect(await getSharedMedia(created.token, session.token, 'reserve-share-snapshot')).toBeNull();
|
||||
revokeShare(actor, created.id);
|
||||
expect(getSharedShow(created.token, session.token).status).toBe('unavailable');
|
||||
expect(await getSharedMedia(created.token, session.token, 'share-snapshot')).toBeNull();
|
||||
|
||||
const expired = await createShare(actor, {
|
||||
showId: prepared.showId,
|
||||
scope: 'rundown',
|
||||
password: '',
|
||||
expiresAtUtc: new Date(Date.now() + 60_000).toISOString()
|
||||
});
|
||||
database
|
||||
.prepare('UPDATE show_shares SET expires_at_utc = ? WHERE id = ?')
|
||||
.run('2000-01-01T00:00:00.000Z', expired.id);
|
||||
expect(getSharedShow(expired.token).status).toBe('unavailable');
|
||||
expect(await getSharedMedia(expired.token, undefined, 'share-snapshot')).toBeNull();
|
||||
});
|
||||
|
||||
it('limits repeated password attempts per share', async () => {
|
||||
const prepared = finalizedShow();
|
||||
const created = await createShare(actor, {
|
||||
showId: prepared.showId,
|
||||
scope: 'rundown',
|
||||
password: 'noch-ein-sicheres-passwort',
|
||||
expiresAtUtc: null
|
||||
});
|
||||
for (let attempt = 0; attempt < 5; attempt += 1) {
|
||||
await expect(authenticateShare(created.token, 'falsch', '192.0.2.10')).rejects.toThrow(
|
||||
'INVALID_PASSWORD'
|
||||
);
|
||||
}
|
||||
await expect(
|
||||
authenticateShare(created.token, 'noch-ein-sicheres-passwort', '192.0.2.10')
|
||||
).rejects.toThrow('RATE_LIMITED');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,451 @@
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import {
|
||||
createToken,
|
||||
hashPassword,
|
||||
hashToken,
|
||||
validPassword,
|
||||
verifyPassword,
|
||||
type AuthUser
|
||||
} from './auth.js';
|
||||
import { getServerPaths } from './config.js';
|
||||
import { getDatabase } from './database.js';
|
||||
import { renderMarkdown } from './markdown.js';
|
||||
import type { ShowStatus } from './shows.js';
|
||||
|
||||
export const SHARE_SESSION_COOKIE = 'sendewerk_share_session';
|
||||
export const SHARE_SCOPES = ['rundown', 'moderation', 'research'] as const;
|
||||
export type ShareScope = (typeof SHARE_SCOPES)[number];
|
||||
const PASSWORD_ATTEMPT_WINDOW_MS = 15 * 60 * 1000;
|
||||
const SHARE_PASSWORD_ATTEMPT_LIMIT = 5;
|
||||
const ADDRESS_PASSWORD_ATTEMPT_LIMIT = 20;
|
||||
|
||||
type ShareRow = {
|
||||
id: string;
|
||||
show_id: string;
|
||||
token_hash: string;
|
||||
scope: ShareScope;
|
||||
password_hash: string | null;
|
||||
expires_at_utc: string | null;
|
||||
revoked_at_utc: string | null;
|
||||
created_at_utc: string;
|
||||
};
|
||||
|
||||
export type ShareListItem = {
|
||||
id: string;
|
||||
showId: string;
|
||||
showTitle: string;
|
||||
showStatus: ShowStatus;
|
||||
showStartsAtUtc: string | null;
|
||||
scope: ShareScope;
|
||||
isPasswordProtected: boolean;
|
||||
expiresAtUtc: string | null;
|
||||
revokedAtUtc: string | null;
|
||||
createdAtUtc: string;
|
||||
};
|
||||
|
||||
function requireBarkeeperActor(actor: AuthUser): void {
|
||||
if (actor.role !== 'barkeeper') throw new Error('FORBIDDEN');
|
||||
}
|
||||
|
||||
function validExpiry(value: string | null): string | null {
|
||||
if (!value) return null;
|
||||
const expiry = new Date(value);
|
||||
if (Number.isNaN(expiry.valueOf()) || expiry.valueOf() <= Date.now()) {
|
||||
throw new Error('INVALID_EXPIRY');
|
||||
}
|
||||
return expiry.toISOString();
|
||||
}
|
||||
|
||||
function activeShare(rawToken: string): ShareRow | null {
|
||||
if (!rawToken) return null;
|
||||
const now = new Date().toISOString();
|
||||
return (
|
||||
(getDatabase()
|
||||
.prepare(
|
||||
`SELECT id, show_id, token_hash, scope, password_hash, expires_at_utc,
|
||||
revoked_at_utc, created_at_utc FROM show_shares
|
||||
WHERE token_hash = ? AND revoked_at_utc IS NULL
|
||||
AND (expires_at_utc IS NULL OR expires_at_utc > ?)`
|
||||
)
|
||||
.get(hashToken(rawToken), now) as ShareRow | undefined) ?? null
|
||||
);
|
||||
}
|
||||
|
||||
export function listShares(actor: AuthUser, showId?: string): ShareListItem[] {
|
||||
requireBarkeeperActor(actor);
|
||||
const where = showId ? 'WHERE ss.show_id = ?' : '';
|
||||
return (
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`SELECT ss.id, ss.show_id, sh.title AS show_title, sh.status AS show_status,
|
||||
sh.starts_at_utc AS show_starts_at_utc, ss.scope, ss.password_hash,
|
||||
ss.expires_at_utc, ss.revoked_at_utc, ss.created_at_utc
|
||||
FROM show_shares ss JOIN shows sh ON sh.id = ss.show_id
|
||||
${where}
|
||||
ORDER BY ss.created_at_utc DESC`
|
||||
)
|
||||
.all(...(showId ? [showId] : [])) as {
|
||||
id: string;
|
||||
show_id: string;
|
||||
show_title: string;
|
||||
show_status: ShowStatus;
|
||||
show_starts_at_utc: string | null;
|
||||
scope: ShareScope;
|
||||
password_hash: string | null;
|
||||
expires_at_utc: string | null;
|
||||
revoked_at_utc: string | null;
|
||||
created_at_utc: string;
|
||||
}[]
|
||||
).map((share) => ({
|
||||
id: share.id,
|
||||
showId: share.show_id,
|
||||
showTitle: share.show_title,
|
||||
showStatus: share.show_status,
|
||||
showStartsAtUtc: share.show_starts_at_utc,
|
||||
scope: share.scope,
|
||||
isPasswordProtected: Boolean(share.password_hash),
|
||||
expiresAtUtc: share.expires_at_utc,
|
||||
revokedAtUtc: share.revoked_at_utc,
|
||||
createdAtUtc: share.created_at_utc
|
||||
}));
|
||||
}
|
||||
|
||||
export async function createShare(
|
||||
actor: AuthUser,
|
||||
input: { showId: string; scope: string; password: string; expiresAtUtc: string | null }
|
||||
) {
|
||||
requireBarkeeperActor(actor);
|
||||
if (!SHARE_SCOPES.includes(input.scope as ShareScope)) throw new Error('INVALID_SCOPE');
|
||||
if (input.password && !validPassword(input.password)) throw new Error('INVALID_PASSWORD');
|
||||
const expiresAtUtc = validExpiry(input.expiresAtUtc);
|
||||
const database = getDatabase();
|
||||
if (!database.prepare('SELECT 1 FROM shows WHERE id = ?').get(input.showId)) {
|
||||
throw new Error('NOT_FOUND');
|
||||
}
|
||||
const token = createToken();
|
||||
const id = randomUUID();
|
||||
const now = new Date().toISOString();
|
||||
const passwordHash = input.password ? await hashPassword(input.password) : null;
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO show_shares
|
||||
(id, show_id, token_hash, scope, password_hash, expires_at_utc,
|
||||
created_by_user_id, created_at_utc) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(
|
||||
id,
|
||||
input.showId,
|
||||
hashToken(token),
|
||||
input.scope,
|
||||
passwordHash,
|
||||
expiresAtUtc,
|
||||
actor.id,
|
||||
now
|
||||
);
|
||||
return { id, token };
|
||||
}
|
||||
|
||||
export async function updateShare(
|
||||
actor: AuthUser,
|
||||
shareId: string,
|
||||
input: {
|
||||
scope: string;
|
||||
passwordMode: string;
|
||||
password: string;
|
||||
expiresAtUtc: string | null;
|
||||
},
|
||||
expectedShowId?: string
|
||||
): Promise<void> {
|
||||
requireBarkeeperActor(actor);
|
||||
if (!SHARE_SCOPES.includes(input.scope as ShareScope)) throw new Error('INVALID_SCOPE');
|
||||
if (!['keep', 'remove', 'replace'].includes(input.passwordMode)) {
|
||||
throw new Error('INVALID_PASSWORD_MODE');
|
||||
}
|
||||
if (input.passwordMode === 'replace' && !validPassword(input.password)) {
|
||||
throw new Error('INVALID_PASSWORD');
|
||||
}
|
||||
const expiresAtUtc = validExpiry(input.expiresAtUtc);
|
||||
const existing = getDatabase()
|
||||
.prepare(
|
||||
'SELECT show_id, password_hash FROM show_shares WHERE id = ? AND revoked_at_utc IS NULL'
|
||||
)
|
||||
.get(shareId) as { show_id: string; password_hash: string | null } | undefined;
|
||||
if (!existing || (expectedShowId && existing.show_id !== expectedShowId))
|
||||
throw new Error('NOT_FOUND');
|
||||
const passwordHash =
|
||||
input.passwordMode === 'keep'
|
||||
? existing.password_hash
|
||||
: input.passwordMode === 'replace'
|
||||
? await hashPassword(input.password)
|
||||
: null;
|
||||
const database = getDatabase();
|
||||
database.transaction(() => {
|
||||
const result = database
|
||||
.prepare(
|
||||
`UPDATE show_shares SET scope = ?, password_hash = ?, expires_at_utc = ?
|
||||
WHERE id = ? AND revoked_at_utc IS NULL`
|
||||
)
|
||||
.run(input.scope, passwordHash, expiresAtUtc, shareId);
|
||||
if (result.changes !== 1) throw new Error('NOT_FOUND');
|
||||
database.prepare('DELETE FROM show_share_sessions WHERE share_id = ?').run(shareId);
|
||||
})();
|
||||
}
|
||||
|
||||
export function replaceShareToken(
|
||||
actor: AuthUser,
|
||||
shareId: string,
|
||||
expectedShowId?: string
|
||||
): string {
|
||||
requireBarkeeperActor(actor);
|
||||
const token = createToken();
|
||||
const database = getDatabase();
|
||||
database.transaction(() => {
|
||||
const result = database
|
||||
.prepare(
|
||||
`UPDATE show_shares SET token_hash = ?
|
||||
WHERE id = ? AND revoked_at_utc IS NULL${expectedShowId ? ' AND show_id = ?' : ''}`
|
||||
)
|
||||
.run(hashToken(token), ...(expectedShowId ? [shareId, expectedShowId] : [shareId]));
|
||||
if (result.changes !== 1) throw new Error('NOT_FOUND');
|
||||
database.prepare('DELETE FROM show_share_sessions WHERE share_id = ?').run(shareId);
|
||||
})();
|
||||
return token;
|
||||
}
|
||||
|
||||
export function deleteShare(actor: AuthUser, shareId: string, expectedShowId?: string): void {
|
||||
requireBarkeeperActor(actor);
|
||||
const result = getDatabase()
|
||||
.prepare(`DELETE FROM show_shares WHERE id = ?${expectedShowId ? ' AND show_id = ?' : ''}`)
|
||||
.run(...(expectedShowId ? [shareId, expectedShowId] : [shareId]));
|
||||
if (result.changes !== 1) throw new Error('NOT_FOUND');
|
||||
}
|
||||
|
||||
export function revokeShare(actor: AuthUser, shareId: string): void {
|
||||
requireBarkeeperActor(actor);
|
||||
const database = getDatabase();
|
||||
database.transaction(() => {
|
||||
const result = database
|
||||
.prepare('UPDATE show_shares SET revoked_at_utc = ? WHERE id = ? AND revoked_at_utc IS NULL')
|
||||
.run(new Date().toISOString(), shareId);
|
||||
if (result.changes !== 1) throw new Error('NOT_FOUND');
|
||||
database.prepare('DELETE FROM show_share_sessions WHERE share_id = ?').run(shareId);
|
||||
})();
|
||||
}
|
||||
|
||||
export function shareAccessState(rawToken: string, sessionToken?: string) {
|
||||
const share = activeShare(rawToken);
|
||||
if (!share) return { status: 'unavailable' as const };
|
||||
if (!share.password_hash) return { status: 'authorized' as const, share };
|
||||
if (!sessionToken) return { status: 'password' as const };
|
||||
const session = getDatabase()
|
||||
.prepare(
|
||||
`SELECT 1 FROM show_share_sessions WHERE token_hash = ? AND share_id = ?
|
||||
AND expires_at_utc > ?`
|
||||
)
|
||||
.get(hashToken(sessionToken), share.id, new Date().toISOString());
|
||||
return session ? { status: 'authorized' as const, share } : { status: 'password' as const };
|
||||
}
|
||||
|
||||
export async function authenticateShare(rawToken: string, password: string, address: string) {
|
||||
const share = activeShare(rawToken);
|
||||
if (!share?.password_hash) throw new Error('SHARE_UNAVAILABLE');
|
||||
const database = getDatabase();
|
||||
const now = new Date();
|
||||
const since = new Date(now.getTime() - PASSWORD_ATTEMPT_WINDOW_MS).toISOString();
|
||||
const shareKey = hashToken(rawToken);
|
||||
const addressKey = hashToken(address || 'unknown');
|
||||
database.prepare('DELETE FROM share_password_attempts WHERE attempted_at_utc < ?').run(since);
|
||||
const shareAttempts = database
|
||||
.prepare(
|
||||
`SELECT count(*) AS count FROM share_password_attempts
|
||||
WHERE share_key = ? AND attempted_at_utc >= ?`
|
||||
)
|
||||
.get(shareKey, since) as { count: number };
|
||||
const addressAttempts = database
|
||||
.prepare(
|
||||
`SELECT count(*) AS count FROM share_password_attempts
|
||||
WHERE address_key = ? AND attempted_at_utc >= ?`
|
||||
)
|
||||
.get(addressKey, since) as { count: number };
|
||||
if (
|
||||
shareAttempts.count >= SHARE_PASSWORD_ATTEMPT_LIMIT ||
|
||||
addressAttempts.count >= ADDRESS_PASSWORD_ATTEMPT_LIMIT
|
||||
) {
|
||||
throw new Error('RATE_LIMITED');
|
||||
}
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO share_password_attempts
|
||||
(id, share_key, address_key, attempted_at_utc) VALUES (?, ?, ?, ?)`
|
||||
)
|
||||
.run(randomUUID(), shareKey, addressKey, now.toISOString());
|
||||
if (!(await verifyPassword(share.password_hash, password))) throw new Error('INVALID_PASSWORD');
|
||||
const token = createToken();
|
||||
const defaultExpiry = now.getTime() + 12 * 60 * 60 * 1000;
|
||||
const shareExpiry = share.expires_at_utc
|
||||
? new Date(share.expires_at_utc).getTime()
|
||||
: defaultExpiry;
|
||||
const expires = new Date(Math.min(defaultExpiry, shareExpiry));
|
||||
database.prepare('DELETE FROM share_password_attempts WHERE share_key = ?').run(shareKey);
|
||||
database
|
||||
.prepare('DELETE FROM show_share_sessions WHERE expires_at_utc <= ?')
|
||||
.run(now.toISOString());
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO show_share_sessions (token_hash, share_id, created_at_utc, expires_at_utc)
|
||||
VALUES (?, ?, ?, ?)`
|
||||
)
|
||||
.run(hashToken(token), share.id, now.toISOString(), expires.toISOString());
|
||||
return { token, expires };
|
||||
}
|
||||
|
||||
export function getSharedShow(rawToken: string, sessionToken?: string) {
|
||||
const access = shareAccessState(rawToken, sessionToken);
|
||||
if (access.status !== 'authorized' || !access.share) return access;
|
||||
const share = access.share;
|
||||
const database = getDatabase();
|
||||
const show = database
|
||||
.prepare('SELECT title, starts_at_utc, status, completed_at_utc FROM shows WHERE id = ?')
|
||||
.get(share.show_id) as {
|
||||
title: string;
|
||||
starts_at_utc: string | null;
|
||||
status: ShowStatus;
|
||||
completed_at_utc: string | null;
|
||||
};
|
||||
const sections = database
|
||||
.prepare(
|
||||
`SELECT s.id, s.name, s.category_name_snapshot, s.category_color_snapshot,
|
||||
c.name AS category_name, c.color AS category_color,
|
||||
s.explicit_duration_seconds, s.position FROM show_sections s
|
||||
LEFT JOIN section_categories c ON c.id = s.category_id
|
||||
WHERE s.show_id = ? AND s.is_reserve_bank = 0 ORDER BY s.position`
|
||||
)
|
||||
.all(share.show_id) as {
|
||||
id: string;
|
||||
name: string;
|
||||
category_name_snapshot: string | null;
|
||||
category_color_snapshot: string | null;
|
||||
category_name: string | null;
|
||||
category_color: string | null;
|
||||
explicit_duration_seconds: number | null;
|
||||
position: number;
|
||||
}[];
|
||||
const usageStatement = database.prepare(
|
||||
`SELECT u.id, u.title_snapshot, u.output_title_snapshot, u.status, u.duration_seconds,
|
||||
u.intro_snapshot, u.research_snapshot, u.moderation_snapshot, u.interaction_snapshot,
|
||||
u.transition_snapshot, u.own_notes,
|
||||
COALESCE((SELECT actual_duration_seconds FROM piece_usage_history WHERE usage_id = u.id), 0)
|
||||
AS actual_duration_seconds
|
||||
FROM piece_usages u WHERE u.show_section_id = ? ORDER BY u.position`
|
||||
);
|
||||
const sourceStatement = database.prepare(
|
||||
'SELECT label, url, timecode_seconds FROM usage_source_snapshots WHERE usage_id = ? ORDER BY position'
|
||||
);
|
||||
const toolStatement = database.prepare(
|
||||
`SELECT name, start_url, work_url, note FROM usage_tool_snapshots
|
||||
WHERE usage_id = ? ORDER BY position`
|
||||
);
|
||||
const mediaStatement = database.prepare(
|
||||
`SELECT id, alt_text FROM usage_media_snapshots
|
||||
WHERE usage_id = ? AND is_presentation = 1`
|
||||
);
|
||||
const includesModeration = share.scope === 'moderation' || share.scope === 'research';
|
||||
const includesResearch = share.scope === 'research';
|
||||
return {
|
||||
status: 'authorized' as const,
|
||||
share: {
|
||||
scope: share.scope,
|
||||
title: show.title,
|
||||
startsAtUtc: show.starts_at_utc,
|
||||
completedAtUtc: show.completed_at_utc,
|
||||
isCompleted: show.status === 'completed',
|
||||
sections: sections.map((section) => {
|
||||
const usages = usageStatement.all(section.id) as {
|
||||
id: string;
|
||||
title_snapshot: string;
|
||||
output_title_snapshot: string;
|
||||
status: string;
|
||||
duration_seconds: number;
|
||||
actual_duration_seconds: number;
|
||||
intro_snapshot: string;
|
||||
research_snapshot: string;
|
||||
moderation_snapshot: string;
|
||||
interaction_snapshot: string;
|
||||
transition_snapshot: string;
|
||||
own_notes: string;
|
||||
}[];
|
||||
return {
|
||||
name: section.name,
|
||||
category:
|
||||
show.status === 'completed' ? section.category_name_snapshot : section.category_name,
|
||||
categoryColor:
|
||||
show.status === 'completed' ? section.category_color_snapshot : section.category_color,
|
||||
explicitDurationSeconds: section.explicit_duration_seconds,
|
||||
usages: usages.map((usage) => ({
|
||||
title: usage.title_snapshot,
|
||||
outputTitle: usage.output_title_snapshot,
|
||||
status: usage.status,
|
||||
durationSeconds: usage.duration_seconds,
|
||||
actualDurationSeconds: usage.actual_duration_seconds,
|
||||
media: mediaStatement.get(usage.id) as { id: string; alt_text: string } | undefined,
|
||||
...(includesModeration
|
||||
? {
|
||||
introHtml: renderMarkdown(usage.intro_snapshot),
|
||||
moderationHtml: renderMarkdown(usage.moderation_snapshot),
|
||||
interactionHtml: renderMarkdown(usage.interaction_snapshot),
|
||||
transitionHtml: renderMarkdown(usage.transition_snapshot)
|
||||
}
|
||||
: {}),
|
||||
...(includesResearch
|
||||
? {
|
||||
researchHtml: renderMarkdown(usage.research_snapshot),
|
||||
sources: sourceStatement.all(usage.id) as {
|
||||
label: string;
|
||||
url: string;
|
||||
timecode_seconds: number | null;
|
||||
}[],
|
||||
tools: (
|
||||
toolStatement.all(usage.id) as {
|
||||
name: string;
|
||||
start_url: string;
|
||||
work_url: string;
|
||||
note: string;
|
||||
}[]
|
||||
).map((tool) => ({ name: tool.name, note: tool.note }))
|
||||
}
|
||||
: {})
|
||||
}))
|
||||
};
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export async function getSharedMedia(
|
||||
rawToken: string,
|
||||
sessionToken: string | undefined,
|
||||
snapshotMediaId: string
|
||||
) {
|
||||
const access = shareAccessState(rawToken, sessionToken);
|
||||
if (access.status !== 'authorized' || !access.share) return null;
|
||||
const row = getDatabase()
|
||||
.prepare(
|
||||
`SELECT pm.storage_name, pm.mime_type, pm.byte_size
|
||||
FROM usage_media_snapshots ums
|
||||
JOIN piece_usages u ON u.id = ums.usage_id
|
||||
JOIN show_sections s ON s.id = u.show_section_id
|
||||
JOIN piece_media pm ON pm.id = ums.original_media_id
|
||||
WHERE ums.id = ? AND ums.is_presentation = 1 AND s.show_id = ?
|
||||
AND s.is_reserve_bank = 0`
|
||||
)
|
||||
.get(snapshotMediaId, access.share.show_id) as
|
||||
{ storage_name: string; mime_type: string; byte_size: number } | undefined;
|
||||
if (!row) return null;
|
||||
return {
|
||||
data: await readFile(path.join(getServerPaths().uploads, row.storage_name)),
|
||||
mimeType: row.mime_type,
|
||||
byteSize: row.byte_size
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,826 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { mkdtempSync, rmSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import { getPiece } from './content.js';
|
||||
import { closeDatabase, getDatabase } from './database.js';
|
||||
import {
|
||||
addPieceUsage,
|
||||
addShowSection,
|
||||
createShow,
|
||||
createAndAddPieceUsage,
|
||||
duplicatePieceUsage,
|
||||
getPieceUsageContexts,
|
||||
getShow,
|
||||
listPreparationUsages,
|
||||
listShowTemplates,
|
||||
movePieceUsage,
|
||||
moveShowSection,
|
||||
refreshPieceUsageFromOriginal,
|
||||
removePieceUsage,
|
||||
removeShowSection,
|
||||
updatePieceUsage,
|
||||
updateShowSection,
|
||||
type PieceUsage
|
||||
} from './shows.js';
|
||||
|
||||
let directory: string;
|
||||
|
||||
beforeEach(() => {
|
||||
directory = mkdtempSync(path.join(tmpdir(), 'sendewerk-shows-test-'));
|
||||
process.env.SENDEWERK_DB_PATH = path.join(directory, 'test.sqlite');
|
||||
process.env.SENDEWERK_UPLOAD_DIR = path.join(directory, 'uploads');
|
||||
execFileSync(process.execPath, ['scripts/migrate.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
execFileSync(process.execPath, ['scripts/seed.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
closeDatabase();
|
||||
delete process.env.SENDEWERK_DB_PATH;
|
||||
delete process.env.SENDEWERK_UPLOAD_DIR;
|
||||
rmSync(directory, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
function editedUsage(usage: PieceUsage, overrides: Partial<PieceUsage> = {}) {
|
||||
const edited = { ...usage, ...overrides };
|
||||
return {
|
||||
title: edited.title,
|
||||
outputTitle: edited.outputTitle,
|
||||
intro: edited.intro,
|
||||
research: edited.research,
|
||||
moderation: edited.moderation,
|
||||
transition: edited.transition,
|
||||
presentation: edited.presentation,
|
||||
presentationMode: edited.presentationMode,
|
||||
presentationSourceLabel: edited.presentationSourceLabel,
|
||||
presentationSourceUrl: edited.presentationSourceUrl,
|
||||
presentationSourceTimecodeSeconds: edited.presentationSourceTimecodeSeconds,
|
||||
presentationTitle: edited.presentationTitle,
|
||||
presentationDescription: edited.presentationDescription,
|
||||
presentationImageUrl: edited.presentationImageUrl,
|
||||
presentationSiteName: edited.presentationSiteName,
|
||||
presentationMediaId: edited.presentationMediaId,
|
||||
preparationStatus: edited.preparationStatus,
|
||||
preparationEffort: edited.preparationEffort,
|
||||
ownNotes: edited.ownNotes,
|
||||
durationSeconds: edited.durationSeconds
|
||||
};
|
||||
}
|
||||
|
||||
describe('show builder data layer', () => {
|
||||
it('tracks preparation on the concrete usage independently from its original', () => {
|
||||
const database = getDatabase();
|
||||
database
|
||||
.prepare(
|
||||
"UPDATE pieces SET status = 'preparing', preparation_effort = 'high' WHERE id = 'piece-console'"
|
||||
)
|
||||
.run();
|
||||
database.prepare("UPDATE pieces SET status = 'preparing' WHERE id = 'piece-sounds'").run();
|
||||
const show = getShow('show-october')!;
|
||||
const planned = addPieceUsage(show.id, show.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: show.sections[0].id
|
||||
});
|
||||
|
||||
database
|
||||
.prepare(
|
||||
"UPDATE pieces SET status = 'ready', preparation_effort = 'low' WHERE id = 'piece-console'"
|
||||
)
|
||||
.run();
|
||||
const usages = listPreparationUsages();
|
||||
expect(usages.map((usage) => usage.usageId)).toEqual([planned.id]);
|
||||
expect(usages[0]).toMatchObject({
|
||||
showId: 'show-october',
|
||||
showTitle: 'Herbstsendung: Kleine Welten',
|
||||
sectionName: show.sections[0].name,
|
||||
title: 'Die kleine Konsole mit dem großen Dreh',
|
||||
preparationEffort: 'high',
|
||||
topics: [{ name: 'Gaming' }]
|
||||
});
|
||||
expect(usages.some((usage) => usage.title === 'Drei Sounds, ein Spiel')).toBe(false);
|
||||
|
||||
const plannedUsage = getShow(show.id)!.sections[0].usages.find(
|
||||
(usage) => usage.id === planned.id
|
||||
)!;
|
||||
updatePieceUsage(
|
||||
show.id,
|
||||
planned.id,
|
||||
planned.revision,
|
||||
editedUsage(plannedUsage, { preparationStatus: 'ready' })
|
||||
);
|
||||
expect(listPreparationUsages()).toEqual([]);
|
||||
});
|
||||
|
||||
it('creates a fundus original and usage atomically and idempotently', () => {
|
||||
const created = createShow({ title: 'Direkte Planung', startsAtUtc: null, templateId: null });
|
||||
const section = addShowSection(created.id, created.revision, {
|
||||
name: 'Ablauf',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
const before = (
|
||||
getDatabase().prepare('SELECT count(*) AS count FROM pieces').get() as { count: number }
|
||||
).count;
|
||||
const first = createAndAddPieceUsage(created.id, section.revision, 'new-piece-command', {
|
||||
title: 'Direkt geplantes Piece',
|
||||
templateId: 'talk',
|
||||
sectionId: section.id
|
||||
});
|
||||
const repeated = createAndAddPieceUsage(created.id, section.revision, 'new-piece-command', {
|
||||
title: 'Darf nicht doppelt entstehen',
|
||||
templateId: 'blank',
|
||||
sectionId: section.id
|
||||
});
|
||||
expect(repeated).toEqual({ ...first, duplicate: true });
|
||||
expect(getShow(created.id)?.sections[0].usages).toHaveLength(1);
|
||||
expect(getPiece(first.pieceId)).toMatchObject({
|
||||
title: 'Direkt geplantes Piece',
|
||||
status: 'ready',
|
||||
formatId: 'format-talk'
|
||||
});
|
||||
expect(
|
||||
(getDatabase().prepare('SELECT count(*) AS count FROM pieces').get() as { count: number })
|
||||
.count
|
||||
).toBe(before + 1);
|
||||
|
||||
expect(() =>
|
||||
createAndAddPieceUsage(created.id, first.revision, 'failing-command', {
|
||||
title: 'Rollback',
|
||||
templateId: 'blank',
|
||||
sectionId: 'missing'
|
||||
})
|
||||
).toThrow('NOT_FOUND');
|
||||
expect(
|
||||
(getDatabase().prepare('SELECT count(*) AS count FROM pieces').get() as { count: number })
|
||||
.count
|
||||
).toBe(before + 1);
|
||||
|
||||
const removed = removePieceUsage(created.id, first.usageId, first.revision);
|
||||
const afterRemoval = createAndAddPieceUsage(created.id, removed.revision, 'new-piece-command', {
|
||||
title: 'Darf auch nach dem Entfernen nicht neu entstehen',
|
||||
templateId: 'blank',
|
||||
sectionId: section.id
|
||||
});
|
||||
expect(afterRemoval).toEqual({ ...first, duplicate: true });
|
||||
expect(getShow(created.id)?.sections[0].usages).toHaveLength(0);
|
||||
expect(
|
||||
(getDatabase().prepare('SELECT count(*) AS count FROM pieces').get() as { count: number })
|
||||
.count
|
||||
).toBe(before + 1);
|
||||
});
|
||||
|
||||
it('creates blank and templated shows with independent sections and reserve banks', () => {
|
||||
const templatesBefore = listShowTemplates();
|
||||
expect(
|
||||
templatesBefore.find((template) => template.id === 'template-default')?.sections
|
||||
).toHaveLength(5);
|
||||
expect(templatesBefore.find((template) => template.id === 'template-games')?.name).toBe(
|
||||
'Spieleabend'
|
||||
);
|
||||
|
||||
const blank = createShow({ title: null, startsAtUtc: null, templateId: null });
|
||||
expect(getShow(blank.id)).toMatchObject({
|
||||
title: 'Neue Sendung',
|
||||
startsAtUtc: null,
|
||||
sections: [],
|
||||
reserve: []
|
||||
});
|
||||
const reserveCount = getDatabase()
|
||||
.prepare(
|
||||
'SELECT count(*) AS count FROM show_sections WHERE show_id = ? AND is_reserve_bank = 1'
|
||||
)
|
||||
.get(blank.id) as { count: number };
|
||||
expect(reserveCount.count).toBe(1);
|
||||
|
||||
const templated = createShow({
|
||||
title: 'Vorlagenkopie',
|
||||
startsAtUtc: '2027-01-08T19:00:00Z',
|
||||
templateId: 'template-default'
|
||||
});
|
||||
const copy = getShow(templated.id)!;
|
||||
expect(copy.sections.map((section) => section.name)).toEqual([
|
||||
'Start',
|
||||
'JC / Reaction',
|
||||
'Spiel 1',
|
||||
'JC',
|
||||
'Spiel 2'
|
||||
]);
|
||||
updateShowSection(templated.id, copy.sections[0].id, copy.revision, {
|
||||
name: 'Eigener Start',
|
||||
categoryId: 'cat-jc',
|
||||
explicitDurationSeconds: 420
|
||||
});
|
||||
expect(listShowTemplates()).toEqual(templatesBefore);
|
||||
});
|
||||
|
||||
it('snapshots a ready piece repeatedly and keeps usage edits independent from its original', () => {
|
||||
const created = createShow({
|
||||
title: 'Doppelte Verwendung',
|
||||
startsAtUtc: null,
|
||||
templateId: null
|
||||
});
|
||||
const section = addShowSection(created.id, created.revision, {
|
||||
name: 'Fundstücke',
|
||||
categoryId: 'cat-reaction',
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
const first = addPieceUsage(created.id, section.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: section.id
|
||||
});
|
||||
const second = addPieceUsage(created.id, first.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: section.id
|
||||
});
|
||||
const usages = getShow(created.id)!.sections[0].usages;
|
||||
const firstSaved = updatePieceUsage(
|
||||
created.id,
|
||||
first.id,
|
||||
second.revision,
|
||||
editedUsage(usages[0], {
|
||||
title: 'Konsole als Auftakt',
|
||||
durationSeconds: 300,
|
||||
ownNotes: 'Kurbel zuerst zeigen',
|
||||
research: 'Eigene Recherchekopie'
|
||||
})
|
||||
);
|
||||
updatePieceUsage(
|
||||
created.id,
|
||||
second.id,
|
||||
firstSaved.revision,
|
||||
editedUsage(usages[1], { title: 'Konsole als Rückblick', durationSeconds: 900 })
|
||||
);
|
||||
|
||||
const show = getShow(created.id)!;
|
||||
expect(show.sections[0].usages).toMatchObject([
|
||||
{
|
||||
title: 'Konsole als Auftakt',
|
||||
durationSeconds: 300,
|
||||
ownNotes: 'Kurbel zuerst zeigen',
|
||||
research: 'Eigene Recherchekopie'
|
||||
},
|
||||
{ title: 'Konsole als Rückblick', durationSeconds: 900 }
|
||||
]);
|
||||
expect(getPiece('piece-console')).toMatchObject({
|
||||
title: 'Die kleine Konsole mit dem großen Dreh',
|
||||
durationSeconds: 480,
|
||||
researchText:
|
||||
'## Recherche\n\n- Herstellerangaben gegen unabhängige Tests prüfen\n- Fokus auf Bedienidee statt Leistungsdaten'
|
||||
});
|
||||
});
|
||||
|
||||
it('derives sent history and current planning only from qualifying usages by original id', () => {
|
||||
const completed = createShow({
|
||||
title: 'Abgeschlossene Sendung',
|
||||
startsAtUtc: '2027-01-10T19:00:00Z',
|
||||
templateId: null
|
||||
});
|
||||
const completedSection = addShowSection(completed.id, completed.revision, {
|
||||
name: 'Ablauf',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
const done = addPieceUsage(completed.id, completedSection.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: completedSection.id
|
||||
});
|
||||
const skipped = addPieceUsage(completed.id, done.revision, {
|
||||
pieceId: 'piece-effects',
|
||||
sectionId: completedSection.id
|
||||
});
|
||||
const reserve = addPieceUsage(completed.id, skipped.revision, {
|
||||
pieceId: 'piece-pixels',
|
||||
sectionId: null
|
||||
});
|
||||
getDatabase()
|
||||
.prepare("UPDATE piece_usages SET status = 'done' WHERE id IN (?, ?)")
|
||||
.run(done.id, reserve.id);
|
||||
getDatabase()
|
||||
.prepare("UPDATE piece_usages SET status = 'skipped' WHERE id = ?")
|
||||
.run(skipped.id);
|
||||
getDatabase()
|
||||
.prepare(
|
||||
"UPDATE shows SET status = 'completed', completed_at_utc = starts_at_utc WHERE id = ?"
|
||||
)
|
||||
.run(completed.id);
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO show_finalizations
|
||||
(show_id, command_id, source_revision, finalized_at_utc)
|
||||
SELECT id, 'test-finalization', revision, starts_at_utc FROM shows WHERE id = ?`
|
||||
)
|
||||
.run(completed.id);
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO piece_usage_history
|
||||
(usage_id, show_id, original_piece_id, show_title_snapshot, usage_title_snapshot,
|
||||
used_at_utc, actual_duration_seconds)
|
||||
SELECT u.id, sh.id, u.original_piece_id, sh.title, u.title_snapshot,
|
||||
sh.starts_at_utc, 0 FROM piece_usages u
|
||||
JOIN show_sections s ON s.id = u.show_section_id
|
||||
JOIN shows sh ON sh.id = s.show_id WHERE u.id = ?`
|
||||
)
|
||||
.run(done.id);
|
||||
|
||||
const active = createShow({ title: 'Aktuelle Planung', startsAtUtc: null, templateId: null });
|
||||
const activeSection = addShowSection(active.id, active.revision, {
|
||||
name: 'Plan',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
const planned = addPieceUsage(active.id, activeSection.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: activeSection.id
|
||||
});
|
||||
const plannedReserve = addPieceUsage(active.id, planned.revision, {
|
||||
pieceId: 'piece-effects',
|
||||
sectionId: null
|
||||
});
|
||||
getDatabase().prepare("UPDATE piece_usages SET status = 'done' WHERE id = ?").run(planned.id);
|
||||
|
||||
let contexts = getPieceUsageContexts(
|
||||
['piece-console', 'piece-effects', 'piece-pixels'],
|
||||
active.id
|
||||
);
|
||||
expect(contexts['piece-console']).toMatchObject({
|
||||
isPlannedInCurrentShow: true,
|
||||
sentHistory: [
|
||||
{
|
||||
usageId: done.id,
|
||||
showId: completed.id,
|
||||
showTitle: 'Abgeschlossene Sendung',
|
||||
usedAtUtc: '2027-01-10T19:00:00.000Z'
|
||||
}
|
||||
]
|
||||
});
|
||||
expect(contexts['piece-effects']).toEqual({
|
||||
isPlannedInActiveShow: true,
|
||||
isPlannedInCurrentShow: true,
|
||||
sentHistory: []
|
||||
});
|
||||
expect(contexts['piece-pixels']).toEqual({
|
||||
isPlannedInActiveShow: true,
|
||||
isPlannedInCurrentShow: false,
|
||||
sentHistory: []
|
||||
});
|
||||
|
||||
removePieceUsage(active.id, plannedReserve.id, plannedReserve.revision);
|
||||
contexts = getPieceUsageContexts(['piece-effects'], active.id);
|
||||
expect(contexts['piece-effects'].isPlannedInCurrentShow).toBe(false);
|
||||
});
|
||||
|
||||
it('duplicates an adjusted usage directly after its source without live measurements', () => {
|
||||
const created = createShow({
|
||||
title: 'Einplanungsduplikat',
|
||||
startsAtUtc: null,
|
||||
templateId: null
|
||||
});
|
||||
const section = addShowSection(created.id, created.revision, {
|
||||
name: 'Ablauf',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
const usage = addPieceUsage(created.id, section.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: section.id
|
||||
});
|
||||
const source = getShow(created.id)!.sections[0].usages[0];
|
||||
const adjusted = updatePieceUsage(
|
||||
created.id,
|
||||
usage.id,
|
||||
usage.revision,
|
||||
editedUsage(source, {
|
||||
title: 'Angepasste Einplanung',
|
||||
durationSeconds: 777,
|
||||
intro: 'Eigene Einleitung',
|
||||
research: 'Eigene Recherche',
|
||||
moderation: 'Eigene Moderation',
|
||||
transition: 'Eigene Überleitung',
|
||||
presentation: 'Eigene Präsentation',
|
||||
ownNotes: 'Eigene Notizen'
|
||||
})
|
||||
);
|
||||
getDatabase().prepare("UPDATE piece_usages SET status = 'done' WHERE id = ?").run(usage.id);
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO live_usage_runs (id, show_id, usage_id, started_at_utc, ended_at_utc)
|
||||
VALUES ('source-run', ?, ?, '2027-01-01T10:00:00.000Z', '2027-01-01T10:10:00.000Z')`
|
||||
)
|
||||
.run(created.id, usage.id);
|
||||
const pieceCountBefore = (
|
||||
getDatabase().prepare('SELECT count(*) AS count FROM pieces').get() as { count: number }
|
||||
).count;
|
||||
|
||||
const duplicate = duplicatePieceUsage(created.id, usage.id, adjusted.revision);
|
||||
const usages = getShow(created.id)!.sections[0].usages;
|
||||
expect(usages.map((item) => item.id)).toEqual([usage.id, duplicate.id]);
|
||||
expect(usages[1]).toMatchObject({
|
||||
originalPieceId: 'piece-console',
|
||||
status: 'open',
|
||||
durationSeconds: 777,
|
||||
title: 'Angepasste Einplanung',
|
||||
intro: 'Eigene Einleitung',
|
||||
research: 'Eigene Recherche',
|
||||
moderation: 'Eigene Moderation',
|
||||
transition: 'Eigene Überleitung',
|
||||
presentation: 'Eigene Präsentation',
|
||||
ownNotes: 'Eigene Notizen'
|
||||
});
|
||||
expect(
|
||||
getDatabase()
|
||||
.prepare('SELECT count(*) AS count FROM live_usage_runs WHERE usage_id = ?')
|
||||
.get(duplicate.id)
|
||||
).toEqual({ count: 0 });
|
||||
expect(
|
||||
(getDatabase().prepare('SELECT count(*) AS count FROM pieces').get() as { count: number })
|
||||
.count
|
||||
).toBe(pieceCountBefore);
|
||||
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`UPDATE pieces SET title = 'Aktuelles Original', duration_seconds = 420,
|
||||
intro = 'Neue Einleitung', research_text = 'Neue Recherche',
|
||||
moderation_notes = 'Neue Moderation', transition_text = 'Neue Überleitung',
|
||||
presentation_text = 'Neue Präsentation' WHERE id = 'piece-console'`
|
||||
)
|
||||
.run();
|
||||
const refreshed = refreshPieceUsageFromOriginal(created.id, usage.id, duplicate.revision);
|
||||
const refreshedUsages = getShow(created.id)!.sections[0].usages;
|
||||
expect(refreshedUsages[0]).toMatchObject({
|
||||
title: 'Aktuelles Original',
|
||||
durationSeconds: 420,
|
||||
intro: 'Neue Einleitung',
|
||||
research: 'Neue Recherche',
|
||||
moderation: 'Neue Moderation',
|
||||
transition: 'Neue Überleitung',
|
||||
presentation: 'Neue Präsentation',
|
||||
ownNotes: 'Eigene Notizen',
|
||||
status: 'done'
|
||||
});
|
||||
expect(refreshedUsages[1]).toMatchObject({
|
||||
title: 'Angepasste Einplanung',
|
||||
durationSeconds: 777,
|
||||
status: 'open'
|
||||
});
|
||||
expect(
|
||||
getDatabase()
|
||||
.prepare('SELECT count(*) AS count FROM live_usage_runs WHERE usage_id = ?')
|
||||
.get(usage.id)
|
||||
).toEqual({ count: 1 });
|
||||
expect(() => duplicatePieceUsage(created.id, usage.id, adjusted.revision)).toThrow('CONFLICT');
|
||||
expect(getShow(created.id)?.revision).toBe(refreshed.revision);
|
||||
getDatabase()
|
||||
.prepare('UPDATE piece_usages SET original_piece_id = NULL WHERE id = ?')
|
||||
.run(duplicate.id);
|
||||
expect(() =>
|
||||
refreshPieceUsageFromOriginal(created.id, duplicate.id, refreshed.revision)
|
||||
).toThrow('ORIGINAL_NOT_FOUND');
|
||||
expect(getShow(created.id)?.revision).toBe(refreshed.revision);
|
||||
expect(getShow(created.id)!.sections[0].usages).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('snapshots presentation settings until an explicit refresh and copies them on duplication', () => {
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`UPDATE piece_sources SET label = 'YouTube', url = ?, timecode_seconds = 75
|
||||
WHERE piece_id = 'piece-console' AND position = 0`
|
||||
)
|
||||
.run('https://youtu.be/dQw4w9WgXcQ');
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`UPDATE pieces SET output_title = 'Öffentlicher Ausgabetitel',
|
||||
presentation_mode = 'video', presentation_source_position = 0,
|
||||
presentation_title = 'Gespeicherte Vorschau', presentation_description = 'Erster Stand',
|
||||
presentation_site_name = 'YouTube', presentation_provider = 'youtube',
|
||||
presentation_provider_id = 'dQw4w9WgXcQ' WHERE id = 'piece-console'`
|
||||
)
|
||||
.run();
|
||||
const show = createShow({ title: 'Snapshot-Test', startsAtUtc: null, templateId: null });
|
||||
const section = addShowSection(show.id, show.revision, {
|
||||
name: 'Videos',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
const added = addPieceUsage(show.id, section.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: section.id
|
||||
});
|
||||
let usage = getShow(show.id)!.sections[0].usages[0];
|
||||
expect(usage).toMatchObject({
|
||||
outputTitle: 'Öffentlicher Ausgabetitel',
|
||||
presentationMode: 'video',
|
||||
presentationSourceUrl: 'https://youtu.be/dQw4w9WgXcQ',
|
||||
presentationSourceTimecodeSeconds: 75,
|
||||
presentationTitle: 'Gespeicherte Vorschau'
|
||||
});
|
||||
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`UPDATE pieces SET presentation_title = 'Neuer Originaltitel' WHERE id = 'piece-console'`
|
||||
)
|
||||
.run();
|
||||
expect(getShow(show.id)!.sections[0].usages[0].presentationTitle).toBe('Gespeicherte Vorschau');
|
||||
const refreshed = refreshPieceUsageFromOriginal(show.id, usage.id, added.revision);
|
||||
usage = getShow(show.id)!.sections[0].usages[0];
|
||||
expect(usage.presentationTitle).toBe('Neuer Originaltitel');
|
||||
duplicatePieceUsage(show.id, usage.id, refreshed.revision);
|
||||
expect(getShow(show.id)!.sections[0].usages[1]).toMatchObject({
|
||||
presentationMode: 'video',
|
||||
presentationSourceUrl: 'https://youtu.be/dQw4w9WgXcQ',
|
||||
presentationTitle: 'Neuer Originaltitel',
|
||||
status: 'open'
|
||||
});
|
||||
});
|
||||
|
||||
it('keeps private source, tool and topic snapshots stable until an explicit refresh', () => {
|
||||
const database = getDatabase();
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO tools (id, name, start_url, description, is_active, created_at_utc, updated_at_utc)
|
||||
VALUES ('tool-tierlist', 'Tierlist', 'https://example.com/start', '', 1, ?, ?)`
|
||||
)
|
||||
.run('2026-10-23T00:00:00.000Z', '2026-10-23T00:00:00.000Z');
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO piece_tools (id, piece_id, tool_id, work_url, note, position)
|
||||
VALUES ('piece-tool-console', 'piece-console', 'tool-tierlist', 'https://example.com/board', 'Erster Stand', 0)`
|
||||
)
|
||||
.run();
|
||||
const show = createShow({ title: 'Relationen', startsAtUtc: null, templateId: null });
|
||||
const section = addShowSection(show.id, show.revision, {
|
||||
name: 'Block',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
const added = addPieceUsage(show.id, section.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: section.id
|
||||
});
|
||||
let usage = getShow(show.id)!.sections[0].usages[0];
|
||||
expect(usage).toMatchObject({
|
||||
sources: [{ label: 'Herstellerseite', url: 'https://example.com/console' }],
|
||||
tools: [{ name: 'Tierlist', workUrl: 'https://example.com/board', note: 'Erster Stand' }],
|
||||
topics: [{ name: 'Gaming', iconName: '' }]
|
||||
});
|
||||
|
||||
database
|
||||
.prepare("UPDATE piece_sources SET label = 'Neue Quelle' WHERE piece_id = 'piece-console'")
|
||||
.run();
|
||||
database
|
||||
.prepare("UPDATE tools SET name = 'Neuer Katalogname' WHERE id = 'tool-tierlist'")
|
||||
.run();
|
||||
database
|
||||
.prepare(
|
||||
"UPDATE piece_tools SET work_url = 'https://example.com/new' WHERE id = 'piece-tool-console'"
|
||||
)
|
||||
.run();
|
||||
database.prepare("DELETE FROM piece_topics WHERE piece_id = 'piece-console'").run();
|
||||
database
|
||||
.prepare(
|
||||
"INSERT INTO piece_topics (piece_id, topic_id) VALUES ('piece-console', 'topic-internet')"
|
||||
)
|
||||
.run();
|
||||
usage = getShow(show.id)!.sections[0].usages[0];
|
||||
expect(usage.sources[0].label).toBe('Herstellerseite');
|
||||
expect(usage.tools[0]).toMatchObject({
|
||||
name: 'Tierlist',
|
||||
workUrl: 'https://example.com/board'
|
||||
});
|
||||
expect(usage.topics).toEqual([{ name: 'Gaming', iconName: '' }]);
|
||||
|
||||
refreshPieceUsageFromOriginal(show.id, usage.id, added.revision);
|
||||
usage = getShow(show.id)!.sections[0].usages[0];
|
||||
expect(usage.sources[0].label).toBe('Neue Quelle');
|
||||
expect(usage.tools[0]).toMatchObject({
|
||||
name: 'Neuer Katalogname',
|
||||
workUrl: 'https://example.com/new'
|
||||
});
|
||||
expect(usage.topics).toEqual([{ name: 'Netzkultur', iconName: '' }]);
|
||||
});
|
||||
|
||||
it('snapshots active media, their presentation choice and topic icons independently', () => {
|
||||
const database = getDatabase();
|
||||
database.prepare("UPDATE topics SET icon_name = 'gamepad' WHERE id = 'topic-gaming'").run();
|
||||
const insertMedia = database.prepare(
|
||||
`INSERT INTO piece_media (id, piece_id, storage_name, original_name, mime_type,
|
||||
byte_size, alt_text, position, created_at_utc, removed_at_utc)
|
||||
VALUES (?, 'piece-console', ?, ?, 'image/png', 10, ?, ?, ?, ?)`
|
||||
);
|
||||
insertMedia.run(
|
||||
'media-first',
|
||||
'first.png',
|
||||
'first-original.png',
|
||||
'Erstes Bild',
|
||||
0,
|
||||
'2026-10-23T00:00:00.000Z',
|
||||
null
|
||||
);
|
||||
insertMedia.run(
|
||||
'media-second',
|
||||
'second.png',
|
||||
'second-original.png',
|
||||
'Zweites Bild',
|
||||
1,
|
||||
'2026-10-23T00:00:00.000Z',
|
||||
null
|
||||
);
|
||||
insertMedia.run(
|
||||
'media-removed',
|
||||
'removed.png',
|
||||
'removed-original.png',
|
||||
'Entferntes Bild',
|
||||
2,
|
||||
'2026-10-23T00:00:00.000Z',
|
||||
'2026-10-23T01:00:00.000Z'
|
||||
);
|
||||
database
|
||||
.prepare(
|
||||
"INSERT INTO piece_presentation_media (piece_id, media_id) VALUES ('piece-console', 'media-first')"
|
||||
)
|
||||
.run();
|
||||
const show = createShow({ title: 'Medien', startsAtUtc: null, templateId: null });
|
||||
const section = addShowSection(show.id, show.revision, {
|
||||
name: 'Bilder',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
const added = addPieceUsage(show.id, section.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: section.id
|
||||
});
|
||||
let usage = getShow(show.id)!.sections[0].usages[0];
|
||||
expect(usage.topics).toEqual([{ name: 'Gaming', iconName: 'gamepad' }]);
|
||||
expect(usage.media).toMatchObject([
|
||||
{ originalMediaId: 'media-first', altText: 'Erstes Bild', position: 0, isPresentation: true },
|
||||
{
|
||||
originalMediaId: 'media-second',
|
||||
altText: 'Zweites Bild',
|
||||
position: 1,
|
||||
isPresentation: false
|
||||
}
|
||||
]);
|
||||
expect(usage.presentationMediaId).toBe(usage.media[0].id);
|
||||
|
||||
const selected = updatePieceUsage(show.id, usage.id, added.revision, {
|
||||
...editedUsage(usage),
|
||||
presentationMediaId: usage.media[1].id
|
||||
});
|
||||
usage = getShow(show.id)!.sections[0].usages[0];
|
||||
expect(usage.media.map((item) => item.isPresentation)).toEqual([false, true]);
|
||||
expect(() =>
|
||||
updatePieceUsage(show.id, usage.id, selected.revision, {
|
||||
...editedUsage(usage),
|
||||
presentationMediaId: 'media-first'
|
||||
})
|
||||
).toThrow('INVALID_PRESENTATION_MEDIA');
|
||||
expect(getShow(show.id)?.revision).toBe(selected.revision);
|
||||
|
||||
const duplicate = duplicatePieceUsage(show.id, usage.id, selected.revision);
|
||||
const duplicateUsage = getShow(show.id)!.sections[0].usages[1];
|
||||
expect(duplicateUsage.media.map((item) => item.originalMediaId)).toEqual([
|
||||
'media-first',
|
||||
'media-second'
|
||||
]);
|
||||
expect(duplicateUsage.presentationMediaId).toBe(duplicateUsage.media[1].id);
|
||||
expect(duplicateUsage.media.map((item) => item.id)).not.toEqual(
|
||||
usage.media.map((item) => item.id)
|
||||
);
|
||||
|
||||
database
|
||||
.prepare("UPDATE piece_media SET removed_at_utc = ? WHERE id = 'media-first'")
|
||||
.run('2026-10-23T02:00:00.000Z');
|
||||
database
|
||||
.prepare("UPDATE piece_media SET alt_text = 'Neuer Alternativtext' WHERE id = 'media-second'")
|
||||
.run();
|
||||
database.prepare("DELETE FROM piece_presentation_media WHERE piece_id = 'piece-console'").run();
|
||||
database
|
||||
.prepare(
|
||||
"INSERT INTO piece_presentation_media (piece_id, media_id) VALUES ('piece-console', 'media-second')"
|
||||
)
|
||||
.run();
|
||||
refreshPieceUsageFromOriginal(show.id, usage.id, duplicate.revision);
|
||||
usage = getShow(show.id)!.sections[0].usages[0];
|
||||
expect(usage.media).toMatchObject([
|
||||
{ originalMediaId: 'media-second', altText: 'Neuer Alternativtext', isPresentation: true }
|
||||
]);
|
||||
expect(duplicateUsage.media).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('persists normalized section and usage reordering, moving and removal', () => {
|
||||
const created = createShow({ title: 'Sortierung', startsAtUtc: null, templateId: null });
|
||||
const firstSection = addShowSection(created.id, created.revision, {
|
||||
name: 'Erster Block',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
const secondSection = addShowSection(created.id, firstSection.revision, {
|
||||
name: 'Zweiter Block',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
const firstUsage = addPieceUsage(created.id, secondSection.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: firstSection.id
|
||||
});
|
||||
const secondUsage = addPieceUsage(created.id, firstUsage.revision, {
|
||||
pieceId: 'piece-effects',
|
||||
sectionId: firstSection.id
|
||||
});
|
||||
const thirdUsage = addPieceUsage(created.id, secondUsage.revision, {
|
||||
pieceId: 'piece-pixels',
|
||||
sectionId: firstSection.id
|
||||
});
|
||||
const reordered = movePieceUsage(created.id, thirdUsage.id, thirdUsage.revision, {
|
||||
sectionId: firstSection.id,
|
||||
position: 0
|
||||
});
|
||||
const reserved = movePieceUsage(created.id, firstUsage.id, reordered.revision, {
|
||||
sectionId: null,
|
||||
position: 0
|
||||
});
|
||||
const plannedAgain = movePieceUsage(created.id, firstUsage.id, reserved.revision, {
|
||||
sectionId: secondSection.id,
|
||||
position: 0
|
||||
});
|
||||
const removedUsage = removePieceUsage(created.id, secondUsage.id, plannedAgain.revision);
|
||||
const movedSection = moveShowSection(created.id, secondSection.id, 0, removedUsage.revision);
|
||||
removeShowSection(created.id, firstSection.id, movedSection.revision);
|
||||
|
||||
const show = getShow(created.id)!;
|
||||
expect(show.sections.map((section) => [section.name, section.position])).toEqual([
|
||||
['Zweiter Block', 0]
|
||||
]);
|
||||
expect(show.sections[0].usages.map((usage) => [usage.id, usage.position])).toEqual([
|
||||
[firstUsage.id, 0]
|
||||
]);
|
||||
expect(show.reserve).toEqual([]);
|
||||
expect(getDatabase().pragma('foreign_key_check')).toEqual([]);
|
||||
});
|
||||
|
||||
it('uses explicit section durations once and excludes the show-wide reserve', () => {
|
||||
const created = createShow({ title: 'Dauer', startsAtUtc: null, templateId: null });
|
||||
const section = addShowSection(created.id, created.revision, {
|
||||
name: 'Fester Block',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: 600
|
||||
});
|
||||
const planned = addPieceUsage(created.id, section.revision, {
|
||||
pieceId: 'piece-effects',
|
||||
sectionId: section.id
|
||||
});
|
||||
addPieceUsage(created.id, planned.revision, {
|
||||
pieceId: 'piece-pixels',
|
||||
sectionId: null
|
||||
});
|
||||
|
||||
const explicit = getShow(created.id)!;
|
||||
expect(explicit.sections[0].durationSeconds).toBe(600);
|
||||
expect(explicit.totalDurationSeconds).toBe(600);
|
||||
expect(explicit.reserve[0].durationSeconds).toBe(540);
|
||||
|
||||
updateShowSection(created.id, section.id, explicit.revision, {
|
||||
name: 'Summierter Block',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
expect(getShow(created.id)).toMatchObject({
|
||||
totalDurationSeconds: 720,
|
||||
sections: [{ durationSeconds: 720 }]
|
||||
});
|
||||
});
|
||||
|
||||
it('rolls stale and invalid aggregate mutations back and rejects completed shows', () => {
|
||||
const created = createShow({ title: 'Konflikt', startsAtUtc: null, templateId: null });
|
||||
const saved = addShowSection(created.id, created.revision, {
|
||||
name: 'Gültig',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
});
|
||||
expect(() =>
|
||||
addShowSection(created.id, created.revision, {
|
||||
name: 'Veraltet',
|
||||
categoryId: null,
|
||||
explicitDurationSeconds: null
|
||||
})
|
||||
).toThrow('CONFLICT');
|
||||
expect(getShow(created.id)).toMatchObject({
|
||||
revision: saved.revision,
|
||||
sections: [{ name: 'Gültig' }]
|
||||
});
|
||||
|
||||
expect(() => removeShowSection(created.id, 'missing', saved.revision)).toThrow('NOT_FOUND');
|
||||
expect(getShow(created.id)?.revision).toBe(saved.revision);
|
||||
getDatabase().prepare("UPDATE shows SET status = 'completed' WHERE id = ?").run(created.id);
|
||||
expect(() =>
|
||||
addPieceUsage(created.id, saved.revision, {
|
||||
pieceId: 'piece-console',
|
||||
sectionId: saved.id
|
||||
})
|
||||
).toThrow('SHOW_COMPLETED');
|
||||
expect(getShow(created.id)).toMatchObject({
|
||||
revision: saved.revision,
|
||||
sections: [{ usages: [] }]
|
||||
});
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,103 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { mkdtempSync, rmSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import type { AuthUser } from './auth.js';
|
||||
import { closeDatabase, getDatabase } from './database.js';
|
||||
import {
|
||||
authenticateTechnical,
|
||||
createTechnicalAccess,
|
||||
idempotentResponse,
|
||||
revokeTechnicalAccess,
|
||||
updateTechnicalAccess
|
||||
} from './technical-access.js';
|
||||
|
||||
let directory: string;
|
||||
let actor: AuthUser;
|
||||
|
||||
beforeEach(() => {
|
||||
directory = mkdtempSync(path.join(tmpdir(), 'sendewerk-api-test-'));
|
||||
process.env.SENDEWERK_DB_PATH = path.join(directory, 'test.sqlite');
|
||||
process.env.SENDEWERK_UPLOAD_DIR = path.join(directory, 'uploads');
|
||||
execFileSync(process.execPath, ['scripts/migrate.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
execFileSync(process.execPath, ['scripts/seed.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
const now = new Date().toISOString();
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO users (id, email, email_normalized, display_name, password_hash, role,
|
||||
password_changed_at_utc, created_at_utc, updated_at_utc) VALUES ('test-user', 'test@example.org',
|
||||
'test@example.org', 'Test', 'not-used', 'barkeeper', ?, ?, ?)`
|
||||
)
|
||||
.run(now, now, now);
|
||||
actor = {
|
||||
id: 'test-user',
|
||||
email: 'test@example.org',
|
||||
displayName: 'Test',
|
||||
role: 'barkeeper',
|
||||
lockedAtUtc: null
|
||||
};
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
closeDatabase();
|
||||
delete process.env.SENDEWERK_DB_PATH;
|
||||
delete process.env.SENDEWERK_UPLOAD_DIR;
|
||||
rmSync(directory, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
function request(token: string, key?: string) {
|
||||
return new Request('https://sendewerk.test/api/v1/pieces', {
|
||||
headers: { Authorization: `Bearer ${token}`, ...(key ? { 'Idempotency-Key': key } : {}) }
|
||||
});
|
||||
}
|
||||
|
||||
describe('technical API access', () => {
|
||||
it('enforces permissions and revocation without storing the raw token', () => {
|
||||
const created = createTechnicalAccess(actor, 'Leser', 'read');
|
||||
expect(authenticateTechnical(request(created.token))).toMatchObject({
|
||||
name: 'Leser',
|
||||
permissions: 'read'
|
||||
});
|
||||
expect(() => authenticateTechnical(request(created.token), true)).toThrow('API_FORBIDDEN');
|
||||
expect(
|
||||
getDatabase()
|
||||
.prepare('SELECT token_hash FROM technical_accesses WHERE id = ?')
|
||||
.get(created.id)
|
||||
).not.toMatchObject({ token_hash: created.token });
|
||||
updateTechnicalAccess(actor, created.id, 'Leser bearbeitet', 'read_write');
|
||||
expect(authenticateTechnical(request(created.token), true)).toMatchObject({
|
||||
name: 'Leser bearbeitet',
|
||||
permissions: 'read_write'
|
||||
});
|
||||
revokeTechnicalAccess(actor, created.id);
|
||||
expect(() => authenticateTechnical(request(created.token))).toThrow('API_UNAUTHORIZED');
|
||||
});
|
||||
|
||||
it('replays an identical idempotent write and rejects a changed payload', () => {
|
||||
const created = createTechnicalAccess(actor, 'Schreiber', 'read_write');
|
||||
const technical = authenticateTechnical(request(created.token), true);
|
||||
let calls = 0;
|
||||
const first = idempotentResponse(
|
||||
technical,
|
||||
request(created.token, 'command-1'),
|
||||
{ title: 'A' },
|
||||
() => ({ status: 201, body: { calls: ++calls } })
|
||||
);
|
||||
const replay = idempotentResponse(
|
||||
technical,
|
||||
request(created.token, 'command-1'),
|
||||
{ title: 'A' },
|
||||
() => ({ status: 201, body: { calls: ++calls } })
|
||||
);
|
||||
expect(first.duplicate).toBe(false);
|
||||
expect(replay).toMatchObject({ duplicate: true, body: { calls: 1 } });
|
||||
expect(calls).toBe(1);
|
||||
expect(() =>
|
||||
idempotentResponse(technical, request(created.token, 'command-1'), { title: 'B' }, () => ({
|
||||
status: 201,
|
||||
body: {}
|
||||
}))
|
||||
).toThrow('API_IDEMPOTENCY_CONFLICT');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,176 @@
|
||||
import { createHash, randomBytes, randomUUID } from 'node:crypto';
|
||||
import type { AuthUser } from './auth.js';
|
||||
import { getDatabase } from './database.js';
|
||||
|
||||
export type TechnicalPermission = 'read' | 'read_write';
|
||||
export type TechnicalActor = { id: string; name: string; permissions: TechnicalPermission };
|
||||
|
||||
function tokenHash(token: string) {
|
||||
return createHash('sha256').update(token).digest('hex');
|
||||
}
|
||||
|
||||
export function listTechnicalAccesses() {
|
||||
return getDatabase()
|
||||
.prepare(
|
||||
`SELECT id, name, permissions, created_at_utc AS createdAtUtc,
|
||||
last_used_at_utc AS lastUsedAtUtc, revoked_at_utc AS revokedAtUtc FROM technical_accesses ORDER BY name`
|
||||
)
|
||||
.all() as {
|
||||
id: string;
|
||||
name: string;
|
||||
permissions: TechnicalPermission;
|
||||
createdAtUtc: string;
|
||||
lastUsedAtUtc: string | null;
|
||||
revokedAtUtc: string | null;
|
||||
}[];
|
||||
}
|
||||
|
||||
export function createTechnicalAccess(actor: AuthUser, nameValue: string, permissions: string) {
|
||||
const name = nameValue.trim();
|
||||
if (!name || name.length > 120 || !['read', 'read_write'].includes(permissions))
|
||||
throw new Error('INVALID_ACCESS');
|
||||
const token = randomBytes(32).toString('base64url');
|
||||
const id = randomUUID();
|
||||
const now = new Date().toISOString();
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO technical_accesses
|
||||
(id, name, token_hash, permissions, created_by_user_id, created_at_utc) VALUES (?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(id, name, tokenHash(token), permissions, actor.id, now);
|
||||
auditTechnical(
|
||||
{ id: actor.id, name: actor.displayName, permissions: 'read_write' },
|
||||
'technical_access.create',
|
||||
'technical_access',
|
||||
id,
|
||||
'user'
|
||||
);
|
||||
return { id, token };
|
||||
}
|
||||
|
||||
export function updateTechnicalAccess(
|
||||
actor: AuthUser,
|
||||
id: string,
|
||||
nameValue: string,
|
||||
permissions: string
|
||||
) {
|
||||
const name = nameValue.trim();
|
||||
if (!name || name.length > 120 || !['read', 'read_write'].includes(permissions))
|
||||
throw new Error('INVALID_ACCESS');
|
||||
const result = getDatabase()
|
||||
.prepare(
|
||||
`UPDATE technical_accesses SET name = ?, permissions = ?
|
||||
WHERE id = ? AND revoked_at_utc IS NULL`
|
||||
)
|
||||
.run(name, permissions, id);
|
||||
if (!result.changes) throw new Error('NOT_FOUND');
|
||||
auditTechnical(
|
||||
{ id: actor.id, name: actor.displayName, permissions: 'read_write' },
|
||||
'technical_access.update',
|
||||
'technical_access',
|
||||
id,
|
||||
'user'
|
||||
);
|
||||
}
|
||||
|
||||
export function revokeTechnicalAccess(actor: AuthUser, id: string) {
|
||||
const result = getDatabase()
|
||||
.prepare(
|
||||
'UPDATE technical_accesses SET revoked_at_utc = ? WHERE id = ? AND revoked_at_utc IS NULL'
|
||||
)
|
||||
.run(new Date().toISOString(), id);
|
||||
if (!result.changes) throw new Error('NOT_FOUND');
|
||||
auditTechnical(
|
||||
{ id: actor.id, name: actor.displayName, permissions: 'read_write' },
|
||||
'technical_access.revoke',
|
||||
'technical_access',
|
||||
id,
|
||||
'user'
|
||||
);
|
||||
}
|
||||
|
||||
export function authenticateTechnical(request: Request, write = false): TechnicalActor {
|
||||
const authorization = request.headers.get('authorization') ?? '';
|
||||
const token = authorization.startsWith('Bearer ') ? authorization.slice(7).trim() : '';
|
||||
if (!token) throw new Error('API_UNAUTHORIZED');
|
||||
const row = getDatabase()
|
||||
.prepare(
|
||||
`SELECT id, name, permissions FROM technical_accesses
|
||||
WHERE token_hash = ? AND revoked_at_utc IS NULL`
|
||||
)
|
||||
.get(tokenHash(token)) as TechnicalActor | undefined;
|
||||
if (!row) throw new Error('API_UNAUTHORIZED');
|
||||
if (write && row.permissions !== 'read_write') throw new Error('API_FORBIDDEN');
|
||||
getDatabase()
|
||||
.prepare('UPDATE technical_accesses SET last_used_at_utc = ? WHERE id = ?')
|
||||
.run(new Date().toISOString(), row.id);
|
||||
return row;
|
||||
}
|
||||
|
||||
export function auditTechnical(
|
||||
actor: TechnicalActor,
|
||||
action: string,
|
||||
targetType: string,
|
||||
targetId: string,
|
||||
actorType: 'technical' | 'user' = 'technical'
|
||||
) {
|
||||
getDatabase()
|
||||
.prepare(
|
||||
`INSERT INTO audit_events (id, actor_type, actor_id, action, target_type, target_id, created_at_utc)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(
|
||||
randomUUID(),
|
||||
actorType,
|
||||
actor.id,
|
||||
action.slice(0, 120),
|
||||
targetType.slice(0, 80),
|
||||
targetId.slice(0, 200),
|
||||
new Date().toISOString()
|
||||
);
|
||||
}
|
||||
|
||||
export function idempotentResponse(
|
||||
actor: TechnicalActor,
|
||||
request: Request,
|
||||
body: unknown,
|
||||
operation: () => { status: number; body: unknown }
|
||||
) {
|
||||
const key = request.headers.get('idempotency-key')?.trim() ?? '';
|
||||
if (!key || key.length > 200) throw new Error('API_IDEMPOTENCY_REQUIRED');
|
||||
const hash = createHash('sha256')
|
||||
.update(`${request.method} ${new URL(request.url).pathname}\n${JSON.stringify(body)}`)
|
||||
.digest('hex');
|
||||
const database = getDatabase();
|
||||
return database.transaction(() => {
|
||||
const existing = database
|
||||
.prepare(
|
||||
'SELECT request_hash, status_code, response_json FROM api_idempotency WHERE access_id = ? AND request_key = ?'
|
||||
)
|
||||
.get(actor.id, key) as
|
||||
{ request_hash: string; status_code: number; response_json: string } | undefined;
|
||||
if (existing) {
|
||||
if (existing.request_hash !== hash) throw new Error('API_IDEMPOTENCY_CONFLICT');
|
||||
return {
|
||||
status: existing.status_code,
|
||||
body: JSON.parse(existing.response_json),
|
||||
duplicate: true
|
||||
};
|
||||
}
|
||||
const result = operation();
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO api_idempotency
|
||||
(access_id, request_key, request_hash, status_code, response_json, created_at_utc) VALUES (?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(
|
||||
actor.id,
|
||||
key,
|
||||
hash,
|
||||
result.status,
|
||||
JSON.stringify(result.body),
|
||||
new Date().toISOString()
|
||||
);
|
||||
return { ...result, duplicate: false };
|
||||
})();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { berlinLocalToUtc } from './time.js';
|
||||
|
||||
describe('Berlin local time conversion', () => {
|
||||
it('converts valid civil time and rejects normalized or nonexistent values', () => {
|
||||
expect(berlinLocalToUtc('2026-10-25T20:00')).toBe('2026-10-25T19:00:00.000Z');
|
||||
expect(berlinLocalToUtc('')).toBeNull();
|
||||
expect(() => berlinLocalToUtc('2026-02-31T12:00')).toThrow('INVALID_TIMESTAMP');
|
||||
expect(() => berlinLocalToUtc('2026-03-29T02:30', 'INVALID_EXPIRY')).toThrow('INVALID_EXPIRY');
|
||||
expect(() => berlinLocalToUtc('2026-10-25T02:30', 'INVALID_EXPIRY')).toThrow('INVALID_EXPIRY');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
export function berlinLocalToUtc(value: string, errorCode = 'INVALID_TIMESTAMP'): string | null {
|
||||
if (!value) return null;
|
||||
const match = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(value);
|
||||
if (!match) throw new Error(errorCode);
|
||||
const parts = match.slice(1).map(Number);
|
||||
const localMilliseconds = Date.UTC(parts[0], parts[1] - 1, parts[2], parts[3], parts[4]);
|
||||
let candidate = localMilliseconds;
|
||||
const formatter = new Intl.DateTimeFormat('en-CA', {
|
||||
timeZone: 'Europe/Berlin',
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hourCycle: 'h23'
|
||||
});
|
||||
const localParts = (date: Date) => {
|
||||
const formatted = formatter.formatToParts(date);
|
||||
const read = (type: Intl.DateTimeFormatPartTypes) =>
|
||||
formatted.find((part) => part.type === type)?.value ?? '';
|
||||
return {
|
||||
key: `${read('year')}-${read('month')}-${read('day')}T${read('hour')}:${read('minute')}`,
|
||||
milliseconds: Date.UTC(
|
||||
Number(read('year')),
|
||||
Number(read('month')) - 1,
|
||||
Number(read('day')),
|
||||
Number(read('hour')),
|
||||
Number(read('minute'))
|
||||
)
|
||||
};
|
||||
};
|
||||
for (let attempt = 0; attempt < 2; attempt += 1) {
|
||||
candidate += localMilliseconds - localParts(new Date(candidate)).milliseconds;
|
||||
}
|
||||
const result = new Date(candidate);
|
||||
if (localParts(result).key !== value) throw new Error(errorCode);
|
||||
if (
|
||||
localParts(new Date(candidate - 60 * 60 * 1000)).key === value ||
|
||||
localParts(new Date(candidate + 60 * 60 * 1000)).key === value
|
||||
) {
|
||||
throw new Error(errorCode);
|
||||
}
|
||||
return result.toISOString();
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { mkdtempSync, rmSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import { closeDatabase } from './database.js';
|
||||
import { createTool, listTools, updateTool } from './tools.js';
|
||||
|
||||
let directory: string;
|
||||
|
||||
beforeEach(() => {
|
||||
directory = mkdtempSync(path.join(tmpdir(), 'sendewerk-tools-test-'));
|
||||
process.env.SENDEWERK_DB_PATH = path.join(directory, 'test.sqlite');
|
||||
process.env.SENDEWERK_UPLOAD_DIR = path.join(directory, 'uploads');
|
||||
execFileSync(process.execPath, ['scripts/migrate.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
execFileSync(process.execPath, ['scripts/seed.mjs'], { cwd: process.cwd(), env: process.env });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
closeDatabase();
|
||||
delete process.env.SENDEWERK_DB_PATH;
|
||||
delete process.env.SENDEWERK_UPLOAD_DIR;
|
||||
rmSync(directory, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
describe('tool catalog', () => {
|
||||
it('validates, classifies and deactivates tools without deleting them', () => {
|
||||
const id = createTool({
|
||||
name: 'Tierlist',
|
||||
startUrl: 'https://example.com/tierlist',
|
||||
description: 'Gemeinsames Ranking',
|
||||
iconName: 'ranking-star',
|
||||
isActive: true,
|
||||
formatIds: ['format-quiz']
|
||||
});
|
||||
expect(listTools()).toEqual([
|
||||
{
|
||||
id,
|
||||
name: 'Tierlist',
|
||||
startUrl: 'https://example.com/tierlist',
|
||||
description: 'Gemeinsames Ranking',
|
||||
iconName: 'ranking-star',
|
||||
isActive: true,
|
||||
formatIds: ['format-quiz']
|
||||
}
|
||||
]);
|
||||
updateTool(id, {
|
||||
name: 'Tierlist',
|
||||
startUrl: '',
|
||||
description: '',
|
||||
iconName: 'list-ol',
|
||||
isActive: false,
|
||||
formatIds: []
|
||||
});
|
||||
expect(listTools()).toEqual([]);
|
||||
expect(listTools(true)[0]).toMatchObject({ id, iconName: 'list-ol', isActive: false });
|
||||
expect(() =>
|
||||
createTool({
|
||||
name: 'Unsicher',
|
||||
startUrl: 'javascript:alert(1)',
|
||||
description: '',
|
||||
iconName: 'wrench',
|
||||
isActive: true,
|
||||
formatIds: []
|
||||
})
|
||||
).toThrow('INVALID_TOOL_URL');
|
||||
expect(() =>
|
||||
createTool({
|
||||
name: 'Unbekanntes Icon',
|
||||
startUrl: '',
|
||||
description: '',
|
||||
iconName: 'kein-font-awesome-icon',
|
||||
isActive: true,
|
||||
formatIds: []
|
||||
})
|
||||
).toThrow('INVALID_ICON');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,156 @@
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import { classicRegularIconNames } from '#lib/icons/classic-regular.js';
|
||||
import { getDatabase } from './database.js';
|
||||
|
||||
export type Tool = {
|
||||
id: string;
|
||||
name: string;
|
||||
startUrl: string;
|
||||
description: string;
|
||||
iconName: string;
|
||||
isActive: boolean;
|
||||
formatIds: string[];
|
||||
};
|
||||
|
||||
export type ToolInput = Omit<Tool, 'id'>;
|
||||
|
||||
function clean(value: unknown, maximum: number, required = false) {
|
||||
const text = String(value ?? '').trim();
|
||||
if (text.length > maximum || (required && !text)) throw new Error('INVALID_TOOL');
|
||||
return text;
|
||||
}
|
||||
|
||||
function validUrl(value: string) {
|
||||
if (!value) return '';
|
||||
try {
|
||||
const url = new URL(value);
|
||||
if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password)
|
||||
throw new Error();
|
||||
return url.href;
|
||||
} catch {
|
||||
throw new Error('INVALID_TOOL_URL');
|
||||
}
|
||||
}
|
||||
|
||||
function validated(input: ToolInput): ToolInput {
|
||||
const formatIds = [...new Set(input.formatIds.filter(Boolean))];
|
||||
if (formatIds.length > 30) throw new Error('INVALID_TOOL');
|
||||
if (formatIds.length) {
|
||||
const placeholders = formatIds.map(() => '?').join(', ');
|
||||
const row = getDatabase()
|
||||
.prepare(`SELECT count(*) AS count FROM formats WHERE id IN (${placeholders})`)
|
||||
.get(...formatIds) as { count: number };
|
||||
if (row.count !== formatIds.length) throw new Error('INVALID_TOOL_FORMAT');
|
||||
}
|
||||
return {
|
||||
name: clean(input.name, 120, true),
|
||||
startUrl: validUrl(clean(input.startUrl, 2_000)),
|
||||
description: clean(input.description, 2_000),
|
||||
iconName: (() => {
|
||||
const iconName = clean(input.iconName, 120, true);
|
||||
if (!classicRegularIconNames.has(iconName)) throw new Error('INVALID_ICON');
|
||||
return iconName;
|
||||
})(),
|
||||
isActive: Boolean(input.isActive),
|
||||
formatIds
|
||||
};
|
||||
}
|
||||
|
||||
export function listTools(includeInactive = false): Tool[] {
|
||||
const database = getDatabase();
|
||||
const rows = database
|
||||
.prepare(
|
||||
`SELECT id, name, start_url, description, icon_name, is_active FROM tools
|
||||
${includeInactive ? '' : 'WHERE is_active = 1'} ORDER BY is_active DESC, name`
|
||||
)
|
||||
.all() as {
|
||||
id: string;
|
||||
name: string;
|
||||
start_url: string;
|
||||
description: string;
|
||||
icon_name: string;
|
||||
is_active: number;
|
||||
}[];
|
||||
const formats = database.prepare(
|
||||
'SELECT format_id FROM tool_formats WHERE tool_id = ? ORDER BY format_id'
|
||||
);
|
||||
return rows.map((row) => ({
|
||||
id: row.id,
|
||||
name: row.name,
|
||||
startUrl: row.start_url,
|
||||
description: row.description,
|
||||
iconName: row.icon_name,
|
||||
isActive: row.is_active === 1,
|
||||
formatIds: (formats.all(row.id) as { format_id: string }[]).map((item) => item.format_id)
|
||||
}));
|
||||
}
|
||||
|
||||
function replaceFormats(toolId: string, formatIds: string[]) {
|
||||
const database = getDatabase();
|
||||
database.prepare('DELETE FROM tool_formats WHERE tool_id = ?').run(toolId);
|
||||
const insert = database.prepare('INSERT INTO tool_formats (tool_id, format_id) VALUES (?, ?)');
|
||||
for (const formatId of formatIds) insert.run(toolId, formatId);
|
||||
}
|
||||
|
||||
export function createTool(rawInput: ToolInput) {
|
||||
const input = validated(rawInput);
|
||||
const database = getDatabase();
|
||||
const id = randomUUID();
|
||||
const now = new Date().toISOString();
|
||||
try {
|
||||
database.transaction(() => {
|
||||
database
|
||||
.prepare(
|
||||
`INSERT INTO tools (id, name, start_url, description, icon_name, is_active, created_at_utc, updated_at_utc)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
.run(
|
||||
id,
|
||||
input.name,
|
||||
input.startUrl,
|
||||
input.description,
|
||||
input.iconName,
|
||||
input.isActive ? 1 : 0,
|
||||
now,
|
||||
now
|
||||
);
|
||||
replaceFormats(id, input.formatIds);
|
||||
})();
|
||||
} catch (cause) {
|
||||
if (cause instanceof Error && cause.message.includes('UNIQUE')) {
|
||||
throw new Error('TOOL_EXISTS', { cause });
|
||||
}
|
||||
throw cause;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
export function updateTool(id: string, rawInput: ToolInput) {
|
||||
const input = validated(rawInput);
|
||||
const database = getDatabase();
|
||||
try {
|
||||
database.transaction(() => {
|
||||
const result = database
|
||||
.prepare(
|
||||
`UPDATE tools SET name = ?, start_url = ?, description = ?, icon_name = ?, is_active = ?, updated_at_utc = ?
|
||||
WHERE id = ?`
|
||||
)
|
||||
.run(
|
||||
input.name,
|
||||
input.startUrl,
|
||||
input.description,
|
||||
input.iconName,
|
||||
input.isActive ? 1 : 0,
|
||||
new Date().toISOString(),
|
||||
id
|
||||
);
|
||||
if (result.changes !== 1) throw new Error('NOT_FOUND');
|
||||
replaceFormats(id, input.formatIds);
|
||||
})();
|
||||
} catch (cause) {
|
||||
if (cause instanceof Error && cause.message.includes('UNIQUE')) {
|
||||
throw new Error('TOOL_EXISTS', { cause });
|
||||
}
|
||||
throw cause;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { LayoutServerLoad } from './$types';
|
||||
|
||||
export const load: LayoutServerLoad = ({ locals, url }) => ({
|
||||
user:
|
||||
url.pathname.startsWith('/heinzlive/') || url.pathname.startsWith('/freigabe/')
|
||||
? null
|
||||
: locals.user,
|
||||
presentationMode: url.pathname.startsWith('/heinzlive/'),
|
||||
guestMode: url.pathname.startsWith('/freigabe/'),
|
||||
liveControllerMode: url.pathname === '/live'
|
||||
});
|
||||
+62
-10
@@ -3,16 +3,20 @@
|
||||
import { resolve } from '$app/paths';
|
||||
import { page } from '$app/state';
|
||||
import NavIcon from '#lib/components/NavIcon.svelte';
|
||||
import AppIcon from '#lib/components/AppIcon.svelte';
|
||||
import ThemeToggle from '#lib/components/ThemeToggle.svelte';
|
||||
|
||||
let { children } = $props();
|
||||
const navigation = [
|
||||
let { children, data } = $props();
|
||||
const primaryNavigation = [
|
||||
{ href: '/eingang', label: 'Eingang', icon: 'inbox' },
|
||||
{ href: '/fundus', label: 'Fundus', icon: 'library' },
|
||||
{ href: '/sendungen', label: 'Sendungen', icon: 'shows' },
|
||||
{ href: '/archiv', label: 'Archiv', icon: 'archive' },
|
||||
{ href: '/verwaltung', label: 'Verwaltung', icon: 'settings' }
|
||||
{ href: '/archiv', label: 'Archiv', icon: 'archive' }
|
||||
] as const;
|
||||
const administration = { href: '/verwaltung', label: 'Verwaltung', icon: 'settings' } as const;
|
||||
const mobileNavigation = $derived(
|
||||
data.user?.role === 'barkeeper' ? [...primaryNavigation, administration] : primaryNavigation
|
||||
);
|
||||
|
||||
function isActive(href: string) {
|
||||
return (
|
||||
@@ -28,6 +32,22 @@
|
||||
/>
|
||||
</svelte:head>
|
||||
|
||||
{#if data.presentationMode}
|
||||
{@render children()}
|
||||
{:else if data.guestMode}
|
||||
<div class="guest-shell">
|
||||
<header class="auth-header">
|
||||
<span class="brand"
|
||||
><span class="brand-mark" aria-hidden="true"><i></i><i></i><i></i></span><span
|
||||
>Sendewerk</span
|
||||
></span
|
||||
><ThemeToggle />
|
||||
</header>
|
||||
{@render children()}
|
||||
</div>
|
||||
{:else if data.user && data.liveControllerMode}
|
||||
<main id="main-content" class="live-controller-shell">{@render children()}</main>
|
||||
{:else if data.user}
|
||||
<div class="app-shell">
|
||||
<aside class="sidebar">
|
||||
<a class="brand" href={resolve('/fundus')} aria-label="Sendewerk Startseite">
|
||||
@@ -36,7 +56,7 @@
|
||||
</a>
|
||||
|
||||
<nav class="main-navigation" aria-label="Hauptnavigation">
|
||||
{#each navigation as item (item.href)}
|
||||
{#each primaryNavigation as item (item.href)}
|
||||
<a
|
||||
href={resolve(item.href)}
|
||||
class:active={isActive(item.href)}
|
||||
@@ -49,11 +69,26 @@
|
||||
</nav>
|
||||
|
||||
<div class="sidebar-footer">
|
||||
<ThemeToggle />
|
||||
<div class="stage-indicator">
|
||||
<span></span>
|
||||
<div><strong>Etappe 1</strong><small>Lokaler Entwurf</small></div>
|
||||
{#if data.user.role === 'barkeeper'}
|
||||
<nav class="utility-navigation" aria-label="Verwaltung">
|
||||
<a
|
||||
href={resolve(administration.href)}
|
||||
class:active={isActive(administration.href)}
|
||||
aria-current={isActive(administration.href) ? 'page' : undefined}
|
||||
>
|
||||
<NavIcon name={administration.icon} />
|
||||
<span>{administration.label}</span>
|
||||
</a>
|
||||
</nav>
|
||||
{/if}
|
||||
<div class="account-summary">
|
||||
<span>{data.user.displayName}</span>
|
||||
<small>{data.user.role === 'barkeeper' ? 'Barkeeper' : 'Thekencrew'}</small>
|
||||
</div>
|
||||
<form method="POST" action="/logout">
|
||||
<button class="logout-button" type="submit">Abmelden</button>
|
||||
</form>
|
||||
<ThemeToggle />
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
@@ -62,13 +97,18 @@
|
||||
<span class="brand-mark" aria-hidden="true"><i></i><i></i><i></i></span>
|
||||
<span>Sendewerk</span>
|
||||
</a>
|
||||
<form method="POST" action="/logout">
|
||||
<button class="mobile-logout" type="submit" aria-label="Abmelden"
|
||||
><AppIcon name="right-from-bracket" /></button
|
||||
>
|
||||
</form>
|
||||
<ThemeToggle />
|
||||
</header>
|
||||
|
||||
<main id="main-content">{@render children()}</main>
|
||||
|
||||
<nav class="mobile-navigation" aria-label="Hauptnavigation">
|
||||
{#each navigation as item (item.href)}
|
||||
{#each mobileNavigation as item (item.href)}
|
||||
<a
|
||||
href={resolve(item.href)}
|
||||
class:active={isActive(item.href)}
|
||||
@@ -80,3 +120,15 @@
|
||||
{/each}
|
||||
</nav>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="auth-shell">
|
||||
<header class="auth-header">
|
||||
<a class="brand" href={resolve('/login')} aria-label="Sendewerk Anmeldung">
|
||||
<span class="brand-mark" aria-hidden="true"><i></i><i></i><i></i></span>
|
||||
<span>Sendewerk</span>
|
||||
</a>
|
||||
<ThemeToggle />
|
||||
</header>
|
||||
<main class="auth-main">{@render children()}</main>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -1,5 +1,7 @@
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { hasUsers } from '#lib/server/auth.js';
|
||||
|
||||
export function load() {
|
||||
redirect(307, '/fundus');
|
||||
export function load({ locals }) {
|
||||
if (!hasUsers()) redirect(307, '/setup');
|
||||
redirect(307, locals.user ? '/fundus' : '/login');
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
const id = { name: 'id', in: 'path', required: true, schema: { type: 'string' } };
|
||||
const usageId = { name: 'usageId', in: 'path', required: true, schema: { type: 'string' } };
|
||||
const idempotency = {
|
||||
name: 'Idempotency-Key',
|
||||
in: 'header',
|
||||
required: true,
|
||||
schema: { type: 'string' }
|
||||
};
|
||||
const ok = { '200': { description: 'Erfolgreich' } };
|
||||
const jsonBody = (schema: Record<string, unknown>) => ({
|
||||
required: true,
|
||||
content: { 'application/json': { schema } }
|
||||
});
|
||||
|
||||
export const GET: RequestHandler = () =>
|
||||
json({
|
||||
openapi: '3.1.0',
|
||||
info: {
|
||||
title: 'Sendewerk API',
|
||||
version: '1.0.0',
|
||||
description:
|
||||
'Versionierte API für technische Redaktionszugänge. Schreibzugriffe benötigen einen Idempotency-Key.'
|
||||
},
|
||||
servers: [{ url: '/api/v1' }],
|
||||
security: [{ bearerAuth: [] }],
|
||||
components: {
|
||||
securitySchemes: {
|
||||
bearerAuth: { type: 'http', scheme: 'bearer', bearerFormat: 'Sendewerk technical token' }
|
||||
},
|
||||
schemas: {
|
||||
PieceWrite: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
title: { type: 'string' },
|
||||
summary: { type: 'string' },
|
||||
status: { enum: ['inbox', 'preparing', 'ready'] },
|
||||
durationSeconds: { type: 'integer', minimum: 0 }
|
||||
}
|
||||
},
|
||||
ShowWrite: {
|
||||
type: 'object',
|
||||
required: ['title'],
|
||||
properties: {
|
||||
title: { type: 'string' },
|
||||
startsAtUtc: { type: ['string', 'null'], format: 'date-time' },
|
||||
templateId: { type: ['string', 'null'] }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
paths: {
|
||||
'/pieces': {
|
||||
get: { summary: 'Pieces lesen', responses: ok },
|
||||
post: {
|
||||
summary: 'Piece anlegen',
|
||||
parameters: [idempotency],
|
||||
requestBody: jsonBody({ $ref: '#/components/schemas/PieceWrite' }),
|
||||
responses: { '201': { description: 'Angelegt' } }
|
||||
}
|
||||
},
|
||||
'/pieces/{id}': {
|
||||
get: { summary: 'Piece lesen', parameters: [id], responses: ok },
|
||||
patch: {
|
||||
summary: 'Piece ändern',
|
||||
parameters: [id],
|
||||
requestBody: jsonBody({
|
||||
allOf: [
|
||||
{ $ref: '#/components/schemas/PieceWrite' },
|
||||
{ type: 'object', required: ['revision'] }
|
||||
]
|
||||
}),
|
||||
responses: ok
|
||||
}
|
||||
},
|
||||
'/shows': {
|
||||
get: { summary: 'Sendungen lesen', responses: ok },
|
||||
post: {
|
||||
summary: 'Sendung anlegen',
|
||||
parameters: [idempotency],
|
||||
requestBody: jsonBody({ $ref: '#/components/schemas/ShowWrite' }),
|
||||
responses: { '201': { description: 'Angelegt' } }
|
||||
}
|
||||
},
|
||||
'/shows/{id}': { get: { summary: 'Sendung lesen', parameters: [id], responses: ok } },
|
||||
'/shows/{id}/usages': {
|
||||
post: {
|
||||
summary: 'Piece einplanen',
|
||||
parameters: [id, idempotency],
|
||||
requestBody: jsonBody({ type: 'object', required: ['revision', 'pieceId'] }),
|
||||
responses: { '201': { description: 'Eingeplant' } }
|
||||
}
|
||||
},
|
||||
'/shows/{id}/usages/{usageId}': {
|
||||
patch: {
|
||||
summary: 'Einplanung sortieren',
|
||||
parameters: [id, usageId, idempotency],
|
||||
requestBody: jsonBody({ type: 'object', required: ['revision', 'position'] }),
|
||||
responses: ok
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { apiBody, apiFailure, pageInput } from '#lib/server/api-http.js';
|
||||
import {
|
||||
createPiece,
|
||||
getPiece,
|
||||
listPieces,
|
||||
savePiece,
|
||||
type PieceStatus
|
||||
} from '#lib/server/content.js';
|
||||
import {
|
||||
auditTechnical,
|
||||
authenticateTechnical,
|
||||
idempotentResponse
|
||||
} from '#lib/server/technical-access.js';
|
||||
|
||||
export const GET: RequestHandler = ({ request, url }) => {
|
||||
try {
|
||||
authenticateTechnical(request);
|
||||
const { limit, offset } = pageInput(url);
|
||||
const status = url.searchParams.get('status') as PieceStatus | null;
|
||||
const statuses = status ? [status] : (['inbox', 'preparing', 'ready'] as PieceStatus[]);
|
||||
const all = listPieces({ statuses, query: url.searchParams.get('q') ?? '' });
|
||||
return json({
|
||||
data: all.slice(offset, offset + limit),
|
||||
pagination: { limit, offset, total: all.length }
|
||||
});
|
||||
} catch (cause) {
|
||||
return apiFailure(cause);
|
||||
}
|
||||
};
|
||||
|
||||
export const POST: RequestHandler = async ({ request }) => {
|
||||
try {
|
||||
const actor = authenticateTechnical(request, true);
|
||||
const body = await apiBody(request);
|
||||
const result = idempotentResponse(actor, request, body, () => {
|
||||
const id = createPiece('blank');
|
||||
const piece = getPiece(id)!;
|
||||
savePiece(id, piece.revision, {
|
||||
...piece,
|
||||
title: String(body.title ?? ''),
|
||||
summary: String(body.summary ?? ''),
|
||||
status: ['inbox', 'preparing', 'ready'].includes(String(body.status))
|
||||
? (body.status as 'inbox' | 'preparing' | 'ready')
|
||||
: 'preparing',
|
||||
durationSeconds: Number(body.durationSeconds ?? 0),
|
||||
sources: Array.isArray(body.sources)
|
||||
? body.sources.map((source) => ({
|
||||
label: String((source as Record<string, unknown>).label ?? ''),
|
||||
url: String((source as Record<string, unknown>).url ?? ''),
|
||||
timecodeSeconds:
|
||||
(source as Record<string, unknown>).timecodeSeconds == null
|
||||
? null
|
||||
: Number((source as Record<string, unknown>).timecodeSeconds)
|
||||
}))
|
||||
: []
|
||||
});
|
||||
auditTechnical(actor, 'piece.create', 'piece', id);
|
||||
return { status: 201, body: { data: getPiece(id) } };
|
||||
});
|
||||
return json(result.body, {
|
||||
status: result.status,
|
||||
headers: { 'Idempotency-Replayed': result.duplicate ? 'true' : 'false' }
|
||||
});
|
||||
} catch (cause) {
|
||||
return apiFailure(cause);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { apiBody, apiFailure } from '#lib/server/api-http.js';
|
||||
import { getPiece, savePiece } from '#lib/server/content.js';
|
||||
import { auditTechnical, authenticateTechnical } from '#lib/server/technical-access.js';
|
||||
|
||||
export const GET: RequestHandler = ({ request, params }) => {
|
||||
try {
|
||||
authenticateTechnical(request);
|
||||
const piece = getPiece(params.id);
|
||||
if (!piece) throw new Error('NOT_FOUND');
|
||||
return json({ data: piece });
|
||||
} catch (cause) {
|
||||
return apiFailure(cause);
|
||||
}
|
||||
};
|
||||
|
||||
export const PATCH: RequestHandler = async ({ request, params }) => {
|
||||
try {
|
||||
const actor = authenticateTechnical(request, true);
|
||||
const body = await apiBody(request);
|
||||
const piece = getPiece(params.id);
|
||||
if (!piece) throw new Error('NOT_FOUND');
|
||||
if (piece.status === 'archived') throw new Error('INVALID_STATUS');
|
||||
if (Number(body.revision) !== piece.revision) throw new Error('CONFLICT');
|
||||
const status =
|
||||
body.status !== undefined
|
||||
? (String(body.status) as 'inbox' | 'preparing' | 'ready')
|
||||
: piece.status;
|
||||
savePiece(params.id, piece.revision, {
|
||||
...piece,
|
||||
status,
|
||||
...(body.title !== undefined ? { title: String(body.title) } : {}),
|
||||
...(body.summary !== undefined ? { summary: String(body.summary) } : {}),
|
||||
...(body.durationSeconds !== undefined
|
||||
? { durationSeconds: Number(body.durationSeconds) }
|
||||
: {})
|
||||
});
|
||||
auditTechnical(actor, 'piece.update', 'piece', params.id);
|
||||
return json({ data: getPiece(params.id) });
|
||||
} catch (cause) {
|
||||
return apiFailure(cause);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { apiBody, apiFailure, pageInput } from '#lib/server/api-http.js';
|
||||
import { createShow, getShow, listShows } from '#lib/server/shows.js';
|
||||
import {
|
||||
auditTechnical,
|
||||
authenticateTechnical,
|
||||
idempotentResponse
|
||||
} from '#lib/server/technical-access.js';
|
||||
|
||||
export const GET: RequestHandler = ({ request, url }) => {
|
||||
try {
|
||||
authenticateTechnical(request);
|
||||
const { limit, offset } = pageInput(url);
|
||||
const all = listShows();
|
||||
return json({
|
||||
data: all.slice(offset, offset + limit),
|
||||
pagination: { limit, offset, total: all.length }
|
||||
});
|
||||
} catch (cause) {
|
||||
return apiFailure(cause);
|
||||
}
|
||||
};
|
||||
|
||||
export const POST: RequestHandler = async ({ request }) => {
|
||||
try {
|
||||
const actor = authenticateTechnical(request, true);
|
||||
const body = await apiBody(request);
|
||||
const result = idempotentResponse(actor, request, body, () => {
|
||||
const created = createShow({
|
||||
title: String(body.title ?? ''),
|
||||
startsAtUtc: body.startsAtUtc ? String(body.startsAtUtc) : null,
|
||||
templateId: body.templateId ? String(body.templateId) : null
|
||||
});
|
||||
auditTechnical(actor, 'show.create', 'show', created.id);
|
||||
return { status: 201, body: { data: getShow(created.id) } };
|
||||
});
|
||||
return json(result.body, {
|
||||
status: result.status,
|
||||
headers: { 'Idempotency-Replayed': result.duplicate ? 'true' : 'false' }
|
||||
});
|
||||
} catch (cause) {
|
||||
return apiFailure(cause);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { apiFailure } from '#lib/server/api-http.js';
|
||||
import { getShow } from '#lib/server/shows.js';
|
||||
import { authenticateTechnical } from '#lib/server/technical-access.js';
|
||||
|
||||
export const GET: RequestHandler = ({ request, params }) => {
|
||||
try {
|
||||
authenticateTechnical(request);
|
||||
const show = getShow(params.id);
|
||||
if (!show) throw new Error('NOT_FOUND');
|
||||
return json({ data: show });
|
||||
} catch (cause) {
|
||||
return apiFailure(cause);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { apiBody, apiFailure } from '#lib/server/api-http.js';
|
||||
import { addPieceUsage, getShow } from '#lib/server/shows.js';
|
||||
import {
|
||||
auditTechnical,
|
||||
authenticateTechnical,
|
||||
idempotentResponse
|
||||
} from '#lib/server/technical-access.js';
|
||||
|
||||
export const POST: RequestHandler = async ({ request, params }) => {
|
||||
try {
|
||||
const actor = authenticateTechnical(request, true);
|
||||
const body = await apiBody(request);
|
||||
const result = idempotentResponse(actor, request, body, () => {
|
||||
const created = addPieceUsage(params.id, Number(body.revision), {
|
||||
pieceId: String(body.pieceId ?? ''),
|
||||
sectionId: body.sectionId ? String(body.sectionId) : null,
|
||||
position: body.position == null ? undefined : Number(body.position)
|
||||
});
|
||||
auditTechnical(actor, 'usage.create', 'usage', created.id);
|
||||
return { status: 201, body: { data: getShow(params.id), usageId: created.id } };
|
||||
});
|
||||
return json(result.body, {
|
||||
status: result.status,
|
||||
headers: { 'Idempotency-Replayed': result.duplicate ? 'true' : 'false' }
|
||||
});
|
||||
} catch (cause) {
|
||||
return apiFailure(cause);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { apiBody, apiFailure } from '#lib/server/api-http.js';
|
||||
import { getShow, movePieceUsage } from '#lib/server/shows.js';
|
||||
import {
|
||||
auditTechnical,
|
||||
authenticateTechnical,
|
||||
idempotentResponse
|
||||
} from '#lib/server/technical-access.js';
|
||||
|
||||
export const PATCH: RequestHandler = async ({ request, params }) => {
|
||||
try {
|
||||
const actor = authenticateTechnical(request, true);
|
||||
const body = await apiBody(request);
|
||||
const result = idempotentResponse(actor, request, body, () => {
|
||||
movePieceUsage(params.id, params.usageId, Number(body.revision), {
|
||||
sectionId: body.sectionId ? String(body.sectionId) : null,
|
||||
position: Number(body.position)
|
||||
});
|
||||
auditTechnical(actor, 'usage.move', 'usage', params.usageId);
|
||||
return { status: 200, body: { data: getShow(params.id) } };
|
||||
});
|
||||
return json(result.body, {
|
||||
status: result.status,
|
||||
headers: { 'Idempotency-Replayed': result.duplicate ? 'true' : 'false' }
|
||||
});
|
||||
} catch (cause) {
|
||||
return apiFailure(cause);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
import { fail, redirect } from '@sveltejs/kit';
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import type { Actions, PageServerLoad } from './$types';
|
||||
import { requireUser } from '#lib/server/auth.js';
|
||||
import { listPieces, setPieceArchived, setPieceDeleted } from '#lib/server/content.js';
|
||||
import { duplicateCompletedShow, listShows } from '#lib/server/shows.js';
|
||||
|
||||
export const load: PageServerLoad = ({ locals }) => {
|
||||
requireUser(locals.user);
|
||||
return {
|
||||
completedShows: listShows(['completed']),
|
||||
duplicateCommandId: randomUUID(),
|
||||
pieces: listPieces({ statuses: ['archived'] }),
|
||||
deletedPieces: listPieces({
|
||||
statuses: ['inbox', 'preparing', 'ready', 'archived'],
|
||||
deleted: true
|
||||
})
|
||||
};
|
||||
};
|
||||
|
||||
export const actions = {
|
||||
restore: async ({ locals, request }) => {
|
||||
requireUser(locals.user);
|
||||
const data = await request.formData();
|
||||
try {
|
||||
setPieceArchived(String(data.get('pieceId') || ''), Number(data.get('revision')), false);
|
||||
return { success: 'Piece wurde in seinen vorherigen Bereich zurückgelegt.' };
|
||||
} catch {
|
||||
return fail(409, { error: 'Das Piece wurde inzwischen geändert. Bitte Seite neu laden.' });
|
||||
}
|
||||
},
|
||||
restoreDeleted: async ({ locals, request }) => {
|
||||
requireUser(locals.user);
|
||||
const data = await request.formData();
|
||||
try {
|
||||
setPieceDeleted(String(data.get('pieceId') || ''), Number(data.get('revision')), false);
|
||||
return { success: 'Gelöschtes Piece wurde wiederhergestellt.' };
|
||||
} catch {
|
||||
return fail(409, { error: 'Das Piece wurde inzwischen geändert. Bitte Seite neu laden.' });
|
||||
}
|
||||
},
|
||||
duplicateShow: async ({ locals, request }) => {
|
||||
requireUser(locals.user);
|
||||
const data = await request.formData();
|
||||
try {
|
||||
const duplicate = duplicateCompletedShow(
|
||||
String(data.get('showId') || ''),
|
||||
String(data.get('commandId') || '')
|
||||
);
|
||||
redirect(303, `/sendungen/${duplicate.id}`);
|
||||
} catch (cause) {
|
||||
if (cause && typeof cause === 'object' && 'status' in cause) throw cause;
|
||||
return fail(400, { error: 'Die Sendung konnte nicht dupliziert werden.' });
|
||||
}
|
||||
}
|
||||
} satisfies Actions;
|
||||
@@ -1,20 +1,78 @@
|
||||
<script lang="ts">
|
||||
import AppIcon from '#lib/components/AppIcon.svelte';
|
||||
import { resolve } from '$app/paths';
|
||||
import { formatDuration } from '#lib/format.js';
|
||||
import type { PageProps } from './$types';
|
||||
let { data, form }: PageProps = $props();
|
||||
</script>
|
||||
|
||||
<svelte:head><title>Archiv | Sendewerk</title></svelte:head>
|
||||
|
||||
<div class="page-wrap narrow-page">
|
||||
<header class="page-heading">
|
||||
<p class="eyebrow">Bewahrte Sendungen</p>
|
||||
<h1>Archiv</h1>
|
||||
<p class="page-intro">
|
||||
Abgeschlossene Abläufe bleiben hier in ihrem damaligen Stand nachvollziehbar.
|
||||
</p>
|
||||
<p class="page-intro">Stabile Sendungshistorie und bewusst abgelegte Fundus-Pieces.</p>
|
||||
</header>
|
||||
<section class="quiet-panel planned-panel">
|
||||
<div class="planned-icon" aria-hidden="true">□</div>
|
||||
<p class="eyebrow">Geplant für Etappe 6</p>
|
||||
<h2>Historie braucht klare Regeln.</h2>
|
||||
{#if form?.error}<div class="form-message error" role="alert">{form.error}</div>{/if}
|
||||
{#if form?.success}<div class="form-message success" role="status">{form.success}</div>{/if}
|
||||
<section aria-labelledby="completed-shows-title">
|
||||
<h2 id="completed-shows-title" class="section-heading">Abgeschlossene Sendungen</h2>
|
||||
{#if data.completedShows.length}<div class="archive-list">
|
||||
{#each data.completedShows as show (show.id)}<article>
|
||||
<div>
|
||||
<h2><a href={resolve('/sendungen/[id]', { id: show.id })}>{show.title}</a></h2>
|
||||
<p>
|
||||
Stabile Snapshots, Verwendungshistorie und bewusste Archivierung werden gemeinsam
|
||||
implementiert, statt jetzt nur eine leere Liste vorzutäuschen.
|
||||
{show.sectionCount} Abschnitte · {formatDuration(show.totalDurationSeconds)} Planzeit
|
||||
</p>
|
||||
</div>
|
||||
<form method="POST" action="?/duplicateShow">
|
||||
<input type="hidden" name="showId" value={show.id} />
|
||||
<input type="hidden" name="commandId" value={data.duplicateCommandId} />
|
||||
<button class="secondary-button" type="submit">Als neue Sendung duplizieren</button>
|
||||
</form>
|
||||
</article>{/each}
|
||||
</div>{:else}<p class="context-empty">Noch keine Sendung historisch abgeschlossen.</p>{/if}
|
||||
</section>
|
||||
<h2 class="section-heading">Archivierte Pieces</h2>
|
||||
{#if data.pieces.length}<div class="archive-list">
|
||||
{#each data.pieces as piece (piece.id)}<article>
|
||||
<div>
|
||||
<h2>{piece.title}</h2>
|
||||
<p>{piece.summary || 'Keine Kurzbeschreibung.'}</p>
|
||||
</div>
|
||||
<form method="POST" action="?/restore">
|
||||
<input type="hidden" name="pieceId" value={piece.id} /><input
|
||||
type="hidden"
|
||||
name="revision"
|
||||
value={piece.revision}
|
||||
/><button class="secondary-button" type="submit">Wiederherstellen</button>
|
||||
</form>
|
||||
</article>{/each}
|
||||
</div>
|
||||
{:else}<section class="quiet-panel planned-panel">
|
||||
<div class="planned-icon" aria-hidden="true"><AppIcon name="box-archive" /></div>
|
||||
<h2>Keine Pieces archiviert</h2>
|
||||
<p>Archivierte Inhalte lassen sich hier später wiederherstellen.</p>
|
||||
</section>{/if}
|
||||
<section class="deleted-pieces" aria-labelledby="deleted-pieces-title">
|
||||
<h2 id="deleted-pieces-title">Gelöschte Pieces</h2>
|
||||
<p class="quiet-copy">
|
||||
Diese Einträge bleiben wiederherstellbar; bestehende Sendungsfassungen werden nicht verändert.
|
||||
</p>
|
||||
{#if data.deletedPieces.length}<div class="archive-list">
|
||||
{#each data.deletedPieces as piece (piece.id)}<article>
|
||||
<div>
|
||||
<h2>{piece.title}</h2>
|
||||
{#if piece.summary}<p>{piece.summary}</p>{/if}
|
||||
</div>
|
||||
<form method="POST" action="?/restoreDeleted">
|
||||
<input type="hidden" name="pieceId" value={piece.id} /><input
|
||||
type="hidden"
|
||||
name="revision"
|
||||
value={piece.revision}
|
||||
/><button class="secondary-button" type="submit">Wiederherstellen</button>
|
||||
</form>
|
||||
</article>{/each}
|
||||
</div>{:else}<p class="context-empty">Keine gelöschten Pieces.</p>{/if}
|
||||
</section>
|
||||
</div>
|
||||
@@ -0,0 +1,79 @@
|
||||
import { fail } from '@sveltejs/kit';
|
||||
import type { Actions, PageServerLoad } from './$types';
|
||||
import { requireUser } from '#lib/server/auth.js';
|
||||
import { captureInbox, getTaxonomy, listPieces, setPieceDeleted } from '#lib/server/content.js';
|
||||
import { discardFeedEntries, importFeedEntries, listFeedEntries } from '#lib/server/feeds.js';
|
||||
|
||||
export const load: PageServerLoad = ({ locals }) => {
|
||||
requireUser(locals.user);
|
||||
return {
|
||||
pieces: listPieces({ statuses: ['inbox'] }),
|
||||
feedEntries: listFeedEntries(),
|
||||
taxonomy: getTaxonomy()
|
||||
};
|
||||
};
|
||||
|
||||
export const actions = {
|
||||
capture: async ({ locals, request }) => {
|
||||
requireUser(locals.user);
|
||||
const data = await request.formData();
|
||||
try {
|
||||
const id = captureInbox(String(data.get('title') || ''), String(data.get('url') || ''));
|
||||
return { captured: true, capturedId: id };
|
||||
} catch (cause) {
|
||||
const code = cause instanceof Error ? cause.message : '';
|
||||
return fail(400, {
|
||||
title: String(data.get('title') || ''),
|
||||
url: String(data.get('url') || ''),
|
||||
error:
|
||||
code === 'INVALID_SOURCES'
|
||||
? 'Bitte eine vollständige HTTP- oder HTTPS-Adresse eingeben.'
|
||||
: 'Ein Titel ist erforderlich.'
|
||||
});
|
||||
}
|
||||
},
|
||||
delete: async ({ locals, request }) => {
|
||||
requireUser(locals.user);
|
||||
const data = await request.formData();
|
||||
try {
|
||||
setPieceDeleted(String(data.get('pieceId') || ''), Number(data.get('revision')), true);
|
||||
return { deleted: true };
|
||||
} catch {
|
||||
return fail(409, { error: 'Das Piece wurde inzwischen geändert. Bitte neu laden.' });
|
||||
}
|
||||
},
|
||||
importFeeds: async ({ locals, request }) => {
|
||||
requireUser(locals.user);
|
||||
const data = await request.formData();
|
||||
const entryIds = data.getAll('entryIds').map(String);
|
||||
if (!entryIds.length)
|
||||
return fail(400, {
|
||||
intent: 'feedImport',
|
||||
feedError: 'Mindestens einen Beitrag auswählen.'
|
||||
});
|
||||
try {
|
||||
const pieceIds = importFeedEntries(entryIds, data.getAll('categoryIds').map(String));
|
||||
return {
|
||||
intent: 'feedImport',
|
||||
feedSuccess: `${pieceIds.length} ${pieceIds.length === 1 ? 'Beitrag' : 'Beiträge'} in den Eingang übernommen.`
|
||||
};
|
||||
} catch {
|
||||
return fail(400, {
|
||||
intent: 'feedImport',
|
||||
feedError: 'Die Auswahl konnte nicht übernommen werden.'
|
||||
});
|
||||
}
|
||||
},
|
||||
discardFeeds: async ({ locals, request }) => {
|
||||
requireUser(locals.user);
|
||||
const data = await request.formData();
|
||||
const entryIds = data.getAll('entryIds').map(String);
|
||||
if (!entryIds.length)
|
||||
return fail(400, { intent: 'feedDiscard', feedError: 'Mindestens einen Beitrag auswählen.' });
|
||||
const count = discardFeedEntries(entryIds);
|
||||
return {
|
||||
intent: 'feedDiscard',
|
||||
feedSuccess: `${count} ${count === 1 ? 'Beitrag' : 'Beiträge'} verworfen.`
|
||||
};
|
||||
}
|
||||
} satisfies Actions;
|
||||
+126
-14
@@ -1,21 +1,133 @@
|
||||
<script lang="ts">
|
||||
import { resolve } from '$app/paths';
|
||||
import AppIcon from '#lib/components/AppIcon.svelte';
|
||||
import RssSelectionDialog from '#lib/components/RssSelectionDialog.svelte';
|
||||
import type { PageProps } from './$types';
|
||||
let { data, form }: PageProps = $props();
|
||||
let rssDialog: { showModal: () => void };
|
||||
</script>
|
||||
|
||||
<svelte:head><title>Eingang | Sendewerk</title></svelte:head>
|
||||
|
||||
<div class="page-wrap narrow-page">
|
||||
<header class="page-heading">
|
||||
<p class="eyebrow">Sammelstelle</p>
|
||||
<h1>Eingang</h1>
|
||||
<p class="page-intro">
|
||||
Neue Gedanken und spätere RSS-Fundstücke landen hier, bevor sie in den Fundus übernommen
|
||||
werden.
|
||||
</p>
|
||||
<p class="page-intro">Gedanken und Fundstücke schnell festhalten und später ausarbeiten.</p>
|
||||
</header>
|
||||
<section class="quiet-panel planned-panel">
|
||||
<div class="planned-icon" aria-hidden="true">+</div>
|
||||
<p class="eyebrow">Geplant für Etappe 3 und 7</p>
|
||||
<h2>Noch ist der Tresen leer.</h2>
|
||||
<p>
|
||||
Schnellaufnahme, Feed-Vorschau und bewusste Übernahme werden erst mit den dazugehörigen
|
||||
Speicher- und Sicherheitsregeln umgesetzt.
|
||||
</p>
|
||||
</section>
|
||||
<section class="quiet-panel capture-panel">
|
||||
<div>
|
||||
<p class="eyebrow">Schnellaufnahme</p>
|
||||
<h2>Was soll nicht verloren gehen?</h2>
|
||||
</div>
|
||||
{#if form?.error}<div class="form-message error" role="alert">{form.error}</div>{/if}
|
||||
{#if form?.captured}<div class="form-message success" role="status">
|
||||
Im Eingang gespeichert.
|
||||
<a href={resolve('/fundus/[id]', { id: form.capturedId })}>Jetzt ausarbeiten</a>
|
||||
</div>{/if}
|
||||
<form method="POST" action="?/capture" class="capture-form">
|
||||
<label
|
||||
>Gedanke <span>optional bei URL</span><input
|
||||
name="title"
|
||||
maxlength="200"
|
||||
value={form?.title ?? ''}
|
||||
placeholder="Kurze Idee festhalten"
|
||||
/></label
|
||||
>
|
||||
<label
|
||||
>Link <span>optional</span><input
|
||||
name="url"
|
||||
type="url"
|
||||
maxlength="2000"
|
||||
value={form?.url ?? ''}
|
||||
placeholder="https://…"
|
||||
/></label
|
||||
>
|
||||
<button class="primary-button" type="submit">Im Eingang ablegen</button>
|
||||
</form>
|
||||
</section>
|
||||
<section class="quiet-panel rss-inbox-panel">
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
<p class="eyebrow">RSS-Importeingang</p>
|
||||
<h2>RSS-Beiträge</h2>
|
||||
</div>
|
||||
<span class="catalog-entry-icon"><AppIcon name="rss" /></span>
|
||||
</div>
|
||||
<p class="catalog-note">
|
||||
{data.feedEntries.length}
|
||||
{data.feedEntries.length === 1 ? 'Beitrag ist' : 'Beiträge sind'}
|
||||
verfügbar. Erst deine ausdrückliche Auswahl übernimmt sie in den redaktionellen Eingang.
|
||||
</p>
|
||||
{#if form?.feedError}<div class="form-message error" role="alert">{form.feedError}</div>{/if}
|
||||
{#if form?.feedSuccess}<div class="form-message success" role="status">
|
||||
{form.feedSuccess}
|
||||
</div>{/if}
|
||||
<button
|
||||
class="compact-add-button"
|
||||
type="button"
|
||||
disabled={!data.feedEntries.length}
|
||||
onclick={() => rssDialog.showModal()}
|
||||
>
|
||||
<AppIcon name="list" />
|
||||
{data.feedEntries.length ? 'RSS-Beiträge auswählen' : 'Keine neuen RSS-Beiträge'}
|
||||
</button>
|
||||
</section>
|
||||
<RssSelectionDialog
|
||||
bind:this={rssDialog}
|
||||
entries={data.feedEntries}
|
||||
categories={data.taxonomy.categories}
|
||||
{form}
|
||||
/>
|
||||
{#if data.pieces.length}
|
||||
<section class="inbox-list">
|
||||
<h2>{data.pieces.length} {data.pieces.length === 1 ? 'offener Inhalt' : 'offene Inhalte'}</h2>
|
||||
{#each data.pieces as piece (piece.id)}<article class="inbox-item">
|
||||
<a href={resolve('/fundus/[id]', { id: piece.id })}
|
||||
><span
|
||||
><strong>{piece.title}</strong><small
|
||||
>{piece.sourceCount ? `${piece.sourceCount} Quelle` : 'Gedanke ohne Link'}</small
|
||||
></span
|
||||
><span>Ausarbeiten <AppIcon name="arrow-right" /></span></a
|
||||
>
|
||||
<details class="piece-actions">
|
||||
<summary aria-label={`Aktionen für ${piece.title}`}><AppIcon name="ellipsis" /></summary
|
||||
>
|
||||
<div class="piece-actions-popover">
|
||||
<form
|
||||
method="POST"
|
||||
action="?/delete"
|
||||
onsubmit={(event) =>
|
||||
!confirm(`„${piece.title}“ löschen?`) && event.preventDefault()}
|
||||
>
|
||||
<input type="hidden" name="pieceId" value={piece.id} /><input
|
||||
type="hidden"
|
||||
name="revision"
|
||||
value={piece.revision}
|
||||
/>
|
||||
<button class="text-button danger-text" type="submit">Piece löschen</button>
|
||||
</form>
|
||||
</div>
|
||||
</details>
|
||||
</article>{/each}
|
||||
</section>
|
||||
{:else}<section class="quiet-panel planned-panel">
|
||||
<div class="planned-icon" aria-hidden="true"><AppIcon name="plus" /></div>
|
||||
<h2>Eingang ist leer</h2>
|
||||
<p>Neue Gedanken und Links können oben direkt aufgenommen werden.</p>
|
||||
</section>{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.rss-inbox-panel {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
margin-block: 1.5rem;
|
||||
padding: clamp(0.85rem, 2vw, 1.2rem);
|
||||
}
|
||||
.rss-inbox-panel .panel-heading {
|
||||
margin: 0;
|
||||
}
|
||||
.rss-inbox-panel .catalog-note {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,57 @@
|
||||
import { fail, redirect } from '@sveltejs/kit';
|
||||
import type { Actions, PageServerLoad } from './$types';
|
||||
import {
|
||||
acceptInvitation,
|
||||
createSession,
|
||||
deleteLinkToken,
|
||||
getInvitation,
|
||||
INVITATION_COOKIE,
|
||||
readLinkToken,
|
||||
storeLinkToken,
|
||||
validDisplayName,
|
||||
validPassword
|
||||
} from '#lib/server/auth.js';
|
||||
|
||||
export const load: PageServerLoad = ({ url, cookies }) => {
|
||||
const queryToken = url.searchParams.get('token');
|
||||
if (queryToken) {
|
||||
if (queryToken.length <= 100) storeLinkToken(cookies, INVITATION_COOKIE, queryToken);
|
||||
else deleteLinkToken(cookies, INVITATION_COOKIE);
|
||||
redirect(303, '/einladung');
|
||||
}
|
||||
const token = readLinkToken(cookies, INVITATION_COOKIE);
|
||||
const invitation = getInvitation(token);
|
||||
const valid = Boolean(
|
||||
invitation &&
|
||||
!invitation.accepted_at_utc &&
|
||||
!invitation.revoked_at_utc &&
|
||||
invitation.expires_at_utc > new Date().toISOString()
|
||||
);
|
||||
return { valid, email: valid ? invitation?.email : null };
|
||||
};
|
||||
|
||||
export const actions = {
|
||||
default: async ({ request, cookies }) => {
|
||||
const data = await request.formData();
|
||||
const token = readLinkToken(cookies, INVITATION_COOKIE);
|
||||
const displayName = String(data.get('displayName') || '').trim();
|
||||
const password = String(data.get('password') || '');
|
||||
if (!validDisplayName(displayName) || !validPassword(password)) {
|
||||
return fail(400, {
|
||||
displayName,
|
||||
error: 'Bitte Namen und ein Passwort mit mindestens 12 Zeichen prüfen.'
|
||||
});
|
||||
}
|
||||
try {
|
||||
const user = await acceptInvitation({ token, displayName, password });
|
||||
deleteLinkToken(cookies, INVITATION_COOKIE);
|
||||
createSession(user.id, cookies);
|
||||
} catch {
|
||||
return fail(400, {
|
||||
displayName,
|
||||
error: 'Die Einladung ist ungültig, abgelaufen oder bereits verwendet.'
|
||||
});
|
||||
}
|
||||
redirect(303, '/fundus');
|
||||
}
|
||||
} satisfies Actions;
|
||||
Loaded 100 of 140 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user