Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21c0de7dd9 | ||
|
|
d5b1c58ba2 |
No files matched your search
@@ -6,6 +6,7 @@ BODY_SIZE_LIMIT=6M
|
|||||||
|
|
||||||
# Generate this locally and insert it here as described in README.md. Never commit .env.
|
# Generate this locally and insert it here as described in README.md. Never commit .env.
|
||||||
SENDEWERK_SETUP_TOKEN=
|
SENDEWERK_SETUP_TOKEN=
|
||||||
|
# Public production origins must use HTTPS; loopback HTTP remains available locally.
|
||||||
SENDEWERK_APP_ORIGIN=http://localhost:5173
|
SENDEWERK_APP_ORIGIN=http://localhost:5173
|
||||||
|
|
||||||
# "local" writes messages to the outbox and never contacts a mail server.
|
# "local" writes messages to the outbox and never contacts a mail server.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"title": "Sendewerk",
|
"title": "Sendewerk",
|
||||||
"description": "Redaktionelle Planung und Durchführung von heinzlive-Sendungen.",
|
"description": "Redaktionelle Planung und Durchführung von heinzlive-Sendungen.",
|
||||||
"tagline": "Vom Fundstück bis zur Livesendung",
|
"tagline": "Vom Fundstück bis zur Livesendung",
|
||||||
"version": "0.7.1",
|
"version": "0.7.3",
|
||||||
"healthCheckPath": "/healthz",
|
"healthCheckPath": "/healthz",
|
||||||
"httpPort": 3000,
|
"httpPort": 3000,
|
||||||
"addons": {
|
"addons": {
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
Sendewerk ist die redaktionelle Webanwendung für den Weg vom vorbereiteten
|
Sendewerk ist die redaktionelle Webanwendung für den Weg vom vorbereiteten
|
||||||
Inhalt bis zur moderierten und archivierten Sendung. Der aktuelle Stand umfasst
|
Inhalt bis zur moderierten und archivierten Sendung. Der aktuelle Stand umfasst
|
||||||
Etappe 1 bis 5: technisches Grundgerüst, Anmeldung und Rollen, einen
|
Etappe 1 bis 7: technisches Grundgerüst, Anmeldung und Rollen, Fundus,
|
||||||
persistenten Fundus, den Sendungsbaukasten sowie Live-Steuerung und eine
|
Sendungsbau, Live-Steuerung, Präsentationsausgabe, Abschluss, Archiv,
|
||||||
abgesicherte Präsentationsausgabe. Abschluss und Archivierung folgen in Etappe 6.
|
Freigaben, RSS sowie technische REST- und MCP-Zugänge.
|
||||||
|
|
||||||
## Voraussetzungen
|
## Voraussetzungen
|
||||||
|
|
||||||
@@ -62,6 +62,9 @@ enthält bewusst kein Konto und kein Standardpasswort.
|
|||||||
Relative Sendewerk-Pfade werden vom Projektverzeichnis aus aufgelöst. In
|
Relative Sendewerk-Pfade werden vom Projektverzeichnis aus aufgelöst. In
|
||||||
Cloudron liegen Datenbank und Uploads unter `/app/data`.
|
Cloudron liegen Datenbank und Uploads unter `/app/data`.
|
||||||
|
|
||||||
|
Eine öffentliche Produktions-Origin muss HTTPS verwenden. Nur für lokale
|
||||||
|
Loopback-Adressen bleibt HTTP zulässig.
|
||||||
|
|
||||||
Der Vorgabemodus `local` baut keine Netzwerkverbindung auf. Einladungen und
|
Der Vorgabemodus `local` baut keine Netzwerkverbindung auf. Einladungen und
|
||||||
Passwort-Resets landen als JSON-Dateien in `.data/mail-outbox`; die enthaltenen
|
Passwort-Resets landen als JSON-Dateien in `.data/mail-outbox`; die enthaltenen
|
||||||
Links sind Geheimnisse und dürfen nicht veröffentlicht werden. Echter Versand
|
Links sind Geheimnisse und dürfen nicht veröffentlicht werden. Echter Versand
|
||||||
@@ -151,6 +154,53 @@ DNS-, Redirect-, Zeit- und Größenlimits abgerufen. Private und lokale
|
|||||||
Netzwerkziele sind gesperrt. Eingebettetes HTML oder Skripte einer Quellseite
|
Netzwerkziele sind gesperrt. Eingebettetes HTML oder Skripte einer Quellseite
|
||||||
werden nicht übernommen.
|
werden nicht übernommen.
|
||||||
|
|
||||||
|
## MCP und ChatGPT
|
||||||
|
|
||||||
|
Der lesende Streamable-HTTP-Endpunkt liegt unter `/mcp`. Seine konkrete
|
||||||
|
Adresse ist die konfigurierte Anwendungs-Origin mit angehängtem Pfad:
|
||||||
|
|
||||||
|
```text
|
||||||
|
https://<Cloudron-App-Domain>/mcp
|
||||||
|
```
|
||||||
|
|
||||||
|
Beispiel: Bei `SENDEWERK_APP_ORIGIN=https://sendewerk.example.org` lautet die
|
||||||
|
MCP-URL `https://sendewerk.example.org/mcp`. Niemals einen technischen
|
||||||
|
REST-Token an die URL hängen oder in ChatGPT eintragen. MCP verwendet einen
|
||||||
|
eigenen OAuth-2.1-Flow mit Authorization Code, PKCE und kurzlebigen Tokens.
|
||||||
|
|
||||||
|
Die Verbindung stellt ausschließlich lesende Werkzeuge bereit:
|
||||||
|
|
||||||
|
- `get_profile` identifiziert das verbundene Sendewerk-Konto ohne E-Mail-Adresse.
|
||||||
|
- `list_pieces` und `get_piece` lesen Fundus-Pieces.
|
||||||
|
- `list_shows` und `get_show_rundown` lesen Sendungen und deren Abläufe.
|
||||||
|
|
||||||
|
Die Detailwerkzeuge können private Recherche, Moderationsnotizen, Quellen,
|
||||||
|
eigene Notizen und Reserveinhalte liefern. Der angemeldete Nutzer muss diesem
|
||||||
|
Umfang ausdrücklich zustimmen. Sperrung oder Passwortwechsel widerrufen
|
||||||
|
bestehende OAuth-Tokens; jede MCP-Anfrage prüft Konto, Scope, Ablauf und
|
||||||
|
Zielressource erneut. MCP kann keine Inhalte schreiben.
|
||||||
|
|
||||||
|
### In ChatGPT einrichten
|
||||||
|
|
||||||
|
1. Zuerst Version `0.7.3` unter der endgültigen öffentlichen HTTPS-Origin
|
||||||
|
bereitstellen. Lokalhost ohne öffentliches HTTPS ist für eine direkte
|
||||||
|
ChatGPT-Verbindung nicht erreichbar.
|
||||||
|
2. In [ChatGPT Plugins](https://chatgpt.com/plugins) das Plus wählen und
|
||||||
|
**Add custom MCP server** öffnen.
|
||||||
|
3. Einen Namen und eine Beschreibung vergeben und unter **Connection** die
|
||||||
|
vollständige URL `https://<Cloudron-App-Domain>/mcp` eintragen.
|
||||||
|
4. OAuth als Authentifizierung verwenden, den Risikohinweis prüfen und
|
||||||
|
**Create as a plugin** wählen. ChatGPT entdeckt die OAuth-Endpunkte und
|
||||||
|
registriert einen öffentlichen PKCE-Client dynamisch.
|
||||||
|
5. Im geöffneten Sendewerk-Fenster mit dem eigenen Konto anmelden, Clientname
|
||||||
|
und Rücksprung-Domain prüfen und den lesenden Zugriff ausdrücklich erlauben.
|
||||||
|
6. Die gefundenen fünf Werkzeuge kontrollieren, das Plugin installieren und in
|
||||||
|
einer neuen Unterhaltung über `@` auswählen.
|
||||||
|
|
||||||
|
Eine erfolgreich lokale OAuth- und MCP-Prüfung beweist noch keine reale
|
||||||
|
ChatGPT-Verbindung. Diese muss nach dem Cloudron-Update separat in der
|
||||||
|
jeweiligen ChatGPT-Workspace-Konfiguration durchgeführt werden.
|
||||||
|
|
||||||
## Befehle
|
## Befehle
|
||||||
|
|
||||||
| Befehl | Zweck |
|
| Befehl | Zweck |
|
||||||
@@ -210,6 +260,12 @@ Umgebungsvariable gesetzt werden. `CLOUDRON_APP_ORIGIN` liefert dort die feste
|
|||||||
HTTPS-Origin. SMTP-Zugangsdaten werden ebenfalls ausschließlich als
|
HTTPS-Origin. SMTP-Zugangsdaten werden ebenfalls ausschließlich als
|
||||||
Laufzeitvariablen gesetzt, nicht in Manifest oder Image geschrieben.
|
Laufzeitvariablen gesetzt, nicht in Manifest oder Image geschrieben.
|
||||||
|
|
||||||
|
Für MCP sind keine zusätzlichen Geheimnisse erforderlich. Nach einem Update
|
||||||
|
auf `0.7.3` führt der bestehende Startprozess Migration `0020_oauth_mcp.sql`
|
||||||
|
aus. Anschließend muss die von Cloudron gelieferte HTTPS-Origin mit der in
|
||||||
|
ChatGPT eingetragenen MCP-Domain übereinstimmen. Reverse Proxy und öffentliche
|
||||||
|
Erreichbarkeit wurden ohne Cloudron-Zugang nicht geprüft.
|
||||||
|
|
||||||
Das ersetzt keinen Test auf einem echten Cloudron. Insbesondere Addon-Backup,
|
Das ersetzt keinen Test auf einem echten Cloudron. Insbesondere Addon-Backup,
|
||||||
Restore, Proxy-Origin und das read-only Laufzeitdateisystem können erst dort
|
Restore, Proxy-Origin und das read-only Laufzeitdateisystem können erst dort
|
||||||
abschließend geprüft werden.
|
abschließend geprüft werden.
|
||||||
|
|||||||
@@ -1,5 +1,45 @@
|
|||||||
# Abnahme
|
# Abnahme
|
||||||
|
|
||||||
|
## Lesender MCP-Zugang 0.7.3
|
||||||
|
|
||||||
|
| Bereich | Nachweis | Stand |
|
||||||
|
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | --------------------- |
|
||||||
|
| OAuth-Discovery und anonymer Schutz | Reale lokale HTTP-Anfrage erhält 401 mit `resource_metadata`; Discovery-Routen sind im Produktionsbuild enthalten | erfüllt am 27.10.2026 |
|
||||||
|
| DCR, Zustimmung und PKCE | Isolierter HTTP-Ablauf registriert Client, lädt Zustimmung, erhält Code mit `state`/`iss` und tauscht per S256 | erfüllt am 27.10.2026 |
|
||||||
|
| Nutzer-, Scope- und Ressourcenbindung | Ausgestellter Token ist gehasht persistiert und wird bei jedem Aufruf gegen Nutzer, Scope, Ablauf und `/mcp` geprüft | erfüllt am 27.10.2026 |
|
||||||
|
| MCP-Kompatibilität | Legacy-Initialisierung `2025-11-25` sowie `server/discover` und `tools/list` mit `2026-07-28` über HTTP | erfüllt am 27.10.2026 |
|
||||||
|
| Tatsächliche Leseanfrage | `tools/call` auf `list_pieces` liefert aus einer temporären Seed-Datenbank reale Pieces | erfüllt am 27.10.2026 |
|
||||||
|
| Schreibschutz und Datenminimierung | Nur fünf Lese-Tools; Positivprojektionen ohne E-Mail, Uploadnamen, Dateipfade und Werkzeug-Arbeitsdaten | erfüllt am 27.10.2026 |
|
||||||
|
| ChatGPT- und Cloudron-Verbindung | Kein Deployment und keine externe Clientumgebung vorhanden | offen |
|
||||||
|
|
||||||
|
- `npm run check`: 0 Fehler und 0 Warnungen.
|
||||||
|
- Gezielter isolierter HTTP-Ablauf: OAuth Code Flow, PKCE, anonymer Challenge,
|
||||||
|
Legacy-Initialisierung, aktuelle Discovery, Toolliste und echte
|
||||||
|
`list_pieces`-Anfrage erfolgreich.
|
||||||
|
- `npm run build`: erfolgreich mit `@sveltejs/adapter-node`.
|
||||||
|
- Keine weitere Verhaltenstest- oder Browsermatrix gemäß Auftrag ausgeführt;
|
||||||
|
die Zustimmungsseite wurde im HTTP-Ablauf geladen, aber nicht visuell geprüft.
|
||||||
|
- Echte ChatGPT-Verbindung, öffentliche HTTPS-Erreichbarkeit und Cloudron-
|
||||||
|
Reverse-Proxy-Verhalten bleiben bis zu einem ausdrücklich freigegebenen
|
||||||
|
Deployment offen.
|
||||||
|
|
||||||
|
## 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
|
## Wartungsrelease 0.7.1
|
||||||
|
|
||||||
| Bereich | Nachweis | Stand |
|
| Bereich | Nachweis | Stand |
|
||||||
|
|||||||
@@ -465,3 +465,52 @@ Ein Freigabe-Ersatzlink rotiert ausschließlich den gehashten Token derselben
|
|||||||
Freigabe. Umfang, Passwort-Hash und Ablauf bleiben erhalten, der alte Token und
|
Freigabe. Umfang, Passwort-Hash und Ablauf bleiben erhalten, der alte Token und
|
||||||
alle bisherigen Gastsitzungen werden in derselben Transaktion ungültig. Der neue
|
alle bisherigen Gastsitzungen werden in derselben Transaktion ungültig. Der neue
|
||||||
Klartexttoken wird weiterhin nur in der Action-Antwort ausgegeben.
|
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.
|
||||||
|
|
||||||
|
## Lesender MCP-Zugang 0.7.3
|
||||||
|
|
||||||
|
`/mcp` ist ein stateless Streamable-HTTP-Adapter über `content.ts` und
|
||||||
|
`shows.ts`. Er unterstützt die aktuelle per Request deklarierte MCP-Fassung
|
||||||
|
`2026-07-28` einschließlich `server/discover`, Header-/Body-Abgleich und
|
||||||
|
`resultType`. Für derzeitige OpenAI-Clients bleiben die Initialisierungsfassungen
|
||||||
|
`2025-11-25`, `2025-06-18` und `2025-03-26` verfügbar. Es gibt keine
|
||||||
|
MCP-Sitzung und keinen unabhängigen SSE-Strom; jede Anfrage trägt erneut ihre
|
||||||
|
Authentifizierung.
|
||||||
|
|
||||||
|
Die fünf Werkzeuge sind ausschließlich lesend. Eigene Positivprojektionen
|
||||||
|
lassen Mediennamen, interne Speicherpfade und Werkzeug-Arbeitsdaten aus. Die
|
||||||
|
Detailprojektionen dürfen nach ausdrücklicher Zustimmung redaktionell private
|
||||||
|
Recherche, Moderation, eigene Notizen, Quellen und Reserveinhalte enthalten.
|
||||||
|
Keine MCP-Methode ruft Mutationsdienste auf.
|
||||||
|
|
||||||
|
Sendewerk ist zugleich OAuth-Autorisierungs- und Ressourcenserver. Geschützte
|
||||||
|
Ressourcen- und Authorization-Server-Metadaten verweisen ausschließlich auf die
|
||||||
|
konfigurierte Origin. Öffentliche PKCE-Clients werden per begrenztem DCR
|
||||||
|
registriert; die Autorisierung verlangt exakte Redirect-URI, `S256`, den Scope
|
||||||
|
`sendewerk:read` und den exakten Ressourcenindikator `<Origin>/mcp`. Codes sind
|
||||||
|
fünf Minuten, Zugriffstokens eine Stunde gültig. SQLite speichert nur SHA-256-
|
||||||
|
Hashes. Tokens sind direkt an Nutzer, Client, Scope und Ressource gebunden;
|
||||||
|
Kontosperre und Passwortwechsel widerrufen sie, und jeder MCP-Aufruf verbindet
|
||||||
|
erneut den aktuellen Nutzerzustand.
|
||||||
|
|
||||||
|
DCR ist für die von OpenAI weiterhin unterstützte Kompatibilität vorhanden,
|
||||||
|
aber pro Quelladresse und insgesamt begrenzt. Clientnamen sind nicht verifiziert;
|
||||||
|
der Zustimmungsdialog kennzeichnet dies und zeigt die genaue Rücksprung-Domain.
|
||||||
|
Öffentliche Produktion verlangt HTTPS, während HTTP nur an Loopback-Adressen
|
||||||
|
zulässig bleibt. Der bestehende technische REST-Token wird weder gelesen noch
|
||||||
|
weitergereicht.
|
||||||
@@ -518,3 +518,55 @@ Duplikation und ausdrückliches Aktualisieren kopieren den Zustand, während der
|
|||||||
Usage-Editor ihn danach unabhängig ändert. `piece_usages.status` bleibt davon
|
Usage-Editor ihn danach unabhängig ändert. `piece_usages.status` bleibt davon
|
||||||
getrennt und beschreibt weiterhin ausschließlich den Livezustand `open`,
|
getrennt und beschreibt weiterhin ausschließlich den Livezustand `open`,
|
||||||
`current`, `done` oder `skipped`.
|
`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.
|
||||||
|
|
||||||
|
## D-034: Nutzergebundener OAuth-Zugang statt Token-Passthrough
|
||||||
|
|
||||||
|
Der bestehende technische REST-Zugang kann und darf nicht für ChatGPT
|
||||||
|
weitergereicht werden: Sein Klartexttoken ist nach der Erstellung nicht mehr
|
||||||
|
verfügbar, und MCP verbietet Token-Passthrough. Sendewerk stellt deshalb einen
|
||||||
|
eigenen OAuth-2.1-Authorization-Code-Flow für öffentliche Clients bereit. PKCE
|
||||||
|
`S256`, exakte Redirect-URIs und der auf `<Origin>/mcp` gebundene
|
||||||
|
Ressourcenindikator sind verpflichtend. Codes und einstündige Zugriffstokens
|
||||||
|
liegen ausschließlich gehasht vor und sind direkt an ein aktives Nutzerkonto
|
||||||
|
gebunden.
|
||||||
|
|
||||||
|
Die Autorisierungsserver-Metadaten bieten das von OpenAI unterstützte Dynamic
|
||||||
|
Client Registration als Kompatibilitätsweg an. Die aktuelle MCP-Fassung stuft
|
||||||
|
DCR zugunsten von Client ID Metadata Documents als veraltet ein. Ein allgemeiner
|
||||||
|
CIMD-Abruf würde jedoch eine neue SSRF- und Cache-Sicherheitsgrenze eröffnen;
|
||||||
|
für diese private Anwendung bleibt DCR deshalb eng mengen- und ratenbegrenzt.
|
||||||
|
Der Zustimmungsdialog behandelt den selbst gemeldeten Clientnamen ausdrücklich
|
||||||
|
als unverifiziert und zeigt dessen Rücksprung-Domain.
|
||||||
|
|
||||||
|
Der MCP-Adapter unterstützt sowohl die aktuelle stateless Fassung `2026-07-28`
|
||||||
|
als auch die von OpenAI weiterhin dokumentierten Initialisierungsfassungen bis
|
||||||
|
`2025-03-26`. Tooldaten werden aus bestehenden Diensten positiv projiziert.
|
||||||
|
Der einzige Scope `sendewerk:read` ist im Dialog ausdrücklich einschließlich
|
||||||
|
privater redaktioneller Recherche beschrieben; E-Mail, Uploadnamen,
|
||||||
|
Speicherpfade und Werkzeug-Arbeitsdaten werden nicht ausgegeben. Alle Werkzeuge
|
||||||
|
sind als lesend markiert und haben keinen Pfad zu Mutationsdiensten.
|
||||||
|
|
||||||
|
Quellen, geprüft am 27. Oktober 2026:
|
||||||
|
|
||||||
|
- <https://developers.openai.com/apps-sdk/build/auth>
|
||||||
|
- <https://developers.openai.com/apps-sdk/deploy/connect-chatgpt>
|
||||||
|
- <https://platform.openai.com/docs/mcp>
|
||||||
|
- <https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization>
|
||||||
|
- <https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http>
|
||||||
|
- <https://modelcontextprotocol.io/specification/2026-07-28/basic/versioning>
|
||||||
|
- <https://modelcontextprotocol.io/specification/2026-07-28/server/discover>
|
||||||
|
- <https://modelcontextprotocol.io/specification/2026-07-28/server/tools>
|
||||||
@@ -1,5 +1,62 @@
|
|||||||
# Release Notes
|
# Release Notes
|
||||||
|
|
||||||
|
## 0.7.3 - Lesender MCP-Zugang mit OAuth 2.1
|
||||||
|
|
||||||
|
Veröffentlicht am 27. Oktober 2026
|
||||||
|
|
||||||
|
- Der öffentliche Streamable-HTTP-Endpunkt `/mcp` bietet fünf ausschließlich
|
||||||
|
lesende Werkzeuge für Kontoidentität, Pieces, Sendungen und vollständige
|
||||||
|
Abläufe. Er verwendet die bestehenden Inhalts- und Sendungsdienste und keine
|
||||||
|
parallele Datenhaltung.
|
||||||
|
- OAuth-2.1-Discovery, begrenzte dynamische Clientregistrierung,
|
||||||
|
Authorization Code, PKCE `S256`, exakte Redirect-URI und Ressourcenbindung
|
||||||
|
ermöglichen die von OpenAI dokumentierte Kontoverknüpfung. Codes und
|
||||||
|
einstündige Tokens werden nur gehasht gespeichert.
|
||||||
|
- Nutzerzustand, Sperren und Rollen werden bei jedem MCP-Aufruf erneut gelesen.
|
||||||
|
Passwortwechsel und Kontosperre widerrufen bestehende OAuth-Tokens. Der
|
||||||
|
vorhandene technische REST-Token wird weder offengelegt noch weitergereicht.
|
||||||
|
- MCP `2026-07-28` und die weiterhin von OpenAI verwendeten älteren
|
||||||
|
Initialisierungsfassungen werden am selben stateless Endpunkt unterstützt.
|
||||||
|
Private redaktionelle Details sind erst nach ausdrücklicher Zustimmung
|
||||||
|
lesbar; E-Mail, Uploadnamen, interne Pfade und Werkzeug-Arbeitsdaten bleiben
|
||||||
|
ausgeschlossen.
|
||||||
|
- Die Produktions-URL lautet `https://<Cloudron-App-Domain>/mcp`. README und
|
||||||
|
Betriebsdokumentation beschreiben die Einrichtung über **Add custom MCP
|
||||||
|
server**. Das Release wurde nicht auf Cloudron ausgerollt und eine reale
|
||||||
|
ChatGPT-Verbindung wird nicht als geprüft ausgegeben.
|
||||||
|
- Paket, Lockdatei und Cloudron-Manifest tragen Version `0.7.3`. Migration
|
||||||
|
`0020_oauth_mcp.sql` ergänzt additive OAuth- und Ratenbegrenzungstabellen.
|
||||||
|
- Typprüfung und Produktionsbuild sind erfolgreich. Ein isolierter lokaler
|
||||||
|
HTTP-Rundlauf hat OAuth, beide MCP-Protokollgenerationen und eine echte
|
||||||
|
`list_pieces`-Anfrage geprüft; eine reale ChatGPT-/Cloudron-Verbindung bleibt
|
||||||
|
ausdrücklich offen.
|
||||||
|
|
||||||
|
## 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
|
## 0.7.1 - Bedienung und Live-Korrekturen
|
||||||
|
|
||||||
Veröffentlicht am 25. Oktober 2026, Korrekturstand 26. Oktober 2026
|
Veröffentlicht am 25. Oktober 2026, Korrekturstand 26. Oktober 2026
|
||||||
|
|||||||
@@ -8,6 +8,56 @@ Live-Steuerung, Präsentationsausgabe, unveränderliche Sendungshistorie,
|
|||||||
Archiv, sichere Lesefreigaben, RSS-Import und technische REST-Zugänge sind
|
Archiv, sichere Lesefreigaben, RSS-Import und technische REST-Zugänge sind
|
||||||
dokumentiert.
|
dokumentiert.
|
||||||
|
|
||||||
|
## Lesender MCP-Zugang 0.7.3
|
||||||
|
|
||||||
|
- Der öffentliche Streamable-HTTP-Endpunkt `/mcp` liest Pieces, Sendungen und
|
||||||
|
Abläufe über dieselben Dienste wie Browser und REST-API. Fünf deklarierte
|
||||||
|
Werkzeuge besitzen nur Leseannotationen und keine Mutationspfade.
|
||||||
|
- OAuth 2.1 verwendet Discovery-Metadaten, begrenzte dynamische
|
||||||
|
Clientregistrierung, Authorization Code, PKCE `S256`, exakte Redirect-URIs
|
||||||
|
und Ressourcenbindung. Codes und einstündige Tokens liegen nur gehasht vor.
|
||||||
|
- OAuth-Tokens sind an den zustimmenden Nutzer gebunden. Sperrung und
|
||||||
|
Passwortwechsel widerrufen sie; jeder Zugriff prüft erneut Nutzerstatus,
|
||||||
|
Scope, Ablauf und Zielressource.
|
||||||
|
- Aktuelles MCP `2026-07-28` mit `server/discover` und per-Request-Metadaten
|
||||||
|
läuft neben den OpenAI-kompatiblen Initialisierungsfassungen. Ausgaben sind
|
||||||
|
Positivlisten ohne E-Mail, Uploadnamen, interne Pfade oder Werkzeug-Arbeitsdaten.
|
||||||
|
- Die konkrete Produktionsadresse ist
|
||||||
|
`https://<Cloudron-App-Domain>/mcp`. Ein Cloudron-Deployment und eine reale
|
||||||
|
ChatGPT-Verbindung wurden nicht durchgeführt.
|
||||||
|
|
||||||
|
Geprüft wurden Typen, Produktionsbuild und ein isolierter tatsächlicher
|
||||||
|
HTTP-Ablauf über eine temporäre Datenbank: anonymer OAuth-Challenge, DCR,
|
||||||
|
Zustimmung, PKCE-Tokenaustausch, Legacy-Initialisierung, aktuelle
|
||||||
|
`server/discover`-Abfrage, Toolliste und `list_pieces` mit Seed-Daten waren
|
||||||
|
erfolgreich. Eine weitere Verhaltenstest- oder Browsermatrix wurde gemäß
|
||||||
|
Auftrag nicht ausgeführt.
|
||||||
|
|
||||||
|
## 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
|
## Fehlerkorrekturen 0.7.1
|
||||||
|
|
||||||
- Explizite Abschnittsdauern werden während der Live-Regie nach Änderungen
|
- Explizite Abschnittsdauern werden während der Live-Regie nach Änderungen
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
CREATE TABLE oauth_clients (
|
||||||
|
id TEXT PRIMARY KEY,
|
||||||
|
name TEXT NOT NULL,
|
||||||
|
redirect_uris_json TEXT NOT NULL CHECK (json_valid(redirect_uris_json)),
|
||||||
|
created_at_utc TEXT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE oauth_authorization_codes (
|
||||||
|
code_hash TEXT PRIMARY KEY,
|
||||||
|
client_id TEXT NOT NULL REFERENCES oauth_clients(id) ON DELETE CASCADE,
|
||||||
|
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||||
|
redirect_uri TEXT NOT NULL,
|
||||||
|
scope TEXT NOT NULL,
|
||||||
|
resource TEXT NOT NULL,
|
||||||
|
code_challenge TEXT NOT NULL,
|
||||||
|
created_at_utc TEXT NOT NULL,
|
||||||
|
expires_at_utc TEXT NOT NULL,
|
||||||
|
consumed_at_utc TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX oauth_authorization_codes_expiry_idx
|
||||||
|
ON oauth_authorization_codes(expires_at_utc);
|
||||||
|
|
||||||
|
CREATE TABLE oauth_access_tokens (
|
||||||
|
token_hash TEXT PRIMARY KEY,
|
||||||
|
client_id TEXT NOT NULL REFERENCES oauth_clients(id) ON DELETE CASCADE,
|
||||||
|
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||||
|
scope TEXT NOT NULL,
|
||||||
|
resource TEXT NOT NULL,
|
||||||
|
created_at_utc TEXT NOT NULL,
|
||||||
|
expires_at_utc TEXT NOT NULL,
|
||||||
|
last_used_at_utc TEXT,
|
||||||
|
request_window_started_at_utc TEXT NOT NULL,
|
||||||
|
request_count INTEGER NOT NULL DEFAULT 0 CHECK (request_count >= 0),
|
||||||
|
revoked_at_utc TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX oauth_access_tokens_user_idx ON oauth_access_tokens(user_id);
|
||||||
|
CREATE INDEX oauth_access_tokens_expiry_idx ON oauth_access_tokens(expires_at_utc);
|
||||||
|
|
||||||
|
CREATE TABLE oauth_rate_limit_attempts (
|
||||||
|
id TEXT PRIMARY KEY,
|
||||||
|
kind TEXT NOT NULL CHECK (kind IN ('registration', 'token')),
|
||||||
|
address_hash TEXT NOT NULL,
|
||||||
|
attempted_at_utc TEXT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX oauth_rate_limit_attempts_lookup_idx
|
||||||
|
ON oauth_rate_limit_attempts(kind, address_hash, attempted_at_utc);
|
||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "sendewerk",
|
"name": "sendewerk",
|
||||||
"version": "0.7.1",
|
"version": "0.7.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "sendewerk",
|
"name": "sendewerk",
|
||||||
"version": "0.7.1",
|
"version": "0.7.3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@node-rs/argon2": "^2.2.2",
|
"@node-rs/argon2": "^2.2.2",
|
||||||
"better-sqlite3": "^13.0.3",
|
"better-sqlite3": "^13.0.3",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "sendewerk",
|
"name": "sendewerk",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.7.1",
|
"version": "0.7.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=22.17 <25"
|
"node": ">=22.17 <25"
|
||||||
|
|||||||
+487
-2
@@ -1575,16 +1575,58 @@ textarea:focus {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-timer-control {
|
.section-timer-control,
|
||||||
|
.total-timer-control {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
gap: 0.3rem;
|
gap: 0.3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-timer-control form {
|
.section-timer-control > form,
|
||||||
|
.total-timer-control > form {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.timer-reset-menu {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timer-reset-menu > summary {
|
||||||
|
display: grid;
|
||||||
|
width: 1.65rem;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 2rem;
|
||||||
|
place-items: center;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 0.6rem;
|
||||||
|
background: var(--panel-soft);
|
||||||
|
color: var(--text-muted);
|
||||||
|
cursor: pointer;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timer-reset-menu > summary::-webkit-details-marker {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timer-reset-menu > form {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 220;
|
||||||
|
top: calc(100% + 0.35rem);
|
||||||
|
right: 0;
|
||||||
|
width: max-content;
|
||||||
|
padding: 0.4rem;
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
border-radius: 0.65rem;
|
||||||
|
background: var(--glass-strong);
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
backdrop-filter: blur(18px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.timer-reset-menu > form button {
|
||||||
|
font-size: 0.65rem;
|
||||||
|
}
|
||||||
|
|
||||||
.live-timer-toggle {
|
.live-timer-toggle {
|
||||||
display: grid;
|
display: grid;
|
||||||
width: 2.15rem;
|
width: 2.15rem;
|
||||||
@@ -1797,6 +1839,118 @@ textarea:focus {
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.live-menu-show-heading {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-menu-show-heading > span:first-child {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-show-state {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
padding: 0.25rem 0.45rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: color-mix(in srgb, var(--success) 14%, var(--panel));
|
||||||
|
color: var(--success);
|
||||||
|
font-size: 0.58rem;
|
||||||
|
font-weight: 780;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-show-state.paused {
|
||||||
|
background: color-mix(in srgb, var(--warning) 14%, var(--panel));
|
||||||
|
color: var(--warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-menu-hint {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--text-faint);
|
||||||
|
font-size: 0.65rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-view-controls {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-view-controls .text-button,
|
||||||
|
.live-view-controls .theme-toggle {
|
||||||
|
min-height: 2.35rem;
|
||||||
|
font-size: 0.65rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-output-settings > summary {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) auto auto;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.45rem;
|
||||||
|
cursor: pointer;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-output-settings > summary::-webkit-details-marker {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-output-settings > summary > span {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-weight: 750;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-output-settings > summary > small {
|
||||||
|
color: var(--text-faint);
|
||||||
|
font-size: 0.58rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-output-settings > summary > .app-icon {
|
||||||
|
transition: transform 140ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-output-settings[open] > summary > .app-icon {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-output-settings-body {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.4rem;
|
||||||
|
margin-top: 0.55rem;
|
||||||
|
padding-top: 0.55rem;
|
||||||
|
border-top: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-output-settings-body p {
|
||||||
|
margin: 0 0 0.15rem;
|
||||||
|
color: var(--text-faint);
|
||||||
|
font-size: 0.62rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-menu-navigation {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.2rem;
|
||||||
|
padding: 0.7rem 0.6rem 0.55rem;
|
||||||
|
border-top: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-menu-navigation a {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-menu-navigation small {
|
||||||
|
color: var(--text-faint);
|
||||||
|
font-size: 0.58rem;
|
||||||
|
}
|
||||||
|
|
||||||
.live-menu-popover a {
|
.live-menu-popover a {
|
||||||
font-size: 0.72rem;
|
font-size: 0.72rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@@ -2851,6 +3005,23 @@ textarea:focus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 52rem) {
|
@media (max-width: 52rem) {
|
||||||
|
.rss-entry-list {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-selection-actions {
|
||||||
|
align-items: stretch;
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-selection-actions button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catalog-setting-row {
|
||||||
|
grid-template-columns: minmax(0, 1fr) auto;
|
||||||
|
}
|
||||||
|
|
||||||
.heinzlive-output {
|
.heinzlive-output {
|
||||||
padding: 1.2rem;
|
padding: 1.2rem;
|
||||||
}
|
}
|
||||||
@@ -3022,6 +3193,32 @@ textarea:focus {
|
|||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.oauth-consent {
|
||||||
|
margin: clamp(1.25rem, 6vw, 4rem) auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.oauth-permission {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.2rem;
|
||||||
|
margin: 1.25rem 0;
|
||||||
|
padding: 0.9rem;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius-medium);
|
||||||
|
background: var(--panel-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.oauth-permission span,
|
||||||
|
.oauth-redirect {
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.oauth-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
.auth-form,
|
.auth-form,
|
||||||
.compact-form {
|
.compact-form {
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -7393,6 +7590,7 @@ body:has(.heinzlive-output.empty),
|
|||||||
}
|
}
|
||||||
|
|
||||||
.management-dialog input:not([type='checkbox'], [type='hidden']),
|
.management-dialog input:not([type='checkbox'], [type='hidden']),
|
||||||
|
.management-dialog select,
|
||||||
.management-dialog textarea {
|
.management-dialog textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0.62rem 0.68rem;
|
padding: 0.62rem 0.68rem;
|
||||||
@@ -7524,6 +7722,293 @@ body:has(.heinzlive-output.empty),
|
|||||||
border-top: 1px solid var(--line);
|
border-top: 1px solid var(--line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.catalog-setting-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) auto;
|
||||||
|
align-items: stretch;
|
||||||
|
min-width: 0;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius-medium);
|
||||||
|
background: color-mix(in srgb, var(--panel-soft) 82%, transparent);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catalog-setting-row.inactive {
|
||||||
|
opacity: 0.68;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catalog-entry-main {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto minmax(0, 1fr) auto;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.65rem;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0.65rem;
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--text);
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.catalog-entry-main {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.catalog-entry-main:hover {
|
||||||
|
background: color-mix(in srgb, var(--gold) 7%, var(--panel-soft));
|
||||||
|
}
|
||||||
|
|
||||||
|
.catalog-entry-main > .app-icon {
|
||||||
|
color: var(--text-faint);
|
||||||
|
}
|
||||||
|
|
||||||
|
.catalog-entry-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0.35rem;
|
||||||
|
border-left: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.catalog-entry-actions form {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catalog-entry-actions button {
|
||||||
|
display: grid;
|
||||||
|
width: 2.15rem;
|
||||||
|
height: 2.15rem;
|
||||||
|
place-items: center;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0.55rem;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--text-muted);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catalog-entry-actions button:hover,
|
||||||
|
.catalog-entry-actions button:focus-visible {
|
||||||
|
background: var(--panel);
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-selection-dialog {
|
||||||
|
width: min(66rem, calc(100vw - 2rem));
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-selection-form {
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: minmax(0, 1fr) auto;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-selection-content {
|
||||||
|
display: grid;
|
||||||
|
min-height: 0;
|
||||||
|
align-content: start;
|
||||||
|
gap: 0.85rem;
|
||||||
|
padding: 1rem 1.1rem;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-source-filters {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.4rem;
|
||||||
|
padding-bottom: 0.25rem;
|
||||||
|
overflow-x: auto;
|
||||||
|
scrollbar-width: thin;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-source-filters button {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
padding: 0.48rem 0.72rem;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 999px;
|
||||||
|
background: var(--panel-soft);
|
||||||
|
color: var(--text-muted);
|
||||||
|
cursor: pointer;
|
||||||
|
font: inherit;
|
||||||
|
font-size: 0.68rem;
|
||||||
|
font-weight: 720;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-source-filters button.active {
|
||||||
|
border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
|
||||||
|
background: color-mix(in srgb, var(--accent) 14%, var(--panel));
|
||||||
|
color: var(--accent-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-result-summary,
|
||||||
|
.rss-pagination {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-result-summary {
|
||||||
|
color: var(--text-faint);
|
||||||
|
font-size: 0.68rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry-list {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 0.55rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry {
|
||||||
|
display: grid;
|
||||||
|
position: relative;
|
||||||
|
grid-template-columns: auto minmax(0, 1fr);
|
||||||
|
align-items: start;
|
||||||
|
gap: 0.7rem;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0.8rem;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius-medium);
|
||||||
|
background: color-mix(in srgb, var(--panel-soft) 90%, transparent);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry:hover {
|
||||||
|
border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry.selected {
|
||||||
|
border-color: color-mix(in srgb, var(--accent) 72%, var(--line));
|
||||||
|
background: color-mix(in srgb, var(--accent) 15%, var(--panel));
|
||||||
|
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme='light'] .rss-entry.selected {
|
||||||
|
background: color-mix(in srgb, var(--accent) 20%, #fff);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry:focus-visible {
|
||||||
|
outline: 3px solid var(--focus);
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry-state {
|
||||||
|
display: grid;
|
||||||
|
width: 1.8rem;
|
||||||
|
height: 1.8rem;
|
||||||
|
place-items: center;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--panel);
|
||||||
|
color: var(--text-faint);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry.selected .rss-entry-state {
|
||||||
|
border-color: var(--accent);
|
||||||
|
background: var(--accent);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry-copy,
|
||||||
|
.rss-entry-copy > * {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry-copy {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry-copy small {
|
||||||
|
color: var(--text-faint);
|
||||||
|
font-size: 0.62rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry-copy strong {
|
||||||
|
font-size: 0.78rem;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry-copy p {
|
||||||
|
display: -webkit-box;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-size: 0.68rem;
|
||||||
|
line-height: 1.45;
|
||||||
|
overflow: hidden;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry-copy a {
|
||||||
|
width: fit-content;
|
||||||
|
font-size: 0.65rem;
|
||||||
|
font-weight: 720;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-selected-label {
|
||||||
|
position: absolute;
|
||||||
|
top: 0.55rem;
|
||||||
|
right: 0.6rem;
|
||||||
|
padding: 0.2rem 0.42rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: var(--accent);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 0.55rem;
|
||||||
|
font-weight: 780;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-entry.selected .rss-entry-copy small {
|
||||||
|
padding-right: 4.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-pagination {
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 0.68rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-category-selection {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.25rem;
|
||||||
|
padding-top: 0.8rem;
|
||||||
|
border-top: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-category-selection > small {
|
||||||
|
color: var(--text-faint);
|
||||||
|
font-size: 0.62rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rss-selection-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.technical-token-result {
|
||||||
|
display: grid;
|
||||||
|
align-content: start;
|
||||||
|
gap: 0.8rem;
|
||||||
|
padding: 1rem 1.1rem;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.technical-token-result code {
|
||||||
|
padding: 0.8rem;
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
border-radius: var(--radius-small);
|
||||||
|
background: var(--panel-soft);
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
user-select: all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.technical-token-result .primary-button {
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-form-message {
|
||||||
|
margin: 1rem 1.1rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 52rem) {
|
@media (max-width: 52rem) {
|
||||||
.choice-picker-popover,
|
.choice-picker-popover,
|
||||||
.icon-picker-popover {
|
.icon-picker-popover {
|
||||||
|
|||||||
Vendored
+1
@@ -8,6 +8,7 @@ declare global {
|
|||||||
interface PageData {
|
interface PageData {
|
||||||
user?: AuthUser | null;
|
user?: AuthUser | null;
|
||||||
presentationMode?: boolean;
|
presentationMode?: boolean;
|
||||||
|
oauthMode?: boolean;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-1
@@ -20,6 +20,10 @@ export const handle: Handle = async ({ event, resolve }) => {
|
|||||||
const sharePath = event.url.pathname.startsWith('/freigabe/');
|
const sharePath = event.url.pathname.startsWith('/freigabe/');
|
||||||
const shareMediaPath = /^\/freigabe\/[^/]+\/media\/[^/]+$/.test(event.url.pathname);
|
const shareMediaPath = /^\/freigabe\/[^/]+\/media\/[^/]+$/.test(event.url.pathname);
|
||||||
const apiPath = event.url.pathname.startsWith('/api/v1/');
|
const apiPath = event.url.pathname.startsWith('/api/v1/');
|
||||||
|
const oauthPath =
|
||||||
|
event.url.pathname.startsWith('/oauth/') ||
|
||||||
|
event.url.pathname.startsWith('/.well-known/oauth-');
|
||||||
|
const mcpPath = event.url.pathname === '/mcp';
|
||||||
const presentationTestPath = /^\/fundus\/[^/]+\/praesentation(?:\/|$)/.test(event.url.pathname);
|
const presentationTestPath = /^\/fundus\/[^/]+\/praesentation(?:\/|$)/.test(event.url.pathname);
|
||||||
const token = event.cookies.get(SESSION_COOKIE);
|
const token = event.cookies.get(SESSION_COOKIE);
|
||||||
event.locals.user = getSessionUser(token);
|
event.locals.user = getSessionUser(token);
|
||||||
@@ -30,6 +34,8 @@ export const handle: Handle = async ({ event, resolve }) => {
|
|||||||
!sharePath &&
|
!sharePath &&
|
||||||
!publicPaths.has(event.url.pathname) &&
|
!publicPaths.has(event.url.pathname) &&
|
||||||
!apiPath &&
|
!apiPath &&
|
||||||
|
!oauthPath &&
|
||||||
|
!mcpPath &&
|
||||||
!event.locals.user
|
!event.locals.user
|
||||||
) {
|
) {
|
||||||
redirect(303, hasUsers() ? '/login' : '/setup');
|
redirect(303, hasUsers() ? '/login' : '/setup');
|
||||||
@@ -66,7 +72,12 @@ export const handle: Handle = async ({ event, resolve }) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.url.pathname === '/einladung' || event.url.pathname === '/passwort-zuruecksetzen') {
|
if (
|
||||||
|
event.url.pathname === '/einladung' ||
|
||||||
|
event.url.pathname === '/passwort-zuruecksetzen' ||
|
||||||
|
oauthPath ||
|
||||||
|
mcpPath
|
||||||
|
) {
|
||||||
response.headers.set('Cache-Control', 'no-store');
|
response.headers.set('Cache-Control', 'no-store');
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
@@ -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,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,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>
|
||||||
+15
-1
@@ -564,7 +564,13 @@ export async function resetPassword(token: string, password: string): Promise<vo
|
|||||||
'UPDATE password_reset_tokens SET consumed_at_utc = ? WHERE user_id = ? AND consumed_at_utc IS NULL'
|
'UPDATE password_reset_tokens SET consumed_at_utc = ? WHERE user_id = ? AND consumed_at_utc IS NULL'
|
||||||
)
|
)
|
||||||
.run(timestamp, row.user_id);
|
.run(timestamp, row.user_id);
|
||||||
|
database.prepare('DELETE FROM oauth_authorization_codes WHERE user_id = ?').run(row.user_id);
|
||||||
database.prepare('DELETE FROM sessions WHERE user_id = ?').run(row.user_id);
|
database.prepare('DELETE FROM sessions WHERE user_id = ?').run(row.user_id);
|
||||||
|
database
|
||||||
|
.prepare(
|
||||||
|
'UPDATE oauth_access_tokens SET revoked_at_utc = ? WHERE user_id = ? AND revoked_at_utc IS NULL'
|
||||||
|
)
|
||||||
|
.run(timestamp, row.user_id);
|
||||||
});
|
});
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
@@ -592,7 +598,15 @@ export function setUserLocked(actor: AuthUser, userId: string, locked: boolean):
|
|||||||
database
|
database
|
||||||
.prepare('UPDATE users SET locked_at_utc = ?, updated_at_utc = ? WHERE id = ?')
|
.prepare('UPDATE users SET locked_at_utc = ?, updated_at_utc = ? WHERE id = ?')
|
||||||
.run(locked ? nowUtc() : null, nowUtc(), userId);
|
.run(locked ? nowUtc() : null, nowUtc(), userId);
|
||||||
if (locked) database.prepare('DELETE FROM sessions WHERE user_id = ?').run(userId);
|
if (locked) {
|
||||||
|
database.prepare('DELETE FROM sessions WHERE user_id = ?').run(userId);
|
||||||
|
database
|
||||||
|
.prepare(
|
||||||
|
'UPDATE oauth_access_tokens SET revoked_at_utc = ? WHERE user_id = ? AND revoked_at_utc IS NULL'
|
||||||
|
)
|
||||||
|
.run(nowUtc(), userId);
|
||||||
|
database.prepare('DELETE FROM oauth_authorization_codes WHERE user_id = ?').run(userId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ export function getAuthConfig() {
|
|||||||
throw new Error('SENDEWERK_APP_ORIGIN muss im Produktionsbetrieb gesetzt sein.');
|
throw new Error('SENDEWERK_APP_ORIGIN muss im Produktionsbetrieb gesetzt sein.');
|
||||||
}
|
}
|
||||||
const origin = new URL(configuredOrigin || 'http://localhost:5173');
|
const origin = new URL(configuredOrigin || 'http://localhost:5173');
|
||||||
|
const loopback = ['localhost', '127.0.0.1', '[::1]'].includes(origin.hostname);
|
||||||
|
if (process.env.NODE_ENV === 'production' && origin.protocol !== 'https:' && !loopback) {
|
||||||
|
throw new Error('SENDEWERK_APP_ORIGIN muss öffentlich HTTPS verwenden.');
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
origin,
|
origin,
|
||||||
setupToken: process.env.SENDEWERK_SETUP_TOKEN || '',
|
setupToken: process.env.SENDEWERK_SETUP_TOKEN || '',
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ describe('database setup', () => {
|
|||||||
database.close();
|
database.close();
|
||||||
|
|
||||||
expect(counts).toEqual({
|
expect(counts).toEqual({
|
||||||
migrations: 19,
|
migrations: 20,
|
||||||
pieces: 6,
|
pieces: 6,
|
||||||
shows: 2,
|
shows: 2,
|
||||||
usages: 5,
|
usages: 5,
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ import { closeDatabase, getDatabase } from './database.js';
|
|||||||
import {
|
import {
|
||||||
completeCurrent,
|
completeCurrent,
|
||||||
clearPresentationChannel,
|
clearPresentationChannel,
|
||||||
getPresentationChannelView,
|
|
||||||
getLiveView,
|
getLiveView,
|
||||||
|
getPresentationChannelStatus,
|
||||||
|
getPresentationChannelView,
|
||||||
getPresentationMedia,
|
getPresentationMedia,
|
||||||
getPresentationView,
|
getPresentationView,
|
||||||
goBack,
|
goBack,
|
||||||
@@ -159,7 +160,9 @@ describe('live mode', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('keeps one stable output channel until its key is explicitly rotated', () => {
|
it('keeps one stable output channel until its key is explicitly rotated', () => {
|
||||||
|
expect(getPresentationChannelStatus('show-october')).toBe('disconnected');
|
||||||
const key = issuePresentationAccess('show-october');
|
const key = issuePresentationAccess('show-october');
|
||||||
|
expect(getPresentationChannelStatus('show-october')).toBe('connected');
|
||||||
expect(issuePresentationAccess('show-october')).toBe(key);
|
expect(issuePresentationAccess('show-october')).toBe(key);
|
||||||
expect(presentationChannelAccess('default', key)).toBe(true);
|
expect(presentationChannelAccess('default', key)).toBe(true);
|
||||||
expect(getPresentationChannelView('default')).toEqual({
|
expect(getPresentationChannelView('default')).toEqual({
|
||||||
@@ -175,6 +178,7 @@ describe('live mode', () => {
|
|||||||
presentUsage('show-october', 'usage-console', 'present-channel', 1);
|
presentUsage('show-october', 'usage-console', 'present-channel', 1);
|
||||||
expect(getPresentationChannelView('default')?.content).not.toBeNull();
|
expect(getPresentationChannelView('default')?.content).not.toBeNull();
|
||||||
clearPresentationChannel();
|
clearPresentationChannel();
|
||||||
|
expect(getPresentationChannelStatus('show-october')).toBe('disconnected');
|
||||||
expect(getPresentationChannelView('default')?.content).toBeNull();
|
expect(getPresentationChannelView('default')?.content).toBeNull();
|
||||||
issuePresentationAccess('show-october');
|
issuePresentationAccess('show-october');
|
||||||
expect(getPresentationChannelView('default')?.content).toBeNull();
|
expect(getPresentationChannelView('default')?.content).toBeNull();
|
||||||
|
|||||||
@@ -1158,6 +1158,14 @@ export function presentationChannelAccess(channelId: string, accessKey: string)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getPresentationChannelStatus(showId: string) {
|
||||||
|
const channel = getDatabase()
|
||||||
|
.prepare("SELECT show_id FROM presentation_channels WHERE id = 'default'")
|
||||||
|
.get() as { show_id: string | null } | undefined;
|
||||||
|
if (!channel?.show_id) return 'disconnected' as const;
|
||||||
|
return channel.show_id === showId ? ('connected' as const) : ('other_show' as const);
|
||||||
|
}
|
||||||
|
|
||||||
function presentationShowId(database: Database.Database, token: string) {
|
function presentationShowId(database: Database.Database, token: string) {
|
||||||
if (!token || token.length > 200) return null;
|
if (!token || token.length > 200) return null;
|
||||||
const channel = database
|
const channel = database
|
||||||
|
|||||||
@@ -0,0 +1,431 @@
|
|||||||
|
import type { AuthUser } from './auth.js';
|
||||||
|
import { PIECE_STATUSES, getPiece, listPieces, type PieceStatus } from './content.js';
|
||||||
|
import { SHOW_STATUSES, getShow, listShows, type ShowStatus } from './shows.js';
|
||||||
|
import { MCP_SCOPE } from './oauth.js';
|
||||||
|
|
||||||
|
const MAX_PAGE_SIZE = 100;
|
||||||
|
|
||||||
|
type JsonRpcId = string | number | null;
|
||||||
|
type JsonRpcRequest = {
|
||||||
|
jsonrpc: '2.0';
|
||||||
|
id?: JsonRpcId;
|
||||||
|
method: string;
|
||||||
|
params?: Record<string, unknown>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const oauthSecurity = [{ type: 'oauth2', scopes: [MCP_SCOPE] }];
|
||||||
|
const readOnlyAnnotations = {
|
||||||
|
readOnlyHint: true,
|
||||||
|
destructiveHint: false,
|
||||||
|
idempotentHint: true,
|
||||||
|
openWorldHint: false
|
||||||
|
};
|
||||||
|
|
||||||
|
const profileOutputSchema = {
|
||||||
|
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
id: { type: 'string', minLength: 1, pattern: '\\S' },
|
||||||
|
name: { type: 'string' },
|
||||||
|
email: { type: 'string' },
|
||||||
|
nickname: { type: 'string' }
|
||||||
|
},
|
||||||
|
required: ['id'],
|
||||||
|
additionalProperties: false
|
||||||
|
};
|
||||||
|
|
||||||
|
const paginationSchema = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
limit: { type: 'integer' },
|
||||||
|
offset: { type: 'integer' },
|
||||||
|
total: { type: 'integer' }
|
||||||
|
},
|
||||||
|
required: ['limit', 'offset', 'total'],
|
||||||
|
additionalProperties: false
|
||||||
|
};
|
||||||
|
|
||||||
|
const tools = [
|
||||||
|
{
|
||||||
|
name: 'get_profile',
|
||||||
|
title: 'Sendewerk-Profil',
|
||||||
|
description: 'Gibt das mit dieser Verbindung verknüpfte Sendewerk-Konto zurück.',
|
||||||
|
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
||||||
|
outputSchema: profileOutputSchema,
|
||||||
|
annotations: readOnlyAnnotations,
|
||||||
|
securitySchemes: oauthSecurity,
|
||||||
|
_meta: { 'openai/profile': true, securitySchemes: oauthSecurity }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'list_pieces',
|
||||||
|
title: 'Pieces durchsuchen',
|
||||||
|
description: 'Listet und durchsucht redaktionelle Pieces im Sendewerk-Fundus.',
|
||||||
|
inputSchema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
query: { type: 'string', maxLength: 200 },
|
||||||
|
statuses: {
|
||||||
|
type: 'array',
|
||||||
|
items: { type: 'string', enum: PIECE_STATUSES },
|
||||||
|
uniqueItems: true
|
||||||
|
},
|
||||||
|
limit: { type: 'integer', minimum: 1, maximum: MAX_PAGE_SIZE, default: 20 },
|
||||||
|
offset: { type: 'integer', minimum: 0, default: 0 }
|
||||||
|
},
|
||||||
|
additionalProperties: false
|
||||||
|
},
|
||||||
|
outputSchema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
pieces: { type: 'array', items: { type: 'object' } },
|
||||||
|
pagination: paginationSchema
|
||||||
|
},
|
||||||
|
required: ['pieces', 'pagination'],
|
||||||
|
additionalProperties: false
|
||||||
|
},
|
||||||
|
annotations: readOnlyAnnotations,
|
||||||
|
securitySchemes: oauthSecurity,
|
||||||
|
_meta: { securitySchemes: oauthSecurity }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'get_piece',
|
||||||
|
title: 'Piece lesen',
|
||||||
|
description: 'Liest die redaktionellen Texte und Quellen eines einzelnen Pieces.',
|
||||||
|
inputSchema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: { id: { type: 'string', minLength: 1, maxLength: 100 } },
|
||||||
|
required: ['id'],
|
||||||
|
additionalProperties: false
|
||||||
|
},
|
||||||
|
outputSchema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: { id: { type: 'string' }, title: { type: 'string' } },
|
||||||
|
required: ['id', 'title']
|
||||||
|
},
|
||||||
|
annotations: readOnlyAnnotations,
|
||||||
|
securitySchemes: oauthSecurity,
|
||||||
|
_meta: { securitySchemes: oauthSecurity }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'list_shows',
|
||||||
|
title: 'Sendungen auflisten',
|
||||||
|
description: 'Listet Sendungen mit Status, Termin, Dauer und Abschnittszahl.',
|
||||||
|
inputSchema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
statuses: {
|
||||||
|
type: 'array',
|
||||||
|
items: { type: 'string', enum: SHOW_STATUSES },
|
||||||
|
uniqueItems: true
|
||||||
|
},
|
||||||
|
limit: { type: 'integer', minimum: 1, maximum: MAX_PAGE_SIZE, default: 20 },
|
||||||
|
offset: { type: 'integer', minimum: 0, default: 0 }
|
||||||
|
},
|
||||||
|
additionalProperties: false
|
||||||
|
},
|
||||||
|
outputSchema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
shows: { type: 'array', items: { type: 'object' } },
|
||||||
|
pagination: paginationSchema
|
||||||
|
},
|
||||||
|
required: ['shows', 'pagination'],
|
||||||
|
additionalProperties: false
|
||||||
|
},
|
||||||
|
annotations: readOnlyAnnotations,
|
||||||
|
securitySchemes: oauthSecurity,
|
||||||
|
_meta: { securitySchemes: oauthSecurity }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'get_show_rundown',
|
||||||
|
title: 'Sendungsablauf lesen',
|
||||||
|
description: 'Liest Metadaten, Abschnitte, eingeplante Pieces und Reserve einer Sendung.',
|
||||||
|
inputSchema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: { id: { type: 'string', minLength: 1, maxLength: 100 } },
|
||||||
|
required: ['id'],
|
||||||
|
additionalProperties: false
|
||||||
|
},
|
||||||
|
outputSchema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
id: { type: 'string' },
|
||||||
|
title: { type: 'string' },
|
||||||
|
sections: { type: 'array', items: { type: 'object' } },
|
||||||
|
reserve: { type: 'array', items: { type: 'object' } }
|
||||||
|
},
|
||||||
|
required: ['id', 'title', 'sections', 'reserve']
|
||||||
|
},
|
||||||
|
annotations: readOnlyAnnotations,
|
||||||
|
securitySchemes: oauthSecurity,
|
||||||
|
_meta: { securitySchemes: oauthSecurity }
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
function isObject(value: unknown): value is Record<string, unknown> {
|
||||||
|
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function integer(
|
||||||
|
value: unknown,
|
||||||
|
fallback: number,
|
||||||
|
minimum: number,
|
||||||
|
maximum = Number.MAX_SAFE_INTEGER
|
||||||
|
) {
|
||||||
|
if (value === undefined) return fallback;
|
||||||
|
if (!Number.isInteger(value) || Number(value) < minimum || Number(value) > maximum) {
|
||||||
|
throw new Error('INVALID_ARGUMENTS');
|
||||||
|
}
|
||||||
|
return Number(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function stringArgument(value: unknown, maximum: number, required = false): string {
|
||||||
|
if (value === undefined && !required) return '';
|
||||||
|
if (typeof value !== 'string' || (required && !value) || value.length > maximum) {
|
||||||
|
throw new Error('INVALID_ARGUMENTS');
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function enumArray<T extends string>(value: unknown, allowed: readonly T[], fallback: T[]): T[] {
|
||||||
|
if (value === undefined) return fallback;
|
||||||
|
if (!Array.isArray(value) || value.some((item) => !allowed.includes(item as T))) {
|
||||||
|
throw new Error('INVALID_ARGUMENTS');
|
||||||
|
}
|
||||||
|
return [...new Set(value as T[])];
|
||||||
|
}
|
||||||
|
|
||||||
|
function exactKeys(input: Record<string, unknown>, allowed: string[]): void {
|
||||||
|
if (Object.keys(input).some((key) => !allowed.includes(key)))
|
||||||
|
throw new Error('INVALID_ARGUMENTS');
|
||||||
|
}
|
||||||
|
|
||||||
|
function toolResult(value: unknown) {
|
||||||
|
return {
|
||||||
|
content: [{ type: 'text', text: JSON.stringify(value) }],
|
||||||
|
structuredContent: value,
|
||||||
|
isError: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function toolError(message: string) {
|
||||||
|
return { content: [{ type: 'text', text: message }], isError: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
function projectPieceUsage(
|
||||||
|
usage: NonNullable<ReturnType<typeof getShow>>['sections'][number]['usages'][number]
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
id: usage.id,
|
||||||
|
originalPieceId: usage.originalPieceId,
|
||||||
|
position: usage.position,
|
||||||
|
status: usage.status,
|
||||||
|
preparationStatus: usage.preparationStatus,
|
||||||
|
preparationEffort: usage.preparationEffort,
|
||||||
|
durationSeconds: usage.durationSeconds,
|
||||||
|
title: usage.title,
|
||||||
|
outputTitle: usage.outputTitle,
|
||||||
|
intro: usage.intro,
|
||||||
|
research: usage.research,
|
||||||
|
moderation: usage.moderation,
|
||||||
|
interaction: usage.interaction,
|
||||||
|
transition: usage.transition,
|
||||||
|
presentation: usage.presentation,
|
||||||
|
ownNotes: usage.ownNotes,
|
||||||
|
sources: usage.sources.map(({ label, url, timecodeSeconds }) => ({
|
||||||
|
label,
|
||||||
|
url,
|
||||||
|
timecodeSeconds
|
||||||
|
})),
|
||||||
|
topics: usage.topics.map(({ name }) => name)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function callTool(name: string, input: unknown, user: AuthUser) {
|
||||||
|
if (!isObject(input)) throw new Error('INVALID_ARGUMENTS');
|
||||||
|
switch (name) {
|
||||||
|
case 'get_profile': {
|
||||||
|
exactKeys(input, []);
|
||||||
|
const profile = { id: user.id, name: user.displayName };
|
||||||
|
return {
|
||||||
|
content: [{ type: 'text', text: JSON.stringify(profile) }],
|
||||||
|
structuredContent: profile,
|
||||||
|
isError: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
case 'list_pieces': {
|
||||||
|
exactKeys(input, ['query', 'statuses', 'limit', 'offset']);
|
||||||
|
const statuses = enumArray<PieceStatus>(input.statuses, PIECE_STATUSES, [
|
||||||
|
'inbox',
|
||||||
|
'preparing',
|
||||||
|
'ready'
|
||||||
|
]);
|
||||||
|
const query = stringArgument(input.query, 200);
|
||||||
|
const limit = integer(input.limit, 20, 1, MAX_PAGE_SIZE);
|
||||||
|
const offset = integer(input.offset, 0, 0);
|
||||||
|
const all = listPieces({ statuses, query });
|
||||||
|
return toolResult({
|
||||||
|
pieces: all
|
||||||
|
.slice(offset, offset + limit)
|
||||||
|
.map(({ mediaId: _mediaId, formatId: _formatId, ...piece }) => piece),
|
||||||
|
pagination: { limit, offset, total: all.length }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
case 'get_piece': {
|
||||||
|
exactKeys(input, ['id']);
|
||||||
|
const id = stringArgument(input.id, 100, true);
|
||||||
|
const piece = getPiece(id);
|
||||||
|
if (!piece) return toolError('Piece nicht gefunden.');
|
||||||
|
const listEntry = listPieces({ statuses: [...PIECE_STATUSES] }).find(
|
||||||
|
(entry) => entry.id === id
|
||||||
|
);
|
||||||
|
return toolResult({
|
||||||
|
id: piece.id,
|
||||||
|
title: piece.title,
|
||||||
|
outputTitle: piece.outputTitle,
|
||||||
|
summary: piece.summary,
|
||||||
|
status: piece.status,
|
||||||
|
preparationEffort: piece.preparationEffort,
|
||||||
|
durationSeconds: piece.durationSeconds,
|
||||||
|
format: listEntry?.format ?? '',
|
||||||
|
categories: listEntry?.categories.map(({ name }) => name) ?? [],
|
||||||
|
topics: listEntry?.topics.map(({ name }) => name) ?? [],
|
||||||
|
intro: piece.intro,
|
||||||
|
research: piece.researchText,
|
||||||
|
moderation: piece.moderationNotes,
|
||||||
|
interaction: piece.interactionText,
|
||||||
|
transition: piece.transitionText,
|
||||||
|
presentation: piece.presentationText,
|
||||||
|
sources: piece.sources,
|
||||||
|
createdAtUtc: piece.createdAtUtc,
|
||||||
|
updatedAtUtc: piece.updatedAtUtc
|
||||||
|
});
|
||||||
|
}
|
||||||
|
case 'list_shows': {
|
||||||
|
exactKeys(input, ['statuses', 'limit', 'offset']);
|
||||||
|
const statuses = enumArray<ShowStatus>(input.statuses, SHOW_STATUSES, [...SHOW_STATUSES]);
|
||||||
|
const limit = integer(input.limit, 20, 1, MAX_PAGE_SIZE);
|
||||||
|
const offset = integer(input.offset, 0, 0);
|
||||||
|
const all = listShows(statuses);
|
||||||
|
return toolResult({
|
||||||
|
shows: all.slice(offset, offset + limit),
|
||||||
|
pagination: { limit, offset, total: all.length }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
case 'get_show_rundown': {
|
||||||
|
exactKeys(input, ['id']);
|
||||||
|
const show = getShow(stringArgument(input.id, 100, true));
|
||||||
|
if (!show) return toolError('Sendung nicht gefunden.');
|
||||||
|
return toolResult({
|
||||||
|
id: show.id,
|
||||||
|
title: show.title,
|
||||||
|
startsAtUtc: show.startsAtUtc,
|
||||||
|
twitchTitle: show.twitchTitle,
|
||||||
|
announcementText: show.announcementText,
|
||||||
|
status: show.status,
|
||||||
|
totalDurationSeconds: show.totalDurationSeconds,
|
||||||
|
sections: show.sections.map((section) => ({
|
||||||
|
id: section.id,
|
||||||
|
name: section.name,
|
||||||
|
category: section.category,
|
||||||
|
position: section.position,
|
||||||
|
explicitDurationSeconds: section.explicitDurationSeconds,
|
||||||
|
durationSeconds: section.durationSeconds,
|
||||||
|
twitchTags: section.twitchTags,
|
||||||
|
pieces: section.usages.map(projectPieceUsage)
|
||||||
|
})),
|
||||||
|
reserve: show.reserve.map(projectPieceUsage),
|
||||||
|
createdAtUtc: show.createdAtUtc,
|
||||||
|
updatedAtUtc: show.updatedAtUtc,
|
||||||
|
completedAtUtc: show.completedAtUtc
|
||||||
|
});
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
throw new Error('UNKNOWN_TOOL');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function validJsonRpcRequest(value: unknown): value is JsonRpcRequest {
|
||||||
|
if (!isObject(value) || value.jsonrpc !== '2.0' || typeof value.method !== 'string') return false;
|
||||||
|
if (
|
||||||
|
'id' in value &&
|
||||||
|
value.id !== null &&
|
||||||
|
typeof value.id !== 'string' &&
|
||||||
|
typeof value.id !== 'number'
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return value.params === undefined || isObject(value.params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function handleMcpRequest(request: JsonRpcRequest, user: AuthUser) {
|
||||||
|
const id = request.id ?? null;
|
||||||
|
try {
|
||||||
|
switch (request.method) {
|
||||||
|
case 'server/discover':
|
||||||
|
return {
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
id,
|
||||||
|
result: {
|
||||||
|
resultType: 'complete',
|
||||||
|
supportedVersions: ['2026-07-28', '2025-11-25', '2025-06-18', '2025-03-26'],
|
||||||
|
capabilities: { tools: { listChanged: false } },
|
||||||
|
_meta: {
|
||||||
|
'io.modelcontextprotocol/serverInfo': { name: 'Sendewerk', version: '0.7.3' }
|
||||||
|
},
|
||||||
|
instructions: 'Lesezugriff auf Pieces, Sendungen und redaktionelle Abläufe.',
|
||||||
|
ttlMs: 3_600_000,
|
||||||
|
cacheScope: 'private'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
case 'initialize': {
|
||||||
|
const requestedVersion = request.params?.protocolVersion;
|
||||||
|
const supported = ['2025-11-25', '2025-06-18', '2025-03-26'];
|
||||||
|
const protocolVersion =
|
||||||
|
typeof requestedVersion === 'string' && supported.includes(requestedVersion)
|
||||||
|
? requestedVersion
|
||||||
|
: supported[0];
|
||||||
|
return {
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
id,
|
||||||
|
result: {
|
||||||
|
protocolVersion,
|
||||||
|
capabilities: { tools: { listChanged: false } },
|
||||||
|
serverInfo: { name: 'Sendewerk', version: '0.7.3' },
|
||||||
|
instructions: 'Lesezugriff auf Pieces, Sendungen und redaktionelle Abläufe.'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
case 'ping':
|
||||||
|
return { jsonrpc: '2.0', id, result: { resultType: 'complete' } };
|
||||||
|
case 'tools/list':
|
||||||
|
return { jsonrpc: '2.0', id, result: { resultType: 'complete', tools } };
|
||||||
|
case 'tools/call': {
|
||||||
|
const name = request.params?.name;
|
||||||
|
if (typeof name !== 'string') throw new Error('INVALID_ARGUMENTS');
|
||||||
|
return {
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
id,
|
||||||
|
result: {
|
||||||
|
resultType: 'complete',
|
||||||
|
...callTool(name, request.params?.arguments ?? {}, user)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return { jsonrpc: '2.0', id, error: { code: -32601, message: 'Method not found' } };
|
||||||
|
}
|
||||||
|
} catch (cause) {
|
||||||
|
const message = cause instanceof Error ? cause.message : '';
|
||||||
|
return {
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
id,
|
||||||
|
error:
|
||||||
|
message === 'INVALID_ARGUMENTS'
|
||||||
|
? { code: -32602, message: 'Invalid params' }
|
||||||
|
: message === 'UNKNOWN_TOOL'
|
||||||
|
? { code: -32602, message: 'Unknown tool' }
|
||||||
|
: { code: -32603, message: 'Internal error' }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,425 @@
|
|||||||
|
import { createHash, randomBytes, randomUUID } from 'node:crypto';
|
||||||
|
import type { AuthUser } from './auth.js';
|
||||||
|
import { getAuthConfig } from './config.js';
|
||||||
|
import { getDatabase } from './database.js';
|
||||||
|
|
||||||
|
export const MCP_SCOPE = 'sendewerk:read';
|
||||||
|
const AUTHORIZATION_CODE_DURATION_MS = 5 * 60 * 1000;
|
||||||
|
const ACCESS_TOKEN_DURATION_SECONDS = 60 * 60;
|
||||||
|
const MAX_REGISTERED_CLIENTS = 1000;
|
||||||
|
const MCP_REQUEST_LIMIT_PER_HOUR = 600;
|
||||||
|
|
||||||
|
type OAuthClientRow = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
redirect_uris_json: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type AuthorizationCodeRow = {
|
||||||
|
client_id: string;
|
||||||
|
user_id: string;
|
||||||
|
redirect_uri: string;
|
||||||
|
scope: string;
|
||||||
|
resource: string;
|
||||||
|
code_challenge: string;
|
||||||
|
expires_at_utc: string;
|
||||||
|
consumed_at_utc: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type OAuthClient = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
redirectUris: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type OAuthAuthorizationRequest = {
|
||||||
|
client: OAuthClient;
|
||||||
|
redirectUri: string;
|
||||||
|
state: string;
|
||||||
|
scope: typeof MCP_SCOPE;
|
||||||
|
resource: string;
|
||||||
|
codeChallenge: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class OAuthError extends Error {
|
||||||
|
constructor(
|
||||||
|
public code: string,
|
||||||
|
message: string,
|
||||||
|
public status = 400
|
||||||
|
) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function nowUtc(): string {
|
||||||
|
return new Date().toISOString();
|
||||||
|
}
|
||||||
|
|
||||||
|
function futureUtc(durationMs: number): string {
|
||||||
|
return new Date(Date.now() + durationMs).toISOString();
|
||||||
|
}
|
||||||
|
|
||||||
|
function tokenHash(token: string): string {
|
||||||
|
return createHash('sha256').update(token).digest('hex');
|
||||||
|
}
|
||||||
|
|
||||||
|
function randomToken(): string {
|
||||||
|
return randomBytes(32).toString('base64url');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function oauthIssuer(): string {
|
||||||
|
return getAuthConfig().origin.origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mcpResource(): string {
|
||||||
|
return new URL('/mcp', getAuthConfig().origin).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function protectedResourceMetadataUrl(): string {
|
||||||
|
return new URL('/.well-known/oauth-protected-resource/mcp', getAuthConfig().origin).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
function validRedirectUri(value: string): boolean {
|
||||||
|
try {
|
||||||
|
const url = new URL(value);
|
||||||
|
if (url.hash || url.username || url.password) return false;
|
||||||
|
if (url.protocol === 'https:') return true;
|
||||||
|
return (
|
||||||
|
url.protocol === 'http:' &&
|
||||||
|
(url.hostname === 'localhost' || url.hostname === '127.0.0.1' || url.hostname === '[::1]')
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clientFromRow(row: OAuthClientRow): OAuthClient {
|
||||||
|
return { id: row.id, name: row.name, redirectUris: JSON.parse(row.redirect_uris_json) };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function registerOAuthClient(input: unknown): OAuthClient {
|
||||||
|
if (!input || typeof input !== 'object' || Array.isArray(input)) {
|
||||||
|
throw new OAuthError('invalid_client_metadata', 'Client-Metadaten fehlen.');
|
||||||
|
}
|
||||||
|
const metadata = input as Record<string, unknown>;
|
||||||
|
const name = typeof metadata.client_name === 'string' ? metadata.client_name.trim() : '';
|
||||||
|
const redirectUris = Array.isArray(metadata.redirect_uris)
|
||||||
|
? [...new Set(metadata.redirect_uris.filter((uri): uri is string => typeof uri === 'string'))]
|
||||||
|
: [];
|
||||||
|
if (
|
||||||
|
!name ||
|
||||||
|
name.length > 120 ||
|
||||||
|
/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u.test(name) ||
|
||||||
|
!redirectUris.length ||
|
||||||
|
redirectUris.length > 10
|
||||||
|
) {
|
||||||
|
throw new OAuthError('invalid_client_metadata', 'Name und Redirect-URIs sind erforderlich.');
|
||||||
|
}
|
||||||
|
if (redirectUris.some((uri) => uri.length > 1000 || !validRedirectUri(uri))) {
|
||||||
|
throw new OAuthError(
|
||||||
|
'invalid_redirect_uri',
|
||||||
|
'Redirect-URIs müssen HTTPS oder lokale HTTP-Adressen sein.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
metadata.token_endpoint_auth_method !== undefined &&
|
||||||
|
metadata.token_endpoint_auth_method !== 'none'
|
||||||
|
) {
|
||||||
|
throw new OAuthError(
|
||||||
|
'invalid_client_metadata',
|
||||||
|
'Nur öffentliche PKCE-Clients werden unterstützt.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
(Array.isArray(metadata.grant_types) && !metadata.grant_types.includes('authorization_code')) ||
|
||||||
|
(Array.isArray(metadata.response_types) && !metadata.response_types.includes('code'))
|
||||||
|
) {
|
||||||
|
throw new OAuthError('invalid_client_metadata', 'Nur Authorization Code wird unterstützt.');
|
||||||
|
}
|
||||||
|
const client: OAuthClient = { id: randomToken(), name, redirectUris };
|
||||||
|
const database = getDatabase();
|
||||||
|
const timestamp = nowUtc();
|
||||||
|
database
|
||||||
|
.prepare('DELETE FROM oauth_authorization_codes WHERE expires_at_utc <= ?')
|
||||||
|
.run(timestamp);
|
||||||
|
database
|
||||||
|
.prepare(
|
||||||
|
'DELETE FROM oauth_access_tokens WHERE expires_at_utc <= ? OR revoked_at_utc IS NOT NULL'
|
||||||
|
)
|
||||||
|
.run(timestamp);
|
||||||
|
database
|
||||||
|
.prepare(
|
||||||
|
`DELETE FROM oauth_clients WHERE created_at_utc < ?
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM oauth_authorization_codes c WHERE c.client_id = oauth_clients.id)
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM oauth_access_tokens t WHERE t.client_id = oauth_clients.id)`
|
||||||
|
)
|
||||||
|
.run(new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString());
|
||||||
|
const count = database.prepare('SELECT count(*) AS count FROM oauth_clients').get() as {
|
||||||
|
count: number;
|
||||||
|
};
|
||||||
|
if (count.count >= MAX_REGISTERED_CLIENTS) {
|
||||||
|
throw new OAuthError(
|
||||||
|
'temporarily_unavailable',
|
||||||
|
'Derzeit sind keine weiteren Registrierungen möglich.',
|
||||||
|
503
|
||||||
|
);
|
||||||
|
}
|
||||||
|
database
|
||||||
|
.prepare(
|
||||||
|
'INSERT INTO oauth_clients (id, name, redirect_uris_json, created_at_utc) VALUES (?, ?, ?, ?)'
|
||||||
|
)
|
||||||
|
.run(client.id, client.name, JSON.stringify(client.redirectUris), timestamp);
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function reserveOAuthAttempt(kind: 'registration' | 'token', address: string): boolean {
|
||||||
|
const database = getDatabase();
|
||||||
|
const since = new Date(Date.now() - 60 * 60 * 1000).toISOString();
|
||||||
|
const limit = kind === 'registration' ? 20 : 120;
|
||||||
|
const addressHash = tokenHash(address || 'unknown');
|
||||||
|
return database.transaction(() => {
|
||||||
|
database.prepare('DELETE FROM oauth_rate_limit_attempts WHERE attempted_at_utc < ?').run(since);
|
||||||
|
const row = database
|
||||||
|
.prepare(
|
||||||
|
`SELECT count(*) AS count FROM oauth_rate_limit_attempts
|
||||||
|
WHERE kind = ? AND address_hash = ? AND attempted_at_utc >= ?`
|
||||||
|
)
|
||||||
|
.get(kind, addressHash, since) as { count: number };
|
||||||
|
if (row.count >= limit) return false;
|
||||||
|
database
|
||||||
|
.prepare(
|
||||||
|
`INSERT INTO oauth_rate_limit_attempts (id, kind, address_hash, attempted_at_utc)
|
||||||
|
VALUES (?, ?, ?, ?)`
|
||||||
|
)
|
||||||
|
.run(randomUUID(), kind, addressHash, nowUtc());
|
||||||
|
return true;
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getOAuthClient(clientId: string): OAuthClient | null {
|
||||||
|
if (!clientId || clientId.length > 200) return null;
|
||||||
|
const row = getDatabase()
|
||||||
|
.prepare('SELECT id, name, redirect_uris_json FROM oauth_clients WHERE id = ?')
|
||||||
|
.get(clientId) as OAuthClientRow | undefined;
|
||||||
|
return row ? clientFromRow(row) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function parseAuthorizationRequest(url: URL): OAuthAuthorizationRequest {
|
||||||
|
const client = getOAuthClient(url.searchParams.get('client_id') ?? '');
|
||||||
|
if (!client) throw new OAuthError('invalid_client', 'Der OAuth-Client ist nicht registriert.');
|
||||||
|
const redirectUri = url.searchParams.get('redirect_uri') ?? '';
|
||||||
|
if (!client.redirectUris.includes(redirectUri)) {
|
||||||
|
throw new OAuthError('invalid_request', 'Die Redirect-URI ist nicht registriert.');
|
||||||
|
}
|
||||||
|
if (url.searchParams.get('response_type') !== 'code') {
|
||||||
|
throw new OAuthError('unsupported_response_type', 'Nur response_type=code wird unterstützt.');
|
||||||
|
}
|
||||||
|
const scope = url.searchParams.get('scope') ?? '';
|
||||||
|
if (scope !== MCP_SCOPE)
|
||||||
|
throw new OAuthError('invalid_scope', 'Der angeforderte Scope ist ungültig.');
|
||||||
|
const resource = url.searchParams.get('resource') ?? '';
|
||||||
|
if (resource !== mcpResource()) {
|
||||||
|
throw new OAuthError('invalid_target', 'Die angeforderte MCP-Ressource ist ungültig.');
|
||||||
|
}
|
||||||
|
const codeChallenge = url.searchParams.get('code_challenge') ?? '';
|
||||||
|
if (
|
||||||
|
url.searchParams.get('code_challenge_method') !== 'S256' ||
|
||||||
|
!/^[A-Za-z0-9_-]{43}$/.test(codeChallenge)
|
||||||
|
) {
|
||||||
|
throw new OAuthError('invalid_request', 'PKCE mit S256 ist erforderlich.');
|
||||||
|
}
|
||||||
|
const state = url.searchParams.get('state') ?? '';
|
||||||
|
if (state.length > 1000) throw new OAuthError('invalid_request', 'Der OAuth-State ist zu lang.');
|
||||||
|
return { client, redirectUri, state, scope: MCP_SCOPE, resource, codeChallenge };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function authorizationErrorRedirect(url: URL, problem: OAuthError): string | null {
|
||||||
|
const client = getOAuthClient(url.searchParams.get('client_id') ?? '');
|
||||||
|
const redirectUri = url.searchParams.get('redirect_uri') ?? '';
|
||||||
|
if (!client?.redirectUris.includes(redirectUri)) return null;
|
||||||
|
const target = new URL(redirectUri);
|
||||||
|
target.searchParams.set('error', problem.code);
|
||||||
|
target.searchParams.set('error_description', problem.message);
|
||||||
|
const state = url.searchParams.get('state') ?? '';
|
||||||
|
if (state && state.length <= 1000) target.searchParams.set('state', state);
|
||||||
|
target.searchParams.set('iss', oauthIssuer());
|
||||||
|
return target.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function authorizationRedirect(
|
||||||
|
request: OAuthAuthorizationRequest,
|
||||||
|
values: Record<string, string>
|
||||||
|
): string {
|
||||||
|
const target = new URL(request.redirectUri);
|
||||||
|
for (const [key, value] of Object.entries(values)) target.searchParams.set(key, value);
|
||||||
|
if (request.state) target.searchParams.set('state', request.state);
|
||||||
|
target.searchParams.set('iss', oauthIssuer());
|
||||||
|
return target.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createAuthorizationCode(
|
||||||
|
request: OAuthAuthorizationRequest,
|
||||||
|
user: AuthUser
|
||||||
|
): string {
|
||||||
|
const code = randomToken();
|
||||||
|
const timestamp = nowUtc();
|
||||||
|
const database = getDatabase();
|
||||||
|
const store = database.transaction(() => {
|
||||||
|
database
|
||||||
|
.prepare('DELETE FROM oauth_authorization_codes WHERE expires_at_utc <= ?')
|
||||||
|
.run(timestamp);
|
||||||
|
database
|
||||||
|
.prepare(
|
||||||
|
`INSERT INTO oauth_authorization_codes (
|
||||||
|
code_hash, client_id, user_id, redirect_uri, scope, resource, code_challenge,
|
||||||
|
created_at_utc, expires_at_utc
|
||||||
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
||||||
|
)
|
||||||
|
.run(
|
||||||
|
tokenHash(code),
|
||||||
|
request.client.id,
|
||||||
|
user.id,
|
||||||
|
request.redirectUri,
|
||||||
|
request.scope,
|
||||||
|
request.resource,
|
||||||
|
request.codeChallenge,
|
||||||
|
timestamp,
|
||||||
|
futureUtc(AUTHORIZATION_CODE_DURATION_MS)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
store();
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pkceChallenge(verifier: string): string {
|
||||||
|
return createHash('sha256').update(verifier).digest('base64url');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function exchangeAuthorizationCode(input: {
|
||||||
|
code: string;
|
||||||
|
clientId: string;
|
||||||
|
redirectUri: string;
|
||||||
|
codeVerifier: string;
|
||||||
|
resource: string;
|
||||||
|
}) {
|
||||||
|
if (!/^[A-Za-z0-9._~-]{43,128}$/.test(input.codeVerifier)) {
|
||||||
|
throw new OAuthError('invalid_grant', 'Der PKCE-Verifier ist ungültig.');
|
||||||
|
}
|
||||||
|
const database = getDatabase();
|
||||||
|
const exchange = database.transaction(() => {
|
||||||
|
const timestamp = nowUtc();
|
||||||
|
const row = database
|
||||||
|
.prepare(
|
||||||
|
`SELECT client_id, user_id, redirect_uri, scope, resource, code_challenge,
|
||||||
|
expires_at_utc, consumed_at_utc
|
||||||
|
FROM oauth_authorization_codes WHERE code_hash = ?`
|
||||||
|
)
|
||||||
|
.get(tokenHash(input.code)) as AuthorizationCodeRow | undefined;
|
||||||
|
if (
|
||||||
|
!row ||
|
||||||
|
row.consumed_at_utc ||
|
||||||
|
row.expires_at_utc <= timestamp ||
|
||||||
|
row.client_id !== input.clientId ||
|
||||||
|
row.redirect_uri !== input.redirectUri ||
|
||||||
|
row.resource !== input.resource ||
|
||||||
|
row.code_challenge !== pkceChallenge(input.codeVerifier)
|
||||||
|
) {
|
||||||
|
throw new OAuthError('invalid_grant', 'Der Autorisierungscode ist ungültig oder abgelaufen.');
|
||||||
|
}
|
||||||
|
const user = database
|
||||||
|
.prepare('SELECT 1 FROM users WHERE id = ? AND locked_at_utc IS NULL')
|
||||||
|
.get(row.user_id);
|
||||||
|
if (!user) throw new OAuthError('invalid_grant', 'Das zugehörige Konto ist nicht aktiv.');
|
||||||
|
const token = randomToken();
|
||||||
|
database
|
||||||
|
.prepare('UPDATE oauth_authorization_codes SET consumed_at_utc = ? WHERE code_hash = ?')
|
||||||
|
.run(timestamp, tokenHash(input.code));
|
||||||
|
database
|
||||||
|
.prepare(
|
||||||
|
`INSERT INTO oauth_access_tokens (
|
||||||
|
token_hash, client_id, user_id, scope, resource, created_at_utc, expires_at_utc,
|
||||||
|
request_window_started_at_utc
|
||||||
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
|
||||||
|
)
|
||||||
|
.run(
|
||||||
|
tokenHash(token),
|
||||||
|
row.client_id,
|
||||||
|
row.user_id,
|
||||||
|
row.scope,
|
||||||
|
row.resource,
|
||||||
|
timestamp,
|
||||||
|
futureUtc(ACCESS_TOKEN_DURATION_SECONDS * 1000),
|
||||||
|
timestamp
|
||||||
|
);
|
||||||
|
return { accessToken: token, scope: row.scope };
|
||||||
|
});
|
||||||
|
return exchange();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function authenticateOAuth(request: Request): AuthUser {
|
||||||
|
const authorization = request.headers.get('authorization') ?? '';
|
||||||
|
const token = authorization.startsWith('Bearer ') ? authorization.slice(7).trim() : '';
|
||||||
|
if (!token || token.length > 100)
|
||||||
|
throw new OAuthError('invalid_token', 'OAuth-Token fehlt.', 401);
|
||||||
|
const timestamp = nowUtc();
|
||||||
|
const database = getDatabase();
|
||||||
|
const row = database.transaction(() => {
|
||||||
|
const current = database
|
||||||
|
.prepare(
|
||||||
|
`SELECT u.id, u.email, u.display_name AS displayName, u.role,
|
||||||
|
u.locked_at_utc AS lockedAtUtc, t.token_hash,
|
||||||
|
t.request_window_started_at_utc, t.request_count
|
||||||
|
FROM oauth_access_tokens t JOIN users u ON u.id = t.user_id
|
||||||
|
WHERE t.token_hash = ? AND t.revoked_at_utc IS NULL AND t.expires_at_utc > ?
|
||||||
|
AND t.scope = ? AND t.resource = ? AND u.locked_at_utc IS NULL`
|
||||||
|
)
|
||||||
|
.get(tokenHash(token), timestamp, MCP_SCOPE, mcpResource()) as
|
||||||
|
| (AuthUser & {
|
||||||
|
token_hash: string;
|
||||||
|
request_window_started_at_utc: string;
|
||||||
|
request_count: number;
|
||||||
|
})
|
||||||
|
| undefined;
|
||||||
|
if (!current) {
|
||||||
|
throw new OAuthError('invalid_token', 'OAuth-Token ist ungültig oder abgelaufen.', 401);
|
||||||
|
}
|
||||||
|
const windowExpired =
|
||||||
|
current.request_window_started_at_utc <= new Date(Date.now() - 60 * 60 * 1000).toISOString();
|
||||||
|
if (!windowExpired && current.request_count >= MCP_REQUEST_LIMIT_PER_HOUR) {
|
||||||
|
throw new OAuthError('temporarily_unavailable', 'Zu viele MCP-Anfragen.', 429);
|
||||||
|
}
|
||||||
|
database
|
||||||
|
.prepare(
|
||||||
|
`UPDATE oauth_access_tokens SET last_used_at_utc = ?,
|
||||||
|
request_window_started_at_utc = ?, request_count = ? WHERE token_hash = ?`
|
||||||
|
)
|
||||||
|
.run(
|
||||||
|
timestamp,
|
||||||
|
windowExpired ? timestamp : current.request_window_started_at_utc,
|
||||||
|
windowExpired ? 1 : current.request_count + 1,
|
||||||
|
current.token_hash
|
||||||
|
);
|
||||||
|
return current;
|
||||||
|
})();
|
||||||
|
return {
|
||||||
|
id: row.id,
|
||||||
|
email: row.email,
|
||||||
|
displayName: row.displayName,
|
||||||
|
role: row.role,
|
||||||
|
lockedAtUtc: row.lockedAtUtc
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function revokeOAuthToken(token: string, clientId: string): void {
|
||||||
|
if (!token || token.length > 200 || !clientId || clientId.length > 200) return;
|
||||||
|
getDatabase()
|
||||||
|
.prepare(
|
||||||
|
`UPDATE oauth_access_tokens SET revoked_at_utc = ?
|
||||||
|
WHERE token_hash = ? AND client_id = ? AND revoked_at_utc IS NULL`
|
||||||
|
)
|
||||||
|
.run(nowUtc(), tokenHash(token), clientId);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function oauthTokenDurationSeconds(): number {
|
||||||
|
return ACCESS_TOKEN_DURATION_SECONDS;
|
||||||
|
}
|
||||||
@@ -9,7 +9,8 @@ import {
|
|||||||
authenticateTechnical,
|
authenticateTechnical,
|
||||||
createTechnicalAccess,
|
createTechnicalAccess,
|
||||||
idempotentResponse,
|
idempotentResponse,
|
||||||
revokeTechnicalAccess
|
revokeTechnicalAccess,
|
||||||
|
updateTechnicalAccess
|
||||||
} from './technical-access.js';
|
} from './technical-access.js';
|
||||||
|
|
||||||
let directory: string;
|
let directory: string;
|
||||||
@@ -64,6 +65,11 @@ describe('technical API access', () => {
|
|||||||
.prepare('SELECT token_hash FROM technical_accesses WHERE id = ?')
|
.prepare('SELECT token_hash FROM technical_accesses WHERE id = ?')
|
||||||
.get(created.id)
|
.get(created.id)
|
||||||
).not.toMatchObject({ token_hash: created.token });
|
).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);
|
revokeTechnicalAccess(actor, created.id);
|
||||||
expect(() => authenticateTechnical(request(created.token))).toThrow('API_UNAUTHORIZED');
|
expect(() => authenticateTechnical(request(created.token))).toThrow('API_UNAUTHORIZED');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -48,6 +48,31 @@ export function createTechnicalAccess(actor: AuthUser, nameValue: string, permis
|
|||||||
return { id, token };
|
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) {
|
export function revokeTechnicalAccess(actor: AuthUser, id: string) {
|
||||||
const result = getDatabase()
|
const result = getDatabase()
|
||||||
.prepare(
|
.prepare(
|
||||||
|
|||||||
@@ -7,5 +7,6 @@ export const load: LayoutServerLoad = ({ locals, url }) => ({
|
|||||||
: locals.user,
|
: locals.user,
|
||||||
presentationMode: url.pathname.startsWith('/heinzlive/'),
|
presentationMode: url.pathname.startsWith('/heinzlive/'),
|
||||||
guestMode: url.pathname.startsWith('/freigabe/'),
|
guestMode: url.pathname.startsWith('/freigabe/'),
|
||||||
|
oauthMode: url.pathname === '/oauth/authorize',
|
||||||
liveControllerMode: url.pathname === '/live'
|
liveControllerMode: url.pathname === '/live'
|
||||||
});
|
});
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
{#if data.presentationMode}
|
{#if data.presentationMode}
|
||||||
{@render children()}
|
{@render children()}
|
||||||
{:else if data.guestMode}
|
{:else if data.guestMode || data.oauthMode}
|
||||||
<div class="guest-shell">
|
<div class="guest-shell">
|
||||||
<header class="auth-header">
|
<header class="auth-header">
|
||||||
<span class="brand"
|
<span class="brand"
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { json } from '@sveltejs/kit';
|
||||||
|
import type { RequestHandler } from './$types';
|
||||||
|
import { MCP_SCOPE, oauthIssuer } from '#lib/server/oauth.js';
|
||||||
|
|
||||||
|
export const GET: RequestHandler = () => {
|
||||||
|
const issuer = oauthIssuer();
|
||||||
|
return json(
|
||||||
|
{
|
||||||
|
issuer,
|
||||||
|
authorization_endpoint: `${issuer}/oauth/authorize`,
|
||||||
|
token_endpoint: `${issuer}/oauth/token`,
|
||||||
|
registration_endpoint: `${issuer}/oauth/register`,
|
||||||
|
revocation_endpoint: `${issuer}/oauth/revoke`,
|
||||||
|
response_types_supported: ['code'],
|
||||||
|
grant_types_supported: ['authorization_code'],
|
||||||
|
token_endpoint_auth_methods_supported: ['none'],
|
||||||
|
revocation_endpoint_auth_methods_supported: ['none'],
|
||||||
|
code_challenge_methods_supported: ['S256'],
|
||||||
|
scopes_supported: [MCP_SCOPE],
|
||||||
|
authorization_response_iss_parameter_supported: true
|
||||||
|
},
|
||||||
|
{ headers: { 'Cache-Control': 'public, max-age=3600' } }
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { GET } from './mcp/+server.js';
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { json } from '@sveltejs/kit';
|
||||||
|
import type { RequestHandler } from './$types';
|
||||||
|
import { MCP_SCOPE, mcpResource, oauthIssuer } from '#lib/server/oauth.js';
|
||||||
|
|
||||||
|
export const GET: RequestHandler = () =>
|
||||||
|
json(
|
||||||
|
{
|
||||||
|
resource: mcpResource(),
|
||||||
|
authorization_servers: [oauthIssuer()],
|
||||||
|
scopes_supported: [MCP_SCOPE],
|
||||||
|
bearer_methods_supported: ['header']
|
||||||
|
},
|
||||||
|
{ headers: { 'Cache-Control': 'public, max-age=3600' } }
|
||||||
|
);
|
||||||
@@ -46,22 +46,34 @@ export const actions = {
|
|||||||
requireUser(locals.user);
|
requireUser(locals.user);
|
||||||
const data = await request.formData();
|
const data = await request.formData();
|
||||||
const entryIds = data.getAll('entryIds').map(String);
|
const entryIds = data.getAll('entryIds').map(String);
|
||||||
if (!entryIds.length) return fail(400, { feedError: 'Mindestens einen Beitrag auswählen.' });
|
if (!entryIds.length)
|
||||||
|
return fail(400, {
|
||||||
|
intent: 'feedImport',
|
||||||
|
feedError: 'Mindestens einen Beitrag auswählen.'
|
||||||
|
});
|
||||||
try {
|
try {
|
||||||
const pieceIds = importFeedEntries(entryIds, data.getAll('categoryIds').map(String));
|
const pieceIds = importFeedEntries(entryIds, data.getAll('categoryIds').map(String));
|
||||||
return {
|
return {
|
||||||
|
intent: 'feedImport',
|
||||||
feedSuccess: `${pieceIds.length} ${pieceIds.length === 1 ? 'Beitrag' : 'Beiträge'} in den Eingang übernommen.`
|
feedSuccess: `${pieceIds.length} ${pieceIds.length === 1 ? 'Beitrag' : 'Beiträge'} in den Eingang übernommen.`
|
||||||
};
|
};
|
||||||
} catch {
|
} catch {
|
||||||
return fail(400, { feedError: 'Die Auswahl konnte nicht übernommen werden.' });
|
return fail(400, {
|
||||||
|
intent: 'feedImport',
|
||||||
|
feedError: 'Die Auswahl konnte nicht übernommen werden.'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discardFeeds: async ({ locals, request }) => {
|
discardFeeds: async ({ locals, request }) => {
|
||||||
requireUser(locals.user);
|
requireUser(locals.user);
|
||||||
const data = await request.formData();
|
const data = await request.formData();
|
||||||
const entryIds = data.getAll('entryIds').map(String);
|
const entryIds = data.getAll('entryIds').map(String);
|
||||||
if (!entryIds.length) return fail(400, { feedError: 'Mindestens einen Beitrag auswählen.' });
|
if (!entryIds.length)
|
||||||
|
return fail(400, { intent: 'feedDiscard', feedError: 'Mindestens einen Beitrag auswählen.' });
|
||||||
const count = discardFeedEntries(entryIds);
|
const count = discardFeedEntries(entryIds);
|
||||||
return { feedSuccess: `${count} ${count === 1 ? 'Beitrag' : 'Beiträge'} verworfen.` };
|
return {
|
||||||
|
intent: 'feedDiscard',
|
||||||
|
feedSuccess: `${count} ${count === 1 ? 'Beitrag' : 'Beiträge'} verworfen.`
|
||||||
|
};
|
||||||
}
|
}
|
||||||
} satisfies Actions;
|
} satisfies Actions;
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
/* eslint-disable svelte/no-navigation-without-resolve -- RSS links are validated external URLs. */
|
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import AppIcon from '#lib/components/AppIcon.svelte';
|
import AppIcon from '#lib/components/AppIcon.svelte';
|
||||||
|
import RssSelectionDialog from '#lib/components/RssSelectionDialog.svelte';
|
||||||
import type { PageProps } from './$types';
|
import type { PageProps } from './$types';
|
||||||
let { data, form }: PageProps = $props();
|
let { data, form }: PageProps = $props();
|
||||||
|
let rssDialog: { showModal: () => void };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head><title>Eingang | Sendewerk</title></svelte:head>
|
<svelte:head><title>Eingang | Sendewerk</title></svelte:head>
|
||||||
@@ -44,65 +45,39 @@
|
|||||||
<button class="primary-button" type="submit">Im Eingang ablegen</button>
|
<button class="primary-button" type="submit">Im Eingang ablegen</button>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
<section class="quiet-panel feed-inbox">
|
<section class="quiet-panel rss-inbox-panel">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div>
|
<div>
|
||||||
<p class="eyebrow">RSS-Importeingang</p>
|
<p class="eyebrow">RSS-Importeingang</p>
|
||||||
<h2>Beiträge sichten</h2>
|
<h2>RSS-Beiträge</h2>
|
||||||
</div>
|
</div>
|
||||||
<span>{data.feedEntries.length} neu</span>
|
<span class="catalog-entry-icon"><AppIcon name="rss" /></span>
|
||||||
</div>
|
</div>
|
||||||
<p>Beiträge bleiben hier getrennt, bis du sie auswählst und in den Fundus übernimmst.</p>
|
<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?.feedError}<div class="form-message error" role="alert">{form.feedError}</div>{/if}
|
||||||
{#if form?.feedSuccess}<div class="form-message success" role="status">
|
{#if form?.feedSuccess}<div class="form-message success" role="status">
|
||||||
{form.feedSuccess}
|
{form.feedSuccess}
|
||||||
</div>{/if}
|
</div>{/if}
|
||||||
{#if data.feedEntries.length}
|
<button
|
||||||
<form method="POST" class="feed-selection">
|
class="compact-add-button"
|
||||||
<fieldset class="feed-categories">
|
type="button"
|
||||||
<legend>Kategorien für die Auswahl <span>(Feed-Standard gilt ohne Auswahl)</span></legend>
|
disabled={!data.feedEntries.length}
|
||||||
{#each data.taxonomy.categories as category (category.id)}
|
onclick={() => rssDialog.showModal()}
|
||||||
<label
|
>
|
||||||
><input type="checkbox" name="categoryIds" value={category.id} />
|
<AppIcon name="list" />
|
||||||
{category.name}</label
|
{data.feedEntries.length ? 'RSS-Beiträge auswählen' : 'Keine neuen RSS-Beiträge'}
|
||||||
>
|
</button>
|
||||||
{/each}
|
|
||||||
</fieldset>
|
|
||||||
<div class="feed-entry-list">
|
|
||||||
{#each data.feedEntries as entry (entry.id)}
|
|
||||||
<label class="feed-entry">
|
|
||||||
<input type="checkbox" name="entryIds" value={entry.id} />
|
|
||||||
<span
|
|
||||||
><small
|
|
||||||
>{entry.feedName}{entry.publishedAtUtc
|
|
||||||
? ` · ${new Date(entry.publishedAtUtc).toLocaleDateString('de-DE')}`
|
|
||||||
: ''}</small
|
|
||||||
><strong>{entry.title}</strong>{#if entry.summary}<span>{entry.summary}</span>{/if}
|
|
||||||
<a
|
|
||||||
href={entry.url}
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
onclick={(event) => event.stopPropagation()}>Original öffnen</a
|
|
||||||
></span
|
|
||||||
>
|
|
||||||
</label>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
<div class="feed-actions">
|
|
||||||
<button class="primary-button" type="submit" formaction="?/importFeeds"
|
|
||||||
>Auswahl übernehmen</button
|
|
||||||
>
|
|
||||||
<button class="text-button danger-text" type="submit" formaction="?/discardFeeds"
|
|
||||||
>Auswahl verwerfen</button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{:else}
|
|
||||||
<p class="empty-copy">
|
|
||||||
Keine neuen Feed-Beiträge. Aktivierte Feeds werden automatisch abgerufen.
|
|
||||||
</p>
|
|
||||||
{/if}
|
|
||||||
</section>
|
</section>
|
||||||
|
<RssSelectionDialog
|
||||||
|
bind:this={rssDialog}
|
||||||
|
entries={data.feedEntries}
|
||||||
|
categories={data.taxonomy.categories}
|
||||||
|
{form}
|
||||||
|
/>
|
||||||
{#if data.pieces.length}
|
{#if data.pieces.length}
|
||||||
<section class="inbox-list">
|
<section class="inbox-list">
|
||||||
<h2>{data.pieces.length} {data.pieces.length === 1 ? 'offener Inhalt' : 'offene Inhalte'}</h2>
|
<h2>{data.pieces.length} {data.pieces.length === 1 ? 'offener Inhalt' : 'offene Inhalte'}</h2>
|
||||||
@@ -143,57 +118,16 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.feed-inbox {
|
.rss-inbox-panel {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 1rem;
|
gap: 0.75rem;
|
||||||
margin-block: 1.5rem;
|
margin-block: 1.5rem;
|
||||||
|
padding: clamp(0.85rem, 2vw, 1.2rem);
|
||||||
}
|
}
|
||||||
.feed-selection,
|
.rss-inbox-panel .panel-heading {
|
||||||
.feed-entry-list {
|
margin: 0;
|
||||||
display: grid;
|
|
||||||
gap: 0.75rem;
|
|
||||||
}
|
}
|
||||||
.feed-categories {
|
.rss-inbox-panel .catalog-note {
|
||||||
display: flex;
|
margin: 0;
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 0.6rem 1rem;
|
|
||||||
border: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
.feed-categories legend {
|
|
||||||
width: 100%;
|
|
||||||
font-weight: 700;
|
|
||||||
margin-bottom: 0.45rem;
|
|
||||||
}
|
|
||||||
.feed-categories legend span {
|
|
||||||
font-weight: 400;
|
|
||||||
color: var(--color-text-muted);
|
|
||||||
}
|
|
||||||
.feed-entry {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: auto 1fr;
|
|
||||||
gap: 0.8rem;
|
|
||||||
align-items: start;
|
|
||||||
padding: 0.9rem;
|
|
||||||
border: 1px solid var(--color-border);
|
|
||||||
border-radius: 0.7rem;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.feed-entry > span {
|
|
||||||
display: grid;
|
|
||||||
gap: 0.25rem;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
.feed-entry small {
|
|
||||||
color: var(--color-text-muted);
|
|
||||||
}
|
|
||||||
.feed-entry a {
|
|
||||||
width: fit-content;
|
|
||||||
}
|
|
||||||
.feed-actions {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 0.75rem;
|
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
clearPresentationChannel,
|
clearPresentationChannel,
|
||||||
endLive,
|
endLive,
|
||||||
getLiveView,
|
getLiveView,
|
||||||
|
getPresentationChannelStatus,
|
||||||
goBack,
|
goBack,
|
||||||
issuePresentationAccess,
|
issuePresentationAccess,
|
||||||
moveOpenUsage,
|
moveOpenUsage,
|
||||||
@@ -87,6 +88,7 @@ export const load: PageServerLoad = ({ locals, url }) => {
|
|||||||
const live = getLiveView(showId);
|
const live = getLiveView(showId);
|
||||||
return {
|
return {
|
||||||
live,
|
live,
|
||||||
|
outputStatus: getPresentationChannelStatus(showId),
|
||||||
canManageShares: actor.role === 'barkeeper',
|
canManageShares: actor.role === 'barkeeper',
|
||||||
shares: actor.role === 'barkeeper' ? listShares(actor, showId) : [],
|
shares: actor.role === 'barkeeper' ? listShares(actor, showId) : [],
|
||||||
commandId: randomUUID(),
|
commandId: randomUUID(),
|
||||||
|
|||||||
+188
-129
@@ -300,9 +300,10 @@
|
|||||||
menuOpen = true;
|
menuOpen = true;
|
||||||
expandedContext = null;
|
expandedContext = null;
|
||||||
await tick();
|
await tick();
|
||||||
liveMenuPopover
|
(
|
||||||
?.querySelector<HTMLElement>('button:not(:disabled), a[href]')
|
liveMenuPopover?.querySelector<HTMLElement>('[data-menu-initial-focus]') ??
|
||||||
?.focus({ preventScroll: true });
|
liveMenuPopover?.querySelector<HTMLElement>('button:not(:disabled), a[href]')
|
||||||
|
)?.focus({ preventScroll: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function closeLiveMenu(restoreFocus = true) {
|
async function closeLiveMenu(restoreFocus = true) {
|
||||||
@@ -361,6 +362,15 @@
|
|||||||
return 'Kommend';
|
return 'Kommend';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showStateLabel() {
|
||||||
|
if (data.live.show.status === 'completed') return 'Historisch abgeschlossen';
|
||||||
|
if (!data.live.startedAtUtc)
|
||||||
|
return data.live.show.status === 'ready' ? 'Bereit zum Start' : 'Entwurf';
|
||||||
|
if (data.live.endedAtUtc) return 'Lauf beendet';
|
||||||
|
if (data.live.isPaused) return 'Pausiert';
|
||||||
|
return 'Läuft';
|
||||||
|
}
|
||||||
|
|
||||||
function liveAction(name: string) {
|
function liveAction(name: string) {
|
||||||
return `?show=${encodeURIComponent(data.live.show.id)}&/${name}`;
|
return `?show=${encodeURIComponent(data.live.show.id)}&/${name}`;
|
||||||
}
|
}
|
||||||
@@ -481,28 +491,46 @@
|
|||||||
</form>{/if}
|
</form>{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<div class="total-timer-control">
|
||||||
class="total-countdown"
|
<button
|
||||||
type="button"
|
class="total-countdown"
|
||||||
onclick={toggleTimerDisplay}
|
type="button"
|
||||||
aria-label={timerDisplay === 'elapsed'
|
onclick={toggleTimerDisplay}
|
||||||
? 'Gelaufene Gesamtzeit, zu Restzeit wechseln'
|
aria-label={timerDisplay === 'elapsed'
|
||||||
: 'Geschätzte Restzeit, zu gelaufener Zeit wechseln'}
|
? 'Gelaufene Gesamtzeit, zu Restzeit wechseln'
|
||||||
>
|
: 'Geschätzte Restzeit, zu gelaufener Zeit wechseln'}
|
||||||
<span class="timer-label"
|
|
||||||
><AppIcon name="timer" /> {timerDisplay === 'elapsed' ? 'Gelaufen' : 'Restzeit'}</span
|
|
||||||
>
|
>
|
||||||
<strong
|
<span class="timer-label"
|
||||||
>{formatCountdown(
|
><AppIcon name="timer" /> {timerDisplay === 'elapsed' ? 'Gelaufen' : 'Restzeit'}</span
|
||||||
timerDisplay === 'elapsed' ? totalElapsedSeconds : remainingSeconds
|
|
||||||
)}</strong
|
|
||||||
>
|
|
||||||
{#if timerDisplay === 'remaining' && data.live.remainingEstimate.unplannedSectionCount}
|
|
||||||
<small title="Verbleibende Abschnitte ohne geplante Abschnittsdauer"
|
|
||||||
>+ {data.live.remainingEstimate.unplannedSectionCount} ungeplant</small
|
|
||||||
>
|
>
|
||||||
{/if}
|
<strong
|
||||||
</button>
|
>{formatCountdown(
|
||||||
|
timerDisplay === 'elapsed' ? totalElapsedSeconds : remainingSeconds
|
||||||
|
)}</strong
|
||||||
|
>
|
||||||
|
{#if timerDisplay === 'remaining' && data.live.remainingEstimate.unplannedSectionCount}
|
||||||
|
<small title="Verbleibende Abschnitte ohne geplante Abschnittsdauer"
|
||||||
|
>+ {data.live.remainingEstimate.unplannedSectionCount} ungeplant</small
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
{#if data.live.startedAtUtc && !data.live.endedAtUtc}<details class="timer-reset-menu">
|
||||||
|
<summary aria-label="Aktionen für Gesamtzeit"><AppIcon name="ellipsis" /></summary>
|
||||||
|
<form
|
||||||
|
method="POST"
|
||||||
|
action={liveAction('resetTotalTimer')}
|
||||||
|
use:enhance={enhanceCommand}
|
||||||
|
onsubmit={(event) => {
|
||||||
|
if (!confirm('Gesamtzeit wirklich zurücksetzen?')) event.preventDefault();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<input type="hidden" name="showId" value={data.live.show.id} />
|
||||||
|
<input type="hidden" name="revision" value={data.live.liveRevision} />
|
||||||
|
<input type="hidden" name="commandId" value={data.commandId} />
|
||||||
|
<button class="text-button" type="submit">Gesamtzeit zurücksetzen</button>
|
||||||
|
</form>
|
||||||
|
</details>{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="section-timer-control">
|
<div class="section-timer-control">
|
||||||
<div
|
<div
|
||||||
@@ -540,6 +568,24 @@
|
|||||||
<AppIcon name={data.live.isPaused ? 'play' : 'pause'} />
|
<AppIcon name={data.live.isPaused ? 'play' : 'pause'} />
|
||||||
</button>
|
</button>
|
||||||
</form>{/if}
|
</form>{/if}
|
||||||
|
{#if data.live.startedAtUtc && !data.live.endedAtUtc && data.live.sectionTimer && data.live.sectionTimer.plannedDurationSeconds > 0}<details
|
||||||
|
class="timer-reset-menu"
|
||||||
|
>
|
||||||
|
<summary aria-label="Aktionen für Abschnittszeit"><AppIcon name="ellipsis" /></summary>
|
||||||
|
<form
|
||||||
|
method="POST"
|
||||||
|
action={liveAction('resetSectionTimer')}
|
||||||
|
use:enhance={enhanceCommand}
|
||||||
|
onsubmit={(event) => {
|
||||||
|
if (!confirm('Abschnittstimer wirklich zurücksetzen?')) event.preventDefault();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<input type="hidden" name="showId" value={data.live.show.id} />
|
||||||
|
<input type="hidden" name="revision" value={data.live.liveRevision} />
|
||||||
|
<input type="hidden" name="commandId" value={data.commandId} />
|
||||||
|
<button class="text-button" type="submit">Abschnittszeit zurücksetzen</button>
|
||||||
|
</form>
|
||||||
|
</details>{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -567,52 +613,23 @@
|
|||||||
inert={mobileRailOpen}
|
inert={mobileRailOpen}
|
||||||
>
|
>
|
||||||
<section class="live-menu-show">
|
<section class="live-menu-show">
|
||||||
<small>Sendung</small>
|
<strong>Sendung steuern</strong>
|
||||||
<strong>{data.live.show.title}</strong>
|
<div class="live-menu-show-heading">
|
||||||
</section>
|
<span>
|
||||||
<section>
|
<small>Sendung</small>
|
||||||
<strong>Ansicht</strong>
|
<strong>{data.live.show.title}</strong>
|
||||||
<div class="font-control" aria-label="Prompter-Schriftgröße">
|
</span>
|
||||||
<button
|
<span class:paused={data.live.isPaused} class="live-show-state">{showStateLabel()}</span>
|
||||||
type="button"
|
|
||||||
onclick={() => changePromptSize(-0.1)}
|
|
||||||
aria-label="Schrift verkleinern">A−</button
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onclick={() => changePromptSize(0.1)}
|
|
||||||
aria-label="Schrift vergrößern">A+</button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="text-button" aria-pressed={!showTimes} onclick={toggleTimes}>
|
|
||||||
{showTimes ? 'Zeiten ausblenden' : 'Zeiten einblenden'}
|
|
||||||
</button>
|
|
||||||
<ThemeToggle />
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<strong>Ausgabekanal</strong>
|
|
||||||
{#if data.canManageShares}<ShareManagement
|
|
||||||
shows={[{ ...data.live.show, startsAtUtc: null }]}
|
|
||||||
shares={data.shares}
|
|
||||||
fixedShowId={data.live.show.id}
|
|
||||||
{form}
|
|
||||||
/>{/if}
|
|
||||||
<form method="POST" action={liveAction('createOutput')} use:enhance={enhanceOutput}>
|
|
||||||
<input type="hidden" name="showId" value={data.live.show.id} />
|
|
||||||
<button class="secondary-button" type="submit">Ausgabe verbinden und öffnen</button>
|
|
||||||
</form>
|
|
||||||
<form method="POST" action={liveAction('rotateOutput')} use:enhance={enhanceOutput}>
|
|
||||||
<input type="hidden" name="showId" value={data.live.show.id} />
|
|
||||||
<button class="text-button" type="submit">Schlüssel erneuern</button>
|
|
||||||
</form>
|
|
||||||
<form method="POST" action={liveAction('clearOutput')} use:enhance={enhanceCommand}>
|
|
||||||
<button class="text-button danger-text" type="submit">Ausgabekanal trennen</button>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<strong>Sendungssteuerung</strong>
|
|
||||||
<small>Status: {data.live.show.status}</small>
|
|
||||||
{#if !data.live.startedAtUtc}
|
{#if !data.live.startedAtUtc}
|
||||||
|
<form method="POST" action={liveAction('start')} use:enhance={enhanceCommand}>
|
||||||
|
<input type="hidden" name="showId" value={data.live.show.id} />
|
||||||
|
<input type="hidden" name="revision" value={data.live.liveRevision} />
|
||||||
|
<input type="hidden" name="commandId" value={data.commandId} />
|
||||||
|
<button class="secondary-button" type="submit"
|
||||||
|
><AppIcon name="play" /> Sendung starten</button
|
||||||
|
>
|
||||||
|
</form>
|
||||||
<form method="POST" action={liveAction('setStatus')} use:enhance={enhanceCommand}>
|
<form method="POST" action={liveAction('setStatus')} use:enhance={enhanceCommand}>
|
||||||
<input type="hidden" name="showId" value={data.live.show.id} />
|
<input type="hidden" name="showId" value={data.live.show.id} />
|
||||||
<input
|
<input
|
||||||
@@ -627,27 +644,16 @@
|
|||||||
{data.live.show.status === 'ready' ? 'Als Entwurf markieren' : 'Als bereit markieren'}
|
{data.live.show.status === 'ready' ? 'Als Entwurf markieren' : 'Als bereit markieren'}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<form method="POST" action={liveAction('start')} use:enhance={enhanceCommand}>
|
|
||||||
<input type="hidden" name="showId" value={data.live.show.id} />
|
|
||||||
<input type="hidden" name="revision" value={data.live.liveRevision} />
|
|
||||||
<input type="hidden" name="commandId" value={data.commandId} />
|
|
||||||
<button class="secondary-button" type="submit"
|
|
||||||
><AppIcon name="play" /> Sendung starten</button
|
|
||||||
>
|
|
||||||
</form>
|
|
||||||
{:else if data.live.endedAtUtc}
|
{:else if data.live.endedAtUtc}
|
||||||
{#if data.live.show.status === 'completed'}
|
{#if data.live.show.status === 'completed'}
|
||||||
<p class="quiet-copy">Diese Sendung ist historisch abgeschlossen und unveränderlich.</p>
|
<p class="quiet-copy">Diese Sendung ist historisch abgeschlossen.</p>
|
||||||
<a class="secondary-button" href={resolve('/sendungen/[id]', { id: data.live.show.id })}
|
|
||||||
>Historische Sendung öffnen</a
|
|
||||||
>
|
|
||||||
{:else}
|
{:else}
|
||||||
<form method="POST" action={liveAction('resumeEnded')} use:enhance={enhanceCommand}>
|
<form method="POST" action={liveAction('resumeEnded')} use:enhance={enhanceCommand}>
|
||||||
<input type="hidden" name="showId" value={data.live.show.id} />
|
<input type="hidden" name="showId" value={data.live.show.id} />
|
||||||
<input type="hidden" name="revision" value={data.live.liveRevision} />
|
<input type="hidden" name="revision" value={data.live.liveRevision} />
|
||||||
<input type="hidden" name="commandId" value={data.commandId} />
|
<input type="hidden" name="commandId" value={data.commandId} />
|
||||||
<button class="secondary-button" type="submit"
|
<button class="secondary-button" type="submit"
|
||||||
><AppIcon name="play" /> Lauf fortsetzen</button
|
><AppIcon name="play" /> Beendeten Lauf wiederaufnehmen</button
|
||||||
>
|
>
|
||||||
</form>
|
</form>
|
||||||
<form
|
<form
|
||||||
@@ -679,49 +685,19 @@
|
|||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<form
|
{#if needsResume}<form
|
||||||
method="POST"
|
|
||||||
action={liveAction(data.live.isPaused ? 'resume' : 'pause')}
|
|
||||||
use:enhance={enhanceCommand}
|
|
||||||
>
|
|
||||||
<input type="hidden" name="showId" value={data.live.show.id} />
|
|
||||||
<input type="hidden" name="revision" value={data.live.liveRevision} />
|
|
||||||
<input type="hidden" name="commandId" value={data.commandId} />
|
|
||||||
<button class="secondary-button" type="submit">
|
|
||||||
<AppIcon name={data.live.isPaused ? 'play' : 'pause'} />
|
|
||||||
{data.live.isPaused ? 'Fortsetzen' : 'Pausieren'}
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
{#if data.live.sectionTimer && data.live.sectionTimer.plannedDurationSeconds > 0}<form
|
|
||||||
method="POST"
|
method="POST"
|
||||||
action={liveAction('resetSectionTimer')}
|
action={liveAction('start')}
|
||||||
use:enhance={enhanceCommand}
|
use:enhance={enhanceCommand}
|
||||||
onsubmit={(event) => {
|
|
||||||
if (!confirm('Abschnittstimer wirklich zurücksetzen?')) event.preventDefault();
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<input type="hidden" name="showId" value={data.live.show.id} />
|
<input type="hidden" name="showId" value={data.live.show.id} />
|
||||||
<input type="hidden" name="revision" value={data.live.liveRevision} />
|
<input type="hidden" name="revision" value={data.live.liveRevision} />
|
||||||
<input type="hidden" name="commandId" value={data.commandId} />
|
<input type="hidden" name="commandId" value={data.commandId} />
|
||||||
<button class="text-button" type="submit"
|
<button class="secondary-button" type="submit">Live-Stand wiederaufnehmen</button>
|
||||||
><AppIcon name="arrow-rotate-left" /> Abschnittszeit zurücksetzen</button
|
|
||||||
>
|
|
||||||
</form>{/if}
|
</form>{/if}
|
||||||
<form
|
{#if data.live.isPaused}<p class="live-menu-hint">
|
||||||
method="POST"
|
Fortsetzen ist direkt bei der Abschnittszeit erreichbar.
|
||||||
action={liveAction('resetTotalTimer')}
|
</p>{/if}
|
||||||
use:enhance={enhanceCommand}
|
|
||||||
onsubmit={(event) => {
|
|
||||||
if (!confirm('Gesamtzeit wirklich zurücksetzen?')) event.preventDefault();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<input type="hidden" name="showId" value={data.live.show.id} />
|
|
||||||
<input type="hidden" name="revision" value={data.live.liveRevision} />
|
|
||||||
<input type="hidden" name="commandId" value={data.commandId} />
|
|
||||||
<button class="text-button" type="submit"
|
|
||||||
><AppIcon name="timer" /> Gesamtzeit zurücksetzen</button
|
|
||||||
>
|
|
||||||
</form>
|
|
||||||
<form
|
<form
|
||||||
method="POST"
|
method="POST"
|
||||||
action={liveAction('end')}
|
action={liveAction('end')}
|
||||||
@@ -739,20 +715,103 @@
|
|||||||
>
|
>
|
||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
{#if needsResume && !data.live.endedAtUtc}<form
|
|
||||||
method="POST"
|
|
||||||
action={liveAction('start')}
|
|
||||||
use:enhance={enhanceCommand}
|
|
||||||
>
|
|
||||||
<input type="hidden" name="showId" value={data.live.show.id} />
|
|
||||||
<input type="hidden" name="revision" value={data.live.liveRevision} />
|
|
||||||
<input type="hidden" name="commandId" value={data.commandId} />
|
|
||||||
<button class="text-button" type="submit">Live-Stand wiederaufnehmen</button>
|
|
||||||
</form>{/if}
|
|
||||||
<a href={resolve('/sendungen/[id]', { id: data.live.show.id })}
|
|
||||||
>Liveansicht verlassen · Zur Planung</a
|
|
||||||
>
|
|
||||||
</section>
|
</section>
|
||||||
|
<section>
|
||||||
|
<strong>Ansicht</strong>
|
||||||
|
<div class="live-view-controls">
|
||||||
|
<div class="font-control" aria-label="Prompter-Schriftgröße">
|
||||||
|
<button
|
||||||
|
data-menu-initial-focus
|
||||||
|
type="button"
|
||||||
|
onclick={() => changePromptSize(-0.1)}
|
||||||
|
aria-label="Schrift verkleinern">A−</button
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onclick={() => changePromptSize(0.1)}
|
||||||
|
aria-label="Schrift vergrößern">A+</button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="text-button" aria-pressed={!showTimes} onclick={toggleTimes}>
|
||||||
|
{showTimes ? 'Zeiten ausblenden' : 'Zeiten einblenden'}
|
||||||
|
</button>
|
||||||
|
<ThemeToggle />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{#if data.canManageShares}<section>
|
||||||
|
<strong>Teilen</strong>
|
||||||
|
<ShareManagement
|
||||||
|
shows={[{ ...data.live.show, startsAtUtc: null }]}
|
||||||
|
shares={data.shares}
|
||||||
|
fixedShowId={data.live.show.id}
|
||||||
|
{form}
|
||||||
|
/>
|
||||||
|
</section>{/if}
|
||||||
|
<section class="live-output-section">
|
||||||
|
<details class="live-output-settings">
|
||||||
|
<summary>
|
||||||
|
<span><AppIcon name="display" /> Ausgabe einrichten</span>
|
||||||
|
<small
|
||||||
|
>{data.outputStatus === 'connected'
|
||||||
|
? 'Mit dieser Sendung verbunden'
|
||||||
|
: data.outputStatus === 'other_show'
|
||||||
|
? 'Mit einer anderen Sendung verbunden'
|
||||||
|
: 'Nicht verbunden'}</small
|
||||||
|
>
|
||||||
|
<AppIcon name="chevron-right" />
|
||||||
|
</summary>
|
||||||
|
<div class="live-output-settings-body">
|
||||||
|
<p>Der OBS-Ausgabekanal ändert sich erst durch eine der folgenden Aktionen.</p>
|
||||||
|
<form method="POST" action={liveAction('createOutput')} use:enhance={enhanceOutput}>
|
||||||
|
<input type="hidden" name="showId" value={data.live.show.id} />
|
||||||
|
<button class="secondary-button" type="submit">
|
||||||
|
{data.outputStatus === 'connected'
|
||||||
|
? 'Ausgabe öffnen'
|
||||||
|
: 'Mit dieser Sendung verbinden und öffnen'}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
{#if data.outputStatus === 'connected'}
|
||||||
|
<form
|
||||||
|
method="POST"
|
||||||
|
action={liveAction('rotateOutput')}
|
||||||
|
use:enhance={enhanceOutput}
|
||||||
|
onsubmit={(event) => {
|
||||||
|
if (
|
||||||
|
!confirm(
|
||||||
|
'Schlüssel erneuern? Bereits eingerichtete OBS-Quellen verlieren den Zugriff.'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
event.preventDefault();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<input type="hidden" name="showId" value={data.live.show.id} />
|
||||||
|
<button class="text-button" type="submit">Schlüssel erneuern</button>
|
||||||
|
</form>
|
||||||
|
<form
|
||||||
|
method="POST"
|
||||||
|
action={liveAction('clearOutput')}
|
||||||
|
use:enhance={enhanceCommand}
|
||||||
|
onsubmit={(event) => {
|
||||||
|
if (
|
||||||
|
!confirm(
|
||||||
|
'Ausgabekanal trennen? Verbundene Browserquellen zeigen anschließend keine Sendung.'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
event.preventDefault();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<button class="text-button danger-text" type="submit">Kanal trennen</button>
|
||||||
|
</form>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</section>
|
||||||
|
<nav class="live-menu-navigation" aria-label="Liveansicht verlassen">
|
||||||
|
<a href={resolve('/sendungen/[id]', { id: data.live.show.id })}
|
||||||
|
><AppIcon name="arrow-left" /> Zur Planung</a
|
||||||
|
>
|
||||||
|
<small>Die Sendung und öffentliche Ausgabe laufen unverändert weiter.</small>
|
||||||
|
</nav>
|
||||||
</div>{/if}
|
</div>{/if}
|
||||||
|
|
||||||
<div class="live-messages">
|
<div class="live-messages">
|
||||||
|
|||||||
@@ -8,13 +8,26 @@ import {
|
|||||||
validEmail
|
validEmail
|
||||||
} from '#lib/server/auth.js';
|
} from '#lib/server/auth.js';
|
||||||
|
|
||||||
export const load: PageServerLoad = ({ locals }) => {
|
function safeReturnTo(value: string | null): string {
|
||||||
|
if (!value || value.length > 4000) return '/fundus';
|
||||||
|
try {
|
||||||
|
const target = new URL(value, 'http://sendewerk.local');
|
||||||
|
if (target.origin === 'http://sendewerk.local' && target.pathname === '/oauth/authorize') {
|
||||||
|
return `${target.pathname}${target.search}`;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Fall back to the normal authenticated landing page.
|
||||||
|
}
|
||||||
|
return '/fundus';
|
||||||
|
}
|
||||||
|
|
||||||
|
export const load: PageServerLoad = ({ locals, url }) => {
|
||||||
if (!hasUsers()) redirect(303, '/setup');
|
if (!hasUsers()) redirect(303, '/setup');
|
||||||
if (locals.user) redirect(303, '/fundus');
|
if (locals.user) redirect(303, safeReturnTo(url.searchParams.get('returnTo')));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
default: async ({ request, cookies, getClientAddress }) => {
|
default: async ({ request, cookies, getClientAddress, url }) => {
|
||||||
const data = await request.formData();
|
const data = await request.formData();
|
||||||
const email = String(data.get('email') || '').trim();
|
const email = String(data.get('email') || '').trim();
|
||||||
const password = String(data.get('password') || '');
|
const password = String(data.get('password') || '');
|
||||||
@@ -31,6 +44,6 @@ export const actions = {
|
|||||||
const user = await authenticate(email, password);
|
const user = await authenticate(email, password);
|
||||||
if (!user) return fail(400, { email, error: 'E-Mail oder Passwort ist nicht korrekt.' });
|
if (!user) return fail(400, { email, error: 'E-Mail oder Passwort ist nicht korrekt.' });
|
||||||
createSession(user.id, cookies);
|
createSession(user.id, cookies);
|
||||||
redirect(303, '/fundus');
|
redirect(303, safeReturnTo(url.searchParams.get('returnTo')));
|
||||||
}
|
}
|
||||||
} satisfies Actions;
|
} satisfies Actions;
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
import { json, text } from '@sveltejs/kit';
|
||||||
|
import type { RequestHandler } from './$types';
|
||||||
|
import { handleMcpRequest, validJsonRpcRequest } from '#lib/server/mcp.js';
|
||||||
|
import { getAuthConfig } from '#lib/server/config.js';
|
||||||
|
import {
|
||||||
|
authenticateOAuth,
|
||||||
|
MCP_SCOPE,
|
||||||
|
OAuthError,
|
||||||
|
protectedResourceMetadataUrl
|
||||||
|
} from '#lib/server/oauth.js';
|
||||||
|
|
||||||
|
const MODERN_VERSION = '2026-07-28';
|
||||||
|
const supportedProtocolVersions = [MODERN_VERSION, '2025-11-25', '2025-06-18', '2025-03-26'];
|
||||||
|
|
||||||
|
function challenge(errorCode?: string) {
|
||||||
|
const fields = [`resource_metadata="${protectedResourceMetadataUrl()}"`, `scope="${MCP_SCOPE}"`];
|
||||||
|
if (errorCode) fields.push(`error="${errorCode}"`);
|
||||||
|
return `Bearer ${fields.join(', ')}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function authenticate(request: Request) {
|
||||||
|
try {
|
||||||
|
return authenticateOAuth(request);
|
||||||
|
} catch (cause) {
|
||||||
|
if (cause instanceof OAuthError) {
|
||||||
|
const headers: Record<string, string> = { 'Cache-Control': 'no-store' };
|
||||||
|
if (cause.status === 401) headers['WWW-Authenticate'] = challenge(cause.code);
|
||||||
|
return json(
|
||||||
|
{ error: cause.code, error_description: cause.message },
|
||||||
|
{ status: cause.status, headers }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
throw cause;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function originAllowed(request: Request): boolean {
|
||||||
|
const origin = request.headers.get('origin');
|
||||||
|
return !origin || origin === getAuthConfig().origin.origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
function protocolError(id: string | number | null, code: number, message: string, data?: unknown) {
|
||||||
|
return {
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
id,
|
||||||
|
error: { code, message, ...(data === undefined ? {} : { data }) }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function modernValidation(
|
||||||
|
request: Request,
|
||||||
|
body: {
|
||||||
|
id?: string | number | null;
|
||||||
|
method: string;
|
||||||
|
params?: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
): Response | null {
|
||||||
|
const id = typeof body.id === 'string' || typeof body.id === 'number' ? body.id : null;
|
||||||
|
const metadata = body.params?._meta;
|
||||||
|
if (!metadata || typeof metadata !== 'object' || Array.isArray(metadata)) {
|
||||||
|
return json(protocolError(id, -32602, 'Required MCP request metadata is missing.'), {
|
||||||
|
status: 400
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const meta = metadata as Record<string, unknown>;
|
||||||
|
const bodyVersion = meta['io.modelcontextprotocol/protocolVersion'];
|
||||||
|
if (typeof bodyVersion !== 'string' || !supportedProtocolVersions.includes(bodyVersion)) {
|
||||||
|
return json(
|
||||||
|
protocolError(id, -32022, 'Unsupported protocol version', {
|
||||||
|
supported: supportedProtocolVersions,
|
||||||
|
requested: bodyVersion ?? null
|
||||||
|
}),
|
||||||
|
{ status: 400 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
request.headers.get('mcp-protocol-version') !== bodyVersion ||
|
||||||
|
request.headers.get('mcp-method') !== body.method ||
|
||||||
|
(body.method === 'tools/call' && request.headers.get('mcp-name') !== body.params?.name)
|
||||||
|
) {
|
||||||
|
return json(protocolError(id, -32020, 'MCP request headers do not match the body.'), {
|
||||||
|
status: 400
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const capabilities = meta['io.modelcontextprotocol/clientCapabilities'];
|
||||||
|
if (
|
||||||
|
body.id === null ||
|
||||||
|
!capabilities ||
|
||||||
|
typeof capabilities !== 'object' ||
|
||||||
|
Array.isArray(capabilities)
|
||||||
|
) {
|
||||||
|
return json(protocolError(id, -32602, 'Required MCP request metadata is invalid.'), {
|
||||||
|
status: 400
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const POST: RequestHandler = async ({ request }) => {
|
||||||
|
if (!originAllowed(request)) return text('Forbidden', { status: 403 });
|
||||||
|
const authenticated = authenticate(request);
|
||||||
|
if (authenticated instanceof Response) return authenticated;
|
||||||
|
if (!request.headers.get('content-type')?.toLowerCase().startsWith('application/json')) {
|
||||||
|
return text('JSON wird erwartet.', { status: 415 });
|
||||||
|
}
|
||||||
|
let body: unknown;
|
||||||
|
try {
|
||||||
|
body = await request.json();
|
||||||
|
} catch {
|
||||||
|
return json({ jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error' } });
|
||||||
|
}
|
||||||
|
if (!validJsonRpcRequest(body)) {
|
||||||
|
return json({ jsonrpc: '2.0', id: null, error: { code: -32600, message: 'Invalid Request' } });
|
||||||
|
}
|
||||||
|
const metadata = body.params?._meta;
|
||||||
|
const bodyVersion =
|
||||||
|
metadata && typeof metadata === 'object' && !Array.isArray(metadata)
|
||||||
|
? (metadata as Record<string, unknown>)['io.modelcontextprotocol/protocolVersion']
|
||||||
|
: undefined;
|
||||||
|
const headerVersion = request.headers.get('mcp-protocol-version');
|
||||||
|
const modern = headerVersion === MODERN_VERSION || bodyVersion === MODERN_VERSION;
|
||||||
|
if (modern) {
|
||||||
|
const validationFailure = modernValidation(request, body);
|
||||||
|
if (validationFailure) return validationFailure;
|
||||||
|
} else if (headerVersion && !supportedProtocolVersions.includes(headerVersion)) {
|
||||||
|
return json(
|
||||||
|
protocolError(body.id ?? null, -32022, 'Unsupported protocol version', {
|
||||||
|
supported: supportedProtocolVersions,
|
||||||
|
requested: headerVersion
|
||||||
|
}),
|
||||||
|
{ status: 400 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (body.id === undefined) return new Response(null, { status: 202 });
|
||||||
|
const response = handleMcpRequest(body, authenticated);
|
||||||
|
const status = modern && 'error' in response && response.error?.code === -32601 ? 404 : 200;
|
||||||
|
return json(response, {
|
||||||
|
status,
|
||||||
|
headers: { 'Cache-Control': 'no-store' }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const GET: RequestHandler = ({ request }) => {
|
||||||
|
if (!originAllowed(request)) return text('Forbidden', { status: 403 });
|
||||||
|
const authenticated = authenticate(request);
|
||||||
|
if (authenticated instanceof Response) return authenticated;
|
||||||
|
return text('Dieser MCP-Endpunkt bietet keinen serverseitigen Ereignisstrom.', {
|
||||||
|
status: 405,
|
||||||
|
headers: { Allow: 'POST' }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DELETE: RequestHandler = () =>
|
||||||
|
text('Method Not Allowed', { status: 405, headers: { Allow: 'POST' } });
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import { error, redirect } from '@sveltejs/kit';
|
||||||
|
import type { Actions, PageServerLoad } from './$types';
|
||||||
|
import {
|
||||||
|
authorizationErrorRedirect,
|
||||||
|
authorizationRedirect,
|
||||||
|
createAuthorizationCode,
|
||||||
|
OAuthError,
|
||||||
|
parseAuthorizationRequest
|
||||||
|
} from '#lib/server/oauth.js';
|
||||||
|
|
||||||
|
function authorization(url: URL) {
|
||||||
|
try {
|
||||||
|
return parseAuthorizationRequest(url);
|
||||||
|
} catch (cause) {
|
||||||
|
if (cause instanceof OAuthError) {
|
||||||
|
const target = authorizationErrorRedirect(url, cause);
|
||||||
|
if (target) redirect(303, target, { external: true });
|
||||||
|
error(cause.status, cause.message);
|
||||||
|
}
|
||||||
|
throw cause;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const load: PageServerLoad = ({ locals, url }) => {
|
||||||
|
const request = authorization(url);
|
||||||
|
if (!locals.user) {
|
||||||
|
const returnTo = `${url.pathname}${url.search}`;
|
||||||
|
redirect(303, `/login?returnTo=${encodeURIComponent(returnTo)}`);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
clientName: request.client.name,
|
||||||
|
redirectHost: new URL(request.redirectUri).host,
|
||||||
|
scope: request.scope,
|
||||||
|
user: locals.user
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const actions = {
|
||||||
|
default: ({ request: browserRequest, locals, url }) => {
|
||||||
|
if (!locals.user)
|
||||||
|
redirect(303, `/login?returnTo=${encodeURIComponent(`${url.pathname}${url.search}`)}`);
|
||||||
|
const oauthRequest = authorization(url);
|
||||||
|
return browserRequest.formData().then((data) => {
|
||||||
|
if (data.get('decision') !== 'approve') {
|
||||||
|
redirect(303, authorizationRedirect(oauthRequest, { error: 'access_denied' }), {
|
||||||
|
external: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const code = createAuthorizationCode(oauthRequest, locals.user!);
|
||||||
|
redirect(303, authorizationRedirect(oauthRequest, { code }), { external: true });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} satisfies Actions;
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import type { PageProps } from './$types';
|
||||||
|
let { data }: PageProps = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head><title>Zugriff erlauben | Sendewerk</title></svelte:head>
|
||||||
|
|
||||||
|
<section class="auth-card oauth-consent">
|
||||||
|
<p class="eyebrow">Externe Verbindung</p>
|
||||||
|
<h1>{data.clientName} verbinden?</h1>
|
||||||
|
<p>
|
||||||
|
Die Anwendung erhält im Namen von <strong>{data.user.displayName}</strong> lesenden Zugriff auf redaktionelle
|
||||||
|
Pieces, Sendungen und Abläufe. Dazu gehören auch private Recherche, Moderationsnotizen, Quellen und
|
||||||
|
die Reservebank.
|
||||||
|
</p>
|
||||||
|
<div class="oauth-permission">
|
||||||
|
<strong>Nur lesen</strong>
|
||||||
|
<span>Keine Inhalte anlegen, ändern, einplanen oder archivieren.</span>
|
||||||
|
</div>
|
||||||
|
<p class="oauth-redirect">
|
||||||
|
<strong>Nicht verifizierter OAuth-Client.</strong> Nach Zustimmung erfolgt der Rücksprung zu
|
||||||
|
<code>{data.redirectHost}</code>.
|
||||||
|
</p>
|
||||||
|
<form class="oauth-actions" method="POST">
|
||||||
|
<button class="secondary-button" type="submit" name="decision" value="deny">Ablehnen</button>
|
||||||
|
<button class="primary-button" type="submit" name="decision" value="approve">
|
||||||
|
Zugriff erlauben
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { json } from '@sveltejs/kit';
|
||||||
|
import type { RequestHandler } from './$types';
|
||||||
|
import { OAuthError, registerOAuthClient, reserveOAuthAttempt } from '#lib/server/oauth.js';
|
||||||
|
|
||||||
|
export const POST: RequestHandler = async ({ request, getClientAddress }) => {
|
||||||
|
try {
|
||||||
|
if (!reserveOAuthAttempt('registration', getClientAddress())) {
|
||||||
|
throw new OAuthError('temporarily_unavailable', 'Zu viele Registrierungsversuche.', 429);
|
||||||
|
}
|
||||||
|
if (!request.headers.get('content-type')?.toLowerCase().startsWith('application/json')) {
|
||||||
|
throw new OAuthError('invalid_client_metadata', 'JSON wird erwartet.');
|
||||||
|
}
|
||||||
|
const client = registerOAuthClient(await request.json());
|
||||||
|
return json(
|
||||||
|
{
|
||||||
|
client_id: client.id,
|
||||||
|
client_id_issued_at: Math.floor(Date.now() / 1000),
|
||||||
|
client_name: client.name,
|
||||||
|
redirect_uris: client.redirectUris,
|
||||||
|
grant_types: ['authorization_code'],
|
||||||
|
response_types: ['code'],
|
||||||
|
token_endpoint_auth_method: 'none'
|
||||||
|
},
|
||||||
|
{ status: 201, headers: { 'Cache-Control': 'no-store' } }
|
||||||
|
);
|
||||||
|
} catch (cause) {
|
||||||
|
const problem =
|
||||||
|
cause instanceof OAuthError
|
||||||
|
? cause
|
||||||
|
: new OAuthError('invalid_client_metadata', 'Ungültige Client-Metadaten.');
|
||||||
|
return json(
|
||||||
|
{ error: problem.code, error_description: problem.message },
|
||||||
|
{ status: problem.status, headers: { 'Cache-Control': 'no-store' } }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { text } from '@sveltejs/kit';
|
||||||
|
import type { RequestHandler } from './$types';
|
||||||
|
import { revokeOAuthToken } from '#lib/server/oauth.js';
|
||||||
|
|
||||||
|
export const POST: RequestHandler = async ({ request }) => {
|
||||||
|
if (
|
||||||
|
request.headers
|
||||||
|
.get('content-type')
|
||||||
|
?.toLowerCase()
|
||||||
|
.startsWith('application/x-www-form-urlencoded')
|
||||||
|
) {
|
||||||
|
const data = await request.formData();
|
||||||
|
revokeOAuthToken(String(data.get('token') ?? ''), String(data.get('client_id') ?? ''));
|
||||||
|
}
|
||||||
|
return text('', { headers: { 'Cache-Control': 'no-store' } });
|
||||||
|
};
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import { json } from '@sveltejs/kit';
|
||||||
|
import type { RequestHandler } from './$types';
|
||||||
|
import {
|
||||||
|
exchangeAuthorizationCode,
|
||||||
|
oauthTokenDurationSeconds,
|
||||||
|
OAuthError,
|
||||||
|
reserveOAuthAttempt
|
||||||
|
} from '#lib/server/oauth.js';
|
||||||
|
|
||||||
|
function failure(cause: unknown) {
|
||||||
|
const problem =
|
||||||
|
cause instanceof OAuthError
|
||||||
|
? cause
|
||||||
|
: new OAuthError('invalid_request', 'Ungültige Token-Anfrage.');
|
||||||
|
return json(
|
||||||
|
{ error: problem.code, error_description: problem.message },
|
||||||
|
{ status: problem.status, headers: { 'Cache-Control': 'no-store', Pragma: 'no-cache' } }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const POST: RequestHandler = async ({ request, getClientAddress }) => {
|
||||||
|
try {
|
||||||
|
if (!reserveOAuthAttempt('token', getClientAddress())) {
|
||||||
|
throw new OAuthError('temporarily_unavailable', 'Zu viele Token-Anfragen.', 429);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!request.headers
|
||||||
|
.get('content-type')
|
||||||
|
?.toLowerCase()
|
||||||
|
.startsWith('application/x-www-form-urlencoded')
|
||||||
|
) {
|
||||||
|
throw new OAuthError('invalid_request', 'Formulardaten werden erwartet.');
|
||||||
|
}
|
||||||
|
const data = await request.formData();
|
||||||
|
if (data.get('grant_type') !== 'authorization_code') {
|
||||||
|
throw new OAuthError('unsupported_grant_type', 'Nur Authorization Code wird unterstützt.');
|
||||||
|
}
|
||||||
|
const result = exchangeAuthorizationCode({
|
||||||
|
code: String(data.get('code') ?? ''),
|
||||||
|
clientId: String(data.get('client_id') ?? ''),
|
||||||
|
redirectUri: String(data.get('redirect_uri') ?? ''),
|
||||||
|
codeVerifier: String(data.get('code_verifier') ?? ''),
|
||||||
|
resource: String(data.get('resource') ?? '')
|
||||||
|
});
|
||||||
|
return json(
|
||||||
|
{
|
||||||
|
access_token: result.accessToken,
|
||||||
|
token_type: 'Bearer',
|
||||||
|
expires_in: oauthTokenDurationSeconds(),
|
||||||
|
scope: result.scope
|
||||||
|
},
|
||||||
|
{ headers: { 'Cache-Control': 'no-store', Pragma: 'no-cache' } }
|
||||||
|
);
|
||||||
|
} catch (cause) {
|
||||||
|
return failure(cause);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -22,7 +22,8 @@ import { deleteFeedSource, fetchFeed, listFeedSources, saveFeedSource } from '#l
|
|||||||
import {
|
import {
|
||||||
createTechnicalAccess,
|
createTechnicalAccess,
|
||||||
listTechnicalAccesses,
|
listTechnicalAccesses,
|
||||||
revokeTechnicalAccess
|
revokeTechnicalAccess,
|
||||||
|
updateTechnicalAccess
|
||||||
} from '#lib/server/technical-access.js';
|
} from '#lib/server/technical-access.js';
|
||||||
import {
|
import {
|
||||||
inviteUser,
|
inviteUser,
|
||||||
@@ -343,6 +344,21 @@ export const actions = {
|
|||||||
return fail(400, { intent: 'technicalAccess', error: actionError(cause) });
|
return fail(400, { intent: 'technicalAccess', error: actionError(cause) });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
updateTechnicalAccess: async ({ locals, request }) => {
|
||||||
|
const actor = requireBarkeeper(locals.user);
|
||||||
|
const data = await request.formData();
|
||||||
|
try {
|
||||||
|
updateTechnicalAccess(
|
||||||
|
actor,
|
||||||
|
String(data.get('accessId') || ''),
|
||||||
|
String(data.get('name') || ''),
|
||||||
|
String(data.get('permissions') || '')
|
||||||
|
);
|
||||||
|
return { intent: 'technicalAccess', success: 'Technischer Zugang aktualisiert.' };
|
||||||
|
} catch (cause) {
|
||||||
|
return fail(400, { intent: 'technicalAccess', error: actionError(cause) });
|
||||||
|
}
|
||||||
|
},
|
||||||
revokeTechnicalAccess: async ({ locals, request }) => {
|
revokeTechnicalAccess: async ({ locals, request }) => {
|
||||||
const actor = requireBarkeeper(locals.user);
|
const actor = requireBarkeeper(locals.user);
|
||||||
const data = await request.formData();
|
const data = await request.formData();
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import AppIcon from '#lib/components/AppIcon.svelte';
|
import AppIcon from '#lib/components/AppIcon.svelte';
|
||||||
|
import FeedEditorDialog from '#lib/components/FeedEditorDialog.svelte';
|
||||||
import IconPicker from '#lib/components/IconPicker.svelte';
|
import IconPicker from '#lib/components/IconPicker.svelte';
|
||||||
import ShareManagement from '#lib/components/ShareManagement.svelte';
|
import ShareManagement from '#lib/components/ShareManagement.svelte';
|
||||||
|
import TechnicalAccessDialog from '#lib/components/TechnicalAccessDialog.svelte';
|
||||||
import ToolEditorDialog from '#lib/components/ToolEditorDialog.svelte';
|
import ToolEditorDialog from '#lib/components/ToolEditorDialog.svelte';
|
||||||
import type { PageProps } from './$types';
|
import type { PageProps } from './$types';
|
||||||
let { data, form }: PageProps = $props();
|
let { data, form }: PageProps = $props();
|
||||||
let toolDialog: { showModal: (tool?: (typeof data.tools)[number] | null) => void };
|
let toolDialog: { showModal: (tool?: (typeof data.tools)[number] | null) => void };
|
||||||
|
let feedDialog: { showModal: (feed?: (typeof data.feeds)[number] | null) => void };
|
||||||
|
let technicalAccessDialog: {
|
||||||
|
showModal: (access?: (typeof data.technicalAccesses)[number] | null) => void;
|
||||||
|
};
|
||||||
|
let managementIntent = $derived(form?.intent?.toLowerCase() ?? '');
|
||||||
|
|
||||||
function confirmTaxonomyRemoval(event: SubmitEvent) {
|
function confirmTaxonomyRemoval(event: SubmitEvent) {
|
||||||
if (!confirm('Eintrag wirklich entfernen?')) event.preventDefault();
|
if (!confirm('Eintrag wirklich entfernen?')) event.preventDefault();
|
||||||
@@ -20,124 +27,60 @@
|
|||||||
<h1>Verwaltung</h1>
|
<h1>Verwaltung</h1>
|
||||||
<p class="page-intro">Konten, Werkzeuge und bestehende Taxonomie verwalten.</p>
|
<p class="page-intro">Konten, Werkzeuge und bestehende Taxonomie verwalten.</p>
|
||||||
</header>
|
</header>
|
||||||
{#if form?.error && !form.intent?.toLowerCase().includes('share')}<div
|
{#if form?.error && !['share', 'technicalaccess'].some( (intent) => managementIntent.includes(intent) )}<div
|
||||||
class="form-message error"
|
class="form-message error"
|
||||||
role="alert"
|
role="alert"
|
||||||
>
|
>
|
||||||
{form.error}
|
{form.error}
|
||||||
</div>{/if}
|
</div>{/if}
|
||||||
{#if form?.success && !form.intent?.toLowerCase().includes('share')}<div
|
{#if form?.success && !['share', 'technicalaccess'].some( (intent) => managementIntent.includes(intent) )}<div
|
||||||
class="form-message success"
|
class="form-message success"
|
||||||
role="status"
|
role="status"
|
||||||
>
|
>
|
||||||
{form.success}
|
{form.success}
|
||||||
</div>{/if}
|
</div>{/if}
|
||||||
<h2 class="section-heading">Schnittstellen</h2>
|
<h2 class="section-heading">Schnittstellen</h2>
|
||||||
<section class="quiet-panel integration-panel">
|
<section class="quiet-panel integration-catalog">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div>
|
<div>
|
||||||
<p class="eyebrow">Import</p>
|
<p class="eyebrow">Import</p>
|
||||||
<h2>RSS-Feeds</h2>
|
<h2>RSS-Feeds</h2>
|
||||||
</div>
|
</div>
|
||||||
<span>{data.feeds.length} eingerichtet</span>
|
<button class="compact-add-button" type="button" onclick={() => feedDialog.showModal()}>
|
||||||
|
<AppIcon name="plus" /> Feed hinzufügen
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p class="catalog-note">
|
||||||
Aktive Feeds werden im gewählten Intervall abgerufen. Beiträge landen zuerst separat im
|
Aktive Feeds werden im gewählten Intervall abgerufen. Beiträge landen zuerst separat im
|
||||||
Eingang.
|
Eingang.
|
||||||
</p>
|
</p>
|
||||||
<details class="integration-create">
|
<div class="catalog-settings-list integration-settings-list">
|
||||||
<summary class="compact-add-button"><AppIcon name="plus" /> Feed hinzufügen</summary>
|
|
||||||
<form class="integration-form" method="POST" action="?/saveFeed">
|
|
||||||
<label>Name<input name="name" required maxlength="120" /></label>
|
|
||||||
<label
|
|
||||||
>Feed-URL<input
|
|
||||||
name="url"
|
|
||||||
type="url"
|
|
||||||
required
|
|
||||||
maxlength="2000"
|
|
||||||
placeholder="https://example.org/feed.xml"
|
|
||||||
/></label
|
|
||||||
>
|
|
||||||
<label
|
|
||||||
>Intervall in Minuten<input
|
|
||||||
name="refreshIntervalMinutes"
|
|
||||||
type="number"
|
|
||||||
min="15"
|
|
||||||
max="10080"
|
|
||||||
value="60"
|
|
||||||
required
|
|
||||||
/></label
|
|
||||||
>
|
|
||||||
<label
|
|
||||||
>Standardkategorie<select name="defaultCategoryId"
|
|
||||||
><option value="">Keine</option
|
|
||||||
>{#each data.taxonomy.categories as category (category.id)}<option value={category.id}
|
|
||||||
>{category.name}</option
|
|
||||||
>{/each}</select
|
|
||||||
></label
|
|
||||||
>
|
|
||||||
<label class="check-row"
|
|
||||||
><input type="checkbox" name="isEnabled" value="1" checked /> Automatisch abrufen</label
|
|
||||||
>
|
|
||||||
<button class="primary-button" type="submit">Feed anlegen</button>
|
|
||||||
</form>
|
|
||||||
</details>
|
|
||||||
<div class="integration-list">
|
|
||||||
{#each data.feeds as feed (feed.id)}
|
{#each data.feeds as feed (feed.id)}
|
||||||
<details>
|
<article class:inactive={!feed.isEnabled} class="catalog-setting-row">
|
||||||
<summary
|
<button
|
||||||
><span
|
class="catalog-entry-main"
|
||||||
><strong>{feed.name}</strong><small
|
type="button"
|
||||||
|
aria-label={`${feed.name} bearbeiten`}
|
||||||
|
onclick={() => feedDialog.showModal(feed)}
|
||||||
|
>
|
||||||
|
<span class="catalog-entry-icon"><AppIcon name="rss" /></span>
|
||||||
|
<span class="catalog-entry-copy">
|
||||||
|
<strong>{feed.name}</strong>
|
||||||
|
<small
|
||||||
>{feed.lastError
|
>{feed.lastError
|
||||||
? `Fehler: ${feed.lastError}`
|
? `Fehler: ${feed.lastError}`
|
||||||
: feed.lastFetchedAtUtc
|
: feed.lastFetchedAtUtc
|
||||||
? `Zuletzt: ${new Date(feed.lastFetchedAtUtc).toLocaleString('de-DE')}`
|
? `Zuletzt ${new Date(feed.lastFetchedAtUtc).toLocaleString('de-DE')}`
|
||||||
: 'Noch nicht abgerufen'}</small
|
: 'Noch nicht abgerufen'} · {feed.isEnabled ? 'Automatisch' : 'Pausiert'}</small
|
||||||
></span
|
>
|
||||||
><AppIcon name="pen" /></summary
|
</span>
|
||||||
>
|
<AppIcon name="pen" />
|
||||||
<form class="integration-form" method="POST" action="?/saveFeed">
|
</button>
|
||||||
<input type="hidden" name="feedId" value={feed.id} />
|
<div class="catalog-entry-actions">
|
||||||
<label>Name<input name="name" required maxlength="120" value={feed.name} /></label>
|
|
||||||
<label
|
|
||||||
>Feed-URL<input
|
|
||||||
name="url"
|
|
||||||
type="url"
|
|
||||||
required
|
|
||||||
maxlength="2000"
|
|
||||||
value={feed.url}
|
|
||||||
/></label
|
|
||||||
>
|
|
||||||
<label
|
|
||||||
>Intervall in Minuten<input
|
|
||||||
name="refreshIntervalMinutes"
|
|
||||||
type="number"
|
|
||||||
min="15"
|
|
||||||
max="10080"
|
|
||||||
value={feed.refreshIntervalMinutes}
|
|
||||||
required
|
|
||||||
/></label
|
|
||||||
>
|
|
||||||
<label
|
|
||||||
>Standardkategorie<select name="defaultCategoryId"
|
|
||||||
><option value="">Keine</option
|
|
||||||
>{#each data.taxonomy.categories as category (category.id)}<option
|
|
||||||
value={category.id}
|
|
||||||
selected={feed.defaultCategoryId === category.id}>{category.name}</option
|
|
||||||
>{/each}</select
|
|
||||||
></label
|
|
||||||
>
|
|
||||||
<label class="check-row"
|
|
||||||
><input type="checkbox" name="isEnabled" value="1" checked={feed.isEnabled} /> Automatisch
|
|
||||||
abrufen</label
|
|
||||||
>
|
|
||||||
<button class="secondary-button" type="submit">Speichern</button>
|
|
||||||
</form>
|
|
||||||
<div class="row-actions">
|
|
||||||
<form method="POST" action="?/fetchFeed">
|
<form method="POST" action="?/fetchFeed">
|
||||||
<input type="hidden" name="feedId" value={feed.id} /><button
|
<input type="hidden" name="feedId" value={feed.id} />
|
||||||
class="text-button"
|
<button type="submit" aria-label={`${feed.name} jetzt abrufen`} title="Jetzt abrufen"
|
||||||
type="submit">Jetzt abrufen</button
|
><AppIcon name="arrow-rotate-right" /></button
|
||||||
>
|
>
|
||||||
</form>
|
</form>
|
||||||
<form
|
<form
|
||||||
@@ -146,74 +89,82 @@
|
|||||||
onsubmit={(event) =>
|
onsubmit={(event) =>
|
||||||
!confirm('Feed und seinen Importeingang löschen?') && event.preventDefault()}
|
!confirm('Feed und seinen Importeingang löschen?') && event.preventDefault()}
|
||||||
>
|
>
|
||||||
<input type="hidden" name="feedId" value={feed.id} /><button
|
<input type="hidden" name="feedId" value={feed.id} />
|
||||||
class="text-button danger-text"
|
<button
|
||||||
type="submit">Feed löschen</button
|
class="danger-text"
|
||||||
|
type="submit"
|
||||||
|
aria-label={`${feed.name} löschen`}
|
||||||
|
title="Feed löschen"><AppIcon name="trash" /></button
|
||||||
>
|
>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</article>
|
||||||
{/each}
|
{/each}
|
||||||
|
{#if !data.feeds.length}<p class="empty-copy">Noch keine RSS-Feeds eingerichtet.</p>{/if}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<FeedEditorDialog bind:this={feedDialog} categories={data.taxonomy.categories} />
|
||||||
|
|
||||||
<section class="quiet-panel integration-panel">
|
<section class="quiet-panel integration-catalog">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div>
|
<div>
|
||||||
<p class="eyebrow">Externe Assistenz</p>
|
<p class="eyebrow">Externe Assistenz</p>
|
||||||
<h2>Technische Zugänge</h2>
|
<h2>Technische Zugänge</h2>
|
||||||
</div>
|
</div>
|
||||||
<a href={resolve('/api/v1/openapi.json')} target="_blank">OpenAPI</a>
|
<button
|
||||||
|
class="compact-add-button"
|
||||||
|
type="button"
|
||||||
|
onclick={() => technicalAccessDialog.showModal()}
|
||||||
|
>
|
||||||
|
<AppIcon name="plus" /> Zugang hinzufügen
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p class="catalog-note">
|
||||||
Tokens gelten ausschließlich für die API. Schreibende Aufrufe werden protokolliert und müssen
|
Tokens gelten ausschließlich für die API. Schreibende Aufrufe werden protokolliert und müssen
|
||||||
idempotent sein.
|
idempotent sein. <a href={resolve('/api/v1/openapi.json')} target="_blank">OpenAPI öffnen</a>
|
||||||
</p>
|
</p>
|
||||||
{#if form?.technicalToken}<div class="token-reveal" role="status">
|
<div class="catalog-settings-list integration-settings-list">
|
||||||
<strong>Token, einmalig sichtbar</strong><code>{form.technicalToken}</code>
|
|
||||||
</div>{/if}
|
|
||||||
<details class="integration-create">
|
|
||||||
<summary class="compact-add-button"><AppIcon name="plus" /> Zugang hinzufügen</summary>
|
|
||||||
<form class="integration-form" method="POST" action="?/createTechnicalAccess">
|
|
||||||
<label
|
|
||||||
>Name<input
|
|
||||||
name="name"
|
|
||||||
required
|
|
||||||
maxlength="120"
|
|
||||||
placeholder="Redaktionsassistenz"
|
|
||||||
/></label
|
|
||||||
>
|
|
||||||
<label
|
|
||||||
>Berechtigung<select name="permissions"
|
|
||||||
><option value="read">Nur lesen</option><option value="read_write"
|
|
||||||
>Lesen und schreiben</option
|
|
||||||
></select
|
|
||||||
></label
|
|
||||||
>
|
|
||||||
<button class="primary-button" type="submit">Zugang anlegen</button>
|
|
||||||
</form>
|
|
||||||
</details>
|
|
||||||
<div class="integration-list">
|
|
||||||
{#each data.technicalAccesses as access (access.id)}
|
{#each data.technicalAccesses as access (access.id)}
|
||||||
<div class="access-row">
|
<article class:inactive={Boolean(access.revokedAtUtc)} class="catalog-setting-row">
|
||||||
<span
|
<button
|
||||||
><strong>{access.name}</strong><small
|
class="catalog-entry-main"
|
||||||
>{access.permissions === 'read' ? 'Nur lesen' : 'Lesen und schreiben'} · {access.revokedAtUtc
|
type="button"
|
||||||
? 'Widerrufen'
|
disabled={Boolean(access.revokedAtUtc)}
|
||||||
: access.lastUsedAtUtc
|
aria-label={`${access.name} bearbeiten`}
|
||||||
? `Zuletzt genutzt ${new Date(access.lastUsedAtUtc).toLocaleString('de-DE')}`
|
onclick={() => technicalAccessDialog.showModal(access)}
|
||||||
: 'Noch nicht genutzt'}</small
|
>
|
||||||
></span
|
<span class="catalog-entry-icon"><AppIcon name="key" /></span>
|
||||||
>{#if !access.revokedAtUtc}<form method="POST" action="?/revokeTechnicalAccess">
|
<span class="catalog-entry-copy">
|
||||||
<input type="hidden" name="accessId" value={access.id} /><button
|
<strong>{access.name}</strong>
|
||||||
class="secondary-button"
|
<small
|
||||||
type="submit">Widerrufen</button
|
>{access.permissions === 'read' ? 'Nur lesen' : 'Lesen und schreiben'} · {access.revokedAtUtc
|
||||||
|
? 'Widerrufen'
|
||||||
|
: access.lastUsedAtUtc
|
||||||
|
? `Zuletzt genutzt ${new Date(access.lastUsedAtUtc).toLocaleString('de-DE')}`
|
||||||
|
: 'Noch nicht genutzt'}</small
|
||||||
>
|
>
|
||||||
</form>{/if}
|
</span>
|
||||||
</div>
|
{#if !access.revokedAtUtc}<AppIcon name="pen" />{/if}
|
||||||
|
</button>
|
||||||
|
{#if !access.revokedAtUtc}<div class="catalog-entry-actions">
|
||||||
|
<form method="POST" action="?/revokeTechnicalAccess">
|
||||||
|
<input type="hidden" name="accessId" value={access.id} />
|
||||||
|
<button
|
||||||
|
class="danger-text"
|
||||||
|
type="submit"
|
||||||
|
aria-label={`${access.name} widerrufen`}
|
||||||
|
title="Zugang widerrufen"><AppIcon name="ban" /></button
|
||||||
|
>
|
||||||
|
</form>
|
||||||
|
</div>{/if}
|
||||||
|
</article>
|
||||||
{/each}
|
{/each}
|
||||||
|
{#if !data.technicalAccesses.length}<p class="empty-copy">
|
||||||
|
Noch keine technischen Zugänge angelegt.
|
||||||
|
</p>{/if}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<TechnicalAccessDialog bind:this={technicalAccessDialog} {form} />
|
||||||
|
|
||||||
<section class="quiet-panel account-panel">
|
<section class="quiet-panel account-panel">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
@@ -457,78 +408,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.integration-panel {
|
.integration-catalog {
|
||||||
display: grid;
|
|
||||||
gap: 1rem;
|
|
||||||
margin-block: 1.5rem;
|
margin-block: 1.5rem;
|
||||||
|
padding: clamp(0.85rem, 2vw, 1.2rem);
|
||||||
}
|
}
|
||||||
.integration-form {
|
.integration-catalog .catalog-note a {
|
||||||
display: grid;
|
white-space: nowrap;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
|
||||||
gap: 0.8rem;
|
|
||||||
align-items: end;
|
|
||||||
}
|
|
||||||
.integration-create > summary {
|
|
||||||
width: fit-content;
|
|
||||||
cursor: pointer;
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
.integration-create > summary::-webkit-details-marker {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.integration-create[open] > .integration-form {
|
|
||||||
margin-top: 0.8rem;
|
|
||||||
}
|
|
||||||
.integration-form label:not(.check-row) {
|
|
||||||
display: grid;
|
|
||||||
gap: 0.35rem;
|
|
||||||
}
|
|
||||||
.check-row {
|
|
||||||
display: flex;
|
|
||||||
gap: 0.5rem;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 2.6rem;
|
|
||||||
}
|
|
||||||
.integration-list {
|
|
||||||
display: grid;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
.integration-list details,
|
|
||||||
.access-row {
|
|
||||||
padding: 0.75rem 0.8rem;
|
|
||||||
border: 1px solid var(--line);
|
|
||||||
border-radius: var(--radius-medium);
|
|
||||||
background: var(--panel-soft);
|
|
||||||
}
|
|
||||||
.integration-list summary,
|
|
||||||
.access-row {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 1rem;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.integration-list summary > span,
|
|
||||||
.access-row > span {
|
|
||||||
display: grid;
|
|
||||||
gap: 0.2rem;
|
|
||||||
}
|
|
||||||
.integration-list small {
|
|
||||||
color: var(--text-muted);
|
|
||||||
}
|
|
||||||
.row-actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 1rem;
|
|
||||||
margin-top: 0.75rem;
|
|
||||||
}
|
|
||||||
.token-reveal {
|
|
||||||
display: grid;
|
|
||||||
gap: 0.4rem;
|
|
||||||
padding: 0.8rem;
|
|
||||||
border: 2px solid var(--color-accent);
|
|
||||||
border-radius: 0.7rem;
|
|
||||||
overflow-wrap: anywhere;
|
|
||||||
}
|
|
||||||
.token-reveal code {
|
|
||||||
user-select: all;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
+216
-3
@@ -247,6 +247,80 @@ function removeCompletionFixture() {
|
|||||||
rmSync(path.join(dataDirectory, 'uploads', 'e2e-share.png'), { force: true });
|
rmSync(path.join(dataDirectory, 'uploads', 'e2e-share.png'), { force: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addRssSelectionFixture() {
|
||||||
|
const dataDirectory = process.env.SENDEWERK_E2E_DATA_DIR;
|
||||||
|
if (!dataDirectory) throw new Error('E2E-Datenverzeichnis ist nicht konfiguriert.');
|
||||||
|
const database = new Database(path.join(dataDirectory, 'e2e.sqlite'));
|
||||||
|
const now = '2026-10-26T12:00:00.000Z';
|
||||||
|
const insertFeed = database.prepare(
|
||||||
|
`INSERT INTO feed_sources
|
||||||
|
(id, name, url, is_enabled, refresh_interval_minutes, created_at_utc, updated_at_utc)
|
||||||
|
VALUES (?, ?, ?, 1, 60, ?, ?)`
|
||||||
|
);
|
||||||
|
const insertEntry = 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 (?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
||||||
|
);
|
||||||
|
database.transaction(() => {
|
||||||
|
insertFeed.run('e2e-feed-a', 'E2E Quelle A', 'https://example.org/e2e-a.xml', now, now);
|
||||||
|
insertFeed.run('e2e-feed-b', 'E2E Quelle B', 'https://example.org/e2e-b.xml', now, now);
|
||||||
|
for (let index = 1; index <= 25; index += 1) {
|
||||||
|
const published = new Date(Date.UTC(2026, 8, index)).toISOString();
|
||||||
|
insertEntry.run(
|
||||||
|
`e2e-entry-a-${index}`,
|
||||||
|
'e2e-feed-a',
|
||||||
|
`a-${index}`,
|
||||||
|
`E2E Quelle A Beitrag ${index}`,
|
||||||
|
`https://example.org/a/${index}`,
|
||||||
|
`Auszug für Beitrag ${index} aus Quelle A.`,
|
||||||
|
published,
|
||||||
|
now,
|
||||||
|
now
|
||||||
|
);
|
||||||
|
}
|
||||||
|
for (let index = 1; index <= 20; index += 1) {
|
||||||
|
const published = new Date(Date.UTC(2026, 7, index)).toISOString();
|
||||||
|
insertEntry.run(
|
||||||
|
`e2e-entry-b-${index}`,
|
||||||
|
'e2e-feed-b',
|
||||||
|
`b-${index}`,
|
||||||
|
`E2E Quelle B Beitrag ${index}`,
|
||||||
|
`https://example.org/b/${index}`,
|
||||||
|
`Auszug für Beitrag ${index} aus Quelle B.`,
|
||||||
|
published,
|
||||||
|
now,
|
||||||
|
now
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
database.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeIntegrationFixtures() {
|
||||||
|
const dataDirectory = process.env.SENDEWERK_E2E_DATA_DIR;
|
||||||
|
if (!dataDirectory) return;
|
||||||
|
const database = new Database(path.join(dataDirectory, 'e2e.sqlite'));
|
||||||
|
database.pragma('foreign_keys = ON');
|
||||||
|
database.transaction(() => {
|
||||||
|
const pieceIds = database
|
||||||
|
.prepare(
|
||||||
|
"SELECT piece_id AS id FROM feed_entries WHERE id LIKE 'e2e-entry-%' AND piece_id IS NOT NULL"
|
||||||
|
)
|
||||||
|
.all() as { id: string }[];
|
||||||
|
database.prepare("DELETE FROM feed_sources WHERE id LIKE 'e2e-feed-%'").run();
|
||||||
|
for (const piece of pieceIds) database.prepare('DELETE FROM pieces WHERE id = ?').run(piece.id);
|
||||||
|
const accessIds = database
|
||||||
|
.prepare("SELECT id FROM technical_accesses WHERE name LIKE 'E2E API-Zugang%'")
|
||||||
|
.all() as { id: string }[];
|
||||||
|
for (const access of accessIds) {
|
||||||
|
database.prepare('DELETE FROM audit_events WHERE target_id = ?').run(access.id);
|
||||||
|
database.prepare('DELETE FROM technical_accesses WHERE id = ?').run(access.id);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
database.close();
|
||||||
|
}
|
||||||
|
|
||||||
function addPresentationFixture() {
|
function addPresentationFixture() {
|
||||||
const dataDirectory = process.env.SENDEWERK_E2E_DATA_DIR;
|
const dataDirectory = process.env.SENDEWERK_E2E_DATA_DIR;
|
||||||
if (!dataDirectory) throw new Error('E2E-Datenverzeichnis ist nicht konfiguriert.');
|
if (!dataDirectory) throw new Error('E2E-Datenverzeichnis ist nicht konfiguriert.');
|
||||||
@@ -1173,6 +1247,124 @@ test('inbox, archive and administration stay concise', async ({ page }) => {
|
|||||||
await expect(topicIconPicker.locator('input[type="hidden"]')).toHaveValue('satellite-dish');
|
await expect(topicIconPicker.locator('input[type="hidden"]')).toHaveValue('satellite-dish');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('rss selection and integration catalogs keep deliberate choices', async ({
|
||||||
|
page
|
||||||
|
}, testInfo) => {
|
||||||
|
addRssSelectionFixture();
|
||||||
|
try {
|
||||||
|
await page.context().route('https://example.org/**', (route) =>
|
||||||
|
route.fulfill({
|
||||||
|
contentType: 'text/html',
|
||||||
|
body: '<!doctype html><title>RSS-Original</title>'
|
||||||
|
})
|
||||||
|
);
|
||||||
|
await page.setViewportSize({ width: 1100, height: 760 });
|
||||||
|
await setTheme(page, 'light');
|
||||||
|
await page.goto('/eingang');
|
||||||
|
const rssPanel = page.locator('.rss-inbox-panel');
|
||||||
|
await expect(rssPanel).toContainText('45 Beiträge sind verfügbar');
|
||||||
|
await rssPanel.getByRole('button', { name: 'RSS-Beiträge auswählen' }).click();
|
||||||
|
const rssDialog = page.getByRole('dialog', { name: 'RSS-Beiträge auswählen' });
|
||||||
|
await expect(rssDialog).toBeVisible();
|
||||||
|
await expect(rssDialog.getByRole('option')).toHaveCount(20);
|
||||||
|
await rssDialog.getByRole('button', { name: 'E2E Quelle B' }).click();
|
||||||
|
await expect(rssDialog).toContainText('25 verfügbare Beiträge');
|
||||||
|
|
||||||
|
const firstChoice = rssDialog.getByRole('option', { name: /E2E Quelle A Beitrag 25/ });
|
||||||
|
await firstChoice.press('Enter');
|
||||||
|
await expect(firstChoice).toHaveAttribute('aria-selected', 'true');
|
||||||
|
const [original] = await Promise.all([
|
||||||
|
page.waitForEvent('popup'),
|
||||||
|
firstChoice.getByRole('link', { name: 'Original öffnen' }).click()
|
||||||
|
]);
|
||||||
|
await original.close();
|
||||||
|
await expect(firstChoice).toHaveAttribute('aria-selected', 'true');
|
||||||
|
await rssDialog.getByRole('button', { name: 'Weiter' }).click();
|
||||||
|
const secondChoice = rssDialog.getByRole('option', { name: /E2E Quelle A Beitrag 1/ });
|
||||||
|
await secondChoice.press(' ');
|
||||||
|
await expect(secondChoice).toHaveAttribute('aria-selected', 'true');
|
||||||
|
await rssDialog.getByRole('button', { name: 'E2E Quelle B' }).click();
|
||||||
|
await expect(
|
||||||
|
rssDialog.getByRole('button', { name: 'Auswahl in den Eingang übernehmen (2)' })
|
||||||
|
).toBeEnabled();
|
||||||
|
|
||||||
|
await page.setViewportSize({ width: 390, height: 844 });
|
||||||
|
await page.evaluate(() => (document.documentElement.dataset.theme = 'dark'));
|
||||||
|
await expectNoHorizontalOverflow(page);
|
||||||
|
await expect(
|
||||||
|
rssDialog.getByRole('button', { name: 'Auswahl in den Eingang übernehmen (2)' })
|
||||||
|
).toBeVisible();
|
||||||
|
await page.screenshot({ path: testInfo.outputPath('rss-selection-mobile-dark.png') });
|
||||||
|
await rssDialog.getByRole('button', { name: 'Auswahl in den Eingang übernehmen (2)' }).click();
|
||||||
|
await expect(page.getByRole('status')).toContainText('2 Beiträge in den Eingang übernommen');
|
||||||
|
await expect(rssPanel).toContainText('43 Beiträge sind verfügbar');
|
||||||
|
await expect(page.getByText('E2E Quelle A Beitrag 25', { exact: true })).toBeVisible();
|
||||||
|
await rssPanel.getByRole('button', { name: 'RSS-Beiträge auswählen' }).click();
|
||||||
|
await expect(rssDialog.getByText('E2E Quelle A Beitrag 25', { exact: true })).toHaveCount(0);
|
||||||
|
await expect(rssDialog.getByText('E2E Quelle A Beitrag 1', { exact: true })).toHaveCount(0);
|
||||||
|
await rssDialog.getByRole('button', { name: 'RSS-Auswahl schließen' }).click();
|
||||||
|
|
||||||
|
await page.setViewportSize({ width: 1100, height: 800 });
|
||||||
|
await setTheme(page, 'light');
|
||||||
|
await page.goto('/verwaltung');
|
||||||
|
await page.getByRole('button', { name: 'Feed hinzufügen' }).click();
|
||||||
|
let feedDialog = page.getByRole('dialog', { name: 'Feed hinzufügen' });
|
||||||
|
await feedDialog.getByLabel('Name').fill('E2E Feed Verwaltung');
|
||||||
|
await feedDialog.getByLabel('Feed-URL').fill('https://example.org/e2e-admin.xml');
|
||||||
|
await feedDialog.getByLabel('Intervall in Minuten').fill('90');
|
||||||
|
await feedDialog.getByLabel('Standardkategorie').selectOption({ index: 1 });
|
||||||
|
await feedDialog.getByRole('button', { name: 'Feed anlegen' }).click();
|
||||||
|
const feedEntry = page.getByRole('button', { name: 'E2E Feed Verwaltung bearbeiten' });
|
||||||
|
await expect(feedEntry).toBeVisible();
|
||||||
|
await feedEntry.click();
|
||||||
|
feedDialog = page.getByRole('dialog', { name: 'E2E Feed Verwaltung' });
|
||||||
|
await feedDialog.getByLabel('Name').fill('E2E Feed Verwaltung bearbeitet');
|
||||||
|
await feedDialog.getByLabel('Intervall in Minuten').fill('120');
|
||||||
|
await feedDialog.getByRole('button', { name: 'Änderungen speichern' }).click();
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: 'E2E Feed Verwaltung bearbeitet bearbeiten' })
|
||||||
|
).toBeVisible();
|
||||||
|
await page.setViewportSize({ width: 390, height: 844 });
|
||||||
|
await page.evaluate(() => (document.documentElement.dataset.theme = 'dark'));
|
||||||
|
await page.getByRole('button', { name: 'E2E Feed Verwaltung bearbeitet bearbeiten' }).click();
|
||||||
|
feedDialog = page.getByRole('dialog', { name: 'E2E Feed Verwaltung bearbeitet' });
|
||||||
|
await expect(feedDialog.getByRole('button', { name: 'Änderungen speichern' })).toBeVisible();
|
||||||
|
await expectNoHorizontalOverflow(page);
|
||||||
|
await page.screenshot({ path: testInfo.outputPath('feed-editor-mobile-dark.png') });
|
||||||
|
await feedDialog.getByRole('button', { name: 'Feeddialog schließen' }).click();
|
||||||
|
|
||||||
|
await page.setViewportSize({ width: 1100, height: 800 });
|
||||||
|
await page.evaluate(() => (document.documentElement.dataset.theme = 'light'));
|
||||||
|
await page.context().grantPermissions(['clipboard-read', 'clipboard-write']);
|
||||||
|
await page.getByRole('button', { name: 'Zugang hinzufügen' }).click();
|
||||||
|
let accessDialog = page.getByRole('dialog', { name: 'API-Zugang hinzufügen' });
|
||||||
|
await accessDialog.getByLabel('Name').fill('E2E API-Zugang');
|
||||||
|
await accessDialog.getByLabel('Berechtigung').selectOption('read_write');
|
||||||
|
await accessDialog.getByRole('button', { name: 'Zugang anlegen' }).click();
|
||||||
|
await expect(accessDialog.getByText('Token, einmalig sichtbar')).toBeVisible();
|
||||||
|
const token = await accessDialog.locator('code').textContent();
|
||||||
|
expect(token?.length ?? 0).toBeGreaterThan(20);
|
||||||
|
await accessDialog.getByRole('button', { name: 'Token kopieren' }).click();
|
||||||
|
await expect(accessDialog.getByText('Token kopiert.')).toBeVisible();
|
||||||
|
expect(await page.evaluate(() => navigator.clipboard.readText())).toBe(token);
|
||||||
|
await accessDialog.getByRole('button', { name: 'Zugangsdialog schließen' }).click();
|
||||||
|
await page.getByRole('button', { name: 'E2E API-Zugang bearbeiten' }).click();
|
||||||
|
accessDialog = page.getByRole('dialog', { name: 'E2E API-Zugang' });
|
||||||
|
await accessDialog.getByLabel('Name').fill('E2E API-Zugang bearbeitet');
|
||||||
|
await accessDialog.getByLabel('Berechtigung').selectOption('read');
|
||||||
|
await accessDialog.getByRole('button', { name: 'Änderungen speichern' }).click();
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: 'E2E API-Zugang bearbeitet bearbeiten' })
|
||||||
|
).toContainText('Nur lesen');
|
||||||
|
await page.screenshot({
|
||||||
|
path: testInfo.outputPath('integration-catalogs-light.png'),
|
||||||
|
fullPage: true
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
removeIntegrationFixtures();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test('tools stay editable in pieces after catalog deactivation', async ({ page }, testInfo) => {
|
test('tools stay editable in pieces after catalog deactivation', async ({ page }, testInfo) => {
|
||||||
await page.goto('/verwaltung');
|
await page.goto('/verwaltung');
|
||||||
for (const width of [390, 1280]) {
|
for (const width of [390, 1280]) {
|
||||||
@@ -1266,8 +1458,9 @@ test('validated YouTube and TikTok players switch without exposing private field
|
|||||||
);
|
);
|
||||||
await page.goto('/live?show=e2e-presentation');
|
await page.goto('/live?show=e2e-presentation');
|
||||||
await page.getByText('Menü', { exact: true }).click();
|
await page.getByText('Menü', { exact: true }).click();
|
||||||
|
await page.getByText('Ausgabe einrichten', { exact: true }).click();
|
||||||
const popupPromise = page.waitForEvent('popup');
|
const popupPromise = page.waitForEvent('popup');
|
||||||
await page.getByRole('button', { name: 'Ausgabe verbinden und öffnen' }).click();
|
await page.getByRole('button', { name: 'Mit dieser Sendung verbinden und öffnen' }).click();
|
||||||
const output = await popupPromise;
|
const output = await popupPromise;
|
||||||
await expect(output.locator('.output-content')).toHaveCount(0);
|
await expect(output.locator('.output-content')).toHaveCount(0);
|
||||||
await expect(output.locator('.heinzlive-output')).toHaveClass(/empty/);
|
await expect(output.locator('.heinzlive-output')).toHaveClass(/empty/);
|
||||||
@@ -1360,11 +1553,23 @@ test('live control persists state and exposes only explicit presentation data',
|
|||||||
const liveMenu = page.getByRole('dialog', { name: 'Regiemenü' });
|
const liveMenu = page.getByRole('dialog', { name: 'Regiemenü' });
|
||||||
await expect(liveMenu).toBeVisible();
|
await expect(liveMenu).toBeVisible();
|
||||||
await expect(liveMenu).toContainText('Herbstsendung: Kleine Welten');
|
await expect(liveMenu).toContainText('Herbstsendung: Kleine Welten');
|
||||||
|
await expect(liveMenu).toContainText('Läuft');
|
||||||
await expect(liveMenu.getByRole('button', { name: 'Live-Stand wiederaufnehmen' })).toHaveCount(0);
|
await expect(liveMenu.getByRole('button', { name: 'Live-Stand wiederaufnehmen' })).toHaveCount(0);
|
||||||
|
await expect(liveMenu.getByRole('button', { name: 'Pausieren', exact: true })).toHaveCount(0);
|
||||||
|
await expect(liveMenu.getByRole('button', { name: 'Fortsetzen', exact: true })).toHaveCount(0);
|
||||||
|
await expect(liveMenu.getByText(/zurücksetzen/)).toHaveCount(0);
|
||||||
await expect(page.getByRole('button', { name: 'Schrift verkleinern' })).toBeFocused();
|
await expect(page.getByRole('button', { name: 'Schrift verkleinern' })).toBeFocused();
|
||||||
await page.keyboard.press('Escape');
|
await page.keyboard.press('Escape');
|
||||||
await expect(liveMenu).toBeHidden();
|
await expect(liveMenu).toBeHidden();
|
||||||
await expect(liveMenuTrigger).toBeFocused();
|
await expect(liveMenuTrigger).toBeFocused();
|
||||||
|
await page.getByRole('button', { name: 'Sendung pausieren' }).click();
|
||||||
|
await expect(page.getByRole('button', { name: 'Sendung fortsetzen' })).toBeVisible();
|
||||||
|
await liveMenuTrigger.click();
|
||||||
|
await expect(liveMenu).toContainText('Pausiert');
|
||||||
|
await expect(liveMenu.getByRole('button', { name: 'Fortsetzen', exact: true })).toHaveCount(0);
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.getByRole('button', { name: 'Sendung fortsetzen' }).click();
|
||||||
|
await expect(page.getByRole('button', { name: 'Sendung pausieren' })).toBeVisible();
|
||||||
await liveMenuTrigger.press('Enter');
|
await liveMenuTrigger.press('Enter');
|
||||||
await expect(liveMenu).toBeVisible();
|
await expect(liveMenu).toBeVisible();
|
||||||
await page.locator('.live-current').click({ position: { x: 8, y: 8 } });
|
await page.locator('.live-current').click({ position: { x: 8, y: 8 } });
|
||||||
@@ -1392,9 +1597,10 @@ test('live control persists state and exposes only explicit presentation data',
|
|||||||
await expect(page.locator('.research-details')).toHaveAttribute('open', '');
|
await expect(page.locator('.research-details')).toHaveAttribute('open', '');
|
||||||
|
|
||||||
await page.getByText('Menü', { exact: true }).click();
|
await page.getByText('Menü', { exact: true }).click();
|
||||||
|
await page.getByText('Ausgabe einrichten', { exact: true }).click();
|
||||||
const [popup] = await Promise.all([
|
const [popup] = await Promise.all([
|
||||||
page.waitForEvent('popup'),
|
page.waitForEvent('popup'),
|
||||||
page.getByRole('button', { name: 'Ausgabe verbinden und öffnen' }).click()
|
page.getByRole('button', { name: 'Mit dieser Sendung verbinden und öffnen' }).click()
|
||||||
]);
|
]);
|
||||||
await popup.waitForURL(/\/heinzlive\/default#/);
|
await popup.waitForURL(/\/heinzlive\/default#/);
|
||||||
const outputUrl = popup.url();
|
const outputUrl = popup.url();
|
||||||
@@ -1712,12 +1918,19 @@ test('live control persists state and exposes only explicit presentation data',
|
|||||||
window.open = () => null;
|
window.open = () => null;
|
||||||
});
|
});
|
||||||
await page.getByText('Menü', { exact: true }).click();
|
await page.getByText('Menü', { exact: true }).click();
|
||||||
await page.getByRole('button', { name: 'Ausgabe verbinden und öffnen' }).click();
|
await page.getByText('Ausgabe einrichten', { exact: true }).click();
|
||||||
|
await page.getByRole('button', { name: 'Ausgabe öffnen' }).click();
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
.getByRole('status')
|
.getByRole('status')
|
||||||
.filter({ hasText: 'Präsentationsfenster konnte nicht geöffnet werden' })
|
.filter({ hasText: 'Präsentationsfenster konnte nicht geöffnet werden' })
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
await page.getByText('Menü', { exact: true }).click();
|
||||||
|
page.once('dialog', (dialog) => dialog.accept());
|
||||||
|
await page.getByRole('button', { name: 'Sendung beenden' }).click();
|
||||||
|
await page.getByText('Menü', { exact: true }).click();
|
||||||
|
await expect(page.getByRole('dialog', { name: 'Regiemenü' })).toContainText('Lauf beendet');
|
||||||
|
await expect(page.getByRole('button', { name: 'Beendeten Lauf wiederaufnehmen' })).toBeVisible();
|
||||||
await anonymous.close();
|
await anonymous.close();
|
||||||
await popup.close();
|
await popup.close();
|
||||||
await expectNoHorizontalOverflow(page);
|
await expectNoHorizontalOverflow(page);
|
||||||
|
|||||||
Reference in new issue
Block a user