diff --git a/APP_CHATUEBERGABE.md b/APP_CHATUEBERGABE.md new file mode 100644 index 0000000..c5bec27 --- /dev/null +++ b/APP_CHATUEBERGABE.md @@ -0,0 +1,150 @@ +# Chatübergabe – Landwelle Android- und iOS-App + +**Stand:** 27. Juli 2026 +**API-Vertrag:** Landwelle App API 1.0.0 +**Portal-Referenzstand:** Landwelle v1.5.58 +**Öffentliche API-Basis:** `https://api.landwelle.de/v1` + +Diese Datei ist die verbindliche Ausgangsinformation für einen separaten Chat, in dem die Flutter-App für Android und iOS entwickelt wird. + +## 1. Projektgrenze + +Der App-Chat entwickelt ausschließlich die mobile App. Änderungen am Go-Portal, an PostgreSQL-Migrationen, KeyHelp/Apache oder an der Server-API werden im Landwelle-Portal-Chat vorgenommen. + +Die App kommuniziert fachlich ausschließlich über: + +```text +https://api.landwelle.de/v1 +``` + +Nicht erlaubt: + +- HTML-Seiten von `landwelle.de` parsen +- direkt auf PostgreSQL zugreifen +- AzuraCast, RSS, Wetter- oder Verkehrsdienste direkt abfragen +- interne Pfade unter `127.0.0.1:2200` verwenden +- Adminzugänge oder Server-Secrets in der App speichern +- nicht dokumentierte API-Routen erfinden + +## 2. Verbindliche Dokumente + +Im Portalpaket: + +```text +docs/API.md +openapi/landwelle-app-api.yaml +docs/MOBILE_APPS.md +docs/MOBILE_STORE_RELEASE_PLAN.md +docs/API_CHANGE_REQUEST_TEMPLATE.md +``` + +Die OpenAPI-Datei ist der maschinenlesbare Vertrag. Bei einem Widerspruch muss der App-Chat den Nutzer darauf hinweisen und eine API-Klärung für den Portal-Chat formulieren. + +## 3. App-Start + +1. `GET /v1/app/bootstrap` +2. Feature-Flags auswerten +3. `GET /v1/station` und `GET /v1/now` +4. Player und Inhalte initialisieren +5. Installation über `POST /v1/installations` registrieren +6. Installation-Secret sicher speichern +7. Push nur nach Nutzerfreigabe registrieren +8. Statistik nur nach separater Einwilligung aktivieren + +Die Streamadresse wird immer aus der API gelesen. + +## 4. Vorgesehene App-Bereiche + +```text +Radio +Aktuelles +Veranstaltungen +Programm +Charts +Mehr +``` + +Datenquellen: + +```text +Radio/Player /station, /now, /livestudio, /playlist/history +Aktuelles /news und /news/{type}/{id} +Veranstaltungen /events und /events/{id} +Programm /program und /program/current +Team /team +Charts /charts und /charts/{id} +Wetter/Verkehr /weather, /traffic, /speed-cameras +Ausflüge /excursions +Regionen /regions +Updates /app/compatibility und /releases +``` + +## 5. Pflichtregel bei fehlender API + +Sobald für eine App-Funktion ein Endpunkt, Feld, Filter, Schreibvorgang oder Fehlerzustand fehlt, muss der App-Chat die Arbeit an genau dieser Integration anhalten und dem Nutzer einen kopierbaren Block mit der Überschrift ausgeben: + +```text +API-ERWEITERUNG FÜR DAS LANDWELLE-PORTAL +``` + +Der Block muss die Vorlage aus `docs/API_CHANGE_REQUEST_TEMPLATE.md` vollständig ausfüllen. Der Nutzer übermittelt ihn anschließend im Portal-Chat. Der App-Chat darf erst nach Bereitstellung einer aktualisierten Portalversion und OpenAPI-Datei mit dieser Funktion fortfahren. + +Andere, nicht betroffene App-Bereiche dürfen weiterentwickelt werden. + +## 6. Installation und Datenschutz + +Die App verwendet eine anonyme Installation-ID und ein einmalig ausgegebenes Installation-Secret. Das Secret gehört in Android Keystore beziehungsweise iOS Keychain. + +Nicht erfassen: + +- Werbe-ID +- IMEI oder Seriennummer +- Kontakte +- genauer Standort +- Mikrofon +- App-übergreifendes Tracking + +Die Installation kann über die API gelöscht werden. Push und freiwillige Nutzungsstatistik sind getrennte Einwilligungen. + +## 7. Test- und Releasepfad + +### Android + +1. lokale Debugtests +2. signierte interne APK für kleine Testgruppe +3. Release-AAB und Play App Signing vorbereiten +4. Google-Play-Internal-Test +5. Closed Testing nach den für das Entwicklerkonto angezeigten Anforderungen +6. Produktionszugang beantragen +7. gestufter Produktionsrollout + +### iOS + +1. lokale Geräte- und Simulator-Tests +2. Apple Developer Program und App-ID +3. interne TestFlight-Gruppe +4. externe TestFlight-Gruppe mit Beta Review +5. App-Store-Metadaten und Datenschutzangaben +6. App Review +7. manuelle oder gestufte Veröffentlichung + +Die aktuelle Detailplanung steht in `docs/MOBILE_STORE_RELEASE_PLAN.md`. Store-Vorgaben ändern sich; unmittelbar vor jedem Release müssen die offiziellen Google- und Apple-Dokumente erneut geprüft werden. + +## 8. Abnahmekriterien vor Store-Veröffentlichung + +- stabiler Hintergrundstream +- Sperrbildschirm-, Bluetooth- und Headset-Steuerung +- Wiederverbindung bei Netzwechsel +- keine Wiedergabe ohne Nutzeraktion beim Erststart +- API-Fehler und Offlinezustände verständlich +- Installation löschen funktioniert +- Push-Einwilligung und Tokenwechsel getestet +- Datenschutzangaben stimmen mit tatsächlichem Verhalten überein +- keine geheimen Schlüssel im App-Bundle +- Android- und iOS-Store-Build verwenden ausschließlich die Produktions-API +- Crash- und Funktionstest auf mehreren realen Geräten erfolgreich + + +## Separate interne App + +Diese Übergabe betrifft die öffentliche Radio-App. Für die Android-App `de.landwelle.itmonitor` gilt ausschließlich `LANDWELLE_IT_APP_CHATUEBERGABE.md`. Die beiden API-Verträge dürfen nicht vermischt werden. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b7d0ca9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,1044 @@ +## v1.5.62 + +- `Landwelle vor Ort` erhält eine echte Kategorienavigation auf Basis der bestehenden, im Admin für „Landwelle vor Ort“ freigeschalteten Redaktionskategorien. +- Kategorieübersichten sind unter `/landwelle-vor-ort/` erreichbar. +- Beitragsseiten verwenden kanonisch `/landwelle-vor-ort//`. +- Alte Links nach dem Muster `/landwelle-vor-ort/` bleiben erhalten und werden per HTTP 301 auf die neue Kategorie-URL weitergeleitet. +- Startseitenkarten, Facebook-Links, SEO-Canonical, Breadcrumbs und Admin-Vorschau verwenden die neue URL-Struktur. +- Neue Asset-Versionen `landwelle-vor-ort-v2.css` und `admin-editorial-v38.js`. +- Keine neue Datenbankmigration. + +## v1.5.61 + +- `/landwelle-vor-ort` zeigt wieder alle veröffentlichten Beiträge der für „Landwelle vor Ort“ freigegebenen Rubriken. +- Die Übersichtsseite verwendet dafür eine unbegrenzte Abfrage; die Startseite bleibt bewusst auf drei aktuelle Beiträge begrenzt. +- Regressionstest stellt sicher, dass die Übersichtsabfrage kein künstliches `LIMIT` erhält. +- Keine neue Datenbankmigration. + +## v1.5.60 + +- `/landwelle-vor-ort` wiederhergestellt: `web/landwelle-vor-ort.html` war vorhanden, wurde aber im produktiven `ParseFS`-Template-Set nicht geladen. +- Öffentliche Template-Dateien sind jetzt zentral in `publicTemplateFiles` definiert, damit Route und Tests denselben Template-Satz verwenden. +- Regressionstest ergänzt, der die produktive Verfügbarkeit von `landwelle-vor-ort.html` prüft. +- Öffentliche Vor-Ort-Handler rendern zunächst in einen Buffer und liefern bei Templatefehlern HTTP 500 statt einer leeren weißen Seite. +- Keine neue Migration. + +# Changelog + +## v1.5.59 – Radio-Sendestation mit Originalbild + +- Auf `/zuhause/landwelle` wurde im Abschnitt „Die Radio-Sendestation“ der bisherige Bildplatzhalter durch das erste Originalbild aus OpenGenesisLINK ersetzt. +- Neues Asset `web/assets/landwelle-zuhause-sendestation-v1.png` und passende Bildkarten-Darstellung ergänzt. + +## v1.5.57 – Deploy-Sicherheit + +- `build-pi.sh` entfernt vor jedem Build alte ARM64-Artefakte und prüft anschließend die erzeugte Binary-Version gegen `main.go`. +- `update-portal-on-pi.sh` verweigert die Installation, wenn das vorhandene `dist`-Binary nicht zur aktuellen Quellversion passt. +- Dadurch kann ein altes Binary aus einem vorherigen Build nicht mehr versehentlich installiert werden. + + + +## v1.5.57 – ServeMux-Sicherheitsfix + +- Öffentliche Route `/ueber-landwelle` wird im konsolidierten Quellstand exakt einmal registriert. +- Neuer Regressionstest verhindert künftig unbemerkte doppelte Registrierung dieser Route vor einem Release. +- Funktionsumfang von v1.5.55 einschließlich „Landwelle Zuhause“ bleibt unverändert. + +## v1.5.55 – 23. September 2026 + +- Produktiven Serverquellstand nach dem versehentlichen Mischstand vollständig auf Basis des vorhandenen v1.5.54-ARM64-Releases rekonsolidiert. +- Verlorene zentrale Verknüpfungen für Ausflüge, Event-Kategorien, KI-Audio/Cron, App-Push, Todo-API, Charts, Branchenbuch, Landwelle vor Ort und AdSense wiederhergestellt. +- Die gültigen v1.5.54-Admin-Templates für Chartverwaltung und Nachrichtenstudio aus dem vorhandenen Release-Binary rekonstruiert. +- Öffentliche AdSense-CSP und lokale Nachrichtenstudio-Dateibereinigung auf den validierten neueren Stand gebracht. +- Neue öffentliche Seite `/zuhause/landwelle` mit OpenGenesisLINK-Erklärung, Radiosendestation, Festzelt/DJ Jens, Bildplatzhaltern und Event-Slideshow integriert. +- Navigation „Mitmachen → Landwelle Zuhause“, Footer und Sitemap ergänzt. +- `9000_landwelle_zuhause_navigation.sql` bleibt als kompatible produktive Migration bestehen; alte irrtümliche Dateien mit Nummer 0039/0040 werden vom Update-Skript gezielt entfernt. +- Vollständiger isolierter Go-Regressionstest wieder erfolgreich. + +## v1.5.28 – 23. September 2026 + +- Korrigiert den Migrationskonflikt mit einer bereits vorhandenen `0039_event_categories_admin.sql` auf Produktivinstallationen. +- Die Navigation für „Landwelle Zuhause“ verwendet jetzt `0040_landwelle_zuhause_navigation.sql`. +- `update-migrations-on-pi.sh` entfernt die irrtümlich entpackte alte Datei `0039_landwelle_zuhause_navigation.sql` automatisch vor dem Migrationslauf. + +- Neue öffentliche Seite `/zuhause/landwelle` als hochwertiger Einstieg in die digitale Landwelle-Welt in OpenGenesisLINK. +- Eigenständiges responsives Design mit Hero, Radio-Sendestation, Event-/Festzelt-Bereich, DJ-Jens-Bereich und Zugangserklärung. +- Vorbereitete Bilder-Slideshow mit fünf Platzhaltern, Navigation, automatischem Wechsel und Berücksichtigung reduzierter Bewegungen. +- Bilderbereiche zunächst bewusst als Platzhalter angelegt, damit spätere Originalaufnahmen aus OpenGenesisLINK ohne Layoutumbau eingesetzt werden können. +- Neuer Menüpunkt „Landwelle Zuhause“ unter „Mitmachen“ sowie zusätzlicher Footerlink und Sitemap-Eintrag. +- Migration `0040_landwelle_zuhause_navigation.sql` ergänzt den Menüpunkt in bestehenden PostgreSQL-Installationen. +- Versionsstand auf Landwelle v1.5.28 angehoben. + +## v1.5.26 – 4. August 2026 + +- Vollständiges `COMPLETE`-Quellpaket am 14. August 2026 neu aus dem konsolidierten v1.5.26-Stand gepackt; keine Funktions- oder Datenbankänderung. +- Kanonische Projektdokumentation auf den vollständigen Funktionsstand bis v1.5.25 abgeglichen. +- `CHATUEBERGABE.md` als umfassende Übergabe für neue Portal-Chats neu strukturiert und erweitert. +- README, Roadmap, Iststand, Architektur-, Admin-, Chart-, KI-, Medien-, API-, Test- und Deploymentdokumentation synchronisiert. +- Öffentliche App- und interne IT-App-Übergaben auf den aktuellen Portalreferenzstand gebracht. +- Veraltete Deploymentbeispiele und frühere Projektpfade entfernt; produktiver Build-, Update- und Prüfablauf vereinheitlicht. +- Dokumentationsregeln und Zuständigkeiten zwischen Portal, öffentlicher Radio-App und interner IT-App präzisiert. +- Keine Datenbankänderung; Datenbankstand bleibt bei Migration `0038_team_ai_media_watermark.sql`. + +## v1.5.25 – 2. August 2026 + +- Teamverwaltung um die Kennzeichnung „KI-/virtuelle Persönlichkeit“ und einen optionalen Transparenzhinweis erweitert. +- Öffentliche Teamseite zeigt KI-Profile klar sichtbar; verknüpfte Programme kennzeichnen virtuelle Moderation als „KI-Stimme“. +- Mediengalerie erhält eine nachträgliche Bearbeitungsfunktion für Alternativtext, Rechtehinweise und KI-Klassifizierung. +- Für ausgewählte KI-generierte oder wesentlich KI-bearbeitete Bilder kann ein sichtbares Wasserzeichen aktiviert und individuell benannt werden. +- Standardtexte „Mit KI erstellt“ und „Mit KI bearbeitet“ werden automatisch aus der Klassifizierung abgeleitet. +- Originaldateien bleiben unverändert; Wasserzeichen werden in unterstützten öffentlichen Ansichten als zugängliche Overlay-Kennzeichnung ausgegeben. +- Redaktion, „Landwelle vor Ort“, Team, Programm und Mediathek übernehmen aktive Wasserzeichen aus der zentralen Mediengalerie. +- App-API ergänzt Wasserzeichenstatus und -text in der Medien-KI-Transparenzstruktur redaktioneller Inhalte. +- Migration `0038_team_ai_media_watermark.sql`, neue Admin-Assets und Regressionstests ergänzt. + +## v1.5.24 – 2. August 2026 + +- KI-Transparenz nach Art. 50 EU-KI-Verordnung für Redaktion, Medien, Mediathek und Jahrescharts umgesetzt. +- Migration `0037_ai_transparency.sql` ergänzt KI-Art, menschliche Prüfung, redaktionelle Verantwortung und Transparenztexte. +- Öffentliche Beiträge zeigen KI-Hinweise bereits im Hero und auf Startseitenkarten; KI-Bilder erhalten eine separate Kennzeichnung. +- Mediathek-Audios zeigen den Hinweis vor dem Player; synthetische ElevenLabs-Ausgaben erhalten zentral einen gesprochenen Vorspann. +- Facebook-Vorschau und Veröffentlichung übernehmen den KI-Transparenztext. +- Jahreschart-Informationen sind sichtbar und in der API als KI-generiert ausgewiesen. +- Neue öffentliche Seite `/ki-transparenz`, Footerlink sowie aktualisierte Datenschutz- und Impressumsangaben. +- Adminformulare für Redaktion, Medien und Mediathek um nachvollziehbare KI-Klassifizierung erweitert. + +## v1.5.23 – 28. Juli 2026 + +- Frontend-Votes werden jetzt dauerhaft in `chart_vote_history` protokolliert; jede nach Ablauf der 24-Stunden-Sperre akzeptierte Stimme erhöht den Voting-Stand erneut. +- `chart_votes` bleibt als letzter Abstimmungsstatus je Titel und Besucher für die 24-Stunden-Sperre bestehen. +- Die jeweils noch vorhandene letzte Stimme wird durch Migration `0036_chart_vote_history.sql` einmalig in die Historie übernommen; früher bereits überschriebene Wiederholungsstimmen können technisch nicht nachträglich rekonstruiert werden. +- Der Admin ersetzt das editierbare Feld „Auswertung fest“ durch die reine Textanzeige „Voting-Stand“ mit automatisch berechnetem Gesamtwert und Anzahl der Online-Stimmen. +- Normales Autosave kann den festen Basiswert nicht mehr versehentlich überschreiben. +- „Generieren“ sortiert laufende Charts nun nach `VotePoints`, also Basiswert plus tatsächlich gezählte Frontend-Stimmen, statt nur nach `fixed_vote_points`. +- Bei gleichem Punktestand bleibt die bisherige Reihenfolge stabil. +- Beim Leeren einer Chartzeile werden auch deren Votingstatus und Votinghistorie entfernt, damit ein neu eingetragener Titel keine alten Stimmen übernimmt. +- Chart-Assets auf `admin-charts-v7.css` und `admin-charts-v7.js` angehoben. +- Regressionstests für kumulative Stimmen, automatische Auswertung, Sortierreihenfolge und Migration ergänzt. + +## v1.5.22 – 27. Juli 2026 + +- Pressetexte und andere verwaltete Inhaltsblöcke stellen Leerzeilen jetzt als echte Absätze dar. +- Versehentlich gespeicherte Zeichenfolgen `\n` und `\r\n` werden beim Laden und Speichern in echte Zeilenumbrüche umgewandelt. +- Sichere Absatzdarstellung ergänzt: HTML bleibt escaped, einzelne Zeilenumbrüche werden als `
` und Leerzeilen als getrennte Absätze ausgegeben. +- Migration `0035_press_paragraph_breaks.sql` repariert bereits gespeicherte Pressetexte in bestehenden Installationen. +- Öffentliche Inhaltsseiten, FAQ, Kontaktblöcke und die Adminvorschau verwenden dieselbe konsistente Mehrzeilendarstellung. +- Regressionstests für Legacy-Zeilenumbrüche, Absatzbildung, HTML-Escaping und Reparaturmigration ergänzt. + +## v1.5.21 – 27. Juli 2026 + +- Doppelt eingebundenen älteren Chartverwaltungsblock aus `web/admin/management.html` entfernt; Zuhörer-, docX- und Schlagercharts werden im Admin nur noch einmal dargestellt. +- Chart-Assets auf `admin-charts-v6.css` und `admin-charts-v6.js` angehoben, damit Browser den Fix sicher laden. +- `L = Leeren` löscht keine Chartzeile mehr, sondern leert ausschließlich die Eingabefelder der betroffenen Position. +- Leere Chartzeilen bleiben im Admin zur erneuten Befüllung erhalten, werden aber nicht auf öffentlichen Chartseiten oder über die Radio-App-API ausgegeben. +- Chartgenerierung kann jederzeit erneut ausgeführt werden; Wochen- beziehungsweise 24-Stunden-Sperre entfernt. +- Wiederholte Generierungen aktualisieren den letzten Generierungszeitpunkt derselben Kalenderwoche. +- Migration `0034_press_beta_release.sql` ergänzt die erste Pressemitteilung zum Android-App-Beta-Test. +- Pressebericht nennt die offene Google-Gruppe und die SLMM GbR als Entwickler und Bereitsteller der App. +- Impressum um „Design & Konzept“ mit SLMM GbR, Jens Bramsche & Jörg Weiß, Anschrift, Website und E-Mail-Adresse ergänzt. +- Regressionstests für einmalige Chartdarstellung, gezieltes Leeren, freie Generierung, öffentliche Ausblendung leerer Zeilen, Pressetext und Impressumsangaben ergänzt. + +## v1.5.20 – 27. Juli 2026 + +- Ursache der HTML-404-Seite auf `https://api.landwelle.de/v1/app/bootstrap` eingegrenzt: Die Go-Route funktioniert, aber die API-Subdomain leitete `/v1/*` nicht an Port 2200 weiter. +- Direkt einsetzbares KeyHelp-Fragment `deploy/keyhelp-api-subdomain-https.conf` ergänzt. +- Proxyregeln für `/v1`, `/api/mobile`, `/health` und `/ready` vollständig und HTTPS-spezifisch dokumentiert. +- Diagnose-Skript `scripts/verify-api-subdomain.sh` ergänzt; es unterscheidet lokale Portalfehler von fehlender öffentlicher Reverse-Proxy-Weiterleitung. +- Dokumentation erklärt ausdrücklich, dass eine funktionierende API-Startseite unter `/` keine funktionierende `/v1`-Weiterleitung beweist. +- Regressionstests für das Deployment-Fragment und die externe `/v1`-Aliasroute ergänzt. +- Keine Datenbankmigration und keine Änderung des API-Vertrags. + +## v1.5.19 – 27. Juli 2026 + +- App-Beta-Test-Bereich vom Liveplayer an das Ende der Startseite direkt vor den Footer verschoben. +- Große Hero-Anmutung durch eine kompakte, in das Seitenraster integrierte Teilnahme-Karte ersetzt. +- Überdimensionierte Smartphone-Illustration und dreiteilige Prozesskarten entfernt. +- Inhalt auf klare Vorteile, Teilnahmebutton und Google-Gruppenhinweis reduziert. +- Responsive Darstellung für Tablet und Smartphone neu abgestimmt. +- Homepage-Stylesheet auf `home-v4.css` angehoben, damit Browser den Layoutfix sicher neu laden. +- Regressionstest ergänzt, der die Position nach den Startseiteninhalten und vor dem Footer absichert. +- Keine Datenbankmigration und keine API-Änderung. + +## v1.5.18 – 27. Juli 2026 + +- Vorübergehenden, responsiven App-Beta-Test-Bereich direkt unter dem Startseiten-Liveplayer ergänzt. +- Primärer Teilnahmebutton öffnet die offizielle Google-Gruppe `landwelle-betatest` in einem neuen Tab. +- Teilnahmeablauf in drei verständlichen Schritten erklärt; Gruppenadresse und Hinweis auf das erforderliche Google-Konto ergänzt. +- Keine Google-Skripte oder eingebetteten Drittinhalte: Das Portal speichert keine Google-Anmeldedaten. +- Externer Link über `noopener`, `noreferrer` und `referrerpolicy=no-referrer` abgesichert. +- Bereich über `LANDWELLE_APP_BETA_ENABLED=false` ohne Codeänderung abschaltbar; Gruppen-URL und Gruppenadresse sind ebenfalls konfigurierbar. +- Eigene Mobilansicht, sichtbarer Tastaturfokus und Rücksicht auf `prefers-reduced-motion` ergänzt. +- Regressionstests für Inhalt, Konfiguration, Responsivität und Abschaltbarkeit ergänzt. +- Keine Datenbankmigration und keine API-Änderung. + +## v1.5.17 – 27. Juli 2026 + +- `/admin/editorial` in die Tabs „Inhalte“, „Inhalt anlegen“ und „Kategorien“ gegliedert. +- Kategorienanlage von „Redaktionstypen“ auf verständliche Kategorien umbenannt und in ein Modal verschoben. +- Inhaltsübersicht mit Kategorie, Status, Teaser, Region, Facebook-Zustand, Push-Auswahl und direkten Aktionen neu gestaltet. +- Facebook-Live-Vorschau für Nachrichtentext, Beitragsbild, Linkkarte und öffentliche Zieladresse ergänzt. +- Facebook-Publisher verwendet für regionale Beiträge nun `/landwelle-vor-ort/` statt der falschen `/news/`-Route. +- Facebook-Ergebnis wird mit Beitrags-ID oder gekürztem Fehlergrund gespeichert und in der Inhaltsliste angezeigt. +- Manueller Wiederholungsversand für fehlgeschlagene oder bewusst erneut gewünschte Facebook-Beiträge ergänzt. +- Automatische Doppelposts bei normalen Bearbeitungen bereits veröffentlichter Facebook-Inhalte verhindert. +- Mobile Startseite korrigiert: Einzelne beziehungsweise letzte „Landwelle vor Ort“-Karten bleiben sichtbar. +- Regressionstests für Facebook-Link, Graph-Formular, Redaktionstabs, Kategorienmodal und mobile Regionalbeiträge ergänzt. +- Nicht mehr referenzierte Editorial- und Home-Assets entfernt. +- Keine Datenbankmigration und keine API-Änderung. + +## v1.5.16 – 24. Juli 2026 + +- Alle numerischen Eingabefelder unter `/admin/charts` von Browser-Number-Inputs auf normale Textfelder mit numerischer Eingabehilfe umgestellt. +- Position, Punkte, Einstiegsjahr, Monat/Kalenderwoche sowie aktuelle und vorherige Platzierung bleiben serverseitig numerisch validiert. +- Positionsspalte verbreitert; Positionsfeld vergrößert und Zifferndarstellung mit tabellarischen Ziffern verbessert. +- Chart-Stylesheet auf `admin-charts-v5.css` angehoben, damit Browser den Darstellungsfix zuverlässig neu laden. +- Regressionstest ergänzt, der Number-Inputs in der Chartverwaltung verhindert. +- Keine Datenbankmigration und keine API-Änderung. + +## v1.5.15 – 24. Juli 2026 + +- Mediathek-Herotext wieder exakt am globalen Seitencontainer ausgerichtet. +- Fehlerhafte lokale Überschreibung `width: 100%` aus `.mediathek-hero .page-shell` entfernt. +- Stylesheet auf `mediathek-v3.css` angehoben, damit Browser den Fix nicht aus einem alten Cache übergehen. +- Regressionstest für Hero-Ausrichtung und Stylesheet-Referenz ergänzt. +- Keine Datenbankmigration und keine API-Änderung. + +## v1.5.14 – 24. Juli 2026 + +- Neue textfreie Hero-Grafik im Landwelle-Stil oben auf `/mediathek` eingebaut. +- Grafik verlustarm auf rund 181 KB als WebP optimiert und über `go:embed` ausgeliefert. +- Hero-Bild wird vorgeladen; Überschrift und Einleitung bleiben als zugänglicher HTML-Text erhalten. +- Responsive Bildausrichtung und kontrastreiche, gestaffelte Verlaufsfläche für Desktop und Mobilgeräte ergänzt. +- Mediathek-Stylesheet auf `mediathek-v2.css` aktualisiert und die nicht mehr verwendete Vorversion entfernt. +- Regressionstests für Hero-Asset, Template-Verknüpfung und aktuelle Anwendungsversion ergänzt. +- Keine Datenbankmigration und keine API-Änderung erforderlich. + +## v1.5.13 – 24. Juli 2026 + +- Projektstamm bereinigt: historische Build Notes, Hotfix-Anleitungen, Release-Einzeldateien, Validierungsprotokolle und Dateilisten entfernt. +- `CHANGELOG.md` als einzige historische Releasequelle festgelegt. +- README, Roadmap, Chatübergabe, Contribution-Regeln und Projekt-Iststand konsolidiert und aktualisiert. +- Dokumentationsindex `docs/README.md` ergänzt; ausdrücklich archivierte und doppelte Dokumente entfernt. +- unreferenzierte Altversionen statischer CSS-, JavaScript- und Bildassets entfernt. +- versionsbezogene Hotfix-Testdateien fachlich umbenannt und doppelte Versionsprüfungen zentralisiert. +- `.gitignore` und reproduzierbare Go-Abhängigkeitsdatei `go.sum` ergänzt. +- keine Datenbankmigration und keine Änderung an den API-Verträgen. + +## v1.5.12 – 24. Juli 2026 + +- Statistik: PostgreSQL-Syntaxfehler in der täglichen Verlaufsauswertung behoben. +- SQL: reservierungsnaher Alias `day` durch `visit_date` ersetzt. +- SQL: `LEFT JOIN ... USING(day)` durch einen expliziten Join auf die Datumsspalten ersetzt. +- Qualität: Regressionstest für die sichere Tageskurven-Abfrage ergänzt. +- Keine Datenbankmigration erforderlich. + +## v1.5.11 – 23. Juli 2026 + +- Charts: kompaktere Top-3-Cover, kontrastreicher Countdown, behobener Leerbalken und hörernahe Beschriftungen. +- Admin: professionellere Forum-, Themen- und Auditansichten. +- Statistik: consentbasierte First-Party-Reichweitenmessung mit pseudonymen Kennungen, Verlauf, Top-Seiten und CSV-Export. +- Inhalte: öffentliche und administrative Seiten für Presse, Karriere, FAQ und Kontakt. +- Kontakt: PostgreSQL-Formularablage mit Honeypot, Validierung, Rate-Limit und Bearbeitungsstatus. +- Mediathek: öffentliche Wiedergabe, Audio-Uploads und direkte Übernahme fertiger Nachrichtenstudio-/ElevenLabs-Dateien als Entwurf. +- Datenschutz: Consent-Cookie-Prüfung, DNT/GPC, aktualisierte Datenschutzangaben und Ausschluss des Adminbereichs. +- Navigation: Presse im Footer; Fotos & Video entfernt. +- Startseite: ehrlicher Leerzustand für Landwelle vor Ort. +- Datenbank: Migration `0033_public_content_mediathek_analytics.sql`. +- Qualität: neue Regressionstests, Race Detector, Vet, JavaScript-Prüfung, Starttest und ARM64-Compilechecks. + +## v1.5.10 – Charts, Redaktion, Todo-Board und Forum + +- Öffentlicher Votingstatus serverseitig statt über veralteten Browserzustand; Bewertungsbuttons werden während der 24-Stunden-Sperre ausgeblendet und durch einen sichtbaren Countdown ersetzt. +- Eigenständige Landwelle-Designs für Zuhörer-, docX- und Schlagercharts sowie nostalgisches Jahreschart-Archiv. +- Korrigierte Migration `0031` ohne eigenen Transaktionsblock und neue Migration `0032`. +- „Landwelle vor Ort“ aus veröffentlichten Redaktionseinträgen; frei verwaltbare Redaktionstypen im Adminbereich. +- Professionelles Todo-Board mit Firebase-Annahme und optionaler echter App-Empfangsbestätigung über API-Vertrag `1.1.0`. +- MyBB-ähnliches Forum mit Kategorie-/Themenhierarchie, Rängen, Sternen, Benutzerstatistiken, BBCode, Emoticons, Dankeschöns und Neu-Markierungen. +- Regressionstests, JavaScript-Prüfung sowie Linux-ARM64-Builds erfolgreich. + +## v1.5.9 – Atomare Chartpositionen und Startseiten-Veranstaltungsmodal + +- Chartpositionen werden über aufschiebbare PostgreSQL-Constraints atomar neu sortiert. +- Tauschen und Drag-and-drop erzeugen keine vorübergehenden Doppelpositionen mehr. +- Die Startseiten-Veranstaltungen öffnen beim Anklicken ein Detailmodal. +- Das Modal lädt Beschreibung, Ort, Veranstalter, Kalender-, Webseiten- und Quellenlinks über `/api/events/`. + +## v1.5.8 – Chart-Voting, Drag-and-drop und Jahresauswahl + +- Behebt den PostgreSQL-Fehler beim Voting durch eine explizite Textformatierung von `next_vote_at`; ein leerer Zeitwert wird nicht mehr als `timestamp with time zone` interpretiert. +- Der Drag-Griff ist jetzt selbst das HTML5-Drag-Element. Chartzeilen lassen sich dadurch tatsächlich zwischen Top 3, Hauptchart und Neuvorstellungen verschieben. +- Nach dem Ablegen wird die neue Reihenfolge normalisiert, atomar gespeichert und per Notify bestätigt. +- Die Jahresauswahl unter `/charts/jahrescharts` verwendet externes JavaScript statt eines durch die CSP blockierten Inline-`onchange`. +- Neue Cache-Versionen: `charts-v5.js` und `admin-charts-v5.js`. +- Keine Datenbankmigration erforderlich. + +## v1.5.7 – Vollständige Landwelle-Chartplattform + +- Frontend der Zuhörer-, docX-, Schlager- und Jahrescharts nach der bewährten Funktionsstruktur des alten SLMM-Radio-Projekts neu aufgebaut. +- Neue öffentliche Route `/charts/docx` samt Voting-API und datenbankbasiertem Navigationspunkt. +- Top 3, Hauptchart und Neuvorstellungen werden je Chartbereich getrennt dargestellt. +- Store-/YouTube-Link steuert Cover und Hörprobe; YouTube wird datenschutzfreundlich über `youtube-nocookie.com` eingebettet. +- Jahrescharts erhalten Jahrgangsauswahl und öffentliche KI-Titelinformationen. +- Admin-Charts unterstützen Drag-and-drop und direkte Positionsänderung mit serverseitigem Autosave und Notify. +- Wöchentlicher Button „Generieren“ sortiert laufende Charts nach festem Voting-Stand und ist pro ISO-Woche nur einmal ausführbar. +- „Titel-Infos KI“ erzeugt fehlende Künstler- und Songinformationen für Jahrescharts. +- Migration `0030_chart_generation_docx.sql` ergänzt Wochenläufe und den docX-Navigationspunkt. + +## v1.5.6 – Chart-Autosave und Altlogik + +- technische Chartlogik des bereitgestellten Altprojekts analysiert und in den aktuellen Go-Admin übertragen +- aktive Checkboxen aus den laufenden Charttabellen entfernt; gespeicherte Titel bleiben automatisch aktiv +- Aktionen auf `A = Auto` und `L = Leeren` reduziert +- positionsbezogenes Autosave mit Erfolgs- und Fehlermeldungen ergänzt +- separate Hörprobenspalte entfernt; Store-/YouTube-Link steuert Cover und Hörprobe +- iTunes-Suche und abgesicherte YouTube-Metadatenauflösung ergänzt +- Zahlenfelder kompakt und schmal gestaltet +- keine Datenbankmigration erforderlich + +# Changelog +## v1.5.5 – Chartzeilen wieder sichtbar + +- Behebt die leeren Tabellen unter `/admin/charts` trotz korrekt geladener Importbestände. +- Der ausgelagerte Zeilenbaustein erhält nun Charttitel, CSRF-Token und Chart-Key in einem gemeinsamen Datenkontext. +- Zuhörer-, dockX- und Schlagercharts werden dadurch vollständig als editierbare Zeilen gerendert. +- Die Verwaltungsseite wird vor der HTTP-Ausgabe vollständig in einen Puffer gerendert; zukünftige Templatefehler erzeugen keine halbfertige Seite mehr. +- Regressionstest rendert alle drei laufenden Chart-Tabs mit einem echten Beispieltitel. +- Keine Datenbankmigration erforderlich. + +## v1.5.4 – Stellenbörse und Chartimport-Reparatur + +- Korrigiert die Ergebnisstruktur der Bundesagentur-Jobsuche. +- Passt die Chartverwaltung an das helle Landwelle-Design an. +- Ergänzt Migration `0029_slmmradio_charts_import_repair.sql` zur idempotenten Bestandsprüfung und Reparatur. +- Zeigt Chart-Ladefehler und Importstatistiken sichtbar im Adminbereich. + +## v1.5.3 – Chartimport, Stellenbörse, Playlist-Wünsche und Todo-Vorbelegung + +- `/playlist`: Der Button „Wünschen“ übergibt Interpret und Titel per Querystring an das Wunschformular und springt direkt zum Formular. +- `/admin/todos`: Neue Aufgaben werden mit Anzeigename beziehungsweise Benutzername der angemeldeten Person vorbelegt; bestehende Aufgaben bleiben frei editierbar. +- `/admin/charts`: Neuaufbau mit getrennten Tabs für Zuhörer, dockX, Schlager, Archiv und Jahrescharts, eigenem Anlegebereich pro aktivem Tab, Top-3-Sektion und vollständig editierbaren Beständen. +- Migration `0028_slmmradio_charts_import.sql` konvertiert den bereitgestellten MariaDB-Dump nach PostgreSQL und importiert 120 laufende Einträge, 293 Archiveinträge, 96 Jahresdefinitionen, 6237 Jahreschart-Einträge und 1457 Songinformationen. Historische IP-/Voting- und Chatdaten werden nicht importiert. +- `/service/stellenboerse`: Neue serverseitige Stellenbörse auf Basis der Jobsuche der Bundesagentur für Arbeit mit Suche, Filtern, Pagination und Detailmodal. +- Startseite: Das zusätzliche Logo wurde aus dem Hero entfernt. +- Neue Konfiguration: `LANDWELLE_JOBS_API_BASE` und `LANDWELLE_JOBS_API_KEY`. + +## v1.5.2 – Zustandsabhängige Admin-Sidebar + +- Admin-Sidebar als echte, intern scrollbar bleibende Seitennavigation überarbeitet. +- Aktuelle Adminroute wird automatisch erkannt und mit `aria-current="page"` eindeutig markiert. +- Die Kategorie des geöffneten Menüpunkts klappt beim Seitenaufruf automatisch auf; alle anderen Kategorien starten geschlossen. +- Beim manuellen Öffnen einer Kategorie werden die übrigen Kategorien geschlossen. +- Neue fachliche Gruppierung: Inhalte & Sendeplanung, Hörer & Community, KI & Automatisierung, Apps & Veröffentlichung, Benutzer & Rechte sowie System & Betrieb. +- Zusätzliche Zwischenüberschriften strukturieren umfangreiche Bereiche wie Forum, Produktion, Tagesrubriken und Konfiguration. +- Hash-Ziele wie `/admin/settings#ki`, `#social` und `#delivery` werden getrennt als aktive Ziele erkannt. +- Mobile Sidebar schließt nach der Auswahl eines Menüpunkts automatisch. +- Keine Datenbankmigration erforderlich. + +## v1.5.1 – OnTour-Player und Navigation-Sicherheitsprüfung + +- Erlaubt YouTube-Embeds auf `/ontour` gezielt über eine seitenbezogene `frame-src`-CSP für `youtube-nocookie.com` und `youtube.com`. +- Andere öffentliche Seiten behalten die restriktive CSP ohne externe Frames. +- Der OnTour-Player zeigt einen Ladezustand und bei fehlgeschlagener Einbettung einen direkten YouTube-Link. +- Behebt die Meldung „Ungültige Sicherheitsprüfung“ beim Speichern und Löschen der datenbankbasierten Navigation. +- Standard-HTML-Formulare dürfen den CSRF-Token über `csrf_token` senden; JSON-/AJAX-Aufrufe verwenden weiterhin `X-CSRF-Token`. +- Keine neue Datenbankmigration erforderlich. + +## v1.5.0 – Werbung, OnTour, Branchenbuch, Veranstaltungssuche und Navigation + +- Neue gestaltete Werbeseite mit auswählbaren Paketen, PostgreSQL-Speicherung, interner Nachricht an `radio@landwelle.de` und Bestätigungsmail. +- Live-Suche und vollständiges Detailmodal für Veranstaltungen. +- Neue OnTour-Seite mit öffentlichem YouTube-Atom-Feed, serverseitigem Cache, Thumbnail-Proxy und Consent-gesteuerter Einbettung. +- Neues kostenloses Branchenbuch mit Kategorien, Suche, Pagination, Einsendung und Adminmoderation. +- Öffentliche Hauptnavigation aus PostgreSQL mit Adminverwaltung für Hauptpunkte und Dropdowns. +- Footer-Link „Branchenbuch“ und Radio-Menüpunkt „Landwelle OnTour“. +- Migration `0027_public_growth_navigation_directory_ads.sql`. +- Neue Rechte `navigation.manage` und `directory.manage`. + +## v1.4.8 – Favoriten-Schaltfläche für eigene Veranstaltungen + +- Behebt die fehlende Favoriten-Schaltfläche unter `Admin → Veranstaltungen → Eigene Einsendungen`. +- `source_type` und `source_name` aus der PostgreSQL-JSON-Antwort werden jetzt explizit den Go-Feldern `SourceType` und `SourceName` zugeordnet. +- Eigene Einsendungen (`submission`) und redaktionelle Termine (`editorial`) zeigen dadurch wieder „☆ Als Startseiten-Favorit“ beziehungsweise „★ Favorit entfernen“. +- Der bestehende Favoriten-POST und die Startseiten-Priorisierung bleiben unverändert. +- Keine neue Datenbankmigration erforderlich. +- Regressionstest prüft die JSON-Zuordnung von `source_type` und `source_name`. + +## v1.4.7 – Startseiten-Favoriten für eigene Veranstaltungen + +- Eigene Einsendungen und redaktionelle Veranstaltungen können im Adminbereich als Startseiten-Favorit markiert werden. +- Importierte Niedersachsen-Hub-Termine können nicht als Favorit markiert werden. +- Solange mindestens ein veröffentlichter Favorit aktiv ist, steht ein Favorit auf der Startseite immer an Position 1. +- Bei mehreren gleichzeitig aktiven Favoriten rotiert die erste Position bei jedem Seitenaufruf zufällig zwischen diesen Favoriten. +- Die beiden weiteren Plätze werden weiterhin zufällig aus den übrigen aktiven Veranstaltungen gewählt; doppelte Karten werden verhindert. +- Abgelaufene Favoriten werden durch die bestehende Gültigkeitsprüfung nicht mehr auf der Startseite angezeigt. +- Migration `0026_event_homepage_favorites.sql` ergänzt Favoritenstatus, Markierungszeit und einen partiellen Index. +- Regressionstests decken Favoritenposition, Rotation, Duplikatschutz und unveränderte Eingabedaten ab. + +## v1.4.6 – Ausgewogene Niedersachsen-Nachrichten und zufällige Veranstaltungen + +- Der offizielle NDR-RSS „Niedersachsen“ wird als zweite regionale Quelle eingerichtet. +- Auf `/aktuelles` werden ausschließlich eigene Landwelle-Beiträge und Meldungen mit Niedersachsen-Bezug angezeigt. +- Landeszeitung und NDR werden fair abwechselnd gewichtet; innerhalb jeder Quelle bleibt die zeitliche Reihenfolge erhalten. +- Die Startseite verwendet dieselbe ausgewogene Nachrichtenmischung. +- Quellenangaben werden auch beim Aufmacher, bei den Topmeldungen und auf den Startseitenkarten sichtbar ausgegeben. +- Die drei Veranstaltungen auf der Startseite werden bei jedem Seitenaufruf neu aus allen aktiven veröffentlichten Terminen ausgelost. +- NDR-Inhalte werden entsprechend der veröffentlichten RSS-Bedingungen nur als Überschrift mit Link und Quellenangabe übernommen; Zusammenfassungen und Originalbilder sind deaktiviert. +- Nicht mehr im aktuellen NDR-Feed enthaltene Einträge werden nach einem erfolgreichen Abruf entfernt und nicht archiviert. +- Migration `0025_ndr_niedersachsen_balanced_news.sql` richtet Quelle, Niedersachsen-Zuordnung und sofortigen Erstabruf ein. + +# Changelog +## v1.4.5 – Robuste Tagesschau-Bildauflösung + +- Doppelt HTML-maskierte Bildangaben im RSS werden mehrfach sicher dekodiert. +- Verschachtelte Media-RSS-Gruppen (`media:group`) werden ausgewertet. +- Fehlt im RSS-Eintrag weiterhin ein Bild, lädt der Server ausschließlich den verlinkten Tagesschau-Artikel und übernimmt `og:image`, `twitter:image` oder `image_src`. +- Artikel- und Bild-Fallback akzeptieren ausschließlich HTTPS-Hosts von `tagesschau.de`; fremde Hosts und Weiterleitungen werden abgewiesen. +- Pro Feedlauf wird protokolliert, wie viele Bilder direkt aus RSS und wie viele aus Artikel-Metadaten stammen. +- Migration `0024_tagesschau_article_image_fallback.sql` erzwingt einen erneuten Tagesschau-Import. +- Regressionstests decken doppelte Maskierung, verschachtelte Media-RSS-Gruppen, Meta-Attributreihenfolge und fremde Bildhosts ab. + +## v1.4.4 – Tagesschau-Bilder und getrennte Nachrichtenmenüs + +- Offizielle Tagesschau-Vorschaubilder werden aus `content:encoded`, Media-RSS und Bild-Enclosures gelesen. +- Audio- und Video-Enclosures werden nicht mehr versehentlich als Nachrichtenbild übernommen. +- Relative und protokollrelative Bildadressen werden sicher zu absoluten HTTP-/HTTPS-Adressen aufgelöst. +- Migration `0023_tagesschau_rss_images.sql` entfernt die bisher ohne Bild importierten Tagesschau-Einträge und erzwingt einen frischen Feedabruf. +- Nachrichtenbilder auf `/aktuelles` erhalten aussagekräftige Alternativtexte, Lazy Loading und eine restriktive Referrer-Policy. +- Im Adminmenü „KI & Audio“ heißt `/admin/ai/news` jetzt „Nachrichten Welt“. +- Direkt darunter wurde `/admin/ai/news-local` als neuer, getrennt vorbereiteter Bereich „Nachrichten Lokal“ ergänzt. +- RSS-Bildparser und Adminnavigation sind mit Regressionstests abgesichert. + +## v1.4.3 – Nachrichten-Pagination und Welt Nachrichten + +- Unter dem Dropdown „Mitmachen“ heißt der Link `/mitmachen` jetzt „Wünsche & Grüße“. +- „Weitere Nachrichten“ auf `/aktuelles` zeigt maximal fünf regionale Meldungen je Seite. +- Kompakte Pagination mit Zurück, Weiter, aktiver Seite, Seitenzahlen und Auslassungszeichen ergänzt. +- Neue Rubrik „Welt Nachrichten“ unterhalb der regionalen Meldungen ergänzt. +- Der offizielle Tagesschau-Ausland-RSS wird über Migration `0022_tagesschau_world_news.sql` als eigene Quelle eingerichtet. +- Weltmeldungen werden technisch von Landeszeitung- und Landwelle-Meldungen getrennt und ebenfalls mit maximal fünf Einträgen je Seite angezeigt. +- Regionale und Welt-Pagination bewahren gegenseitig ihre aktuelle Seitenposition. +- RSS-Abruflimit für die öffentliche, paginierte Darstellung auf bis zu 500 Datensätze erweitert. +- Navigation, Quellenklassifizierung, Pagination und Template-Struktur mit Regressionstests abgesichert. + +## v1.4.2 – Veranstaltungseinsendung und Frontend-Navigation + +- SQL-Syntaxfehler beim öffentlichen Einsenden einer Veranstaltung behoben. +- Das `INSERT ... RETURNING id` wird innerhalb der PostgreSQL-CTE nicht mehr vorzeitig mit einem Semikolon abgeschlossen. +- Regressionstest verhindert erneut ungültige Abfragen im Muster `;) SELECT`. +- Der Navigationspunkt „Programm“ wurde aus der Hauptebene in das Dropdown „Radio“ verschoben. +- „Mitmachen“ ist jetzt ein eigenes Dropdown mit den Einträgen „Mitmachen“ und „Forum“. +- „Forum“ wurde aus dem Radio-Dropdown entfernt und auch im Footer dem Bereich „Mitmachen“ zugeordnet. +- Die ARM64-Buildskripte ergänzen vor dem Build automatisch fehlende oder unvollständige `go.sum`-Einträge. +- Keine neue Datenbankmigration erforderlich. + +## v1.4.1 – Firebase-Push für Jens-Todos und Landwelle IT + +- Offizielles Firebase Admin SDK für Go als serverseitiger FCM-Gegenpart integriert. +- Firebase wird einmalig zentral beim Portalstart aus einem sicheren absoluten Service-Account-Pfad initialisiert. +- Nach einem erfolgreichen neuen Todo-Insert wird für Verfasser oder Ersteller Jens eine Topic-Nachricht an `landwelle_it_jens_todos` gesendet. +- Updates, Löschungen, Listenaufrufe und normale Seitenansichten lösen keinen Push aus. +- Jens-Erkennung nutzt bevorzugt `LANDWELLE_TODO_JENS_USER_ID`, `author_user_id` und `created_by_user_id`; Namen dienen nur als eindeutiger Fallback. +- Doppelte Formulare werden über `create_request_id`, doppelte Pushes über `(todo_id, topic)` verhindert. +- Erfolg und Fehler werden mit Zeitstempel, Todo-ID, Topic und Firebase Message-ID beziehungsweise bereinigtem Fehler gespeichert und protokolliert. +- Admin-Testversand unter `/admin/todos/firebase-test` mit Sitzung, Berechtigung und CSRF-Schutz. +- Interne App-Endpunkte unter `https://api.landwelle.de/api/mobile/todos?author=Jens` und `/api/mobile/status` dokumentiert und proxyfähig gemacht. +- Migration `0021_todo_firebase_push.sql`, OpenAPI-Vertrag `openapi/landwelle-it-api.yaml` und separate App-Übergabe ergänzt. + +## v1.4.0 – Vollständige Android-/iOS-App-API + +- `api.landwelle.de/v1` als kanonische, versionierte Produktionsbasis ergänzt. +- App-Bootstrap mit Feature-Flags, Branding, Stream und Endpunktverzeichnis erweitert. +- Station, Now Playing, Livestudio, Playlist-Historie, Nachrichten, Veranstaltungsdetails, Programm, Team, Charts, Wetter, Verkehr, Ausflüge und Regionen über API v1 bereitgestellt. +- Anonyme Installationsregistrierung mit einmaligem Secret und ausschließlich gehashtem Serverwert umgesetzt. +- Push-Token verschlüsselt, Themenverwaltung und Push-Öffnungsbestätigung ergänzt. +- Optionale Nutzungsstatistik an Einwilligung, feste Ereignisnamen und Feld-Whitelists gebunden. +- Release- und Kompatibilitätsabfragen für Android-Sideload, Google Play, Beta und Apple App Store ergänzt. +- OpenAPI-Vertrag 1.0.0, separate App-Chatübergabe, API-Anforderungsvorlage, KeyHelp-Anleitung und Store-Releaseplan erstellt. +- Website-Scraping und direkte Drittanbieterzugriffe für die App ausdrücklich ausgeschlossen. + +## v1.3.26 – Verbindliche lokale Nachrichtenpriorität + +- Nachrichten aus dem Landeszeitung-RSS „Der Norden“ werden nicht mehr nur per Prompt bevorzugt, sondern technisch verbindlich eingeplant. +- Bei mindestens zwei geeigneten heutigen Landeszeitung-Meldungen stammen zwei der drei produzierten Beiträge aus dem lokalen Feed. +- Bei genau einer geeigneten heutigen Landeszeitung-Meldung wird mindestens diese Meldung verwendet. +- Jede KI-Meldung wird über eine eindeutige interne Quellen-ID an einen konkreten RSS-Artikel gebunden. +- Doppelte Quellen-IDs werden abgewiesen und lösen automatisch einen korrigierten OpenAI-Aufruf aus. +- Ist der Landeszeitung-Feed technisch nicht erreichbar, bricht die Produktion mit einer klaren Fehlermeldung ab, statt still vollständig auf andere Quellen auszuweichen. +- Live-Modal zeigt Anzahl der gefundenen lokalen Meldungen und die verbindlich eingeplante Lokalquote an. +- Keine Datenbankmigration erforderlich. + +## v1.3.25 – Exakt drei strukturierte OpenAI-Nachrichten + +- Fehler `OpenAI lieferte 1 statt genau 3 Nachrichtenmeldungen` behoben. +- Die Nachrichtenerzeugung verwendet jetzt die Structured Outputs der OpenAI Responses API. +- Ein striktes JSON-Schema erzwingt ein Array mit exakt drei Meldungen. +- Jede Meldung enthält getrennte Felder für Emotion, Ort beziehungsweise Region und gesprochenen Text. +- Landwelle validiert Emotion-Tag, Ortsangabe und Meldungstext und baut daraus erst danach den TTS-Text. +- Die Aufteilung hängt nicht mehr von Leerzeilen, Markdown oder frei formatierten Emotion-Tags ab. +- Tests für Schema, Anzahl und Konvertierung in das Landwelle-Sendeformat ergänzt. +- Keine Datenbankmigration erforderlich. + +## v1.3.24 – OpenAI-Temperatur-Kompatibilität + +- OpenAI-HTTP-400-Fehler `Unsupported parameter: temperature` im Nachrichtenstudio behoben. +- Bei GPT-5- und Reasoning-Modellen wird `temperature` nicht mehr an die Responses API gesendet. +- Für andere Modelle bleibt die konfigurierbare Temperatur erhalten. +- Meldet ein weiteres Modell den Parameter dennoch als nicht unterstützt, wird dieselbe Anfrage automatisch einmal ohne `temperature` wiederholt. +- Die drei Nachrichtentexte, die Modal-Liveanzeige, ElevenLabs-Erzeugung und FTP-Ausgabe bleiben unverändert. +- Automatische Tests für GPT-5-Anfragen und den kompatiblen Wiederholungsversuch ergänzt. +- Keine Datenbankmigration erforderlich. + +## v1.3.23 – Direkter HTML-Livestream für die MP3-Produktion + +- Den weiterhin auftretenden Fehler „Der Server lieferte keine gültige JSON-Antwort: 404 page not found“ grundlegend beseitigt. +- Der Produktionsbutton verwendet keine Fetch-Anfrage, keine JSON-Startantwort und kein separates Status-Polling mehr. +- Das Formular wird als normale, authentifizierte POST-Anfrage in ein Modal-Iframe gesendet. +- Der Produktionsjob läuft weiterhin serverseitig im Hintergrund; das Modal erhält dessen Fortschritt über einen fortlaufenden HTML-Stream auf derselben Route `/admin/ai/news`. +- Quellenabruf, OpenAI-Erzeugung, jede ElevenLabs-MP3, jeder FTP-Upload und der Abschluss werden live angezeigt. +- Das Schließen des Modals beendet den bereits gestarteten Produktionsjob nicht. +- Konfigurations- und Voice-ID-Fehler erscheinen ebenfalls direkt im Modal. +- Der ausführliche Landwelle-Nachrichtenprompt ist nun der Standardprompt; ein noch unveränderter alter Kurz-Standardprompt wird automatisch ersetzt. +- Keine Datenbankmigration erforderlich. + +## v1.3.22 – Proxy-sichere Live-Statusabfrage + +- Fehler „Der Server lieferte keine gültige JSON-Antwort: 404 page not found“ beim Start der MP3-Produktion behoben. +- Das Live-Polling verwendet jetzt den bereits freigegebenen Pfad `/admin/ai/news?job_status=` statt des bei engen KeyHelp-/Apache-Regeln problematischen Unterpfads `/admin/ai/news/job/`. +- Der bisherige Status-Unterpfad bleibt aus Kompatibilitätsgründen erhalten. +- Erfolgs- und Fehlerantworten der Statusabfrage bleiben durchgehend gültiges JSON. +- Automatische Tests für JSON-Statusantworten und die proxy-sichere Browserroute ergänzt. + +## v1.3.21 – Versions-Binary und Dokumentationsübergabe + +- ARM64-Portalbinary nach der Versionsänderung vollständig neu gebaut. +- Fehler behoben, durch den das v1.3.20-Paket weiterhin `Landwelle v1.3.19` meldete. +- Update-Skript selbst war korrekt und verglich die tatsächlich ausgelieferte Binary mit `/version`. +- README, ROADMAP, CONTRIBUTING und CHATUEBERGABE auf den konsolidierten Stand v1.3.21 gebracht. +- Referenzpaket für die Weiterarbeit in einem neuen Chat aktualisiert. + +## v1.3.19 – Live-Produktionsstatus und Auto-Aufgaben + +- Live-Statusmodal für Nachrichtenproduktionen ohne Proxy-Timeout. +- Datenbankgestützte Zeitplanung für Nachrichten, Sport und Wetter mit Uhrzeit, Wochentagen und Aktivstatus. +- Migration 0020_ai_auto_tasks.sql. + + +## v1.3.20 – Live-Status JSON und API-Startseite + +- Live-Produktionsstart und Statusabfrage liefern auch bei Fehlern ausschließlich gültiges JSON. +- Browser zeigt verständliche Serverfehler statt eines JSON.parse-Fehlers. +- API-Root wird über Host-Erkennung sowie `/api` und `/api/` abgesichert. +- KeyHelp-Dokumentation verwendet eine zuverlässige exakte RewriteRule. + + +## v1.3.18 – Nachrichtenquellen und asynchrone Produktion + +- Nachrichtenproduktion läuft als Hintergrundauftrag und ist nicht mehr vom Apache-/Proxy-Timeout des Adminrequests abhängig. +- Nach dem Start erfolgt sofort eine Weiterleitung mit sichtbarer Statusmeldung. +- Nachrichtenquellen werden serverseitig unmittelbar vor der Produktion abgerufen. +- Landeszeitung, tagesschau.de, n-tv und WELT werden als konfigurierbare RSS-Quellen unterstützt. +- Ausschließlich Meldungen mit Veröffentlichungsdatum des aktuellen Tages werden an OpenAI übergeben. +- Der Fach-Prompt erhält belegbares Quellenmaterial statt einer nicht ausführbaren Aufforderung zum eigenen Browsen. +- Die drei Nachrichten werden in einem gemeinsamen OpenAI-Lauf erstellt, anschließend getrennt und als drei einzelne MP3-Dateien produziert. +- Fehlerhafte Ausgaben mit weniger oder mehr als drei Meldungen werden vor der Vertonung abgewiesen. + +## v1.3.17 – Migration 0019 Hotfix + +- `0019_admin_todos_mobile_api.sql` an das bestehende Berechtigungsschema angepasst. +- Berechtigung wird über `permissions.slug` statt nicht vorhandener `key`-Spalte angelegt. +- Administrator-Zuordnung verwendet `role_slug` und `permission_slug`. +- Die fehlgeschlagene Migration kann unverändert erneut ausgeführt werden. + +## v1.3.17 – Neutrale API-Startseite + +- Eigene, nicht indexierbare Hinweis-Seite für den Aufruf von `api.landwelle.de/` ergänzt. +- Die Seite veröffentlicht keine Endpunktliste, Versionsnummern oder internen Serverdetails. +- KeyHelp-Apache-Konfiguration um ein exaktes Root-Proxy-Matching auf `/api/info` erweitert. +- Mobile-API und Health-Endpunkt bleiben getrennt erreichbar. + +## v1.3.15 – Nachrichtenstudio-Auswahl und API-Subdomain + +- Stimme und Hintergrundmusik werden im Nachrichtenstudio serverseitig als ausgewählte Optionen gerendert. +- Die Speicherung hängt nicht mehr von Inline-JavaScript ab. +- Voice-ID, Musikbett sowie TTS- und Hintergrundpegel bleiben nach dem Speichern und Neuladen erhalten. +- Dokumentation für `api.landwelle.de` als Apache-Reverse-Proxy ergänzt. + +## v1.3.13 – Nachrichtenstudio Aktions-Hotfix + +- Fehler „Unbekannte Aktion“ beim Speichern und bei der MP3-Produktion behoben. +- Aktionswert wird vor dem Deaktivieren des Absende-Buttons in einem versteckten Formularfeld gesichert. +- Serverseitiger Fallback für ältere zwischengespeicherte JavaScript-Dateien ergänzt. +- Arbeitsstatus der Buttons bleibt erhalten, ohne den Formularwert zu verlieren. + +## v1.3.12 – Nachrichtenstudio Formular-Hotfix + +- Unsichtbare Pflichtfelder in inaktiven Tabs blockieren Speichern und MP3-Produktion nicht mehr. +- Validierung erfolgt zuverlässig serverseitig. +- Speichern und Produktion zeigen während des Absendevorgangs einen sichtbaren Arbeitsstatus. +- Gespeicherte Prompt-, Voice-, Musik-, dB- und FTP-Werte bleiben nach dem Neuladen erhalten. + +# v1.3.11 – KI-Audiopegel in dB + +- Button „KI-Studio öffnen“ aus `/admin/settings` entfernt. +- TTS- und Hintergrundpegel im Nachrichtenstudio von Prozent auf dB umgestellt. +- Standardpegel: TTS +12 dB, Hintergrund −16 dB. +- Pegel werden als `tts_gain_db` und `background_gain_db` in den Studioeinstellungen gespeichert. +- Bestehende Prozentkonfigurationen werden einmalig auf die neuen dB-Standardwerte migriert. +- ffmpeg-Audiomix verwendet direkte dB-Gain-Filter. + +# v1.3.10 – Dokumentation und Chatübergabe + +- README auf den tatsächlichen Funktionsstand aktualisiert. +- ROADMAP auf v1.3.10 konsolidiert und veraltete Angaben entfernt. +- CONTRIBUTING um aktuelle Release-, Migration-, Multipart-, Pagination- und KI-Audio-Regeln ergänzt. +- CHATUEBERGABE vollständig für die Fortsetzung in einem neuen Chat neu aufgebaut. +- Migrationsstand bis `0018_ai_audio_profiles.sql` dokumentiert. + +# v1.3.9 – Sicherheitsprüfung beim Speichern + +- Multipart-Verarbeitung des Einstellungsformulars korrigiert. +- CSRF-Token wird beim normalen Speichern wieder zuverlässig eingelesen. +- Die CSRF-Prüfung bleibt unverändert aktiv und wird nicht umgangen. +- Erfolgsmeldung nach dem Speichern korrigiert; kein automatischer destination.one-Import wird mehr behauptet. + +# v1.3.8 – Migration 0018 Hotfix + +- Eigene `BEGIN`-/`COMMIT`-Anweisungen aus `0018_ai_audio_profiles.sql` entfernt. +- Die Migration ist damit mit dem transaktionsverwaltenden Landwelle-Migrator kompatibel. +- Eine zuvor fehlgeschlagene 0018 kann nach dem Update erneut ausgeführt werden. + +# v1.3.7 – Einstellungen und KI-Audiomix + +- Speichern und destination.one-Import getrennt. +- Stimmenverwaltung repariert. +- Hintergrundmusik-Upload und Auswahl pro KI-Bereich. +- TTS- und Hintergrundlautstärke pro Nachrichten-, Sport- und Wetterprofil. +- KI-Audiokonfiguration wird mit PostgreSQL über Migration 0018 gespeichert. +- MP3-Mix mit ffmpeg vor dem FTP-Upload. + +## v1.3.6 – Landeszeitung-RSS und automatische Aktualisierung + +- Externe Niedersachsen-Nachrichten auf den RSS-Feed „Der Norden“ der Landeszeitung umgestellt. +- Startseite und `/aktuelles` verwenden dieselbe chronologisch gemischte Liste aus eigenen Beiträgen und RSS-Meldungen. +- RSS-Abruf läuft automatisch im Hintergrund; die Quelle wird alle fünf Minuten zur Aktualisierung vorgemerkt. +- ETag und Last-Modified werden für ressourcenschonende Aktualisierungen verwendet. +- Bei vorübergehenden Feed-Fehlern bleibt der letzte erfolgreiche Datenbankstand sichtbar. +- Frühere externe Quellen und deren veröffentlichte Einträge werden durch Migration `0017_landeszeitung_news_feed.sql` deaktiviert. + + +## v1.3.5 – Nachrichtenstudio: Standardlayout und drei MP3-Ausgaben + +- `/admin/ai/news` an das helle, einheitliche Admin-Design angepasst. +- Verschobene Texte, Kartenbreiten und Formularabstände korrigiert. +- Zentralen Master-Prompt entfernt; Nachrichten, Sport und Wetter besitzen nur noch eigene Fach-Prompts. +- Jeder Produktionslauf erzeugt drei eigenständige Beiträge und drei separate MP3-Dateien. +- Pro MP3 sind FTP-Zielordner und gewünschter Dateiname getrennt konfigurierbar. +- Bestehende v1.3.4-Einstellungen werden beim Laden automatisch übernommen und auf drei Ausgaben ergänzt. +# v1.3.4 + +- Nachrichtenstudio visuell an den Landwelle-Stil angepasst. +- Kontraste, Typografie, Eingabefelder, Tabs und Produktionshistorie verbessert. +- Landwelle-Grün als konsistenter Akzent eingesetzt. +- Responsive Darstellung und Fokuszustände optimiert. + +# v1.3.3 + +- `/admin/ai/news` als vollständiges Nachrichtenstudio umgesetzt. +- Tabs für Nachrichten, Sport und Wetter ergänzt. +- Zentraler Master-Prompt sowie Fach-Prompts, OpenAI-Modell und Temperatur konfigurierbar. +- ElevenLabs-Voice-ID und FTP-Zielpfad je Bereich hinterlegbar. +- Produktionskette OpenAI → ElevenLabs MP3 → FTP samt Historie umgesetzt. +- Zugangsdaten verbleiben in den zentralen Systemeinstellungen. + +## v1.3.2 – KI-&-Audio-Untermenüs + +- Acht neue Unterseiten unter KI & Audio ergänzt. +- Eigene Adminrouten für Nachrichten, Mondkalender, Wünsche, Bauernkalender, Gedenktage, Heute ist der..., Tageshoroskope und Auto Aufgaben. +- Einheitliche vorbereitete Moduloberflächen und Navigation. + +## v1.3.0 – Medienverwaltung, Team-Bildauswahl und Eventfilter + +- `/admin/media` professionell neu gestaltet, Upload-Modal und serverseitige Pagination mit 24 Bildern pro Seite. +- `/admin/team` erhält eine Mediengalerie als zweites Modal zur Übernahme des Bildpfads. +- Öffentliche Veranstaltungen ignorieren zusätzlich fehlerhaft lang laufende und mehr als 14 Tage zurückliegende Alttermine. + +# Changelog + +## v1.2.8 – Professionelle Teamverwaltung + +- `/admin/team` als moderne Kartenansicht mit Kennzahlen neu gestaltet. +- Neues Teammitglied wird über einen klaren Aktionsbutton in einem responsiven Modal angelegt. +- Bestehende Teammitglieder werden vollständig vorausgefüllt in einem Bearbeitungsmodal geöffnet. +- Öffentliche Sichtbarkeit, Rollen, Profilbild, Region, Sortierung und Biografie bleiben zentral pflegbar. +- Responsive Darstellung und Tastaturbedienung inklusive Escape-Schließen ergänzt. + +## v1.2.8 – Programm mit Team verknüpft + +- Moderator und Bild werden in der Programmverwaltung über ein Teammitglied ausgewählt. +- Startseite und Programm-Highlights verwenden automatisch das aktuelle Teamfoto. +- Migration 0016 verknüpft Programmeinträge mit `team_members`. + +# Landwelle v1.2.6 + +- Bearbeiten von Sendungen unter `/admin/program` erfolgt jetzt in einem responsiven Modal. +- Bearbeitungsdaten werden vorausgefüllt; Abbrechen, Hintergrundklick und Escape schließen das Modal. +- Der ausgewählte Wochentag bleibt beim Öffnen der Bearbeitung erhalten. + +# v1.2.4 – Professionelle Programmverwaltung + +- `/admin/program` neu strukturiert. +- Neue Sendungen werden über ein responsives Modal angelegt. +- Professionelle Tabellenansicht mit Status, Programmart und Aktionen. +- Kennzahlen, direkter Frontend-Link und verbesserte mobile Darstellung. + +## v1.2.2 +- Offizielles Wallpaper-Paket mit ZIP-Datei und Vorschaubild im Downloadbereich ergänzt. +- Kryptografische Token-Links für Downloads und Vorschaubilder eingeführt. +- Serverseitige Pagination für Niedersachsen-Hub-Termine im Adminbereich ergänzt. +- Hub-Datensätze werden seitenweise mit LIMIT/OFFSET geladen. + +## v1.2.1 +- Admin-Veranstaltungen in die Tabs „Niedersachsen Hub“ und „Eigene Einsendungen“ getrennt. +- Statusabhängige Aktionen: veröffentlichte Termine zeigen keine Freigabe-/Ablehnen-Schaltflächen mehr. +- Archivieren aus der Veranstaltungsverwaltung entfernt. +- Abgelaufene Niedersachsen-Hub-Termine werden automatisch aus der Datenbank gelöscht. +- Tab-Zähler, Status-Badges und klarere Leerezustände ergänzt. + +## v1.2.0 +- Große Admin-Ausbaustufe: Charts, Jahrescharts, Veranstaltungsmoderation und Audit-Protokoll. +- Programmplanung um Konfliktprüfung ergänzt. +- Öffentliche Jahreschartseite aktiviert. +- Roadmap auf den tatsächlichen Stand aktualisiert. + +## v1.1.52 +- Admin-Navigation über alle Unterseiten vereinheitlicht und auf denselben Stylesheet-Stand gebracht. +- Löschen von Programmeinträgen korrigiert und serverseitig verifiziert. +- Automatisches Wiederherstellen gelöschter Standardprogramme entfernt. +- Öffentliche Programmseite als direkte Ansicht des gemeinsamen Program Stores bestätigt. +- Roadmap vollständig auf den aktuellen Projektstand gebracht. + +## v1.1.51 +- Textposition im Hero von `/ausflugstipps` korrigiert. +- Zentrierte Seitenbreite und responsive Innenabstände wiederhergestellt. + +## v1.1.50 +- Vorhandene Hero-Grafik auf `/ausflugstipps` eingebaut. +- Responsiven Bildausschnitt und Overlay für gute Lesbarkeit ergänzt. + +## v1.1.49 +- Vorhandene Mitmachen-Hero-Grafik auf `/mitmachen` eingebunden. +- Responsiven Bildausschnitt und Overlay für gute Lesbarkeit ergänzt. +- Formular- und Wunschlistenfunktion unverändert beibehalten. + +## v1.1.48 +- Vorhandene Studio-/Landschaftsgrafik als Hero auf `/programm` eingebunden. +- Lesbarkeit durch responsives Overlay und optimierten mobilen Bildausschnitt verbessert. + +## v1.1.47 +- Programmseite im Stil von `/mitmachen` vollständig neu gestaltet. +- Wochenplan von Montag bis Sonntag mit kompakter Tagesnavigation ergänzt. +- Tägliche Sendungen werden automatisch an allen sieben Tagen angezeigt. +- Aktuelle Live-Sendung und kompakte Programmliste hervorgehoben. + +## v1.1.46 +- Vorhandene Verkehrsgrafik als Hero auf `/verkehr` eingebaut. +- Responsiven Bildausschnitt und dunkles Overlay für gute Lesbarkeit ergänzt. + +## v1.1.45 +- `/verkehr` kompakt im Stil von `/mitmachen` neu gestaltet. +- Meldungen in einer intern scrollbaren Hauptkarte gebündelt. +- Besuchertexte und Datenquellen-Hinweise überarbeitet. + +## v1.1.44 +- Startseite zeigt im Bereich Veranstaltungen automatisch die drei zeitlich nächsten veröffentlichten Termine. +- Bilder, Datum, Veranstaltungsort und Titel werden direkt aus dem Veranstaltungskalender übernommen. +- Lokales Ersatzbild ergänzt, falls ein Termin kein Bild besitzt. + +## v1.1.43 +- HTML-Beschreibungen aus destination.one werden in sauberen, lesbaren Text umgewandelt. +- Absätze, Zeilenumbrüche und Listen bleiben erhalten; sichtbare Tags wie `

` oder `

` werden entfernt. +- HTML-Entities wie `&` und ` ` werden korrekt entschlüsselt. + +## v1.1.42 +- Veranstaltungs-Pagination kompakt gestaltet. +- Statt aller Seitenzahlen werden nur erste, letzte und Seiten rund um die aktuelle Seite angezeigt. +- Auslassungspunkte sowie optimierte mobile Navigation ergänzt. + +## v1.1.41 +- destination.one-Bilder aus dem ET2014A-Feld `media_objects` übernommen. +- Standardbild mit `rel=default` wird bevorzugt; Galerie-Bilder dienen als Fallback. +- Nicht-Bild-Links wie Veranstaltungswebseiten werden nicht mehr als Bild interpretiert. + +## v1.1.40 +- Veranstaltungskalender auf maximal sechs Termine pro Seite begrenzt. +- Seitennavigation mit Zurück, Weiter und direkten Seitenzahlen ergänzt. +- Kategorieauswahl bleibt beim Blättern erhalten. + +## v1.1.39 +- destination.one-Abruf fest auf den bestätigten Niedersachsen-Hub-Endpunkt umgestellt. +- Experience, type und ET2014A-Template werden nicht mehr frei konfiguriert. +- Parserfehler behoben: Event-Felder wie `features` werden nicht länger fälschlich als Container behandelt. +- Adminbereich benötigt nur noch den Lizenzschlüssel sowie Intervall und Veröffentlichungsstatus. + +## v1.1.38 +- destination.one ET2014A-Containerparser ohne vorzeitige Feldtyp-Filterung neu aufgebaut. +- Jedes Objekt im offiziellen `items`-Array wird jetzt an den Event-Parser übergeben. +- Diagnosemeldung mit Parserkennung v4 ergänzt, um veraltete Deployments sofort zu erkennen. + +## v1.1.37 +- destination.one ET2014A-Containerparser korrigiert. +- Zu strenge Vorfilterung von `items` entfernt; Datensätze werden erst im eigentlichen Event-Parser validiert. +- Groß-/Kleinschreibung und zusätzlich verschachtelte `item`/`items`-Container werden unterstützt. +- Importfehler nennen nun konkrete fehlende Felder wie Titel, Termin oder Ort. + +## v1.1.36 +- destination.one ET2014A-Parser an die reale Niedersachsen-Hub-Antwort angepasst. +- `items` werden jetzt auch erkannt, wenn das Datum in `timeIntervals` liegt. +- Beschreibungen aus `texts` (`details`/`teaser`), Kategorien-Arrays, Adressen, Links und Lizenzfelder werden verarbeitet. +- Importfehler zeigen jetzt konkrete Gründe, wenn gelieferte Events nicht übernommen werden konnten. +- Parser-Tests mit einer ET2014A-typischen Event-Struktur ergänzt. + +## v1.1.35 +- destination.one-Import repariert und mit sofort sichtbarer Erfolgs- oder Fehlermeldung versehen. +- Offizielles JSON-Template, `type=Event`, deutscher Markt, Jahreszeitraum und Pagination werden automatisch ergänzt. +- Leere oder nicht lesbare API-Antworten werden nicht mehr still als erfolgreicher Import mit 0 Terminen behandelt. +- Datenbank- und Migrationsfehler werden im Adminbereich verständlich angezeigt. + +## v1.1.34 +- destination.one-Anbindung für Veranstaltungen aus dem Niedersachsen Hub ergänzt. +- Lizenzschlüssel, API-URL, Experience, Parameter, Importintervall und Veröffentlichungsmodus im Adminbereich unter Einstellungen konfigurierbar. +- Automatische, wiederkehrende Synchronisierung mit Dublettenabgleich über externe IDs. +- Externe Bilder, Quellen- und Lizenzangaben werden am Veranstaltungsdatensatz gespeichert. +- Migration `0014_destination_one_events.sql` ergänzt. +- Impressum auf SLMM GbR / Landwelle mit Jens Bramsche und Jörg Weiß als Gesellschafter und Geschäftsinhaber aktualisiert. + +## v1.1.33 +- Neue Hero-Grafik auf `/veranstaltungen` eingebaut. +- Veranstaltungsseite mit stimmungsvollem Niedersachsen-Eventmotiv visuell aufgewertet. +- Hero-Overlay und responsiven Bildausschnitt optimiert. + +## v1.1.32 +- Abonnierbaren iCal-Feed unter `/veranstaltungen/kalender.ics` ergänzt. +- Pro Veranstaltung einen direkten Link zum Übernehmen in Google Kalender hinzugefügt. +- Kalender-Abo und Kalenderdatei auf der öffentlichen Veranstaltungsseite sichtbar gemacht. +- iCal-Export enthält Titel, Zeitraum, Ort, Beschreibung, Kategorie und Veranstalter-Link. + +## v1.1.31 +- Vollständigen Veranstaltungskalender unter `/veranstaltungen` umgesetzt. +- Modal zur Einsendung eigener Veranstaltungen inklusive Grafik-Upload ergänzt. +- Bestätigungs-E-Mail an Einsender sowie Redaktions-E-Mail an `radio@landwelle.de` mit Grafik-Anhang ergänzt. +- Neue bearbeitbare E-Mail-Templates `event_submission_confirmation` und `event_submission_admin` ergänzt. +- Datenmodell und Migration `0013_event_calendar.sql` für geprüfte, veröffentlichte und externe Termine ergänzt. +- Navigation direkt auf die Veranstaltungsseite umgestellt. +- Recherche und Quellenstrategie für niedersachsenweite Veranstaltungsdaten dokumentiert. + +## v1.1.30 +- `/aktuelles` optisch an die Seite `/mitmachen` angepasst. +- Nachrichten-Aufmacher, Seitenkarte und News-Wall im einheitlichen Landwelle-Stil neu aufgebaut. +- Besuchertekste vollständig überarbeitet und technische Formulierungen entfernt. +- Artikelseite sprachlich verständlicher und persönlicher gestaltet. + +## v1.1.29 +- Bereits erstellte Hero-Grafik auf `/aktuelles` eingebaut. +- Nachrichten-Hero mit responsivem Bildausschnitt und Lesbarkeits-Overlay modernisiert. +- Kein zusätzlicher Text wurde in die Grafik eingebettet. + +## v1.1.28 +- `/aktuelles` als eigenständige professionelle Nachrichtenseite umgesetzt. +- Veröffentlichte eigene Redaktionsbeiträge und freigegebene RSS-Meldungen werden chronologisch gemischt. +- Eigene Beiträge werden als „Landwelle Original“ gekennzeichnet und erhalten eigene Artikelseiten. +- Aufmacher, Topmeldungen, Newsfeed, Quellenkennzeichnung und responsive Darstellung ergänzt. +- Hauptnavigation von Startseiten-Anker auf `/aktuelles` umgestellt. + +## v1.1.27 +- Neues Landwelle-Fallback-Cover für Titel ohne verfügbares iTunes-/Artwork eingebunden. +- Standardbild `artist-current.jpg` im Frontend und Backend durch die neue Landwelle-Grafik ersetzt. +- Fallback greift jetzt einheitlich in Now Playing, Player, Live-Studio, Playlist und Charts. + +## v1.1.26 +- Seite `/mobile-app` vollständig professionell überarbeitet. +- CSS-basierte Smartphone-App-Vorschau ohne neue Bildassets ergänzt. +- Bereiche für Plattformstatus, Funktionen, Roadmap und mobile Nutzung hinzugefügt. +- Seite auf aktuelles Stylesheet, Auth-Modal und Cookie-Einstellungen umgestellt. + +## v1.1.25 +- Neue Hero-Grafik auf `/empfangen` eingebaut. +- Empfangsseite visuell mit Küstenmotiv, Empfangsgeräten und Overlay modernisiert. +- Responsiven Bildausschnitt für kleinere Displays optimiert. + +## v1.1.24 +- Seite `/empfangen` auf den aktuellen Empfangsstand gebracht. +- Alexa, radio.de und myTuner als bereits verfügbar gekennzeichnet. +- Veraltete Hinweise auf vorbereitete Verzeichniseinträge entfernt. +- Empfangsseite optisch modernisiert und auf das aktuelle Stylesheet umgestellt. + +## v1.1.23 +- Downloadseite komplett modernisiert und visuell aufgewertet. +- Hero mit Desktop-Player-Vorschau, Plattformkarten, Featurebereich und Web-Player-CTA ergänzt. +- Veraltetes Stylesheet auf `/downloads` ersetzt; Login-/Registrieren-Schaltfläche und Auth-Modal werden wieder korrekt dargestellt. +- Cookie-Einstellungen auf der Downloadseite ergänzt. + +## v1.1.22 +- Landwelle Schlager Charts als vollwertige Chartseite wie die Zuhörer Charts umgesetzt. +- Eigene Hero-Grafik für `/charts/schlager` eingebaut. +- Schlagercharts mit Top 3, Rangliste, Trend, Vorwoche, Einstieg, Hörprobe, Voting und Live-Countdown ergänzt. +- Chart-Frontend für mehrere Charttypen verallgemeinert. + +# Changelog + +## 1.1.21 – 2026-07-18 + +- Neue, eigens gestaltete Hero-Grafik auf `/charts/zuhoerer` eingebaut. +- Responsive Bildpositionierung und dunkle Lesbarkeits-Overlays ergänzt. +- Chart-Hero optisch an den Landwelle-Küstenstil angepasst. + +## Landwelle v1.1.19 – 18. Juli 2026 + +- Zuhörercharts: sekundengenauer Live-Countdown bis zur nächsten möglichen Bewertung. +- Voting-API liefert `next_vote_at` und `retry_after_seconds` auch nach erfolgreichem Voting. +- Voting wird nach Ablauf des Countdowns im Browser automatisch wieder freigegeben. + +## Landwelle v1.1.18 – 18. Juli 2026 + +### Zuhörercharts + +- `/charts/zuhoerer` optisch an `/mitmachen` angepasst +- Top 3 prominent dargestellt +- Rangliste bis Platz 45 +- Anzeige von Vorwoche, Einstieg und Trend +- Bewertung mit 1 bis 5 Punkten +- sichtbares Badge „Du hast gevotet“ nach erfolgreicher Bewertung +- serverseitige 24-Stunden-Sperre je Titel und Besucher +- Votingstatus bleibt nach einem Neuladen sichtbar +- Durchschnitt und Stimmenzahl werden nach dem Voting aktualisiert +- Vorhörmodal stoppt die Audiowiedergabe beim Schließen + +## Landwelle v1.1.17 + +- doppelte Registrierung von `/charts/zuhoerer` entfernt +- Start-Panic des Go-ServeMux behoben +- Readiness-Check und Rollbackfähigkeit des Update-Skripts bestätigt + +## Landwelle v1.1.16 + +- datenbankgestützte Zuhörercharts eingeführt +- Migration `0012_listener_charts.sql` +- Tabellen `chart_entries` und `chart_votes` +- initiale Chartbefüllung aus der Playlist-Historie +- Voting- und Vorhörgrundlage + +## Landwelle v1.1.15 + +- Forum in das Dropdown „Radio“ verschoben +- neues Dropdown „Charts“ +- Links für Zuhörer-, Schlager- und Jahrescharts ergänzt + +## Landwelle v1.1.14 + +- überarbeitete Playlist-Hero-Grafik mit kleinerer Schrift und kleineren Coverkarten eingebaut +- neuer Assetname zur sicheren Cache-Aktualisierung + +## Landwelle v1.1.13 + +- Playlist-Hero mit versioniertem Dateinamen eingebunden +- Assetcache-Problem beseitigt + +## Landwelle v1.1.12 + +- neues kompaktes Playlist-Hero eingebaut + +## Landwelle v1.1.11 + +- Playlist-Hero proportional an kompakte Höhen angepasst + +## Landwelle v1.1.10 + +- kompakter Playlist-Hero für Desktop, Tablet und Smartphone + +## Landwelle v1.1.9 + +- Playlist-Hero erstmals integriert + +## Landwelle v1.1.8 + +- Playlist optisch an `/mitmachen` angepasst +- maximal 15 Titel pro Seite +- Live-Suche und Datums-/Uhrzeitfilter +- Gruppierung nach Tagen + +## Landwelle v1.1.7 + +- Cover ausschließlich über Apple iTunes +- AzuraCast-Artwork und weitere externe Coverquellen entfernt + +## Landwelle v1.1.6 + +- zentrale Coverermittlung und verbesserte Titelnormalisierung + +## Landwelle v1.1.5 + +- Playlist-Historie und Menüpunkt „Playlist“ eingeführt +- Migration `0011_playlist_history.sql` + +## Landwelle v1.1.4 + +- dynamisches Kontomenü für angemeldete Benutzer + +## Landwelle v1.1.3 + +- Forum-Kategorien im Adminbereich bearbeitbar +- Kategorie „Rezepte“ +- Registrierungsfehler behoben +- Willkommens-E-Mail und Template eingeführt +- Migration `0010_forum_registration_email.sql` + +## Landwelle v1.1.2 + +- Forum-Hero integriert + +## Landwelle v1.1.1 + +- kompaktes Forum-Layout im klassischen Forenstil + +## Landwelle v1.1.0 + +- Team, Forum und öffentliche Benutzerkonten +- Migration `0009_team_forum_public_auth.sql` + +## Landwelle v1.2.3 + +- Pagination im Niedersachsen-Hub sichtbar und auf zehn Termine pro Seite reduziert +- `LIMIT` und `OFFSET` werden jetzt vor der JSON-Aggregation auf die Veranstaltungszeilen angewendet +- Zurück/Weiter bleiben auf der ersten und letzten Seite sichtbar und sind dort deaktiviert +- Seitenstatus zeigt Gesamtzahl und Seitengröße an + +## Landwelle v1.2.5 + +- „Alle Sendungen“ in der Programmverwaltung nach Montag bis Sonntag aufgeteilt +- Tagesnavigation mit Eintragszähler und Hervorhebung des aktuellen Tages +- tägliche Sendungen erscheinen automatisch an allen sieben Wochentagen +- nur die Sendungen des gewählten Tages werden angezeigt +- Tastaturnavigation und mobile horizontale Tagesauswahl ergänzt + +## Landwelle v1.2.9 + +- öffentliche Veranstaltungslisten zeigen nur noch laufende oder zukünftige Termine +- Startseite verwendet automatisch die drei zeitlich nächsten gültigen Veranstaltungen +- Termine ohne Endzeit bleiben am Veranstaltungstag sichtbar und verschwinden erst nach Tagesende +- abgelaufene Niedersachsen-Hub-Termine werden nach derselben Logik bereinigt +- alte Termine vom Vortag erscheinen weder auf der Startseite noch unter `/veranstaltungen` + +## 1.3.1 + +- PostgreSQL-Fehler in der Medien-Pagination behoben: `count(*)` wird nicht mehr innerhalb von `json_agg` verschachtelt. +- Dieselbe fehlerhafte Zählabfrage beim Löschen von Medienobjekten korrigiert. +- `/admin/media` kann dadurch wieder geladen und paginiert werden. + +## v1.3.14 +- Neue Admin-Kategorie „Aufgaben & Status“ mit datenbankgestützter Todo-Liste. +- Mobile-API `GET /api/mobile/todos?author=...` gemäß App-Vertrag ergänzt. +- Serverseitige Dienstprüfung unter `GET /api/mobile/status` ergänzt. +- Optionale Bearer-Authentifizierung über `LANDWELLE_MOBILE_API_TOKEN`. +- Konfigurierbare Statusziele über `LANDWELLE_STATUS_SERVICES`. +- Todo-Änderungen werden im Audit-System protokolliert. +- Migration `0019_admin_todos_mobile_api.sql` ergänzt. diff --git a/CHATUEBERGABE.md b/CHATUEBERGABE.md new file mode 100644 index 0000000..308bd13 --- /dev/null +++ b/CHATUEBERGABE.md @@ -0,0 +1,247 @@ +# Chatübergabe – Landwelle-Portal + +**Aktuelle Referenzversion:** `Landwelle v1.5.62` +**Stand:** 23. September 2026 +**Referenzpaket:** `landwelle-go-portal-v1.5.62-COMPLETE-source.zip` +**Datenbankstand:** Migrationen `0001` bis `0045` plus `9000_landwelle_zuhause_navigation.sql` + +**Komplettpaket aktualisiert:** 23. September 2026 + +Diese Datei ist die verbindliche Übergabe für einen neuen Chat zum Landwelle-Go-Portal. Bei Widersprüchen gelten der aktuelle Quellcode, die Migrationen, die OpenAPI-Dateien und anschließend diese Übergabe. + +## 1. Projekt und Betriebsmodell + +- Go 1.22, modularer Monolith +- PostgreSQL als einzige Datenbank +- Templates und Assets über `go:embed` +- Linux ARM64 / Raspberry Pi 5 +- interner Port `2200` +- systemd-Dienst `landwelle-radio.service` +- Produktivbinary `/opt/landwelle/landwelle-portal` +- Konfiguration `/etc/landwelle/landwelle.env` +- persistente Daten und Uploads unter `/var/lib/landwelle` +- Hauptdomain `https://landwelle.de` +- öffentliche App-API `https://api.landwelle.de/v1` +- interne IT-App-API `https://api.landwelle.de/api/mobile` + +## 2. Wichtige öffentliche Bereiche + +- Startseite mit Liveplayer, Wetter, Nachrichten, Veranstaltungen und „Landwelle vor Ort“ +- vorübergehender App-Beta-Bereich direkt vor dem Footer +- Programm, Playlist, Team, Wünsche und Grüße +- Landwelle Zuhause unter `/zuhause/landwelle` als digitale OpenGenesisLINK-Welt +- Zuhörer-, docX-, Schlager- und Jahrescharts +- Nachrichten und redaktionelle Detailseiten +- Veranstaltungen, OnTour, Ausflüge, Verkehr und Stellenbörse +- Forum und Benutzerkonten +- Mediathek +- Presse, Karriere, FAQ, Kontakt, Datenschutz, Impressum und KI-Transparenz +- Werbung und Branchenbuch + +## 3. Wichtige Adminbereiche + +- `/admin/program` – Sendungen und Teamzuordnung +- `/admin/team` – reale und KI-/virtuelle Teammitglieder +- `/admin/media` – Medien, Rechte, KI-Klassifizierung und sichtbare Wasserzeichen +- `/admin/editorial` – Inhalte, Inhalt anlegen und Kategorien +- `/admin/charts` – laufende Charts, Archiv und Jahrescharts +- `/admin/mediathek` – Audioinhalte und Übernahme aus dem Nachrichtenstudio +- `/admin/forum` und `/admin/forum/topics` – Forumverwaltung +- `/admin/statistik` – einwilligungsbasierte First-Party-Reichweite +- `/admin/audit` – Auditprotokoll mit Suche, Filtern und Pagination +- `/admin/todos` – Todo-Board, Firebase-Status und App-Quittung +- `/admin/presse`, `/admin/karriere`, `/admin/faq`, `/admin/kontakt` + +## 4. Letzte fachliche Änderungen + +### v1.5.62 – Landwelle vor Ort: Kategorien und verschachtelte URLs + +`/landwelle-vor-ort` zeigt alle Beiträge und eine Kategorienavigation aus den aktiven, für „Landwelle vor Ort“ freigeschalteten Redaktionskategorien. Kategorieübersichten liegen unter `/landwelle-vor-ort/`, Beiträge unter `/landwelle-vor-ort//`. Alte Beitragslinks ohne Kategorie werden dauerhaft auf die kanonische URL umgeleitet. Keine neue Migration. + + +### v1.5.61 – Alle Beiträge auf Landwelle vor Ort + +Die Übersichtsseite `/landwelle-vor-ort` lädt alle veröffentlichten Einträge aus aktiven Rubriken mit `homepage_section=true`. Nur der Startseiten-Teaser bleibt auf drei aktuelle Beiträge begrenzt. Die frühere Übergabe von Limit 100 führte wegen der Store-Validierung unbeabsichtigt zu einem Fallback auf drei Beiträge. + + +### v1.5.60 – Landwelle vor Ort Template-Fix + +Die Übersichtsseite `/landwelle-vor-ort` war weiß, weil `web/landwelle-vor-ort.html` zwar vorhanden und die Route registriert war, das Template aber im produktiven `ParseFS`-Set fehlte. Die öffentlichen Templates werden nun zentral über `publicTemplateFiles` geladen. Ein Regressionstest prüft die produktive Verfügbarkeit; Renderfehler liefern künftig einen sichtbaren HTTP-500-Fehler statt einer leeren Seite. + + +### v1.5.59 – Router-Kollision behoben + +Der veraltete statische Eintrag `ueber-landwelle` wurde aus `contentPages()` entfernt. Die Route `/ueber-landwelle` wird ausschließlich über den verwalteten Seitenhandler registriert; die Sitemap führt sie explizit. Der Build-Preflight erkennt künftig Überschneidungen zwischen expliziten Routen und dynamisch aus `contentPages()` erzeugten Routen. + +### v1.5.55 – Landwelle Zuhause + +Unter „Mitmachen“ ist die öffentliche Seite `/zuhause/landwelle` erreichbar. Sie präsentiert die geplante digitale Landwelle-Welt in OpenGenesisLINK mit Radio-Sendestation, Community-Treffpunkten, Events, virtuellem Festzelt und DJ Jens. Fünf vorbereitete Slideshow-Platzhalter können später durch Originalbilder ersetzt werden. Der Zugang über den OpenGenesisLINK Viewer wird ohne vorweggenommene Download- oder Teleport-URL erklärt. + +Migration: `9000_landwelle_zuhause_navigation.sql`. + +### v1.5.25 – Team und Bildwasserzeichen + +Teamprofile können als KI-/virtuelle Persönlichkeit markiert werden. Öffentliche Profile zeigen eine sichtbare Kennzeichnung; verknüpfte Sendungen kennzeichnen eine virtuelle Moderation als „KI-Stimme“. + +Bilder aus der zentralen Mediengalerie können nachträglich als „Mit KI erstellt“ oder „Mit KI bearbeitet“ klassifiziert werden. Für ausdrücklich ausgewählte Bilder kann ein sichtbares Wasserzeichen mit Standard- oder eigenem Text aktiviert werden. Das Originalbild bleibt unverändert; die Kennzeichnung wird in unterstützten öffentlichen Ansichten als Overlay ausgegeben. + +Migration: `0038_team_ai_media_watermark.sql`. + +### v1.5.24 – KI-Transparenz + +Redaktionseinträge, Bilder und Mediathek-Audios besitzen eine KI-Klassifizierung, dokumentierte menschliche Prüfung, redaktionelle Verantwortung und einen öffentlichen Transparenzhinweis. Synthetische ElevenLabs-Ausgaben erhalten zentral einen gesprochenen Vorspann. Jahreschart-Informationen und App-API-Felder weisen KI-generierte Inhalte aus. Öffentliche Erläuterung unter `/ki-transparenz`. + +Migration: `0037_ai_transparency.sql`. + +### v1.5.23 – Chart-Voting und Generierung + +Jede gültige Frontend-Bewertung wird dauerhaft in `chart_vote_history` protokolliert. `chart_votes` verwaltet nur den letzten Votingzeitpunkt für die 24-Stunden-Sperre. Der aktuelle Voting-Stand ist im Admin schreibgeschützt. „Generieren“ kann jederzeit ausgeführt werden und sortiert nach dem aktuellen Gesamtstand. + +Migration: `0036_chart_vote_history.sql`. + +### v1.5.22 – Pressetext-Absätze + +Literal gespeicherte `\n`- und `\r\n`-Sequenzen werden in echte Zeilenumbrüche umgewandelt. Leerzeilen erscheinen als Absätze, einzelne Umbrüche bleiben sichtbar und HTML wird sicher escaped. + +Migration: `0035_press_paragraph_breaks.sql`. + +### v1.5.21 – Chartverwaltung, Presse und Impressum + +Der doppelte Chartblock im Admin wurde entfernt. `L = Leeren` leert nur die betroffene Zeile; Position und restliche Liste bleiben erhalten. Leere Zeilen sind nicht öffentlich sichtbar. Die Generierung besitzt keine 24-Stunden- oder Wochensperre. Die erste Pressemitteilung behandelt den Android-App-Beta-Test. Das Impressum nennt die SLMM GbR für Design und Konzept. + +Migration: `0034_press_beta_release.sql`. + +## 5. Chartlogik + +- Öffentliche Bereiche: `/charts/zuhoerer`, `/charts/docx`, `/charts/schlager`, `/charts/jahrescharts` +- Votingwerte von 1 bis 5 +- 24-Stunden-Sperre pro Titel und normalisierter Besucherkennung +- während der Sperre verschwinden die Buttons und ein Countdown wird angezeigt +- Gesamtstand = vorhandener Basiswert plus Summe der gültigen Stimmenhistorie +- Adminanzeige „Voting-Stand“ ist kein Eingabefeld +- „Generieren“ sortiert absteigend nach aktuellem Gesamtstand +- leere Adminzeilen werden weder öffentlich noch in der App-API ausgegeben +- Positionsänderungen werden atomar mit deferrierbaren Constraints gespeichert + +## 6. Redaktion und Facebook + +Die Redaktion ist in die Tabs „Inhalte“, „Inhalt anlegen“ und „Kategorien“ gegliedert. Kategorien werden über ein Modal angelegt und können für „Landwelle vor Ort“ aktiviert werden. Beiträge besitzen eine Facebook-Vorschau, einen Versandstatus, den gespeicherten Fehlergrund und eine Wiederholungsaktion. + +Wichtig für den Betrieb: Ein Facebook-Fehler `OAuthException`, Code `190`, Subcode `463` bedeutet einen abgelaufenen Token. Dann muss der Page Access Token unter `/admin/settings#social` erneuert werden; ein Codeupdate allein behebt das nicht. + +## 7. App-Beta-Test + +Die Startseite zeigt vorübergehend direkt vor dem Footer einen kompakten Aufruf zum Android-Beta-Test. Ziel ist: + +```text +https://groups.google.com/g/landwelle-betatest +landwelle-betatest@googlegroups.com +``` + +Konfiguration: + +```env +LANDWELLE_APP_BETA_ENABLED=true +LANDWELLE_APP_BETA_GROUP_URL=https://groups.google.com/g/landwelle-betatest +LANDWELLE_APP_BETA_GROUP_EMAIL=landwelle-betatest@googlegroups.com +``` + +Später deaktivieren mit `LANDWELLE_APP_BETA_ENABLED=false` und anschließendem Dienstneustart. + +## 8. Apps und API-Verträge + +### Öffentliche Radio-App + +- Übergabe: `APP_CHATUEBERGABE.md` +- Dokumentation: `docs/API.md` +- OpenAPI: `openapi/landwelle-app-api.yaml` +- Produktionsbasis: `https://api.landwelle.de/v1` +- Bootstrap: `GET /v1/app/bootstrap` + +Die App darf keine HTML-Seiten scrapen und weder direkt auf PostgreSQL noch auf Drittanbieter zugreifen. + +### Interne Landwelle-IT-App + +- Übergabe: `LANDWELLE_IT_APP_CHATUEBERGABE.md` +- OpenAPI: `openapi/landwelle-it-api.yaml`, Vertrag `1.1.0` +- Todo-Liste: `GET /api/mobile/todos?author=Jens` +- Status: `GET /api/mobile/status` +- Empfangsquittung: `POST /api/mobile/todos/push-receipt` + +## 9. API-Subdomain und Reverse Proxy + +Die Go-Routen funktionieren lokal auf Port `2200`. Für `api.landwelle.de` muss die KeyHelp-/Apache-HTTPS-Konfiguration aus `deploy/keyhelp-api-subdomain-https.conf` aktiv sein. Diagnose: + +```bash +./scripts/verify-api-subdomain.sh +``` + +Ein generisches Apache-`404 Not Found` auf `/v1/app/bootstrap` bedeutet normalerweise, dass der HTTPS-VHost `/v1/*` nicht an das Go-Portal weiterleitet. + +## 10. KI-Transparenz + +- öffentliche Seite `/ki-transparenz` +- Texte: `none`, `assisted`, `generated` oder `manipulated` +- Bilder: getrennte KI-Klassifizierung und optional sichtbares Wasserzeichen +- Audios: sichtbarer Hinweis vor dem Player; neue synthetische Stimmen erhalten gesprochenen Vorspann +- Team: reale oder KI-/virtuelle Persönlichkeit +- Facebook-Vorschau und Veröffentlichung übernehmen relevante Transparenzhinweise +- maschinenlesbare Attribute ergänzen, ersetzen aber nicht die sichtbare beziehungsweise hörbare Kennzeichnung + +## 11. Installation von v1.5.62 + +v1.5.62 enthält keine neue Migration gegenüber dem Landwelle-Zuhause-Stand. `9000_landwelle_zuhause_navigation.sql` bleibt Bestandteil des Pakets. Nach dem Entpacken deshalb zuerst Migrationen aktualisieren und anschließend das Portal bauen und installieren: + +```bash +cd /home/users/slmmradio/www/landwelle.de +unzip -o /PFAD/landwelle-go-portal-v1.5.62-COMPLETE-source.zip +chmod +x scripts/*.sh +./scripts/build-migrator-pi.sh +sudo ./scripts/update-migrations-on-pi.sh +./scripts/build-pi.sh +sudo ./scripts/update-portal-on-pi.sh +``` + +Prüfen: + +```bash +/opt/landwelle/landwelle-portal --version +curl -fsS http://127.0.0.1:2200/version +curl -fsS http://127.0.0.1:2200/ready +``` + +Erwartet wird `Landwelle v1.5.62`. + +## 12. Offene Hauptaufgaben + +1. persistente KI-/Audio-Jobqueue mit Retry, Wiederaufnahme und Abbruch +2. einheitlicher redaktioneller Freigabe- und Zeitplanungsworkflow +3. Mediathek-Reihen, Suche, automatische Dauer und Dateibereinigung +4. Sponsorenberichte mit Vergleichszeiträumen und dokumentierter Messdefinition +5. Forum-Abonnements, Suche und Moderationswarteschlange +6. Chart-Wochenarchiv, Auswertungen und Exporte +7. vollständige Empfangsquittung der IT-App in allen Appzuständen +8. höhere automatisierte Testabdeckung älterer Admin- und Integrationspfade + +## 13. Sicherheits- und Entwicklungsregeln + +- keine Secrets, Service-Accounts, produktiven `.env`-Dateien oder Runtime-Daten in Quellpakete aufnehmen +- vor Migrationen PostgreSQL und Uploads sichern +- Migrationen ohne eigenes `BEGIN`, `COMMIT`, `ROLLBACK` oder `START TRANSACTION` +- Apps verwenden ausschließlich dokumentierte APIs +- schreibende Adminaktionen benötigen Authentifizierung, CSRF, Validierung und gegebenenfalls Audit +- Reichweitenwerte als einwilligungsbasierte First-Party-Messung bezeichnen +- KI-Kennzeichnungen nicht entfernen, solange die Klassifizierung fachlich gilt +- nach jedem relevanten Release Reverse Proxy, externe Dienste und betroffene öffentliche Seiten produktiv abnehmen + +## 14. Kanonische Dokumente + +- `README.md` +- `CHANGELOG.md` +- `ROADMAP.md` +- `CHATUEBERGABE.md` +- `CONTRIBUTING.md` +- `docs/CURRENT_STATE.md` +- `docs/README.md` +- betroffene Fachdocs unter `docs/` +- OpenAPI-Verträge unter `openapi/` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a26d7e3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,73 @@ +# Mitwirken am Landwelle-Portal + +**Projektstand: Landwelle v1.5.58** + +## Grundregeln + +- PostgreSQL verwenden; kein SQLite und keine parallele Schatten-Datenbank. +- Bestehende Modulgrenzen, Adminnavigation und das Landwelle-Designsystem beibehalten. +- Öffentliche Templates und Assets über `go:embed` einbinden. +- Datenbankänderungen ausschließlich über die nächste fortlaufende Migration ergänzen. +- Migrationen dürfen kein eigenes `BEGIN`, `COMMIT`, `ROLLBACK` oder `START TRANSACTION` enthalten. +- Schreibende Adminaktionen benötigen Authentifizierung, CSRF-Schutz, Validierung und bei administrativ relevanten Änderungen einen Audit-Eintrag. +- Keine Secrets, produktiven Konfigurationen, Service-Accounts oder Runtime-Daten einchecken. +- Neue Assets nur hinzufügen, wenn sie tatsächlich referenziert werden. Veraltete Assetversionen nach erfolgreicher Umstellung entfernen. + +## Codeorganisation + +- Neue Logik nach Fachbereich in bestehende Go-Dateien oder klar benannte neue Module einordnen. +- Tests nach Fachbereich benennen, nicht nach Release- oder Hotfixnummer. +- Wiederverwendbare Validierung und Datenzugriffe zentralisieren. +- JSON-Endpunkte liefern auch bei Authentifizierungs-, Validierungs- und Serverfehlern gültiges JSON. +- HTML-Endpunkte dürfen keine internen Fehlerdetails, Zugangsdaten oder Dateipfade ausgeben. +- Große Listen serverseitig paginieren und filtern. + +## Externe Dienste und Hintergrundjobs + +- OpenAI-, ElevenLabs-, ffmpeg-, FTP-, RSS- und Firebase-Aufrufe benötigen Zeitlimits und verständliche Fehlerbehandlung. +- Jobstatus darf keine API-Schlüssel, Passwörter oder internen Dateipfade offenlegen. +- Externe Inhalte serverseitig beschaffen; nicht voraussetzen, dass ein Modell oder Client selbst browsen kann. +- Mobile Clients verwenden ausschließlich die dokumentierten APIs und greifen nicht direkt auf Drittanbieter oder PostgreSQL zu. + +## Dokumentation + +Aktualisiert werden nur die kanonischen Dateien: + +- `README.md` +- `CHANGELOG.md` +- `ROADMAP.md` +- `CHATUEBERGABE.md` +- `docs/CURRENT_STATE.md` +- betroffene Fachdokumente unter `docs/` +- betroffene OpenAPI-Verträge + +Keine neuen `BUILD_NOTES-v…`, `HOTFIX-ANWENDEN-v…`, `RELEASE_NOTES-v…`, `VALIDATION-v…` oder `CHANGED_FILES-v…` im Projektstamm anlegen. Der Verlauf gehört in `CHANGELOG.md`; Build- und Prüfergebnisse gehören in die jeweilige Releaseausgabe außerhalb des Quellbaums. + +## Prüfung vor einem Release + +```bash +gofmt -w . +go mod tidy +go test ./... +go vet ./... +``` + +Zusätzlich: + +- JavaScript-Syntax prüfen +- Shellskripte mit `bash -n` prüfen +- Templates parsen und relevante HTTP-Routen testen +- alle Migrationen auf unerlaubte Transaktionsanweisungen prüfen +- Linux-ARM64-Builds für Portal, Migrator und Adminpass erstellen +- Quellpaket auf Secrets und generierte Dateien prüfen +- ZIP-Integrität und SHA-256 prüfen + +## Releaseablauf + +1. Version in `main.go` erhöhen. +2. Changelog, Roadmap, Übergabe, Iststand und betroffene Fachdocs aktualisieren. +3. Tests und statische Prüfungen ausführen. +4. ARM64-Binaries vollständig neu bauen. +5. Migrationen zunächst gegen eine aktuelle Sicherung prüfen. +6. Quellpaket ohne `dist/`, Runtime-Daten und Secrets erstellen. +7. Produktivupdate durchführen und `/version`, `/ready` sowie die betroffenen Routen abnehmen. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fe5716e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM golang:1.23-alpine AS build +WORKDIR /src +COPY go.mod main.go ./ +COPY web ./web +RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/landwelle-portal . + +FROM scratch +COPY --from=build /out/landwelle-portal /landwelle-portal +EXPOSE 2200 +ENTRYPOINT ["/landwelle-portal"] diff --git a/LANDWELLE_IT_APP_CHATUEBERGABE.md b/LANDWELLE_IT_APP_CHATUEBERGABE.md new file mode 100644 index 0000000..da45152 --- /dev/null +++ b/LANDWELLE_IT_APP_CHATUEBERGABE.md @@ -0,0 +1,114 @@ +# Chatübergabe – Android-App „Landwelle IT“ + +Diese Datei ist die verbindliche Startinformation für einen separaten Flutter-App-Chat. + +**Portal-Referenzstand:** Landwelle v1.5.58 +**Stand:** 27. Juli 2026 + +## Projekt + +- App: Landwelle IT +- Android-Paketkennung: `de.landwelle.itmonitor` +- API-Basis: `https://api.landwelle.de` +- API-Vertrag: `openapi/landwelle-it-api.yaml`, Version `1.1.0` +- Firebase-Projekt: dasselbe Projekt wie das Landwelle-Portal +- FCM-Topic: `landwelle_it_jens_todos` +- Android-Benachrichtigungskanal: `landwelle_monitoring` + +## API + +```http +GET https://api.landwelle.de/api/mobile/todos?author=Jens +GET https://api.landwelle.de/api/mobile/status +POST https://api.landwelle.de/api/mobile/todos/push-receipt +``` + +Keine doppelten Pfade verwenden. Falsch wäre: + +```text +https://api.landwelle.de/api/api/mobile/todos +``` + +Wenn der Portalserver `LANDWELLE_MOBILE_API_TOKEN` verwendet, muss die App den Wert bei allen drei Endpunkten als Bearer-Token senden. + +## Push-Empfang + +Die App muss: + +1. Firebase über `google-services.json` beziehungsweise FlutterFire initialisieren. +2. unter Android 13 und neuer die Benachrichtigungsberechtigung anfragen. +3. das Topic `landwelle_it_jens_todos` abonnieren. +4. den Android-Kanal `landwelle_monitoring` mit hoher Wichtigkeit anlegen. +5. Vordergrund-, Hintergrund- und Terminated-State behandeln. +6. bei `data.type == "todo"` die Todo-Liste über die API aktualisieren. +7. `data.todo_id` als String annehmen und sicher in eine positive Ganzzahl umwandeln. +8. erst nach tatsächlichem Empfang beziehungsweise erfolgreicher Verarbeitung die Empfangsbestätigung senden. + +Die produktive Nachricht enthält: + +```json +{ + "type": "todo", + "todo_id": "123", + "author": "Jens" +} +``` + +## Empfangsbestätigung + +Firebase bestätigt dem Portal nur, dass FCM die Nachricht angenommen hat. Das ist keine sichere Bestätigung, dass das Android-Gerät sie verarbeitet hat. Deshalb muss die App nach tatsächlichem Empfang folgenden Aufruf senden: + +```http +POST /api/mobile/todos/push-receipt +Authorization: Bearer +Content-Type: application/json + +{ + "todo_id": 123, + "device_id": "" +} +``` + +Erfolgreiche Antwort: + +```json +{ + "data": { + "todo_id": 123, + "delivered_at": "2026-07-23T18:45:12.123Z" + } +} +``` + +Die Bestätigung ist idempotent: Ein wiederholter Aufruf behält den ersten Empfangszeitpunkt bei und aktualisiert lediglich die gespeicherte Gerätekennung. Der Adminbereich zeigt danach „In der Landwelle-IT-App bestätigt“. + +Empfohlene Aufrufpunkte: + +- `FirebaseMessaging.onMessage` nach erfolgreicher Verarbeitung +- Hintergrundhandler nach erfolgreicher Verarbeitung +- beim Öffnen einer Todo-Benachrichtigung, falls noch keine Bestätigung gesendet wurde + +Die App sollte fehlgeschlagene Bestätigungen lokal zwischenspeichern und beim nächsten erfolgreichen API-Zugriff erneut senden. + +## Sicherheit + +Der serverseitige Service Account darf niemals in die App kopiert oder über die API geladen werden. Im Flutter-Projekt liegt ausschließlich die öffentliche Firebase-Konfiguration. `device_id` darf keine Hardware-ID und kein Geheimnis sein; geeignet ist eine zufällig erzeugte, lokal gespeicherte Installationskennung. + +## Verbindlicher Änderungsprozess + +Fehlt eine App-Funktion, darf der App-Chat weder HTML scrapen noch neue API-Pfade erfinden. Er muss stattdessen folgenden Block liefern: + +```text +API-ERWEITERUNG FÜR DAS LANDWELLE-PORTAL + +Zweck: +Benötigter Endpunkt oder Änderung: +HTTP-Methode: +Benötigte Request-Felder: +Benötigte Response-Felder: +Authentifizierung: +Beispiel: +Begründung: +``` + +Diesen Block im Portal-Chat einfügen. Erst nach Erweiterung und Dokumentation der Portal-API wird die App darauf angepasst. diff --git a/README.md b/README.md index c7f7fc0..6366445 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,69 @@ -# Landwelle +# Landwelle Radio Portal -**Aktueller Stand: Landwelle v1.5.62** +**Aktueller Stand: Landwelle v1.5.62 – 23. September 2026** -Landwelle ist das Go-basierte Radio- und Regionalportal von Landwelle mit öffentlicher Website, Adminbereich, PostgreSQL-Datenbank, Radio-App-API und internen Produktionswerkzeugen. Die produktive Zielplattform ist Linux ARM64 auf einem Raspberry Pi 5. +Landwelle ist ein Go-basiertes Radio- und Regionalportal mit öffentlicher Website, geschütztem Adminbereich, PostgreSQL-Datenbank, Radio-App-API und internen Produktionswerkzeugen. Das Portal läuft produktiv als Linux-ARM64-Dienst auf einem Raspberry Pi 5. + +## Projektstatus + +Das hier bezeichnete `COMPLETE`-Paket wurde am 14. August 2026 neu aus dem vollständigen Quellstand konsolidiert; Basis ist der rekonstruierte v1.5.54-Serverstand mit Migrationen bis 0045; Landwelle Zuhause wird über Migration 9000 ergänzt. v1.5.60 behebt zusätzlich die zuvor weiße Übersichtsseite `/landwelle-vor-ort`, deren Template im produktiven Template-Set fehlte. + + +Version 1.5.61 korrigiert die Beitragsliste unter `/landwelle-vor-ort`: Die Übersichtsseite lädt wieder alle veröffentlichten Beiträge der freigegebenen Vor-Ort-Rubriken, während der Teaser auf der Startseite weiterhin auf drei Beiträge begrenzt bleibt. + +Version 1.5.60 behebt die weiße Übersichtsseite `/landwelle-vor-ort`: Das vorhandene Template wird wieder in das produktive öffentliche Template-Set aufgenommen. Zusätzlich verhindert ein Regressionstest denselben Integrationsfehler künftig. + +Version 1.5.62 erweitert `/landwelle-vor-ort` um Kategorieübersichten und kanonische Beitrags-URLs nach dem Schema `/landwelle-vor-ort//`. Alte ungegliederte Beitragslinks werden per 301 weitergeleitet. + +Version 1.5.59 ersetzt auf `/zuhause/landwelle` im Abschnitt „Die Radio-Sendestation“ den bisherigen Bildplatzhalter durch ein echtes Bild aus OpenGenesisLINK. + +Version 1.5.58 behebt einen Laufzeitfehler im öffentlichen Router: `ueber-landwelle` war gleichzeitig als verwaltete Seite explizit registriert und noch als veralteter Eintrag in `contentPages()` enthalten. Die dynamische `contentPages()`-Schleife registrierte dadurch dieselbe URL ein zweites Mal und löste beim Start einen `net/http`-Panic aus. Der Alt-Eintrag wurde entfernt, die Sitemap behält `/ueber-landwelle` explizit, und `build-pi.sh` prüft nun dynamische gegen explizite Routen. + +Version 1.5.59 ergänzt auf `/zuhause/landwelle` im Abschnitt „Die Radio-Sendestation“ ein echtes Bild aus OpenGenesisLINK anstelle des bisherigen Platzhalters. + +Version 1.5.57 ist ein Start-/Deployment-Sicherheitsrelease auf Basis von v1.5.55. Es stellt sicher, dass `/ueber-landwelle` nur einmal registriert ist und prüft dies bereits in `build-pi.sh`. Der in v1.5.55 ergänzte öffentliche Bereich `/zuhause/landwelle` bleibt vollständig enthalten. Die Seite präsentiert die geplante digitale Landwelle-Welt in OpenGenesisLINK mit Radio-Sendestation, Events, Festzelt, DJ Jens, Zugangserklärung und vorbereiteter Bilder-Slideshow. + +Der aktuelle Funktionsstand umfasst insbesondere: + +- vollständige Chart-Votinghistorie mit 24-Stunden-Sperre und Neusortierung nach aktuellem Votingstand +- Redaktion mit Kategorien, Facebook-Vorschau und „Landwelle vor Ort“ +- Presse, Karriere, FAQ, Kontakt und Mediathek +- einwilligungsbasierte First-Party-Reichweitenstatistik +- KI-Transparenz für Texte, Bilder, Audios, virtuelle Teammitglieder und optional sichtbare Bildwasserzeichen +- öffentliche App-API und interne Landwelle-IT-API +- vorübergehenden App-Beta-Aufruf zur Google-Gruppe `landwelle-betatest` ## Technische Basis -- Go 1.23 mit Toolchain Go 1.24.4 -- PostgreSQL als einzige Datenbank -- HTML-Templates und statische Assets via `go:embed` -- interner Port `2200` +- Go 1.22 +- PostgreSQL; kein SQLite +- HTML-Templates und statische Assets über `go:embed` +- interner Standardport `2200` +- Linux ARM64 / Raspberry Pi 5 - systemd-Dienst `landwelle-radio.service` -- produktives Binary `/opt/landwelle/landwelle-portal` +- Runtime-Binary `/opt/landwelle/landwelle-portal` - Konfiguration `/etc/landwelle/landwelle.env` - persistente Daten unter `/var/lib/landwelle` +- regulärer Migrationsstand bis `0045`; zusätzlich `9000_landwelle_zuhause_navigation.sql` für die bereits produktiv eingeführte Zuhause-Navigation -## Wichtige Bereiche +## Funktionsumfang -- Livestream, Now Playing, Playlist und Programm -- Nachrichten, Veranstaltungen, Verkehr und Ausflugstipps -- `Landwelle vor Ort` mit Kategorie-URLs nach `/landwelle-vor-ort//` -- Zuhörer-, docX-, Schlager- und Jahrescharts -- Redaktion, Presse, Karriere, FAQ, Kontakt und Mediathek -- Forum, Benutzerkonten, Audit und Todo-Board +Das Portal umfasst unter anderem: + +- Livestream, Now Playing, Playlist und Wochenprogramm +- regionale und überregionale Nachrichten aus Redaktion und RSS +- Veranstaltungen, destination.one, Landwelle OnTour und Ausflugstipps +- Zuhörer-, docX-, Schlager- und Jahrescharts mit Voting +- Redaktion, „Landwelle vor Ort“, Presse, Karriere, FAQ und Kontakt +- Mediathek für Sendungen, KI-Beiträge, Interviews und Specials +- Forum, Benutzerkonten, Rollen, Audit und Todo-Board - Werbeplattform, Branchenbuch und Stellenbörse - KI-Nachrichtenstudio mit OpenAI, ElevenLabs, ffmpeg und FTP -- Firebase-Push und interne Landwelle-IT-API -- öffentliche App-API -- `Landwelle Zuhause` unter `/zuhause/landwelle` +- Firebase-Push für die Landwelle-IT-App +- versionierte API für die getrennte Radio-App +- einwilligungsbasierte First-Party-Reichweitenstatistik mit CSV-Export + +Der verbindliche Iststand steht in [`docs/CURRENT_STATE.md`](docs/CURRENT_STATE.md). ## Projektstruktur @@ -35,42 +71,58 @@ Landwelle ist das Go-basierte Radio- und Regionalportal von Landwelle mit öffen cmd/ Hilfsprogramme wie Migrator und Adminpass config/ Beispielkonfigurationen deploy/ systemd- und Reverse-Proxy-Beispiele -docs/ technische und fachliche Dokumentation +docs/ dauerhafte technische und fachliche Dokumentation internal/ interne Go-Pakete -migrations/ PostgreSQL-Migrationen -openapi/ API-Verträge +migrations/ PostgreSQL-Migrationen; Landwelle Zuhause liegt wegen bereits belegter 0039 auf 0040 +openapi/ maschinenlesbare API-Verträge scripts/ Build-, Update-, Backup- und Wartungsskripte web/ eingebettete Templates und statische Assets -clients/ getrennte Client-Projekte und Hinweise +clients/ Hinweise und getrennte Client-Projekte ``` -## Entwicklung +Die Dokumentationsübersicht steht in [`docs/README.md`](docs/README.md). + +## Lokale Prüfung ```bash -go mod verify +gofmt -w . go test ./... go vet ./... ``` -ARM64-Builds: +Abhängigkeiten werden über `go.mod` und `go.sum` festgeschrieben. Lokale Konfigurationen, Secrets, Builds und Runtime-Daten dürfen nicht in das Quellpaket gelangen; dafür gilt `.gitignore`. + +## ARM64-Build ```bash ./scripts/build-pi.sh ./scripts/build-migrator-pi.sh ``` -## Produktives Update - -Vor jedem Update PostgreSQL und persistente Uploads sichern. Migrationen werden vor dem Portalupdate ausgeführt, wenn neue Migrationsdateien hinzugekommen sind. +Alternativ direkt: ```bash +GOOS=linux GOARCH=arm64 go build -o dist/landwelle-portal-linux-arm64 . +GOOS=linux GOARCH=arm64 go build -o dist/landwelle-migrate-linux-arm64 ./cmd/migrate +GOOS=linux GOARCH=arm64 go build -o dist/landwelle-adminpass-linux-arm64 ./cmd/adminpass +``` + +## Installation und Update + +Vor jedem Update PostgreSQL und Uploads sichern. v1.5.62 enthält die bereits eingeführte Migration `9000_landwelle_zuhause_navigation.sql`. Deshalb zuerst den Migrator bauen und die Migrationen installieren, anschließend das Portal aktualisieren: + +```bash +cd /home/users/slmmradio/www/landwelle.de +unzip -o /PFAD/landwelle-go-portal-v1.5.62-COMPLETE-source.zip +chmod +x scripts/*.sh ./scripts/build-migrator-pi.sh sudo ./scripts/update-migrations-on-pi.sh ./scripts/build-pi.sh sudo ./scripts/update-portal-on-pi.sh ``` -Prüfung: + +Prüfen: ```bash /opt/landwelle/landwelle-portal --version @@ -78,12 +130,24 @@ curl -fsS http://127.0.0.1:2200/version curl -fsS http://127.0.0.1:2200/ready ``` -## GitHub und Releases +Erwartete Version: `Landwelle v1.5.62`. -`main` ist der verbindliche Quellstand. Jede fachliche Änderung wird zusammen mit Versionsanpassung, `CHANGELOG.md` und den zugehörigen Tests committed. GitHub Actions prüft jeden Push und Pull Request mit `go test`, `go vet` und einem Linux-ARM64-Build. +## Verbindliche Projektdokumente -Produktive Secrets, `.env`-Dateien, Firebase-Service-Accounts, Runtime-Daten, Build-Artefakte und Release-ZIPs gehören nicht ins Repository und sind über `.gitignore` ausgeschlossen. +- `README.md` – Einstieg, Struktur, Build und Update +- `CHANGELOG.md` – vollständiger Versionsverlauf +- `ROADMAP.md` – geplante Weiterentwicklung +- `CHATUEBERGABE.md` – aktueller Stand für einen neuen Portal-Chat +- `CONTRIBUTING.md` – Entwicklungs- und Release-Regeln +- `APP_CHATUEBERGABE.md` – Übergabe für die öffentliche Flutter-App +- `LANDWELLE_IT_APP_CHATUEBERGABE.md` – Übergabe für die interne IT-App +- `docs/README.md` – Index der dauerhaften Fachdokumentation -## Dokumentation +## Wichtige Sicherheitsregeln -Der aktuelle Iststand steht in `docs/CURRENT_STATE.md`. Weitere wichtige Dokumente sind `CHANGELOG.md`, `ROADMAP.md`, `CONTRIBUTING.md`, `CHATUEBERGABE.md`, `APP_CHATUEBERGABE.md` und `LANDWELLE_IT_APP_CHATUEBERGABE.md`. +- Keine Zugangsdaten, Service-Accounts, privaten Schlüssel oder produktiven `.env`-Dateien ausliefern. +- Datenbankänderungen nur als fortlaufende Migration ergänzen. +- Migrationen enthalten kein eigenes `BEGIN`, `COMMIT` oder `ROLLBACK`; der Migrator verwaltet die Transaktion. +- Schreibende Adminaktionen benötigen Authentifizierung, CSRF-Schutz und bei relevanten Änderungen einen Audit-Eintrag. +- Mobile Apps verwenden ausschließlich die dokumentierten API-Verträge und greifen weder direkt auf PostgreSQL noch auf Drittanbieter zu. +- KI-Kennzeichnungen und Wasserzeichen dürfen nicht pauschal entfernt werden, wenn die zugrunde liegende Klassifizierung weiterhin gilt. diff --git a/ROADMAP.md b/ROADMAP.md new file mode 100644 index 0000000..049ccba --- /dev/null +++ b/ROADMAP.md @@ -0,0 +1,110 @@ +# Landwelle Roadmap + +**Stand: Landwelle v1.5.58 – 4. August 2026** + +## Zuletzt abgeschlossen + +- Kanonische Markdown-Dokumentation und Chatübergaben vollständig auf den aktuellen Projektstand gebracht. +- KI-Transparenz für redaktionelle Texte, Bilder, Mediathek-Audios und Jahreschart-Informationen umgesetzt. +- Virtuelle Teammitglieder sowie gezielt aktivierbare Wasserzeichen „Mit KI erstellt“ und „Mit KI bearbeitet“ ergänzt. +- Kumulative Chart-Votinghistorie eingeführt; jede gültige Stimme nach Ablauf der 24-Stunden-Sperre zählt erneut. +- Automatische Chartauswertung schreibgeschützt dargestellt und Generierung nach aktuellem Voting-Gesamtstand korrigiert. +- Absatzdarstellung für Presse und verwaltete Inhaltsseiten repariert. +- Redaktion in Inhalte, Inhalt anlegen und Kategorien gegliedert; Facebook-Vorschau und Versandstatus ergänzt. +- App-Beta-Aufruf kompakt direkt vor dem Footer platziert. +- Pressemitteilung zum Android-Beta-Test und SLMM-Angaben im Impressum ergänzt. +- Migrationen auf `0001` bis `0038` erweitert. + +## Priorität 1: Produktionssicherheit + +- persistente Jobwarteschlange für KI- und Audiojobs +- Retry mit Backoff für OpenAI, ElevenLabs, ffmpeg und FTP +- fehlgeschlagene Jobs fortsetzen, wiederholen oder gezielt abbrechen +- zentrale Jobhistorie mit verständlichen Fehlerursachen +- Gesundheitsüberwachung für RSS, OpenAI, ElevenLabs, FTP, destination.one, Facebook und Firebase +- automatische Benachrichtigung bei kritischen Ausfällen +- dokumentierte regelmäßige Backup- und Restore-Tests + +## Priorität 2: Redaktion und Mediathek + +- einheitlicher Workflow für Entwurf, Prüfung, Freigabe und Zeitplanung +- Medienauswahl direkt im Redaktionseditor +- Versionshistorie und Wiederherstellung +- redaktioneller Kalender +- automatische Übergabe ausgewählter KI-Produktionen in einen Freigabe-Posteingang +- Sendungsreihen, Staffeln und optionale Kapitel in der Mediathek +- automatische Ermittlung der Audiodauer +- Suche, Pagination und sichere Bereinigung verwaister Audiodateien +- bessere Übersicht über KI-Klassifizierung, Wasserzeichen und redaktionelle Prüfung + +## Priorität 3: Reichweite und Sponsorenunterlagen + +- Vergleichszeiträume und Vorperioden im Statistik-Dashboard +- Monats- und Jahresberichte +- druckfähiger Sponsorenreport mit klarer Kennzeichnung der Messmethode +- Export nach Seitengruppe, Kampagne und Zeitraum +- datensparsame UTM-Auswertung +- dokumentierte Datenqualitätsindikatoren und zusätzliche Botfilter +- Consent-Quote nur aggregiert und ohne Profilierung nicht eingewilligter Nutzer + +## Priorität 4: Forum und Community + +- Themen und Kategorien abonnieren +- Benachrichtigungen bei Antworten +- Schließen, Anheften, Verschieben und Zusammenführen +- Beitragsmeldungen und Moderationswarteschlange +- öffentliche Benutzerprofile und Forumssuche +- Pagination für große Themen und Kategorien +- „Alle als gelesen markieren“ + +## Priorität 5: Charts + +- Adminauswertung zu Votingmustern und auffälligen Häufungen +- automatische Wochenarchivierung +- Langzeit- und Vorwochenvergleiche +- Chartnotizen und Moderationstexte +- Export für Sendesoftware und Social Media +- barrierefreies Reorder über Tastatur +- fachliche Entscheidung, ob manuelle Punkte künftig getrennt vom Online-Voting ausgewiesen werden sollen + +## Priorität 6: Kontakt, Presse und Karriere + +- E-Mail-Benachrichtigung bei neuer Kontaktanfrage +- Zuständigkeiten und interne Notizen +- Presse-Downloads mit Logos, Senderportrait und freigegebenen Fotos +- weitere aktuelle Pressemitteilungen +- strukturierte Stellenausschreibungen und Bewerbungsstatus +- dokumentierte Lösch- und Aufbewahrungsregeln + +## Todo und Landwelle IT + +- IT-App vollständig auf API-Vertrag `1.1.0` aktualisieren +- Empfangsbestätigung in Vordergrund-, Hintergrund- und beendetem Appzustand +- Fälligkeiten, Labels, Suche und Verantwortliche +- Kommentare und Aktivitätsverlauf je Aufgabe +- erneuter Versand fehlgeschlagener Pushs +- Geräteübersicht und letzte erfolgreiche App-Rückmeldung + +## Radio-App als separates Projekt + +- Flutter-App anhand `APP_CHATUEBERGABE.md` weiterentwickeln +- produktive API-Contract-Tests +- redaktionelle Push-Kampagnen +- App-Releases, Store-URLs, Mindestversionen und Pflichtupdates pflegen +- Google Play Internal/Closed Testing und TestFlight +- Storeeinreichung erst nach technischer, redaktioneller und datenschutzrechtlicher Abnahme + +## KI-Transparenz und Governance + +- Kennzeichnungen bei neuen Inhaltsarten fortlaufend prüfen +- Nachweise redaktioneller Prüfung und Verantwortlichkeit auswertbar machen +- maschinenlesbare Anbieter-Metadaten und interoperable Kennzeichnungsstandards beobachten +- sichtbare Wasserzeichen auch in weiteren Bildverwendungen übernehmen, sofern fachlich erforderlich +- Rechtstexte und interne Arbeitsanweisungen regelmäßig rechtlich prüfen lassen + +## Vor geschäftlicher Nutzung prüfen + +- Datenschutz-, Consent- und Aufbewahrungstexte rechtlich prüfen lassen. +- Reichweitenwerte stets als einwilligungsbasierte, pseudonyme First-Party-Messung bezeichnen. +- Sponsorenauswertungen nicht als Vollerhebung oder unabhängig auditierte Radioreichweite darstellen. +- Produktivumgebung, Reverse Proxy, Medienverzeichnis, externe Dienste und E-Mail-Abläufe nach jedem relevanten Release abnehmen. diff --git a/admin.go b/admin.go new file mode 100644 index 0000000..7359876 --- /dev/null +++ b/admin.go @@ -0,0 +1,3254 @@ +package main + +import ( + "context" + "crypto/rand" + "crypto/sha256" + "crypto/subtle" + "encoding/base64" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "html/template" + "io" + "log" + "mime/multipart" + "net" + "net/http" + "net/url" + "os" + "path/filepath" + "runtime" + "strconv" + "strings" + "sync" + "time" + + "landwelle-portal/internal/auth" +) + +const adminCookieName = "landwelle_admin_session" + +type adminHandler struct { + loginTemplate *template.Template + dashboardTemplate *template.Template + programTemplate *template.Template + downloadsTemplate *template.Template + settingsTemplate *template.Template + aiTemplate *template.Template + editorialTemplate *template.Template + wishesTemplate *template.Template + emailTemplatesTemplate *template.Template + mediaTemplate *template.Template + usersTemplate *template.Template + rolesTemplate *template.Template + teamTemplate *template.Template + forumTemplate *template.Template + managementTemplate *template.Template + aiModuleTemplate *template.Template + newsStudioTemplate *template.Template + autoTasksTemplate *template.Template + navigationTemplate *template.Template + directoryTemplate *template.Template + siteContentTemplate *template.Template + mediathekTemplate *template.Template + analyticsTemplate *template.Template + excursionsTemplate *template.Template + aiAudioModuleTemplate *template.Template + pushTemplate *template.Template + sessions *adminSessionStore + limiter *loginLimiter + logger *log.Logger + weather *WeatherService + settings *settingsStore + nowPlaying *nowPlayingService + programs *programStore + downloads *downloadStore + ai *aiService + editorial *editorialStore + wishes *wishStore + emailTemplates *emailTemplateStore + media *mediaStore + wishAutomation *wishWorkflow + startedAt time.Time + username string + passwordHash string + plainPassword string + cookieSecure bool + trustProxy bool + pageData PageData + database *postgresStore + users *userStore + team *teamStore + forum *forumStore + destinationOne *destinationOneImporter + newsStudio *newsStudioStore + aiJobs *aiJobStore + firebasePush *firebasePushService + navigation *navigationStore + directory *directoryStore + siteContent *siteContentStore + analytics *siteAnalyticsStore + excursions *excursionStore +} + +type adminSession struct { + UserID int64 + Username string + DisplayName string + Role string + Permissions map[string]bool + CSRFToken string + ExpiresAt time.Time +} + +type adminSessionStore struct { + mu sync.Mutex + sessions map[string]adminSession + ttl time.Duration +} + +type loginAttempt struct { + Failures int + ResetAt time.Time + Blocked time.Time +} + +type loginLimiter struct { + mu sync.Mutex + attempts map[string]loginAttempt +} + +type adminLoginData struct { + Error string + Configured bool + Username string +} + +type dashboardDBStats struct { + Installations int + PushEnabled int + PushAccepted int + PushOpened int + AdminUsers int + NormalUsers int + LatestAndroidVersion string +} + +type adminDashboardData struct { + Username string + CSRFToken string + Version string + StartedAt string + Uptime string + ListenAddress string + StreamURL string + DatabaseConfigured bool + Weather WeatherSnapshot + WeatherAvailable bool + WeatherError string + AdminHashActive bool + RuntimeSettings RuntimeSettings + SettingsPath string + NowPlaying NowPlayingSnapshot + AzuraCastEndpoint string + OpenAIStatus string + OpenAIModels int + ElevenStatus string + ElevenUsed int64 + ElevenLimit int64 + FTPStatus string + FirebaseStatus string + FirebaseProject string + DBStats dashboardDBStats + GoVersion string + GoOS string + GoArch string + GoRoutines int + MemoryMB uint64 +} + +type adminDownloadsData struct { + Username string + CSRFToken string + Platforms []DownloadPlatform + StorePath string + Error string + Success string +} + +type adminSettingsData struct { + Username string + CSRFToken string + Settings RuntimeSettings + SettingsPath string + OpenAIKeySet bool + ElevenLabsKeySet bool + DestinationOneKeySet bool + Error string + Success string + OpenAIModels []providerModel + ElevenModels []providerModel +} + +type adminWishesData struct { + Username string + CSRFToken string + Items []ListenerWish + StorePath string + Error string + Success string + Page int + PerPage int + Total int + TotalPages int + Pages []int + HasPrev bool + HasNext bool + PrevURL string + NextURL string + Settings RuntimeSettings +} + +type adminEmailTemplatesData struct { + Username string + CSRFToken string + Items []EmailTemplate + Edit EmailTemplate + Error string + Success string +} + +type adminMediaData struct { + Username string + CSRFToken string + Items []MediaAsset + StorePath string + DatabaseReady bool + Error string + Success string + Page int + PerPage int + Total int + TotalPages int + Pages []int + PrevURL string + NextURL string +} + +type adminEditorialData struct { + Username string + CSRFToken string + Items []EditorialEntry + Edit EditorialEntry + HasEdit bool + DatabaseReady bool + Error string + Success string + Media []MediaAsset + Types []EditorialContentType + ActiveTab string + Social SocialSettings + FacebookReady bool +} + +type adminAIData struct { + Username string + CSRFToken string + Settings RuntimeSettings + Task string + Source string + Result string + SpeechText string + VoiceID string + AudioURL string + Error string +} + +type adminUsersData struct { + Username string + CSRFToken string + Navigation template.HTML + Title string + Description string + BasePath string + Group string + Items []ManagedUser + Edit ManagedUser + Roles []UserRole + DatabaseReady bool + Error string + Success string + Search string + RoleFilter string + StatusFilter string + Page int + PerPage int + Total int + TotalPages int + HasPrev bool + HasNext bool + PrevURL string + NextURL string + ActiveCount int + LockedCount int + UnverifiedCount int +} + +type adminRolesData struct { + Username string + CSRFToken string + Navigation template.HTML + Roles []UserRole + DatabaseReady bool + Error string + Success string +} + +type adminNewsStudioData struct { + Username string + CSRFToken string + Settings NewsStudioSettings + Channels []NewsStudioChannel + Active string + History []NewsProduction + Error string + Success string + OpenAIReady bool + ElevenReady bool + FTPReady bool + Voices []ElevenLabsVoice + Backgrounds []AudioBackgroundTrack +} + +type adminAIModuleData struct { + Username string + CSRFToken string + Title string + Kicker string + Description string + Module string + Icon string + Status string + Features []string +} + +type adminProgramData struct { + Username string + CSRFToken string + Items []ProgramItem + Edit ProgramItem + HasEdit bool + Error string + Success string + StorePath string + TeamMembers []TeamMember +} + +func parseAdminTemplate(files ...string) (*template.Template, error) { + return template.New("admin").Funcs(template.FuncMap{ + "adminNavigation": func() template.HTML { return template.HTML(adminNavigationHTML()) }, + "inc": func(value int) int { return value + 1 }, + "auditURL": auditAdminURL, + "paragraphs": managedParagraphs, + }).ParseFS(webFS, files...) +} + +func newAdminHandler(logger *log.Logger, weather *WeatherService, data PageData, settings *settingsStore, nowPlaying *nowPlayingService, programs *programStore, downloads *downloadStore, extras ...any) (*adminHandler, error) { + var ai *aiService + var editorial *editorialStore + var wishes *wishStore + var emailTemplates *emailTemplateStore + var wishAutomation *wishWorkflow + var media *mediaStore + var database *postgresStore + var team *teamStore + var forum *forumStore + var destinationOne *destinationOneImporter + var navigation *navigationStore + var directory *directoryStore + for _, extra := range extras { + switch value := extra.(type) { + case *aiService: + ai = value + case *editorialStore: + editorial = value + case *wishStore: + wishes = value + case *emailTemplateStore: + emailTemplates = value + case *wishWorkflow: + wishAutomation = value + case *mediaStore: + media = value + case *postgresStore: + database = value + case *teamStore: + team = value + case *forumStore: + forum = value + case *destinationOneImporter: + destinationOne = value + case *navigationStore: + navigation = value + case *directoryStore: + directory = value + } + } + if ai == nil { + ai, _ = newAIService(settings) + } + if editorial == nil { + editorial = newEditorialStore(nil) + } + if wishes == nil { + wishes, _ = newWishStore() + } + if team == nil { + team = newTeamStore(database) + } + if forum == nil { + forum = newForumStore(database) + } + loginTemplate, err := parseAdminTemplate("web/admin/login.html") + if err != nil { + return nil, err + } + dashboardTemplate, err := parseAdminTemplate("web/admin/dashboard.html") + if err != nil { + return nil, err + } + programTemplate, err := parseAdminTemplate("web/admin/program.html") + if err != nil { + return nil, err + } + downloadsTemplate, err := parseAdminTemplate("web/admin/downloads.html") + if err != nil { + return nil, err + } + settingsTemplate, err := parseAdminTemplate("web/admin/settings.html") + if err != nil { + return nil, err + } + aiTemplate, err := parseAdminTemplate("web/admin/ai.html") + if err != nil { + return nil, err + } + editorialTemplate, err := parseAdminTemplate("web/admin/editorial.html") + if err != nil { + return nil, err + } + wishesTemplate, err := parseAdminTemplate("web/admin/wishes.html") + if err != nil { + return nil, err + } + emailTemplatesTemplate, err := parseAdminTemplate("web/admin/email-templates.html") + if err != nil { + return nil, err + } + mediaTemplate, err := parseAdminTemplate("web/admin/media.html") + if err != nil { + return nil, err + } + usersTemplate, err := parseAdminTemplate("web/admin/users.html") + if err != nil { + return nil, err + } + rolesTemplate, err := parseAdminTemplate("web/admin/roles.html") + if err != nil { + return nil, err + } + teamTemplate, err := parseAdminTemplate("web/admin/team.html") + if err != nil { + return nil, err + } + forumTemplate, err := parseAdminTemplate("web/admin/forum.html") + if err != nil { + return nil, err + } + managementTemplate, err := parseAdminTemplate("web/admin/management.html") + if err != nil { + return nil, err + } + aiModuleTemplate, err := parseAdminTemplate("web/admin/ai-module.html") + if err != nil { + return nil, err + } + newsStudioTemplate, err := parseAdminTemplate("web/admin/news-studio.html") + if err != nil { + return nil, err + } + autoTasksTemplate, err := parseAdminTemplate("web/admin/auto-tasks.html") + if err != nil { + return nil, err + } + navigationTemplate, err := parseAdminTemplate("web/admin/navigation.html") + if err != nil { + return nil, err + } + directoryTemplate, err := parseAdminTemplate("web/admin/directory.html") + if err != nil { + return nil, err + } + siteContentTemplate, err := parseAdminTemplate("web/admin/site-content.html") + if err != nil { + return nil, err + } + mediathekTemplate, err := parseAdminTemplate("web/admin/mediathek.html") + if err != nil { + return nil, err + } + analyticsTemplate, err := parseAdminTemplate("web/admin/analytics.html") + if err != nil { + return nil, err + } + excursionsTemplate, err := parseAdminTemplate("web/admin/excursions.html") + if err != nil { + return nil, err + } + aiAudioModuleTemplate, err := parseAdminTemplate("web/admin/ai-audio-module.html") + if err != nil { + return nil, err + } + pushTemplate, err := parseAdminTemplate("web/admin/push.html") + if err != nil { + return nil, err + } + newsStudio, err := newNewsStudioStore(database) + if err != nil { + return nil, err + } + firebasePush := newFirebasePushService(logger, database) + + return &adminHandler{ + loginTemplate: loginTemplate, + dashboardTemplate: dashboardTemplate, + programTemplate: programTemplate, + downloadsTemplate: downloadsTemplate, + settingsTemplate: settingsTemplate, + aiTemplate: aiTemplate, + editorialTemplate: editorialTemplate, + wishesTemplate: wishesTemplate, + emailTemplatesTemplate: emailTemplatesTemplate, + mediaTemplate: mediaTemplate, + usersTemplate: usersTemplate, + rolesTemplate: rolesTemplate, + teamTemplate: teamTemplate, + forumTemplate: forumTemplate, + managementTemplate: managementTemplate, + aiModuleTemplate: aiModuleTemplate, + newsStudioTemplate: newsStudioTemplate, + autoTasksTemplate: autoTasksTemplate, + navigationTemplate: navigationTemplate, + directoryTemplate: directoryTemplate, + siteContentTemplate: siteContentTemplate, + mediathekTemplate: mediathekTemplate, + analyticsTemplate: analyticsTemplate, + excursionsTemplate: excursionsTemplate, + aiAudioModuleTemplate: aiAudioModuleTemplate, + pushTemplate: pushTemplate, + sessions: &adminSessionStore{sessions: make(map[string]adminSession), ttl: envDuration("LANDWELLE_ADMIN_SESSION_TTL", 12*time.Hour)}, + limiter: &loginLimiter{attempts: make(map[string]loginAttempt)}, + logger: logger, + weather: weather, + settings: settings, + nowPlaying: nowPlaying, + programs: programs, + downloads: downloads, + ai: ai, + editorial: editorial, + wishes: wishes, + emailTemplates: emailTemplates, + media: media, + wishAutomation: wishAutomation, + startedAt: time.Now(), + username: envOr("LANDWELLE_ADMIN_USER", "admin"), + passwordHash: strings.TrimSpace(os.Getenv("LANDWELLE_ADMIN_PASSWORD_HASH")), + plainPassword: os.Getenv("LANDWELLE_ADMIN_PASSWORD"), + cookieSecure: envBool("LANDWELLE_ADMIN_COOKIE_SECURE", false), + trustProxy: envBool("LANDWELLE_TRUST_PROXY", false), + pageData: data, + database: database, + users: newUserStore(database), + team: team, + forum: forum, + destinationOne: destinationOne, + newsStudio: newsStudio, + aiJobs: newAIJobStore(), + firebasePush: firebasePush, + navigation: navigation, + directory: directory, + siteContent: newSiteContentStore(database, media), + analytics: newSiteAnalyticsStore(database), + excursions: newExcursionStore(database), + }, nil +} + +func (a *adminHandler) register(mux *http.ServeMux) { + mux.HandleFunc("/admin", a.adminRoot) + mux.HandleFunc("/admin/", a.adminRoot) + mux.HandleFunc("/admin/login", a.login) + mux.HandleFunc("/admin/logout", a.logout) + mux.HandleFunc("/admin/program", a.withPermission("program.manage", a.adminProgram)) + mux.HandleFunc("/admin/downloads", a.withPermission("downloads.manage", a.adminDownloads)) + mux.HandleFunc("/admin/app/push", a.withPermission("settings.manage", a.adminAppPush)) + mux.HandleFunc("/admin/settings", a.withPermission("settings.manage", a.adminSettings)) + mux.HandleFunc("/admin/settings/import-events", a.withPermission("settings.manage", a.adminSettingsImportEvents)) + mux.HandleFunc("/admin/settings/background-music", a.withPermission("settings.manage", a.adminBackgroundMusic)) + mux.HandleFunc("/admin/ai", a.withPermission("ai.use", a.adminAI)) + mux.HandleFunc("/admin/ai/news", a.withPermission("ai.use", a.adminNewsStudio)) + mux.HandleFunc("/admin/ai/news-local", a.withPermission("ai.use", a.adminAIAudioModule)) + mux.HandleFunc("/admin/ai/news/job/", a.withPermission("ai.use", a.adminNewsJobStatus)) + mux.HandleFunc("/admin/ai/moon-calendar", a.withPermission("ai.use", a.adminAIModule)) + mux.HandleFunc("/admin/ai/wishes", a.withPermission("ai.use", a.adminAIModule)) + mux.HandleFunc("/admin/ai/farmers-calendar", a.withPermission("ai.use", a.adminAIModule)) + mux.HandleFunc("/admin/ai/memorial-days", a.withPermission("ai.use", a.adminAIModule)) + mux.HandleFunc("/admin/ai/today-is", a.withPermission("ai.use", a.adminAIModule)) + mux.HandleFunc("/admin/ai/horoscopes", a.withPermission("ai.use", a.adminAIModule)) + mux.HandleFunc("/admin/ai/auto-tasks", a.withPermission("ai.use", a.adminAutoTasks)) + mux.HandleFunc("/internal/cron", a.handleCentralCron) + mux.HandleFunc("/admin/editorial", a.withPermission("editorial.write", a.adminEditorial)) + mux.HandleFunc("/admin/mediathek", a.withPermission("editorial.write", a.adminMediathek)) + mux.HandleFunc("/admin/presse", a.withPermission("editorial.write", a.adminSiteContent)) + mux.HandleFunc("/admin/karriere", a.withPermission("editorial.write", a.adminSiteContent)) + mux.HandleFunc("/admin/faq", a.withPermission("editorial.write", a.adminSiteContent)) + mux.HandleFunc("/admin/kontakt", a.withPermission("editorial.write", a.adminSiteContent)) + mux.HandleFunc("/admin/wishes", a.withPermission("wishes.manage", a.adminWishes)) + mux.HandleFunc("/admin/email-templates", a.withPermission("settings.manage", a.adminEmailTemplates)) + mux.HandleFunc("/admin/media", a.withPermission("media.manage", a.adminMedia)) + mux.HandleFunc("/admin/team", a.withPermission("editorial.write", a.adminTeam)) + mux.HandleFunc("/admin/forum", a.withPermission("forum.moderate", a.adminForum)) + mux.HandleFunc("/admin/forum/categories", a.withPermission("forum.moderate", a.adminForum)) + mux.HandleFunc("/admin/forum/topics", a.withPermission("forum.moderate", a.adminForum)) + mux.HandleFunc("/admin/forum/reports", a.withPermission("forum.moderate", a.adminForum)) + mux.HandleFunc("/admin/charts", a.adminManagement) + mux.HandleFunc("/admin/api/charts/autosave", a.adminChartsAutosave) + mux.HandleFunc("/admin/api/charts/lookup-meta", a.adminChartsLookupMeta) + mux.HandleFunc("/admin/api/charts/reorder", a.adminChartsReorder) + mux.HandleFunc("/admin/api/charts/generate", a.adminChartsGenerate) + mux.HandleFunc("/admin/api/charts/year-info/generate", a.adminChartYearInfoGenerate) + mux.HandleFunc("/admin/events", a.adminManagement) + mux.HandleFunc("/admin/excursions", a.withPermission("excursions.manage", a.adminExcursions)) + mux.HandleFunc("/admin/navigation", a.withPermission("navigation.manage", a.adminNavigation)) + mux.HandleFunc("/admin/directory", a.withPermission("directory.manage", a.adminDirectory)) + mux.HandleFunc("/admin/audit", a.adminManagement) + mux.HandleFunc("/admin/statistik", a.withPermission("audit.view", a.adminAnalytics)) + mux.HandleFunc("/admin/todos", a.withPermission("todos.manage", a.adminTodos)) + mux.HandleFunc("/admin/todos/firebase-test", a.withPermission("todos.manage", a.adminTodoFirebaseTest)) + mux.HandleFunc("/api/mobile/todos", a.apiMobileTodos) + mux.HandleFunc("/api/mobile/todos/push-receipt", a.apiMobileTodoPushReceipt) + mux.HandleFunc("/api/mobile/status", a.apiMobileStatus) + mux.HandleFunc("/admin/users/admins", a.adminUsers) + mux.HandleFunc("/admin/users/members", a.adminUsers) + mux.HandleFunc("/admin/users/roles", a.adminRoles) + mux.HandleFunc("/admin/ai/audio/", a.adminAIAudio) + mux.HandleFunc("/admin/api/weather", a.adminWeather) + mux.HandleFunc("/admin/api/azuracast", a.adminAzuraCast) + mux.HandleFunc("/admin/api/azuracast/test", a.adminAzuraCastTest) + mux.HandleFunc("/admin/api/azuracast/save", a.adminAzuraCastSave) + for _, module := range aiAudioModuleCatalog { + if module.Path == "/admin/ai/news-local" { + continue + } + mux.HandleFunc(module.Path, a.withPermission("ai.use", a.adminAIAudioModule)) + } +} + +func wantsJSONRequest(r *http.Request) bool { + return strings.Contains(strings.ToLower(r.Header.Get("Accept")), "application/json") || strings.EqualFold(r.Header.Get("X-Requested-With"), "XMLHttpRequest") +} + +func writeAdminJSONError(w http.ResponseWriter, status int, message string) { + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Cache-Control", "no-store") + w.WriteHeader(status) + _ = json.NewEncoder(w).Encode(map[string]any{"error": message}) +} + +func (a *adminHandler) withPermission(permission string, next http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + if wantsJSONRequest(r) { + writeAdminJSONError(w, http.StatusUnauthorized, "Die Admin-Sitzung ist abgelaufen. Bitte neu anmelden.") + return + } + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if !requireAdminPermission(w, session, permission) { + return + } + next(w, r) + } +} + +func (a *adminHandler) configured() bool { + return a.passwordHash != "" || a.plainPassword != "" || (a.users != nil && a.users.Enabled()) +} + +func (a *adminHandler) adminRoot(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/admin" && r.URL.Path != "/admin/" { + http.NotFound(w, r) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", http.MethodGet) + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if !requireAdminPermission(w, session, "dashboard.view") { + return + } + if r.Method == http.MethodHead { + w.WriteHeader(http.StatusOK) + return + } + + weather, weatherErr := a.weather.Get(r.Context(), false) + runtimeSettings := a.settings.Get() + now := a.nowPlaying.Current() + data := adminDashboardData{ + Username: session.Username, + CSRFToken: session.CSRFToken, + Version: displayVersion(), + StartedAt: a.startedAt.Local().Format("02.01.2006 · 15:04 Uhr"), + Uptime: humanDuration(time.Since(a.startedAt)), + ListenAddress: envOr("ADDR", ":2200"), + StreamURL: a.pageData.StreamURL, + DatabaseConfigured: strings.TrimSpace(os.Getenv("DATABASE_URL")) != "", + Weather: weather, + WeatherAvailable: weatherErr == nil, + AdminHashActive: a.passwordHash != "", + RuntimeSettings: runtimeSettings, + SettingsPath: a.settings.Path(), + NowPlaying: now, + AzuraCastEndpoint: azuraCastNowPlayingURL(runtimeSettings.AzuraCast), + } + if weatherErr != nil { + data.WeatherError = "Wetterdienst derzeit nicht erreichbar" + } + a.enrichDashboard(r.Context(), &data) + + setAdminHTMLHeaders(w) + if err := a.dashboardTemplate.ExecuteTemplate(w, "dashboard.html", data); err != nil { + a.logger.Printf("admin dashboard template: %v", err) + } +} + +func (a *adminHandler) login(w http.ResponseWriter, r *http.Request) { + if r.Method == http.MethodGet || r.Method == http.MethodHead { + setAdminHTMLHeaders(w) + if _, _, ok := a.sessionFromRequest(r); ok { + http.Redirect(w, r, "/admin", http.StatusSeeOther) + return + } + if r.Method == http.MethodHead { + w.WriteHeader(http.StatusOK) + return + } + a.renderLogin(w, adminLoginData{Configured: a.configured(), Username: a.username}) + return + } + if r.Method != http.MethodPost { + w.Header().Set("Allow", "GET, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if !a.configured() { + a.renderLogin(w, adminLoginData{Configured: false, Username: a.username, Error: "Der Adminzugang ist noch nicht konfiguriert."}) + return + } + + ip := a.clientIP(r) + if wait, blocked := a.limiter.blocked(ip); blocked { + w.Header().Set("Retry-After", strconv.Itoa(int(wait.Seconds())+1)) + a.renderLoginStatus(w, http.StatusTooManyRequests, adminLoginData{Configured: true, Username: a.username, Error: "Zu viele Anmeldeversuche. Bitte später erneut versuchen."}) + return + } + + r.Body = http.MaxBytesReader(w, r.Body, 16<<10) + if err := r.ParseForm(); err != nil { + a.renderLogin(w, adminLoginData{Configured: true, Username: a.username, Error: "Die Anmeldung konnte nicht verarbeitet werden."}) + return + } + username := strings.TrimSpace(r.FormValue("username")) + password := r.FormValue("password") + identity, authenticated := a.authenticateAdmin(r.Context(), username, password) + if !authenticated { + a.limiter.failure(ip) + time.Sleep(250 * time.Millisecond) + a.renderLogin(w, adminLoginData{Configured: true, Username: username, Error: "Benutzername oder Passwort ist nicht korrekt oder das Konto ist gesperrt."}) + return + } + + a.limiter.success(ip) + token, session, err := a.sessions.create(identity) + if err != nil { + http.Error(w, "Sitzung konnte nicht erstellt werden", http.StatusInternalServerError) + return + } + a.setSessionCookie(w, r, token, session.ExpiresAt) + a.logger.Printf("Admin-Anmeldung erfolgreich für %s von %s", session.Username, ip) + http.Redirect(w, r, "/admin", http.StatusSeeOther) +} + +func (a *adminHandler) logout(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + w.Header().Set("Allow", http.MethodPost) + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + token, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + r.Body = http.MaxBytesReader(w, r.Body, 8<<10) + if err := r.ParseForm(); err != nil || subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + a.sessions.delete(token) + a.clearSessionCookie(w, r) + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) +} + +func (a *adminHandler) adminProgram(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 64<<10) + if err := r.ParseForm(); err != nil || subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + action := r.FormValue("action") + if action == "delete" { + if err := a.programs.Delete(strings.TrimSpace(r.FormValue("id"))); err != nil { + a.renderProgram(w, session, adminProgramData{Error: err.Error()}) + return + } + a.audit(r.Context(), session, r, "program.delete", "program", 0, "Programmeintrag gelöscht", true) + http.Redirect(w, r, "/admin/program?deleted=1", http.StatusSeeOther) + return + } + weekday, _ := strconv.Atoi(r.FormValue("weekday")) + teamMemberID := strings.TrimSpace(r.FormValue("team_member_id")) + teamMembers, teamErr := a.team.List(r.Context(), false) + if teamErr != nil { + a.renderProgram(w, session, adminProgramData{Error: "Teammitglieder konnten nicht geladen werden: " + teamErr.Error()}) + return + } + var selectedTeam TeamMember + for _, member := range teamMembers { + if member.ID == teamMemberID { + selectedTeam = member + break + } + } + if selectedTeam.ID == "" { + a.renderProgram(w, session, adminProgramData{Error: "Bitte ein gültiges Teammitglied für Moderator/Bild auswählen."}) + return + } + item := ProgramItem{ID: strings.TrimSpace(r.FormValue("id")), Weekday: weekday, Start: r.FormValue("start"), End: r.FormValue("end"), Show: r.FormValue("show"), Presenter: selectedTeam.Name, ProgramType: r.FormValue("program_type"), Description: r.FormValue("description"), Image: selectedTeam.Image, TeamMemberID: selectedTeam.ID, Active: r.FormValue("active") == "on"} + weekdays := r.Form["weekdays"] + if item.ID == "" && len(weekdays) > 0 { + for _, raw := range weekdays { + day, err := strconv.Atoi(raw) + if err != nil { + continue + } + copyItem := item + copyItem.Weekday = day + copyItem.ID = "" + if err := a.programs.Upsert(copyItem); err != nil { + a.renderProgram(w, session, adminProgramData{Edit: item, Error: err.Error()}) + return + } + } + } else if err := a.programs.Upsert(item); err != nil { + data := adminProgramData{Edit: item, HasEdit: item.ID != "", Error: err.Error()} + a.renderProgram(w, session, data) + return + } + a.audit(r.Context(), session, r, "program.save", "program", 0, "Programmeintrag gespeichert", true) + redirectURL := "/admin/program?saved=1" + if day := strings.TrimSpace(r.FormValue("return_day")); day != "" { + redirectURL += "&day=" + url.QueryEscape(day) + } + http.Redirect(w, r, redirectURL, http.StatusSeeOther) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.Method == http.MethodHead { + setAdminHTMLHeaders(w) + w.WriteHeader(http.StatusOK) + return + } + data := adminProgramData{} + if id := strings.TrimSpace(r.URL.Query().Get("edit")); id != "" { + if item, found := a.programs.Get(id); found { + data.Edit = item + data.HasEdit = true + } + } + if r.URL.Query().Get("saved") == "1" { + data.Success = "Sendung wurde gespeichert." + } + if r.URL.Query().Get("deleted") == "1" { + data.Success = "Sendung wurde gelöscht." + } + a.renderProgram(w, session, data) +} + +func (a *adminHandler) renderProgram(w http.ResponseWriter, session adminSession, data adminProgramData) { + data.Username = session.Username + data.CSRFToken = session.CSRFToken + data.Items = a.programs.List(time.Now()) + data.StorePath = a.programs.Path() + if members, err := a.team.List(context.Background(), false); err == nil { + data.TeamMembers = members + if data.HasEdit && data.Edit.TeamMemberID == "" { + for _, member := range members { + if member.Name == data.Edit.Presenter || (member.Image != "" && member.Image == data.Edit.Image) { + data.Edit.TeamMemberID = member.ID + break + } + } + } + } + if !data.HasEdit && data.Edit.Start == "" { + data.Edit = ProgramItem{Weekday: -1, Start: "06:00", End: "10:00", Image: "/assets/presenter-jan-v14.svg", Active: true} + } + setAdminHTMLHeaders(w) + if err := a.programTemplate.ExecuteTemplate(w, "program-admin.html", data); err != nil { + a.logger.Printf("admin program template: %v", err) + } +} + +func (a *adminHandler) adminDownloads(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 750<<20) + if err := r.ParseMultipartForm(750 << 20); err != nil { + a.renderDownloads(w, session, adminDownloadsData{Error: "Upload konnte nicht verarbeitet werden. Maximale Dateigröße: 750 MB."}) + return + } + if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + if wantsJSONRequest(r) { + writeAdminJSONError(w, http.StatusForbidden, "Ungültige Sicherheitsprüfung. Bitte die Seite neu laden.") + return + } + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + platform := strings.TrimSpace(r.FormValue("platform")) + action := strings.TrimSpace(r.FormValue("action")) + if action == "delete" { + if err := a.downloads.Delete(platform); err != nil { + a.audit(r.Context(), session, r, "download.delete", "download", 0, "Download konnte nicht entfernt werden: "+platform, false) + a.renderDownloads(w, session, adminDownloadsData{Error: "Datei konnte nicht entfernt werden: " + err.Error()}) + return + } + a.audit(r.Context(), session, r, "download.delete", "download", 0, "Download entfernt: "+platform, true) + http.Redirect(w, r, "/admin/downloads?deleted=1", http.StatusSeeOther) + return + } + file, header, err := r.FormFile("download_file") + if err != nil { + a.renderDownloads(w, session, adminDownloadsData{Error: "Bitte eine Datei auswählen."}) + return + } + _ = file.Close() + var previewHeader *multipart.FileHeader + if _, ph, perr := r.FormFile("preview_file"); perr == nil { + previewHeader = ph + } + if err := a.downloads.SaveWithPreview(platform, header, previewHeader); err != nil { + a.audit(r.Context(), session, r, "download.publish", "download", 0, "Download konnte nicht veröffentlicht werden: "+platform, false) + a.renderDownloads(w, session, adminDownloadsData{Error: "Datei konnte nicht gespeichert werden: " + err.Error()}) + return + } + a.logger.Printf("Download %s von Admin %s aktualisiert", platform, session.Username) + a.audit(r.Context(), session, r, "download.publish", "download", 0, "Download veröffentlicht: "+platform, true) + http.Redirect(w, r, "/admin/downloads?saved=1", http.StatusSeeOther) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.Method == http.MethodHead { + setAdminHTMLHeaders(w) + w.WriteHeader(http.StatusOK) + return + } + data := adminDownloadsData{} + if r.URL.Query().Get("saved") == "1" { + data.Success = "Download-Datei wurde veröffentlicht." + } + if r.URL.Query().Get("deleted") == "1" { + data.Success = "Download-Datei wurde entfernt. Der Eintrag steht wieder auf Coming soon." + } + a.renderDownloads(w, session, data) +} + +func (a *adminHandler) renderDownloads(w http.ResponseWriter, session adminSession, data adminDownloadsData) { + data.Username = session.Username + data.CSRFToken = session.CSRFToken + data.Platforms = a.downloads.List() + data.StorePath = a.downloads.dir + setAdminHTMLHeaders(w) + if err := a.downloadsTemplate.ExecuteTemplate(w, "downloads-admin.html", data); err != nil { + a.logger.Printf("admin downloads template: %v", err) + } +} + +func (a *adminHandler) adminWeather(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + w.Header().Set("Allow", http.MethodGet) + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Diese HTTP-Methode ist nicht erlaubt.") + return + } + if _, _, ok := a.sessionFromRequest(r); !ok { + writeAPIError(w, http.StatusUnauthorized, "admin_login_required", "Admin-Anmeldung erforderlich.") + return + } + ctx, cancel := context.WithTimeout(r.Context(), 8*time.Second) + defer cancel() + snapshot, err := a.weather.Get(ctx, true) + if err != nil { + writeAPIError(w, http.StatusBadGateway, "weather_unavailable", "Wetterdaten sind momentan nicht erreichbar.") + return + } + writeJSON(w, http.StatusOK, apiEnvelope{Data: snapshot, Meta: apiMeta()}) +} + +func (a *adminHandler) adminAzuraCast(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + w.Header().Set("Allow", http.MethodGet) + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Diese HTTP-Methode ist nicht erlaubt.") + return + } + if _, _, ok := a.sessionFromRequest(r); !ok { + writeAPIError(w, http.StatusUnauthorized, "admin_login_required", "Admin-Anmeldung erforderlich.") + return + } + settings := a.settings.Get() + snapshot, err := a.nowPlaying.Get(r.Context(), false) + writeJSON(w, http.StatusOK, apiEnvelope{ + Data: map[string]any{ + "settings": settings, + "endpoint": azuraCastNowPlayingURL(settings.AzuraCast), + "now": snapshot, + "connected": err == nil && snapshot.Source == "azuracast", + }, + Meta: apiMeta(), + }) +} + +func (a *adminHandler) adminAzuraCastTest(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + w.Header().Set("Allow", http.MethodPost) + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Diese HTTP-Methode ist nicht erlaubt.") + return + } + _, session, ok := a.sessionFromRequest(r) + if !ok { + writeAPIError(w, http.StatusUnauthorized, "admin_login_required", "Admin-Anmeldung erforderlich.") + return + } + if !validAdminCSRF(r, session) { + writeAPIError(w, http.StatusForbidden, "invalid_csrf", "Ungültige Sicherheitsprüfung.") + return + } + settings, err := decodeRuntimeSettings(w, r) + currentAI := a.settings.Get() + settings.OpenAI = currentAI.OpenAI + settings.ElevenLabs = currentAI.ElevenLabs + if err != nil { + writeAPIError(w, http.StatusBadRequest, "invalid_settings", err.Error()) + return + } + ctx, cancel := context.WithTimeout(r.Context(), 18*time.Second) + defer cancel() + snapshot, err := a.nowPlaying.TestConfig(ctx, settings) + if err != nil { + writeAPIError(w, http.StatusBadGateway, "azuracast_test_failed", err.Error()) + return + } + writeJSON(w, http.StatusOK, apiEnvelope{ + Data: map[string]any{ + "message": "AzuraCast-Verbindung erfolgreich.", + "endpoint": azuraCastNowPlayingURL(settings.AzuraCast), + "now": snapshot, + }, + Meta: apiMeta(), + }) +} + +func (a *adminHandler) adminAzuraCastSave(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + w.Header().Set("Allow", http.MethodPost) + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Diese HTTP-Methode ist nicht erlaubt.") + return + } + _, session, ok := a.sessionFromRequest(r) + if !ok { + writeAPIError(w, http.StatusUnauthorized, "admin_login_required", "Admin-Anmeldung erforderlich.") + return + } + if !validAdminCSRF(r, session) { + writeAPIError(w, http.StatusForbidden, "invalid_csrf", "Ungültige Sicherheitsprüfung.") + return + } + settings, err := decodeRuntimeSettings(w, r) + currentAI := a.settings.Get() + settings.OpenAI = currentAI.OpenAI + settings.ElevenLabs = currentAI.ElevenLabs + if err != nil { + writeAPIError(w, http.StatusBadRequest, "invalid_settings", err.Error()) + return + } + if err := a.settings.Save(settings); err != nil { + a.logger.Printf("AzuraCast-Einstellungen speichern: %v", err) + writeAPIError(w, http.StatusInternalServerError, "settings_save_failed", "Die Einstellungen konnten nicht gespeichert werden: "+err.Error()) + return + } + a.nowPlaying.Invalidate() + ctx, cancel := context.WithTimeout(r.Context(), 18*time.Second) + defer cancel() + snapshot, fetchErr := a.nowPlaying.Get(ctx, true) + message := "AzuraCast- und Cover-Einstellungen wurden gespeichert." + if fetchErr != nil { + message += " Die Verbindung konnte unmittelbar danach noch nicht bestätigt werden." + } + a.logger.Printf("AzuraCast-Einstellungen von Admin %s aktualisiert", session.Username) + writeJSON(w, http.StatusOK, apiEnvelope{ + Data: map[string]any{ + "message": message, + "settings": settings, + "endpoint": azuraCastNowPlayingURL(settings.AzuraCast), + "now": snapshot, + "connected": fetchErr == nil && snapshot.Source == "azuracast", + }, + Meta: apiMeta(), + }) +} + +func decodeRuntimeSettings(w http.ResponseWriter, r *http.Request) (RuntimeSettings, error) { + r.Body = http.MaxBytesReader(w, r.Body, 64<<10) + defer r.Body.Close() + var settings RuntimeSettings + decoder := json.NewDecoder(r.Body) + decoder.DisallowUnknownFields() + if err := decoder.Decode(&settings); err != nil { + return RuntimeSettings{}, errors.New("die übermittelten Einstellungen sind ungültig") + } + if err := validateRuntimeSettings(settings); err != nil { + return RuntimeSettings{}, err + } + return settings, nil +} + +func validAdminCSRF(r *http.Request, session adminSession) bool { + expected := strings.TrimSpace(session.CSRFToken) + if expected == "" { + return false + } + if token := strings.TrimSpace(r.Header.Get("X-CSRF-Token")); token != "" { + return subtle.ConstantTimeCompare([]byte(token), []byte(expected)) == 1 + } + token := strings.TrimSpace(r.FormValue("csrf_token")) + return token != "" && subtle.ConstantTimeCompare([]byte(token), []byte(expected)) == 1 +} + +func (a *adminHandler) renderLogin(w http.ResponseWriter, data adminLoginData) { + a.renderLoginStatus(w, http.StatusOK, data) +} + +func (a *adminHandler) renderLoginStatus(w http.ResponseWriter, status int, data adminLoginData) { + setAdminHTMLHeaders(w) + w.WriteHeader(status) + if err := a.loginTemplate.ExecuteTemplate(w, "login.html", data); err != nil { + a.logger.Printf("admin login template: %v", err) + } +} + +func (a *adminHandler) authenticateAdmin(ctx context.Context, username, password string) (AuthenticatedUser, bool) { + userMatch := subtle.ConstantTimeCompare(hashText(username), hashText(a.username)) == 1 + var passwordMatch bool + if a.passwordHash != "" { + passwordMatch = auth.VerifyPassword(a.passwordHash, password) + } else if a.plainPassword != "" { + passwordMatch = subtle.ConstantTimeCompare(hashText(password), hashText(a.plainPassword)) == 1 + } + if userMatch && passwordMatch { + return AuthenticatedUser{Username: a.username, DisplayName: a.username, Role: "administrator", Permissions: map[string]bool{"*": true}}, true + } + if a.users != nil && a.users.Enabled() { + identity, ok := a.users.Authenticate(ctx, username, password) + if ok && identity.Role != "member" { + return identity, true + } + } + return AuthenticatedUser{}, false +} + +func hashText(value string) []byte { + sum := sha256.Sum256([]byte(value)) + return sum[:] +} + +func (a *adminHandler) sessionFromRequest(r *http.Request) (string, adminSession, bool) { + cookie, err := r.Cookie(adminCookieName) + if err != nil || cookie.Value == "" { + return "", adminSession{}, false + } + session, ok := a.sessions.get(cookie.Value) + return cookie.Value, session, ok +} + +func (a *adminHandler) setSessionCookie(w http.ResponseWriter, r *http.Request, token string, expires time.Time) { + http.SetCookie(w, &http.Cookie{ + Name: adminCookieName, + Value: token, + Path: "/admin", + Expires: expires, + MaxAge: int(time.Until(expires).Seconds()), + HttpOnly: true, + Secure: a.cookieSecure || requestIsHTTPS(r), + SameSite: http.SameSiteStrictMode, + }) +} + +func (a *adminHandler) clearSessionCookie(w http.ResponseWriter, r *http.Request) { + http.SetCookie(w, &http.Cookie{ + Name: adminCookieName, + Value: "", + Path: "/admin", + Expires: time.Unix(1, 0), + MaxAge: -1, + HttpOnly: true, + Secure: a.cookieSecure || requestIsHTTPS(r), + SameSite: http.SameSiteStrictMode, + }) +} + +func (a *adminHandler) clientIP(r *http.Request) string { + if a.trustProxy { + if forwarded := strings.TrimSpace(strings.Split(r.Header.Get("X-Forwarded-For"), ",")[0]); forwarded != "" { + return forwarded + } + } + host, _, err := net.SplitHostPort(r.RemoteAddr) + if err == nil { + return host + } + return r.RemoteAddr +} + +func (s *adminSessionStore) create(identity AuthenticatedUser) (string, adminSession, error) { + token, err := randomToken(32) + if err != nil { + return "", adminSession{}, err + } + csrf, err := randomToken(24) + if err != nil { + return "", adminSession{}, err + } + session := adminSession{UserID: identity.ID, Username: identity.Username, DisplayName: identity.DisplayName, Role: identity.Role, Permissions: identity.Permissions, CSRFToken: csrf, ExpiresAt: time.Now().Add(s.ttl)} + s.mu.Lock() + defer s.mu.Unlock() + for key, existing := range s.sessions { + if time.Now().After(existing.ExpiresAt) { + delete(s.sessions, key) + } + } + s.sessions[token] = session + return token, session, nil +} + +func (s *adminSessionStore) get(token string) (adminSession, bool) { + s.mu.Lock() + defer s.mu.Unlock() + session, ok := s.sessions[token] + if !ok || time.Now().After(session.ExpiresAt) { + delete(s.sessions, token) + return adminSession{}, false + } + return session, true +} + +func (s *adminSessionStore) delete(token string) { + s.mu.Lock() + delete(s.sessions, token) + s.mu.Unlock() +} + +func (l *loginLimiter) blocked(key string) (time.Duration, bool) { + l.mu.Lock() + defer l.mu.Unlock() + attempt := l.attempts[key] + now := time.Now() + if !attempt.Blocked.IsZero() && now.Before(attempt.Blocked) { + return time.Until(attempt.Blocked), true + } + if now.After(attempt.ResetAt) { + delete(l.attempts, key) + } + return 0, false +} + +func (l *loginLimiter) failure(key string) { + l.mu.Lock() + defer l.mu.Unlock() + now := time.Now() + attempt := l.attempts[key] + if now.After(attempt.ResetAt) { + attempt = loginAttempt{ResetAt: now.Add(15 * time.Minute)} + } + attempt.Failures++ + if attempt.Failures >= 5 { + attempt.Blocked = now.Add(15 * time.Minute) + } + l.attempts[key] = attempt +} + +func (l *loginLimiter) success(key string) { + l.mu.Lock() + delete(l.attempts, key) + l.mu.Unlock() +} + +func randomToken(bytes int) (string, error) { + buffer := make([]byte, bytes) + if _, err := rand.Read(buffer); err != nil { + return "", err + } + return base64.RawURLEncoding.EncodeToString(buffer), nil +} + +func requestIsHTTPS(r *http.Request) bool { + if r.TLS != nil { + return true + } + return strings.EqualFold(strings.TrimSpace(strings.Split(r.Header.Get("X-Forwarded-Proto"), ",")[0]), "https") +} + +func setAdminHTMLHeaders(w http.ResponseWriter) { + w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.Header().Set("Cache-Control", "no-store") + w.Header().Set("X-Robots-Tag", "noindex, nofollow, noarchive") +} + +func humanDuration(duration time.Duration) string { + if duration < time.Minute { + return "weniger als eine Minute" + } + days := int(duration.Hours()) / 24 + hours := int(duration.Hours()) % 24 + minutes := int(duration.Minutes()) % 60 + parts := make([]string, 0, 3) + if days > 0 { + parts = append(parts, strconv.Itoa(days)+" Tage") + } + if hours > 0 { + parts = append(parts, strconv.Itoa(hours)+" Std.") + } + if minutes > 0 && days == 0 { + parts = append(parts, strconv.Itoa(minutes)+" Min.") + } + return strings.Join(parts, " ") +} + +func envBool(key string, fallback bool) bool { + value := strings.TrimSpace(os.Getenv(key)) + if value == "" { + return fallback + } + parsed, err := strconv.ParseBool(value) + if err != nil { + return fallback + } + return parsed +} + +func (a *adminHandler) warmWeather() { + ctx, cancel := context.WithTimeout(context.Background(), 8*time.Second) + defer cancel() + if _, err := a.weather.Get(ctx, false); err != nil { + a.logger.Printf("Wetter-Vorababruf: %v", err) + } +} + +func (a *adminHandler) adminSettings(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if r.Method == http.MethodPost { + // Das Einstellungsformular nutzt multipart/form-data, weil im selben Bereich + // auch Hintergrundmusik verwaltet wird. ParseForm allein liest bei + // Multipart-Anfragen die Formularfelder (einschließlich CSRF-Token) nicht ein. + r.Body = http.MaxBytesReader(w, r.Body, 2<<20) + if err := r.ParseMultipartForm(2 << 20); err != nil { + a.renderSettings(w, session, adminSettingsData{Error: "Einstellungen konnten nicht gelesen werden."}) + return + } + if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + current := a.settings.Get() + next := current + if r.FormValue("google_adsense_enabled") == "on" { + next.Website.GoogleAdSenseMode = "enabled" + } else { + next.Website.GoogleAdSenseMode = "disabled" + } + next.OpenAI.Enabled = r.FormValue("openai_enabled") == "on" + next.OpenAI.BaseURL = r.FormValue("openai_base_url") + next.OpenAI.Model = r.FormValue("openai_model") + next.OpenAI.SystemPrompt = r.FormValue("openai_system_prompt") + if key := strings.TrimSpace(r.FormValue("openai_api_key")); key != "" { + next.OpenAI.APIKey = key + } + next.ElevenLabs.Enabled = r.FormValue("elevenlabs_enabled") == "on" + next.ElevenLabs.BaseURL = r.FormValue("elevenlabs_base_url") + next.ElevenLabs.Model = r.FormValue("elevenlabs_model") + next.ElevenLabs.OutputFormat = r.FormValue("elevenlabs_output_format") + if key := strings.TrimSpace(r.FormValue("elevenlabs_api_key")); key != "" { + next.ElevenLabs.APIKey = key + } + next.SMTP.Enabled = r.FormValue("smtp_enabled") == "on" + next.SMTP.Host = r.FormValue("smtp_host") + next.SMTP.Port, _ = strconv.Atoi(r.FormValue("smtp_port")) + next.SMTP.Username = r.FormValue("smtp_username") + if value := r.FormValue("smtp_password"); value != "" { + next.SMTP.Password = value + } + next.SMTP.FromName = r.FormValue("smtp_from_name") + next.SMTP.FromEmail = r.FormValue("smtp_from_email") + next.SMTP.AdminEmail = r.FormValue("smtp_admin_email") + next.SMTP.TLSMode = r.FormValue("smtp_tls_mode") + next.FTP.Enabled = r.FormValue("ftp_enabled") == "on" + next.FTP.Host = r.FormValue("ftp_host") + next.FTP.Port, _ = strconv.Atoi(r.FormValue("ftp_port")) + next.FTP.Username = r.FormValue("ftp_username") + if value := r.FormValue("ftp_password"); value != "" { + next.FTP.Password = value + } + next.FTP.TLS = r.FormValue("ftp_tls") == "on" + next.FTP.Passive = true + next.FTP.TimeoutSeconds, _ = strconv.Atoi(r.FormValue("ftp_timeout")) + next.WishAutomation.Enabled = r.FormValue("wish_automation_enabled") == "on" + next.WishAutomation.AutoProcessOnApprove = r.FormValue("wish_auto_process") == "on" + next.WishAutomation.Prompt = r.FormValue("wish_prompt") + next.WishAutomation.VoiceID = r.FormValue("wish_voice_id") + next.WishAutomation.RemoteDirectory = r.FormValue("wish_remote_directory") + next.WishAutomation.PublicBaseURL = r.FormValue("public_base_url") + next.Social.FacebookEnabled = r.FormValue("facebook_enabled") == "on" + next.Social.FacebookPageID = r.FormValue("facebook_page_id") + if value := strings.TrimSpace(r.FormValue("facebook_page_token")); value != "" { + next.Social.FacebookPageToken = value + } + next.Social.FacebookAPIVersion = r.FormValue("facebook_api_version") + next.Social.PublicBaseURL = r.FormValue("social_public_base_url") + next.Social.WhatsAppChannelURL = r.FormValue("whatsapp_channel_url") + next.DestinationOne.Enabled = r.FormValue("destination_one_enabled") == "on" + next.DestinationOne.APIURL = r.FormValue("destination_one_api_url") + if value := strings.TrimSpace(r.FormValue("destination_one_api_key")); value != "" { + next.DestinationOne.APIKey = value + } + next.DestinationOne.KeyParameter = r.FormValue("destination_one_key_parameter") + next.DestinationOne.Experience = r.FormValue("destination_one_experience") + next.DestinationOne.ExperienceParam = r.FormValue("destination_one_experience_parameter") + next.DestinationOne.IntervalMinutes, _ = strconv.Atoi(r.FormValue("destination_one_interval_minutes")) + next.DestinationOne.AutoPublish = r.FormValue("destination_one_auto_publish") == "on" + labels := r.Form["voice_label"] + ids := r.Form["voice_id"] + purposes := r.Form["voice_purpose"] + next.ElevenLabs.Voices = nil + for i := 0; i < len(ids); i++ { + id := strings.TrimSpace(ids[i]) + if id == "" { + continue + } + label, purpose := "Stimme", "general" + if i < len(labels) && strings.TrimSpace(labels[i]) != "" { + label = strings.TrimSpace(labels[i]) + } + if i < len(purposes) && strings.TrimSpace(purposes[i]) != "" { + purpose = strings.TrimSpace(purposes[i]) + } + next.ElevenLabs.Voices = append(next.ElevenLabs.Voices, ElevenLabsVoice{Label: label, VoiceID: id, Purpose: purpose}) + } + if err := a.settings.Save(next); err != nil { + a.renderSettings(w, session, adminSettingsData{Settings: next, Error: err.Error()}) + return + } + a.logger.Printf("Systemeinstellungen von Admin %s aktualisiert", session.Username) + http.Redirect(w, r, "/admin/settings?saved=1", http.StatusSeeOther) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.Method == http.MethodHead { + setAdminHTMLHeaders(w) + w.WriteHeader(http.StatusOK) + return + } + data := adminSettingsData{} + if r.URL.Query().Get("saved") == "1" { + data.Success = "Einstellungen wurden gespeichert." + } + a.renderSettings(w, session, data) +} + +func (a *adminHandler) renderSettings(w http.ResponseWriter, session adminSession, data adminSettingsData) { + data.Username = session.Username + data.CSRFToken = session.CSRFToken + if data.Settings.OpenAI.BaseURL == "" { + data.Settings = a.settings.Get() + } + data.SettingsPath = a.settings.Path() + data.OpenAIKeySet = data.Settings.OpenAI.APIKey != "" + data.ElevenLabsKeySet = data.Settings.ElevenLabs.APIKey != "" + data.DestinationOneKeySet = data.Settings.DestinationOne.APIKey != "" + ctx, cancel := context.WithTimeout(context.Background(), 8*time.Second) + defer cancel() + if models, err := a.ai.ListOpenAIModels(ctx); err == nil { + data.OpenAIModels = models + } + ctx2, cancel2 := context.WithTimeout(context.Background(), 8*time.Second) + defer cancel2() + if models, err := a.ai.ListElevenLabsModels(ctx2); err == nil { + data.ElevenModels = models + } + data.Settings.OpenAI.APIKey = "" + data.Settings.ElevenLabs.APIKey = "" + data.Settings.DestinationOne.APIKey = "" + setAdminHTMLHeaders(w) + if err := a.settingsTemplate.ExecuteTemplate(w, "settings-admin.html", data); err != nil { + a.logger.Printf("admin settings template: %v", err) + } +} + +func (a *adminHandler) adminAIModule(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", http.MethodGet) + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + modules := map[string]adminAIModuleData{ + "/admin/ai/news": {Title: "Nachrichten Welt", Kicker: "KI & Audio", Description: "Überregionale und internationale Nachrichteninhalte vorbereiten, redaktionell prüfen und für die Audioausgabe bereitstellen.", Module: "news", Icon: "▤", Status: "Modul aktiv", Features: []string{"Aktuelle Weltmeldungen", "Freigabe vor der Audioerzeugung", "Übergabe an ElevenLabs"}}, + "/admin/ai/news-local": {Title: "Nachrichten Lokal", Kicker: "KI & Audio", Description: "Lokale Nachrichten aus Niedersachsen und Norddeutschland in einem getrennten Arbeitsbereich vorbereiten.", Module: "news-local", Icon: "⌖", Status: "Modul vorbereitet", Features: []string{"Landeszeitung und regionale Quellen", "Lokale Themenauswahl", "Eigene Audioausgabe vorbereiten"}}, + "/admin/ai/moon-calendar": {Title: "Mondkalender", Kicker: "Tagesinhalte", Description: "Tägliche Mondphasen und passende redaktionelle Kurztexte verwalten.", Module: "moon-calendar", Icon: "☾", Status: "Modul vorbereitet", Features: []string{"Mondphase des Tages", "Sprechtext-Vorlage", "Zeitgesteuerte Erzeugung"}}, + "/admin/ai/wishes": {Title: "Wünsche", Kicker: "Hörer & Audio", Description: "Hörerwünsche für moderierte Wunschblöcke aufbereiten und vertonen.", Module: "wishes", Icon: "♥", Status: "Modul vorbereitet", Features: []string{"Freigegebene Wünsche übernehmen", "Moderationstext erzeugen", "Audioausgabe vorbereiten"}}, + "/admin/ai/farmers-calendar": {Title: "Bauernkalender", Kicker: "Land & Region", Description: "Bauernregeln, Jahreszeitenwissen und regionale Hinweise als Tagesrubrik pflegen.", Module: "farmers-calendar", Icon: "♨", Status: "Modul vorbereitet", Features: []string{"Tagesbezogene Bauernregeln", "Redaktionelle Prüfung", "Automatische Audiofassung"}}, + "/admin/ai/memorial-days": {Title: "Gedenktage", Kicker: "Tagesinhalte", Description: "Historische und regionale Gedenktage auswählen und als kurze Radiobeiträge vorbereiten.", Module: "memorial-days", Icon: "◆", Status: "Modul vorbereitet", Features: []string{"Gedenktage verwalten", "Quellenhinweise erfassen", "Sendefertigen Text erzeugen"}}, + "/admin/ai/today-is": {Title: "Heute ist der …", Kicker: "Tagesrubrik", Description: "Kuriose, offizielle und saisonale Aktionstage für die tägliche Rubrik planen.", Module: "today-is", Icon: "◉", Status: "Modul vorbereitet", Features: []string{"Aktionstage auswählen", "Kurze Anmoderation erzeugen", "Tagesplanung vorbereiten"}}, + "/admin/ai/horoscopes": {Title: "Tageshoroskope", Kicker: "Unterhaltung", Description: "Tageshoroskope für alle Sternzeichen erzeugen, prüfen und vertonen.", Module: "horoscopes", Icon: "✧", Status: "Modul vorbereitet", Features: []string{"Zwölf Sternzeichen", "Einheitliche Textlänge", "Audio-Paket erzeugen"}}, + "/admin/ai/auto-tasks": {Title: "Auto Aufgaben (Cronjob)", Kicker: "Automatisierung", Description: "Zeitgesteuerte KI- und Audioaufgaben zentral planen, aktivieren und überwachen.", Module: "auto-tasks", Icon: "◷", Status: "Cronjob-Zentrale vorbereitet", Features: []string{"Ausführungszeiten verwalten", "Letzten Lauf und Fehlerstatus anzeigen", "Einzelne Aufgaben aktivieren oder pausieren"}}, + } + data, found := modules[r.URL.Path] + if !found { + http.NotFound(w, r) + return + } + data.Username = session.Username + data.CSRFToken = session.CSRFToken + setAdminHTMLHeaders(w) + if r.Method == http.MethodHead { + return + } + if err := a.aiModuleTemplate.ExecuteTemplate(w, "ai-module-admin.html", data); err != nil { + a.logger.Printf("admin ai module template: %v", err) + } +} + +func (a *adminHandler) adminAI(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + data := adminAIData{Username: session.Username, CSRFToken: session.CSRFToken, Settings: a.settings.Get()} + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 256<<10) + if err := r.ParseForm(); err != nil { + data.Error = "Eingabe konnte nicht gelesen werden." + a.renderAI(w, data) + return + } + if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + action := r.FormValue("action") + ctx, cancel := context.WithTimeout(r.Context(), 90*time.Second) + defer cancel() + switch action { + case "text": + data.Task = r.FormValue("task") + data.Source = r.FormValue("source") + result, err := a.ai.GenerateText(ctx, data.Task, data.Source) + if err != nil { + data.Error = err.Error() + } else { + data.Result = result + } + case "speech": + data.SpeechText = r.FormValue("speech_text") + data.VoiceID = r.FormValue("voice_id") + name, err := a.ai.GenerateSpeechWithDisclosure(ctx, data.SpeechText, data.VoiceID, r.FormValue("ai_disclosure_enabled") == "on") + if err != nil { + data.Error = err.Error() + } else { + data.AudioURL = "/admin/ai/audio/" + name + } + default: + data.Error = "Unbekannte KI-Aktion." + } + a.renderAI(w, data) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.Method == http.MethodHead { + setAdminHTMLHeaders(w) + w.WriteHeader(http.StatusOK) + return + } + a.renderAI(w, data) +} + +func (a *adminHandler) renderAI(w http.ResponseWriter, data adminAIData) { + setAdminHTMLHeaders(w) + if err := a.aiTemplate.ExecuteTemplate(w, "ai-admin.html", data); err != nil { + a.logger.Printf("admin ai template: %v", err) + } +} + +func (a *adminHandler) adminAIAudio(w http.ResponseWriter, r *http.Request) { + if _, _, ok := a.sessionFromRequest(r); !ok { + http.Error(w, "Nicht angemeldet", http.StatusUnauthorized) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, HEAD") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + name := strings.TrimPrefix(r.URL.Path, "/admin/ai/audio/") + path, ok := a.ai.AudioPath(name) + if !ok { + http.NotFound(w, r) + return + } + w.Header().Set("Cache-Control", "private, no-store") + w.Header().Set("Content-Type", "audio/mpeg") + http.ServeFile(w, r, path) +} + +func normalizeEditorialTab(raw string) string { + switch strings.TrimSpace(raw) { + case "create", "categories", "contents": + return strings.TrimSpace(raw) + default: + return "contents" + } +} + +func trimFacebookStatusError(err error) string { + if err == nil { + return "" + } + message := strings.TrimSpace(err.Error()) + if len(message) > 600 { + message = message[:600] + "…" + } + return message +} + +func (a *adminHandler) setEditorialFacebookStatus(id int64, status string) { + ctx, cancel := context.WithTimeout(context.Background(), 6*time.Second) + defer cancel() + if err := a.editorial.SetFacebookStatus(ctx, id, status); err != nil { + a.logger.Printf("editorial facebook status %d: %v", id, err) + } +} + +func (a *adminHandler) publishEditorialFacebook(ctx context.Context, entry EditorialEntry) error { + if entry.ID <= 0 { + return errors.New("der redaktionelle Inhalt besitzt keine gültige ID") + } + if entry.Status != "published" { + return errors.New("der Inhalt muss zuerst veröffentlicht werden") + } + if !entry.PostToFacebook { + return errors.New("Facebook ist für diesen Inhalt nicht ausgewählt") + } + a.setEditorialFacebookStatus(entry.ID, "sending") + fbCtx, cancel := context.WithTimeout(ctx, 25*time.Second) + postID, err := newFacebookPublisher().Publish(fbCtx, a.settings.Get().Social, entry) + cancel() + if err != nil { + a.setEditorialFacebookStatus(entry.ID, "failed:"+trimFacebookStatusError(err)) + return err + } + a.setEditorialFacebookStatus(entry.ID, "published:"+strings.TrimSpace(postID)) + return nil +} + +func (a *adminHandler) adminEditorial(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + activeTab := normalizeEditorialTab(r.URL.Query().Get("tab")) + data := adminEditorialData{ + Username: session.Username, + CSRFToken: session.CSRFToken, + DatabaseReady: a.editorial.Enabled(), + ActiveTab: activeTab, + Social: a.settings.Get().Social, + } + data.FacebookReady = data.Social.FacebookEnabled && strings.TrimSpace(data.Social.FacebookPageID) != "" && strings.TrimSpace(data.Social.FacebookPageToken) != "" && strings.TrimSpace(data.Social.PublicBaseURL) != "" + + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 512<<10) + if err := r.ParseForm(); err != nil { + data.Error = "Eingabe konnte nicht gelesen werden." + a.renderEditorial(w, data) + return + } + if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + if !a.editorial.Enabled() { + data.Error = "PostgreSQL ist nicht aktiv. Führe die vorhandenen Migrationen aus und setze DATABASE_URL." + a.renderEditorial(w, data) + return + } + ctx, cancel := context.WithTimeout(r.Context(), 35*time.Second) + defer cancel() + action := strings.TrimSpace(r.FormValue("action")) + switch action { + case "save_type": + data.ActiveTab = "categories" + order, _ := strconv.Atoi(r.FormValue("sort_order")) + item := EditorialContentType{ + Slug: r.FormValue("type_slug"), + Name: r.FormValue("type_name"), + Description: r.FormValue("type_description"), + HomepageSection: r.FormValue("homepage_section") == "on", + Active: r.FormValue("type_active") == "on", + SortOrder: order, + } + if err := a.editorial.SaveContentType(ctx, item); err != nil { + data.Error = err.Error() + a.renderEditorial(w, data) + return + } + http.Redirect(w, r, "/admin/editorial?tab=categories&category_saved=1", http.StatusSeeOther) + return + case "delete_type": + data.ActiveTab = "categories" + if err := a.editorial.DeleteContentType(ctx, r.FormValue("type_slug")); err != nil { + data.Error = err.Error() + a.renderEditorial(w, data) + return + } + http.Redirect(w, r, "/admin/editorial?tab=categories&category_deleted=1", http.StatusSeeOther) + return + case "delete": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if err := a.editorial.Delete(ctx, id); err != nil { + data.ActiveTab = "contents" + data.Error = err.Error() + a.renderEditorial(w, data) + return + } + http.Redirect(w, r, "/admin/editorial?tab=contents&deleted=1", http.StatusSeeOther) + return + case "publish_facebook": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + entry, found, err := a.editorial.Get(ctx, id) + if err != nil || !found { + http.Redirect(w, r, "/admin/editorial?tab=contents&facebook=missing", http.StatusSeeOther) + return + } + if err := a.publishEditorialFacebook(ctx, entry); err != nil { + http.Redirect(w, r, "/admin/editorial?tab=contents&facebook=failed", http.StatusSeeOther) + return + } + http.Redirect(w, r, "/admin/editorial?tab=contents&facebook=published", http.StatusSeeOther) + return + } + + data.ActiveTab = "create" + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + var previous EditorialEntry + if id > 0 { + if item, found, err := a.editorial.Get(ctx, id); err == nil && found { + previous = item + } + } + entry := EditorialEntry{ + ID: id, + ContentType: r.FormValue("content_type"), + Title: r.FormValue("title"), + Teaser: r.FormValue("teaser"), + Body: r.FormValue("body"), + Location: r.FormValue("location"), + Status: r.FormValue("status"), + AIUsage: r.FormValue("ai_usage"), + AIHumanReviewed: r.FormValue("ai_human_reviewed") == "on", + AIEditorialResponsible: r.FormValue("ai_editorial_responsible"), + AIDisclosure: r.FormValue("ai_disclosure"), + MediaAssetID: parseInt64(r.FormValue("media_asset_id")), + PostToFacebook: r.FormValue("post_to_facebook") == "on", + SendPush: r.FormValue("send_push") == "on", + } + saved, err := a.editorial.SaveAndGet(ctx, entry) + if err != nil { + data.Edit = entry + data.Edit.Slug = slugify(entry.Title) + data.HasEdit = id > 0 + data.Error = err.Error() + a.renderEditorial(w, data) + return + } + + shouldPublishFacebook := saved.Status == "published" && saved.PostToFacebook && + (id == 0 || !previous.PostToFacebook || !strings.HasPrefix(strings.TrimSpace(previous.FacebookStatus), "published")) + if shouldPublishFacebook { + if err := a.publishEditorialFacebook(ctx, saved); err != nil { + http.Redirect(w, r, "/admin/editorial?tab=contents&saved=1&facebook=failed", http.StatusSeeOther) + return + } + http.Redirect(w, r, "/admin/editorial?tab=contents&saved=1&facebook=published", http.StatusSeeOther) + return + } + http.Redirect(w, r, "/admin/editorial?tab=contents&saved=1", http.StatusSeeOther) + return + } + + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.Method == http.MethodHead { + setAdminHTMLHeaders(w) + w.WriteHeader(http.StatusOK) + return + } + if id, _ := strconv.ParseInt(r.URL.Query().Get("edit"), 10, 64); id > 0 && a.editorial.Enabled() { + ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second) + defer cancel() + if item, found, err := a.editorial.Get(ctx, id); err == nil && found { + data.Edit = item + data.HasEdit = true + data.ActiveTab = "create" + } + } + if r.URL.Query().Get("saved") == "1" { + data.Success = "Der redaktionelle Inhalt wurde gespeichert." + } + if r.URL.Query().Get("deleted") == "1" { + data.Success = "Der Inhalt wurde gelöscht." + } + if r.URL.Query().Get("category_saved") == "1" { + data.Success = "Die Kategorie wurde gespeichert." + } + if r.URL.Query().Get("category_deleted") == "1" { + data.Success = "Die Kategorie wurde gelöscht." + } + switch r.URL.Query().Get("facebook") { + case "published": + data.Success = "Der Inhalt wurde gespeichert und erfolgreich auf Facebook veröffentlicht." + case "failed": + data.Error = "Der Inhalt wurde gespeichert, konnte aber nicht auf Facebook veröffentlicht werden. Den genauen Grund findest du beim Inhalt; nach der Korrektur kannst du den Versand dort erneut starten." + case "missing": + data.Error = "Der ausgewählte Inhalt konnte für den Facebook-Versand nicht geladen werden." + } + a.renderEditorial(w, data) +} + +func (a *adminHandler) renderEditorial(w http.ResponseWriter, data adminEditorialData) { + if data.DatabaseReady { + ctx, cancel := context.WithTimeout(context.Background(), 12*time.Second) + defer cancel() + if types, typeErr := a.editorial.ContentTypes(ctx, true); typeErr == nil { + data.Types = types + } else if data.Error == "" { + data.Error = typeErr.Error() + } + if a.media != nil { + if mediaItems, mediaErr := a.media.List(ctx); mediaErr == nil { + data.Media = mediaItems + } + } + items, err := a.editorial.List(ctx) + if err != nil && data.Error == "" { + data.Error = err.Error() + } else { + data.Items = items + } + } + if data.Edit.ContentType == "" { + data.Edit.ContentType = "news" + for _, item := range data.Types { + if item.Active { + data.Edit.ContentType = item.Slug + break + } + } + } + if data.Edit.Status == "" { + data.Edit.Status = "draft" + } + setAdminHTMLHeaders(w) + if err := a.editorialTemplate.ExecuteTemplate(w, "editorial-admin.html", data); err != nil { + a.logger.Printf("admin editorial template: %v", err) + } +} + +func parseInt64(raw string) int64 { v, _ := strconv.ParseInt(strings.TrimSpace(raw), 10, 64); return v } + +func (a *adminHandler) adminMedia(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + page, _ := strconv.Atoi(r.URL.Query().Get("page")) + if page < 1 { + page = 1 + } + data := adminMediaData{Username: session.Username, CSRFToken: session.CSRFToken, DatabaseReady: a.media != nil && a.media.Enabled(), Page: page, PerPage: 24} + if a.media != nil { + data.StorePath = a.media.Dir() + } + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 16<<20) + if err := r.ParseMultipartForm(16 << 20); err != nil { + data.Error = "Upload konnte nicht gelesen werden: " + err.Error() + a.renderMedia(w, data) + return + } + if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + ctx, cancel := context.WithTimeout(r.Context(), 30*time.Second) + defer cancel() + action := strings.TrimSpace(r.FormValue("action")) + if action == "delete" { + if err := a.media.Delete(ctx, parseInt64(r.FormValue("id"))); err != nil { + data.Error = err.Error() + a.renderMedia(w, data) + return + } + http.Redirect(w, r, "/admin/media?deleted=1", http.StatusSeeOther) + return + } + if action == "update" { + if err := a.media.UpdateMetadata(ctx, parseInt64(r.FormValue("id")), r.FormValue("alt_text"), r.FormValue("rights_holder"), r.FormValue("rights_note"), r.FormValue("ai_usage"), r.FormValue("ai_disclosure"), r.FormValue("ai_watermark_enabled") == "on", r.FormValue("ai_watermark_text")); err != nil { + data.Error = err.Error() + a.renderMedia(w, data) + return + } + http.Redirect(w, r, "/admin/media?page="+strconv.Itoa(page)+"&updated=1", http.StatusSeeOther) + return + } + file, header, err := r.FormFile("image") + if err != nil { + data.Error = "Bitte ein Bild auswählen." + a.renderMedia(w, data) + return + } + defer file.Close() + if _, err := a.media.SaveUpload(ctx, file, header, r.FormValue("alt_text"), r.FormValue("rights_holder"), r.FormValue("rights_note"), r.FormValue("ai_usage"), r.FormValue("ai_disclosure"), r.FormValue("ai_watermark_enabled") == "on", r.FormValue("ai_watermark_text")); err != nil { + data.Error = err.Error() + a.renderMedia(w, data) + return + } + http.Redirect(w, r, "/admin/media?uploaded=1", http.StatusSeeOther) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.URL.Query().Get("uploaded") == "1" { + data.Success = "Bild wurde in die Mediengalerie hochgeladen." + } + if r.URL.Query().Get("deleted") == "1" { + data.Success = "Bild wurde gelöscht." + } + if r.URL.Query().Get("updated") == "1" { + data.Success = "Bilddaten und KI-Wasserzeichen wurden aktualisiert." + } + a.renderMedia(w, data) +} +func (a *adminHandler) renderMedia(w http.ResponseWriter, data adminMediaData) { + if data.DatabaseReady { + ctx, cancel := context.WithTimeout(context.Background(), 12*time.Second) + defer cancel() + if data.PerPage == 0 { + data.PerPage = 24 + } + if data.Page < 1 { + data.Page = 1 + } + items, total, err := a.media.ListPage(ctx, data.PerPage, (data.Page-1)*data.PerPage) + if err != nil && data.Error == "" { + data.Error = err.Error() + } else { + data.Items, data.Total = items, total + data.TotalPages = (total + data.PerPage - 1) / data.PerPage + if data.TotalPages < 1 { + data.TotalPages = 1 + } + if data.Page > data.TotalPages { + data.Page = data.TotalPages + } + for n := 1; n <= data.TotalPages; n++ { + if n == 1 || n == data.TotalPages || (n >= data.Page-2 && n <= data.Page+2) { + data.Pages = append(data.Pages, n) + } + } + if data.Page > 1 { + data.PrevURL = "/admin/media?page=" + strconv.Itoa(data.Page-1) + } + if data.Page < data.TotalPages { + data.NextURL = "/admin/media?page=" + strconv.Itoa(data.Page+1) + } + } + } + setAdminHTMLHeaders(w) + if err := a.mediaTemplate.ExecuteTemplate(w, "media-admin.html", data); err != nil { + a.logger.Printf("admin media template: %v", err) + } +} + +func (a *adminHandler) adminWishes(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + page := parsePositiveInt(r.URL.Query().Get("page"), 1) + perPage := parsePositiveInt(r.URL.Query().Get("per_page"), 20) + if perPage != 10 && perPage != 20 && perPage != 50 { + perPage = 20 + } + data := adminWishesData{Username: session.Username, CSRFToken: session.CSRFToken, StorePath: a.wishes.Path(), Page: page, PerPage: perPage, Settings: a.settings.Get()} + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 256<<10) + if err := r.ParseForm(); err != nil { + data.Error = "Eingabe konnte nicht gelesen werden." + a.renderWishes(w, data) + return + } + if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + action, id := r.FormValue("action"), strings.TrimSpace(r.FormValue("id")) + redirect := fmt.Sprintf("/admin/wishes?page=%d&per_page=%d", page, perPage) + switch action { + case "delete": + if err := a.wishes.Delete(id); err != nil { + data.Error = err.Error() + a.renderWishes(w, data) + return + } + http.Redirect(w, r, redirect+"&deleted=1", http.StatusSeeOther) + return + case "save": + old, found := a.wishes.Get(id) + if !found { + data.Error = "Musikwunsch nicht gefunden" + a.renderWishes(w, data) + return + } + old.Name = r.FormValue("name") + old.Place = r.FormValue("place") + old.Artist = r.FormValue("artist") + old.Song = r.FormValue("song") + old.Message = r.FormValue("message") + old.EditorialNote = r.FormValue("editorial_note") + if err := a.wishes.Update(old); err != nil { + data.Error = err.Error() + a.renderWishes(w, data) + return + } + http.Redirect(w, r, redirect+"&saved=1", http.StatusSeeOther) + return + case "post_without_audio": + wish, found := a.wishes.Get(id) + if !found { + data.Error = "Musikwunsch nicht gefunden" + a.renderWishes(w, data) + return + } + wish.Name = r.FormValue("name") + wish.Place = r.FormValue("place") + wish.Artist = r.FormValue("artist") + wish.Song = r.FormValue("song") + wish.Message = r.FormValue("message") + wish.EditorialNote = r.FormValue("editorial_note") + if err := a.wishes.Update(wish); err != nil { + data.Error = err.Error() + a.renderWishes(w, data) + return + } + if err := a.wishes.Moderate(id, "approved", wish.EditorialNote); err != nil { + data.Error = err.Error() + a.renderWishes(w, data) + return + } + http.Redirect(w, r, redirect+"&posted=1", http.StatusSeeOther) + return + case "approve", "status": + status := r.FormValue("status") + if action == "approve" { + status = "approved" + } + if err := a.wishes.Moderate(id, status, r.FormValue("editorial_note")); err != nil { + data.Error = err.Error() + a.renderWishes(w, data) + return + } + wishSettings := a.settings.Get().WishAutomation + if status == "approved" && a.wishAutomation != nil && wishSettings.Enabled && wishSettings.AutoProcessOnApprove { + wish, _ := a.wishes.Get(id) + ctx, cancel := context.WithTimeout(r.Context(), 3*time.Minute) + defer cancel() + if _, err := a.wishAutomation.Process(ctx, wish); err != nil { + data.Error = "Freigegeben, aber Automatik fehlgeschlagen: " + err.Error() + a.renderWishes(w, data) + return + } + } + http.Redirect(w, r, redirect+"&approved=1", http.StatusSeeOther) + return + case "process": + wish, found := a.wishes.Get(id) + if !found { + data.Error = "Musikwunsch nicht gefunden" + a.renderWishes(w, data) + return + } + ctx, cancel := context.WithTimeout(r.Context(), 3*time.Minute) + defer cancel() + if _, err := a.wishAutomation.ProcessManual(ctx, wish); err != nil { + data.Error = err.Error() + a.renderWishes(w, data) + return + } + http.Redirect(w, r, redirect+"&processed=1", http.StatusSeeOther) + return + default: + data.Error = "Unbekannte Aktion" + a.renderWishes(w, data) + return + } + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.Method == http.MethodHead { + setAdminHTMLHeaders(w) + w.WriteHeader(http.StatusOK) + return + } + if r.URL.Query().Get("saved") == "1" { + data.Success = "Musikwunsch wurde gespeichert." + } + if r.URL.Query().Get("deleted") == "1" { + data.Success = "Musikwunsch wurde gelöscht." + } + if r.URL.Query().Get("approved") == "1" { + data.Success = "Musikwunsch wurde freigegeben und die Automation ausgeführt." + } + if r.URL.Query().Get("processed") == "1" { + data.Success = "KI-Text, MP3 und FTP-Auslieferung wurden abgeschlossen." + } + if r.URL.Query().Get("posted") == "1" { + data.Success = "Musikwunsch wurde freigegeben – ohne KI-Text, ElevenLabs, MP3 oder FTP-Produktion." + } + a.renderWishes(w, data) +} +func (a *adminHandler) renderWishes(w http.ResponseWriter, data adminWishesData) { + items, total := a.wishes.AdminPage(data.Page, data.PerPage) + data.Items = items + data.Total = total + data.TotalPages = maxWishInt(1, (total+data.PerPage-1)/data.PerPage) + data.Pages = make([]int, data.TotalPages) + for i := range data.Pages { + data.Pages[i] = i + 1 + } + data.HasPrev = data.Page > 1 + data.HasNext = data.Page < data.TotalPages + if data.HasPrev { + data.PrevURL = fmt.Sprintf("/admin/wishes?page=%d&per_page=%d", data.Page-1, data.PerPage) + } + if data.HasNext { + data.NextURL = fmt.Sprintf("/admin/wishes?page=%d&per_page=%d", data.Page+1, data.PerPage) + } + setAdminHTMLHeaders(w) + if err := a.wishesTemplate.ExecuteTemplate(w, "wishes-admin.html", data); err != nil { + a.logger.Printf("admin wishes template: %v", err) + } +} + +func (a *adminHandler) enrichDashboard(ctx context.Context, data *adminDashboardData) { + var ms runtime.MemStats + runtime.ReadMemStats(&ms) + data.GoVersion = runtime.Version() + data.GoOS = runtime.GOOS + data.GoArch = runtime.GOARCH + data.GoRoutines = runtime.NumGoroutine() + data.MemoryMB = ms.Alloc / 1024 / 1024 + + cfg := data.RuntimeSettings + if cfg.FTP.Enabled { + address := net.JoinHostPort(cfg.FTP.Host, strconv.Itoa(cfg.FTP.Port)) + conn, err := net.DialTimeout("tcp", address, 3*time.Second) + if err == nil { + _ = conn.Close() + data.FTPStatus = "Erreichbar" + } else { + data.FTPStatus = "Nicht erreichbar" + } + } else { + data.FTPStatus = "Deaktiviert" + } + + ctxAI, cancelAI := context.WithTimeout(ctx, 7*time.Second) + defer cancelAI() + if models, err := a.ai.ListOpenAIModels(ctxAI); err == nil { + data.OpenAIStatus = "Verbunden" + data.OpenAIModels = len(models) + } else if cfg.OpenAI.Enabled { + data.OpenAIStatus = "Fehler" + } else { + data.OpenAIStatus = "Deaktiviert" + } + ctxEL, cancelEL := context.WithTimeout(ctx, 7*time.Second) + defer cancelEL() + el := a.ai.ElevenLabsStatus(ctxEL) + data.ElevenStatus = el.Message + data.ElevenUsed = el.CreditsUsed + data.ElevenLimit = el.CreditsLimit + + if a.firebasePush != nil { + data.FirebaseStatus = a.firebasePush.Status() + if a.firebasePush.Ready() { + data.FirebaseProject = "Serverseitig initialisiert" + } + } else { + data.FirebaseStatus = "Nicht initialisiert" + } + + if a.database != nil && a.database.Enabled() { + qctx, cancel := context.WithTimeout(ctx, 5*time.Second) + defer cancel() + var rows []dashboardDBStats + sql := `SELECT json_agg(row_to_json(x)) FROM (SELECT + (SELECT count(*)::int FROM app_installations WHERE status='active') AS "Installations", + (SELECT count(*)::int FROM app_installations WHERE status='active' AND notifications_enabled) AS "PushEnabled", + (SELECT coalesce(sum(sent_count),0)::int FROM push_campaigns) AS "PushAccepted", + (SELECT coalesce(sum(opened_count),0)::int FROM push_campaigns) AS "PushOpened", + (SELECT count(*)::int FROM users WHERE role='administrator' AND active=true) AS "AdminUsers", + (SELECT count(*)::int FROM users WHERE active=true) AS "NormalUsers", + (SELECT coalesce(max(app_version),'–') FROM app_installations WHERE platform='android') AS "LatestAndroidVersion") x;` + if err := a.database.queryJSON(qctx, sql, &rows); err == nil && len(rows) > 0 { + data.DBStats = rows[0] + } + } +} + +func adminHasPermission(session adminSession, permission string) bool { + return session.Permissions["*"] || session.Permissions[permission] +} + +func requireAdminPermission(w http.ResponseWriter, session adminSession, permission string) bool { + if adminHasPermission(session, permission) { + return true + } + http.Error(w, "Für diesen Bereich fehlen die erforderlichen Rechte.", http.StatusForbidden) + return false +} + +func (a *adminHandler) environmentAdminMatches(search, role, status string) bool { + if strings.TrimSpace(role) != "" && strings.TrimSpace(role) != "administrator" { + return false + } + if strings.TrimSpace(status) != "" && strings.TrimSpace(status) != "active" { + return false + } + search = strings.ToLower(strings.TrimSpace(search)) + if search == "" { + return true + } + haystack := strings.ToLower(strings.Join([]string{a.username, "Systemadministrator", envOr("LANDWELLE_ADMIN_EMAIL", "radio@landwelle.de"), "Notfallkonto"}, " ")) + return strings.Contains(haystack, search) +} + +func (a *adminHandler) adminUsers(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if !requireAdminPermission(w, session, "users.manage") { + return + } + group, basePath, title, description := "admins", "/admin/users/admins", "Administratoren", "Verwalte Administratoren, Redaktion, Autoren und Moderatoren mit ihren Rollen und Zugriffsrechten." + if strings.HasPrefix(r.URL.Path, "/admin/users/members") { + group = "members" + basePath = "/admin/users/members" + title = "Normale Benutzer" + description = "Verwalte Benutzerkonten für das kommende Forum, die App und weitere Community-Funktionen." + } + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 128<<10) + if err := r.ParseForm(); err != nil || subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + action := strings.TrimSpace(r.FormValue("action")) + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if session.UserID > 0 && id == session.UserID && (action == "deactivate" || action == "lock" || action == "delete") { + a.renderUsers(w, r, session, group, basePath, title, description, "Das aktuell angemeldete Konto kann nicht gesperrt, deaktiviert oder gelöscht werden.", "") + return + } + ctx, cancel := context.WithTimeout(r.Context(), 12*time.Second) + defer cancel() + var err error + switch action { + case "save": + u := ManagedUser{ID: id, Username: r.FormValue("username"), Email: r.FormValue("email"), DisplayName: r.FormValue("display_name"), FirstName: r.FormValue("first_name"), LastName: r.FormValue("last_name"), Phone: r.FormValue("phone"), Role: r.FormValue("role"), Active: r.FormValue("active") == "on", EmailVerified: r.FormValue("email_verified") == "on", PasswordResetRequired: r.FormValue("password_reset_required") == "on", Notes: r.FormValue("notes")} + err = a.users.Upsert(ctx, u, r.FormValue("password"), session.Username) + case "reset_password": + err = a.users.ResetPassword(ctx, id, r.FormValue("password"), session.Username) + case "activate", "deactivate", "lock", "unlock", "verify", "delete": + err = a.users.Action(ctx, id, action, session.Username) + default: + err = errors.New("unbekannte Benutzeraktion") + } + if err != nil { + a.renderUsers(w, r, session, group, basePath, title, description, err.Error(), "") + return + } + http.Redirect(w, r, basePath+"?saved=1", http.StatusSeeOther) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.Method == http.MethodHead { + setAdminHTMLHeaders(w) + w.WriteHeader(http.StatusOK) + return + } + a.renderUsers(w, r, session, group, basePath, title, description, "", map[bool]string{true: "Änderung wurde gespeichert."}[r.URL.Query().Get("saved") == "1"]) +} + +func (a *adminHandler) renderUsers(w http.ResponseWriter, r *http.Request, session adminSession, group, basePath, title, description, errorMessage, success string) { + data := adminUsersData{Username: session.Username, CSRFToken: session.CSRFToken, Navigation: template.HTML(adminNavigationHTML()), Title: title, Description: description, BasePath: basePath, Group: group, DatabaseReady: a.users != nil && a.users.Enabled(), Error: errorMessage, Success: success, Page: 1, PerPage: 20} + if !data.DatabaseReady { + setAdminHTMLHeaders(w) + _ = a.usersTemplate.ExecuteTemplate(w, "users-admin.html", data) + return + } + q := r.URL.Query() + data.Search = q.Get("q") + data.RoleFilter = q.Get("role") + data.StatusFilter = q.Get("status") + if v, _ := strconv.Atoi(q.Get("page")); v > 0 { + data.Page = v + } + if v, _ := strconv.Atoi(q.Get("per_page")); v == 10 || v == 20 || v == 50 { + data.PerPage = v + } + ctx, cancel := context.WithTimeout(r.Context(), 12*time.Second) + defer cancel() + roles, err := a.users.Roles(ctx) + if err != nil && data.Error == "" { + data.Error = err.Error() + } + data.Roles = roles + result, err := a.users.List(ctx, group, data.Search, data.RoleFilter, data.StatusFilter, data.Page, data.PerPage) + if err != nil { + data.Error = err.Error() + } else { + data.Items = result.Items + data.Total = result.Total + if group == "admins" && data.Page == 1 && a.environmentAdminMatches(data.Search, data.RoleFilter, data.StatusFilter) { + now := time.Now() + envUser := ManagedUser{ + ID: 0, Username: a.username, Email: envOr("LANDWELLE_ADMIN_EMAIL", "radio@landwelle.de"), + DisplayName: "Systemadministrator", Role: "administrator", RoleName: "Administrator", + Active: true, EmailVerified: true, LastSeenAt: &now, CreatedAt: now, UpdatedAt: now, + Notes: "Geschütztes Notfallkonto aus /etc/landwelle/landwelle.env", EnvironmentAdmin: true, + } + data.Items = append([]ManagedUser{envUser}, data.Items...) + data.Total++ + } + } + for _, item := range data.Items { + if item.Active { + data.ActiveCount++ + } + if item.LockedUntil != nil && item.LockedUntil.After(time.Now()) { + data.LockedCount++ + } + if !item.EmailVerified { + data.UnverifiedCount++ + } + } + data.TotalPages = (data.Total + data.PerPage - 1) / data.PerPage + if data.TotalPages < 1 { + data.TotalPages = 1 + } + if data.Page > data.TotalPages { + data.Page = data.TotalPages + } + data.HasPrev = data.Page > 1 + data.HasNext = data.Page < data.TotalPages + pageURL := func(page int) string { + v := url.Values{} + if data.Search != "" { + v.Set("q", data.Search) + } + if data.RoleFilter != "" { + v.Set("role", data.RoleFilter) + } + if data.StatusFilter != "" { + v.Set("status", data.StatusFilter) + } + v.Set("per_page", strconv.Itoa(data.PerPage)) + v.Set("page", strconv.Itoa(page)) + return basePath + "?" + v.Encode() + } + if data.HasPrev { + data.PrevURL = pageURL(data.Page - 1) + } + if data.HasNext { + data.NextURL = pageURL(data.Page + 1) + } + if id, _ := strconv.ParseInt(q.Get("edit"), 10, 64); id > 0 { + if item, e := a.users.Get(ctx, id); e == nil { + data.Edit = item + } else if data.Error == "" { + data.Error = e.Error() + } + } + if data.Edit.ID == 0 { + data.Edit = ManagedUser{Role: map[bool]string{true: "member", false: "editor"}[group == "members"], Active: true} + } + setAdminHTMLHeaders(w) + if err := a.usersTemplate.ExecuteTemplate(w, "users-admin.html", data); err != nil { + a.logger.Printf("admin users template: %v", err) + } +} + +func (a *adminHandler) adminRoles(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if !requireAdminPermission(w, session, "roles.manage") { + return + } + data := adminRolesData{Username: session.Username, CSRFToken: session.CSRFToken, Navigation: template.HTML(adminNavigationHTML()), DatabaseReady: a.users != nil && a.users.Enabled()} + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 256<<10) + if err := r.ParseForm(); err != nil || subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + role := UserRole{Slug: r.FormValue("slug"), Name: r.FormValue("name"), Description: r.FormValue("description"), Active: r.FormValue("active") == "on"} + role.SortOrder, _ = strconv.Atoi(r.FormValue("sort_order")) + ctx, cancel := context.WithTimeout(r.Context(), 12*time.Second) + defer cancel() + if err := a.users.SaveRole(ctx, role, r.Form["permissions"], session.Username); err != nil { + data.Error = err.Error() + } else { + http.Redirect(w, r, "/admin/users/roles?saved=1", http.StatusSeeOther) + return + } + } else if r.Method != http.MethodGet && r.Method != http.MethodHead { + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.Method == http.MethodHead { + setAdminHTMLHeaders(w) + w.WriteHeader(http.StatusOK) + return + } + if r.URL.Query().Get("saved") == "1" { + data.Success = "Rolle und Berechtigungen wurden gespeichert." + } + if data.DatabaseReady { + ctx, cancel := context.WithTimeout(r.Context(), 12*time.Second) + defer cancel() + roles, err := a.users.Roles(ctx) + if err != nil { + data.Error = err.Error() + } else { + data.Roles = roles + } + } + setAdminHTMLHeaders(w) + if err := a.rolesTemplate.ExecuteTemplate(w, "roles-admin.html", data); err != nil { + a.logger.Printf("admin roles template: %v", err) + } +} + +func (a *adminHandler) adminPlaceholder(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.Method == http.MethodHead { + w.WriteHeader(http.StatusOK) + return + } + title := "Bereich in Vorbereitung" + switch { + case strings.Contains(r.URL.Path, "forum/categories"): + title = "Forum-Kategorien" + case strings.Contains(r.URL.Path, "forum/topics"): + title = "Forum-Themen" + case strings.Contains(r.URL.Path, "forum/reports"): + title = "Forum-Moderation" + case strings.Contains(r.URL.Path, "/forum"): + title = "Forum-Übersicht" + case strings.Contains(r.URL.Path, "users/admins"): + title = "Administratoren" + case strings.Contains(r.URL.Path, "users/members"): + title = "Normale Benutzer" + case strings.Contains(r.URL.Path, "users/roles"): + title = "Rollen & Rechte" + } + setAdminHTMLHeaders(w) + fmt.Fprintf(w, `%s – Landwelle
Landwelle RadioVerwaltung
%s
Vorbereitung

%s

Die Navigation und technische Grundlage sind bereits angelegt. Die fachlichen Funktionen werden in einem späteren Entwicklungsschritt ergänzt.

Geplanter Bereich

Dieser Menüpunkt ist bewusst sichtbar, damit die künftige Struktur des Landwelle-Forums und der Benutzerverwaltung bereits feststeht.

`, template.HTMLEscapeString(title), adminNavigationHTML(), template.HTMLEscapeString(session.Username), template.HTMLEscapeString(title)) +} + +func adminNavigationHTML() string { + return `` +} + +func (a *adminHandler) adminTeam(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + data := map[string]any{"Username": session.Username, "CSRFToken": session.CSRFToken, "Navigation": template.HTML(adminNavigationHTML())} + if r.Method == http.MethodPost { + if err := r.ParseForm(); err != nil { + data["Error"] = "Formular konnte nicht gelesen werden" + } else if r.FormValue("csrf_token") != session.CSRFToken { + data["Error"] = "Ungültige Sicherheitsprüfung" + } else { + switch r.FormValue("action") { + case "delete": + if err := a.team.Delete(r.Context(), r.FormValue("id")); err != nil { + data["Error"] = err.Error() + } else { + data["Success"] = "Teammitglied wurde gelöscht." + } + default: + order, _ := strconv.Atoi(r.FormValue("sort_order")) + err := a.team.Save(r.Context(), strings.TrimSpace(r.FormValue("id")), strings.TrimSpace(r.FormValue("name")), strings.TrimSpace(r.FormValue("role")), strings.TrimSpace(r.FormValue("image")), strings.TrimSpace(r.FormValue("bio")), strings.TrimSpace(r.FormValue("region")), strings.TrimSpace(r.FormValue("task")), strings.TrimSpace(r.FormValue("at_landwelle")), order, r.FormValue("active") == "on", r.FormValue("is_ai") == "on", strings.TrimSpace(r.FormValue("ai_disclosure"))) + if err != nil { + data["Error"] = err.Error() + } else { + data["Success"] = "Teammitglied wurde gespeichert." + } + } + } + } + items, err := a.team.List(r.Context(), true) + if err != nil { + data["Error"] = "Bitte zuerst Migration 0009 ausführen: " + err.Error() + } + activeCount := 0 + aiCount := 0 + for _, item := range items { + if item.Active { + activeCount++ + } + if item.IsAI { + aiCount++ + } + } + data["Items"] = items + data["ActiveCount"] = activeCount + data["InactiveCount"] = len(items) - activeCount + data["AICount"] = aiCount + if a.media != nil && a.media.Enabled() { + ctx, cancel := context.WithTimeout(r.Context(), 8*time.Second) + defer cancel() + if mediaItems, _, mediaErr := a.media.ListPage(ctx, 100, 0); mediaErr == nil { + data["Media"] = mediaItems + } + } + setAdminHTMLHeaders(w) + if err := a.teamTemplate.ExecuteTemplate(w, "admin-team.html", data); err != nil { + a.logger.Printf("team admin template: %v", err) + } +} + +func (a *adminHandler) adminForum(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + mode := "overview" + title := "Forum-Übersicht" + switch r.URL.Path { + case "/admin/forum/categories": + mode = "categories" + title = "Forum-Kategorien" + case "/admin/forum/topics": + mode = "topics" + title = "Themen & Beiträge" + case "/admin/forum/reports": + mode = "reports" + title = "Meldungen & Moderation" + } + query := strings.ToLower(strings.TrimSpace(r.URL.Query().Get("q"))) + statusFilter := strings.ToLower(strings.TrimSpace(r.URL.Query().Get("status"))) + data := map[string]any{"Username": session.Username, "CSRFToken": session.CSRFToken, "Navigation": template.HTML(adminNavigationHTML()), "Mode": mode, "Title": title, "Query": r.URL.Query().Get("q"), "StatusFilter": statusFilter} + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 128<<10) + _ = r.ParseForm() + if r.FormValue("csrf_token") != session.CSRFToken { + data["Error"] = "Ungültige Sicherheitsprüfung" + } else if r.FormValue("action") == "save_category" { + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + order, _ := strconv.Atoi(r.FormValue("sort_order")) + err := a.forum.SaveCategory(r.Context(), id, r.FormValue("name"), r.FormValue("description"), r.FormValue("icon"), order, r.FormValue("active") == "on", r.FormValue("members_only") == "on") + if err != nil { + data["Error"] = err.Error() + } else { + data["Success"] = "Kategorie wurde gespeichert." + } + } else { + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + action := strings.TrimSpace(r.FormValue("action")) + if err := a.forum.TopicAction(r.Context(), id, action); err != nil { + data["Error"] = err.Error() + } else { + a.audit(r.Context(), session, r, "forum.topic."+action, "forum_topic", id, "Forumthema aktualisiert", true) + data["Success"] = "Thema wurde aktualisiert." + } + } + } + cats, e1 := a.forum.Categories(r.Context(), true) + allTopics, e2 := a.forum.Topics(r.Context(), "", true) + reports, e3 := a.forum.Reports(r.Context()) + if e1 != nil || e2 != nil || e3 != nil { + data["Error"] = "Forumdaten konnten nicht geladen werden. Bitte prüfe PostgreSQL und die Migrationen." + } + published, locked, hidden, pinned, replies := 0, 0, 0, 0, 0 + for _, topic := range allTopics { + switch topic.Status { + case "published": + published++ + case "locked": + locked++ + default: + hidden++ + } + if topic.Pinned { + pinned++ + } + replies += topic.ReplyCount + } + filtered := make([]ForumTopic, 0, len(allTopics)) + for _, topic := range allTopics { + if query != "" && !strings.Contains(strings.ToLower(topic.Title+" "+topic.AuthorName+" "+topic.CategoryName), query) { + continue + } + matches := true + switch statusFilter { + case "published": + matches = topic.Status == "published" + case "locked": + matches = topic.Status == "locked" + case "hidden": + matches = topic.Status != "published" && topic.Status != "locked" + case "pinned": + matches = topic.Pinned + } + if matches { + filtered = append(filtered, topic) + } + } + if mode == "overview" && len(filtered) > 10 { + filtered = filtered[:10] + } + data["Categories"] = cats + if editID, _ := strconv.ParseInt(r.URL.Query().Get("edit"), 10, 64); editID > 0 { + for _, category := range cats { + if category.ID == editID { + data["EditCategory"] = category + break + } + } + } + data["Topics"] = filtered + data["TopicTotal"] = len(allTopics) + data["PublishedCount"] = published + data["LockedCount"] = locked + data["HiddenCount"] = hidden + data["PinnedCount"] = pinned + data["ReplyTotal"] = replies + data["Reports"] = reports + data["OpenReports"] = len(reports) + setAdminHTMLHeaders(w) + if err := a.forumTemplate.ExecuteTemplate(w, "admin-forum.html", data); err != nil { + a.logger.Printf("forum admin template: %v", err) + } +} + +func (a *adminHandler) adminNewsStudio(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + // Die Statusabfrage nutzt bewusst denselben, bereits durch den Reverse-Proxy + // freigegebenen Pfad wie das Nachrichtenstudio. Einige KeyHelp-/Apache-Regeln + // leiten zwar /admin/ai/news weiter, nicht aber zusätzliche Unterpfade. + // Dadurch bleibt das Polling auch bei engen Proxy-Regeln zuverlässig erreichbar. + if r.Method == http.MethodGet { + if _, requested := r.URL.Query()["job_status"]; requested { + a.writeAdminNewsJobStatus(w, strings.TrimSpace(r.URL.Query().Get("job_status"))) + return + } + } + cfg, history := a.newsStudio.Get() + active := strings.ToLower(strings.TrimSpace(r.FormValue("channel"))) + if active == "" { + active = strings.ToLower(strings.TrimSpace(r.URL.Query().Get("tab"))) + } + if _, ok := cfg.Channels[active]; !ok { + active = "news" + } + data := adminNewsStudioData{Username: session.Username, CSRFToken: session.CSRFToken, Settings: cfg, Active: active, History: history} + runtimeCfg := a.settings.Get() + data.OpenAIReady = runtimeCfg.OpenAI.Enabled && strings.TrimSpace(runtimeCfg.OpenAI.APIKey) != "" + data.ElevenReady = runtimeCfg.ElevenLabs.Enabled && strings.TrimSpace(runtimeCfg.ElevenLabs.APIKey) != "" + data.FTPReady = runtimeCfg.FTP.Enabled + data.Voices = runtimeCfg.ElevenLabs.Voices + data.Backgrounds = runtimeCfg.AudioBackgrounds + order := []string{"news", "sport", "weather"} + for _, k := range order { + data.Channels = append(data.Channels, cfg.Channels[k]) + } + render := func() { + setAdminHTMLHeaders(w) + if err := a.newsStudioTemplate.ExecuteTemplate(w, "news-studio-admin.html", data); err != nil { + a.logger.Printf("news studio template: %v", err) + } + } + if r.Method == http.MethodHead { + setAdminHTMLHeaders(w) + w.WriteHeader(http.StatusOK) + return + } + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 512<<10) + if err := r.ParseForm(); err != nil { + if wantsJSONRequest(r) { + writeAdminJSONError(w, http.StatusBadRequest, "Eingabe konnte nicht gelesen werden.") + return + } + data.Error = "Eingabe konnte nicht gelesen werden." + render() + return + } + if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + action := strings.TrimSpace(r.FormValue("action")) + if action == "" { + action = strings.TrimSpace(r.FormValue("action_submit")) + } + // Fallback for older cached JavaScript: infer the intended operation when + // the clicked submit button was disabled before form serialization. + if action == "" { + if strings.TrimSpace(r.FormValue("briefing")) != "" { + action = "produce" + } else { + action = "save" + } + } + if action == "delete_production" { + if err := a.newsStudio.DeleteProduction(strings.TrimSpace(r.FormValue("delete_production_id"))); err != nil { + data.Error = err.Error() + render() + return + } + http.Redirect(w, r, "/admin/ai/news?tab="+active+"&saved=1", http.StatusSeeOther) + return + } + if action == "clear_history" { + if err := a.newsStudio.ClearProductions(); err != nil { + data.Error = err.Error() + render() + return + } + http.Redirect(w, r, "/admin/ai/news?tab="+active+"&saved=1", http.StatusSeeOther) + return + } + switch action { + case "save": + cfg.Model = strings.TrimSpace(r.FormValue("model")) + cfg.Temperature, _ = strconv.ParseFloat(strings.ReplaceAll(r.FormValue("temperature"), ",", "."), 64) + for _, k := range order { + c := cfg.Channels[k] + c.Prompt = r.FormValue(k + "_prompt") + c.VoiceID = strings.TrimSpace(r.FormValue(k + "_voice_id")) + c.BackgroundID = strings.TrimSpace(r.FormValue(k + "_background_id")) + c.DisableAIDisclosure = r.FormValue(k+"_ai_disclosure_enabled") != "on" + c.TTSVolume, _ = strconv.ParseFloat(r.FormValue(k+"_tts_gain_db"), 64) + c.BackgroundVolume, _ = strconv.ParseFloat(r.FormValue(k+"_background_gain_db"), 64) + outputCount := 1 + if k == "news" { + outputCount = 3 + } + c.Outputs = make([]NewsStudioOutput, 0, outputCount) + for i := 1; i <= outputCount; i++ { + c.Outputs = append(c.Outputs, NewsStudioOutput{Number: i, TargetPath: strings.TrimSpace(r.FormValue(fmt.Sprintf("%s_output_%d_path", k, i))), FileName: strings.TrimSpace(r.FormValue(fmt.Sprintf("%s_output_%d_filename", k, i)))}) + } + cfg.Channels[k] = c + } + if err := a.newsStudio.Save(cfg); err != nil { + data.Error = err.Error() + data.Settings = cfg + render() + return + } + http.Redirect(w, r, "/admin/ai/news?tab="+active+"&saved=1", http.StatusSeeOther) + return + case "produce", "produce_stream": + // Save current configuration before producing. + cfg.Model = strings.TrimSpace(r.FormValue("model")) + cfg.Temperature, _ = strconv.ParseFloat(strings.ReplaceAll(r.FormValue("temperature"), ",", "."), 64) + for _, k := range order { + c := cfg.Channels[k] + c.Prompt = r.FormValue(k + "_prompt") + c.VoiceID = strings.TrimSpace(r.FormValue(k + "_voice_id")) + c.BackgroundID = strings.TrimSpace(r.FormValue(k + "_background_id")) + c.DisableAIDisclosure = r.FormValue(k+"_ai_disclosure_enabled") != "on" + c.TTSVolume, _ = strconv.ParseFloat(r.FormValue(k+"_tts_gain_db"), 64) + c.BackgroundVolume, _ = strconv.ParseFloat(r.FormValue(k+"_background_gain_db"), 64) + outputCount := 1 + if k == "news" { + outputCount = 3 + } + c.Outputs = make([]NewsStudioOutput, 0, outputCount) + for i := 1; i <= outputCount; i++ { + c.Outputs = append(c.Outputs, NewsStudioOutput{Number: i, TargetPath: strings.TrimSpace(r.FormValue(fmt.Sprintf("%s_output_%d_path", k, i))), FileName: strings.TrimSpace(r.FormValue(fmt.Sprintf("%s_output_%d_filename", k, i)))}) + } + cfg.Channels[k] = c + } + if err := a.newsStudio.Save(cfg); err != nil { + if action == "produce_stream" { + job := a.aiJobs.New(active) + a.aiJobs.Finish(job.ID, err) + a.streamAIJobHTML(w, r, job.ID) + return + } + if wantsJSONRequest(r) { + writeAdminJSONError(w, http.StatusInternalServerError, err.Error()) + return + } + data.Error = err.Error() + render() + return + } + c := cfg.Channels[active] + if strings.TrimSpace(c.VoiceID) == "" { + message := "Für " + c.Label + " muss eine ElevenLabs Voice-ID eingetragen werden." + if action == "produce_stream" { + job := a.aiJobs.New(active) + a.aiJobs.Finish(job.ID, errors.New(message)) + a.streamAIJobHTML(w, r, job.ID) + return + } + if wantsJSONRequest(r) { + writeAdminJSONError(w, http.StatusBadRequest, message) + return + } + data.Error = message + data.Settings = cfg + render() + return + } + // Die vollständige OpenAI/ElevenLabs/FTP-Kette kann mehrere Minuten dauern. + // Sie läuft deshalb außerhalb des HTTP-Requests, damit Apache/KeyHelp + // nicht nach erfolgreichem Upload mit einem Gateway-Fehler abbricht. + jobCfg := cfg + jobChannel := active + jobBriefing := strings.TrimSpace(r.FormValue("briefing")) + job := a.aiJobs.New(jobChannel) + go func() { + ctx, cancel := context.WithTimeout(context.Background(), 12*time.Minute) + defer cancel() + _, err := a.produceNewsStudioTracked(ctx, jobCfg, jobChannel, jobBriefing, job.ID) + a.aiJobs.Finish(job.ID, err) + if err != nil { + a.logger.Printf("news studio production (%s): %v", jobChannel, err) + } + }() + if action == "produce_stream" { + a.streamAIJobHTML(w, r, job.ID) + return + } + if strings.Contains(r.Header.Get("Accept"), "application/json") || r.Header.Get("X-Requested-With") == "XMLHttpRequest" { + writeJSONResponse(w, map[string]any{"job_id": job.ID, "status": "running"}) + return + } + http.Redirect(w, r, "/admin/ai/news?tab="+active+"&job="+job.ID, http.StatusSeeOther) + return + default: + data.Error = "Unbekannte Aktion" + render() + return + } + } + if r.Method != http.MethodGet { + w.Header().Set("Allow", "GET, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.URL.Query().Get("saved") == "1" { + data.Success = "Einstellungen wurden gespeichert." + } + if r.URL.Query().Get("started") == "1" { + data.Success = "Produktion wurde gestartet. Die Seite kann geschlossen werden; Ergebnisse erscheinen nach Abschluss in der Historie." + } + if r.URL.Query().Get("produced") == "1" { + data.Success = "Drei Texte, drei MP3-Dateien und alle FTP-Uploads wurden erfolgreich abgeschlossen." + } + render() +} + +func (a *adminHandler) adminSettingsImportEvents(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if r.Method != http.MethodPost { + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + _ = r.ParseForm() + if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + if a.destinationOne == nil { + a.renderSettings(w, session, adminSettingsData{Settings: a.settings.Get(), Error: "destination.one ist nicht verfügbar."}) + return + } + ctx, cancel := context.WithTimeout(r.Context(), 2*time.Minute) + defer cancel() + n, err := a.destinationOne.Sync(ctx) + if err != nil { + a.renderSettings(w, session, adminSettingsData{Settings: a.settings.Get(), Error: "Import fehlgeschlagen: " + err.Error()}) + return + } + a.renderSettings(w, session, adminSettingsData{Settings: a.settings.Get(), Success: fmt.Sprintf("Import abgeschlossen: %d Veranstaltungen verarbeitet.", n)}) +} + +func (a *adminHandler) adminBackgroundMusic(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if r.Method != http.MethodPost { + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + r.Body = http.MaxBytesReader(w, r.Body, 50<<20) + if err := r.ParseMultipartForm(50 << 20); err != nil { + http.Error(w, "Upload konnte nicht gelesen werden", http.StatusBadRequest) + return + } + if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + cfg := a.settings.Get() + action := r.FormValue("action") + if action == "" { + action = r.URL.Query().Get("action") + } + if action == "delete" { + id := r.FormValue("id") + var keep []AudioBackgroundTrack + for _, b := range cfg.AudioBackgrounds { + if b.ID == id { + _ = os.Remove(b.Path) + } else { + keep = append(keep, b) + } + } + cfg.AudioBackgrounds = keep + if err := a.settings.Save(cfg); err != nil { + http.Error(w, err.Error(), 500) + return + } + http.Redirect(w, r, "/admin/settings#ki", 303) + return + } + file, h, err := r.FormFile("background_file") + if err != nil { + http.Error(w, "Bitte eine MP3-, WAV- oder M4A-Datei auswählen.", 400) + return + } + defer file.Close() + ext := strings.ToLower(filepath.Ext(h.Filename)) + if ext != ".mp3" && ext != ".wav" && ext != ".m4a" && ext != ".aac" { + http.Error(w, "Nicht unterstütztes Audioformat", 400) + return + } + idBytes := make([]byte, 12) + if _, err = rand.Read(idBytes); err != nil { + http.Error(w, err.Error(), 500) + return + } + id := hex.EncodeToString(idBytes) + dir := filepath.Join(envOr("LANDWELLE_STATE_DIR", "/var/lib/landwelle"), "background-music") + if err = os.MkdirAll(dir, 0750); err != nil { + http.Error(w, err.Error(), 500) + return + } + target := filepath.Join(dir, id+ext) + out, err := os.OpenFile(target, os.O_CREATE|os.O_WRONLY|os.O_EXCL, 0640) + if err != nil { + http.Error(w, err.Error(), 500) + return + } + _, copyErr := io.Copy(out, file) + closeErr := out.Close() + if copyErr != nil || closeErr != nil { + _ = os.Remove(target) + http.Error(w, "Datei konnte nicht gespeichert werden", 500) + return + } + label := strings.TrimSpace(r.FormValue("background_label")) + if label == "" { + label = strings.TrimSuffix(filepath.Base(h.Filename), ext) + } + cfg.AudioBackgrounds = append(cfg.AudioBackgrounds, AudioBackgroundTrack{ID: id, Label: label, FileName: h.Filename, Path: target}) + if err = a.settings.Save(cfg); err != nil { + _ = os.Remove(target) + http.Error(w, err.Error(), 500) + return + } + http.Redirect(w, r, "/admin/settings#ki", 303) +} + +func (a *adminHandler) adminNewsJobStatus(w http.ResponseWriter, r *http.Request) { + id := strings.TrimPrefix(r.URL.Path, "/admin/ai/news/job/") + a.writeAdminNewsJobStatus(w, strings.TrimSpace(id)) +} + +func (a *adminHandler) writeAdminNewsJobStatus(w http.ResponseWriter, id string) { + if id == "" { + writeAdminJSONError(w, http.StatusBadRequest, "Job-ID fehlt.") + return + } + job, ok := a.aiJobs.Get(id) + if !ok { + writeAdminJSONError(w, http.StatusNotFound, "Der Produktionsauftrag wurde nicht gefunden oder der Server wurde neu gestartet.") + return + } + writeJSONResponse(w, job) +} + +type adminAutoTasksData struct { + Username string + CSRFToken string + Tasks []AIAutoTask + Cron AICronAdminStatus + Error string + Success string +} + +func (a *adminHandler) adminAutoTasks(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + data := adminAutoTasksData{Username: session.Username, CSRFToken: session.CSRFToken} + render := func() { + tasks, err := a.listAutoTasks(r.Context()) + if err != nil && data.Error == "" { + data.Error = err.Error() + } + data.Tasks = tasks + data.Cron = a.cronAdminStatus(r.Context()) + setAdminHTMLHeaders(w) + if err := a.autoTasksTemplate.ExecuteTemplate(w, "auto-tasks-admin.html", data); err != nil { + a.logger.Printf("auto tasks template: %v", err) + } + } + if r.Method == http.MethodPost { + _ = r.ParseForm() + if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + action := r.FormValue("action") + switch action { + case "save": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + var days []int + for _, v := range r.Form["days"] { + n, _ := strconv.Atoi(v) + if n >= 1 && n <= 7 { + days = append(days, n) + } + } + t := AIAutoTask{ID: id, Name: strings.TrimSpace(r.FormValue("name")), TaskKey: strings.TrimSpace(r.FormValue("task_key")), RunTime: strings.TrimSpace(r.FormValue("run_time")), Days: days, Active: r.FormValue("active") == "1"} + if t.Name == "" || t.TaskKey == "" || t.RunTime == "" { + data.Error = "Name, KI-Aufgabe und Uhrzeit sind erforderlich." + render() + return + } + if err := a.saveAutoTask(r.Context(), t); err != nil { + data.Error = err.Error() + render() + return + } + http.Redirect(w, r, "/admin/ai/auto-tasks?saved=1", http.StatusSeeOther) + return + case "delete": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if err := a.deleteAutoTask(r.Context(), id); err != nil { + data.Error = err.Error() + render() + return + } + http.Redirect(w, r, "/admin/ai/auto-tasks?deleted=1", http.StatusSeeOther) + return + default: + data.Error = "Unbekannte Aktion" + render() + return + } + } + if r.Method != http.MethodGet { + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.URL.Query().Get("saved") == "1" { + data.Success = "Auto-Aufgabe wurde gespeichert." + } + if r.URL.Query().Get("deleted") == "1" { + data.Success = "Auto-Aufgabe wurde gelöscht." + } + render() +} diff --git a/admin_chart_features.go b/admin_chart_features.go new file mode 100644 index 0000000..80d1684 --- /dev/null +++ b/admin_chart_features.go @@ -0,0 +1,302 @@ +package main + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "sort" + "strconv" + "strings" +) + +type chartOrderItem struct { + ID int64 `json:"id"` + Position int `json:"position"` +} + +type chartOrderRequest struct { + ChartKey string `json:"chart_key"` + ChartYear int `json:"chart_year"` + Order []chartOrderItem `json:"order"` +} + +func (a *adminHandler) chartGenerationStatus(ctx context.Context, chartKey string) (bool, string, string) { + chartKey = normalizeAdminChartKey(chartKey) + if chartKey == "annual" || chartKey == "archive" || a.database == nil || !a.database.Enabled() { + return false, "", "" + } + var row struct { + GeneratedAt string `json:"generated_at"` + } + query := fmt.Sprintf(`SELECT COALESCE((SELECT json_build_object( +'generated_at',to_char(generated_at AT TIME ZONE 'Europe/Berlin','DD.MM.YYYY HH24:MI')) +FROM chart_generation_runs WHERE chart_key=%s ORDER BY generated_at DESC LIMIT 1),'{}'::json)::text;`, sqlText(chartKey)) + if err := a.database.queryJSON(ctx, query, &row); err != nil { + return true, "", "" + } + return true, row.GeneratedAt, "" +} + +func (a *adminHandler) adminChartsReorder(w http.ResponseWriter, r *http.Request) { + session, ok := a.chartAdminAPISession(w, r) + if !ok { + return + } + if r.Method != http.MethodPost { + writeAdminJSONError(w, http.StatusMethodNotAllowed, "Methode nicht erlaubt.") + return + } + if !validAdminCSRF(r, session) { + writeAdminJSONError(w, http.StatusForbidden, "Ungültige Sicherheitsprüfung. Bitte die Seite neu laden.") + return + } + var in chartOrderRequest + if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 256<<10)).Decode(&in); err != nil { + writeAdminJSONError(w, http.StatusBadRequest, "Die neue Reihenfolge konnte nicht gelesen werden.") + return + } + in.ChartKey = normalizeAdminChartKey(in.ChartKey) + if len(in.Order) == 0 || len(in.Order) > 200 { + writeAdminJSONError(w, http.StatusBadRequest, "Die Reihenfolge ist leer oder zu groß.") + return + } + if err := validateChartOrder(in.Order); err != nil { + writeAdminJSONError(w, http.StatusBadRequest, err.Error()) + return + } + if err := a.persistChartOrder(r.Context(), in); err != nil { + writeAdminJSONError(w, http.StatusInternalServerError, "Reihenfolge konnte nicht gespeichert werden: "+err.Error()) + return + } + a.audit(r.Context(), session, r, "chart.reorder", "chart", 0, "Chartpositionen neu sortiert", true) + writeJSON(w, http.StatusOK, map[string]any{"ok": true, "message": "Die neue Reihenfolge wurde gespeichert.", "order": in.Order}) +} + +func validateChartOrder(order []chartOrderItem) error { + ids, positions := map[int64]bool{}, map[int]bool{} + for _, item := range order { + if item.ID <= 0 || item.Position < 1 || item.Position > 200 { + return fmt.Errorf("Eine Chartposition ist ungültig") + } + if ids[item.ID] || positions[item.Position] { + return fmt.Errorf("IDs und Positionen müssen eindeutig sein") + } + ids[item.ID], positions[item.Position] = true, true + } + return nil +} + +func (a *adminHandler) persistChartOrder(ctx context.Context, in chartOrderRequest) error { + if a.database == nil || !a.database.Enabled() { + return fmt.Errorf("PostgreSQL ist nicht verfügbar") + } + sql, err := chartOrderSQL(in) + if err != nil { + return err + } + _, err = a.database.exec(ctx, sql) + return err +} + +func chartOrderSQL(in chartOrderRequest) (string, error) { + if len(in.Order) == 0 { + return "", fmt.Errorf("Die Reihenfolge ist leer") + } + var values strings.Builder + for i, item := range in.Order { + if i > 0 { + values.WriteByte(',') + } + values.WriteString(fmt.Sprintf("(%d,%d)", item.ID, item.Position)) + } + if in.ChartKey == "annual" { + if in.ChartYear < 1900 || in.ChartYear > 2200 { + return "", fmt.Errorf("Das Chartjahr ist ungültig") + } + return fmt.Sprintf(`BEGIN; +SET CONSTRAINTS chart_year_entries_chart_year_position_key DEFERRED; +UPDATE chart_year_entries AS entry +SET previous_week_position=entry.position, + current_week_position=ordered.position, + position=ordered.position, + updated_at=now() +FROM (VALUES %s) AS ordered(id,position) +WHERE entry.id=ordered.id AND entry.chart_year=%d; +COMMIT;`, values.String(), in.ChartYear), nil + } + if in.ChartKey != "listener" && in.ChartKey != "dockx" && in.ChartKey != "schlager" { + return "", fmt.Errorf("Der Chartbereich ist ungültig") + } + return fmt.Sprintf(`BEGIN; +SET CONSTRAINTS chart_entries_chart_key_position_key DEFERRED; +UPDATE chart_entries AS entry +SET previous_position=entry.position, + previous_week_position=entry.position, + current_week_position=ordered.position, + position=ordered.position, + updated_at=now() +FROM (VALUES %s) AS ordered(id,position) +WHERE entry.id=ordered.id AND entry.chart_key=%s AND entry.active=true; +COMMIT;`, values.String(), sqlText(in.ChartKey)), nil +} + +func sortChartEntriesByVotingStand(entries []ChartEntry) { + sort.SliceStable(entries, func(i, j int) bool { + iEmpty := strings.TrimSpace(entries[i].Artist) == "" || strings.TrimSpace(entries[i].Title) == "" + jEmpty := strings.TrimSpace(entries[j].Artist) == "" || strings.TrimSpace(entries[j].Title) == "" + if iEmpty != jEmpty { + return !iEmpty + } + if entries[i].VotePoints != entries[j].VotePoints { + return entries[i].VotePoints > entries[j].VotePoints + } + return entries[i].Position < entries[j].Position + }) +} + +func (a *adminHandler) adminChartsGenerate(w http.ResponseWriter, r *http.Request) { + session, ok := a.chartAdminAPISession(w, r) + if !ok { + return + } + if r.Method != http.MethodPost { + writeAdminJSONError(w, http.StatusMethodNotAllowed, "Methode nicht erlaubt.") + return + } + if !validAdminCSRF(r, session) { + writeAdminJSONError(w, http.StatusForbidden, "Ungültige Sicherheitsprüfung. Bitte die Seite neu laden.") + return + } + var in struct { + ChartKey string `json:"chart_key"` + } + if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 32<<10)).Decode(&in); err != nil { + writeAdminJSONError(w, http.StatusBadRequest, "Chartbereich fehlt.") + return + } + key := normalizeAdminChartKey(in.ChartKey) + if key != "listener" && key != "dockx" && key != "schlager" { + writeAdminJSONError(w, http.StatusBadRequest, "Dieser Chart kann nicht generiert werden.") + return + } + entries, err := newChartStore(a.database).AdminChart(r.Context(), key) + if err != nil || len(entries) == 0 { + writeAdminJSONError(w, http.StatusInternalServerError, "Charttitel konnten nicht geladen werden.") + return + } + sortChartEntriesByVotingStand(entries) + order := make([]chartOrderItem, 0, len(entries)) + for i, entry := range entries { + order = append(order, chartOrderItem{ID: int64(entry.ID), Position: i + 1}) + } + if err := a.persistChartOrder(r.Context(), chartOrderRequest{ChartKey: key, Order: order}); err != nil { + writeAdminJSONError(w, http.StatusInternalServerError, "Charts konnten nicht neu sortiert werden: "+err.Error()) + return + } + insert := fmt.Sprintf(`INSERT INTO chart_generation_runs(chart_key,iso_year,iso_week,generated_by_user_id,generated_at) VALUES(%s,EXTRACT(isoyear FROM now() AT TIME ZONE 'Europe/Berlin')::int,EXTRACT(week FROM now() AT TIME ZONE 'Europe/Berlin')::int,%s,now()) ON CONFLICT(chart_key,iso_year,iso_week) DO UPDATE SET generated_by_user_id=EXCLUDED.generated_by_user_id,generated_at=now() RETURNING id;`, sqlText(key), sqlNullableInt64(session.UserID)) + if _, err := a.database.exec(r.Context(), insert); err != nil { + writeAdminJSONError(w, http.StatusInternalServerError, "Sortierung wurde gespeichert, der Auswertungszeitpunkt aber nicht: "+err.Error()) + return + } + a.audit(r.Context(), session, r, "chart.generate", "chart", 0, adminChartTitle(key)+" neu generiert", true) + writeJSON(w, http.StatusOK, map[string]any{"ok": true, "message": adminChartTitle(key) + " wurden nach dem aktuellen Voting-Stand neu sortiert.", "order": order}) +} + +func (a *adminHandler) chartAdminAPISession(w http.ResponseWriter, r *http.Request) (adminSession, bool) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + writeAdminJSONError(w, http.StatusUnauthorized, "Die Admin-Sitzung ist abgelaufen. Bitte neu anmelden.") + return session, false + } + if !requireAdminPermission(w, session, "charts.manage") { + return session, false + } + return session, true +} + +func (a *adminHandler) adminChartYearInfoGenerate(w http.ResponseWriter, r *http.Request) { + session, ok := a.chartAdminAPISession(w, r) + if !ok { + return + } + if r.Method != http.MethodPost { + writeAdminJSONError(w, http.StatusMethodNotAllowed, "Methode nicht erlaubt.") + return + } + if !validAdminCSRF(r, session) { + writeAdminJSONError(w, http.StatusForbidden, "Ungültige Sicherheitsprüfung. Bitte die Seite neu laden.") + return + } + var in struct { + Year int `json:"year"` + Position int `json:"position"` + Force bool `json:"force"` + } + if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 32<<10)).Decode(&in); err != nil { + writeAdminJSONError(w, http.StatusBadRequest, "Titel konnte nicht gelesen werden.") + return + } + if in.Year < 1900 || in.Year > 2200 || in.Position < 1 || in.Position > 200 { + writeAdminJSONError(w, http.StatusBadRequest, "Jahr oder Position ist ungültig.") + return + } + var entry struct { + Artist string `json:"artist"` + Title string `json:"title"` + } + q := fmt.Sprintf(`SELECT COALESCE((SELECT json_build_object('artist',artist,'title',title) FROM chart_year_entries WHERE chart_year=%d AND position=%d LIMIT 1),'{}'::json)::text;`, in.Year, in.Position) + if err := a.database.queryJSON(r.Context(), q, &entry); err != nil || strings.TrimSpace(entry.Artist) == "" || strings.TrimSpace(entry.Title) == "" { + writeAdminJSONError(w, http.StatusNotFound, "Jahrescharttitel wurde nicht gefunden.") + return + } + if !in.Force { + if info, err := newChartStore(a.database).SongInfo(r.Context(), in.Year, in.Position); err == nil && (info.ArtistInfo != "" || info.SongInfo != "") { + writeJSON(w, http.StatusOK, map[string]any{"ok": true, "skipped": true, "message": "Titelinformationen sind bereits vorhanden.", "data": info}) + return + } + } + info, err := a.ai.generateChartSongInfo(r.Context(), entry.Artist, entry.Title) + if err != nil { + writeAdminJSONError(w, http.StatusBadGateway, "KI-Titelinfo fehlgeschlagen: "+err.Error()) + return + } + cfg := a.settings.Get().OpenAI + upsert := fmt.Sprintf(`INSERT INTO chart_song_infos(chart_year,position,artist,title,artist_info,song_info,release_year,genre,dance_styles,generated_by,generated_at,updated_at) VALUES(%d,%d,%s,%s,%s,%s,%s,%s,%s,%s,now(),now()) ON CONFLICT(chart_year,position) DO UPDATE SET artist=excluded.artist,title=excluded.title,artist_info=excluded.artist_info,song_info=excluded.song_info,release_year=excluded.release_year,genre=excluded.genre,dance_styles=excluded.dance_styles,generated_by=excluded.generated_by,generated_at=now(),updated_at=now();`, in.Year, in.Position, sqlText(entry.Artist), sqlText(entry.Title), sqlText(info.ArtistInfo), sqlText(info.SongInfo), sqlNullableInteger(info.ReleaseYear), sqlText(info.Genre), sqlText(info.DanceStyles), sqlText(cfg.Model)) + if _, err := a.database.exec(r.Context(), upsert); err != nil { + writeAdminJSONError(w, http.StatusInternalServerError, "Titelinfo konnte nicht gespeichert werden: "+err.Error()) + return + } + a.audit(r.Context(), session, r, "chart.year.info.generate", "chart_year", 0, fmt.Sprintf("KI-Titelinfo %d/%d erzeugt", in.Year, in.Position), true) + info.ChartYear, info.Position, info.Artist, info.Title = in.Year, in.Position, entry.Artist, entry.Title + writeJSON(w, http.StatusOK, map[string]any{"ok": true, "message": fmt.Sprintf("Titelinfo für Position %d wurde erzeugt.", in.Position), "data": info}) +} + +func sqlNullableInteger(v int) string { + if v <= 0 { + return "NULL" + } + return strconv.Itoa(v) +} + +func (s *aiService) generateChartSongInfo(ctx context.Context, artist, title string) (chartSongInfo, error) { + var info chartSongInfo + cfg := s.settings.Get().OpenAI + if !cfg.Enabled || strings.TrimSpace(cfg.APIKey) == "" { + return info, fmt.Errorf("OpenAI ist in den Einstellungen nicht aktiviert") + } + schema := map[string]any{"type": "json_schema", "name": "landwelle_chart_song_info", "strict": true, "schema": map[string]any{"type": "object", "additionalProperties": false, "properties": map[string]any{ + "artist_info": map[string]any{"type": "string"}, "song_info": map[string]any{"type": "string"}, "release_year": map[string]any{"type": [2]string{"integer", "null"}}, "genre": map[string]any{"type": "string"}, "dance_styles": map[string]any{"type": "string"}, + }, "required": []string{"artist_info", "song_info", "release_year", "genre", "dance_styles"}}} + prompt := fmt.Sprintf("Erstelle sachliche, sendefähige Titelinformationen für Landwelle Radio. Interpret: %s. Titel: %s. Künstlerinfo und Songinfo jeweils 2 bis 4 kurze deutsche Sätze. Keine erfundenen Details. Genre und geeignete Tanzstile knapp nennen.", artist, title) + payload := map[string]any{"model": cfg.Model, "instructions": "Du recherchierst und formulierst präzise Musikinformationen für ein deutsches Radioprogramm. Antworte ausschließlich im verlangten JSON-Schema.", "input": prompt, "text": map[string]any{"format": schema}} + contents, err := s.createOpenAIResponse(ctx, cfg, payload) + if err != nil { + return info, err + } + raw, err := openAIResponseText(contents) + if err != nil { + return info, err + } + return decodeChartSongInfo(raw) +} diff --git a/admin_charts_api.go b/admin_charts_api.go new file mode 100644 index 0000000..86cfa5f --- /dev/null +++ b/admin_charts_api.go @@ -0,0 +1,269 @@ +package main + +import ( + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "regexp" + "strconv" + "strings" + "time" +) + +var ( + chartMetadataHTTPClient = &http.Client{Timeout: 7 * time.Second} + chartITunesSearchURL = "https://itunes.apple.com/search" + chartYouTubeIDPattern = regexp.MustCompile(`^[A-Za-z0-9_-]{11}$`) +) + +type chartMetadata struct { + StoreURL string `json:"store_url"` + PreviewURL string `json:"preview_url"` + CoverURL string `json:"cover_url"` + EntryYear int `json:"entry_year"` + EntryMonth int `json:"entry_month"` + Source string `json:"source"` +} + +func (a *adminHandler) adminChartsAutosave(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + writeAdminJSONError(w, http.StatusUnauthorized, "Die Admin-Sitzung ist abgelaufen. Bitte neu anmelden.") + return + } + if !requireAdminPermission(w, session, "charts.manage") { + return + } + if r.Method != http.MethodPost { + writeAdminJSONError(w, http.StatusMethodNotAllowed, "Methode nicht erlaubt.") + return + } + r.Body = http.MaxBytesReader(w, r.Body, 128<<10) + if err := r.ParseMultipartForm(128 << 10); err != nil { + if err := r.ParseForm(); err != nil { + writeAdminJSONError(w, http.StatusBadRequest, "Die Chartdaten konnten nicht gelesen werden.") + return + } + } + if !validAdminCSRF(r, session) { + writeAdminJSONError(w, http.StatusForbidden, "Ungültige Sicherheitsprüfung. Bitte die Seite neu laden.") + return + } + data := adminManagementData{ChartKey: normalizeAdminChartKey(r.FormValue("chart_key")), ChartTitle: adminChartTitle(r.FormValue("chart_key"))} + if message := a.handleChartAdmin(r, session, &data); message != "" { + writeAdminJSONError(w, http.StatusInternalServerError, message) + return + } + position := formInt(r, "position") + action := strings.TrimSpace(r.FormValue("action")) + message := fmt.Sprintf("Position %d wurde gespeichert.", position) + if action == "clear" || action == "delete_year" || action == "reset" || action == "reset_year" { + message = fmt.Sprintf("Position %d wurde geleert.", position) + } + response := map[string]any{"ok": true, "position": position, "message": message, "action": action} + if id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64); id > 0 && action == "save" { + var summaries []ChartEntry + query := fmt.Sprintf(`SELECT COALESCE(json_agg(row_to_json(x)),'[]'::json)::text FROM ( +SELECT e.id,COALESCE(e.fixed_vote_points,0)::int AS fixed_vote_points, +(COALESCE(e.fixed_vote_points,0)+COALESCE(sum(v.rating),0))::int AS vote_points, +count(v.id)::int AS vote_count +FROM chart_entries e LEFT JOIN chart_vote_history v ON v.entry_id=e.id +WHERE e.id=%d GROUP BY e.id) x;`, id) + if err := a.database.queryJSON(r.Context(), query, &summaries); err == nil && len(summaries) == 1 { + summary := summaries[0] + response["vote_points"] = summary.VotePoints + response["vote_count"] = summary.VoteCount + } + } + writeJSON(w, http.StatusOK, response) +} + +func (a *adminHandler) adminChartsLookupMeta(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + writeAdminJSONError(w, http.StatusUnauthorized, "Die Admin-Sitzung ist abgelaufen. Bitte neu anmelden.") + return + } + if !requireAdminPermission(w, session, "charts.manage") { + return + } + if r.Method != http.MethodGet { + writeAdminJSONError(w, http.StatusMethodNotAllowed, "Methode nicht erlaubt.") + return + } + artist := compactText(r.URL.Query().Get("artist")) + title := compactText(r.URL.Query().Get("title")) + fallbackURL := strings.TrimSpace(r.URL.Query().Get("fallback_url")) + if artist == "" || title == "" { + writeAdminJSONError(w, http.StatusUnprocessableEntity, "Interpret und Titel werden für Auto benötigt.") + return + } + if len(artist) > 300 || len(title) > 300 || len(fallbackURL) > 2048 { + writeAdminJSONError(w, http.StatusBadRequest, "Die Eingaben sind zu lang.") + return + } + if videoID := chartYouTubeVideoID(fallbackURL); videoID != "" { + writeJSON(w, http.StatusOK, map[string]any{"ok": true, "message": "YouTube-Link wurde für Cover und Hörprobe übernommen.", "data": chartMetadata{ + StoreURL: fallbackURL, PreviewURL: fallbackURL, CoverURL: chartYouTubeThumbnail(videoID), Source: "youtube", + }}) + return + } + metadata, err := lookupChartMetadataITunes(r, artist, title) + if err != nil { + a.logger.Printf("chart metadata lookup: %v", err) + writeAdminJSONError(w, http.StatusBadGateway, "Automatische Titelinformationen konnten nicht geladen werden.") + return + } + if metadata.StoreURL == "" && fallbackURL != "" { + metadata.StoreURL = fallbackURL + } + writeJSON(w, http.StatusOK, map[string]any{"ok": true, "message": "Cover und Hörprobe wurden automatisch ergänzt.", "data": metadata}) +} + +func chartYouTubeVideoID(raw string) string { + raw = strings.TrimSpace(raw) + if chartYouTubeIDPattern.MatchString(raw) { + return raw + } + u, err := url.Parse(raw) + if err != nil { + return "" + } + host := strings.ToLower(strings.TrimPrefix(u.Hostname(), "www.")) + if host == "youtu.be" { + id := strings.Split(strings.Trim(u.Path, "/"), "/")[0] + if chartYouTubeIDPattern.MatchString(id) { + return id + } + return "" + } + if host != "youtube.com" && host != "m.youtube.com" && host != "music.youtube.com" && host != "youtube-nocookie.com" { + return "" + } + if id := u.Query().Get("v"); chartYouTubeIDPattern.MatchString(id) { + return id + } + parts := strings.Split(strings.Trim(u.Path, "/"), "/") + if len(parts) >= 2 && (parts[0] == "embed" || parts[0] == "shorts" || parts[0] == "live") && chartYouTubeIDPattern.MatchString(parts[1]) { + return parts[1] + } + return "" +} + +func chartYouTubeThumbnail(videoID string) string { + if !chartYouTubeIDPattern.MatchString(videoID) { + return "" + } + return "https://i.ytimg.com/vi/" + videoID + "/hqdefault.jpg" +} + +func chartMediaValues(storeURL, previewURL, coverURL string) (string, string, string) { + storeURL = strings.TrimSpace(storeURL) + previewURL = strings.TrimSpace(previewURL) + coverURL = strings.TrimSpace(coverURL) + if videoID := chartYouTubeVideoID(storeURL); videoID != "" { + if previewURL == "" { + previewURL = storeURL + } + if coverURL == "" { + coverURL = chartYouTubeThumbnail(videoID) + } + } + return storeURL, previewURL, coverURL +} + +type itunesChartResponse struct { + Results []struct { + ArtistName string `json:"artistName"` + TrackName string `json:"trackName"` + TrackViewURL string `json:"trackViewUrl"` + PreviewURL string `json:"previewUrl"` + ArtworkURL100 string `json:"artworkUrl100"` + ReleaseDate string `json:"releaseDate"` + } `json:"results"` +} + +func lookupChartMetadataITunes(r *http.Request, artist, title string) (chartMetadata, error) { + u, err := url.Parse(chartITunesSearchURL) + if err != nil { + return chartMetadata{}, err + } + q := u.Query() + q.Set("term", strings.TrimSpace(artist+" "+title)) + q.Set("country", "DE") + q.Set("media", "music") + q.Set("entity", "song") + q.Set("limit", "5") + u.RawQuery = q.Encode() + req, err := http.NewRequestWithContext(r.Context(), http.MethodGet, u.String(), nil) + if err != nil { + return chartMetadata{}, err + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", "Landwelle Charts/1.5.7") + resp, err := chartMetadataHTTPClient.Do(req) + if err != nil { + return chartMetadata{}, err + } + defer resp.Body.Close() + if resp.StatusCode < 200 || resp.StatusCode >= 300 { + return chartMetadata{}, fmt.Errorf("itunes HTTP %d", resp.StatusCode) + } + var payload itunesChartResponse + decoder := json.NewDecoder(io.LimitReader(resp.Body, 2<<20)) + if err := decoder.Decode(&payload); err != nil { + return chartMetadata{}, err + } + if len(payload.Results) == 0 { + return chartMetadata{}, fmt.Errorf("kein passender Titel gefunden") + } + wantedArtist := normalizeChartLookupText(artist) + wantedTitle := normalizeChartLookupText(title) + bestIndex, bestScore := 0, -1 + for i, item := range payload.Results { + score := 0 + gotArtist := normalizeChartLookupText(item.ArtistName) + gotTitle := normalizeChartLookupText(item.TrackName) + if gotArtist == wantedArtist { + score += 6 + } else if strings.Contains(gotArtist, wantedArtist) || strings.Contains(wantedArtist, gotArtist) { + score += 3 + } + if gotTitle == wantedTitle { + score += 8 + } else if strings.Contains(gotTitle, wantedTitle) || strings.Contains(wantedTitle, gotTitle) { + score += 4 + } + if score > bestScore { + bestIndex, bestScore = i, score + } + } + item := payload.Results[bestIndex] + cover := strings.TrimSpace(item.ArtworkURL100) + cover = strings.Replace(cover, "100x100bb", "600x600bb", 1) + entryYear, entryMonth := 0, 0 + if released, err := time.Parse(time.RFC3339, item.ReleaseDate); err == nil { + entryYear, entryMonth = released.Year(), int(released.Month()) + } else if len(item.ReleaseDate) >= 10 { + if released, err := time.Parse("2006-01-02", item.ReleaseDate[:10]); err == nil { + entryYear, entryMonth = released.Year(), int(released.Month()) + } + } + return chartMetadata{ + StoreURL: strings.TrimSpace(item.TrackViewURL), PreviewURL: strings.TrimSpace(item.PreviewURL), CoverURL: cover, + EntryYear: entryYear, EntryMonth: entryMonth, Source: "itunes", + }, nil +} + +func normalizeChartLookupText(value string) string { + value = strings.ToLower(strings.TrimSpace(value)) + var b strings.Builder + for _, r := range value { + if (r >= 'a' && r <= 'z') || (r >= '0' && r <= '9') || r >= 128 { + b.WriteRune(r) + } + } + return b.String() +} diff --git a/admin_charts_template_test.go b/admin_charts_template_test.go new file mode 100644 index 0000000..ef00df0 --- /dev/null +++ b/admin_charts_template_test.go @@ -0,0 +1,61 @@ +package main + +import ( + "bytes" + "strings" + "testing" +) + +func TestAdminChartsTemplateRendersImportedRows(t *testing.T) { + tmpl, err := parseAdminTemplate("web/admin/management.html") + if err != nil { + t.Fatalf("template parse: %v", err) + } + for _, chartKey := range []string{"listener", "dockx", "schlager"} { + t.Run(chartKey, func(t *testing.T) { + entry := ChartEntry{ + ID: 42, + ChartKey: chartKey, + Position: 1, + PreviousPosition: 2, + EntryPosition: 5, + Artist: "Landwelle Testinterpret", + Title: "Landwelle Testtitel", + ManualPoints: 12, + FixedVotePoints: 34, + EntryYear: 2026, + EntryMonth: 30, + CurrentWeekPosition: 1, + PreviousWeekPosition: 2, + Active: true, + } + data := adminManagementData{ + Username: "admin", + CSRFToken: "csrf-test", + Module: "charts", + DatabaseReady: true, + ChartKey: chartKey, + ChartTitle: adminChartTitle(chartKey), + Charts: []ChartEntry{entry}, + TopCharts: []ChartEntry{entry}, + TopChartRows: makeAdminChartRows([]ChartEntry{entry}, "csrf-test", chartKey), + CurrentYear: 2026, + } + var out bytes.Buffer + if err := tmpl.ExecuteTemplate(&out, "management-admin.html", data); err != nil { + t.Fatalf("template execute: %v", err) + } + html := out.String() + for _, want := range []string{ + "Landwelle Testinterpret", + "Landwelle Testtitel", + `name="csrf_token" value="csrf-test"`, + `name="chart_key" value="` + chartKey + `"`, + } { + if !strings.Contains(html, want) { + t.Fatalf("rendered chart row missing %q", want) + } + } + }) + } +} diff --git a/admin_charts_v1521_regression_test.go b/admin_charts_v1521_regression_test.go new file mode 100644 index 0000000..9cdab12 --- /dev/null +++ b/admin_charts_v1521_regression_test.go @@ -0,0 +1,88 @@ +package main + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +func TestAdminChartsRenderOnlyOneChartWorkspace(t *testing.T) { + raw, err := os.ReadFile(filepath.Join("web", "admin", "management.html")) + if err != nil { + t.Fatal(err) + } + text := string(raw) + if got := strings.Count(text, `class="charts-admin-shell"`); got != 1 { + t.Fatalf("expected exactly one chart workspace, got %d", got) + } + if got := strings.Count(text, `data-chart-notifications`); got != 1 { + t.Fatalf("expected exactly one chart notification stack, got %d", got) + } +} + +func TestChartClearKeepsRowAndResetsOnlyItsFields(t *testing.T) { + raw, err := os.ReadFile(filepath.Join("web", "assets", "admin-charts-v7.js")) + if err != nil { + t.Fatal(err) + } + js := string(raw) + for _, want := range []string{"reset_year", "'reset'", "updateCover(row,'')", "Die Eingabefelder dieser Zeile wurden geleert"} { + if !strings.Contains(js, want) { + t.Fatalf("chart clear implementation missing %q", want) + } + } + for _, forbidden := range []string{"row.remove()", "persistOrder(`Position ${pos} wurde geleert"} { + if strings.Contains(js, forbidden) { + t.Fatalf("chart clear must not remove or reorder the row: found %q", forbidden) + } + } +} + +func TestChartGenerationHasNoWeeklyLock(t *testing.T) { + raw, err := os.ReadFile("admin_chart_features.go") + if err != nil { + t.Fatal(err) + } + text := string(raw) + if strings.Contains(text, "Dieser Chart wurde in dieser Woche bereits generiert") { + t.Fatal("weekly chart generation lock is still present") + } + if !strings.Contains(text, "ON CONFLICT(chart_key,iso_year,iso_week) DO UPDATE") { + t.Fatal("repeated generation must refresh the current run record") + } +} + +func TestClearedChartRowsStayAdminOnly(t *testing.T) { + raw, err := os.ReadFile("charts.go") + if err != nil { + t.Fatal(err) + } + text := string(raw) + for _, want := range []string{"func (s *chartStore) AdminChart", "btrim(e.artist)<>''", "btrim(e.title)<>''"} { + if !strings.Contains(text, want) { + t.Fatalf("chart visibility guard missing %q", want) + } + } +} + +func TestPressBetaReleaseMigrationAndImprintCredit(t *testing.T) { + migration, err := os.ReadFile(filepath.Join("migrations", "0034_press_beta_release.sql")) + if err != nil { + t.Fatal(err) + } + for _, want := range []string{"Landwelle Android-App startet in den Beta-Test", "SLMM GbR entwickelt und bereitgestellt", "landwelle-betatest@googlegroups.com"} { + if !strings.Contains(string(migration), want) { + t.Fatalf("press migration missing %q", want) + } + } + imprint, err := os.ReadFile("content.go") + if err != nil { + t.Fatal(err) + } + for _, want := range []string{"Design & Konzept", "Jens Bramsche & Jörg Weiß", "design@slmm.de", "https://www.slmm.de"} { + if !strings.Contains(string(imprint), want) { + t.Fatalf("imprint credit missing %q", want) + } + } +} diff --git a/admin_completion_test.go b/admin_completion_test.go new file mode 100644 index 0000000..9d6c9bd --- /dev/null +++ b/admin_completion_test.go @@ -0,0 +1,15 @@ +package main + +import "testing" + +func TestClockRangesOverlap(t *testing.T) { + if !clockRangesOverlap("10:00", "12:00", "11:30", "13:00") { + t.Fatal("expected overlap") + } + if clockRangesOverlap("10:00", "12:00", "12:00", "13:00") { + t.Fatal("adjacent slots must not overlap") + } + if !clockRangesOverlap("22:00", "02:00", "01:00", "03:00") { + t.Fatal("overnight overlap expected") + } +} diff --git a/admin_directory.go b/admin_directory.go new file mode 100644 index 0000000..21873a5 --- /dev/null +++ b/admin_directory.go @@ -0,0 +1,115 @@ +package main + +import ( + "context" + "errors" + "html/template" + "net/http" + "strconv" + "strings" +) + +type adminDirectoryData struct { + Username string + CSRFToken string + Items []DirectoryEntry + Categories []string + StatusFilter string + DatabaseReady bool + Error string + Success string +} + +func (a *adminHandler) adminDirectory(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if r.Method == http.MethodPost { + if a.directory == nil { + a.renderDirectoryAdmin(w, session, adminDirectoryData{Error: "Die Branchenbuchverwaltung ist derzeit nicht verfügbar."}) + return + } + r.Body = http.MaxBytesReader(w, r.Body, 256<<10) + if err := r.ParseForm(); err != nil { + a.renderDirectoryAdmin(w, session, adminDirectoryData{Error: "Das Formular konnte nicht gelesen werden."}) + return + } + if !validAdminCSRF(r, session) { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + action := strings.TrimSpace(r.FormValue("action")) + var err error + summary := "" + switch action { + case "update": + entry := DirectoryEntry{ID: id, RequestToken: strings.Repeat("x", 24), Name: strings.TrimSpace(r.FormValue("name")), Category: strings.TrimSpace(r.FormValue("category")), Description: strings.TrimSpace(r.FormValue("description")), City: strings.TrimSpace(r.FormValue("city")), PostalCode: strings.TrimSpace(r.FormValue("postal_code")), Address: strings.TrimSpace(r.FormValue("address")), Phone: strings.TrimSpace(r.FormValue("phone")), Email: strings.TrimSpace(r.FormValue("email")), Website: strings.TrimSpace(r.FormValue("website")), ContactName: strings.TrimSpace(r.FormValue("contact_name")), OpeningHours: strings.TrimSpace(r.FormValue("opening_hours")), PartnershipInterest: r.FormValue("partnership_interest") != ""} + if validationErr := validateDirectoryEntry(entry); validationErr != nil { + err = validationErr + } else { + err = a.directory.Update(r.Context(), entry) + } + summary = "Branchenbucheintrag bearbeitet: " + entry.Name + case "publish", "reject", "archive": + status := map[string]string{"publish": "published", "reject": "rejected", "archive": "archived"}[action] + err = a.directory.SetStatus(r.Context(), id, status) + summary = "Branchenbucheintrag Status: " + status + case "delete": + err = a.directory.Delete(r.Context(), id) + summary = "Branchenbucheintrag gelöscht" + default: + err = errors.New("Ungültige Aktion") + } + if err != nil { + a.audit(r.Context(), session, r, "directory."+action, "directory_entry", id, summary+": "+err.Error(), false) + a.renderDirectoryAdmin(w, session, adminDirectoryData{Error: err.Error(), StatusFilter: r.FormValue("status_filter")}) + return + } + a.audit(r.Context(), session, r, "directory."+action, "directory_entry", id, summary, true) + filter := strings.TrimSpace(r.FormValue("status_filter")) + if filter == "" { + filter = "pending" + } + http.Redirect(w, r, "/admin/directory?saved=1&status="+template.URLQueryEscaper(filter), http.StatusSeeOther) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, HEAD, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + filter := strings.TrimSpace(r.URL.Query().Get("status")) + if filter == "" { + filter = "pending" + } + data := adminDirectoryData{StatusFilter: filter} + if r.URL.Query().Get("saved") == "1" { + data.Success = "Der Branchenbucheintrag wurde aktualisiert." + } + a.renderDirectoryAdmin(w, session, data) +} + +func (a *adminHandler) renderDirectoryAdmin(w http.ResponseWriter, session adminSession, data adminDirectoryData) { + data.Username = session.Username + data.CSRFToken = session.CSRFToken + data.Categories = directoryCategories() + data.DatabaseReady = a.directory != nil && a.directory.db != nil && a.directory.db.Enabled() + if data.StatusFilter == "" { + data.StatusFilter = "pending" + } + if data.DatabaseReady { + items, err := a.directory.ListAdmin(context.Background(), data.StatusFilter) + if err != nil { + data.Error = "Einträge konnten nicht geladen werden: " + err.Error() + } else { + data.Items = items + } + } + setAdminHTMLHeaders(w) + if err := a.directoryTemplate.ExecuteTemplate(w, "directory-admin.html", data); err != nil { + a.logger.Printf("admin branchenbuch template: %v", err) + } +} diff --git a/admin_email_templates.go b/admin_email_templates.go new file mode 100644 index 0000000..d8ca98a --- /dev/null +++ b/admin_email_templates.go @@ -0,0 +1,73 @@ +package main + +import ( + "crypto/subtle" + "net/http" + "strings" +) + +func (a *adminHandler) adminEmailTemplates(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + data := adminEmailTemplatesData{Username: session.Username, CSRFToken: session.CSRFToken} + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 512<<10) + if err := r.ParseForm(); err != nil { + data.Error = "Template konnte nicht gelesen werden." + a.renderEmailTemplates(w, data) + return + } + if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf_token")), []byte(session.CSRFToken)) != 1 { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + item := EmailTemplate{Key: strings.TrimSpace(r.FormValue("template_key")), Name: r.FormValue("name"), Subject: r.FormValue("subject"), HTMLBody: r.FormValue("html_body"), TextBody: r.FormValue("text_body"), Enabled: r.FormValue("enabled") == "on"} + if err := a.emailTemplates.Save(item); err != nil { + data.Edit = item + data.Error = err.Error() + a.renderEmailTemplates(w, data) + return + } + http.Redirect(w, r, "/admin/email-templates?saved=1&edit="+item.Key, http.StatusSeeOther) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if r.Method == http.MethodHead { + setAdminHTMLHeaders(w) + w.WriteHeader(http.StatusOK) + return + } + if key := strings.TrimSpace(r.URL.Query().Get("edit")); key != "" { + if item, found := a.emailTemplates.Get(key); found { + data.Edit = item + } + } + if data.Edit.Key == "" { + if item, found := a.emailTemplates.Get("new_wish_admin"); found { + data.Edit = item + } + } + if r.URL.Query().Get("saved") == "1" { + data.Success = "E-Mail-Template wurde gespeichert." + } + a.renderEmailTemplates(w, data) +} +func (a *adminHandler) renderEmailTemplates(w http.ResponseWriter, data adminEmailTemplatesData) { + items, err := a.emailTemplates.List() + if err != nil && data.Error == "" { + data.Error = err.Error() + } else { + data.Items = items + } + setAdminHTMLHeaders(w) + if err := a.emailTemplatesTemplate.ExecuteTemplate(w, "email-templates-admin.html", data); err != nil { + a.logger.Printf("admin email templates template: %v", err) + } +} diff --git a/admin_excursions.go b/admin_excursions.go new file mode 100644 index 0000000..e80caae --- /dev/null +++ b/admin_excursions.go @@ -0,0 +1,297 @@ +package main + +import ( + "errors" + "fmt" + "net/http" + "os" + "path/filepath" + "strconv" + "strings" + "time" +) + +type adminExcursionsData struct { + Username string + CSRFToken string + Items []AdminExcursion + Categories []ExcursionCategory + DatabaseReady bool + Error string + Success string +} + +func (a *adminHandler) adminExcursions(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + data := adminExcursionsData{ + Username: session.Username, + CSRFToken: session.CSRFToken, + DatabaseReady: a.excursions != nil && a.excursions.Enabled(), + } + if r.URL.Query().Get("saved") == "1" { + data.Success = "Ausflugstipp gespeichert." + } + if r.URL.Query().Get("deleted") == "1" { + data.Success = "Ausflugstipp gelöscht." + } + if r.URL.Query().Get("category_saved") == "1" { + data.Success = "Rubrik gespeichert." + } + if r.URL.Query().Get("category_deleted") == "1" { + data.Success = "Rubrik gelöscht." + } + + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 10<<20) + if err := r.ParseMultipartForm(9 << 20); err != nil { + data.Error = "Die Eingabe konnte nicht gelesen werden. Bilder dürfen höchstens 8 MB groß sein." + } else if r.FormValue("csrf_token") != session.CSRFToken { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } else if !data.DatabaseReady { + data.Error = "PostgreSQL oder Migration 0040 ist nicht verfügbar." + } else { + action := strings.TrimSpace(r.FormValue("action")) + redirect, err := a.handleExcursionAdminAction(r, session, action) + if err != nil { + data.Error = friendlyExcursionAdminError(err) + } else { + http.Redirect(w, r, redirect, http.StatusSeeOther) + return + } + } + } + + if data.DatabaseReady { + items, err := a.excursions.ListAdmin(r.Context()) + if err != nil { + if data.Error == "" { + data.Error = "Ausflugstipps konnten nicht geladen werden. Bitte Migration 0040 prüfen." + } + } else { + data.Items = items + } + categories, err := a.excursions.CategoriesAdmin(r.Context()) + if err != nil { + if data.Error == "" { + data.Error = "Rubriken konnten nicht geladen werden. Bitte Migration 0040 prüfen." + } + } else { + data.Categories = categories + } + } + + w.Header().Set("Cache-Control", "no-store") + if err := a.excursionsTemplate.ExecuteTemplate(w, "excursions-admin.html", data); err != nil { + a.logger.Printf("admin excursions template: %v", err) + } +} + +func (a *adminHandler) handleExcursionAdminAction(r *http.Request, session adminSession, action string) (string, error) { + ctx := r.Context() + switch action { + case "create_excursion", "update_excursion": + item, err := excursionFromAdminForm(r) + if err != nil { + return "", err + } + if action == "update_excursion" { + item.ID, _ = strconv.ParseInt(r.FormValue("id"), 10, 64) + if item.ID <= 0 { + return "", errors.New("Ungültiger Ausflugstipp.") + } + } + oldImage := strings.TrimSpace(r.FormValue("current_image")) + image := strings.TrimSpace(r.FormValue("image_url")) + if image == "" { + image = oldImage + } + if r.FormValue("remove_image") == "1" { + image = "" + } + uploaded, err := saveAdminExcursionImage(r) + if err != nil { + return "", err + } + if uploaded != "" { + image = uploaded + } + item.Image = image + if action == "create_excursion" { + id, err := a.excursions.Create(ctx, item) + if err != nil { + if uploaded != "" { + removeExcursionUploadedImage(uploaded) + } + a.audit(ctx, session, r, "excursion.create", "excursion", 0, item.Title, false) + return "", err + } + a.audit(ctx, session, r, "excursion.create", "excursion", id, item.Title, true) + return "/admin/excursions?saved=1", nil + } + if err := a.excursions.Update(ctx, item); err != nil { + if uploaded != "" { + removeExcursionUploadedImage(uploaded) + } + a.audit(ctx, session, r, "excursion.update", "excursion", item.ID, item.Title, false) + return "", err + } + if oldImage != "" && oldImage != image && strings.HasPrefix(oldImage, "/excursion-media/") { + removeExcursionUploadedImage(oldImage) + } + a.audit(ctx, session, r, "excursion.update", "excursion", item.ID, item.Title, true) + return "/admin/excursions?saved=1", nil + + case "delete_excursion": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if id <= 0 { + return "", errors.New("Ungültiger Ausflugstipp.") + } + oldImage := strings.TrimSpace(r.FormValue("current_image")) + if err := a.excursions.Delete(ctx, id); err != nil { + a.audit(ctx, session, r, "excursion.delete", "excursion", id, "Ausflugstipp löschen", false) + return "", err + } + removeExcursionUploadedImage(oldImage) + a.audit(ctx, session, r, "excursion.delete", "excursion", id, "Ausflugstipp gelöscht", true) + return "/admin/excursions?deleted=1", nil + + case "create_category": + name := strings.TrimSpace(r.FormValue("name")) + sortOrder, _ := strconv.Atoi(r.FormValue("sort_order")) + id, err := a.excursions.CreateCategory(ctx, name, sortOrder, r.FormValue("active") == "1") + if err != nil { + a.audit(ctx, session, r, "excursion_category.create", "excursion_category", 0, name, false) + return "", err + } + a.audit(ctx, session, r, "excursion_category.create", "excursion_category", id, name, true) + return "/admin/excursions?category_saved=1", nil + + case "update_category": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if id <= 0 { + return "", errors.New("Ungültige Rubrik.") + } + name := strings.TrimSpace(r.FormValue("name")) + sortOrder, _ := strconv.Atoi(r.FormValue("sort_order")) + if err := a.excursions.UpdateCategory(ctx, id, name, sortOrder, r.FormValue("active") == "1"); err != nil { + a.audit(ctx, session, r, "excursion_category.update", "excursion_category", id, name, false) + return "", err + } + a.audit(ctx, session, r, "excursion_category.update", "excursion_category", id, name, true) + return "/admin/excursions?category_saved=1", nil + + case "delete_category": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if id <= 0 { + return "", errors.New("Ungültige Rubrik.") + } + if err := a.excursions.DeleteCategory(ctx, id); err != nil { + a.audit(ctx, session, r, "excursion_category.delete", "excursion_category", id, "Rubrik löschen", false) + return "", err + } + a.audit(ctx, session, r, "excursion_category.delete", "excursion_category", id, "Rubrik gelöscht", true) + return "/admin/excursions?category_deleted=1", nil + default: + return "", errors.New("Unbekannte Aktion.") + } +} + +func excursionFromAdminForm(r *http.Request) (AdminExcursion, error) { + categoryID, _ := strconv.ParseInt(r.FormValue("category_id"), 10, 64) + sortOrder, _ := strconv.Atoi(r.FormValue("sort_order")) + item := AdminExcursion{ + CategoryID: categoryID, + Title: strings.TrimSpace(r.FormValue("title")), + Region: strings.TrimSpace(r.FormValue("region")), + Description: strings.TrimSpace(r.FormValue("description")), + Distance: strings.TrimSpace(r.FormValue("distance")), + URL: strings.TrimSpace(r.FormValue("url")), + Featured: r.FormValue("featured") == "1", + Active: r.FormValue("active") == "1", + SortOrder: sortOrder, + } + if item.Title == "" { + return item, errors.New("Bitte einen Titel eingeben.") + } + if item.CategoryID <= 0 { + return item, errors.New("Bitte eine Rubrik auswählen.") + } + if len([]rune(item.Description)) > 5000 { + return item, errors.New("Die Beschreibung darf höchstens 5.000 Zeichen lang sein.") + } + return item, nil +} + +func saveAdminExcursionImage(r *http.Request) (string, error) { + file, header, err := r.FormFile("image_file") + if errors.Is(err, http.ErrMissingFile) { + return "", nil + } + if err != nil { + return "", err + } + defer file.Close() + data, imageName, _, err := readEventImage(file, header) + if err != nil { + return "", err + } + dir := envOr("LANDWELLE_EXCURSION_MEDIA_DIR", "/var/lib/landwelle/excursions") + if err := os.MkdirAll(dir, 0o750); err != nil { + return "", errors.New("Das Bild konnte nicht gespeichert werden.") + } + ext := strings.ToLower(filepath.Ext(imageName)) + stored := strconv.FormatInt(time.Now().UnixNano(), 36) + ext + if err := os.WriteFile(filepath.Join(dir, stored), data, 0o640); err != nil { + return "", errors.New("Das Bild konnte nicht gespeichert werden.") + } + return "/excursion-media/" + stored, nil +} + +func removeExcursionUploadedImage(raw string) { + if !strings.HasPrefix(raw, "/excursion-media/") { + return + } + name := filepath.Base(strings.TrimPrefix(raw, "/excursion-media/")) + if name == "." || name == "" { + return + } + _ = os.Remove(filepath.Join(envOr("LANDWELLE_EXCURSION_MEDIA_DIR", "/var/lib/landwelle/excursions"), name)) +} + +func excursionMediaHandler() http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet && r.Method != http.MethodHead { + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + name := filepath.Base(strings.TrimPrefix(r.URL.Path, "/excursion-media/")) + if name == "." || name == "" { + http.NotFound(w, r) + return + } + path := filepath.Join(envOr("LANDWELLE_EXCURSION_MEDIA_DIR", "/var/lib/landwelle/excursions"), name) + w.Header().Set("Cache-Control", "public, max-age=86400") + w.Header().Set("X-Content-Type-Options", "nosniff") + http.ServeFile(w, r, path) + } +} + +func friendlyExcursionAdminError(err error) string { + if err == nil { + return "" + } + msg := err.Error() + switch { + case strings.Contains(msg, "excursion_categories_name_ci_uidx") || strings.Contains(strings.ToLower(msg), "duplicate key"): + return "Diese Rubrik ist bereits vorhanden." + case strings.Contains(msg, "excursions_category_id_fkey"): + return "Die ausgewählte Rubrik ist nicht mehr vorhanden." + default: + return fmt.Sprintf("Änderung konnte nicht gespeichert werden: %s", msg) + } +} diff --git a/admin_management.go b/admin_management.go new file mode 100644 index 0000000..27b3441 --- /dev/null +++ b/admin_management.go @@ -0,0 +1,974 @@ +package main + +import ( + "bytes" + "context" + "fmt" + "net/http" + "net/url" + "os" + "path/filepath" + "sort" + "strconv" + "strings" + "time" +) + +type AuditEntry struct { + ID int64 `json:"id"` + ActorName string `json:"actor_name"` + Action string `json:"action"` + EntityType string `json:"entity_type"` + EntityID int64 `json:"entity_id"` + Summary string `json:"summary"` + Success bool `json:"success"` + IPAddress string `json:"ip_address"` + CreatedAt time.Time `json:"created_at"` +} +type AdminEventRow struct { + ID int64 `json:"id"` + Title string `json:"title"` + Category string `json:"category"` + City string `json:"city"` + Status string `json:"status"` + SourceName string `json:"source_name"` + SourceType string `json:"source_type"` + Venue string `json:"venue"` + Website string `json:"website"` + Description string `json:"description"` + StartAt time.Time `json:"start_at"` + ImageURL string `json:"image_url"` + HomepageFavorite bool `json:"homepage_favorite"` +} + +type ChartArchiveEntry struct { + ID int64 `json:"id"` + SourceChartKey string `json:"source_chart_key"` + OriginalPosition int `json:"original_position"` + Artist string `json:"artist"` + Title string `json:"title"` + StoreURL string `json:"store_url"` + PreviewURL string `json:"preview_url"` + CoverURL string `json:"cover_url"` + ManualPoints int `json:"manual_points"` + FixedVotePoints int `json:"fixed_vote_points"` + EntryYear int `json:"entry_year"` + EntryMonth int `json:"entry_month"` + CurrentWeekPosition int `json:"current_week_position"` + PreviousWeekPosition int `json:"previous_week_position"` + ArchiveReason string `json:"archive_reason"` + ArchivedAt time.Time `json:"archived_at"` + RestoredAt time.Time `json:"restored_at"` +} + +type ChartYear struct { + Year int `json:"chart_year"` + Label string `json:"label"` + IsActive bool `json:"is_active"` + Count int `json:"entry_count"` +} + +type ChartYearEntry struct { + ID int64 `json:"id"` + ChartYear int `json:"chart_year"` + Position int `json:"position"` + Artist string `json:"artist"` + Title string `json:"title"` + StoreURL string `json:"store_url"` + PreviewURL string `json:"preview_url"` + CoverURL string `json:"cover_url"` + FixedPoints int `json:"fixed_points"` + EntryYear int `json:"entry_year"` + EntryMonth int `json:"entry_month"` + CurrentWeekPosition int `json:"current_week_position"` + PreviousWeekPosition int `json:"previous_week_position"` + HasInfo bool `json:"has_info"` +} + +type adminChartRow struct { + ChartEntry + CSRFToken string + ChartKey string + ChartYear int + Annual bool +} + +type adminManagementData struct { + Username, CSRFToken, Module, Error, Success string + Charts []ChartEntry + TopCharts []ChartEntry + OtherCharts []ChartEntry + TopChartRows []adminChartRow + MainChartRows []adminChartRow + PreviewChartRows []adminChartRow + AnnualChartRows []adminChartRow + OtherChartRows []adminChartRow + ChartArchive []ChartArchiveEntry + ChartYears []ChartYear + ChartYearEntries []ChartYearEntry + ChartKey string + ChartTitle string + ChartLoadError string + ChartImportStats chartImportStats + ChartMainEnd int + ChartTotalEnd int + ChartMainTitle string + ChartPreviewTitle string + ChartCanGenerate bool + ChartLastGenerated string + ChartNextGenerate string + ChartInfoCount int + SelectedYear int + CurrentYear int + Events []AdminEventRow + EventCategories []EventCategory + EventTab string + HubCount int + SubmissionCount int + EventPage, EventPerPage, EventTotalPages int + EventHasPrev, EventHasNext bool + EventPrevURL, EventNextURL string + EventPages []int + Audit []AuditEntry + AuditPage, AuditPerPage, AuditTotal int + AuditTotalPages int + AuditHasPrev, AuditHasNext bool + AuditPrevURL, AuditNextURL string + AuditPages []int + AuditQuery, AuditAction, AuditResult string + AuditSuccessCount, AuditFailureCount int + AuditActorCount, AuditTodayCount int + DatabaseReady bool +} + +func normalizeAdminEventStatus(status string) string { + switch strings.ToLower(strings.TrimSpace(status)) { + case "published", "pending", "rejected", "archived": + return strings.ToLower(strings.TrimSpace(status)) + default: + return "published" + } +} + +func chartManualPointsUpdateSQL(manualPoints int) string { + return fmt.Sprintf("fixed_vote_points=COALESCE(fixed_vote_points,0)+(%d::bigint-COALESCE(manual_points,0)::bigint),manual_points=%d", manualPoints, manualPoints) +} + +func (a *adminHandler) audit(ctx context.Context, session adminSession, r *http.Request, action, entityType string, entityID int64, summary string, success bool) { + if a.database == nil || !a.database.Enabled() { + return + } + ip := a.clientIP(r) + q := fmt.Sprintf(`INSERT INTO landwelle.audit_events(user_id,actor_name,action,entity_type,entity_id,summary,success,ip_address) VALUES(%s,%s,%s,%s,%s,%s,%s,%s);`, sqlNullableInt64(session.UserID), sqlText(session.Username), sqlText(action), sqlText(entityType), sqlNullableInt64(entityID), sqlText(summary), sqlBool(success), sqlText(ip)) + _, _ = a.database.exec(ctx, q) +} +func sqlNullableInt64(v int64) string { + if v <= 0 { + return "NULL" + } + return strconv.FormatInt(v, 10) +} + +func (a *adminHandler) adminManagement(w http.ResponseWriter, r *http.Request) { + _, s, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", 303) + return + } + module := strings.TrimPrefix(r.URL.Path, "/admin/") + if module == "charts" { + if !requireAdminPermission(w, s, "charts.manage") { + return + } + } + if module == "events" { + if !requireAdminPermission(w, s, "events.manage") { + return + } + } + if module == "audit" { + if !requireAdminPermission(w, s, "audit.view") { + return + } + } + data := adminManagementData{Username: s.Username, CSRFToken: s.CSRFToken, Module: module, DatabaseReady: a.database != nil && a.database.Enabled(), ChartKey: normalizeAdminChartKey(r.URL.Query().Get("chart")), CurrentYear: time.Now().Year()} + data.SelectedYear, _ = strconv.Atoi(r.URL.Query().Get("year")) + if data.SelectedYear < 1900 || data.SelectedYear > 2200 { + data.SelectedYear = data.CurrentYear + } + data.ChartTitle = adminChartTitle(data.ChartKey) + spec := chartRanges(data.ChartKey) + data.ChartMainEnd, data.ChartTotalEnd = spec.MainEnd, spec.TotalEnd + data.ChartMainTitle, data.ChartPreviewTitle = spec.MainTitle, spec.NewTitle + data.EventTab = normalizeEventAdminTab(r.URL.Query().Get("tab")) + data.EventPage, _ = strconv.Atoi(r.URL.Query().Get("page")) + if data.EventPage < 1 { + data.EventPage = 1 + } + data.EventPerPage = 10 + data.AuditQuery = strings.TrimSpace(r.URL.Query().Get("q")) + data.AuditAction = strings.TrimSpace(r.URL.Query().Get("action")) + data.AuditResult = strings.TrimSpace(r.URL.Query().Get("result")) + data.AuditPage, _ = strconv.Atoi(r.URL.Query().Get("page")) + if data.AuditPage < 1 { + data.AuditPage = 1 + } + data.AuditPerPage = 40 + if r.Method == http.MethodPost { + if module == "events" { + r.Body = http.MaxBytesReader(w, r.Body, 12<<20) + if err := r.ParseMultipartForm(10 << 20); err != nil { + http.Error(w, "Die Veranstaltungsdaten sind zu groß oder unvollständig.", http.StatusBadRequest) + return + } + } else { + r.Body = http.MaxBytesReader(w, r.Body, 128<<10) + if err := r.ParseForm(); err != nil { + http.Error(w, "Ungültige Formulardaten", http.StatusBadRequest) + return + } + } + if r.FormValue("csrf_token") != s.CSRFToken { + http.Error(w, "Ungültige Sicherheitsprüfung", 403) + return + } + if module == "events" && strings.TrimSpace(r.FormValue("event_tab")) != "" { + data.EventTab = normalizeEventAdminTab(r.FormValue("event_tab")) + } + if module == "events" { + if postedPage, err := strconv.Atoi(r.FormValue("event_page")); err == nil && postedPage > 0 { + data.EventPage = postedPage + } + } + if module == "charts" { + data.ChartKey = normalizeAdminChartKey(r.FormValue("chart_key")) + data.ChartTitle = adminChartTitle(data.ChartKey) + spec := chartRanges(data.ChartKey) + data.ChartMainEnd, data.ChartTotalEnd = spec.MainEnd, spec.TotalEnd + data.ChartMainTitle, data.ChartPreviewTitle = spec.MainTitle, spec.NewTitle + if year, err := strconv.Atoi(r.FormValue("chart_year")); err == nil && year >= 1900 && year <= 2200 { + data.SelectedYear = year + } + } + switch module { + case "charts": + data.Error = a.handleChartAdmin(r, s, &data) + case "events": + data.Error = a.handleEventAdmin(r, s, &data) + default: + data.Error = "Diese Aktion ist nicht erlaubt." + } + if data.Error == "" { + redirectURL := "/admin/" + module + "?saved=1&chart=" + data.ChartKey + if module == "charts" && data.ChartKey == "annual" { + redirectURL += "&year=" + strconv.Itoa(data.SelectedYear) + } + if module == "events" { + redirectURL = fmt.Sprintf("/admin/events?saved=1&tab=%s&page=%d", data.EventTab, data.EventPage) + } + http.Redirect(w, r, redirectURL, 303) + return + } + } + if r.URL.Query().Get("saved") == "1" { + data.Success = "Änderung wurde gespeichert." + } + if data.DatabaseReady { + switch module { + case "charts": + chartStore := newChartStore(a.database) + if stats, err := chartStore.ImportStats(r.Context()); err != nil { + data.ChartLoadError = "Der Chart-Importstatus konnte nicht gelesen werden: " + err.Error() + a.logger.Printf("chart importstatus: %v", err) + } else { + data.ChartImportStats = stats + } + switch data.ChartKey { + case "archive": + var err error + data.ChartArchive, err = a.listChartArchive(r.Context()) + if err != nil { + data.ChartLoadError = "Das Chart-Archiv konnte nicht geladen werden: " + err.Error() + a.logger.Printf("chart archiv laden: %v", err) + } + case "annual": + var err error + data.ChartYears, err = a.listChartYears(r.Context()) + if err != nil { + data.ChartLoadError = "Die Jahrescharts konnten nicht geladen werden: " + err.Error() + a.logger.Printf("chart years laden: %v", err) + } + if len(data.ChartYears) > 0 && r.URL.Query().Get("year") == "" { + data.SelectedYear = data.ChartYears[0].Year + } + data.ChartYearEntries, err = a.listChartYearEntries(r.Context(), data.SelectedYear) + if err != nil { + data.ChartLoadError = "Die Jahrescharttitel konnten nicht geladen werden: " + err.Error() + a.logger.Printf("chart year entries laden: %v", err) + } + data.AnnualChartRows = makeAdminAnnualChartRows(data.ChartYearEntries, data.CSRFToken, data.SelectedYear) + for _, row := range data.AnnualChartRows { + if row.HasInfo { + data.ChartInfoCount++ + } + } + default: + var err error + data.Charts, err = chartStore.AdminChart(r.Context(), data.ChartKey) + if err != nil { + data.ChartLoadError = "Die Charttitel konnten nicht geladen werden: " + err.Error() + a.logger.Printf("chart %s laden: %v", data.ChartKey, err) + } + var preview []ChartEntry + spec := extendChartRangeToEntries(data.ChartKey, chartRanges(data.ChartKey), data.Charts) + data.ChartMainEnd, data.ChartTotalEnd = spec.MainEnd, spec.TotalEnd + data.ChartMainTitle, data.ChartPreviewTitle = spec.MainTitle, spec.NewTitle + data.TopCharts, data.OtherCharts, preview = splitChartEntries(data.Charts, spec) + data.TopChartRows = makeAdminChartRows(data.TopCharts, data.CSRFToken, data.ChartKey) + data.MainChartRows = makeAdminChartRows(data.OtherCharts, data.CSRFToken, data.ChartKey) + data.PreviewChartRows = makeAdminChartRows(preview, data.CSRFToken, data.ChartKey) + data.OtherChartRows = append(append([]adminChartRow{}, data.MainChartRows...), data.PreviewChartRows...) + data.ChartCanGenerate, data.ChartLastGenerated, data.ChartNextGenerate = a.chartGenerationStatus(r.Context(), data.ChartKey) + } + case "events": + _ = a.cleanupExpiredHubEvents(r.Context()) + data.HubCount, data.SubmissionCount, _ = a.countAdminEvents(r.Context()) + total := data.HubCount + if data.EventTab == "submissions" { + total = data.SubmissionCount + } + data.EventTotalPages = (total + data.EventPerPage - 1) / data.EventPerPage + if data.EventTotalPages < 1 { + data.EventTotalPages = 1 + } + if data.EventPage > data.EventTotalPages { + data.EventPage = data.EventTotalPages + } + data.EventHasPrev = data.EventPage > 1 + data.EventHasNext = data.EventPage < data.EventTotalPages + data.EventPrevURL = fmt.Sprintf("/admin/events?tab=%s&page=%d", data.EventTab, data.EventPage) + data.EventNextURL = fmt.Sprintf("/admin/events?tab=%s&page=%d", data.EventTab, data.EventPage) + if data.EventHasPrev { + data.EventPrevURL = fmt.Sprintf("/admin/events?tab=%s&page=%d", data.EventTab, data.EventPage-1) + } + if data.EventHasNext { + data.EventNextURL = fmt.Sprintf("/admin/events?tab=%s&page=%d", data.EventTab, data.EventPage+1) + } + data.EventPages = compactAdminPages(data.EventPage, data.EventTotalPages) + data.Events, _ = a.listAdminEvents(r.Context(), data.EventTab, data.EventPage, data.EventPerPage) + data.EventCategories, _ = newEventStore(a.database).Categories(r.Context(), true) + case "audit": + var auditErr error + data.Audit, data.AuditTotal, data.AuditSuccessCount, data.AuditFailureCount, data.AuditActorCount, data.AuditTodayCount, auditErr = a.listAuditPage(r.Context(), data.AuditQuery, data.AuditAction, data.AuditResult, data.AuditPage, data.AuditPerPage) + if auditErr != nil { + data.Error = "Das Audit-Protokoll konnte nicht geladen werden: " + auditErr.Error() + } + data.AuditTotalPages = (data.AuditTotal + data.AuditPerPage - 1) / data.AuditPerPage + if data.AuditTotalPages < 1 { + data.AuditTotalPages = 1 + } + if data.AuditPage > data.AuditTotalPages { + data.AuditPage = data.AuditTotalPages + } + data.AuditHasPrev = data.AuditPage > 1 + data.AuditHasNext = data.AuditPage < data.AuditTotalPages + data.AuditPages = compactAdminPages(data.AuditPage, data.AuditTotalPages) + data.AuditPrevURL = auditAdminURL(data.AuditPage-1, data.AuditQuery, data.AuditAction, data.AuditResult) + data.AuditNextURL = auditAdminURL(data.AuditPage+1, data.AuditQuery, data.AuditAction, data.AuditResult) + } + } + var rendered bytes.Buffer + if err := a.managementTemplate.ExecuteTemplate(&rendered, "management-admin.html", data); err != nil { + a.logger.Printf("admin management template: %v", err) + http.Error(w, "Die Verwaltungsseite konnte nicht vollständig dargestellt werden.", http.StatusInternalServerError) + return + } + setAdminHTMLHeaders(w) + _, _ = w.Write(rendered.Bytes()) +} + +func makeAdminChartRows(entries []ChartEntry, csrfToken, chartKey string) []adminChartRow { + rows := make([]adminChartRow, 0, len(entries)) + for _, entry := range entries { + rows = append(rows, adminChartRow{ChartEntry: entry, CSRFToken: csrfToken, ChartKey: chartKey}) + } + return rows +} + +func makeAdminAnnualChartRows(entries []ChartYearEntry, csrfToken string, year int) []adminChartRow { + rows := make([]adminChartRow, 0, len(entries)) + for _, entry := range entries { + rows = append(rows, adminChartRow{ChartEntry: ChartEntry{ + ID: int(entry.ID), ChartKey: "annual", Position: entry.Position, PreviousPosition: entry.PreviousWeekPosition, EntryPosition: entry.Position, + Artist: entry.Artist, Title: entry.Title, CoverURL: entry.CoverURL, PreviewURL: entry.PreviewURL, StoreURL: entry.StoreURL, + FixedVotePoints: entry.FixedPoints, EntryYear: entry.EntryYear, EntryMonth: entry.EntryMonth, + CurrentWeekPosition: entry.CurrentWeekPosition, PreviousWeekPosition: entry.PreviousWeekPosition, HasInfo: entry.HasInfo, + }, CSRFToken: csrfToken, ChartKey: "annual", ChartYear: year, Annual: true}) + } + return rows +} + +func normalizeAdminChartKey(key string) string { + switch strings.ToLower(strings.TrimSpace(key)) { + case "listener", "zuhoerer": + return "listener" + case "dockx": + return "dockx" + case "schlager": + return "schlager" + case "archive", "archiv": + return "archive" + case "annual", "year", "years", "jahrescharts": + return "annual" + default: + return "listener" + } +} + +func adminChartTitle(key string) string { + switch normalizeAdminChartKey(key) { + case "dockx": + return "Landwelle docX Charts" + case "schlager": + return "Landwelle Schlager Charts" + case "archive": + return "Archiv" + case "annual": + return "Jahrescharts" + default: + return "Zuhörer Charts" + } +} + +func formInt(r *http.Request, name string) int { + v, _ := strconv.Atoi(strings.TrimSpace(r.FormValue(name))) + return v +} + +func (a *adminHandler) handleChartAdmin(r *http.Request, s adminSession, data *adminManagementData) string { + if a.database == nil || !a.database.Enabled() { + return "PostgreSQL ist nicht verfügbar." + } + action := strings.TrimSpace(r.FormValue("action")) + key := normalizeAdminChartKey(r.FormValue("chart_key")) + data.ChartKey = key + data.ChartTitle = adminChartTitle(key) + + switch action { + case "save": + if key == "archive" || key == "annual" { + return "Für diesen Bereich ist die Titelaktion nicht zulässig." + } + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + pos := formInt(r, "position") + artist := compactText(r.FormValue("artist")) + title := compactText(r.FormValue("title")) + if pos < 1 || pos > 100 || artist == "" || title == "" { + return "Position, Interpret und Titel sind erforderlich." + } + previous := formInt(r, "previous_position") + entryPosition := formInt(r, "entry_position") + currentWeek := formInt(r, "current_week_position") + previousWeek := formInt(r, "previous_week_position") + if currentWeek == 0 { + currentWeek = pos + } + if previous == 0 { + previous = previousWeek + } + if entryPosition == 0 { + entryPosition = pos + } + storeURL, previewURL, coverURL := chartMediaValues(r.FormValue("store_url"), r.FormValue("preview_url"), r.FormValue("cover_url")) + manualPoints := formInt(r, "manual_points") + fields := fmt.Sprintf(`chart_key=%s,position=%d,previous_position=%d,entry_position=%d,artist=%s,title=%s,cover_url=%s,preview_url=%s,store_url=%s,weeks=%d,%s,entry_year=%d,entry_month=%d,current_week_position=%d,previous_week_position=%d,active=true,updated_at=now()`, + sqlText(key), pos, previous, entryPosition, sqlText(artist), sqlText(title), sqlText(coverURL), sqlText(previewURL), sqlText(storeURL), formInt(r, "weeks"), chartManualPointsUpdateSQL(manualPoints), formInt(r, "entry_year"), formInt(r, "entry_month"), currentWeek, previousWeek) + var query string + if id > 0 { + // Der feste Basiswert ist eine automatisch verwaltete Auswertung und darf + // beim normalen Autosave nicht aus dem Formular überschrieben werden. + query = fmt.Sprintf(`UPDATE chart_entries SET %s WHERE id=%d RETURNING id;`, fields, id) + } else { + query = fmt.Sprintf(`INSERT INTO chart_entries(chart_key,position,previous_position,entry_position,artist,title,cover_url,preview_url,store_url,weeks,manual_points,fixed_vote_points,entry_year,entry_month,current_week_position,previous_week_position,active) VALUES(%s,%d,%d,%d,%s,%s,%s,%s,%s,%d,%d,%d,%d,%d,%d,%d,true) RETURNING id;`, + sqlText(key), pos, previous, entryPosition, sqlText(artist), sqlText(title), sqlText(coverURL), sqlText(previewURL), sqlText(storeURL), formInt(r, "weeks"), manualPoints, manualPoints, formInt(r, "entry_year"), formInt(r, "entry_month"), currentWeek, previousWeek) + } + if _, err := a.database.exec(r.Context(), query); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "chart.save", "chart", id, "Charttitel gespeichert: "+artist+" – "+title, true) + + case "reset": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + position := formInt(r, "position") + if id <= 0 || position <= 0 { + return "Ungültige Chartposition." + } + query := fmt.Sprintf(`WITH cleared AS ( +UPDATE chart_entries SET artist='',title='',cover_url='',preview_url='',store_url='',weeks=0,manual_points=0,fixed_vote_points=0,entry_year=0,entry_month=0,current_week_position=0,previous_week_position=0,previous_position=0,entry_position=position,updated_at=now() +WHERE id=%d AND chart_key=%s RETURNING id +), removed_status AS ( +DELETE FROM chart_votes v USING cleared c WHERE v.entry_id=c.id RETURNING v.id +), removed_history AS ( +DELETE FROM chart_vote_history h USING cleared c WHERE h.entry_id=c.id RETURNING h.id +) +SELECT id FROM cleared;`, id, sqlText(key)) + if _, err := a.database.exec(r.Context(), query); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "chart.reset", "chart", id, fmt.Sprintf("Eingaben in Chartposition %d geleert", position), true) + + case "reset_year": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + year := formInt(r, "chart_year") + position := formInt(r, "position") + if id <= 0 || year < 1900 || year > 2200 || position <= 0 { + return "Ungültige Jahreschartposition." + } + query := fmt.Sprintf(`UPDATE chart_year_entries SET artist='',title='',store_url='',preview_url='',cover_url='',fixed_points=0,entry_year=0,entry_month=0,current_week_position=0,previous_week_position=0,updated_at=now() WHERE id=%d AND chart_year=%d RETURNING id;`, id, year) + if _, err := a.database.exec(r.Context(), query); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "chart_year.reset", "chart_year", id, fmt.Sprintf("Eingaben in Jahreschartposition %d geleert", position), true) + + case "clear": + // Rückwärtskompatibilität für ältere Admin-JavaScript-Versionen. + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + position := formInt(r, "position") + if id <= 0 && position <= 0 { + return "Ungültige Chartposition." + } + query := "" + if id > 0 { + query = fmt.Sprintf("DELETE FROM chart_entries WHERE id=%d RETURNING id;", id) + } else { + query = fmt.Sprintf("DELETE FROM chart_entries WHERE chart_key=%s AND position=%d RETURNING id;", sqlText(key), position) + } + if _, err := a.database.exec(r.Context(), query); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "chart.clear", "chart", id, fmt.Sprintf("Chartposition %d geleert", position), true) + + case "archive": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if id <= 0 { + return "Ungültiger Charttitel." + } + query := fmt.Sprintf(`BEGIN; +INSERT INTO chart_archive(source_chart_key,original_entry_id,original_position,artist,title,store_url,preview_url,cover_url,manual_points,fixed_vote_points,entry_year,entry_month,current_week_position,previous_week_position,archive_reason,archived_by_user_id,archived_at) +SELECT chart_key,id,position,artist,title,COALESCE(store_url,''),preview_url,cover_url,manual_points,fixed_vote_points,entry_year,entry_month,current_week_position,previous_week_position,'manual_admin',%s,now() +FROM chart_entries WHERE id=%d; +DELETE FROM chart_entries WHERE id=%d; +COMMIT;`, sqlNullableInt64(s.UserID), id, id) + if _, err := a.database.exec(r.Context(), query); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "chart.archive", "chart", id, "Charttitel archiviert", true) + + case "delete": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if _, err := a.database.exec(r.Context(), fmt.Sprintf("DELETE FROM chart_entries WHERE id=%d RETURNING id;", id)); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "chart.delete", "chart", id, "Charttitel gelöscht", true) + + case "restore": + archiveID, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if archiveID <= 0 { + return "Ungültiger Archiveintrag." + } + query := fmt.Sprintf(`WITH source AS ( +SELECT * FROM chart_archive WHERE id=%d AND restored_at IS NULL +), free_position AS ( +SELECT COALESCE((SELECT min(candidate) FROM generate_series(1,100) candidate WHERE NOT EXISTS (SELECT 1 FROM chart_entries e, source s WHERE e.chart_key=s.source_chart_key AND e.position=candidate)),101) AS position +), inserted AS ( +INSERT INTO chart_entries(chart_key,position,previous_position,entry_position,artist,title,cover_url,preview_url,store_url,manual_points,fixed_vote_points,entry_year,entry_month,current_week_position,previous_week_position,active) +SELECT s.source_chart_key,CASE WHEN NOT EXISTS(SELECT 1 FROM chart_entries e WHERE e.chart_key=s.source_chart_key AND e.position=s.original_position) THEN s.original_position ELSE f.position END, +COALESCE(s.previous_week_position,0),COALESCE(s.original_position,0),s.artist,s.title,s.cover_url,s.preview_url,s.store_url,COALESCE(s.manual_points,0),COALESCE(s.fixed_vote_points,0),COALESCE(s.entry_year,0),COALESCE(s.entry_month,0),COALESCE(s.current_week_position,s.original_position),COALESCE(s.previous_week_position,0),true +FROM source s CROSS JOIN free_position f WHERE f.position<=100 RETURNING id +) +UPDATE chart_archive SET restored_by_user_id=%s,restored_at=now() WHERE id=%d AND EXISTS(SELECT 1 FROM inserted) RETURNING id;`, archiveID, sqlNullableInt64(s.UserID), archiveID) + if _, err := a.database.exec(r.Context(), query); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "chart.restore", "chart_archive", archiveID, "Charttitel wiederhergestellt", true) + + case "delete_archive": + archiveID, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if _, err := a.database.exec(r.Context(), fmt.Sprintf("DELETE FROM chart_archive WHERE id=%d RETURNING id;", archiveID)); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "chart.archive.delete", "chart_archive", archiveID, "Archiveintrag gelöscht", true) + + case "save_year": + year := formInt(r, "chart_year") + data.SelectedYear = year + if year < 1900 || year > 2200 { + return "Das Chartjahr ist ungültig." + } + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + pos := formInt(r, "position") + artist := compactText(r.FormValue("artist")) + title := compactText(r.FormValue("title")) + if pos < 1 || pos > 200 || artist == "" || title == "" { + return "Position, Interpret und Titel sind erforderlich." + } + storeURL, previewURL, coverURL := chartMediaValues(r.FormValue("store_url"), r.FormValue("preview_url"), r.FormValue("cover_url")) + query := fmt.Sprintf(`INSERT INTO chart_years(chart_year,label,is_active) VALUES(%d,%s,true) ON CONFLICT(chart_year) DO UPDATE SET label=EXCLUDED.label,updated_at=now();`, year, sqlText("Jahrescharts "+strconv.Itoa(year))) + if id > 0 { + query += fmt.Sprintf(` UPDATE chart_year_entries SET chart_year=%d,position=%d,artist=%s,title=%s,store_url=%s,preview_url=%s,cover_url=%s,fixed_points=%d,entry_year=%d,entry_month=%d,current_week_position=%d,previous_week_position=%d,updated_at=now() WHERE id=%d RETURNING id;`, year, pos, sqlText(artist), sqlText(title), sqlText(storeURL), sqlText(previewURL), sqlText(coverURL), formInt(r, "fixed_points"), formInt(r, "entry_year"), formInt(r, "entry_month"), formInt(r, "current_week_position"), formInt(r, "previous_week_position"), id) + } else { + query += fmt.Sprintf(` INSERT INTO chart_year_entries(chart_year,position,artist,title,store_url,preview_url,cover_url,fixed_points,entry_year,entry_month,current_week_position,previous_week_position) VALUES(%d,%d,%s,%s,%s,%s,%s,%d,%d,%d,%d,%d) RETURNING id;`, year, pos, sqlText(artist), sqlText(title), sqlText(storeURL), sqlText(previewURL), sqlText(coverURL), formInt(r, "fixed_points"), formInt(r, "entry_year"), formInt(r, "entry_month"), formInt(r, "current_week_position"), formInt(r, "previous_week_position")) + } + if _, err := a.database.exec(r.Context(), query); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "chart.year.save", "chart_year", id, fmt.Sprintf("Jahreschart %d gespeichert: %s – %s", year, artist, title), true) + + case "delete_year": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if _, err := a.database.exec(r.Context(), fmt.Sprintf("DELETE FROM chart_year_entries WHERE id=%d RETURNING id;", id)); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "chart.year.delete", "chart_year", id, "Jahrescharttitel gelöscht", true) + + case "snapshot": + period := strings.TrimSpace(r.FormValue("period")) + if period == "" { + period = time.Now().Format("2006") + } + query := fmt.Sprintf(`INSERT INTO landwelle.chart_snapshots(chart_key,period_key,entries) SELECT %s,%s,COALESCE(jsonb_agg(to_jsonb(x) ORDER BY position),'[]'::jsonb) FROM (SELECT position,previous_position,entry_position,artist,title,cover_url,preview_url FROM chart_entries WHERE chart_key=%s AND active=true) x ON CONFLICT(chart_key,period_key) DO UPDATE SET entries=excluded.entries,created_at=now();`, sqlText(key), sqlText(period), sqlText(key)) + if _, err := a.database.exec(r.Context(), query); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "chart.snapshot", "chart", 0, "Chartstand "+period+" gespeichert", true) + + default: + return "Unbekannte Chartaktion." + } + return "" +} + +func (a *adminHandler) listChartArchive(ctx context.Context) ([]ChartArchiveEntry, error) { + var out []ChartArchiveEntry + query := `SELECT COALESCE(json_agg(json_build_object( +'id',id,'source_chart_key',source_chart_key,'original_position',COALESCE(original_position,0),'artist',artist,'title',title, +'store_url',COALESCE(store_url,''),'preview_url',COALESCE(preview_url,''),'cover_url',COALESCE(cover_url,''), +'manual_points',COALESCE(manual_points,0),'fixed_vote_points',COALESCE(fixed_vote_points,0),'entry_year',COALESCE(entry_year,0),'entry_month',COALESCE(entry_month,0), +'current_week_position',COALESCE(current_week_position,0),'previous_week_position',COALESCE(previous_week_position,0),'archive_reason',archive_reason, +'archived_at',archived_at,'restored_at',restored_at) ORDER BY archived_at DESC),'[]'::json)::text +FROM (SELECT * FROM chart_archive ORDER BY archived_at DESC LIMIT 500) a;` + return out, a.database.queryJSON(ctx, query, &out) +} + +func (a *adminHandler) listChartYears(ctx context.Context) ([]ChartYear, error) { + var out []ChartYear + query := `SELECT COALESCE(json_agg(json_build_object('chart_year',y.chart_year,'label',y.label,'is_active',y.is_active,'entry_count',COALESCE(c.entry_count,0)) ORDER BY y.chart_year DESC),'[]'::json)::text FROM chart_years y LEFT JOIN (SELECT chart_year,count(*)::int entry_count FROM chart_year_entries GROUP BY chart_year)c USING(chart_year);` + return out, a.database.queryJSON(ctx, query, &out) +} + +func (a *adminHandler) listChartYearEntries(ctx context.Context, year int) ([]ChartYearEntry, error) { + var out []ChartYearEntry + query := fmt.Sprintf(`SELECT COALESCE(json_agg(json_build_object('id',e.id,'chart_year',e.chart_year,'position',e.position,'artist',e.artist,'title',e.title,'store_url',COALESCE(e.store_url,''),'preview_url',COALESCE(e.preview_url,''),'cover_url',COALESCE(e.cover_url,''),'fixed_points',COALESCE(e.fixed_points,0),'entry_year',COALESCE(e.entry_year,0),'entry_month',COALESCE(e.entry_month,0),'current_week_position',COALESCE(e.current_week_position,0),'previous_week_position',COALESCE(e.previous_week_position,0),'has_info',EXISTS(SELECT 1 FROM chart_song_infos si WHERE si.chart_year=e.chart_year AND si.position=e.position AND (COALESCE(si.artist_info,'')<>'' OR COALESCE(si.song_info,'')<>''))) ORDER BY e.position),'[]'::json)::text FROM chart_year_entries e WHERE e.chart_year=%d;`, year) + return out, a.database.queryJSON(ctx, query, &out) +} + +func normalizeEventAdminTab(tab string) string { + switch strings.ToLower(strings.TrimSpace(tab)) { + case "submissions", "own", "eingaben", "einsendungen": + return "submissions" + default: + return "hub" + } +} + +func (a *adminHandler) cleanupExpiredHubEvents(ctx context.Context) error { + if a.database == nil || !a.database.Enabled() { + return nil + } + _, err := a.database.exec(ctx, `DELETE FROM landwelle.event_submissions WHERE source_type='open_data' AND COALESCE(NULLIF(end_at,start_at), date_trunc('day',start_at)+interval '1 day') <= now();`) + return err +} + +func (a *adminHandler) countAdminEvents(ctx context.Context) (int, int, error) { + var counts struct { + Hub int `json:"hub"` + Submissions int `json:"submissions"` + } + q := `SELECT json_build_object( +'hub',count(*) FILTER (WHERE source_type='open_data' AND COALESCE(NULLIF(end_at,start_at), date_trunc('day',start_at)+interval '1 day')>now()), +'submissions',count(*) FILTER (WHERE source_type<>'open_data' AND COALESCE(end_at,start_at)>=now()-interval '30 days')) +FROM landwelle.event_submissions;` + if err := a.database.queryJSON(ctx, q, &counts); err != nil { + return 0, 0, err + } + return counts.Hub, counts.Submissions, nil +} + +func (a *adminHandler) listAdminEvents(ctx context.Context, tab string, page, perPage int) ([]AdminEventRow, error) { + var out []AdminEventRow + where := `source_type='open_data' AND COALESCE(NULLIF(end_at,start_at), date_trunc('day',start_at)+interval '1 day')>now()` + order := `start_at ASC` + if normalizeEventAdminTab(tab) == "submissions" { + where = `source_type<>'open_data' AND COALESCE(end_at,start_at)>=now()-interval '30 days'` + order = `CASE status WHEN 'pending' THEN 0 WHEN 'rejected' THEN 1 ELSE 2 END, created_at DESC` + } + q := `SELECT COALESCE(json_agg(json_build_object( +'id',paged.id,'title',paged.title,'category',paged.category,'city',paged.city,'status',paged.status,'source_name',paged.source_name,'source_type',paged.source_type, +'venue',paged.venue,'website',paged.website,'description',paged.description,'start_at',paged.start_at, +'image_url',CASE WHEN paged.image_path<>'' THEN '/event-media/'||paged.image_path ELSE paged.external_image_url END, +'homepage_favorite',paged.homepage_favorite) ORDER BY ` + order + `),'[]'::json)::text +FROM (SELECT * FROM landwelle.event_submissions WHERE ` + where + ` ORDER BY ` + order + fmt.Sprintf(` LIMIT %d OFFSET %d) paged;`, perPage, (page-1)*perPage) + return out, a.database.queryJSON(ctx, q, &out) +} + +func saveAdminEventGraphic(r *http.Request) (string, error) { + file, header, err := r.FormFile("graphic") + if err == http.ErrMissingFile { + return "", nil + } + if err != nil { + return "", err + } + defer file.Close() + data, imageName, _, err := readEventImage(file, header) + if err != nil { + return "", err + } + if len(data) == 0 { + return "", nil + } + dir := envOr("LANDWELLE_EVENT_MEDIA_DIR", "/var/lib/landwelle/event-submissions") + if err := os.MkdirAll(dir, 0o750); err != nil { + return "", err + } + ext := strings.ToLower(filepath.Ext(imageName)) + stored := strconv.FormatInt(time.Now().UnixNano(), 36) + ext + if err := os.WriteFile(filepath.Join(dir, stored), data, 0o640); err != nil { + return "", err + } + return stored, nil +} + +func (a *adminHandler) handleEventAdmin(r *http.Request, s adminSession, data *adminManagementData) string { + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + action := r.FormValue("action") + status := "" + + switch action { + case "category_create": + name := strings.TrimSpace(r.FormValue("name")) + if name == "" { + return "Bitte gib einen Kategorienamen ein." + } + sortOrder := formInt(r, "sort_order") + if sortOrder <= 0 { + sortOrder = 100 + } + q := fmt.Sprintf(`INSERT INTO landwelle.event_categories(name,sort_order,active) VALUES(%s,%d,true) ON CONFLICT DO NOTHING;`, sqlText(name), sortOrder) + if _, err := a.database.exec(r.Context(), q); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "event.category.create", "event_category", 0, "Veranstaltungskategorie angelegt: "+name, true) + return "" + case "category_update": + categoryID, _ := strconv.ParseInt(r.FormValue("category_id"), 10, 64) + name := strings.TrimSpace(r.FormValue("name")) + if categoryID <= 0 || name == "" { + return "Die Veranstaltungskategorie ist ungültig." + } + sortOrder := formInt(r, "sort_order") + if sortOrder <= 0 { + sortOrder = 100 + } + active := r.FormValue("active") == "on" + q := fmt.Sprintf(`UPDATE landwelle.event_categories SET name=%s,sort_order=%d,active=%s,updated_at=now() WHERE id=%d RETURNING id;`, sqlText(name), sortOrder, sqlBool(active), categoryID) + if _, err := a.database.exec(r.Context(), q); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "event.category.update", "event_category", categoryID, "Veranstaltungskategorie bearbeitet: "+name, true) + return "" + case "create": + title := strings.TrimSpace(r.FormValue("title")) + city := strings.TrimSpace(r.FormValue("city")) + description := strings.TrimSpace(r.FormValue("description")) + start, err := time.ParseInLocation("2006-01-02T15:04", r.FormValue("start_at"), berlinLocation()) + if err != nil || title == "" || city == "" { + return "Titel, Beginn und Ort sind Pflichtfelder." + } + endSQL := "NULL" + if rawEnd := strings.TrimSpace(r.FormValue("end_at")); rawEnd != "" { + end, err := time.ParseInLocation("2006-01-02T15:04", rawEnd, berlinLocation()) + if err != nil || end.Before(start) { + return "Das Veranstaltungsende ist ungültig." + } + endSQL = sqlText(end.Format(time.RFC3339)) + "::timestamptz" + } + imagePath, err := saveAdminEventGraphic(r) + if err != nil { + return "Die Veranstaltungsgrafik konnte nicht gespeichert werden: " + err.Error() + } + category := strings.TrimSpace(r.FormValue("category")) + if category == "" { + category = "Sonstiges" + } + status := normalizeAdminEventStatus(r.FormValue("status")) + q := fmt.Sprintf(`INSERT INTO landwelle.event_submissions(title,category,start_at,end_at,venue,city,postal_code,organizer,contact_name,contact_email,contact_phone,description,website,image_path,status,source_type,source_name) VALUES(%s,%s,%s::timestamptz,%s,%s,%s,%s,%s,'Landwelle Redaktion','','',%s,%s,%s,%s,'editorial','Landwelle Redaktion') RETURNING id;`, + sqlText(title), sqlText(category), sqlText(start.Format(time.RFC3339)), endSQL, sqlText(r.FormValue("venue")), sqlText(city), sqlText(r.FormValue("postal_code")), sqlText(r.FormValue("organizer")), sqlText(description), sqlText(r.FormValue("website")), sqlText(imagePath), sqlText(status)) + if _, err := a.database.exec(r.Context(), q); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "event.create", "event", 0, "Veranstaltung redaktionell angelegt: "+title, true) + return "" + case "update": + start, err := time.ParseInLocation("2006-01-02T15:04", r.FormValue("start_at"), berlinLocation()) + if err != nil { + return "Beginn ist ungültig." + } + imagePath, err := saveAdminEventGraphic(r) + if err != nil { + return "Die Veranstaltungsgrafik konnte nicht gespeichert werden: " + err.Error() + } + imageSQL := "" + if imagePath != "" { + imageSQL = ",image_path=" + sqlText(imagePath) + } + q := fmt.Sprintf(`UPDATE landwelle.event_submissions SET title=%s,category=%s,start_at=%s::timestamptz,city=%s,venue=%s,website=%s,description=%s%s,updated_at=now() WHERE id=%d RETURNING id;`, sqlText(r.FormValue("title")), sqlText(r.FormValue("category")), sqlText(start.Format(time.RFC3339)), sqlText(r.FormValue("city")), sqlText(r.FormValue("venue")), sqlText(r.FormValue("website")), sqlText(r.FormValue("description")), imageSQL, id) + if _, err := a.database.exec(r.Context(), q); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "event.update", "event", id, "Veranstaltung bearbeitet", true) + return "" + case "publish": + status = "published" + case "reject": + status = "rejected" + case "pending": + status = "pending" + case "favorite", "unfavorite": + favorite := action == "favorite" + var updated []struct { + ID int64 `json:"id"` + } + favoriteAt := "NULL" + if favorite { + favoriteAt = "now()" + } + q := fmt.Sprintf(`WITH updated AS ( +UPDATE landwelle.event_submissions +SET homepage_favorite=%s, homepage_favorite_at=%s, updated_at=now() +WHERE id=%d AND source_type IN ('submission','editorial') +RETURNING id +) SELECT COALESCE(json_agg(json_build_object('id',id)),'[]'::json)::text FROM updated;`, sqlBool(favorite), favoriteAt, id) + if err := a.database.queryJSON(r.Context(), q, &updated); err != nil { + return err.Error() + } + if len(updated) == 0 { + return "Nur selbst eingetragene Veranstaltungen können als Startseiten-Favorit markiert werden." + } + actionName := "event.unfavorite" + summary := "Startseiten-Favorit entfernt" + if favorite { + actionName = "event.favorite" + summary = "Als Startseiten-Favorit markiert" + } + a.audit(r.Context(), s, r, actionName, "event", id, summary, true) + return "" + case "delete": + if _, err := a.database.exec(r.Context(), fmt.Sprintf("DELETE FROM landwelle.event_submissions WHERE id=%d RETURNING id;", id)); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "event.delete", "event", id, "Veranstaltung gelöscht", true) + return "" + default: + return "Unbekannte Veranstaltungsaktion." + } + if _, err := a.database.exec(r.Context(), fmt.Sprintf("UPDATE landwelle.event_submissions SET status=%s,updated_at=now() WHERE id=%d RETURNING id;", sqlText(status), id)); err != nil { + return err.Error() + } + a.audit(r.Context(), s, r, "event.status", "event", id, "Veranstaltungsstatus geändert: "+status, true) + return "" +} + +func auditAdminURL(page int, query, action, result string) string { + if page < 1 { + page = 1 + } + values := url.Values{} + values.Set("page", strconv.Itoa(page)) + if query != "" { + values.Set("q", query) + } + if action != "" { + values.Set("action", action) + } + if result != "" { + values.Set("result", result) + } + return "/admin/audit?" + values.Encode() +} + +func (a *adminHandler) listAuditPage(ctx context.Context, query, action, result string, page, perPage int) ([]AuditEntry, int, int, int, int, int, error) { + if page < 1 { + page = 1 + } + if perPage < 1 || perPage > 200 { + perPage = 40 + } + conditions := []string{"1=1"} + if query = strings.TrimSpace(query); query != "" { + needle := "%" + strings.ToLower(query) + "%" + conditions = append(conditions, fmt.Sprintf("(lower(COALESCE(actor_name,'')) LIKE %s OR lower(action) LIKE %s OR lower(summary) LIKE %s OR lower(entity_type) LIKE %s)", sqlText(needle), sqlText(needle), sqlText(needle), sqlText(needle))) + } + if action = strings.TrimSpace(action); action != "" { + conditions = append(conditions, "action="+sqlText(action)) + } + switch result { + case "success": + conditions = append(conditions, "success=true") + case "failure": + conditions = append(conditions, "success=false") + } + where := strings.Join(conditions, " AND ") + var out []AuditEntry + q := fmt.Sprintf(`SELECT COALESCE(json_agg(json_build_object('id',id,'actor_name',COALESCE(actor_name,''),'action',action,'entity_type',entity_type,'entity_id',COALESCE(entity_id,0),'summary',summary,'success',success,'ip_address',COALESCE(ip_address,''),'created_at',created_at) ORDER BY created_at DESC),'[]'::json)::text FROM (SELECT * FROM landwelle.audit_events WHERE %s ORDER BY created_at DESC LIMIT %d OFFSET %d) a;`, where, perPage, (page-1)*perPage) + if err := a.database.queryJSON(ctx, q, &out); err != nil { + return nil, 0, 0, 0, 0, 0, err + } + var stats []struct { + Total int `json:"total"` + Success int `json:"success"` + Failure int `json:"failure"` + Actors int `json:"actors"` + Today int `json:"today"` + } + q = fmt.Sprintf(`SELECT json_build_array(json_build_object('total',count(*)::int,'success',count(*) FILTER(WHERE success)::int,'failure',count(*) FILTER(WHERE NOT success)::int,'actors',count(DISTINCT actor_name)::int,'today',count(*) FILTER(WHERE created_at>=date_trunc('day',now()))::int))::text FROM landwelle.audit_events WHERE %s;`, where) + if err := a.database.queryJSON(ctx, q, &stats); err != nil { + return out, 0, 0, 0, 0, 0, err + } + if len(stats) == 0 { + return out, 0, 0, 0, 0, 0, nil + } + st := stats[0] + return out, st.Total, st.Success, st.Failure, st.Actors, st.Today, nil +} + +func compactAdminPages(current, total int) []int { + if total <= 7 { + out := make([]int, total) + for i := 1; i <= total; i++ { + out[i-1] = i + } + return out + } + seen := map[int]bool{} + vals := []int{1, current - 1, current, current + 1, total} + out := []int{} + for _, v := range vals { + if v >= 1 && v <= total && !seen[v] { + seen[v] = true + out = append(out, v) + } + } + sort.Ints(out) + return out +} diff --git a/admin_management_test.go b/admin_management_test.go new file mode 100644 index 0000000..55d8bcc --- /dev/null +++ b/admin_management_test.go @@ -0,0 +1,45 @@ +package main + +import ( + "encoding/json" + "testing" +) + +func TestNormalizeEventAdminTab(t *testing.T) { + tests := map[string]string{ + "": "hub", + "hub": "hub", + "submissions": "submissions", + "Einsendungen": "submissions", + "unknown": "hub", + } + for input, want := range tests { + if got := normalizeEventAdminTab(input); got != want { + t.Fatalf("normalizeEventAdminTab(%q)=%q, want %q", input, got, want) + } + } +} + +func TestAdminEventRowMapsSourceTypeFromDatabaseJSON(t *testing.T) { + var rows []AdminEventRow + payload := `[{ + "id": 42, + "title": "Dorffest", + "source_name": "Eigene Einsendung", + "source_type": "submission", + "homepage_favorite": false, + "start_at": "2026-08-01T18:00:00Z" + }]` + if err := json.Unmarshal([]byte(payload), &rows); err != nil { + t.Fatalf("json.Unmarshal: %v", err) + } + if len(rows) != 1 { + t.Fatalf("len(rows)=%d, want 1", len(rows)) + } + if rows[0].SourceType != "submission" { + t.Fatalf("SourceType=%q, want submission", rows[0].SourceType) + } + if rows[0].SourceName != "Eigene Einsendung" { + t.Fatalf("SourceName=%q, want Eigene Einsendung", rows[0].SourceName) + } +} diff --git a/admin_navigation.go b/admin_navigation.go new file mode 100644 index 0000000..5ce886d --- /dev/null +++ b/admin_navigation.go @@ -0,0 +1,131 @@ +package main + +import ( + "context" + "net/http" + "strconv" + "strings" +) + +type adminNavigationData struct { + Username string + CSRFToken string + Items []NavigationItem + Roots []NavigationItem + Edit NavigationItem + DatabaseReady bool + Error string + Success string +} + +func (a *adminHandler) adminNavigation(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + if r.Method == http.MethodPost { + if a.navigation == nil { + a.renderNavigationAdmin(w, session, adminNavigationData{Error: "Die Navigationsverwaltung ist derzeit nicht verfügbar."}) + return + } + r.Body = http.MaxBytesReader(w, r.Body, 128<<10) + if err := r.ParseForm(); err != nil { + a.renderNavigationAdmin(w, session, adminNavigationData{Error: "Das Formular konnte nicht gelesen werden."}) + return + } + if !validAdminCSRF(r, session) { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + action := strings.TrimSpace(r.FormValue("action")) + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if action == "delete" { + if err := a.navigation.Delete(r.Context(), id); err != nil { + a.audit(r.Context(), session, r, "navigation.delete", "navigation_item", id, err.Error(), false) + a.renderNavigationAdmin(w, session, adminNavigationData{Error: err.Error()}) + return + } + a.audit(r.Context(), session, r, "navigation.delete", "navigation_item", id, "Menüpunkt gelöscht", true) + http.Redirect(w, r, "/admin/navigation?deleted=1", http.StatusSeeOther) + return + } + if action != "save" { + a.renderNavigationAdmin(w, session, adminNavigationData{Error: "Ungültige Aktion."}) + return + } + parentID, _ := strconv.ParseInt(r.FormValue("parent_id"), 10, 64) + sortOrder, _ := strconv.Atoi(r.FormValue("sort_order")) + item := NavigationItem{ID: id, ParentID: parentID, Label: strings.TrimSpace(r.FormValue("label")), URL: strings.TrimSpace(r.FormValue("url")), SortOrder: sortOrder, Active: r.FormValue("active") == "on", OpenNew: r.FormValue("open_new") == "on"} + savedID, err := a.navigation.Save(r.Context(), item) + if err != nil { + a.audit(r.Context(), session, r, "navigation.save", "navigation_item", id, err.Error(), false) + a.renderNavigationAdmin(w, session, adminNavigationData{Error: err.Error(), Edit: item}) + return + } + a.audit(r.Context(), session, r, "navigation.save", "navigation_item", savedID, "Menüpunkt gespeichert: "+item.Label, true) + http.Redirect(w, r, "/admin/navigation?saved=1", http.StatusSeeOther) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, HEAD, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + data := adminNavigationData{} + if r.URL.Query().Get("saved") == "1" { + data.Success = "Der Menüpunkt wurde gespeichert." + } + if r.URL.Query().Get("deleted") == "1" { + data.Success = "Der Menüpunkt und gegebenenfalls seine Unterpunkte wurden gelöscht." + } + if editID, _ := strconv.ParseInt(r.URL.Query().Get("edit"), 10, 64); editID > 0 { + items, _ := a.navigation.ListAdmin(r.Context()) + if item, found := findNavigationItem(items, editID); found { + data.Edit = item + } + } + a.renderNavigationAdmin(w, session, data) +} + +func findNavigationItem(items []NavigationItem, id int64) (NavigationItem, bool) { + for _, item := range items { + if item.ID == id { + return item, true + } + for _, child := range item.Children { + if child.ID == id { + return child, true + } + } + } + return NavigationItem{}, false +} + +func (a *adminHandler) renderNavigationAdmin(w http.ResponseWriter, session adminSession, data adminNavigationData) { + data.Username = session.Username + data.CSRFToken = session.CSRFToken + data.DatabaseReady = a.navigation != nil && a.navigation.db != nil && a.navigation.db.Enabled() + if data.DatabaseReady { + items, err := a.navigation.ListAdmin(context.Background()) + if err != nil { + data.Error = "Navigation konnte nicht geladen werden: " + err.Error() + } else { + data.Items = items + data.Roots = make([]NavigationItem, 0, len(items)) + for _, item := range items { + if item.ID != data.Edit.ID { + data.Roots = append(data.Roots, item) + } + } + } + } + if data.Edit.ID == 0 && data.Edit.SortOrder == 0 { + data.Edit.Active = true + data.Edit.SortOrder = 100 + } + setAdminHTMLHeaders(w) + if err := a.navigationTemplate.ExecuteTemplate(w, "navigation-admin.html", data); err != nil { + a.logger.Printf("admin navigation template: %v", err) + } +} diff --git a/admin_navigation_regression_test.go b/admin_navigation_regression_test.go new file mode 100644 index 0000000..ab012d3 --- /dev/null +++ b/admin_navigation_regression_test.go @@ -0,0 +1,67 @@ +package main + +import ( + "os" + "strings" + "testing" +) + +func TestAdminSidebarHasRouteAwareNavigation(t *testing.T) { + html := adminNavigationHTML() + for _, expected := range []string{ + `data-admin-navigation`, + `data-admin-nav-group="content"`, + `data-admin-nav-group="community"`, + `data-admin-nav-group="ai"`, + `data-admin-nav-group="publishing"`, + `data-admin-nav-group="users"`, + `data-admin-nav-group="system"`, + `/assets/admin-sidebar-v2.js`, + } { + if !strings.Contains(html, expected) { + t.Fatalf("Adminnavigation fehlt %q", expected) + } + } +} + +func TestAdminSidebarAssetsContainActiveStateLogic(t *testing.T) { + raw, err := os.ReadFile("web/assets/admin-sidebar-v2.js") + if err != nil { + t.Fatal(err) + } + js := string(raw) + for _, expected := range []string{`aria-current`, `currentGroup`, `group.open = isCurrent`, `hashchange`} { + if !strings.Contains(js, expected) { + t.Fatalf("Sidebar-JavaScript fehlt %q", expected) + } + } + cssRaw, err := os.ReadFile("web/assets/admin-v36.css") + if err != nil { + t.Fatal(err) + } + css := string(cssRaw) + for _, expected := range []string{`.admin-navigation-v37`, `[aria-current="page"]`, `details.is-current`, `overflow-y:auto`} { + if !strings.Contains(css, expected) { + t.Fatalf("Sidebar-CSS fehlt %q", expected) + } + } +} + +func TestAllAdminPagesUseVersionedSidebarCSS(t *testing.T) { + entries, err := os.ReadDir("web/admin") + if err != nil { + t.Fatal(err) + } + for _, entry := range entries { + if entry.IsDir() || !strings.HasSuffix(entry.Name(), ".html") { + continue + } + raw, err := os.ReadFile("web/admin/" + entry.Name()) + if err != nil { + t.Fatal(err) + } + if strings.Contains(string(raw), `/assets/admin-v35.css`) { + t.Fatalf("%s verwendet noch admin-v35.css", entry.Name()) + } + } +} diff --git a/admin_push.go b/admin_push.go new file mode 100644 index 0000000..0ce907a --- /dev/null +++ b/admin_push.go @@ -0,0 +1,211 @@ +package main + +import ( + "context" + "fmt" + "net/http" + "strconv" + "strings" + "time" +) + +type adminPushTopic struct { + Slug string `json:"slug"` + Name string `json:"name"` + Description string `json:"description"` + Kind string `json:"kind"` +} + +type adminPushCampaignRow struct { + ID int64 `json:"id"` + Title string `json:"title"` + Body string `json:"body"` + Topic string `json:"topic"` + DeepLink string `json:"deep_link"` + Status string `json:"status"` + SentCount int `json:"sent_count"` + FailedCount int `json:"failed_count"` + OpenedCount int `json:"opened_count"` + CreatedAt string `json:"created_at"` +} + +type adminPushStats struct { + Installations int `json:"installations"` + PushEnabled int `json:"push_enabled"` + ActiveTokens int `json:"active_tokens"` + Campaigns int `json:"campaigns"` + Sent int `json:"sent"` + Failed int `json:"failed"` + Opened int `json:"opened"` +} + +type adminPushData struct { + Username string + CSRFToken string + DatabaseReady bool + FirebaseReady bool + FirebaseState string + EncryptionOK bool + Topics []adminPushTopic + Campaigns []adminPushCampaignRow + Stats adminPushStats + Title string + Body string + Topic string + DeepLink string + Error string + Success string +} + +func (a *adminHandler) adminAppPush(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + data := adminPushData{ + Username: session.Username, + CSRFToken: session.CSRFToken, + DatabaseReady: a.database != nil && a.database.Enabled(), + EncryptionOK: appPushEncryptionConfigured(), + Topic: "breaking-news", + DeepLink: "landwelle://aktuelles", + } + if a.firebasePush != nil { + data.FirebaseReady = a.firebasePush.Ready() + data.FirebaseState = a.firebasePush.Status() + } else { + data.FirebaseState = "Nicht initialisiert" + } + + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 64<<10) + if err := r.ParseForm(); err != nil { + data.Error = "Das Push-Formular konnte nicht gelesen werden." + a.renderAdminAppPush(w, data) + return + } + if !validAdminCSRF(r, session) { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + data.Title = strings.TrimSpace(r.FormValue("title")) + data.Body = strings.TrimSpace(r.FormValue("body")) + data.Topic = strings.ToLower(strings.TrimSpace(r.FormValue("topic"))) + data.DeepLink = strings.TrimSpace(r.FormValue("deep_link")) + if data.Topic == "" { + data.Topic = "breaking-news" + } + if data.DeepLink == "" { + data.DeepLink = "landwelle://aktuelles" + } + if data.Title == "" || data.Body == "" { + data.Error = "Titel und Nachricht sind erforderlich." + } else if len([]rune(data.Title)) > 160 || len([]rune(data.Body)) > 500 { + data.Error = "Titel oder Nachricht ist zu lang." + } else if !data.DatabaseReady { + data.Error = "PostgreSQL ist für App-Push nicht verfügbar." + } else if !data.EncryptionOK { + data.Error = "LANDWELLE_APP_PUSH_ENCRYPTION_KEY ist nicht korrekt konfiguriert." + } else if a.firebasePush == nil || !a.firebasePush.Ready() { + data.Error = "Firebase Push ist nicht bereit: " + data.FirebaseState + } else { + ctx, cancel := context.WithTimeout(r.Context(), 3*time.Minute) + result, err := a.firebasePush.SendAppCampaign(ctx, appPushCampaignInput{ + Title: data.Title, + Body: data.Body, + Topic: data.Topic, + DeepLink: data.DeepLink, + Priority: "high", + CreatedBy: session.UserID, + Data: map[string]string{ + "type": "news", + "title": data.Title, + "body": data.Body, + }, + }) + cancel() + if err != nil { + data.Error = "Push konnte nicht vollständig versendet werden: " + err.Error() + a.audit(r.Context(), session, r, "app_push.send", "push_campaign", result.CampaignID, data.Error, false) + } else { + data.Success = fmt.Sprintf("Push-Kampagne #%d abgeschlossen: %d Empfänger, %d erfolgreich, %d fehlgeschlagen.", result.CampaignID, result.Recipients, result.Sent, result.Failed) + a.audit(r.Context(), session, r, "app_push.send", "push_campaign", result.CampaignID, data.Success, true) + data.Title, data.Body = "", "" + } + } + } else if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, HEAD, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + + a.renderAdminAppPush(w, data) +} + +func (a *adminHandler) renderAdminAppPush(w http.ResponseWriter, data adminPushData) { + if data.DatabaseReady { + ctx, cancel := context.WithTimeout(context.Background(), 8*time.Second) + defer cancel() + if topics, err := a.loadAdminPushTopics(ctx); err == nil { + data.Topics = topics + } else if data.Error == "" { + data.Error = "Push-Themen konnten nicht geladen werden: " + err.Error() + } + if campaigns, err := a.loadAdminPushCampaigns(ctx, 50); err == nil { + data.Campaigns = campaigns + } else if data.Error == "" { + data.Error = "Push-Historie konnte nicht geladen werden: " + err.Error() + } + if stats, err := a.loadAdminPushStats(ctx); err == nil { + data.Stats = stats + } + } + setAdminHTMLHeaders(w) + if err := a.pushTemplate.ExecuteTemplate(w, "push-admin.html", data); err != nil { + a.logger.Printf("admin push template: %v", err) + } +} + +func (a *adminHandler) loadAdminPushTopics(ctx context.Context) ([]adminPushTopic, error) { + var rows []adminPushTopic + q := `SELECT COALESCE(json_agg(row_to_json(x)),'[]'::json)::text FROM (` + + `SELECT slug,name,COALESCE(description,'') description,kind FROM push_topics WHERE active=true ORDER BY kind,name) x;` + if err := a.database.queryJSON(ctx, q, &rows); err != nil { + return nil, err + } + return rows, nil +} + +func (a *adminHandler) loadAdminPushCampaigns(ctx context.Context, limit int) ([]adminPushCampaignRow, error) { + if limit < 1 || limit > 200 { + limit = 50 + } + var rows []adminPushCampaignRow + q := `SELECT COALESCE(json_agg(row_to_json(x)),'[]'::json)::text FROM (` + + `SELECT id,title,body,COALESCE(target->'topics'->>0,'') topic,COALESCE(deep_link,'') deep_link,status,sent_count,failed_count,opened_count,to_char(created_at AT TIME ZONE 'Europe/Berlin','DD.MM.YYYY HH24:MI') created_at ` + + `FROM push_campaigns ORDER BY created_at DESC LIMIT ` + strconv.Itoa(limit) + `) x;` + if err := a.database.queryJSON(ctx, q, &rows); err != nil { + return nil, err + } + return rows, nil +} + +func (a *adminHandler) loadAdminPushStats(ctx context.Context) (adminPushStats, error) { + var rows []adminPushStats + q := `SELECT json_build_array(json_build_object(` + + `'installations',(SELECT count(*)::int FROM app_installations WHERE status='active'),` + + `'push_enabled',(SELECT count(*)::int FROM app_installations WHERE status='active' AND notifications_enabled=true),` + + `'active_tokens',(SELECT count(*)::int FROM app_push_tokens WHERE active=true AND provider='fcm'),` + + `'campaigns',(SELECT count(*)::int FROM push_campaigns),` + + `'sent',(SELECT COALESCE(sum(sent_count),0)::int FROM push_campaigns),` + + `'failed',(SELECT COALESCE(sum(failed_count),0)::int FROM push_campaigns),` + + `'opened',(SELECT COALESCE(sum(opened_count),0)::int FROM push_campaigns)))::text;` + if err := a.database.queryJSON(ctx, q, &rows); err != nil { + return adminPushStats{}, err + } + if len(rows) == 0 { + return adminPushStats{}, nil + } + return rows[0], nil +} diff --git a/admin_site_content.go b/admin_site_content.go new file mode 100644 index 0000000..e9543d6 --- /dev/null +++ b/admin_site_content.go @@ -0,0 +1,357 @@ +package main + +import ( + "encoding/json" + "html/template" + "net/http" + "strconv" + "strings" + "time" +) + +type adminSiteContentData struct { + Username string + CSRFToken string + Navigation template.HTML + Section string + Title string + Page ManagedPublicPage + EditBlock *PublicPageBlock + Contacts []ContactMessage + ContactTab string + NewContacts int + Error string + Success string +} + +type adminGeneratedAudio struct { + NewsProduction + Imported bool +} + +type adminMediathekData struct { + Username string + CSRFToken string + Navigation template.HTML + Entries []MediathekEntry + Edit *MediathekEntry + Media []MediaAsset + Generated []adminGeneratedAudio + Error string + Success string +} + +type adminAnalyticsData struct { + Username string + Navigation template.HTML + Summary AnalyticsSummary + ChartJSON string + Error string +} + +func adminContentKey(path string) string { + switch path { + case "/admin/ueber-landwelle": + return "ueber-landwelle" + case "/admin/presse": + return "presse" + case "/admin/karriere": + return "karriere" + case "/admin/faq": + return "faq" + case "/admin/kontakt": + return "kontakt" + default: + return "" + } +} + +func adminContentTitle(key string) string { + switch key { + case "ueber-landwelle": + return "Über Landwelle" + case "presse": + return "Pressebereich" + case "karriere": + return "Karriereseite" + case "faq": + return "FAQ verwalten" + case "kontakt": + return "Kontakt & Nachrichten" + default: + return "Inhaltsseite" + } +} + +func (a *adminHandler) adminSiteContent(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + key := adminContentKey(r.URL.Path) + if key == "" { + http.NotFound(w, r) + return + } + data := adminSiteContentData{Username: session.Username, CSRFToken: session.CSRFToken, Navigation: template.HTML(adminNavigationHTML()), Section: key, Title: adminContentTitle(key), ContactTab: normalizeContactStatus(r.URL.Query().Get("status"))} + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 256<<10) + if err := r.ParseForm(); err != nil || r.FormValue("csrf_token") != session.CSRFToken { + http.Error(w, "Ungültige Sicherheitsprüfung", http.StatusForbidden) + return + } + action := strings.TrimSpace(r.FormValue("action")) + switch action { + case "save_page": + if err := a.siteContent.SavePage(r.Context(), key, r.FormValue("kicker"), r.FormValue("title"), r.FormValue("lead"), r.FormValue("contact_email")); err != nil { + data.Error = err.Error() + } else { + a.audit(r.Context(), session, r, "content.page.save", "public_page", 0, "Inhaltsseite "+key+" gespeichert", true) + data.Success = "Seitentitel und Einleitung wurden gespeichert." + } + case "save_block": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + order, _ := strconv.Atoi(r.FormValue("sort_order")) + block := PublicPageBlock{ID: id, PageKey: key, Title: r.FormValue("block_title"), Body: r.FormValue("body"), CTALabel: r.FormValue("cta_label"), CTAURL: r.FormValue("cta_url"), SortOrder: order, Active: r.FormValue("active") == "on"} + if err := a.siteContent.SaveBlock(r.Context(), block); err != nil { + data.Error = err.Error() + } else { + a.audit(r.Context(), session, r, "content.block.save", "public_page_block", id, "Inhaltsblock auf "+key+" gespeichert", true) + data.Success = "Inhaltsblock wurde gespeichert." + } + case "delete_block": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if err := a.siteContent.DeleteBlock(r.Context(), key, id); err != nil { + data.Error = err.Error() + } else { + a.audit(r.Context(), session, r, "content.block.delete", "public_page_block", id, "Inhaltsblock auf "+key+" gelöscht", true) + data.Success = "Inhaltsblock wurde gelöscht." + } + case "contact_status": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if key != "kontakt" { + data.Error = "Diese Aktion ist hier nicht verfügbar." + } else if err := a.siteContent.UpdateContactStatus(r.Context(), id, r.FormValue("status")); err != nil { + data.Error = err.Error() + } else { + a.audit(r.Context(), session, r, "contact.status", "contact_message", id, "Kontaktanfrage aktualisiert", true) + data.Success = "Nachrichtenstatus wurde aktualisiert." + } + default: + data.Error = "Unbekannte Aktion." + } + } + page, err := a.siteContent.Page(r.Context(), key) + if err != nil { + data.Error = err.Error() + } + data.Page = page + if editID, _ := strconv.ParseInt(r.URL.Query().Get("edit"), 10, 64); editID > 0 { + for i := range page.Blocks { + if page.Blocks[i].ID == editID { + copyBlock := page.Blocks[i] + data.EditBlock = ©Block + break + } + } + } + if key == "kontakt" { + contacts, err := a.siteContent.ContactMessages(r.Context(), data.ContactTab) + if err != nil && data.Error == "" { + data.Error = err.Error() + } + data.Contacts = contacts + all, _ := a.siteContent.ContactMessages(r.Context(), "new") + data.NewContacts = len(all) + } + setAdminHTMLHeaders(w) + if err := a.siteContentTemplate.ExecuteTemplate(w, "admin-site-content.html", data); err != nil { + a.logger.Printf("admin site content template: %v", err) + } +} + +func parseAdminMediathekTime(raw string) time.Time { + for _, layout := range []string{"2006-01-02T15:04", "2006-01-02"} { + if t, err := time.ParseInLocation(layout, strings.TrimSpace(raw), time.Local); err == nil { + return t + } + } + return time.Now() +} + +func (a *adminHandler) adminMediathek(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + data := adminMediathekData{Username: session.Username, CSRFToken: session.CSRFToken, Navigation: template.HTML(adminNavigationHTML())} + if r.Method == http.MethodPost { + r.Body = http.MaxBytesReader(w, r.Body, 125<<20) + if err := r.ParseMultipartForm(125 << 20); err != nil || r.FormValue("csrf_token") != session.CSRFToken { + http.Error(w, "Ungültige Eingabe oder Sicherheitsprüfung", http.StatusBadRequest) + return + } + action := strings.TrimSpace(r.FormValue("action")) + switch action { + case "save": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + audioURL := strings.TrimSpace(r.FormValue("audio_url")) + if file, header, err := r.FormFile("audio_file"); err == nil { + defer file.Close() + if uploaded, uploadErr := a.siteContent.SaveAudioUpload(file, header); uploadErr != nil { + data.Error = uploadErr.Error() + } else { + audioURL = uploaded + } + } + entry := MediathekEntry{ID: id, SourceKey: r.FormValue("source_key"), Title: r.FormValue("title"), Subtitle: r.FormValue("subtitle"), Description: r.FormValue("description"), Kind: r.FormValue("kind"), AudioURL: audioURL, CoverURL: r.FormValue("cover_url"), DurationLabel: r.FormValue("duration_label"), EpisodeLabel: r.FormValue("episode_label"), PublishedAt: parseAdminMediathekTime(r.FormValue("published_at")), Active: r.FormValue("active") == "on", Featured: r.FormValue("featured") == "on", AIUsage: r.FormValue("ai_usage"), AIVoice: r.FormValue("ai_voice") == "on", AIHumanReviewed: r.FormValue("ai_human_reviewed") == "on", AIEditorialResponsible: r.FormValue("ai_editorial_responsible"), AIDisclosure: r.FormValue("ai_disclosure")} + if data.Error == "" { + if err := a.siteContent.SaveMediathek(r.Context(), entry); err != nil { + data.Error = err.Error() + } else { + a.audit(r.Context(), session, r, "mediathek.save", "mediathek_entry", id, "Mediathek-Eintrag gespeichert: "+entry.Title, true) + data.Success = "Mediathek-Eintrag wurde gespeichert." + } + } + case "import_ai": + productionID := strings.TrimSpace(r.FormValue("production_id")) + if a.newsStudio == nil || a.ai == nil || a.media == nil { + data.Error = "Das Nachrichtenstudio oder der Medienspeicher ist nicht verfügbar." + break + } + _, history := a.newsStudio.Get() + var production *NewsProduction + for i := range history { + if history[i].ID == productionID { + copyProduction := history[i] + production = ©Production + break + } + } + if production == nil || production.Status != "done" || strings.TrimSpace(production.AudioFile) == "" { + data.Error = "Der erzeugte Audiobeitrag wurde nicht gefunden oder ist nicht vollständig." + break + } + sourceKey := "news-studio:" + production.ID + exists, err := a.siteContent.MediathekSourceExists(r.Context(), sourceKey) + if err != nil { + data.Error = err.Error() + break + } + if exists { + data.Error = "Dieser Beitrag wurde bereits in die Mediathek übernommen." + break + } + localPath, found := a.ai.AudioPath(production.AudioFile) + if !found { + data.Error = "Die lokale Audiodatei ist nicht mehr vorhanden." + break + } + audioURL, err := a.media.SaveAudioFile(localPath) + if err != nil { + data.Error = "Audio konnte nicht in den öffentlichen Medienspeicher übernommen werden: " + err.Error() + break + } + title := production.ChannelLabel + " vom " + production.CreatedAt.Local().Format("02.01.2006") + if production.OutputNumber > 0 { + title += " – Beitrag " + strconv.Itoa(production.OutputNumber) + } + entry := MediathekEntry{SourceKey: sourceKey, Title: title, Subtitle: "Aus dem Landwelle Nachrichtenstudio", Description: strings.TrimSpace(production.Text), Kind: "ki_beitrag", AudioURL: audioURL, EpisodeLabel: production.ChannelLabel, PublishedAt: production.CreatedAt, Active: false, AIUsage: "generated", AIVoice: true, AIEditorialResponsible: "Landwelle Redaktion", AIDisclosure: "Diese Audioaufnahme wurde mit künstlicher Intelligenz erstellt und von einer synthetischen Stimme gesprochen."} + if err := a.siteContent.SaveMediathek(r.Context(), entry); err != nil { + data.Error = err.Error() + } else { + a.audit(r.Context(), session, r, "mediathek.ai.import", "news_production", 0, "KI-Audio als Mediathek-Entwurf übernommen: "+title, true) + data.Success = "Der KI-Beitrag wurde als Mediathek-Entwurf übernommen. Prüfe Titel und Text und schalte ihn anschließend öffentlich." + } + case "delete": + id, _ := strconv.ParseInt(r.FormValue("id"), 10, 64) + if err := a.siteContent.DeleteMediathek(r.Context(), id); err != nil { + data.Error = err.Error() + } else { + a.audit(r.Context(), session, r, "mediathek.delete", "mediathek_entry", id, "Mediathek-Eintrag gelöscht", true) + data.Success = "Mediathek-Eintrag wurde gelöscht." + } + default: + data.Error = "Unbekannte Mediathek-Aktion." + } + } + entries, err := a.siteContent.Mediathek(r.Context(), true) + if err != nil && data.Error == "" { + data.Error = err.Error() + } + data.Entries = entries + importedSources := make(map[string]bool, len(entries)) + for _, entry := range entries { + if entry.SourceKey != "" { + importedSources[entry.SourceKey] = true + } + } + if a.newsStudio != nil && a.ai != nil { + _, history := a.newsStudio.Get() + for _, production := range history { + if production.Status != "done" || strings.TrimSpace(production.AudioFile) == "" { + continue + } + if _, found := a.ai.AudioPath(production.AudioFile); !found { + continue + } + data.Generated = append(data.Generated, adminGeneratedAudio{NewsProduction: production, Imported: importedSources["news-studio:"+production.ID]}) + if len(data.Generated) >= 12 { + break + } + } + } + if editID, _ := strconv.ParseInt(r.URL.Query().Get("edit"), 10, 64); editID > 0 { + for i := range entries { + if entries[i].ID == editID { + copyEntry := entries[i] + data.Edit = ©Entry + break + } + } + } + if a.media != nil && a.media.Enabled() { + data.Media, _ = a.media.List(r.Context()) + if len(data.Media) > 80 { + data.Media = data.Media[:80] + } + } + setAdminHTMLHeaders(w) + if err := a.mediathekTemplate.ExecuteTemplate(w, "admin-mediathek.html", data); err != nil { + a.logger.Printf("admin mediathek template: %v", err) + } +} + +func (a *adminHandler) adminAnalytics(w http.ResponseWriter, r *http.Request) { + _, session, ok := a.sessionFromRequest(r) + if !ok { + http.Redirect(w, r, "/admin/login", http.StatusSeeOther) + return + } + days := analyticsDays(r.URL.Query().Get("days")) + if export := strings.TrimSpace(r.URL.Query().Get("export")); export != "" { + if err := a.analytics.ExportCSV(w, r, days, export); err != nil { + http.Error(w, "Export konnte nicht erstellt werden: "+err.Error(), http.StatusInternalServerError) + } + return + } + summary, err := a.analytics.Summary(r.Context(), days) + data := adminAnalyticsData{Username: session.Username, Navigation: template.HTML(adminNavigationHTML()), Summary: summary, ChartJSON: analyticsChartJSON(summary.Daily)} + if err != nil { + data.Error = err.Error() + } + setAdminHTMLHeaders(w) + if err := a.analyticsTemplate.ExecuteTemplate(w, "admin-analytics.html", data); err != nil { + a.logger.Printf("admin analytics template: %v", err) + } +} + +func analyticsTemplateJSON(value string) template.JS { + var raw json.RawMessage + if json.Unmarshal([]byte(value), &raw) != nil { + return template.JS("[]") + } + return template.JS(value) +} diff --git a/admin_test.go b/admin_test.go new file mode 100644 index 0000000..5b65c2b --- /dev/null +++ b/admin_test.go @@ -0,0 +1,50 @@ +package main + +import ( + "io" + "log" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" +) + +func TestAdminRequiresLoginAndCreatesSession(t *testing.T) { + t.Setenv("LANDWELLE_ADMIN_USER", "admin") + t.Setenv("LANDWELLE_ADMIN_PASSWORD", "Ein-sicheres-Testpasswort-2026") + t.Setenv("LANDWELLE_ADMIN_PASSWORD_HASH", "") + + settings := &settingsStore{path: t.TempDir() + "/settings.json", settings: defaultRuntimeSettings(defaultStreamURL)} + runtime := settings.Get() + runtime.AzuraCast.Enabled = false + settings.settings = runtime + now := newNowPlayingService(settings, log.New(io.Discard, "", 0)) + downloads := &downloadStore{dir: t.TempDir(), meta: make(map[string]downloadMetadata)} + handler, err := newAdminHandler(log.New(io.Discard, "", 0), NewWeatherService(), pageData(), settings, now, &programStore{path: t.TempDir() + "/program.json", items: defaultProgram()}, downloads) + if err != nil { + t.Fatalf("newAdminHandler: %v", err) + } + mux := http.NewServeMux() + handler.register(mux) + + req := httptest.NewRequest(http.MethodGet, "http://example.test/admin", nil) + rec := httptest.NewRecorder() + mux.ServeHTTP(rec, req) + if rec.Code != http.StatusSeeOther || rec.Header().Get("Location") != "/admin/login" { + t.Fatalf("expected login redirect, got %d %q", rec.Code, rec.Header().Get("Location")) + } + + form := url.Values{"username": {"admin"}, "password": {"Ein-sicheres-Testpasswort-2026"}} + req = httptest.NewRequest(http.MethodPost, "http://example.test/admin/login", strings.NewReader(form.Encode())) + req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + rec = httptest.NewRecorder() + mux.ServeHTTP(rec, req) + if rec.Code != http.StatusSeeOther || rec.Header().Get("Location") != "/admin" { + t.Fatalf("expected dashboard redirect, got %d %q", rec.Code, rec.Header().Get("Location")) + } + cookies := rec.Result().Cookies() + if len(cookies) == 0 || cookies[0].Name != adminCookieName || !cookies[0].HttpOnly { + t.Fatalf("secure admin session cookie missing: %#v", cookies) + } +} diff --git a/admin_users_test.go b/admin_users_test.go new file mode 100644 index 0000000..2e8ead5 --- /dev/null +++ b/admin_users_test.go @@ -0,0 +1,43 @@ +package main + +import ( + "bytes" + "html/template" + "testing" + "time" +) + +func TestAdminUserTemplatesRender(t *testing.T) { + usersTemplate, err := template.ParseFS(webFS, "web/admin/users.html") + if err != nil { + t.Fatal(err) + } + now := time.Now() + data := adminUsersData{ + Username: "admin", CSRFToken: "test", Navigation: template.HTML(""), Title: "Administratoren", + Description: "Test", BasePath: "/admin/users/admins", DatabaseReady: true, Page: 1, PerPage: 20, + TotalPages: 1, Edit: ManagedUser{Role: "administrator", Active: true}, + Items: []ManagedUser{{ID: 1, Username: "jens", Email: "jens@example.de", DisplayName: "Jens", Role: "administrator", RoleName: "Administrator", Active: true, EmailVerified: true, CreatedAt: now, UpdatedAt: now}}, + Roles: []UserRole{{Slug: "administrator", Name: "Administrator", Active: true}}, + } + var out bytes.Buffer + if err := usersTemplate.ExecuteTemplate(&out, "users-admin.html", data); err != nil { + t.Fatal(err) + } + if out.Len() == 0 { + t.Fatal("empty users template") + } + + rolesTemplate, err := template.ParseFS(webFS, "web/admin/roles.html") + if err != nil { + t.Fatal(err) + } + out.Reset() + rolesData := adminRolesData{Username: "admin", CSRFToken: "test", Navigation: template.HTML(""), DatabaseReady: true, Roles: []UserRole{{Slug: "administrator", Name: "Administrator", Active: true, Permissions: []Permission{{Slug: "users.manage", Name: "Benutzer verwalten", Granted: true}}}}} + if err := rolesTemplate.ExecuteTemplate(&out, "roles-admin.html", rolesData); err != nil { + t.Fatal(err) + } + if out.Len() == 0 { + t.Fatal("empty roles template") + } +} diff --git a/adsense_v1547_test.go b/adsense_v1547_test.go new file mode 100644 index 0000000..e780a0c --- /dev/null +++ b/adsense_v1547_test.go @@ -0,0 +1,50 @@ +package main + +import ( + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +func TestV1547SEOHeadIncludesGoogleAdSenseOnPublicPages(t *testing.T) { + got := string(seoHead("Testseite", "Beschreibung", "/test", "website")) + const src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2125179191990189" + if !strings.Contains(got, ``) + // Ein ausreichend großer erster Block verhindert, dass Reverse-Proxys die + // Fortschrittsanzeige bis zum Ende der Produktion puffern. + _, _ = fmt.Fprint(w, "\n") + if canFlush { + flusher.Flush() + } + + lastUpdated := time.Time{} + ticker := time.NewTicker(750 * time.Millisecond) + defer ticker.Stop() + timeout := time.NewTimer(13 * time.Minute) + defer timeout.Stop() + + send := func(job AIJob) { + payload, err := json.Marshal(job) + if err != nil { + return + } + _, _ = fmt.Fprintf(w, "\n", payload) + if canFlush { + flusher.Flush() + } + } + + for { + job, ok := a.aiJobs.Get(jobID) + if !ok { + job = AIJob{ID: jobID, Status: "error", Error: "Der Produktionsauftrag wurde nicht gefunden oder der Server wurde neu gestartet."} + send(job) + _, _ = fmt.Fprint(w, "") + return + } + if lastUpdated.IsZero() || job.UpdatedAt.After(lastUpdated) { + send(job) + lastUpdated = job.UpdatedAt + } + if job.Status == "done" || job.Status == "error" { + _, _ = fmt.Fprint(w, "") + return + } + select { + case <-r.Context().Done(): + // Das Schließen des Modals beendet nur die Anzeige. Der bereits gestartete + // Produktionsjob läuft serverseitig weiter. + return + case <-timeout.C: + job.Status = "error" + job.Error = "Die Live-Anzeige wurde nach 13 Minuten beendet. Bitte die Produktionshistorie prüfen." + send(job) + _, _ = fmt.Fprint(w, "") + return + case <-ticker.C: + // Kleiner Heartbeat hält die Proxy-Verbindung offen, ohne JSON-Polling. + _, _ = fmt.Fprint(w, "\n") + if canFlush { + flusher.Flush() + } + } + } +} + +type AIAutoTask struct { + ID int64 `json:"id"` + Name string `json:"name"` + TaskKey string `json:"task_key"` + RunTime string `json:"run_time"` + Days []int `json:"days"` + Active bool `json:"active"` + LastRunAt *time.Time `json:"last_run_at,omitempty"` + LastStatus string `json:"last_status"` + LastError string `json:"last_error"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` +} + +func parseDays(v string) []int { + var out []int + for _, p := range strings.Split(v, ",") { + n, e := strconv.Atoi(strings.TrimSpace(p)) + if e == nil && n >= 1 && n <= 7 { + out = append(out, n) + } + } + return out +} +func daysCSV(days []int) string { + var p []string + for _, d := range days { + p = append(p, strconv.Itoa(d)) + } + return strings.Join(p, ",") +} +func (a *adminHandler) listAutoTasks(ctx context.Context) ([]AIAutoTask, error) { + if a.database == nil || !a.database.Enabled() { + return nil, nil + } + var rows []struct { + ID int64 `json:"id"` + Name, TaskKey, RunTime, Days, LastStatus, LastError string + Active bool + LastRunAt *time.Time `json:"last_run_at"` + CreatedAt, UpdatedAt time.Time + } + q := `SELECT COALESCE(json_agg(json_build_object('id',id,'name',name,'task_key',task_key,'run_time',to_char(run_time,'HH24:MI'),'days',days,'active',active,'last_run_at',last_run_at,'last_status',last_status,'last_error',last_error,'created_at',created_at,'updated_at',updated_at) ORDER BY run_time,name),'[]'::json)::text FROM landwelle.ai_auto_tasks` + if err := a.database.queryJSON(ctx, q, &rows); err != nil { + return nil, err + } + out := make([]AIAutoTask, 0, len(rows)) + for _, r := range rows { + out = append(out, AIAutoTask{ID: r.ID, Name: r.Name, TaskKey: r.TaskKey, RunTime: r.RunTime, Days: parseDays(r.Days), Active: r.Active, LastRunAt: r.LastRunAt, LastStatus: r.LastStatus, LastError: r.LastError, CreatedAt: r.CreatedAt, UpdatedAt: r.UpdatedAt}) + } + return out, nil +} +func (a *adminHandler) saveAutoTask(ctx context.Context, t AIAutoTask) error { + if a.database == nil || !a.database.Enabled() { + return fmt.Errorf("PostgreSQL ist erforderlich") + } + days := daysCSV(t.Days) + if days == "" { + days = "1,2,3,4,5,6,7" + } + if t.ID > 0 { + _, err := a.database.exec(ctx, `UPDATE landwelle.ai_auto_tasks SET name=`+sqlText(t.Name)+`,task_key=`+sqlText(t.TaskKey)+`,run_time=`+sqlText(t.RunTime)+`::time,days=`+sqlText(days)+`,active=`+strconv.FormatBool(t.Active)+`,updated_at=now() WHERE id=`+strconv.FormatInt(t.ID, 10)) + return err + } + _, err := a.database.exec(ctx, `INSERT INTO landwelle.ai_auto_tasks(name,task_key,run_time,days,active) VALUES (`+sqlText(t.Name)+`,`+sqlText(t.TaskKey)+`,`+sqlText(t.RunTime)+`::time,`+sqlText(days)+`,`+strconv.FormatBool(t.Active)+`)`) + return err +} +func (a *adminHandler) deleteAutoTask(ctx context.Context, id int64) error { + if a.database == nil || !a.database.Enabled() { + return fmt.Errorf("PostgreSQL ist erforderlich") + } + _, err := a.database.exec(ctx, `DELETE FROM landwelle.ai_auto_tasks WHERE id=`+strconv.FormatInt(id, 10)) + return err +} + +type AICronAdminStatus struct { + TokenConfigured bool + LocalEndpoint string + PublicEndpoint string + KeyHelpCommand string + Schedule string + Timezone string + Health string + HealthLabel string + HealthText string + PreviousPingAt *time.Time + LastPingAt *time.Time + CallCount int64 + IntervalSeconds int64 + LastStatus string + LastError string + LastDueCount int + LastStartedCount int + LastDurationMS int64 +} + +func berlinLocation() *time.Location { + location, err := time.LoadLocation("Europe/Berlin") + if err != nil { + return time.FixedZone("Europe/Berlin", 3600) + } + return location +} + +func normalizeAutoTaskKey(key string) string { + return strings.ToLower(strings.TrimSpace(key)) +} + +func supportedAutoTaskKey(key string) bool { + switch normalizeAutoTaskKey(key) { + case "news:news", "news:sport", "news:weather": + return true + default: + return false + } +} + +func autoTaskIsDue(task AIAutoTask, now time.Time) bool { + if !task.Active || !supportedAutoTaskKey(task.TaskKey) { + return false + } + local := now.In(berlinLocation()) + weekday := int(local.Weekday()) + if weekday == 0 { + weekday = 7 + } + return strings.TrimSpace(task.RunTime) == local.Format("15:04") && containsInt(task.Days, weekday) +} + +func sameAutoTaskMinute(last *time.Time, now time.Time) bool { + if last == nil { + return false + } + location := berlinLocation() + return last.In(location).Format("2006-01-02 15:04") == now.In(location).Format("2006-01-02 15:04") +} + +func cronRequestAuthorized(r *http.Request) bool { + token := strings.TrimSpace(os.Getenv("LANDWELLE_CRON_TOKEN")) + if token == "" || r == nil { + return false + } + provided := strings.TrimSpace(r.Header.Get("X-Landwelle-Cron-Token")) + if provided == "" { + provided = strings.TrimSpace(r.URL.Query().Get("token")) + } + if len(token) != len(provided) { + return false + } + return subtle.ConstantTimeCompare([]byte(token), []byte(provided)) == 1 +} + +func (a *adminHandler) runDueAutoTasks(ctx context.Context) (int, int, error) { + tasks, err := a.listAutoTasks(ctx) + if err != nil { + return 0, 0, err + } + now := time.Now() + due, started := 0, 0 + for _, task := range tasks { + if !autoTaskIsDue(task, now) || sameAutoTaskMinute(task.LastRunAt, now) { + continue + } + due++ + if a.database != nil && a.database.Enabled() { + if _, err := a.database.exec(ctx, `UPDATE landwelle.ai_auto_tasks SET last_run_at=now(),last_status='queued',last_error='',updated_at=now() WHERE id=`+strconv.FormatInt(task.ID, 10)); err != nil { + if a.logger != nil { + a.logger.Printf("auto task %d could not be claimed: %v", task.ID, err) + } + continue + } + } + started++ + go a.executeAutoTask(task) + } + return due, started, nil +} + +func (a *adminHandler) handleCentralCron(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + w.Header().Set("Allow", http.MethodPost) + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + if !cronRequestAuthorized(r) { + http.Error(w, "Nicht autorisiert", http.StatusUnauthorized) + return + } + startedAt := time.Now() + due, started, runErr := a.runDueAutoTasks(r.Context()) + duration := time.Since(startedAt).Milliseconds() + status := "ok" + errText := "" + if runErr != nil { + status = "error" + errText = runErr.Error() + } + if a.database != nil && a.database.Enabled() { + _, _ = a.database.exec(r.Context(), `INSERT INTO landwelle.ai_cron_state(id,previous_ping_at,last_ping_at,call_count,last_status,last_error,last_due_count,last_started_count,last_duration_ms,updated_at) VALUES (1,NULL,now(),1,`+sqlText(status)+`,`+sqlText(errText)+`,`+strconv.Itoa(due)+`,`+strconv.Itoa(started)+`,`+strconv.FormatInt(duration, 10)+`,now()) ON CONFLICT(id) DO UPDATE SET previous_ping_at=landwelle.ai_cron_state.last_ping_at,last_ping_at=now(),call_count=landwelle.ai_cron_state.call_count+1,last_status=EXCLUDED.last_status,last_error=EXCLUDED.last_error,last_due_count=EXCLUDED.last_due_count,last_started_count=EXCLUDED.last_started_count,last_duration_ms=EXCLUDED.last_duration_ms,updated_at=now();`) + } + if runErr != nil { + writeJSONResponse(w, map[string]any{"status": status, "error": errText, "due": due, "started": started}) + return + } + writeJSONResponse(w, map[string]any{"status": status, "due": due, "started": started, "duration_ms": duration}) +} + +func (a *adminHandler) cronAdminStatus(ctx context.Context) AICronAdminStatus { + baseURL := strings.TrimRight(envOr("LANDWELLE_PUBLIC_URL", "https://landwelle.de"), "/") + token := strings.TrimSpace(os.Getenv("LANDWELLE_CRON_TOKEN")) + status := AICronAdminStatus{ + TokenConfigured: token != "", LocalEndpoint: "http://127.0.0.1:2200/internal/cron", PublicEndpoint: baseURL + "/internal/cron", + Schedule: "* * * * *", Timezone: "Europe/Berlin", Health: "unknown", HealthLabel: "Noch kein Cron-Heartbeat", HealthText: "Es liegt noch kein zentraler Cron-Aufruf vor.", + } + if token != "" { + status.KeyHelpCommand = "curl -fsS -X POST -H " + strconv.Quote("X-Landwelle-Cron-Token: "+token) + " " + status.LocalEndpoint + } + if a.database == nil || !a.database.Enabled() { + status.Health = "error" + status.HealthLabel = "PostgreSQL nicht verfügbar" + status.HealthText = "Der Cron-Heartbeat kann ohne PostgreSQL nicht ausgewertet werden." + return status + } + var rows []struct { + PreviousPingAt *time.Time `json:"previous_ping_at"` + LastPingAt *time.Time `json:"last_ping_at"` + CallCount int64 `json:"call_count"` + LastStatus string `json:"last_status"` + LastError string `json:"last_error"` + LastDueCount int `json:"last_due_count"` + LastStartedCount int `json:"last_started_count"` + LastDurationMS int64 `json:"last_duration_ms"` + } + query := `SELECT COALESCE(json_agg(row_to_json(x)),'[]'::json)::text FROM (SELECT previous_ping_at,last_ping_at,call_count,last_status,last_error,last_due_count,last_started_count,last_duration_ms FROM landwelle.ai_cron_state WHERE id=1) x;` + if err := a.database.queryJSON(ctx, query, &rows); err != nil || len(rows) == 0 { + return status + } + row := rows[0] + status.PreviousPingAt, status.LastPingAt, status.CallCount = row.PreviousPingAt, row.LastPingAt, row.CallCount + status.LastStatus, status.LastError, status.LastDueCount, status.LastStartedCount, status.LastDurationMS = row.LastStatus, row.LastError, row.LastDueCount, row.LastStartedCount, row.LastDurationMS + if row.PreviousPingAt != nil && row.LastPingAt != nil { + status.IntervalSeconds = int64(row.LastPingAt.Sub(*row.PreviousPingAt).Seconds()) + } + if row.LastPingAt != nil { + age := time.Since(*row.LastPingAt) + if age < 3*time.Minute && row.LastStatus != "error" { + status.Health = "ok" + status.HealthLabel = "KeyHelp-Cron aktiv" + status.HealthText = "Der zentrale Minutentakt wird regelmäßig aufgerufen." + } else { + status.Health = "warning" + status.HealthLabel = "Cron-Heartbeat verspätet" + status.HealthText = "Der letzte zentrale Cron-Aufruf liegt länger zurück als erwartet." + } + } + return status +} + +func containsInt(v []int, n int) bool { + for _, x := range v { + if x == n { + return true + } + } + return false +} +func (a *adminHandler) executeAutoTask(t AIAutoTask) { + if !supportedAutoTaskKey(t.TaskKey) { + return + } + _, _ = a.database.exec(context.Background(), `UPDATE landwelle.ai_auto_tasks SET last_run_at=now(),last_status='running',last_error='',updated_at=now() WHERE id=`+strconv.FormatInt(t.ID, 10)) + cfg, _ := a.newsStudio.Get() + ch := strings.TrimPrefix(normalizeAutoTaskKey(t.TaskKey), "news:") + ctx, cancel := context.WithTimeout(context.Background(), 12*time.Minute) + defer cancel() + _, err := a.produceNewsStudio(ctx, cfg, ch, "") + status := "done" + msg := "" + if err != nil { + status = "error" + msg = err.Error() + } + _, _ = a.database.exec(context.Background(), `UPDATE landwelle.ai_auto_tasks SET last_status=`+sqlText(status)+`,last_error=`+sqlText(msg)+`,updated_at=now() WHERE id=`+strconv.FormatInt(t.ID, 10)) +} +func writeJSONResponse(w http.ResponseWriter, v any) { + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Cache-Control", "no-store") + _ = json.NewEncoder(w).Encode(v) +} diff --git a/ai_test.go b/ai_test.go new file mode 100644 index 0000000..232ecee --- /dev/null +++ b/ai_test.go @@ -0,0 +1,147 @@ +package main + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "strings" + "sync/atomic" + "testing" +) + +func testAIService(server *httptest.Server, model string) *aiService { + settings := &settingsStore{settings: RuntimeSettings{OpenAI: OpenAISettings{ + Enabled: true, + APIKey: "test-key", + BaseURL: server.URL, + Model: model, + SystemPrompt: "System", + }}} + return &aiService{settings: settings, client: server.Client(), audioDir: "/tmp"} +} + +func TestGenerateTextWithOptionsOmitsTemperatureForGPT5(t *testing.T) { + var calls atomic.Int32 + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + calls.Add(1) + var payload map[string]any + if err := json.NewDecoder(r.Body).Decode(&payload); err != nil { + t.Errorf("request JSON lesen: %v", err) + http.Error(w, "bad request", http.StatusBadRequest) + return + } + if _, found := payload["temperature"]; found { + t.Errorf("gpt-5-Anfrage darf temperature nicht enthalten: %#v", payload) + } + w.Header().Set("Content-Type", "application/json") + _, _ = w.Write([]byte(`{"output_text":"Drei Meldungen"}`)) + })) + defer server.Close() + + service := testAIService(server, "gpt-5-mini") + text, err := service.GenerateTextWithOptions(context.Background(), "Prompt", "Quellen", "gpt-5-mini", 0.7) + if err != nil { + t.Fatalf("GenerateTextWithOptions: %v", err) + } + if text != "Drei Meldungen" { + t.Fatalf("unerwarteter Text: %q", text) + } + if got := calls.Load(); got != 1 { + t.Fatalf("erwartet 1 Anfrage, erhalten %d", got) + } +} + +func TestGenerateTextWithOptionsRetriesWithoutUnsupportedTemperature(t *testing.T) { + var calls atomic.Int32 + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + call := calls.Add(1) + var payload map[string]any + if err := json.NewDecoder(r.Body).Decode(&payload); err != nil { + t.Errorf("request JSON lesen: %v", err) + http.Error(w, "bad request", http.StatusBadRequest) + return + } + _, hasTemperature := payload["temperature"] + if call == 1 { + if !hasTemperature { + t.Errorf("erste Anfrage sollte temperature enthalten: %#v", payload) + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusBadRequest) + _, _ = w.Write([]byte(`{"error":{"message":"Unsupported parameter: 'temperature' is not supported with this model.","type":"invalid_request_error","param":"temperature","code":null}}`)) + return + } + if hasTemperature { + t.Errorf("Wiederholungsanfrage darf temperature nicht enthalten: %#v", payload) + } + w.Header().Set("Content-Type", "application/json") + _, _ = w.Write([]byte(`{"output_text":"Erfolgreich ohne Temperatur"}`)) + })) + defer server.Close() + + service := testAIService(server, "gpt-4.1") + text, err := service.GenerateTextWithOptions(context.Background(), "Prompt", "", "gpt-4.1", 0.7) + if err != nil { + t.Fatalf("GenerateTextWithOptions: %v", err) + } + if text != "Erfolgreich ohne Temperatur" { + t.Fatalf("unerwarteter Text: %q", text) + } + if got := calls.Load(); got != 2 { + t.Fatalf("erwartet 2 Anfragen, erhalten %d", got) + } +} + +func TestGenerateNewsMessagesUsesExactStructuredSchema(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var payload map[string]any + if err := json.NewDecoder(r.Body).Decode(&payload); err != nil { + t.Errorf("request JSON lesen: %v", err) + http.Error(w, "bad request", http.StatusBadRequest) + return + } + textConfig, ok := payload["text"].(map[string]any) + if !ok { + t.Fatalf("text-Konfiguration fehlt: %#v", payload) + } + format, ok := textConfig["format"].(map[string]any) + if !ok || format["type"] != "json_schema" || format["strict"] != true { + t.Fatalf("ungültiges Structured-Output-Format: %#v", textConfig) + } + schema, ok := format["schema"].(map[string]any) + if !ok { + t.Fatalf("Schema fehlt: %#v", format) + } + properties := schema["properties"].(map[string]any) + messages := properties["messages"].(map[string]any) + if messages["minItems"] != float64(3) || messages["maxItems"] != float64(3) { + t.Fatalf("Schema erzwingt nicht genau drei Meldungen: %#v", messages) + } + w.Header().Set("Content-Type", "application/json") + _, _ = w.Write([]byte(`{"output_text":"{\"messages\":[{\"emotion\":\"calm\",\"location\":\"Niedersachsen.\",\"text\":\"Regionale Meldung.\"},{\"emotion\":\"serious\",\"location\":\"Deutschland\",\"text\":\"Bundesweite Meldung.\"},{\"emotion\":\"concerned\",\"location\":\"Nordsee\",\"text\":\"Wetterlage.\"}]}"}`)) + })) + defer server.Close() + + service := testAIService(server, "gpt-5-mini") + messages, err := service.GenerateNewsMessages(context.Background(), "Prompt", "Quellen", "gpt-5-mini", 0.7) + if err != nil { + t.Fatalf("GenerateNewsMessages: %v", err) + } + if len(messages) != 3 { + t.Fatalf("erwartet 3 Meldungen, erhalten %d: %#v", len(messages), messages) + } + if messages[0] != "[calm]\nNiedersachsen.\nRegionale Meldung." { + t.Fatalf("unerwartete erste Meldung: %q", messages[0]) + } + if messages[2] != "[concerned]\nNordsee.\nWetterlage." { + t.Fatalf("unerwartete dritte Meldung: %q", messages[2]) + } +} + +func TestRenderStructuredNewsMessagesRejectsWrongCount(t *testing.T) { + _, err := renderStructuredNewsMessages(`{"messages":[{"emotion":"neutral","location":"Deutschland","text":"Nur eine Meldung."}]}`) + if err == nil || !strings.Contains(err.Error(), "1 statt genau 3") { + t.Fatalf("erwarteter Mengenfehler fehlt: %v", err) + } +} diff --git a/ai_transparency.go b/ai_transparency.go new file mode 100644 index 0000000..acfa701 --- /dev/null +++ b/ai_transparency.go @@ -0,0 +1,96 @@ +package main + +import "strings" + +const aiAudioDisclosure = "Hinweis: Diese Audioaufnahme wurde mit künstlicher Intelligenz erstellt und von einer synthetischen Stimme gesprochen." + +func normalizeAIUsage(value string) string { + switch strings.ToLower(strings.TrimSpace(value)) { + case "assisted", "generated", "manipulated": + return strings.ToLower(strings.TrimSpace(value)) + default: + return "none" + } +} + +func normalizeMediaAIUsage(value string) string { + switch strings.ToLower(strings.TrimSpace(value)) { + case "generated", "manipulated": + return strings.ToLower(strings.TrimSpace(value)) + default: + return "none" + } +} + +func aiUsageLabel(value string) string { + switch normalizeAIUsage(value) { + case "assisted": + return "Mit KI-Unterstützung erstellt" + case "generated": + return "Mit künstlicher Intelligenz erstellt" + case "manipulated": + return "Mit künstlicher Intelligenz wesentlich bearbeitet" + default: + return "" + } +} + +func aiUsageShortLabel(value string) string { + switch normalizeAIUsage(value) { + case "assisted": + return "KI-unterstützt" + case "generated": + return "KI-generiert" + case "manipulated": + return "KI-bearbeitet" + default: + return "" + } +} + +func defaultAIDisclosure(value string) string { + switch normalizeAIUsage(value) { + case "assisted": + return "Dieser Inhalt wurde mit Unterstützung künstlicher Intelligenz erstellt." + case "generated": + return "Dieser Inhalt wurde mithilfe künstlicher Intelligenz erstellt." + case "manipulated": + return "Dieser Inhalt wurde mithilfe künstlicher Intelligenz wesentlich bearbeitet." + default: + return "" + } +} + +func withSpokenAIDisclosure(text string) string { + text = strings.TrimSpace(text) + if text == "" { + return aiAudioDisclosure + } + if strings.HasPrefix(strings.ToLower(text), strings.ToLower(aiAudioDisclosure)) { + return text + } + return aiAudioDisclosure + "\n\n" + text +} + +func editorialAITransparencyPayload(entry EditorialEntry) any { + if !entry.HasAITransparency() && !entry.HasMediaAITransparency() { + return nil + } + payload := map[string]any{ + "ai_generated": entry.HasAITransparency(), + "usage": entry.EffectiveAIUsage(), + "disclosure": entry.AITransparencyText(), + "human_reviewed": entry.AIHumanReviewed, + "editorial_responsible": strings.TrimSpace(entry.AIEditorialResponsible), + } + if entry.HasMediaAITransparency() { + payload["media"] = map[string]any{ + "ai_generated": true, + "usage": normalizeMediaAIUsage(entry.MediaAIUsage), + "disclosure": entry.MediaAITransparencyText(), + "watermark_enabled": entry.HasMediaWatermark(), + "watermark_text": entry.MediaWatermarkLabel(), + } + } + return payload +} diff --git a/ai_transparency_test.go b/ai_transparency_test.go new file mode 100644 index 0000000..5680234 --- /dev/null +++ b/ai_transparency_test.go @@ -0,0 +1,158 @@ +package main + +import ( + "bytes" + "html/template" + "os" + "path/filepath" + "strings" + "testing" + "time" +) + +func publicTransparencyTemplate(t *testing.T, files ...string) *template.Template { + t.Helper() + funcs := template.FuncMap{ + "year": func() int { return 2026 }, + "seoHead": seoHead, + "playlistURL": playlistPageURL, + "paragraphs": managedParagraphs, + "publicNavigation": func() template.HTML { + return navigationHTML(defaultNavigationItems()) + }, + "seq": func(a, b int) []int { + out := make([]int, 0, b-a+1) + for i := a; i <= b; i++ { + out = append(out, i) + } + return out + }, + } + all := append([]string{"web/partials.html"}, files...) + tmpl, err := template.New("ai-transparency").Funcs(funcs).ParseFS(webFS, all...) + if err != nil { + t.Fatal(err) + } + return tmpl +} + +func TestAITransparencyMigrationContract(t *testing.T) { + raw, err := os.ReadFile(filepath.Join("migrations", "0037_ai_transparency.sql")) + if err != nil { + t.Fatal(err) + } + text := string(raw) + for _, want := range []string{ + "editorial_entries", "mediathek_entries", "media_assets", + "ai_usage", "ai_human_reviewed", "ai_editorial_responsible", "ai_disclosure", "ai_voice", + } { + if !strings.Contains(text, want) { + t.Fatalf("migration 0037 missing %q", want) + } + } + upper := strings.ToUpper(text) + for _, forbidden := range []string{"\nBEGIN;", "\nCOMMIT;", "\nROLLBACK;"} { + if strings.Contains(upper, forbidden) { + t.Fatalf("migration contains transaction statement %q", forbidden) + } + } +} + +func TestSpokenAITransparencyIsMandatoryAndIdempotent(t *testing.T) { + got := withSpokenAIDisclosure("Das sind die Nachrichten.") + if !strings.HasPrefix(got, aiAudioDisclosure) { + t.Fatalf("spoken disclosure missing: %q", got) + } + if again := withSpokenAIDisclosure(got); again != got { + t.Fatalf("spoken disclosure was duplicated: %q", again) + } + aiSource, err := os.ReadFile("ai.go") + if err != nil { + t.Fatal(err) + } + if !strings.Contains(string(aiSource), "text = withSpokenAIDisclosure(text)") { + t.Fatal("GenerateSpeech does not centrally enforce the spoken disclosure") + } +} + +func TestEditorialAITransparencyRendersAtFirstExposure(t *testing.T) { + tmpl := publicTransparencyTemplate(t, "web/editorial-story.html") + data := editorialStoryPageData{Entry: EditorialEntry{ + Title: "KI-Testbeitrag", Slug: "ki-test", Teaser: "Ein transparenter Beitrag.", Body: "Inhalt", + ContentTypeLabel: "Landwelle vor Ort", Status: "published", PublishedAt: time.Date(2026, 8, 2, 10, 0, 0, 0, time.UTC), + AIUsage: "generated", AIHumanReviewed: true, AIEditorialResponsible: "Landwelle Redaktion", + MediaURL: "/media/test.webp", MediaAIUsage: "generated", + }} + var out bytes.Buffer + if err := tmpl.ExecuteTemplate(&out, "editorial-story.html", data); err != nil { + t.Fatal(err) + } + html := out.String() + for _, want := range []string{ + "KI-generiert", "data-ai-generated=\"true\"", "Redaktionell geprüft", "KI-Hinweis zum Bild", "/ki-transparenz", + } { + if !strings.Contains(html, want) { + t.Fatalf("rendered story missing %q", want) + } + } +} + +func TestMediathekAITransparencyRendersBeforePlayer(t *testing.T) { + tmpl := publicTransparencyTemplate(t, "web/mediathek.html") + data := mediathekPublicData{Entries: []MediathekEntry{{ + ID: 7, Title: "KI-Nachrichten", Kind: "ki_beitrag", AudioURL: "/media/test.mp3", + PublishedAt: time.Date(2026, 8, 2, 10, 0, 0, 0, time.UTC), Active: true, + AIUsage: "generated", AIVoice: true, AIHumanReviewed: true, AIEditorialResponsible: "Landwelle Redaktion", + }}} + var out bytes.Buffer + if err := tmpl.ExecuteTemplate(&out, "mediathek.html", data); err != nil { + t.Fatal(err) + } + html := out.String() + for _, want := range []string{"KI-Stimme", "synthetischen Stimme", "data-ai-voice=\"true\"", "/ki-transparenz", "Illustration mit KI erstellt"} { + if !strings.Contains(html, want) { + t.Fatalf("rendered mediathek missing %q", want) + } + } + if strings.Index(html, "mediathek-ai-disclosure") > strings.Index(html, "= date_trunc('day',now()) - interval '29 days'") + + for _, want := range []string{ + "AS visit_date", + "calendar.visit_date", + "stats.visit_date = calendar.visit_date", + "GROUP BY created_at::date", + } { + if !strings.Contains(query, want) { + t.Fatalf("analytics daily query is missing %q\n%s", want, query) + } + } + + for _, forbidden := range []string{ + "created_at::date day", + " AS day\n", + "USING(day)", + "days.day", + } { + if strings.Contains(query, forbidden) { + t.Fatalf("analytics daily query still contains unsafe alias %q\n%s", forbidden, query) + } + } +} diff --git a/api_proxy_config_test.go b/api_proxy_config_test.go new file mode 100644 index 0000000..cc077af --- /dev/null +++ b/api_proxy_config_test.go @@ -0,0 +1,45 @@ +package main + +import ( + "os" + "strings" + "testing" +) + +func TestKeyHelpAPIProxyFragmentContainsRequiredRoutes(t *testing.T) { + raw, err := os.ReadFile("deploy/keyhelp-api-subdomain-https.conf") + if err != nil { + t.Fatalf("read KeyHelp API proxy fragment: %v", err) + } + config := string(raw) + for _, required := range []string{ + "ProxyPass /v1/ http://127.0.0.1:2200/v1/", + "ProxyPassReverse /v1/ http://127.0.0.1:2200/v1/", + "ProxyPass /api/mobile/ http://127.0.0.1:2200/api/mobile/", + "ProxyPass /health http://127.0.0.1:2200/health", + "ProxyPass /ready http://127.0.0.1:2200/ready", + `RequestHeader set X-Forwarded-Proto "https"`, + } { + if !strings.Contains(config, required) { + t.Fatalf("KeyHelp API proxy fragment is missing %q", required) + } + } +} + +func TestAPIProxyVerificationScriptIsPresent(t *testing.T) { + raw, err := os.ReadFile("scripts/verify-api-subdomain.sh") + if err != nil { + t.Fatalf("read API verification script: %v", err) + } + script := string(raw) + for _, required := range []string{ + "/v1/app/bootstrap", + "LANDWELLE_LOCAL_API_BASE", + "LANDWELLE_PUBLIC_API_BASE", + "keyhelp-api-subdomain-https.conf", + } { + if !strings.Contains(script, required) { + t.Fatalf("API verification script is missing %q", required) + } + } +} diff --git a/app_api.go b/app_api.go new file mode 100644 index 0000000..27865a1 --- /dev/null +++ b/app_api.go @@ -0,0 +1,1124 @@ +package main + +import ( + "bytes" + "context" + "crypto/aes" + "crypto/cipher" + "crypto/rand" + "crypto/sha256" + "crypto/subtle" + "encoding/base64" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "os" + "regexp" + "sort" + "strconv" + "strings" + "time" +) + +type apiBaseContextKey struct{} + +type mobileAPIDependencies struct { + data PageData + database *postgresStore + rss *rssEngine + editorial *editorialStore + events *eventStore + team *teamStore + charts *chartStore + playlist *playlistStore + programs *programStore + settings *settingsStore + nowPlaying *nowPlayingService +} + +func registerExternalV1Alias(mux *http.ServeMux) { + alias := func(w http.ResponseWriter, r *http.Request) { + clone := r.Clone(context.WithValue(r.Context(), apiBaseContextKey{}, "/v1")) + clone.URL.Path = "/api" + r.URL.Path + mux.ServeHTTP(w, clone) + } + mux.HandleFunc("/v1", func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/v1" { + writeAPIError(w, http.StatusNotFound, "not_found", "Der angeforderte API-Endpunkt wurde nicht gefunden.") + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Diese HTTP-Methode ist nicht erlaubt.") + return + } + writeJSON(w, http.StatusOK, apiEnvelope{Data: map[string]any{ + "name": applicationName, + "api_version": apiVersion, + "contract": apiContractVersion, + "bootstrap_url": "/v1/app/bootstrap", + }, Meta: apiMeta()}) + }) + mux.HandleFunc("/v1/", alias) +} + +func apiRequestBase(r *http.Request) string { + if value, ok := r.Context().Value(apiBaseContextKey{}).(string); ok && value != "" { + return value + } + return "/api/" + apiVersion +} + +func mobileAPIFeatures(database *postgresStore) map[string]bool { + dbEnabled := database != nil && database.Enabled() + return map[string]bool{ + "radio": true, + "background_audio": true, + "now_playing": true, + "playlist_history": true, + "news": true, + "news_details": true, + "events": true, + "event_details": true, + "program": true, + "team": true, + "charts": true, + "chart_voting": dbEnabled, + "weather": true, + "traffic": true, + "speed_cameras": true, + "excursions": true, + "regional_preferences": dbEnabled, + "installation_identity": dbEnabled, + "push_registration": dbEnabled && appPushEncryptionConfigured(), + "push_topics": dbEnabled, + "usage_analytics": dbEnabled && envBool("LANDWELLE_APP_ANALYTICS_ENABLED", false), + "android_sideload": envBool("LANDWELLE_APP_ANDROID_SIDELOAD_ENABLED", false), + "google_play": envBool("LANDWELLE_APP_GOOGLE_PLAY_ENABLED", false), + "ios_app": envBool("LANDWELLE_APP_IOS_ENABLED", false), + "store_release_checks": true, + } +} + +func registerMobileAppAPI(mux *http.ServeMux, deps mobileAPIDependencies) { + base := "/api/" + apiVersion + + mux.HandleFunc(base+"/station", getOnly(func(w http.ResponseWriter, r *http.Request) { + streamURL := deps.data.StreamURL + writeJSON(w, http.StatusOK, apiEnvelope{Data: map[string]any{ + "name": applicationName, "version": displayVersion(), "timezone": "Europe/Berlin", + "slogan": "Sound & Infos aus Niedersachsen", + "stream": map[string]any{"url": streamURL, "mime_type": "audio/mpeg", "autoplay": false}, + "website_url": "https://landwelle.de", "support_url": "https://landwelle.de/kontakt", + "privacy_url": "https://landwelle.de/datenschutz", "legal_url": "https://landwelle.de/impressum", + }, Meta: apiMeta()}) + })) + + mux.HandleFunc(base+"/playlist/history", getOnly(func(w http.ResponseWriter, r *http.Request) { + limit := queryLimit(r, 30, 100) + entries, total, err := deps.playlist.List(r.Context(), 1, limit, PlaylistFilter{}) + if err != nil { + writeAPIError(w, http.StatusInternalServerError, "playlist_unavailable", "Die Playlist-Historie konnte nicht geladen werden.") + return + } + for i := range entries { + entries[i].CoverURL = publicURL(r, entries[i].CoverURL) + } + writeETagJSON(w, r, http.StatusOK, apiEnvelope{Data: entries, Meta: map[string]any{"count": len(entries), "total": total, "api_version": apiVersion}}) + })) + + mux.HandleFunc(base+"/team", getOnly(func(w http.ResponseWriter, r *http.Request) { + members, err := deps.team.List(r.Context(), false) + if err != nil { + writeAPIError(w, http.StatusInternalServerError, "team_unavailable", "Das Landwelle-Team konnte nicht geladen werden.") + return + } + for i := range members { + members[i].Image = publicURL(r, members[i].Image) + } + writeETagJSON(w, r, http.StatusOK, apiEnvelope{Data: members, Meta: map[string]any{"count": len(members), "api_version": apiVersion}}) + })) + + mux.HandleFunc(base+"/charts", getOnly(func(w http.ResponseWriter, r *http.Request) { + writeJSON(w, http.StatusOK, apiEnvelope{Data: []map[string]any{ + {"id": "listener", "name": "Landwelle Zuhörer Charts", "url": apiRequestBase(r) + "/charts/listener"}, + {"id": "schlager", "name": "Landwelle Schlager Charts", "url": apiRequestBase(r) + "/charts/schlager"}, + {"id": "annual", "name": "Landwelle Jahrescharts", "url": apiRequestBase(r) + "/charts/annual"}, + }, Meta: apiMeta()}) + })) + mux.HandleFunc(base+"/charts/", func(w http.ResponseWriter, r *http.Request) { + handleMobileCharts(w, r, base, deps) + }) + + mux.HandleFunc(base+"/news/", func(w http.ResponseWriter, r *http.Request) { + handleMobileNewsDetail(w, r, base, deps) + }) + mux.HandleFunc(base+"/events/", func(w http.ResponseWriter, r *http.Request) { + handleMobileEventDetail(w, r, base, deps) + }) + + mux.HandleFunc(base+"/app/compatibility", getOnly(func(w http.ResponseWriter, r *http.Request) { + handleCompatibility(w, r, deps.database) + })) + + mux.HandleFunc(base+"/installations", func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != base+"/installations" { + writeAPIError(w, http.StatusNotFound, "not_found", "Der angeforderte API-Endpunkt wurde nicht gefunden.") + return + } + if r.Method != http.MethodPost { + w.Header().Set("Allow", http.MethodPost) + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Nur POST ist erlaubt.") + return + } + handleInstallationRegistration(w, r, deps.database) + }) + mux.HandleFunc(base+"/installations/", func(w http.ResponseWriter, r *http.Request) { + handleInstallationResource(w, r, base, deps.database) + }) + mux.HandleFunc(base+"/usage-events", func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + w.Header().Set("Allow", http.MethodPost) + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Nur POST ist erlaubt.") + return + } + handleUsageEvents(w, r, deps.database) + }) + mux.HandleFunc(base+"/push/opened", func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + w.Header().Set("Allow", http.MethodPost) + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Nur POST ist erlaubt.") + return + } + handlePushOpened(w, r, deps.database) + }) + + // JSON-Fallback für unbekannte v1-Endpunkte. Spezifischere Routen gewinnen im ServeMux. + mux.HandleFunc(base+"/", func(w http.ResponseWriter, r *http.Request) { + writeAPIError(w, http.StatusNotFound, "not_found", "Der angeforderte API-Endpunkt wurde nicht gefunden.") + }) +} + +func handleMobileCharts(w http.ResponseWriter, r *http.Request, base string, deps mobileAPIDependencies) { + tail := strings.Trim(strings.TrimPrefix(r.URL.Path, base+"/charts/"), "/") + parts := strings.Split(tail, "/") + if len(parts) == 0 || parts[0] == "" { + writeAPIError(w, http.StatusNotFound, "not_found", "Charts wurden nicht gefunden.") + return + } + chartKey := parts[0] + if chartKey != "listener" && chartKey != "schlager" && chartKey != "annual" { + writeAPIError(w, http.StatusNotFound, "chart_not_found", "Diese Chartliste existiert nicht.") + return + } + if len(parts) == 1 && r.Method == http.MethodGet { + entries, err := deps.charts.Chart(r.Context(), chartKey) + if err != nil { + writeAPIError(w, http.StatusInternalServerError, "charts_unavailable", "Die Charts konnten nicht geladen werden.") + return + } + for i := range entries { + entries[i].CoverURL = publicURL(r, entries[i].CoverURL) + entries[i].PreviewURL = publicURL(r, entries[i].PreviewURL) + } + writeETagJSON(w, r, http.StatusOK, apiEnvelope{Data: entries, Meta: map[string]any{"chart": chartKey, "count": len(entries), "api_version": apiVersion}}) + return + } + if len(parts) == 2 && parts[1] == "votes" && r.Method == http.MethodPost { + installation, ok := authorizeInstallation(w, r, deps.database, "") + if !ok { + return + } + var in struct { + EntryID int `json:"entry_id"` + Rating int `json:"rating"` + } + if err := decodeStrictJSON(r, &in, 8<<10); err != nil { + writeAPIError(w, http.StatusBadRequest, "invalid_json", err.Error()) + return + } + result, err := deps.charts.Vote(r.Context(), chartKey, in.EntryID, in.Rating, installation.ID) + if err != nil { + writeAPIError(w, http.StatusUnprocessableEntity, "vote_rejected", err.Error()) + return + } + status := http.StatusCreated + if !result.Accepted { + status = http.StatusTooManyRequests + } + writeJSON(w, status, apiEnvelope{Data: result, Meta: apiMeta()}) + return + } + w.Header().Set("Allow", "GET, POST") + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Diese HTTP-Methode ist nicht erlaubt.") +} + +func handleMobileNewsDetail(w http.ResponseWriter, r *http.Request, base string, deps mobileAPIDependencies) { + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, HEAD") + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Diese HTTP-Methode ist nicht erlaubt.") + return + } + tail := strings.Trim(strings.TrimPrefix(r.URL.Path, base+"/news/"), "/") + parts := strings.SplitN(tail, "/", 2) + if len(parts) != 2 || parts[1] == "" { + writeAPIError(w, http.StatusNotFound, "news_not_found", "Die Meldung wurde nicht gefunden.") + return + } + switch parts[0] { + case "editorial": + entry, found, err := deps.editorial.GetBySlug(r.Context(), parts[1]) + if err != nil || !found || entry.Status != "published" || entry.ContentType != "news" { + writeAPIError(w, http.StatusNotFound, "news_not_found", "Die Meldung wurde nicht gefunden.") + return + } + writeJSON(w, http.StatusOK, apiEnvelope{Data: map[string]any{ + "id": "editorial:" + entry.Slug, "content_type": "editorial", "title": entry.Title, + "summary": entry.Teaser, "body": entry.Body, "location": entry.Location, + "image_url": publicURL(r, entry.MediaURL), "image_alt": entry.MediaAlt, + "published_at": entry.UpdatedAt, "source": map[string]any{"name": "Landwelle Redaktion"}, + "ai_transparency": editorialAITransparencyPayload(entry), + }, Meta: apiMeta()}) + case "rss": + id, err := strconv.ParseInt(parts[1], 10, 64) + if err != nil || id < 1 { + writeAPIError(w, http.StatusNotFound, "news_not_found", "Die Meldung wurde nicht gefunden.") + return + } + item, found, err := deps.rss.PublicItemByID(r.Context(), id) + if err != nil || !found { + writeAPIError(w, http.StatusNotFound, "news_not_found", "Die Meldung wurde nicht gefunden.") + return + } + data := feedRecordJSON(r, item) + data["id"] = "rss:" + strconv.FormatInt(item.ID, 10) + data["body"] = nil + writeJSON(w, http.StatusOK, apiEnvelope{Data: data, Meta: apiMeta()}) + default: + writeAPIError(w, http.StatusNotFound, "news_not_found", "Die Meldung wurde nicht gefunden.") + } +} + +func handleMobileEventDetail(w http.ResponseWriter, r *http.Request, base string, deps mobileAPIDependencies) { + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, HEAD") + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Diese HTTP-Methode ist nicht erlaubt.") + return + } + id, err := strconv.ParseInt(strings.Trim(strings.TrimPrefix(r.URL.Path, base+"/events/"), "/"), 10, 64) + if err != nil || id < 1 { + writeAPIError(w, http.StatusNotFound, "event_not_found", "Die Veranstaltung wurde nicht gefunden.") + return + } + items, err := deps.events.ListPublished(r.Context(), "") + if err != nil { + writeAPIError(w, http.StatusInternalServerError, "events_unavailable", "Veranstaltungen konnten nicht geladen werden.") + return + } + for _, item := range items { + if item.ID == id { + item.ImageURL = publicURL(r, item.ImageURL) + writeJSON(w, http.StatusOK, apiEnvelope{Data: mobileEventJSON(r, item), Meta: apiMeta()}) + return + } + } + writeAPIError(w, http.StatusNotFound, "event_not_found", "Die Veranstaltung wurde nicht gefunden.") +} + +func mobileEventJSON(r *http.Request, item CalendarEvent) map[string]any { + imageURL := "" + if strings.TrimSpace(item.ImageURL) != "" { + imageURL = publicURL(r, item.ImageURL) + } + return map[string]any{ + "id": item.ID, "title": item.Title, "category": item.Category, + "start_at": item.StartAt, "end_at": item.EndAt, "date_label": item.DateLabel(), + "venue": item.Venue, "city": item.City, "postal_code": item.PostalCode, + "organizer": item.Organizer, "description": item.Description, "website": item.Website, + "image_url": imageURL, "source_name": item.SourceName, "source_url": item.SourceURL, + "calendar_url": publicURL(r, "/veranstaltungen/kalender.ics"), + "detail_url": apiRequestBase(r) + "/events/" + strconv.FormatInt(item.ID, 10), + } +} + +func handleCompatibility(w http.ResponseWriter, r *http.Request, db *postgresStore) { + platform := strings.ToLower(strings.TrimSpace(r.URL.Query().Get("platform"))) + channel := strings.ToLower(strings.TrimSpace(r.URL.Query().Get("channel"))) + version := strings.TrimSpace(r.URL.Query().Get("version")) + build := strings.TrimSpace(r.URL.Query().Get("build")) + if platform != "android" && platform != "ios" { + writeAPIError(w, http.StatusBadRequest, "invalid_platform", "platform muss android oder ios sein.") + return + } + if channel == "" { + if platform == "android" { + channel = "google_play" + } else { + channel = "app_store" + } + } + if channel == "development" { + channel = "beta" + } + if (platform == "android" && !allowedValue(channel, "sideload", "google_play", "beta")) || + (platform == "ios" && !allowedValue(channel, "app_store", "beta")) { + writeAPIError(w, http.StatusBadRequest, "invalid_channel", "channel ist für die gewählte Plattform ungültig.") + return + } + latest, found, err := latestAppRelease(r.Context(), db, platform, channel) + if err != nil { + writeAPIError(w, http.StatusInternalServerError, "release_check_failed", "Die Versionsprüfung ist momentan nicht verfügbar.") + return + } + data := map[string]any{ + "platform": platform, "channel": channel, "current_version": version, "current_build": build, + "supported": true, "update_available": false, "mandatory": false, "latest_release": nil, + } + if found { + data["latest_release"] = latest + data["update_available"] = appUpdateAvailable(version, build, fmt.Sprint(latest["version"]), fmt.Sprint(latest["build_number"])) + data["mandatory"] = latest["mandatory"] + } + writeJSON(w, http.StatusOK, apiEnvelope{Data: data, Meta: apiMeta()}) +} + +func latestAppRelease(ctx context.Context, db *postgresStore, platform, channel string) (map[string]any, bool, error) { + if db == nil || !db.Enabled() { + return nil, false, nil + } + var items []map[string]any + q := `SELECT COALESCE(json_agg(row_to_json(x)),'[]'::json)::text FROM (SELECT id,platform,architecture,channel,version,build_number,minimum_os_version,download_url,store_url,sha256,file_size_bytes,release_notes,mandatory,published_at FROM app_releases WHERE published=true AND platform=` + sqlText(platform) + ` AND channel=` + sqlText(channel) + ` ORDER BY published_at DESC,id DESC LIMIT 1) x;` + if err := db.queryJSON(ctx, q, &items); err != nil { + return nil, false, err + } + if len(items) == 0 { + return nil, false, nil + } + return items[0], true, nil +} + +func appUpdateAvailable(currentVersion, currentBuild, latestVersion, latestBuild string) bool { + versionComparison := compareVersions(currentVersion, latestVersion) + return versionComparison < 0 || (versionComparison == 0 && compareBuilds(currentBuild, latestBuild) < 0) +} + +func compareVersions(a, b string) int { + parse := func(raw string) []int { + raw = strings.TrimPrefix(strings.TrimSpace(raw), "v") + parts := strings.Split(raw, ".") + out := make([]int, 3) + for i := 0; i < len(parts) && i < len(out); i++ { + n, _ := strconv.Atoi(regexp.MustCompile(`[^0-9].*$`).ReplaceAllString(parts[i], "")) + out[i] = n + } + return out + } + x, y := parse(a), parse(b) + for i := range x { + if x[i] < y[i] { + return -1 + } + if x[i] > y[i] { + return 1 + } + } + return 0 +} + +func compareBuilds(a, b string) int { + x, errX := strconv.ParseInt(strings.TrimSpace(a), 10, 64) + y, errY := strconv.ParseInt(strings.TrimSpace(b), 10, 64) + if errX != nil || errY != nil { + return 0 + } + if x < y { + return -1 + } + if x > y { + return 1 + } + return 0 +} + +// Installation API + +type installationRecord struct { + ID string `json:"id"` + Platform string `json:"platform"` + AppVersion string `json:"app_version"` + AppBuild string `json:"app_build"` + PreferredRegionSlug string `json:"preferred_region_slug"` + NotificationsEnabled bool `json:"notifications_enabled"` + AnalyticsConsent bool `json:"analytics_consent"` + Status string `json:"status"` +} + +type installationRegistration struct { + InstallationID string `json:"installation_id"` + Platform string `json:"platform"` + DeviceClass string `json:"device_class"` + DistributionChannel string `json:"distribution_channel"` + AppVersion string `json:"app_version"` + AppBuild string `json:"app_build"` + OSVersion string `json:"os_version"` + Locale string `json:"locale"` + Timezone string `json:"timezone"` +} + +var uuidPattern = regexp.MustCompile(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`) + +func handleInstallationRegistration(w http.ResponseWriter, r *http.Request, db *postgresStore) { + if db == nil || !db.Enabled() { + writeAPIError(w, http.StatusServiceUnavailable, "database_unavailable", "Die App-Registrierung ist derzeit nicht verfügbar.") + return + } + var in installationRegistration + if err := decodeStrictJSON(r, &in, 32<<10); err != nil { + writeAPIError(w, http.StatusBadRequest, "invalid_json", err.Error()) + return + } + in.Platform = strings.ToLower(strings.TrimSpace(in.Platform)) + in.DeviceClass = strings.ToLower(strings.TrimSpace(in.DeviceClass)) + in.DistributionChannel = strings.ToLower(strings.TrimSpace(in.DistributionChannel)) + if in.InstallationID == "" { + in.InstallationID = newUUID() + } + if !uuidPattern.MatchString(in.InstallationID) { + writeAPIError(w, http.StatusUnprocessableEntity, "invalid_installation_id", "installation_id ist keine gültige UUID.") + return + } + if !allowedValue(in.Platform, "android", "ios") || !allowedValue(in.DeviceClass, "phone", "tablet", "unknown") || !allowedValue(in.DistributionChannel, "sideload", "google_play", "app_store", "development") || strings.TrimSpace(in.AppVersion) == "" { + writeAPIError(w, http.StatusUnprocessableEntity, "invalid_installation", "Plattform, Geräteklasse, Vertriebsweg oder App-Version sind ungültig.") + return + } + secret, err := randomToken(32) + if err != nil { + writeAPIError(w, http.StatusInternalServerError, "token_generation_failed", "Das Installation-Secret konnte nicht erzeugt werden.") + return + } + hash := sha256.Sum256([]byte(secret)) + q := `INSERT INTO app_installations(id,installation_token_hash,platform,device_class,distribution_channel,app_version,app_build,os_version,locale,timezone,last_seen_at) VALUES (` + + sqlText(strings.ToLower(in.InstallationID)) + `::uuid,decode(` + sqlText(hex.EncodeToString(hash[:])) + `,'hex'),` + sqlText(in.Platform) + `,` + sqlText(in.DeviceClass) + `,` + sqlText(in.DistributionChannel) + `,` + sqlText(limitString(in.AppVersion, 50)) + `,` + sqlText(limitString(in.AppBuild, 50)) + `,` + sqlText(limitString(in.OSVersion, 100)) + `,` + sqlText(limitString(in.Locale, 20)) + `,` + sqlText(limitString(in.Timezone, 100)) + `,now());` + if _, err := db.exec(r.Context(), q); err != nil { + if strings.Contains(strings.ToLower(err.Error()), "duplicate") { + writeAPIError(w, http.StatusConflict, "installation_exists", "Diese installation_id ist bereits registriert.") + return + } + writeAPIError(w, http.StatusInternalServerError, "registration_failed", "Die App-Installation konnte nicht registriert werden.") + return + } + writeJSON(w, http.StatusCreated, apiEnvelope{Data: map[string]any{ + "installation_id": strings.ToLower(in.InstallationID), "installation_token": secret, + "authorization_scheme": "Installation", "created_at": time.Now().UTC().Format(time.RFC3339), + }, Meta: apiMeta()}) +} + +func handleInstallationResource(w http.ResponseWriter, r *http.Request, base string, db *postgresStore) { + tail := strings.Trim(strings.TrimPrefix(r.URL.Path, base+"/installations/"), "/") + parts := strings.Split(tail, "/") + if len(parts) < 1 || !uuidPattern.MatchString(parts[0]) { + writeAPIError(w, http.StatusNotFound, "installation_not_found", "Die App-Installation wurde nicht gefunden.") + return + } + id := strings.ToLower(parts[0]) + installation, ok := authorizeInstallation(w, r, db, id) + if !ok { + return + } + if len(parts) == 1 { + switch r.Method { + case http.MethodPatch: + handleInstallationUpdate(w, r, db, installation) + case http.MethodDelete: + handleInstallationDelete(w, r, db, installation) + default: + w.Header().Set("Allow", "PATCH, DELETE") + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Diese HTTP-Methode ist nicht erlaubt.") + } + return + } + if len(parts) == 2 && parts[1] == "push-token" { + switch r.Method { + case http.MethodPut: + handlePushTokenUpsert(w, r, db, installation) + case http.MethodDelete: + handlePushTokenDelete(w, r, db, installation) + default: + w.Header().Set("Allow", "PUT, DELETE") + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Diese HTTP-Methode ist nicht erlaubt.") + } + return + } + if len(parts) == 2 && parts[1] == "topics" { + switch r.Method { + case http.MethodGet: + handleTopicsGet(w, r, db, installation) + case http.MethodPut: + handleTopicsReplace(w, r, db, installation) + default: + w.Header().Set("Allow", "GET, PUT") + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Diese HTTP-Methode ist nicht erlaubt.") + } + return + } + writeAPIError(w, http.StatusNotFound, "not_found", "Der angeforderte API-Endpunkt wurde nicht gefunden.") +} + +func authorizeInstallation(w http.ResponseWriter, r *http.Request, db *postgresStore, expectedID string) (installationRecord, bool) { + if db == nil || !db.Enabled() { + writeAPIError(w, http.StatusServiceUnavailable, "database_unavailable", "Die App-Registrierung ist derzeit nicht verfügbar.") + return installationRecord{}, false + } + token := installationToken(r.Header.Get("Authorization")) + if token == "" { + writeAPIError(w, http.StatusUnauthorized, "installation_auth_required", "Ein gültiges Installation-Secret wird benötigt.") + return installationRecord{}, false + } + hash := sha256.Sum256([]byte(token)) + var rows []installationRecord + where := "installation_token_hash=decode(" + sqlText(hex.EncodeToString(hash[:])) + ",'hex') AND status='active'" + if expectedID != "" { + where += " AND id=" + sqlText(expectedID) + "::uuid" + } + q := `SELECT COALESCE(json_agg(row_to_json(x)),'[]'::json)::text FROM (SELECT id::text,platform,app_version,COALESCE(app_build,'') app_build,COALESCE(preferred_region_slug,'') preferred_region_slug,notifications_enabled,analytics_consent,status FROM app_installations WHERE ` + where + ` LIMIT 1) x;` + if err := db.queryJSON(r.Context(), q, &rows); err != nil || len(rows) == 0 { + writeAPIError(w, http.StatusUnauthorized, "invalid_installation_token", "Das Installation-Secret ist ungültig.") + return installationRecord{}, false + } + _, _ = db.exec(r.Context(), "UPDATE app_installations SET last_seen_at=now() WHERE id="+sqlText(rows[0].ID)+"::uuid;") + return rows[0], true +} + +func installationToken(header string) string { + parts := strings.Fields(strings.TrimSpace(header)) + if len(parts) != 2 { + return "" + } + if !strings.EqualFold(parts[0], "Installation") && !strings.EqualFold(parts[0], "Bearer") { + return "" + } + return parts[1] +} + +func handleInstallationUpdate(w http.ResponseWriter, r *http.Request, db *postgresStore, installation installationRecord) { + var in struct { + AppVersion *string `json:"app_version"` + AppBuild *string `json:"app_build"` + OSVersion *string `json:"os_version"` + Locale *string `json:"locale"` + Timezone *string `json:"timezone"` + PreferredRegionSlug *string `json:"preferred_region_slug"` + NotificationsEnabled *bool `json:"notifications_enabled"` + AnalyticsConsent *bool `json:"analytics_consent"` + } + if err := decodeStrictJSON(r, &in, 16<<10); err != nil { + writeAPIError(w, http.StatusBadRequest, "invalid_json", err.Error()) + return + } + sets := []string{"last_seen_at=now()"} + if in.AppVersion != nil { + sets = append(sets, "app_version="+sqlText(limitString(*in.AppVersion, 50))) + } + if in.AppBuild != nil { + sets = append(sets, "app_build="+sqlText(limitString(*in.AppBuild, 50))) + } + if in.OSVersion != nil { + sets = append(sets, "os_version="+sqlText(limitString(*in.OSVersion, 100))) + } + if in.Locale != nil { + sets = append(sets, "locale="+sqlText(limitString(*in.Locale, 20))) + } + if in.Timezone != nil { + sets = append(sets, "timezone="+sqlText(limitString(*in.Timezone, 100))) + } + if in.PreferredRegionSlug != nil { + if strings.TrimSpace(*in.PreferredRegionSlug) == "" { + sets = append(sets, "preferred_region_slug=NULL") + } else { + sets = append(sets, "preferred_region_slug="+sqlText(limitString(*in.PreferredRegionSlug, 100))) + } + } + if in.NotificationsEnabled != nil { + sets = append(sets, "notifications_enabled="+sqlBool(*in.NotificationsEnabled)) + } + if in.AnalyticsConsent != nil { + sets = append(sets, "analytics_consent="+sqlBool(*in.AnalyticsConsent)) + } + if _, err := db.exec(r.Context(), "UPDATE app_installations SET "+strings.Join(sets, ",")+" WHERE id="+sqlText(installation.ID)+"::uuid;"); err != nil { + writeAPIError(w, http.StatusInternalServerError, "update_failed", "Die App-Installation konnte nicht aktualisiert werden.") + return + } + writeJSON(w, http.StatusOK, apiEnvelope{Data: map[string]any{"installation_id": installation.ID, "updated": true}, Meta: apiMeta()}) +} + +func handleInstallationDelete(w http.ResponseWriter, r *http.Request, db *postgresStore, installation installationRecord) { + q := `UPDATE app_installations SET status='deleted',deleted_at=now(),notifications_enabled=false,analytics_consent=false WHERE id=` + sqlText(installation.ID) + `::uuid; UPDATE app_push_tokens SET active=false,invalidated_at=now() WHERE installation_id=` + sqlText(installation.ID) + `::uuid;` + if _, err := db.exec(r.Context(), q); err != nil { + writeAPIError(w, http.StatusInternalServerError, "delete_failed", "Die App-Installation konnte nicht gelöscht werden.") + return + } + w.WriteHeader(http.StatusNoContent) +} + +func handlePushTokenUpsert(w http.ResponseWriter, r *http.Request, db *postgresStore, installation installationRecord) { + key, err := appPushEncryptionKey() + if err != nil { + writeAPIError(w, http.StatusServiceUnavailable, "push_not_configured", "Push-Registrierung ist serverseitig noch nicht konfiguriert.") + return + } + var in struct{ Provider, Token, Environment string } + if err := decodeStrictJSON(r, &in, 16<<10); err != nil { + writeAPIError(w, http.StatusBadRequest, "invalid_json", err.Error()) + return + } + in.Provider = strings.ToLower(strings.TrimSpace(in.Provider)) + in.Environment = strings.ToLower(strings.TrimSpace(in.Environment)) + if in.Environment == "" { + in.Environment = "production" + } + if !allowedValue(in.Provider, "fcm", "native") || !allowedValue(in.Environment, "development", "staging", "production") || len(strings.TrimSpace(in.Token)) < 20 || len(in.Token) > 8192 { + writeAPIError(w, http.StatusUnprocessableEntity, "invalid_push_token", "Provider, Umgebung oder Push-Token sind ungültig.") + return + } + ciphertext, err := encryptToken(key, []byte(in.Token)) + if err != nil { + writeAPIError(w, http.StatusInternalServerError, "push_encryption_failed", "Der Push-Token konnte nicht geschützt gespeichert werden.") + return + } + fp := sha256.Sum256([]byte(in.Token)) + q := `INSERT INTO app_push_tokens(installation_id,provider,token_ciphertext,token_fingerprint,environment,active,last_confirmed_at) VALUES (` + sqlText(installation.ID) + `::uuid,` + sqlText(in.Provider) + `,decode(` + sqlText(hex.EncodeToString(ciphertext)) + `,'hex'),` + sqlText(hex.EncodeToString(fp[:])) + `,` + sqlText(in.Environment) + `,true,now()) ON CONFLICT(token_fingerprint) DO UPDATE SET installation_id=excluded.installation_id,provider=excluded.provider,token_ciphertext=excluded.token_ciphertext,environment=excluded.environment,active=true,last_confirmed_at=now(),invalidated_at=NULL,last_error_code=NULL; UPDATE app_installations SET notifications_enabled=true,last_seen_at=now() WHERE id=` + sqlText(installation.ID) + `::uuid;` + if _, err := db.exec(r.Context(), q); err != nil { + writeAPIError(w, http.StatusInternalServerError, "push_registration_failed", "Der Push-Token konnte nicht gespeichert werden.") + return + } + w.WriteHeader(http.StatusNoContent) +} + +func handlePushTokenDelete(w http.ResponseWriter, r *http.Request, db *postgresStore, installation installationRecord) { + q := `UPDATE app_push_tokens SET active=false,invalidated_at=now() WHERE installation_id=` + sqlText(installation.ID) + `::uuid; UPDATE app_installations SET notifications_enabled=false WHERE id=` + sqlText(installation.ID) + `::uuid;` + if _, err := db.exec(r.Context(), q); err != nil { + writeAPIError(w, http.StatusInternalServerError, "push_delete_failed", "Der Push-Token konnte nicht entfernt werden.") + return + } + w.WriteHeader(http.StatusNoContent) +} + +func handleTopicsGet(w http.ResponseWriter, r *http.Request, db *postgresStore, installation installationRecord) { + var topics []map[string]any + q := `SELECT COALESCE(json_agg(row_to_json(x)),'[]'::json)::text FROM (SELECT t.slug,t.name,t.description,t.kind,(it.installation_id IS NOT NULL) subscribed FROM push_topics t LEFT JOIN app_installation_topics it ON it.topic_id=t.id AND it.installation_id=` + sqlText(installation.ID) + `::uuid WHERE t.active=true ORDER BY t.kind,t.name) x;` + if err := db.queryJSON(r.Context(), q, &topics); err != nil { + writeAPIError(w, http.StatusInternalServerError, "topics_unavailable", "Push-Themen konnten nicht geladen werden.") + return + } + writeJSON(w, http.StatusOK, apiEnvelope{Data: topics, Meta: map[string]any{"count": len(topics), "api_version": apiVersion}}) +} + +func handleTopicsReplace(w http.ResponseWriter, r *http.Request, db *postgresStore, installation installationRecord) { + var in struct { + Topics []string `json:"topics"` + } + if err := decodeStrictJSON(r, &in, 16<<10); err != nil { + writeAPIError(w, http.StatusBadRequest, "invalid_json", err.Error()) + return + } + if len(in.Topics) > 50 { + writeAPIError(w, http.StatusUnprocessableEntity, "too_many_topics", "Es dürfen höchstens 50 Push-Themen gewählt werden.") + return + } + seen := map[string]bool{} + values := make([]string, 0, len(in.Topics)) + for _, topic := range in.Topics { + topic = strings.ToLower(strings.TrimSpace(topic)) + if topic == "" || seen[topic] { + continue + } + seen[topic] = true + values = append(values, topic) + } + valueSQL := "NULL" + if len(values) > 0 { + quoted := make([]string, len(values)) + for i, value := range values { + quoted[i] = sqlText(value) + } + valueSQL = strings.Join(quoted, ",") + } + q := `DELETE FROM app_installation_topics WHERE installation_id=` + sqlText(installation.ID) + `::uuid;` + if len(values) > 0 { + q += ` INSERT INTO app_installation_topics(installation_id,topic_id) SELECT ` + sqlText(installation.ID) + `::uuid,id FROM push_topics WHERE active=true AND slug IN (` + valueSQL + `) ON CONFLICT DO NOTHING;` + } + if _, err := db.exec(r.Context(), q); err != nil { + writeAPIError(w, http.StatusInternalServerError, "topics_update_failed", "Push-Themen konnten nicht aktualisiert werden.") + return + } + w.WriteHeader(http.StatusNoContent) +} + +func handleUsageEvents(w http.ResponseWriter, r *http.Request, db *postgresStore) { + installation, ok := authorizeInstallation(w, r, db, "") + if !ok { + return + } + if !envBool("LANDWELLE_APP_ANALYTICS_ENABLED", false) { + writeAPIError(w, http.StatusForbidden, "analytics_disabled", "Nutzungsstatistik ist serverseitig deaktiviert.") + return + } + if !installation.AnalyticsConsent { + writeAPIError(w, http.StatusForbidden, "analytics_consent_required", "Für Nutzungsereignisse liegt keine Einwilligung vor.") + return + } + var in struct { + Events []usageEventInput `json:"events"` + } + if err := decodeStrictJSON(r, &in, 128<<10); err != nil { + writeAPIError(w, http.StatusBadRequest, "invalid_json", err.Error()) + return + } + if len(in.Events) == 0 || len(in.Events) > 50 { + writeAPIError(w, http.StatusUnprocessableEntity, "invalid_event_count", "Pro Anfrage sind 1 bis 50 Ereignisse erlaubt.") + return + } + allowed := map[string]bool{"app_open": true, "session_start": true, "session_end": true, "stream_start": true, "stream_stop": true, "news_open": true, "event_open": true, "program_open": true, "push_open": true, "download_open": true} + statements := make([]string, 0, len(in.Events)) + for _, event := range in.Events { + if !uuidPattern.MatchString(event.EventID) || !allowed[event.EventName] || event.Platform != installation.Platform || event.AppVersion == "" { + writeAPIError(w, http.StatusUnprocessableEntity, "invalid_usage_event", "Mindestens ein Nutzungsereignis ist ungültig.") + return + } + occurred, err := time.Parse(time.RFC3339, event.OccurredAt) + if err != nil || occurred.Before(time.Now().Add(-7*24*time.Hour)) || occurred.After(time.Now().Add(10*time.Minute)) { + writeAPIError(w, http.StatusUnprocessableEntity, "invalid_event_time", "Der Ereigniszeitpunkt ist ungültig.") + return + } + properties, err := validateUsageProperties(event.EventName, event.Properties) + if err != nil { + writeAPIError(w, http.StatusUnprocessableEntity, "invalid_event_properties", err.Error()) + return + } + regionSQL := "NULL" + if strings.TrimSpace(event.RegionSlug) != "" { + regionSQL = sqlText(limitString(event.RegionSlug, 100)) + } + statements = append(statements, `INSERT INTO app_usage_events(event_id,installation_id,event_name,occurred_at,app_version,platform,region_slug,properties) VALUES (`+sqlText(strings.ToLower(event.EventID))+`::uuid,`+sqlText(installation.ID)+`::uuid,`+sqlText(event.EventName)+`,`+sqlText(occurred.UTC().Format(time.RFC3339))+`::timestamptz,`+sqlText(limitString(event.AppVersion, 50))+`,`+sqlText(event.Platform)+`,`+regionSQL+`,`+sqlText(string(properties))+`::jsonb) ON CONFLICT(event_id) DO NOTHING;`) + } + if _, err := db.exec(r.Context(), strings.Join(statements, "\n")); err != nil { + writeAPIError(w, http.StatusInternalServerError, "usage_events_failed", "Nutzungsereignisse konnten nicht gespeichert werden.") + return + } + writeJSON(w, http.StatusAccepted, apiEnvelope{Data: map[string]any{"accepted": len(in.Events)}, Meta: apiMeta()}) +} + +func validateUsageProperties(eventName string, properties map[string]any) ([]byte, error) { + allowed := map[string]map[string]string{ + "app_open": {}, + "session_start": {}, + "session_end": {"duration_seconds": "number", "reason": "string"}, + "stream_start": {}, + "stream_stop": {"duration_seconds": "number", "reason": "string"}, + "news_open": {"content_id": "string"}, + "event_open": {"event_id": "id"}, + "program_open": {"program_id": "id"}, + "push_open": {"campaign_id": "id"}, + "download_open": {"release_id": "id"}, + } + rules, ok := allowed[eventName] + if !ok { + return nil, errors.New("Der Ereignistyp ist nicht erlaubt.") + } + if properties == nil { + properties = map[string]any{} + } + for key, value := range properties { + typeName, permitted := rules[key] + if !permitted { + return nil, fmt.Errorf("Die Eigenschaft %q ist für %s nicht erlaubt.", key, eventName) + } + switch typeName { + case "string": + text, valid := value.(string) + if !valid || strings.TrimSpace(text) == "" || len([]rune(text)) > 200 { + return nil, fmt.Errorf("Die Eigenschaft %q muss ein kurzer Text sein.", key) + } + case "number": + number, valid := value.(float64) + if !valid || number < 0 || number > 86400 { + return nil, fmt.Errorf("Die Eigenschaft %q muss eine Zahl zwischen 0 und 86400 sein.", key) + } + case "id": + switch typed := value.(type) { + case string: + if strings.TrimSpace(typed) == "" || len([]rune(typed)) > 100 { + return nil, fmt.Errorf("Die Eigenschaft %q enthält keine gültige ID.", key) + } + case float64: + if typed < 1 || typed != float64(int64(typed)) { + return nil, fmt.Errorf("Die Eigenschaft %q enthält keine gültige ID.", key) + } + default: + return nil, fmt.Errorf("Die Eigenschaft %q enthält keine gültige ID.", key) + } + } + } + encoded, err := json.Marshal(properties) + if err != nil || len(encoded) > 2048 { + return nil, errors.New("Die Ereigniseigenschaften sind ungültig oder zu groß.") + } + return encoded, nil +} + +type usageEventInput struct { + EventID, EventName, OccurredAt, AppVersion, Platform, RegionSlug string + Properties map[string]any `json:"properties"` +} + +func (u *usageEventInput) UnmarshalJSON(data []byte) error { + type alias struct { + EventID string `json:"event_id"` + EventName string `json:"event_name"` + OccurredAt string `json:"occurred_at"` + AppVersion string `json:"app_version"` + Platform string `json:"platform"` + RegionSlug string `json:"region_slug"` + Properties map[string]any `json:"properties"` + } + var a alias + if err := json.Unmarshal(data, &a); err != nil { + return err + } + u.EventID, u.EventName, u.OccurredAt, u.AppVersion, u.Platform, u.RegionSlug, u.Properties = a.EventID, a.EventName, a.OccurredAt, a.AppVersion, strings.ToLower(a.Platform), a.RegionSlug, a.Properties + return nil +} + +func handlePushOpened(w http.ResponseWriter, r *http.Request, db *postgresStore) { + installation, ok := authorizeInstallation(w, r, db, "") + if !ok { + return + } + var in struct { + CampaignID int64 `json:"campaign_id"` + OpenedAt string `json:"opened_at"` + } + if err := decodeStrictJSON(r, &in, 8<<10); err != nil || in.CampaignID < 1 { + writeAPIError(w, http.StatusBadRequest, "invalid_json", "campaign_id und opened_at sind erforderlich.") + return + } + opened, err := time.Parse(time.RFC3339, in.OpenedAt) + if err != nil { + opened = time.Now().UTC() + } + q := `UPDATE push_deliveries SET status='opened',opened_at=` + sqlText(opened.UTC().Format(time.RFC3339)) + `::timestamptz WHERE campaign_id=` + strconv.FormatInt(in.CampaignID, 10) + ` AND installation_id=` + sqlText(installation.ID) + `::uuid; UPDATE push_campaigns SET opened_count=(SELECT count(*) FROM push_deliveries WHERE campaign_id=` + strconv.FormatInt(in.CampaignID, 10) + ` AND status='opened') WHERE id=` + strconv.FormatInt(in.CampaignID, 10) + `;` + if _, err := db.exec(r.Context(), q); err != nil { + writeAPIError(w, http.StatusInternalServerError, "push_open_failed", "Das Öffnen der Push-Mitteilung konnte nicht gespeichert werden.") + return + } + writeJSON(w, http.StatusAccepted, apiEnvelope{Data: map[string]any{"accepted": true}, Meta: apiMeta()}) +} + +func decodeStrictJSON(r *http.Request, dest any, limit int64) error { + body, err := io.ReadAll(io.LimitReader(r.Body, limit+1)) + if err != nil { + return errors.New("Die Anfrage konnte nicht gelesen werden.") + } + if int64(len(body)) > limit { + return errors.New("Die JSON-Anfrage ist zu groß.") + } + decoder := json.NewDecoder(bytes.NewReader(body)) + decoder.DisallowUnknownFields() + if err := decoder.Decode(dest); err != nil { + return fmt.Errorf("Ungültige JSON-Anfrage: %v", err) + } + if err := decoder.Decode(&struct{}{}); err != io.EOF { + return errors.New("Die Anfrage darf nur ein JSON-Objekt enthalten.") + } + return nil +} + +func appPushEncryptionConfigured() bool { + _, err := appPushEncryptionKey() + return err == nil +} + +func appPushEncryptionKey() ([]byte, error) { + raw := strings.TrimSpace(os.Getenv("LANDWELLE_APP_PUSH_ENCRYPTION_KEY")) + if raw == "" { + return nil, errors.New("LANDWELLE_APP_PUSH_ENCRYPTION_KEY fehlt") + } + if decoded, err := base64.StdEncoding.DecodeString(raw); err == nil && len(decoded) == 32 { + return decoded, nil + } + if decoded, err := hex.DecodeString(raw); err == nil && len(decoded) == 32 { + return decoded, nil + } + return nil, errors.New("LANDWELLE_APP_PUSH_ENCRYPTION_KEY muss 32 Byte als Base64 oder Hex enthalten") +} + +func encryptToken(key, plaintext []byte) ([]byte, error) { + block, err := aes.NewCipher(key) + if err != nil { + return nil, err + } + gcm, err := cipher.NewGCM(block) + if err != nil { + return nil, err + } + nonce := make([]byte, gcm.NonceSize()) + if _, err := rand.Read(nonce); err != nil { + return nil, err + } + return gcm.Seal(nonce, nonce, plaintext, nil), nil +} + +func decryptToken(key, ciphertext []byte) ([]byte, error) { + block, err := aes.NewCipher(key) + if err != nil { + return nil, err + } + gcm, err := cipher.NewGCM(block) + if err != nil { + return nil, err + } + if len(ciphertext) < gcm.NonceSize() { + return nil, errors.New("verschlüsselter Push-Token ist unvollständig") + } + nonce := ciphertext[:gcm.NonceSize()] + payload := ciphertext[gcm.NonceSize():] + return gcm.Open(nil, nonce, payload, nil) +} + +func newUUID() string { + b := make([]byte, 16) + if _, err := rand.Read(b); err != nil { + panic(err) + } + b[6] = (b[6] & 0x0f) | 0x40 + b[8] = (b[8] & 0x3f) | 0x80 + return fmt.Sprintf("%08x-%04x-%04x-%04x-%012x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:16]) +} + +func allowedValue(value string, allowed ...string) bool { + for _, candidate := range allowed { + if value == candidate { + return true + } + } + return false +} + +func limitString(value string, max int) string { + value = strings.TrimSpace(value) + runes := []rune(value) + if len(runes) > max { + runes = runes[:max] + } + return string(runes) +} + +// constantTimeEqual is kept for future token rotation support and tested now. +func constantTimeEqual(a, b []byte) bool { + if len(a) != len(b) { + return false + } + return subtle.ConstantTimeCompare(a, b) == 1 +} + +func sortedUnique(values []string) []string { + seen := map[string]bool{} + out := make([]string, 0, len(values)) + for _, value := range values { + value = strings.TrimSpace(value) + if value == "" || seen[value] { + continue + } + seen[value] = true + out = append(out, value) + } + sort.Strings(out) + return out +} + +type mobileNewsItem struct { + SortTime time.Time + Payload map[string]any +} + +func mobileNewsList(r *http.Request, deps mobileAPIDependencies, limit, offset int, region string) ([]map[string]any, int, error) { + if limit < 1 || limit > 100 { + limit = 20 + } + if offset < 0 { + offset = 0 + } + fetchLimit := limit + offset + 20 + items := make([]mobileNewsItem, 0, fetchLimit*2) + + if deps.editorial != nil { + entries, err := deps.editorial.PublishedNews(r.Context(), fetchLimit) + if err != nil && deps.editorial.Enabled() { + return nil, 0, err + } + for _, entry := range entries { + regions := []string{"niedersachsen"} + if slug := slugify(entry.Location); strings.TrimSpace(entry.Location) != "" { + regions = []string{slug} + } + if region != "" && !containsString(regions, region) && region != "niedersachsen" { + continue + } + imageURL := strings.TrimSpace(entry.MediaURL) + if imageURL == "" { + imageURL = "/assets/news-region-v14.jpg" + } + items = append(items, mobileNewsItem{SortTime: entry.UpdatedAt, Payload: map[string]any{ + "id": "editorial:" + entry.Slug, "numeric_id": entry.ID, "content_type": "editorial", + "title": entry.Title, "summary": entry.Teaser, "location": entry.Location, + "image_url": publicURL(r, imageURL), "image_alt": entry.MediaAlt, + "published_at": entry.UpdatedAt, "regions": regions, + "detail_url": apiRequestBase(r) + "/news/editorial/" + entry.Slug, + "web_url": publicURL(r, "/aktuelles/"+entry.Slug), "external_url": nil, + "source": map[string]any{"name": "Landwelle Redaktion", "website_url": "https://landwelle.de"}, + "ai_transparency": editorialAITransparencyPayload(entry), + }}) + } + } + + if deps.rss != nil { + records, _, err := deps.rss.PublicItems(r.Context(), fetchLimit, "", region) + if err != nil { + return nil, 0, err + } + for _, record := range records { + payload := feedRecordJSON(r, record) + payload["id"] = "rss:" + strconv.FormatInt(record.ID, 10) + payload["numeric_id"] = record.ID + payload["detail_url"] = apiRequestBase(r) + "/news/rss/" + strconv.FormatInt(record.ID, 10) + items = append(items, mobileNewsItem{SortTime: record.PublishedAt, Payload: payload}) + } + } + + sort.SliceStable(items, func(i, j int) bool { return items[i].SortTime.After(items[j].SortTime) }) + total := len(items) + if offset >= total { + return []map[string]any{}, total, nil + } + end := offset + limit + if end > total { + end = total + } + result := make([]map[string]any, 0, end-offset) + for _, item := range items[offset:end] { + result = append(result, item.Payload) + } + return result, total, nil +} + +func containsString(values []string, candidate string) bool { + candidate = strings.ToLower(strings.TrimSpace(candidate)) + for _, value := range values { + if strings.ToLower(strings.TrimSpace(value)) == candidate { + return true + } + } + return false +} diff --git a/app_api_test.go b/app_api_test.go new file mode 100644 index 0000000..9809cea --- /dev/null +++ b/app_api_test.go @@ -0,0 +1,161 @@ +package main + +import ( + "encoding/json" + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +func TestExternalV1AliasBootstrap(t *testing.T) { + req := httptest.NewRequest(http.MethodGet, "https://api.landwelle.de/v1/app/bootstrap", nil) + rec := httptest.NewRecorder() + apiTestMux().ServeHTTP(rec, req) + if rec.Code != http.StatusOK { + t.Fatalf("expected 200, got %d: %s", rec.Code, rec.Body.String()) + } + var body struct { + Data struct { + Endpoints map[string]string `json:"endpoints"` + } `json:"data"` + } + if err := json.Unmarshal(rec.Body.Bytes(), &body); err != nil { + t.Fatalf("invalid JSON: %v", err) + } + if got := body.Data.Endpoints["now"]; got != "/v1/now" { + t.Fatalf("expected external alias endpoint /v1/now, got %q", got) + } +} + +func TestUnknownExternalV1EndpointReturnsJSON404(t *testing.T) { + req := httptest.NewRequest(http.MethodGet, "https://api.landwelle.de/v1/does-not-exist", nil) + rec := httptest.NewRecorder() + apiTestMux().ServeHTTP(rec, req) + if rec.Code != http.StatusNotFound { + t.Fatalf("expected 404, got %d: %s", rec.Code, rec.Body.String()) + } + if contentType := rec.Header().Get("Content-Type"); !strings.Contains(contentType, "application/json") { + t.Fatalf("expected JSON response, got %q", contentType) + } +} + +func TestCompatibilityRejectsUnknownPlatform(t *testing.T) { + req := httptest.NewRequest(http.MethodGet, "https://api.landwelle.de/v1/app/compatibility?platform=windows", nil) + rec := httptest.NewRecorder() + apiTestMux().ServeHTTP(rec, req) + if rec.Code != http.StatusBadRequest { + t.Fatalf("expected 400, got %d", rec.Code) + } +} + +func TestVersionComparison(t *testing.T) { + cases := []struct { + a, b string + want int + }{ + {"1.0.0", "1.0.1", -1}, + {"1.2.0", "1.1.9", 1}, + {"v2.0", "2.0.0", 0}, + } + for _, tc := range cases { + if got := compareVersions(tc.a, tc.b); got != tc.want { + t.Fatalf("compareVersions(%q,%q)=%d, want %d", tc.a, tc.b, got, tc.want) + } + } +} + +func TestGeneratedUUIDIsValid(t *testing.T) { + for i := 0; i < 10; i++ { + if id := newUUID(); !uuidPattern.MatchString(id) { + t.Fatalf("generated invalid UUID: %q", id) + } + } +} + +func TestInstallationRegistrationRequiresDatabase(t *testing.T) { + body := `{"platform":"android","device_class":"phone","distribution_channel":"development","app_version":"1.0.0"}` + req := httptest.NewRequest(http.MethodPost, "https://api.landwelle.de/v1/installations", strings.NewReader(body)) + req.Header.Set("Content-Type", "application/json") + rec := httptest.NewRecorder() + apiTestMux().ServeHTTP(rec, req) + if rec.Code != http.StatusServiceUnavailable { + t.Fatalf("expected 503, got %d: %s", rec.Code, rec.Body.String()) + } +} + +func TestExternalNewsFallback(t *testing.T) { + req := httptest.NewRequest(http.MethodGet, "https://api.landwelle.de/v1/news?limit=2", nil) + rec := httptest.NewRecorder() + apiTestMux().ServeHTTP(rec, req) + if rec.Code != http.StatusOK { + t.Fatalf("expected 200, got %d: %s", rec.Code, rec.Body.String()) + } + var body struct { + Data []map[string]any `json:"data"` + } + if err := json.Unmarshal(rec.Body.Bytes(), &body); err != nil { + t.Fatalf("invalid JSON: %v", err) + } + if len(body.Data) != 2 { + t.Fatalf("expected 2 fallback news items, got %d", len(body.Data)) + } +} + +func TestExternalV1RootReportsContractVersion(t *testing.T) { + req := httptest.NewRequest(http.MethodGet, "https://api.landwelle.de/v1", nil) + rec := httptest.NewRecorder() + apiTestMux().ServeHTTP(rec, req) + if rec.Code != http.StatusOK { + t.Fatalf("expected 200, got %d: %s", rec.Code, rec.Body.String()) + } + var body struct { + Data map[string]any `json:"data"` + Meta map[string]any `json:"meta"` + } + if err := json.Unmarshal(rec.Body.Bytes(), &body); err != nil { + t.Fatalf("invalid JSON: %v", err) + } + if body.Data["contract"] != apiContractVersion || body.Meta["contract_version"] != apiContractVersion { + t.Fatalf("contract version missing: %#v %#v", body.Data, body.Meta) + } +} + +func TestCompatibilityRejectsInvalidChannel(t *testing.T) { + req := httptest.NewRequest(http.MethodGet, "https://api.landwelle.de/v1/app/compatibility?platform=ios&channel=google_play", nil) + rec := httptest.NewRecorder() + apiTestMux().ServeHTTP(rec, req) + if rec.Code != http.StatusBadRequest { + t.Fatalf("expected 400, got %d: %s", rec.Code, rec.Body.String()) + } +} + +func TestAppUpdateAvailableDoesNotDowngradeNewerVersion(t *testing.T) { + if appUpdateAvailable("2.0.0", "1", "1.9.9", "999") { + t.Fatal("newer installed version must not be marked as updateable because of a lower build number") + } + if !appUpdateAvailable("1.2.0", "10", "1.2.0", "11") { + t.Fatal("same version with lower build should be marked as updateable") + } +} + +func TestUsagePropertiesWhitelist(t *testing.T) { + if _, err := validateUsageProperties("stream_stop", map[string]any{"duration_seconds": float64(125), "reason": "user"}); err != nil { + t.Fatalf("expected valid properties, got %v", err) + } + if _, err := validateUsageProperties("stream_stop", map[string]any{"url": "https://example.invalid"}); err == nil { + t.Fatal("unexpected arbitrary property accepted") + } + if _, err := validateUsageProperties("news_open", map[string]any{"content_id": strings.Repeat("x", 201)}); err == nil { + t.Fatal("oversized content id accepted") + } +} + +func TestMobileEventWithoutImageDoesNotReturnHostRoot(t *testing.T) { + req := httptest.NewRequest(http.MethodGet, "https://api.landwelle.de/v1/events/1", nil) + item := CalendarEvent{ID: 1, Title: "Test"} + data := mobileEventJSON(req, item) + if got := data["image_url"]; got != "" { + t.Fatalf("expected empty image URL, got %#v", got) + } +} diff --git a/app_push_v1543_test.go b/app_push_v1543_test.go new file mode 100644 index 0000000..b4b9796 --- /dev/null +++ b/app_push_v1543_test.go @@ -0,0 +1,36 @@ +package main + +import ( + "os" + "strings" + "testing" +) + +func TestAppPushMigrationContainsRequiredProductionObjects(t *testing.T) { + raw, err := os.ReadFile("migrations/0043_app_push_wishbox_production.sql") + if err != nil { + t.Fatal(err) + } + s := string(raw) + for _, expected := range []string{"CREATE TABLE IF NOT EXISTS push_openings", "breaking-news", "niedersachsen", "program"} { + if !strings.Contains(s, expected) { + t.Fatalf("migration missing %q", expected) + } + } +} + +func TestAppPushAdminTemplateContainsSendAndStatistics(t *testing.T) { + raw, err := os.ReadFile("web/admin/push.html") + if err != nil { + t.Fatal(err) + } + s := string(raw) + for _, expected := range []string{"Sofort senden", "Aktive FCM-Tokens", "Letzte Push-Kampagnen", "Deep Link"} { + if !strings.Contains(s, expected) { + t.Fatalf("push admin template missing %q", expected) + } + } + if !strings.Contains(adminNavigationHTML(), `href="/admin/app/push"`) { + t.Fatal("admin navigation does not contain /admin/app/push") + } +} diff --git a/audio_mix.go b/audio_mix.go new file mode 100644 index 0000000..98128cc --- /dev/null +++ b/audio_mix.go @@ -0,0 +1,59 @@ +package main + +import ( + "context" + "fmt" + "os" + "os/exec" + "path/filepath" + "strconv" + "strings" +) + +func mixAudio(ctx context.Context, voice, background, output string, ttsVolume, bgVolume float64) error { + filter := audioMixFilter(ttsVolume, bgVolume) + cmd := exec.CommandContext(ctx, "ffmpeg", "-y", "-i", voice, "-stream_loop", "-1", "-i", background, "-filter_complex", filter, "-map", "[out]", "-codec:a", "libmp3lame", "-b:a", "192k", output) + if b, err := cmd.CombinedOutput(); err != nil { + return fmt.Errorf("Audio-Mix fehlgeschlagen (ffmpeg erforderlich): %v: %s", err, string(b)) + } + return nil +} + +func audioMixFilter(ttsVolume, bgVolume float64) string { + return fmt.Sprintf("[0:a]volume=%sdB[a0];[1:a]volume=%sdB[a1];[a0][a1]amix=inputs=2:duration=first:dropout_transition=2:normalize=0[out]", strconv.FormatFloat(ttsVolume, 'f', 2, 64), strconv.FormatFloat(bgVolume, 'f', 2, 64)) +} + +func audioGainFilter(gain float64) string { + return "volume=" + strconv.FormatFloat(gain, 'f', 2, 64) + "dB" +} + +func applyAudioGain(ctx context.Context, input, output string, gain float64) error { + cmd := exec.CommandContext(ctx, "ffmpeg", "-y", "-i", input, "-af", audioGainFilter(gain), "-codec:a", "libmp3lame", "-b:a", "192k", output) + if b, err := cmd.CombinedOutput(); err != nil { + return fmt.Errorf("Audio-Pegelung fehlgeschlagen (ffmpeg erforderlich): %v: %s", err, string(b)) + } + return nil +} + +func removeLocalProductionPaths(paths []string) error { + seen := map[string]bool{} + var errs []string + for _, raw := range paths { + path := strings.TrimSpace(raw) + if path == "" { + continue + } + path = filepath.Clean(path) + if seen[path] { + continue + } + seen[path] = true + if err := os.Remove(path); err != nil && !os.IsNotExist(err) { + errs = append(errs, path+": "+err.Error()) + } + } + if len(errs) > 0 { + return fmt.Errorf("lokale Produktionsdateien konnten nicht vollständig gelöscht werden: %s", strings.Join(errs, "; ")) + } + return nil +} diff --git a/audio_mix_v1543_test.go b/audio_mix_v1543_test.go new file mode 100644 index 0000000..131c10c --- /dev/null +++ b/audio_mix_v1543_test.go @@ -0,0 +1,21 @@ +package main + +import ( + "strings" + "testing" +) + +func TestAudioMixFilterContainsConfiguredDBValues(t *testing.T) { + filter := audioMixFilter(7.5, -21.0) + for _, expected := range []string{"volume=7.50dB", "volume=-21.00dB", "normalize=0"} { + if !strings.Contains(filter, expected) { + t.Fatalf("mix filter %q missing %q", filter, expected) + } + } +} + +func TestAudioGainFilterContainsConfiguredTTSDB(t *testing.T) { + if got := audioGainFilter(-3.5); got != "volume=-3.50dB" { + t.Fatalf("unexpected gain filter %q", got) + } +} diff --git a/auto_task_cron_v1531_test.go b/auto_task_cron_v1531_test.go new file mode 100644 index 0000000..dbb1bc9 --- /dev/null +++ b/auto_task_cron_v1531_test.go @@ -0,0 +1,119 @@ +package main + +import ( + "bytes" + "net/http/httptest" + "os" + "strings" + "testing" + "time" +) + +func TestAutoTaskDueUsesEuropeBerlin(t *testing.T) { + // 18.08.2026 ist Dienstag. 10:15 UTC entspricht in Berlin 12:15 CEST. + now := time.Date(2026, 8, 18, 10, 15, 20, 0, time.UTC) + task := AIAutoTask{TaskKey: "news:news", RunTime: "12:15", Days: []int{2}, Active: true} + if !autoTaskIsDue(task, now) { + t.Fatal("Aufgabe sollte für Dienstag 12:15 Europe/Berlin fällig sein") + } + task.RunTime = "12:16" + if autoTaskIsDue(task, now) { + t.Fatal("Aufgabe darf außerhalb der geplanten Minute nicht fällig sein") + } + task.RunTime = "12:15" + task.Days = []int{1} + if autoTaskIsDue(task, now) { + t.Fatal("Aufgabe darf am falschen Wochentag nicht fällig sein") + } +} + +func TestAutoTaskRunnerRejectsUnsupportedKeys(t *testing.T) { + for _, key := range []string{"news:news", "news:sport", "news:weather"} { + if !supportedAutoTaskKey(key) { + t.Fatalf("erwarteter Task-Key %q fehlt in Whitelist", key) + } + } + for _, key := range []string{"shell:rm", "curl:https://example.invalid", "news:unknown", ""} { + if supportedAutoTaskKey(key) { + t.Fatalf("nicht erlaubter Task-Key %q wurde akzeptiert", key) + } + } +} + +func TestCronRequestRequiresConfiguredToken(t *testing.T) { + t.Setenv("LANDWELLE_CRON_TOKEN", "cron-test-secret") + req := httptest.NewRequest("POST", "http://127.0.0.1:2200/internal/cron", nil) + if cronRequestAuthorized(req) { + t.Fatal("Request ohne Token darf nicht autorisiert sein") + } + req.Header.Set("X-Landwelle-Cron-Token", "wrong") + if cronRequestAuthorized(req) { + t.Fatal("Request mit falschem Token darf nicht autorisiert sein") + } + req.Header.Set("X-Landwelle-Cron-Token", "cron-test-secret") + if !cronRequestAuthorized(req) { + t.Fatal("Request mit korrektem Cron-Token sollte autorisiert sein") + } +} + +func TestSameAutoTaskMinutePreventsDuplicateTrigger(t *testing.T) { + now := time.Date(2026, 8, 18, 10, 15, 40, 0, time.UTC) + last := time.Date(2026, 8, 18, 10, 15, 2, 0, time.UTC) + if !sameAutoTaskMinute(&last, now) { + t.Fatal("gleiche Berliner Planminute muss als bereits ausgeführt erkannt werden") + } + older := time.Date(2026, 8, 18, 10, 14, 59, 0, time.UTC) + if sameAutoTaskMinute(&older, now) { + t.Fatal("vorherige Minute darf nicht als aktueller Lauf gelten") + } +} + +func TestAutoTasksAdminTemplateShowsCentralCron(t *testing.T) { + tmpl, err := parseAdminTemplate("web/admin/auto-tasks.html") + if err != nil { + t.Fatal(err) + } + now := time.Date(2026, 8, 18, 15, 34, 0, 0, berlinLocation()) + data := adminAutoTasksData{ + Username: "admin", CSRFToken: "csrf", + Cron: AICronAdminStatus{ + TokenConfigured: true, LocalEndpoint: "http://127.0.0.1:2200/internal/cron", + PublicEndpoint: "https://landwelle.de/internal/cron", KeyHelpCommand: "curl test", + Schedule: "* * * * *", Timezone: "Europe/Berlin", Health: "ok", HealthLabel: "KeyHelp-Cron aktiv", + HealthText: "aktiv", LastPingAt: &now, CallCount: 3, IntervalSeconds: 60, LastStatus: "ok", + }, + } + var buf bytes.Buffer + if err := tmpl.ExecuteTemplate(&buf, "auto-tasks-admin.html", data); err != nil { + t.Fatal(err) + } + html := buf.String() + for _, want := range []string{"KeyHelp-Cron aktiv", "http://127.0.0.1:2200/internal/cron", "* * * * *", "Europe/Berlin", "Befehl kopieren"} { + if !strings.Contains(html, want) { + t.Fatalf("Adminseite enthält %q nicht", want) + } + } +} + +func TestInternalMinuteSchedulerIsRemoved(t *testing.T) { + raw, err := os.ReadFile("main.go") + if err != nil { + t.Fatal(err) + } + if strings.Contains(string(raw), "startAutoTaskScheduler()") { + t.Fatal("main.go darf den alten internen Auto-Task-Scheduler nicht mehr starten") + } +} + +func TestCronMigrationExists(t *testing.T) { + raw, err := os.ReadFile("migrations/0041_ai_central_cron_runner.sql") + if err != nil { + t.Fatal(err) + } + sql := string(raw) + for _, want := range []string{"ai_cron_state", "previous_ping_at", "last_ping_at", "call_count"} { + if !strings.Contains(sql, want) { + t.Fatalf("Migration enthält %q nicht", want) + } + } +} diff --git a/auto_task_split_v1541_test.go b/auto_task_split_v1541_test.go new file mode 100644 index 0000000..634732d --- /dev/null +++ b/auto_task_split_v1541_test.go @@ -0,0 +1,33 @@ +package main + +import ( + "os" + "strings" + "testing" +) + +func TestAutoTaskSplitMigrationExistsAndSplitsBundle(t *testing.T) { + raw, err := os.ReadFile("migrations/0042_split_ai_auto_tasks.sql") + if err != nil { + t.Fatal(err) + } + sql := string(raw) + for _, want := range []string{"news:bundle", "news:news", "news:sport", "news:weather", "run_time", "days", "active"} { + if !strings.Contains(sql, want) { + t.Fatalf("split migration missing %q", want) + } + } +} + +func TestAutoTaskAdminUsesV4Assets(t *testing.T) { + raw, err := os.ReadFile("web/admin/auto-tasks.html") + if err != nil { + t.Fatal(err) + } + html := string(raw) + for _, want := range []string{"/assets/admin-auto-tasks-v4.css", "/assets/admin-auto-tasks-v4.js"} { + if !strings.Contains(html, want) { + t.Fatalf("auto task admin missing %q", want) + } + } +} diff --git a/chart_admin_metadata_test.go b/chart_admin_metadata_test.go new file mode 100644 index 0000000..11908ce --- /dev/null +++ b/chart_admin_metadata_test.go @@ -0,0 +1,91 @@ +package main + +import ( + "bytes" + "net/http" + "net/http/httptest" + "os" + "path/filepath" + "strings" + "testing" +) + +func TestChartTemplateUsesAutoClearAndNoActiveColumn(t *testing.T) { + raw, err := os.ReadFile(filepath.Join("web", "admin", "management.html")) + if err != nil { + t.Fatal(err) + } + text := string(raw) + for _, want := range []string{"admin-charts-v7.css", "admin-charts-v7.js", "data-chart-auto", "data-chart-clear", "A = Auto", "L = Leeren"} { + if !strings.Contains(text, want) { + t.Fatalf("chart template missing %q", want) + } + } + rowStart := strings.Index(text, `{{define "chart-editor-row"}}`) + rowEnd := strings.Index(text[rowStart:], `{{end}}`) + if rowStart < 0 || rowEnd < 0 { + t.Fatal("chart row template not found") + } + row := text[rowStart : rowStart+rowEnd] + for _, forbidden := range []string{`name="active"`, `Hörprobe-URL`, `value="archive"`, `value="delete"`} { + if strings.Contains(row, forbidden) { + t.Fatalf("chart row still contains %q", forbidden) + } + } + if strings.Contains(text, `HörprobePunkte manuell`) { + t.Fatal("running chart table still contains a preview column") + } +} + +func TestChartRowStillRendersImportedData(t *testing.T) { + tmpl, err := parseAdminTemplate("web/admin/management.html") + if err != nil { + t.Fatal(err) + } + entry := ChartEntry{ID: 7, ChartKey: "listener", Position: 4, Artist: "Test Artist", Title: "Test Song", StoreURL: "https://youtu.be/dQw4w9WgXcQ", ManualPoints: 2, FixedVotePoints: 8, VotePoints: 13, VoteCount: 1, Active: true} + data := adminManagementData{Username: "admin", CSRFToken: "csrf", Module: "charts", DatabaseReady: true, ChartKey: "listener", ChartTitle: adminChartTitle("listener"), Charts: []ChartEntry{entry}, OtherCharts: []ChartEntry{entry}, MainChartRows: makeAdminChartRows([]ChartEntry{entry}, "csrf", "listener"), ChartMainEnd: 32, ChartTotalEnd: 45, ChartMainTitle: "Platz 4 bis 32", ChartPreviewTitle: "Neuvorstellungen 33 bis 45", CurrentYear: 2026} + var out bytes.Buffer + if err := tmpl.ExecuteTemplate(&out, "management-admin.html", data); err != nil { + t.Fatal(err) + } + html := out.String() + for _, want := range []string{"Test Artist", "Test Song", `data-position="4"`, `name="manual_points"`, `data-chart-auto`, `data-chart-vote-total`, ">13<"} { + if !strings.Contains(html, want) { + t.Fatalf("rendered chart row missing %q", want) + } + } + if strings.Contains(html, `name="fixed_vote_points"`) { + t.Fatal("fixed voting evaluation is still rendered as an input") + } +} + +func TestChartYouTubeMetadata(t *testing.T) { + id := chartYouTubeVideoID("https://www.youtube.com/watch?v=dQw4w9WgXcQ") + if id != "dQw4w9WgXcQ" { + t.Fatalf("unexpected id %q", id) + } + store, preview, cover := chartMediaValues("https://youtu.be/dQw4w9WgXcQ", "", "") + if store == "" || preview != store || !strings.Contains(cover, id) { + t.Fatalf("unexpected media values: %q %q %q", store, preview, cover) + } +} + +func TestChartITunesLookupParsing(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + _, _ = w.Write([]byte(`{"results":[{"artistName":"Landwelle Artist","trackName":"Landwelle Song","trackViewUrl":"https://music.apple.com/test","previewUrl":"https://audio.example/test.m4a","artworkUrl100":"https://is1-ssl.mzstatic.com/image/thumb/test/100x100bb.jpg","releaseDate":"2026-07-22T00:00:00Z"}]}`)) + })) + defer server.Close() + oldURL, oldClient := chartITunesSearchURL, chartMetadataHTTPClient + chartITunesSearchURL, chartMetadataHTTPClient = server.URL, server.Client() + defer func() { chartITunesSearchURL, chartMetadataHTTPClient = oldURL, oldClient }() + + req := httptest.NewRequest(http.MethodGet, "/", nil) + metadata, err := lookupChartMetadataITunes(req, "Landwelle Artist", "Landwelle Song") + if err != nil { + t.Fatal(err) + } + if metadata.PreviewURL == "" || metadata.StoreURL == "" || metadata.EntryYear != 2026 || metadata.EntryMonth != 7 || !strings.Contains(metadata.CoverURL, "600x600bb") { + t.Fatalf("unexpected metadata: %#v", metadata) + } +} diff --git a/chart_features.go b/chart_features.go new file mode 100644 index 0000000..85c2537 --- /dev/null +++ b/chart_features.go @@ -0,0 +1,188 @@ +package main + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "strconv" + "strings" +) + +type chartRangeSpec struct { + MainEnd int + TotalEnd int + MainTitle string + NewTitle string +} + +func chartRanges(chartKey string) chartRangeSpec { + switch normalizeAdminChartKey(chartKey) { + case "dockx": + return chartRangeSpec{MainEnd: 30, TotalEnd: 40, MainTitle: "Platz 4 bis 30", NewTitle: "Neuvorstellungen 31 bis 40"} + case "schlager": + return chartRangeSpec{MainEnd: 25, TotalEnd: 35, MainTitle: "Platz 4 bis 25", NewTitle: "Neuvorstellungen 26 bis 35"} + case "annual": + return chartRangeSpec{MainEnd: 100, TotalEnd: 100, MainTitle: "Platz 4 bis 100", NewTitle: ""} + default: + return chartRangeSpec{MainEnd: 32, TotalEnd: 45, MainTitle: "Platz 4 bis 32", NewTitle: "Neuvorstellungen 33 bis 45"} + } +} + +func extendChartRangeToEntries(chartKey string, spec chartRangeSpec, entries []ChartEntry) chartRangeSpec { + if normalizeAdminChartKey(chartKey) == "annual" { + return spec + } + maxPosition := spec.TotalEnd + for _, entry := range entries { + if entry.Position > maxPosition { + maxPosition = entry.Position + } + } + if maxPosition <= spec.TotalEnd { + return spec + } + spec.TotalEnd = maxPosition + if spec.NewTitle != "" { + spec.NewTitle = fmt.Sprintf("Neuvorstellungen %d bis %d", spec.MainEnd+1, spec.TotalEnd) + } + return spec +} + +func splitChartEntries(entries []ChartEntry, spec chartRangeSpec) (top, main, preview []ChartEntry) { + for _, entry := range entries { + switch { + case entry.Position >= 1 && entry.Position <= 3: + top = append(top, entry) + case entry.Position >= 4 && entry.Position <= spec.MainEnd: + main = append(main, entry) + case entry.Position > spec.MainEnd && entry.Position <= spec.TotalEnd: + preview = append(preview, entry) + } + } + return +} + +func (s *chartStore) AnnualYears(ctx context.Context) ([]ChartYear, error) { + if s == nil || s.db == nil || !s.db.Enabled() { + return nil, nil + } + var years []ChartYear + query := `SELECT COALESCE(json_agg(json_build_object( +'chart_year',y.chart_year,'label',y.label,'is_active',y.is_active,'entry_count',COALESCE(c.entry_count,0)) ORDER BY y.chart_year DESC),'[]'::json)::text +FROM chart_years y LEFT JOIN (SELECT chart_year,count(*)::int AS entry_count FROM chart_year_entries GROUP BY chart_year) c ON c.chart_year=y.chart_year;` + if err := s.db.queryJSON(ctx, query, &years); err != nil { + return nil, err + } + return years, nil +} + +func (s *chartStore) AnnualChart(ctx context.Context, year int) ([]ChartEntry, error) { + if s == nil || s.db == nil || !s.db.Enabled() { + return nil, nil + } + yearSQL := strconv.Itoa(year) + if year < 1900 || year > 2200 { + yearSQL = `COALESCE((SELECT max(chart_year) FROM chart_years WHERE is_active=true),(SELECT max(chart_year) FROM chart_year_entries))` + } + query := fmt.Sprintf(`SELECT COALESCE(json_agg(x ORDER BY x.position),'[]'::json) FROM ( +SELECT e.id,COALESCE(e.legacy_id,0) AS legacy_id,'annual' AS chart_key,e.position, +COALESCE(e.previous_week_position,0) AS previous_position,e.position AS entry_position,e.artist,e.title, +COALESCE(e.cover_url,'') AS cover_url,COALESCE(e.preview_url,'') AS preview_url,COALESCE(e.store_url,'') AS store_url, +0 AS weeks,0 AS manual_points,COALESCE(e.fixed_points,0) AS fixed_vote_points, +COALESCE(e.entry_year,0) AS entry_year,COALESCE(e.entry_month,0) AS entry_month, +COALESCE(e.current_week_position,e.position) AS current_week_position,COALESCE(e.previous_week_position,0) AS previous_week_position, +true AS active,to_char(e.updated_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS updated_at, +0::float8 AS vote_average,0::int AS vote_count,COALESCE(e.fixed_points,0)::int AS vote_points, +EXISTS(SELECT 1 FROM chart_song_infos si WHERE si.chart_year=e.chart_year AND si.position=e.position AND (COALESCE(si.artist_info,'')<>'' OR COALESCE(si.song_info,'')<>'')) AS has_info, +CASE WHEN COALESCE(e.previous_week_position,0)=0 THEN 'new' WHEN e.previous_week_position>e.position THEN 'up' WHEN e.previous_week_position'' AND btrim(e.title)<>'' ORDER BY e.position ASC LIMIT 200) x;`, yearSQL) + var out []ChartEntry + if err := s.db.queryJSON(ctx, query, &out); err != nil { + return nil, err + } + return out, nil +} + +type chartSongInfo struct { + ChartYear int `json:"chart_year"` + Position int `json:"position"` + Artist string `json:"artist"` + Title string `json:"title"` + ArtistInfo string `json:"artist_info"` + SongInfo string `json:"song_info"` + ReleaseYear int `json:"release_year"` + Genre string `json:"genre"` + DanceStyles string `json:"dance_styles"` + GeneratedBy string `json:"generated_by"` + GeneratedAt string `json:"generated_at"` + AIGenerated bool `json:"ai_generated"` + AIDisclosure string `json:"ai_disclosure"` +} + +func (s *chartStore) SongInfo(ctx context.Context, year, position int) (chartSongInfo, error) { + var info chartSongInfo + if s == nil || s.db == nil || !s.db.Enabled() { + return info, fmt.Errorf("PostgreSQL ist nicht verfügbar") + } + query := fmt.Sprintf(`SELECT COALESCE((SELECT json_build_object( +'chart_year',chart_year,'position',position,'artist',artist,'title',title,'artist_info',COALESCE(artist_info,''), +'song_info',COALESCE(song_info,''),'release_year',COALESCE(release_year,0),'genre',COALESCE(genre,''), +'dance_styles',COALESCE(dance_styles,''),'generated_by',COALESCE(generated_by,''), +'generated_at',COALESCE(to_char(generated_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"'),''), +'ai_generated',true,'ai_disclosure','Diese Titelinformationen wurden mit künstlicher Intelligenz erstellt und können trotz Plausibilitätsprüfung Fehler enthalten.' +) FROM chart_song_infos WHERE chart_year=%d AND position=%d LIMIT 1),'{}'::json)::text;`, year, position) + if err := s.db.queryJSON(ctx, query, &info); err != nil { + return info, err + } + if info.Position == 0 { + return info, fmt.Errorf("Für diesen Titel liegen noch keine KI-Informationen vor") + } + return info, nil +} + +func chartSongInfoAPI(store *chartStore) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Nur GET erlaubt.") + return + } + year, _ := strconv.Atoi(r.URL.Query().Get("year")) + position, _ := strconv.Atoi(r.URL.Query().Get("position")) + if year < 1900 || year > 2200 || position < 1 || position > 200 { + writeAPIError(w, http.StatusBadRequest, "invalid_parameters", "Jahr oder Position ist ungültig.") + return + } + info, err := store.SongInfo(r.Context(), year, position) + if err != nil { + writeAPIError(w, http.StatusNotFound, "not_found", err.Error()) + return + } + writeJSON(w, http.StatusOK, map[string]any{"ok": true, "data": info}) + } +} + +func compactChartInfoText(value string) string { + return strings.TrimSpace(strings.ReplaceAll(value, "\x00", "")) +} + +func decodeChartSongInfo(raw string) (chartSongInfo, error) { + var info chartSongInfo + raw = strings.TrimSpace(raw) + if start := strings.Index(raw, "{"); start >= 0 { + if end := strings.LastIndex(raw, "}"); end > start { + raw = raw[start : end+1] + } + } + if err := json.Unmarshal([]byte(raw), &info); err != nil { + return info, err + } + info.ArtistInfo = compactChartInfoText(info.ArtistInfo) + info.SongInfo = compactChartInfoText(info.SongInfo) + info.Genre = compactChartInfoText(info.Genre) + info.DanceStyles = compactChartInfoText(info.DanceStyles) + if info.ArtistInfo == "" && info.SongInfo == "" { + return info, fmt.Errorf("OpenAI lieferte keine verwertbaren Titelinformationen") + } + return info, nil +} diff --git a/chart_manual_points_delta_test.go b/chart_manual_points_delta_test.go new file mode 100644 index 0000000..06370bd --- /dev/null +++ b/chart_manual_points_delta_test.go @@ -0,0 +1,66 @@ +package main + +import ( + "os" + "strings" + "testing" +) + +func TestChartManualPointsUpdateUsesOnlyDelta(t *testing.T) { + sql := chartManualPointsUpdateSQL(30) + for _, want := range []string{ + "COALESCE(fixed_vote_points,0)", + "30::bigint-COALESCE(manual_points,0)::bigint", + "manual_points=30", + } { + if !strings.Contains(sql, want) { + t.Fatalf("manual point adjustment SQL missing %q: %s", want, sql) + } + } + if strings.Contains(sql, "fixed_vote_points=30") { + t.Fatal("manual points must adjust the existing base by the delta, not replace it") + } +} + +func TestNewChartEntryUsesInitialManualPointsAsVotingBase(t *testing.T) { + raw, err := os.ReadFile("admin_management.go") + if err != nil { + t.Fatal(err) + } + text := string(raw) + if !strings.Contains(text, "formInt(r, \"weeks\"), manualPoints, manualPoints, formInt(r, \"entry_year\")") { + t.Fatal("new chart entries must initialize fixed_vote_points from manual_points") + } +} + +func TestChartAutosaveReturnsAndRendersUpdatedVotingStand(t *testing.T) { + apiRaw, err := os.ReadFile("admin_charts_api.go") + if err != nil { + t.Fatal(err) + } + api := string(apiRaw) + for _, want := range []string{ + `response["vote_points"] = summary.VotePoints`, + `response["vote_count"] = summary.VoteCount`, + "LEFT JOIN chart_vote_history v ON v.entry_id=e.id", + } { + if !strings.Contains(api, want) { + t.Fatalf("autosave response missing %q", want) + } + } + + jsRaw, err := os.ReadFile("web/assets/admin-charts-v7.js") + if err != nil { + t.Fatal(err) + } + js := string(jsRaw) + for _, want := range []string{ + "applyVotingSummary(row,payload)", + "data-chart-vote-total", + "payload.vote_points", + } { + if !strings.Contains(js, want) { + t.Fatalf("chart admin JS missing %q", want) + } + } +} diff --git a/chart_platform_test.go b/chart_platform_test.go new file mode 100644 index 0000000..e062880 --- /dev/null +++ b/chart_platform_test.go @@ -0,0 +1,107 @@ +package main + +import ( + "bytes" + "html/template" + "net/http" + "net/http/httptest" + "os" + "path/filepath" + "strings" + "testing" +) + +func TestPublicChartTemplateParses(t *testing.T) { + tmpl, err := template.New("landwelle").Funcs(template.FuncMap{ + "year": func() int { return 2026 }, "seoHead": seoHead, "playlistURL": playlistPageURL, + "publicNavigation": func() template.HTML { return navigationHTML(defaultNavigationItems()) }, + "seq": func(a, b int) []int { + out := make([]int, 0, b-a+1) + for i := a; i <= b; i++ { + out = append(out, i) + } + return out + }, + }).ParseFS(webFS, "web/partials.html", "web/charts-listener.html") + if err != nil { + t.Fatalf("public charts template does not parse: %v", err) + } + entry := ChartEntry{ID: 1, Position: 1, Artist: "Artist", Title: "Titel", FrontendVoting: true} + var out bytes.Buffer + if err := tmpl.ExecuteTemplate(&out, "charts-listener.html", ChartsPageData{PageData: pageData(), Config: chartPageConfig{ChartKey: "listener", RoutePath: "/charts/zuhoerer", VotingEnabled: true}, TopThree: []ChartEntry{entry}}); err != nil { + t.Fatalf("regular chart template execute: %v", err) + } + entry.FrontendVoting, entry.FrontendAnnual, entry.FrontendAnnualYear, entry.HasInfo = false, true, 2025, true + out.Reset() + if err := tmpl.ExecuteTemplate(&out, "charts-listener.html", ChartsPageData{PageData: pageData(), Config: chartPageConfig{ChartKey: "annual", RoutePath: "/charts/jahrescharts", Annual: true}, TopThree: []ChartEntry{entry}, AnnualYear: 2025, AnnualYears: []ChartYear{{Year: 2025, Label: "2025", Count: 1}}}); err != nil { + t.Fatalf("annual chart template execute: %v", err) + } +} + +func TestPublicChartTemplateSupportsVotingPreviewAndAnnualInfo(t *testing.T) { + raw, err := os.ReadFile(filepath.Join("web", "charts-listener.html")) + if err != nil { + t.Fatal(err) + } + text := string(raw) + for _, want := range []string{"charts-v8.css", "charts-v7.js", "charts-podium", "charts-new-grid", "data-song-info", "data-preview-modal"} { + if !strings.Contains(text, want) { + t.Fatalf("public chart template missing %q", want) + } + } +} + +func TestAdminChartTemplateRendersAllZonesAndAnnualRows(t *testing.T) { + tmpl, err := parseAdminTemplate("web/admin/management.html") + if err != nil { + t.Fatal(err) + } + entry := ChartEntry{ID: 11, ChartKey: "listener", Position: 4, Artist: "Landwelle Artist", Title: "Landwelle Titel", FixedVotePoints: 42, VotePoints: 47, VoteCount: 1} + data := adminManagementData{ + Username: "admin", CSRFToken: "csrf", Module: "charts", DatabaseReady: true, + ChartKey: "listener", ChartTitle: "Zuhörer Charts", Charts: []ChartEntry{entry}, + MainChartRows: makeAdminChartRows([]ChartEntry{entry}, "csrf", "listener"), + ChartMainEnd: 32, ChartTotalEnd: 45, ChartMainTitle: "Platz 4 bis 32", ChartPreviewTitle: "Neuvorstellungen 33 bis 45", ChartCanGenerate: true, + } + var out bytes.Buffer + if err := tmpl.ExecuteTemplate(&out, "management-admin.html", data); err != nil { + t.Fatal(err) + } + html := out.String() + for _, want := range []string{"Landwelle Artist", "data-chart-zone", "data-chart-generate", "draggable=\"true\"", "admin-charts-v7.js", ">47<", "1 Online-Stimme"} { + if !strings.Contains(html, want) { + t.Fatalf("rendered chart admin missing %q", want) + } + } + + annual := adminManagementData{ + Username: "admin", CSRFToken: "csrf", Module: "charts", DatabaseReady: true, + ChartKey: "annual", ChartTitle: "Jahrescharts", SelectedYear: 2025, + ChartYears: []ChartYear{{Year: 2025, Label: "Jahrescharts 2025", Count: 1}}, + ChartYearEntries: []ChartYearEntry{{ID: 12, ChartYear: 2025, Position: 1, Artist: "Jahres Artist", Title: "Jahres Titel"}}, + AnnualChartRows: makeAdminAnnualChartRows([]ChartYearEntry{{ID: 12, ChartYear: 2025, Position: 1, Artist: "Jahres Artist", Title: "Jahres Titel"}}, "csrf", 2025), + } + out.Reset() + if err := tmpl.ExecuteTemplate(&out, "management-admin.html", annual); err != nil { + t.Fatal(err) + } + if !strings.Contains(out.String(), "Titel-Infos KI") || !strings.Contains(out.String(), "Jahres Artist") { + t.Fatal("annual admin chart controls or rows missing") + } +} + +func TestChartSecurityHeadersAllowYouTubeOnlyOnChartsAndOnTour(t *testing.T) { + next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) }) + for _, path := range []string{"/charts/zuhoerer", "/charts/docx", "/charts/jahrescharts", "/ontour"} { + rec := httptest.NewRecorder() + securityHeaders(next).ServeHTTP(rec, httptest.NewRequest(http.MethodGet, path, nil)) + if !strings.Contains(rec.Header().Get("Content-Security-Policy"), "youtube-nocookie.com") { + t.Fatalf("youtube frame source missing for %s", path) + } + } + rec := httptest.NewRecorder() + securityHeaders(next).ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/", nil)) + if strings.Contains(rec.Header().Get("Content-Security-Policy"), "youtube") { + t.Fatal("youtube frame source leaked to unrelated public page") + } +} diff --git a/chart_reorder_events_test.go b/chart_reorder_events_test.go new file mode 100644 index 0000000..bc17d33 --- /dev/null +++ b/chart_reorder_events_test.go @@ -0,0 +1,70 @@ +package main + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +func TestChartReorderUsesDeferredUniqueConstraint(t *testing.T) { + sql, err := chartOrderSQL(chartOrderRequest{ChartKey: "listener", Order: []chartOrderItem{{ID: 10, Position: 2}, {ID: 11, Position: 1}}}) + if err != nil { + t.Fatal(err) + } + for _, want := range []string{ + "SET CONSTRAINTS chart_entries_chart_key_position_key DEFERRED", + "FROM (VALUES (10,2),(11,1)) AS ordered(id,position)", + "position=ordered.position", + } { + if !strings.Contains(sql, want) { + t.Fatalf("reorder SQL missing %q", want) + } + } + if strings.Contains(sql, "position+1000") { + t.Fatal("reorder still uses an invalid temporary position offset") + } + + migration, err := os.ReadFile(filepath.Join("migrations", "0031_chart_reorder_deferrable.sql")) + if err != nil { + t.Fatal(err) + } + text := string(migration) + for _, want := range []string{ + "DEFERRABLE INITIALLY IMMEDIATE", + "chart_entries_chart_key_position_key", + "chart_year_entries_chart_year_position_key", + } { + if !strings.Contains(text, want) { + t.Fatalf("migration missing %q", want) + } + } +} + +func TestHomepageEventsOpenDetailModal(t *testing.T) { + templateRaw, err := os.ReadFile(filepath.Join("web", "index.html")) + if err != nil { + t.Fatal(err) + } + templateText := string(templateRaw) + for _, want := range []string{ + `data-home-event-id="{{.ID}}"`, + "data-home-event-modal", + "homepage-events-v1.js", + "homepage-events-v1.css", + } { + if !strings.Contains(templateText, want) { + t.Fatalf("homepage event modal markup missing %q", want) + } + } + jsRaw, err := os.ReadFile(filepath.Join("web", "assets", "homepage-events-v1.js")) + if err != nil { + t.Fatal(err) + } + js := string(jsRaw) + for _, want := range []string{"/api/events/", "data-home-event-id", "data-home-event-close"} { + if !strings.Contains(js, want) { + t.Fatalf("homepage event JavaScript missing %q", want) + } + } +} diff --git a/chart_ui_regression_test.go b/chart_ui_regression_test.go new file mode 100644 index 0000000..38ad63f --- /dev/null +++ b/chart_ui_regression_test.go @@ -0,0 +1,105 @@ +package main + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +func TestVoteStatusUsesTextTimestamp(t *testing.T) { + sql := chartVoteStatusSQL("listener", 42, "voter") + if strings.Contains(sql, "SELECT created_at + interval '24 hours'") { + t.Fatal("vote status still returns timestamptz directly") + } + if !strings.Contains(sql, "to_char((created_at + interval '24 hours') AT TIME ZONE 'UTC'") { + t.Fatal("vote status does not format next_vote_at as text") + } + if !strings.Contains(sql, "),'')") { + t.Fatal("vote status should keep an empty text fallback") + } +} + +func TestAnnualYearSwitchUsesExternalJavaScript(t *testing.T) { + templateRaw, err := os.ReadFile(filepath.Join("web", "charts-listener.html")) + if err != nil { + t.Fatal(err) + } + templateText := string(templateRaw) + if !strings.Contains(templateText, "data-chart-year-select") { + t.Fatal("annual year selector marker missing") + } + if strings.Contains(templateText, "onchange=\"this.form.submit()\"") { + t.Fatal("annual year selector still depends on blocked inline JavaScript") + } + if !strings.Contains(templateText, "charts-v7.js") { + t.Fatal("new public chart JavaScript is not loaded") + } + jsRaw, err := os.ReadFile(filepath.Join("web", "assets", "charts-v7.js")) + if err != nil { + t.Fatal(err) + } + js := string(jsRaw) + for _, want := range []string{"[data-chart-year-select]", "requestSubmit", "form.submit"} { + if !strings.Contains(js, want) { + t.Fatalf("annual year switch JavaScript missing %q", want) + } + } +} + +func TestChartDragStartsFromHandleAndPersistsOrder(t *testing.T) { + templateRaw, err := os.ReadFile(filepath.Join("web", "admin", "management.html")) + if err != nil { + t.Fatal(err) + } + if !strings.Contains(string(templateRaw), "admin-charts-v7.js") { + t.Fatal("new admin chart JavaScript is not loaded") + } + jsRaw, err := os.ReadFile(filepath.Join("web", "assets", "admin-charts-v7.js")) + if err != nil { + t.Fatal(err) + } + js := string(jsRaw) + for _, want := range []string{"handle?.addEventListener('dragstart'", "setDragImage", "persistOrder", "is-drag-over"} { + if !strings.Contains(js, want) { + t.Fatalf("drag and drop JavaScript missing %q", want) + } + } + if !strings.Contains(string(templateRaw), `class="chart-drag" draggable="true"`) { + t.Fatal("drag handle itself is not draggable") + } +} + +func TestAdminChartNumericFieldsUsePlainTextInputs(t *testing.T) { + templateRaw, err := os.ReadFile(filepath.Join("web", "admin", "management.html")) + if err != nil { + t.Fatal(err) + } + templateText := string(templateRaw) + if strings.Contains(templateText, `type="number"`) { + t.Fatal("admin chart template still contains browser number inputs") + } + for _, want := range []string{`type="text" inputmode="numeric"`, `name="position"`, `name="manual_points"`, `name="entry_year"`} { + if !strings.Contains(templateText, want) { + t.Fatalf("admin chart numeric text input missing %q", want) + } + } + if strings.Contains(templateText, `name="fixed_vote_points"`) { + t.Fatal("automatic chart evaluation must not be editable") + } + for _, want := range []string{`class="chart-evaluation"`, `data-chart-vote-total`, `Online-Stimmen`} { + if !strings.Contains(templateText, want) { + t.Fatalf("automatic chart evaluation display missing %q", want) + } + } + cssRaw, err := os.ReadFile(filepath.Join("web", "assets", "admin-charts-v7.css")) + if err != nil { + t.Fatal(err) + } + css := string(cssRaw) + for _, want := range []string{"grid-template-columns:86px", "width:54px", "font-variant-numeric:tabular-nums"} { + if !strings.Contains(css, want) { + t.Fatalf("admin chart numeric field styling missing %q", want) + } + } +} diff --git a/chart_voting_generation_test.go b/chart_voting_generation_test.go new file mode 100644 index 0000000..e62b233 --- /dev/null +++ b/chart_voting_generation_test.go @@ -0,0 +1,103 @@ +package main + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +func TestChartGenerationSortsByCurrentVotingStand(t *testing.T) { + entries := []ChartEntry{ + {ID: 1, Position: 1, Artist: "Alt", Title: "Basis hoch", FixedVotePoints: 100, VotePoints: 105, VoteCount: 1}, + {ID: 2, Position: 2, Artist: "Neu", Title: "Online stark", FixedVotePoints: 20, VotePoints: 130, VoteCount: 24}, + {ID: 3, Position: 3, Artist: "Gleich", Title: "Gleicher Stand", FixedVotePoints: 70, VotePoints: 105, VoteCount: 9}, + {ID: 4, Position: 4, Artist: "", Title: "", VotePoints: 999}, + } + sortChartEntriesByVotingStand(entries) + got := []int{entries[0].ID, entries[1].ID, entries[2].ID, entries[3].ID} + want := []int{2, 1, 3, 4} + for i := range want { + if got[i] != want[i] { + t.Fatalf("unexpected generated order: got %v want %v", got, want) + } + } +} + +func TestFrontendVotesAreRecordedCumulatively(t *testing.T) { + sql := chartVoteInsertSQL("listener", 42, 5, "visitor") + for _, want := range []string{ + "INSERT INTO chart_vote_history(entry_id,rating,created_at)", + "ON CONFLICT(entry_id,voter_key) DO UPDATE", + "chart_votes.created_at <= now() - interval '24 hours'", + "EXISTS(SELECT 1 FROM accepted)", + } { + if !strings.Contains(sql, want) { + t.Fatalf("vote SQL missing %q", want) + } + } + if strings.Contains(sql, "DELETE FROM chart_vote_history") { + t.Fatal("accepted votes must not overwrite or delete vote history") + } + if strings.Contains(sql, "chart_vote_history(entry_id,rating,voter_key") { + t.Fatal("vote history must not duplicate the raw visitor key") + } +} + +func TestChartTotalsUseVoteHistory(t *testing.T) { + raw, err := os.ReadFile("charts.go") + if err != nil { + t.Fatal(err) + } + text := string(raw) + for _, want := range []string{ + "LEFT JOIN chart_vote_history v ON v.entry_id=e.id", + "COALESCE(e.fixed_vote_points,0)+COALESCE(sum(v.rating),0)", + } { + if !strings.Contains(text, want) { + t.Fatalf("chart total query missing %q", want) + } + } +} + +func TestChartVoteHistoryMigration(t *testing.T) { + raw, err := os.ReadFile(filepath.Join("migrations", "0036_chart_vote_history.sql")) + if err != nil { + t.Fatal(err) + } + text := string(raw) + for _, want := range []string{ + "CREATE TABLE IF NOT EXISTS chart_vote_history", + "REFERENCES chart_entries(id) ON DELETE CASCADE", + "INSERT INTO chart_vote_history", + "WHERE h.entry_id=v.entry_id AND h.rating=v.rating AND h.created_at=v.created_at", + } { + if !strings.Contains(text, want) { + t.Fatalf("vote history migration missing %q", want) + } + } + if strings.Contains(strings.ToUpper(text), "BEGIN;") || strings.Contains(strings.ToUpper(text), "COMMIT;") { + t.Fatal("migration must leave transaction handling to the migrator") + } +} + +func TestFixedChartEvaluationIsServerManaged(t *testing.T) { + templateRaw, err := os.ReadFile(filepath.Join("web", "admin", "management.html")) + if err != nil { + t.Fatal(err) + } + if strings.Contains(string(templateRaw), `name="fixed_vote_points"`) { + t.Fatal("fixed vote points must not be submitted by the admin form") + } + if !strings.Contains(string(templateRaw), `Voting-Stand`) { + t.Fatal("admin chart table must label the automatic result as Voting-Stand") + } + serverRaw, err := os.ReadFile("admin_management.go") + if err != nil { + t.Fatal(err) + } + server := string(serverRaw) + if strings.Contains(server, `formInt(r, "fixed_vote_points")`) { + t.Fatal("server still accepts editable fixed vote points") + } +} diff --git a/charts.go b/charts.go new file mode 100644 index 0000000..852f7ed --- /dev/null +++ b/charts.go @@ -0,0 +1,429 @@ +package main + +import ( + "context" + "encoding/json" + "fmt" + "html/template" + "log" + "net" + "net/http" + "strconv" + "strings" + "time" +) + +type ChartEntry struct { + ID int `json:"id"` + LegacyID int64 `json:"legacy_id"` + ChartKey string `json:"chart_key"` + Position int `json:"position"` + PreviousPosition int `json:"previous_position"` + EntryPosition int `json:"entry_position"` + Artist string `json:"artist"` + Title string `json:"title"` + CoverURL string `json:"cover_url"` + PreviewURL string `json:"preview_url"` + StoreURL string `json:"store_url"` + Weeks int `json:"weeks"` + ManualPoints int `json:"manual_points"` + FixedVotePoints int `json:"fixed_vote_points"` + EntryYear int `json:"entry_year"` + EntryMonth int `json:"entry_month"` + CurrentWeekPosition int `json:"current_week_position"` + PreviousWeekPosition int `json:"previous_week_position"` + Active bool `json:"active"` + UpdatedAt string `json:"updated_at"` + VoteAverage float64 `json:"vote_average"` + VoteCount int `json:"vote_count"` + Trend string `json:"trend"` + VotePoints int `json:"vote_points"` + HasInfo bool `json:"has_info"` + FrontendVoting bool `json:"-"` + FrontendAnnual bool `json:"-"` + FrontendAnnualYear int `json:"-"` +} + +type chartPageConfig struct { + ChartKey string + RoutePath string + VoteAPIPath string + VoteStatusAPIPath string + SEODescription string + HeroClass string + HeroKicker string + HeroTitle string + HeroLead string + IntroKicker string + IntroTitle string + IntroLead string + SidebarKicker string + SidebarTitle string + SidebarText string + ListKicker string + ListTitle string + EmptyTopTitle string + EmptyTopText string + EmptyListTitle string + EmptyListText string + MainEnd int + TotalEnd int + NewEntriesTitle string + VotingEnabled bool + Annual bool +} + +type ChartsPageData struct { + PageData + Config chartPageConfig + TopThree []ChartEntry + Entries []ChartEntry + NewEntries []ChartEntry + UpdatedLabel string + AnnualYear int + AnnualYears []ChartYear +} + +type chartStore struct{ db *postgresStore } + +func newChartStore(db *postgresStore) *chartStore { return &chartStore{db: db} } + +func (s *chartStore) Chart(ctx context.Context, chartKey string) ([]ChartEntry, error) { + return s.chart(ctx, chartKey, false) +} + +func (s *chartStore) AdminChart(ctx context.Context, chartKey string) ([]ChartEntry, error) { + return s.chart(ctx, chartKey, true) +} + +func (s *chartStore) chart(ctx context.Context, chartKey string, includeEmpty bool) ([]ChartEntry, error) { + if s == nil || s.db == nil || !s.db.Enabled() { + return nil, nil + } + if chartKey == "annual" { + return s.annualChart(ctx) + } + chartKey = normalizeAdminChartKey(chartKey) + contentFilter := " AND btrim(e.artist)<>'' AND btrim(e.title)<>''" + if includeEmpty { + contentFilter = "" + } + richSQL := fmt.Sprintf(`SELECT COALESCE(json_agg(x ORDER BY x.position),'[]'::json) FROM ( +SELECT e.id,COALESCE(e.legacy_id,0) AS legacy_id,e.chart_key,e.position, +COALESCE(e.previous_position,0) AS previous_position,COALESCE(e.entry_position,e.position) AS entry_position, +e.artist,e.title,COALESCE(e.cover_url,'') AS cover_url,COALESCE(e.preview_url,'') AS preview_url, +COALESCE(e.store_url,'') AS store_url,COALESCE(e.weeks,0) AS weeks,COALESCE(e.manual_points,0) AS manual_points, +COALESCE(e.fixed_vote_points,0) AS fixed_vote_points,COALESCE(e.entry_year,0) AS entry_year,COALESCE(e.entry_month,0) AS entry_month, +COALESCE(e.current_week_position,e.position) AS current_week_position,COALESCE(e.previous_week_position,e.previous_position,0) AS previous_week_position, +e.active,to_char(e.updated_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS updated_at, +COALESCE(round(avg(v.rating)::numeric,1),0)::float8 AS vote_average,count(v.id)::int AS vote_count, +(COALESCE(e.fixed_vote_points,0)+COALESCE(sum(v.rating),0))::int AS vote_points,false AS has_info, +CASE WHEN COALESCE(e.previous_week_position,e.previous_position,0)=0 THEN 'new' WHEN COALESCE(e.previous_week_position,e.previous_position,0)>e.position THEN 'up' WHEN COALESCE(e.previous_week_position,e.previous_position,0)e.position THEN 'up' WHEN e.previous_position= 0 { + voter = voter[:i] + } + voter = strings.TrimSpace(voter) + if voter == "" { + voter = strings.TrimSpace(r.RemoteAddr) + if host, _, err := net.SplitHostPort(voter); err == nil { + voter = host + } + } + return voter + "|" + r.UserAgent() +} + +func (s *chartStore) VoteStatuses(ctx context.Context, chartKey, voterKey string) ([]chartVoteStatus, error) { + if s == nil || s.db == nil || !s.db.Enabled() { + return nil, fmt.Errorf("Datenbank nicht verfügbar") + } + chartKey = normalizeAdminChartKey(chartKey) + query := fmt.Sprintf(`SELECT COALESCE(json_agg(json_build_object( +'entry_id',latest.entry_id, +'rating',latest.rating, +'retry_after_seconds',GREATEST(0,CEIL(EXTRACT(EPOCH FROM (latest.created_at + interval '24 hours' - now()))))::int, +'next_vote_at',to_char((latest.created_at + interval '24 hours') AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS.MS"Z"') +) ORDER BY latest.entry_id),'[]'::json)::text +FROM ( + SELECT DISTINCT ON (v.entry_id) v.entry_id,v.rating,v.created_at + FROM chart_votes v JOIN chart_entries e ON e.id=v.entry_id + WHERE e.chart_key=%s AND e.active=true AND v.voter_key=%s AND v.created_at > now() - interval '24 hours' + ORDER BY v.entry_id,v.created_at DESC +) latest;`, sqlText(chartKey), sqlText(voterKey)) + var out []chartVoteStatus + if err := s.db.queryJSON(ctx, query, &out); err != nil { + return nil, err + } + return out, nil +} + +type chartVoteResult struct { + Accepted bool `json:"accepted"` + RetryAfterSeconds int `json:"retry_after_seconds"` + NextVoteAt string `json:"next_vote_at"` +} + +func chartVoteStatusSQL(chartKey string, entryID int, voterKey string) string { + return fmt.Sprintf(`SELECT json_build_object( + 'accepted', CASE + WHEN NOT EXISTS(SELECT 1 FROM chart_entries WHERE id=%d AND chart_key=%s AND active=true) THEN false + WHEN EXISTS(SELECT 1 FROM chart_votes WHERE entry_id=%d AND voter_key=%s AND created_at > now() - interval '24 hours') THEN false + ELSE true + END, + 'retry_after_seconds', COALESCE(( + SELECT GREATEST(0, CEIL(EXTRACT(EPOCH FROM (created_at + interval '24 hours' - now()))))::int + FROM chart_votes WHERE entry_id=%d AND voter_key=%s AND created_at > now() - interval '24 hours' + ORDER BY created_at DESC LIMIT 1 + ),0), + 'next_vote_at', COALESCE(( + SELECT to_char((created_at + interval '24 hours') AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS.MS"Z"') + FROM chart_votes WHERE entry_id=%d AND voter_key=%s AND created_at > now() - interval '24 hours' + ORDER BY created_at DESC LIMIT 1 + ),'') +);`, entryID, sqlText(chartKey), entryID, sqlText(voterKey), entryID, sqlText(voterKey), entryID, sqlText(voterKey)) +} + +func chartVoteInsertSQL(chartKey string, entryID, rating int, voterKey string) string { + return fmt.Sprintf(`WITH accepted AS ( + INSERT INTO chart_votes(entry_id,rating,voter_key,created_at) + SELECT e.id,%d,%s,now() + FROM chart_entries e + WHERE e.id=%d AND e.chart_key=%s AND e.active=true + ON CONFLICT(entry_id,voter_key) DO UPDATE + SET rating=EXCLUDED.rating,created_at=now() + WHERE chart_votes.created_at <= now() - interval '24 hours' + RETURNING entry_id,rating,voter_key,created_at +), recorded AS ( + INSERT INTO chart_vote_history(entry_id,rating,created_at) + SELECT entry_id,rating,created_at FROM accepted + RETURNING created_at +), latest AS ( + SELECT created_at FROM accepted + UNION ALL + SELECT created_at FROM chart_votes + WHERE entry_id=%d AND voter_key=%s AND NOT EXISTS(SELECT 1 FROM accepted) + ORDER BY created_at DESC + LIMIT 1 +) +SELECT json_build_object( + 'accepted',EXISTS(SELECT 1 FROM accepted), + 'retry_after_seconds',COALESCE((SELECT GREATEST(0,CEIL(EXTRACT(EPOCH FROM (created_at + interval '24 hours' - now()))))::int FROM latest),0), + 'next_vote_at',COALESCE((SELECT to_char((created_at + interval '24 hours') AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS.MS"Z"') FROM latest),'') +);`, rating, sqlText(voterKey), entryID, sqlText(normalizeAdminChartKey(chartKey)), entryID, sqlText(voterKey)) +} + +func (s *chartStore) Vote(ctx context.Context, chartKey string, entryID, rating int, voterKey string) (chartVoteResult, error) { + if rating < 1 || rating > 5 { + return chartVoteResult{}, fmt.Errorf("Bewertung muss zwischen 1 und 5 liegen") + } + if s == nil || s.db == nil || !s.db.Enabled() { + return chartVoteResult{}, fmt.Errorf("Datenbank nicht verfügbar") + } + var result chartVoteResult + if err := s.db.queryJSON(ctx, chartVoteInsertSQL(chartKey, entryID, rating, voterKey), &result); err != nil { + return chartVoteResult{}, err + } + return result, nil +} + +func chartsPageHandler(t *template.Template, logger *log.Logger, data PageData, store *chartStore, config chartPageConfig) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != config.RoutePath { + http.NotFound(w, r) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) + return + } + spec := chartRanges(config.ChartKey) + if config.MainEnd > 0 { + spec.MainEnd = config.MainEnd + } + if config.TotalEnd > 0 { + spec.TotalEnd = config.TotalEnd + } + if config.NewEntriesTitle != "" { + spec.NewTitle = config.NewEntriesTitle + } + var entries []ChartEntry + var years []ChartYear + annualYear := 0 + var err error + if config.Annual || config.ChartKey == "annual" { + years, err = store.AnnualYears(r.Context()) + if err != nil { + logger.Printf("jahreschart-jahre laden: %v", err) + } + annualYear, _ = strconv.Atoi(r.URL.Query().Get("jahr")) + if annualYear < 1900 || annualYear > 2200 { + if len(years) > 0 { + annualYear = years[0].Year + } else { + annualYear = time.Now().Year() + } + } + entries, err = store.AnnualChart(r.Context(), annualYear) + } else { + entries, err = store.Chart(r.Context(), config.ChartKey) + } + if err != nil { + logger.Printf("%scharts laden: %v", config.ChartKey, err) + } + spec = extendChartRangeToEntries(config.ChartKey, spec, entries) + for i := range entries { + entries[i].FrontendVoting = config.VotingEnabled + entries[i].FrontendAnnual = config.Annual || config.ChartKey == "annual" + entries[i].FrontendAnnualYear = annualYear + } + top, main, preview := splitChartEntries(entries, spec) + payload := ChartsPageData{ + PageData: data, Config: config, TopThree: top, Entries: main, NewEntries: preview, + UpdatedLabel: time.Now().Format("02.01.2006"), AnnualYear: annualYear, AnnualYears: years, + } + if payload.Config.MainEnd == 0 { + payload.Config.MainEnd = spec.MainEnd + } + if payload.Config.TotalEnd == 0 { + payload.Config.TotalEnd = spec.TotalEnd + } + if payload.Config.NewEntriesTitle == "" { + payload.Config.NewEntriesTitle = spec.NewTitle + } + w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.Header().Set("Cache-Control", "no-store") + if r.Method == http.MethodHead { + w.WriteHeader(http.StatusOK) + return + } + if err := t.ExecuteTemplate(w, "charts-listener.html", payload); err != nil { + logger.Printf("charts template: %v", err) + } + } +} + +func chartVoteStatusHandler(store *chartStore, chartKey string) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Nur GET erlaubt.") + return + } + statuses, err := store.VoteStatuses(r.Context(), chartKey, chartVoterKey(r)) + if err != nil { + writeAPIError(w, http.StatusServiceUnavailable, "vote_status_failed", "Der Voting-Status konnte nicht geladen werden.") + return + } + writeJSON(w, http.StatusOK, map[string]any{"status": "ok", "votes": statuses}) + } +} + +func chartVoteHandler(store *chartStore, chartKey string) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Nur POST erlaubt.") + return + } + var in struct { + EntryID int `json:"entry_id"` + Rating int `json:"rating"` + } + if err := json.NewDecoder(r.Body).Decode(&in); err != nil { + writeAPIError(w, http.StatusBadRequest, "invalid_json", "Ungültige Anfrage.") + return + } + voter := chartVoterKey(r) + result, err := store.Vote(r.Context(), chartKey, in.EntryID, in.Rating, voter) + if err != nil { + writeAPIError(w, http.StatusBadRequest, "vote_failed", err.Error()) + return + } + if !result.Accepted { + if result.RetryAfterSeconds > 0 { + w.Header().Set("Retry-After", strconv.Itoa(result.RetryAfterSeconds)) + } + writeJSON(w, http.StatusTooManyRequests, map[string]any{ + "status": "already_voted", "retry_after_seconds": result.RetryAfterSeconds, "next_vote_at": result.NextVoteAt, + "message": "Du kannst diesen Titel erst nach 24 Stunden erneut bewerten.", + }) + return + } + entries, _ := store.Chart(r.Context(), chartKey) + var found *ChartEntry + for i := range entries { + if entries[i].ID == in.EntryID { + found = &entries[i] + break + } + } + if found == nil { + writeAPIError(w, http.StatusNotFound, "not_found", "Titel nicht gefunden.") + return + } + writeJSON(w, http.StatusOK, map[string]any{"status": "ok", "average": found.VoteAverage, "count": found.VoteCount, "vote_points": found.VotePoints, "rating": strconv.Itoa(in.Rating), "retry_after_seconds": result.RetryAfterSeconds, "next_vote_at": result.NextVoteAt}) + } +} diff --git a/clients/android/README.md b/clients/android/README.md new file mode 100644 index 0000000..5c7c1bb --- /dev/null +++ b/clients/android/README.md @@ -0,0 +1,19 @@ +# Landwelle Android-App + +Die Android-App wird gemeinsam mit iOS als separates Flutter-Projekt entwickelt. Verbindliche Produktionsbasis: + +```text +https://api.landwelle.de/v1 +``` + +Erster Aufruf: + +```text +GET /v1/app/bootstrap +``` + +Verbindliche Übergabe: `APP_CHATUEBERGABE.md`. Maschinenlesbarer Vertrag: `openapi/landwelle-app-api.yaml`. + +Fehlt eine App-Funktion in der API, muss der App-Chat die Vorlage `docs/API_CHANGE_REQUEST_TEMPLATE.md` ausfüllen und die Anforderung an das Portalprojekt zurückgeben. Direkte Zugriffe auf Website, AzuraCast oder andere Drittanbieter sind nicht erlaubt. + +Testpfad: signierte interne APK, reale Gerätetests, Google Play Internal Testing, Closed Testing und erst nach erfolgreicher Abnahme gestufte Produktion. diff --git a/clients/desktop-app/assets/logo.png b/clients/desktop-app/assets/logo.png new file mode 100644 index 0000000..9deb571 Binary files /dev/null and b/clients/desktop-app/assets/logo.png differ diff --git a/clients/desktop-app/index.html b/clients/desktop-app/index.html new file mode 100644 index 0000000..5b87758 --- /dev/null +++ b/clients/desktop-app/index.html @@ -0,0 +1,41 @@ + +Landwelle Player + +
+
+
LANDWELLE PLAYER
+
+ + + +
+
+
+
+ Landwelle Radio +

Sound & Infos aus Niedersachsen

+
+
+
CoverLIVE
+
+ Jetzt auf Landwelle +

Landwelle Radio

+

Live aus Niedersachsen

+
+
+
+
Bereit
+
+ + + +
+
LEISELAUT
+
+
24/7 für Niedersachsen
+
+
LANDWELLE · DESKTOP PLAYER
+
+ + + diff --git a/clients/desktop-app/main.js b/clients/desktop-app/main.js new file mode 100644 index 0000000..9b5d0fd --- /dev/null +++ b/clients/desktop-app/main.js @@ -0,0 +1,62 @@ +const { app, BrowserWindow, ipcMain, shell, nativeImage } = require('electron'); +const path = require('path'); + +const NOW_PLAYING = 'https://stream.slmm.de/api/nowplaying/landwelle'; +let mainWindow; + +function createWindow() { + const icon = nativeImage.createFromPath(path.join(__dirname, 'assets', 'logo.png')); + mainWindow = new BrowserWindow({ + width: 520, + height: 760, + minWidth: 430, + minHeight: 650, + show: false, + frame: false, + transparent: false, + backgroundColor: '#0b0e0b', + icon, + title: 'Landwelle Player', + webPreferences: { + preload: path.join(__dirname, 'preload.js'), + contextIsolation: true, + nodeIntegration: false, + sandbox: true + } + }); + mainWindow.setMenuBarVisibility(false); + mainWindow.loadFile('index.html'); + mainWindow.once('ready-to-show', () => mainWindow.show()); +} + +app.whenReady().then(() => { + createWindow(); + app.on('activate', () => { if (BrowserWindow.getAllWindows().length === 0) createWindow(); }); +}); +app.on('window-all-closed', () => { if (process.platform !== 'darwin') app.quit(); }); + +ipcMain.on('window:minimize', () => mainWindow?.minimize()); +ipcMain.on('window:close', () => mainWindow?.close()); +ipcMain.on('window:toggleMaximize', () => mainWindow?.isMaximized() ? mainWindow.unmaximize() : mainWindow?.maximize()); +ipcMain.handle('open:external', async (_event, url) => { + if (typeof url === 'string' && /^https:\/\/(www\.)?landwelle\.de(?:\/|$)/i.test(url)) await shell.openExternal(url); +}); +ipcMain.handle('nowplaying:get', async () => { + try { + const response = await fetch(NOW_PLAYING, { signal: AbortSignal.timeout(7000) }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const data = await response.json(); + const song = data?.now_playing?.song || {}; + return { + ok: true, + title: song.title || 'Landwelle Radio', + artist: song.artist || 'Live aus Niedersachsen', + art: song.art || '', + listeners: data?.listeners?.current ?? null, + live: Boolean(data?.live?.is_live), + streamer: data?.live?.streamer_name || '' + }; + } catch (error) { + return { ok: false, title: 'Landwelle Radio', artist: 'Live aus Niedersachsen' }; + } +}); diff --git a/clients/desktop-app/package.json b/clients/desktop-app/package.json new file mode 100644 index 0000000..ced13cb --- /dev/null +++ b/clients/desktop-app/package.json @@ -0,0 +1,54 @@ +{ + "name": "landwelle-player", + "version": "1.0.0", + "description": "Eigenständiger Desktop-Player für Landwelle Radio", + "main": "main.js", + "author": "Landwelle Radio", + "license": "UNLICENSED", + "scripts": { + "dist:linux": "electron-builder --linux AppImage --x64", + "dist:win": "electron-builder --win portable --x64", + "dist:mac": "electron-builder --mac zip --x64", + "dist": "electron-builder --linux AppImage --win portable --mac zip --x64", + "start": "electron ." + }, + "devDependencies": { + "electron": "37.2.3", + "electron-builder": "26.0.12" + }, + "build": { + "appId": "de.landwelle.player", + "productName": "Landwelle Player", + "asar": true, + "files": [ + "main.js", + "preload.js", + "index.html", + "styles.css", + "renderer.js", + "assets/**/*" + ], + "directories": { + "output": "dist" + }, + "artifactName": "Landwelle-Player-${os}-${arch}.${ext}", + "linux": { + "target": [ + "AppImage" + ], + "category": "AudioVideo", + "executableName": "landwelle-player" + }, + "win": { + "target": [ + "portable" + ] + }, + "mac": { + "target": [ + "zip" + ], + "category": "public.app-category.music" + } + } +} diff --git a/clients/desktop-app/preload.js b/clients/desktop-app/preload.js new file mode 100644 index 0000000..9fec1f6 --- /dev/null +++ b/clients/desktop-app/preload.js @@ -0,0 +1,8 @@ +const { contextBridge, ipcRenderer } = require('electron'); +contextBridge.exposeInMainWorld('landwelle', { + minimize: () => ipcRenderer.send('window:minimize'), + toggleMaximize: () => ipcRenderer.send('window:toggleMaximize'), + close: () => ipcRenderer.send('window:close'), + openWebsite: () => ipcRenderer.invoke('open:external', 'https://landwelle.de'), + getNowPlaying: () => ipcRenderer.invoke('nowplaying:get') +}); diff --git a/clients/desktop-app/renderer.js b/clients/desktop-app/renderer.js new file mode 100644 index 0000000..d6eff39 --- /dev/null +++ b/clients/desktop-app/renderer.js @@ -0,0 +1,39 @@ +const audio = document.getElementById('audio'); +const play = document.getElementById('play'); +const playIcon = play.querySelector('span'); +const status = document.getElementById('status'); +const volume = document.getElementById('volume'); +const mute = document.getElementById('mute'); +const title = document.getElementById('title'); +const artist = document.getElementById('artist'); +const cover = document.getElementById('cover'); +const listeners = document.getElementById('listeners'); +let lastVolume = .8; +audio.volume = .8; + +document.getElementById('minimize').onclick = () => window.landwelle.minimize(); +document.getElementById('maximize').onclick = () => window.landwelle.toggleMaximize(); +document.getElementById('close').onclick = () => window.landwelle.close(); +document.getElementById('website').onclick = () => window.landwelle.openWebsite(); + +async function togglePlay(){ + if(audio.paused){ status.textContent='Livestream wird verbunden …'; try{ await audio.play(); }catch{ status.textContent='Verbindung fehlgeschlagen'; }} + else audio.pause(); +} +play.onclick = togglePlay; +document.getElementById('rewind').onclick = async()=>{ const wasPlaying=!audio.paused; audio.load(); if(wasPlaying){try{await audio.play()}catch{}} }; +volume.oninput=()=>{audio.volume=Number(volume.value); mute.textContent=audio.volume===0?'🔇':audio.volume<.5?'🔉':'🔊'}; +mute.onclick=()=>{if(audio.volume>0){lastVolume=audio.volume;audio.volume=0;volume.value=0;mute.textContent='🔇'}else{audio.volume=lastVolume||.8;volume.value=audio.volume;mute.textContent='🔊'}}; +audio.onplay=()=>{playIcon.textContent='❚❚';playIcon.style.marginLeft='0';status.textContent='Landwelle läuft live'}; +audio.onpause=()=>{playIcon.textContent='▶';playIcon.style.marginLeft='4px';status.textContent='Pausiert'}; +audio.onwaiting=()=>status.textContent='Stream wird gepuffert …'; +audio.onerror=()=>status.textContent='Stream derzeit nicht erreichbar'; + +async function refreshNowPlaying(){ + const data=await window.landwelle.getNowPlaying(); + title.textContent=data.title||'Landwelle Radio'; + artist.textContent=data.artist||'Live aus Niedersachsen'; + listeners.textContent=Number.isInteger(data.listeners)?`${data.listeners} hören zu`:''; + if(data.art){cover.src=data.art;cover.onerror=()=>{cover.src='assets/logo.png'}} +} +refreshNowPlaying(); setInterval(refreshNowPlaying,15000); diff --git a/clients/desktop-app/styles.css b/clients/desktop-app/styles.css new file mode 100644 index 0000000..2b96518 --- /dev/null +++ b/clients/desktop-app/styles.css @@ -0,0 +1 @@ +:root{--green:#65bd21;--green2:#8cdb38;--bg:#090c09;--panel:#141914;--panel2:#1a211a;--line:#2b352c;--muted:#a7b0a8;--white:#f7faf7}*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:var(--bg);color:var(--white);font-family:Inter,Segoe UI,Arial,sans-serif}body{background:radial-gradient(circle at 50% -10%,#2d3c2d 0,#111611 38%,#080b08 78%)}button,input{font:inherit}.app-shell{height:100vh;border:1px solid #344234;display:flex;flex-direction:column;background:linear-gradient(160deg,rgba(25,33,25,.96),rgba(8,11,8,.99));box-shadow:inset 0 1px rgba(255,255,255,.06)}.titlebar{height:42px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);background:#0c100c}.drag-title{-webkit-app-region:drag;flex:1;height:100%;display:flex;align-items:center;padding:0 14px;font-size:10px;font-weight:800;letter-spacing:.18em;color:#b8c2b9}.live-dot{width:7px;height:7px;border-radius:50%;background:var(--green);box-shadow:0 0 12px var(--green);margin-right:8px}.window-actions{display:flex;height:100%}.window-actions button{-webkit-app-region:no-drag;width:44px;border:0;background:transparent;color:#c5cdc6;font-size:16px;cursor:pointer}.window-actions button:hover{background:#253025}.window-actions .close:hover{background:#b3262e;color:#fff}main{padding:19px 22px 14px;overflow:auto;flex:1}.brand-panel{text-align:center;padding:2px 0 13px}.brand-panel img{width:220px;max-height:108px;object-fit:contain;filter:drop-shadow(0 10px 24px #0008)}.brand-panel p{margin:-4px 0 0;color:var(--green2);font-size:10px;text-transform:uppercase;letter-spacing:.18em;font-weight:800}.now-card{display:grid;grid-template-columns:142px 1fr;gap:18px;align-items:center;padding:16px;border:1px solid var(--line);border-radius:22px;background:linear-gradient(145deg,#1c241c,#111611);box-shadow:0 18px 45px #0007}.cover-wrap{position:relative;width:142px;height:142px;border-radius:18px;overflow:hidden;background:#0c100c;border:1px solid #344334}.cover-wrap img{width:100%;height:100%;object-fit:cover}.onair{position:absolute;left:10px;bottom:10px;border-radius:999px;padding:5px 9px;background:#111;color:#fff;font-size:9px;font-weight:900;letter-spacing:.15em;border:1px solid var(--green);box-shadow:0 0 18px #65bd2155}.meta{min-width:0}.eyebrow{color:var(--green2);text-transform:uppercase;font-size:10px;font-weight:900;letter-spacing:.14em}.meta h1{font-size:24px;line-height:1.08;margin:9px 0 7px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.meta p{color:var(--muted);font-size:14px;line-height:1.4;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.controls-card{margin-top:15px;padding:16px 18px 18px;border:1px solid var(--line);border-radius:22px;background:rgba(16,21,16,.82)}.status-row{display:flex;justify-content:space-between;font-size:11px;color:var(--muted);min-height:16px}.main-controls{display:flex;align-items:center;justify-content:center;gap:28px;margin:12px 0 17px}.play{width:90px;height:90px;border-radius:50%;border:3px solid var(--green);background:radial-gradient(circle at 35% 30%,#3a493a,#111611 65%);color:#fff;font-size:33px;cursor:pointer;box-shadow:0 0 0 8px #65bd2114,0 12px 34px #0009;transition:.16s}.play:hover{transform:scale(1.035);box-shadow:0 0 0 11px #65bd2119,0 14px 38px #000}.play span{display:block;margin-left:4px}.small-control{width:48px;height:48px;border-radius:50%;border:1px solid #3a473b;background:#171e17;color:#d8ded8;cursor:pointer;font-size:19px}.small-control:hover{border-color:var(--green);color:var(--green2)}.volume-row{display:grid;grid-template-columns:43px 1fr 38px;align-items:center;gap:10px;font-size:8px;color:#849086;font-weight:800;letter-spacing:.12em}.volume-row input{width:100%;accent-color:var(--green)}.info-strip{margin-top:15px;border-radius:15px;padding:13px 15px;display:flex;justify-content:space-between;align-items:center;background:linear-gradient(90deg,#568f21,#69bd24);color:#081006;font-weight:900;font-size:11px;text-transform:uppercase;letter-spacing:.08em}.info-strip button{border:0;background:#0c110c;color:white;border-radius:999px;padding:8px 12px;font-size:10px;font-weight:800;cursor:pointer}footer{text-align:center;padding:9px 10px 12px;color:#637064;font-size:8px;letter-spacing:.22em}@media(max-width:470px){.now-card{grid-template-columns:112px 1fr}.cover-wrap{width:112px;height:112px}.meta h1{font-size:20px}.brand-panel img{width:190px}} diff --git a/clients/desktop/README.md b/clients/desktop/README.md new file mode 100644 index 0000000..3905925 --- /dev/null +++ b/clients/desktop/README.md @@ -0,0 +1,31 @@ +> **Archivstatus:** Der Desktop-Player ist nicht Bestandteil der aktuellen Roadmap. Dieser Bestand wird durch v1.4.0 nicht weiterentwickelt. + +# Landwelle Desktop Player + +Der Desktop-Player liegt unter `clients/desktop-app` und ist eine echte Electron-Desktop-Anwendung. Er öffnet **keinen Browser** und startet keinen lokalen HTTP-Server. + +Funktionen: +- eigenes rahmenloses Landwelle-Fenster +- direkter Livestream im Programm +- Start/Pause, Neuverbinden, Lautstärke und Stummschaltung +- aktuelle Titel- und Interpreteninformationen aus AzuraCast +- Coveranzeige und Hörerzahl +- Windows-, Linux- und macOS-Pakete + +Lokale Entwicklung: + +```bash +cd clients/desktop-app +npm install +npm start +``` + +Produktions-Builds werden auf dem jeweiligen Zielbetriebssystem erzeugt: + +```bash +npm run dist:win +npm run dist:linux +npm run dist:mac +``` + +Die GitHub-Actions-Datei `.github/workflows/desktop-player-build.yml` erstellt die drei Plattformpakete automatisch. macOS-Builds sollten für eine öffentliche Verteilung zusätzlich mit einem Apple-Developer-Zertifikat signiert und notarisiert werden. diff --git a/clients/ios/README.md b/clients/ios/README.md new file mode 100644 index 0000000..48d9adf --- /dev/null +++ b/clients/ios/README.md @@ -0,0 +1,19 @@ +# Landwelle iOS-App + +Die iOS-App wird gemeinsam mit Android als separates Flutter-Projekt entwickelt. Verbindliche Produktionsbasis: + +```text +https://api.landwelle.de/v1 +``` + +Erster Aufruf: + +```text +GET /v1/app/bootstrap +``` + +Verbindliche Übergabe: `APP_CHATUEBERGABE.md`. Maschinenlesbarer Vertrag: `openapi/landwelle-app-api.yaml`. + +Fehlt eine App-Funktion in der API, muss der App-Chat die Vorlage `docs/API_CHANGE_REQUEST_TEMPLATE.md` ausfüllen und die Anforderung an das Portalprojekt zurückgeben. Direkte Zugriffe auf Website, AzuraCast oder andere Drittanbieter sind nicht erlaubt. + +Testpfad: Simulator und reale Geräte, interne TestFlight-Gruppe, externe TestFlight-Gruppe und erst nach erfolgreicher Abnahme App Review und Veröffentlichung. diff --git a/cmd/adminpass/main.go b/cmd/adminpass/main.go new file mode 100644 index 0000000..2a1e825 --- /dev/null +++ b/cmd/adminpass/main.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + "os" + "strings" + + "landwelle-portal/internal/auth" +) + +func main() { + password := strings.TrimSpace(os.Getenv("LANDWELLE_NEW_ADMIN_PASSWORD")) + if password == "" { + fmt.Fprintln(os.Stderr, "LANDWELLE_NEW_ADMIN_PASSWORD fehlt. Verwende das mitgelieferte setup-admin-on-pi.sh.") + os.Exit(1) + } + + hash, err := auth.HashPassword(password) + if err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } + fmt.Println(hash) +} diff --git a/cmd/migrate/main.go b/cmd/migrate/main.go new file mode 100644 index 0000000..65baaf4 --- /dev/null +++ b/cmd/migrate/main.go @@ -0,0 +1,525 @@ +package main + +import ( + "bufio" + "context" + "crypto/sha256" + "encoding/hex" + "errors" + "flag" + "fmt" + "io" + "log" + "net/url" + "os" + "os/exec" + "path/filepath" + "regexp" + "sort" + "strconv" + "strings" + "syscall" + "time" +) + +const defaultEnvFile = "/etc/landwelle/landwelle.env" + +var ( + migrationNamePattern = regexp.MustCompile(`^(\d+)[_-].*\.sql$`) + transactionPattern = regexp.MustCompile(`(?im)^\s*(BEGIN|START\s+TRANSACTION|COMMIT|ROLLBACK)\s*;`) +) + +type options struct { + envFile string + migrations string + archive string + keepFiles bool + dryRun bool + timeout time.Duration + lockFile string +} + +type migration struct { + Version int64 + Name string + Path string + Checksum string + SQL string +} + +type appliedMigration struct { + Filename string + Checksum string +} + +type psqlClient struct { + path string + env []string + timeout time.Duration +} + +func main() { + log.SetFlags(0) + + opts := parseFlags() + if err := run(context.Background(), opts); err != nil { + log.Fatalf("Migration fehlgeschlagen: %v", err) + } +} + +func parseFlags() options { + var opts options + flag.StringVar(&opts.envFile, "env-file", defaultEnvFile, "Pfad zur Environment-Datei") + flag.StringVar(&opts.migrations, "dir", "migrations", "Ordner mit noch auszuführenden SQL-Dateien") + flag.StringVar(&opts.archive, "archive-dir", "migrations/applied", "Zielordner für erfolgreich ausgeführte SQL-Dateien") + flag.BoolVar(&opts.keepFiles, "keep-files", false, "Erfolgreiche SQL-Dateien nicht verschieben") + flag.BoolVar(&opts.dryRun, "dry-run", false, "Nur anzeigen, was ausgeführt würde") + flag.DurationVar(&opts.timeout, "timeout", 10*time.Minute, "Zeitlimit pro Migration") + flag.StringVar(&opts.lockFile, "lock-file", "/tmp/landwelle-migrate.lock", "Sperrdatei gegen parallele Läufe") + flag.Parse() + return opts +} + +func run(ctx context.Context, opts options) error { + fileEnv, err := loadEnvFile(opts.envFile) + if err != nil { + return err + } + + databaseURL := strings.TrimSpace(os.Getenv("DATABASE_URL")) + if databaseURL == "" { + databaseURL = strings.TrimSpace(fileEnv["DATABASE_URL"]) + } + if databaseURL == "" { + return fmt.Errorf("DATABASE_URL fehlt; trage sie in %s ein", opts.envFile) + } + + migrations, err := discoverMigrations(opts.migrations) + if err != nil { + return err + } + if len(migrations) == 0 { + log.Printf("Keine offenen SQL-Dateien in %s gefunden.", opts.migrations) + return nil + } + + if opts.dryRun { + log.Printf("Trockenlauf: %d Migration(en) gefunden:", len(migrations)) + for _, m := range migrations { + log.Printf(" - %04d %s", m.Version, m.Name) + } + return nil + } + + unlock, err := acquireFileLock(opts.lockFile) + if err != nil { + return err + } + defer unlock() + + client, err := newPSQLClient(databaseURL, opts.timeout) + if err != nil { + return err + } + if err := client.ping(ctx); err != nil { + return err + } + log.Printf("PostgreSQL-Verbindung hergestellt.") + + if err := client.ensureMigrationTable(ctx); err != nil { + return err + } + + if !opts.keepFiles { + if err := os.MkdirAll(opts.archive, 0o750); err != nil { + return fmt.Errorf("Archivordner %s konnte nicht angelegt werden: %w", opts.archive, err) + } + } + + for _, m := range migrations { + if err := processMigration(ctx, client, opts, m); err != nil { + return err + } + } + + log.Printf("Alle Migrationen wurden erfolgreich verarbeitet.") + return nil +} + +func newPSQLClient(databaseURL string, timeout time.Duration) (*psqlClient, error) { + path, err := exec.LookPath("psql") + if err != nil { + return nil, fmt.Errorf("psql wurde nicht gefunden; installiere einmalig: sudo apt install postgresql-client") + } + + connectionEnv, err := postgresEnvironment(databaseURL) + if err != nil { + return nil, err + } + env := mergeEnvironment(os.Environ(), connectionEnv...) + env = mergeEnvironment(env, + "PGOPTIONS=-c search_path=landwelle,public", + "PGAPPNAME=landwelle-migrator", + ) + return &psqlClient{path: path, env: env, timeout: timeout}, nil +} + +func mergeEnvironment(base []string, overrides ...string) []string { + values := make(map[string]string, len(base)+len(overrides)) + order := make([]string, 0, len(base)+len(overrides)) + set := func(entry string) { + key, _, ok := strings.Cut(entry, "=") + if !ok || key == "" { + return + } + if _, exists := values[key]; !exists { + order = append(order, key) + } + values[key] = entry + } + for _, entry := range base { + set(entry) + } + for _, entry := range overrides { + set(entry) + } + result := make([]string, 0, len(order)) + for _, key := range order { + result = append(result, values[key]) + } + return result +} + +func postgresEnvironment(databaseURL string) ([]string, error) { + u, err := url.Parse(databaseURL) + if err != nil { + return nil, fmt.Errorf("DATABASE_URL ist ungültig: %w", err) + } + if u.Scheme != "postgres" && u.Scheme != "postgresql" { + return nil, fmt.Errorf("DATABASE_URL muss mit postgres:// oder postgresql:// beginnen") + } + if u.User == nil || u.User.Username() == "" { + return nil, fmt.Errorf("DATABASE_URL enthält keinen PostgreSQL-Benutzer") + } + database := strings.TrimPrefix(u.EscapedPath(), "/") + decodedDatabase, err := url.PathUnescape(database) + if err != nil { + return nil, fmt.Errorf("Datenbankname in DATABASE_URL ist ungültig: %w", err) + } + if decodedDatabase == "" { + return nil, fmt.Errorf("DATABASE_URL enthält keinen Datenbanknamen") + } + + env := []string{ + "PGUSER=" + u.User.Username(), + "PGDATABASE=" + decodedDatabase, + } + if password, ok := u.User.Password(); ok { + env = append(env, "PGPASSWORD="+password) + } + if host := u.Hostname(); host != "" { + env = append(env, "PGHOST="+host) + } + if port := u.Port(); port != "" { + env = append(env, "PGPORT="+port) + } + + query := u.Query() + mapping := map[string]string{ + "sslmode": "PGSSLMODE", + "connect_timeout": "PGCONNECT_TIMEOUT", + "application_name": "PGAPPNAME", + "target_session_attrs": "PGTARGETSESSIONATTRS", + "sslrootcert": "PGSSLROOTCERT", + "sslcert": "PGSSLCERT", + "sslkey": "PGSSLKEY", + } + for queryName, envName := range mapping { + if value := query.Get(queryName); value != "" { + env = append(env, envName+"="+value) + } + } + return env, nil +} + +func (p *psqlClient) ping(parent context.Context) error { + ctx, cancel := context.WithTimeout(parent, 20*time.Second) + defer cancel() + _, err := p.run(ctx, "--command", "SELECT 1;") + if err != nil { + return fmt.Errorf("PostgreSQL-Verbindung nicht möglich: %w", err) + } + return nil +} + +func (p *psqlClient) ensureMigrationTable(ctx context.Context) error { + const sql = ` +CREATE SCHEMA IF NOT EXISTS landwelle; +CREATE TABLE IF NOT EXISTS landwelle.schema_migrations ( + version bigint PRIMARY KEY, + filename text NOT NULL DEFAULT '', + checksum text NOT NULL DEFAULT '', + applied_at timestamptz NOT NULL DEFAULT now() +); +ALTER TABLE landwelle.schema_migrations + ADD COLUMN IF NOT EXISTS filename text NOT NULL DEFAULT ''; +ALTER TABLE landwelle.schema_migrations + ADD COLUMN IF NOT EXISTS checksum text NOT NULL DEFAULT ''; +` + if _, err := p.runWithTimeout(ctx, "--command", sql); err != nil { + return fmt.Errorf("Migrationstabelle konnte nicht vorbereitet werden: %w", err) + } + return nil +} + +func (p *psqlClient) lookupApplied(ctx context.Context, version int64) (appliedMigration, bool, error) { + query := fmt.Sprintf(` +SELECT filename || E'\t' || checksum +FROM landwelle.schema_migrations +WHERE version = %d; +`, version) + output, err := p.runWithTimeout(ctx, "--tuples-only", "--no-align", "--command", query) + if err != nil { + return appliedMigration{}, false, err + } + line := strings.TrimSpace(output) + if line == "" { + return appliedMigration{}, false, nil + } + parts := strings.SplitN(line, "\t", 2) + result := appliedMigration{Filename: parts[0]} + if len(parts) == 2 { + result.Checksum = parts[1] + } + return result, true, nil +} + +func (p *psqlClient) executeMigration(ctx context.Context, m migration) error { + if transactionPattern.MatchString(m.SQL) { + return fmt.Errorf("%s enthält BEGIN/COMMIT; Transaktionen werden vom Migrator verwaltet", m.Name) + } + if _, err := p.runWithTimeout(ctx, + "--single-transaction", + "--file", m.Path, + "--command", migrationRegistrationSQL(m), + ); err != nil { + return fmt.Errorf("SQL-Fehler in %s: %w", m.Name, err) + } + return nil +} + +func (p *psqlClient) registerMigration(ctx context.Context, m migration) error { + _, err := p.runWithTimeout(ctx, "--command", migrationRegistrationSQL(m)) + return err +} + +func migrationRegistrationSQL(m migration) string { + // Name und Prüfsumme stammen aus einem streng validierten Dateinamen bzw. SHA-256. + return fmt.Sprintf(` +INSERT INTO landwelle.schema_migrations (version, filename, checksum, applied_at) +VALUES (%d, '%s', '%s', now()) +ON CONFLICT (version) DO UPDATE +SET filename = EXCLUDED.filename, + checksum = EXCLUDED.checksum; +`, m.Version, strings.ReplaceAll(m.Name, "'", "''"), m.Checksum) +} + +func (p *psqlClient) runWithTimeout(parent context.Context, args ...string) (string, error) { + ctx, cancel := context.WithTimeout(parent, p.timeout) + defer cancel() + return p.run(ctx, args...) +} + +func (p *psqlClient) run(ctx context.Context, args ...string) (string, error) { + baseArgs := []string{"-X", "--no-psqlrc", "--quiet", "--set", "ON_ERROR_STOP=1"} + cmd := exec.CommandContext(ctx, p.path, append(baseArgs, args...)...) + cmd.Env = p.env + var stdout strings.Builder + var stderr strings.Builder + cmd.Stdout = &stdout + cmd.Stderr = &stderr + if err := cmd.Run(); err != nil { + message := strings.TrimSpace(stderr.String()) + if errors.Is(ctx.Err(), context.DeadlineExceeded) { + return stdout.String(), fmt.Errorf("Zeitlimit überschritten") + } + if message == "" { + message = err.Error() + } + return stdout.String(), errors.New(message) + } + return stdout.String(), nil +} + +func processMigration(ctx context.Context, client *psqlClient, opts options, m migration) error { + applied, found, err := client.lookupApplied(ctx, m.Version) + if err != nil { + return fmt.Errorf("Status von %s konnte nicht gelesen werden: %w", m.Name, err) + } + + if found { + if applied.Checksum != "" && applied.Checksum != m.Checksum { + return fmt.Errorf("%s ist in PostgreSQL bereits registriert, aber die Prüfsumme ist anders; Datei nicht verändert", m.Name) + } + if applied.Checksum == "" || applied.Filename == "" { + if err := client.registerMigration(ctx, m); err != nil { + return fmt.Errorf("Metadaten für bereits ausgeführte Migration %s konnten nicht ergänzt werden: %w", m.Name, err) + } + } + log.Printf("✓ %s war bereits importiert.", m.Name) + return archiveMigration(opts, m) + } + + log.Printf("→ Führe %s aus ...", m.Name) + if err := client.executeMigration(ctx, m); err != nil { + return err + } + + log.Printf("✓ %s erfolgreich importiert und registriert.", m.Name) + return archiveMigration(opts, m) +} + +func acquireFileLock(path string) (func(), error) { + file, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0o600) + if err != nil { + return nil, fmt.Errorf("Sperrdatei %s konnte nicht geöffnet werden: %w", path, err) + } + if err := syscall.Flock(int(file.Fd()), syscall.LOCK_EX|syscall.LOCK_NB); err != nil { + _ = file.Close() + return nil, fmt.Errorf("ein anderer Migrationslauf ist bereits aktiv; Sperrdatei: %s", path) + } + if err := file.Truncate(0); err == nil { + _, _ = file.Seek(0, 0) + _, _ = fmt.Fprintf(file, "%d\n", os.Getpid()) + } + return func() { + _ = syscall.Flock(int(file.Fd()), syscall.LOCK_UN) + _ = file.Close() + _ = os.Remove(path) + }, nil +} + +func archiveMigration(opts options, m migration) error { + if opts.keepFiles { + return nil + } + + destination := filepath.Join(opts.archive, m.Name+".applied") + if existing, err := os.ReadFile(destination); err == nil { + sum := sha256.Sum256(existing) + if hex.EncodeToString(sum[:]) != m.Checksum { + return fmt.Errorf("Archivdatei %s existiert bereits mit anderem Inhalt", destination) + } + if err := os.Remove(m.Path); err != nil && !errors.Is(err, os.ErrNotExist) { + return fmt.Errorf("doppelte Quelldatei %s konnte nicht entfernt werden: %w", m.Path, err) + } + log.Printf(" ↳ bereits archiviert: %s", destination) + return nil + } else if !errors.Is(err, os.ErrNotExist) { + return fmt.Errorf("Archivdatei %s konnte nicht geprüft werden: %w", destination, err) + } + + if err := os.Rename(m.Path, destination); err != nil { + return fmt.Errorf("%s wurde importiert, konnte aber nicht nach %s verschoben werden: %w", m.Name, destination, err) + } + log.Printf(" ↳ verschoben nach %s", destination) + return nil +} + +func discoverMigrations(dir string) ([]migration, error) { + entries, err := os.ReadDir(dir) + if err != nil { + return nil, fmt.Errorf("Migrationsordner %s konnte nicht gelesen werden: %w", dir, err) + } + + seenVersions := make(map[int64]string) + migrations := make([]migration, 0, len(entries)) + for _, entry := range entries { + if entry.IsDir() { + continue + } + matches := migrationNamePattern.FindStringSubmatch(entry.Name()) + if len(matches) != 2 { + continue + } + + version, err := strconv.ParseInt(matches[1], 10, 64) + if err != nil { + return nil, fmt.Errorf("ungültige Migrationsnummer in %s: %w", entry.Name(), err) + } + if previous, exists := seenVersions[version]; exists { + return nil, fmt.Errorf("Migrationsnummer %d ist doppelt vorhanden: %s und %s", version, previous, entry.Name()) + } + seenVersions[version] = entry.Name() + + path := filepath.Join(dir, entry.Name()) + contents, err := os.ReadFile(path) + if err != nil { + return nil, fmt.Errorf("Migration %s konnte nicht gelesen werden: %w", entry.Name(), err) + } + if len(strings.TrimSpace(string(contents))) == 0 { + return nil, fmt.Errorf("Migration %s ist leer", entry.Name()) + } + sum := sha256.Sum256(contents) + migrations = append(migrations, migration{ + Version: version, + Name: entry.Name(), + Path: path, + Checksum: hex.EncodeToString(sum[:]), + SQL: string(contents), + }) + } + + sort.Slice(migrations, func(i, j int) bool { + if migrations[i].Version == migrations[j].Version { + return migrations[i].Name < migrations[j].Name + } + return migrations[i].Version < migrations[j].Version + }) + return migrations, nil +} + +func loadEnvFile(path string) (map[string]string, error) { + values := make(map[string]string) + file, err := os.Open(path) + if errors.Is(err, os.ErrNotExist) { + return values, nil + } + if err != nil { + return nil, fmt.Errorf("Environment-Datei %s konnte nicht geöffnet werden: %w", path, err) + } + defer file.Close() + + reader := bufio.NewReader(file) + lineNumber := 0 + for { + line, readErr := reader.ReadString('\n') + lineNumber++ + line = strings.TrimSpace(line) + if line != "" && !strings.HasPrefix(line, "#") { + line = strings.TrimSpace(strings.TrimPrefix(line, "export ")) + key, value, ok := strings.Cut(line, "=") + if !ok { + return nil, fmt.Errorf("ungültige Zeile %d in %s", lineNumber, path) + } + key = strings.TrimSpace(key) + value = strings.TrimSpace(value) + if key == "" { + return nil, fmt.Errorf("leerer Variablenname in Zeile %d von %s", lineNumber, path) + } + if len(value) >= 2 { + if (value[0] == '"' && value[len(value)-1] == '"') || (value[0] == '\'' && value[len(value)-1] == '\'') { + value = value[1 : len(value)-1] + } + } + values[key] = value + } + if errors.Is(readErr, io.EOF) { + break + } + if readErr != nil { + return nil, fmt.Errorf("Environment-Datei %s konnte nicht gelesen werden: %w", path, readErr) + } + } + return values, nil +} diff --git a/cmd/migrate/main_test.go b/cmd/migrate/main_test.go new file mode 100644 index 0000000..ca27bd9 --- /dev/null +++ b/cmd/migrate/main_test.go @@ -0,0 +1,123 @@ +package main + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +func TestLoadEnvFile(t *testing.T) { + dir := t.TempDir() + path := filepath.Join(dir, ".env") + contents := "# comment\nDATABASE_URL=postgres://user:pass@localhost/db\nexport OTHER=\"value\"\n" + if err := os.WriteFile(path, []byte(contents), 0o600); err != nil { + t.Fatal(err) + } + + values, err := loadEnvFile(path) + if err != nil { + t.Fatal(err) + } + if values["DATABASE_URL"] != "postgres://user:pass@localhost/db" { + t.Fatalf("unexpected DATABASE_URL: %q", values["DATABASE_URL"]) + } + if values["OTHER"] != "value" { + t.Fatalf("unexpected OTHER: %q", values["OTHER"]) + } +} + +func TestDiscoverMigrationsSortsNumerically(t *testing.T) { + dir := t.TempDir() + files := map[string]string{ + "0010_ten.sql": "SELECT 10;", + "0002_two.sql": "SELECT 2;", + "README.md": "ignored", + } + for name, contents := range files { + if err := os.WriteFile(filepath.Join(dir, name), []byte(contents), 0o600); err != nil { + t.Fatal(err) + } + } + + migrations, err := discoverMigrations(dir) + if err != nil { + t.Fatal(err) + } + if len(migrations) != 2 { + t.Fatalf("expected 2 migrations, got %d", len(migrations)) + } + if migrations[0].Version != 2 || migrations[1].Version != 10 { + t.Fatalf("unexpected order: %d, %d", migrations[0].Version, migrations[1].Version) + } +} + +func TestArchiveMigration(t *testing.T) { + dir := t.TempDir() + sourceDir := filepath.Join(dir, "migrations") + archiveDir := filepath.Join(sourceDir, "applied") + if err := os.MkdirAll(archiveDir, 0o750); err != nil { + t.Fatal(err) + } + path := filepath.Join(sourceDir, "0001_test.sql") + contents := []byte("SELECT 1;") + if err := os.WriteFile(path, contents, 0o600); err != nil { + t.Fatal(err) + } + + migrations, err := discoverMigrations(sourceDir) + if err != nil { + t.Fatal(err) + } + if err := archiveMigration(options{archive: archiveDir}, migrations[0]); err != nil { + t.Fatal(err) + } + if _, err := os.Stat(path); !os.IsNotExist(err) { + t.Fatalf("source still exists or unexpected error: %v", err) + } + if _, err := os.Stat(filepath.Join(archiveDir, "0001_test.sql.applied")); err != nil { + t.Fatalf("archive missing: %v", err) + } +} + +func TestPostgresEnvironment(t *testing.T) { + env, err := postgresEnvironment("postgres://landwelle:secret@db.example:5433/radio?sslmode=require&connect_timeout=4") + if err != nil { + t.Fatal(err) + } + values := make(map[string]string) + for _, entry := range env { + key, value, ok := strings.Cut(entry, "=") + if ok { + values[key] = value + } + } + checks := map[string]string{ + "PGUSER": "landwelle", + "PGPASSWORD": "secret", + "PGHOST": "db.example", + "PGPORT": "5433", + "PGDATABASE": "radio", + "PGSSLMODE": "require", + "PGCONNECT_TIMEOUT": "4", + } + for key, expected := range checks { + if values[key] != expected { + t.Fatalf("%s: expected %q, got %q", key, expected, values[key]) + } + } +} + +func TestMergeEnvironmentOverrides(t *testing.T) { + merged := mergeEnvironment([]string{"PGHOST=old", "PATH=/bin"}, "PGHOST=new") + values := make(map[string]string) + for _, entry := range merged { + key, value, ok := strings.Cut(entry, "=") + if ok { + values[key] = value + } + } + if values["PGHOST"] != "new" { + t.Fatalf("expected override, got %q", values["PGHOST"]) + } +} diff --git a/config/event-sources.example.yaml b/config/event-sources.example.yaml new file mode 100644 index 0000000..951e9b9 --- /dev/null +++ b/config/event-sources.example.yaml @@ -0,0 +1,21 @@ +sources: + - id: niedersachsen-hub + name: Niedersachsen Hub / Open Data-Finder + type: open_data + enabled: false + region: Niedersachsen + notes: API-Zugang und Lizenzfreigabe vor Aktivierung klären. + - id: reiseland-niedersachsen + name: Reiseland Niedersachsen Veranstaltungskalender + type: official_calendar + url: https://www.reiseland-niedersachsen.de/veranstaltungen + enabled: false + region: Niedersachsen + notes: Bevorzugt über Niedersachsen Hub/Open Data beziehen, nicht ungefragt scrapen. + - id: local-ical-example + name: Kommunaler iCal-Feed + type: ical + url: https://example.invalid/events.ics + enabled: false + region: Niedersachsen + notes: Durch einen freigegebenen offiziellen Feed ersetzen. diff --git a/config/rss-feeds.example.yaml b/config/rss-feeds.example.yaml new file mode 100644 index 0000000..d3fe3c8 --- /dev/null +++ b/config/rss-feeds.example.yaml @@ -0,0 +1,62 @@ +# Beispielkonfiguration für die spätere Erstbefüllung. +# Produktiv werden Quellen in PostgreSQL und im Adminbereich verwaltet. +feeds: + - name: Landwirtschaftskammer Niedersachsen – Presse + feed_url: https://www.lwk-niedersachsen.de/rss_lwk_presse.rdf + website_url: https://www.lwk-niedersachsen.de/ + source_type: public_institution + regions: [niedersachsen] + categories: [landwirtschaft] + enabled: true + publication_mode: automatic + rights_status: allowed_with_attribution + allow_title: true + allow_summary: true + allow_image: false + attribution_text: "Quelle: Landwirtschaftskammer Niedersachsen" + interval: 15m + + - name: Niedersächsischer Landtag – Presse + feed_url: https://www.landtag-niedersachsen.de/rss/presse.xml + website_url: https://www.landtag-niedersachsen.de/ + source_type: public_institution + regions: [niedersachsen] + categories: [politik] + enabled: false + publication_mode: review + rights_status: review_required + allow_title: true + allow_summary: false + allow_image: false + attribution_text: "Quelle: Niedersächsischer Landtag" + interval: 15m + + - name: Stadt Braunschweig – Stadtmarketing + feed_url: "https://www.braunschweig.de/rss/stadtmarketing.php?sp%3Aout=rss" + website_url: https://www.braunschweig.de/ + source_type: municipality + regions: [braunschweig] + categories: [veranstaltungen, kultur] + enabled: false + publication_mode: review + rights_status: review_required + allow_title: true + allow_summary: false + allow_image: false + attribution_text: "Quelle: Stadt Braunschweig" + interval: 20m + + - name: NDR – Niedersachsen + feed_url: https://www.ndr.de/nachrichten/niedersachsen/index~rss2.xml + website_url: https://www.ndr.de/nachrichten/niedersachsen/ + source_type: rss + regions: [niedersachsen] + categories: [nachrichten] + enabled: true + publication_mode: automatic + rights_status: noncommercial_only + allow_title: true + allow_summary: false + allow_image: false + attribution_text: "Quelle: NDR.de" + interval: 5m diff --git a/content.go b/content.go new file mode 100644 index 0000000..ee54f01 --- /dev/null +++ b/content.go @@ -0,0 +1,188 @@ +package main + +import ( + "strings" + "time" +) + +type Excursion struct { + Title string + Category string + Region string + Description string + Distance string + Image string + URL string + Featured bool +} + +type ContentSection struct { + Title string + Text string + Items []string + CTA string + URL string +} + +type ContentPage struct { + Slug string + Kicker string + Title string + Lead string + Updated string + Sections []ContentSection + ContactMail string +} + +type StaticPageData struct { + StreamURL string + Page ContentPage +} + +type ExcursionPageData struct { + StreamURL string + Excursions []Excursion + Categories []ExcursionCategory +} + +type TeamMember struct { + ID string `json:"id"` + Name string `json:"name"` + Role string `json:"role"` + Image string `json:"image"` + Bio string `json:"bio"` + Region string `json:"region"` + Task string `json:"task"` + AtLandwelle string `json:"at_landwelle"` + SortOrder int `json:"sort_order"` + Active bool `json:"active"` + IsAI bool `json:"is_ai"` + AIDisclosure string `json:"ai_disclosure"` + ImageAIUsage string `json:"image_ai_usage"` + ImageWatermarkEnabled bool `json:"image_watermark_enabled"` + ImageWatermarkText string `json:"image_watermark_text"` +} + +func (m TeamMember) AITransparencyText() string { + if text := strings.TrimSpace(m.AIDisclosure); text != "" { + return text + } + if m.IsAI { + return "Dieses Teamprofil stellt eine virtuelle, KI-gestützte Landwelle-Persönlichkeit dar." + } + return "" +} + +func (m TeamMember) HasImageWatermark() bool { + return m.ImageWatermarkEnabled && normalizeMediaAIUsage(m.ImageAIUsage) != "none" +} + +func (m TeamMember) ImageWatermarkLabel() string { + if !m.HasImageWatermark() { + return "" + } + if text := strings.TrimSpace(m.ImageWatermarkText); text != "" { + return text + } + if normalizeMediaAIUsage(m.ImageAIUsage) == "manipulated" { + return "Mit KI bearbeitet" + } + return "Mit KI erstellt" +} + +type TeamPageData struct { + StreamURL string + Members []TeamMember +} + +func teamMembers() []TeamMember { + return []TeamMember{ + {ID: "jens-bramsche", Name: "Jens Bramsche", Role: "Moderator & Geschäftsführer", Image: "/assets/jens-bramsche-v16.png", Bio: "Jens gehört zu den Stimmen von Landwelle und begleitet die Hörerinnen und Hörer mit Nähe zur Region, guter Musik und einem offenen Ohr für die Menschen in Niedersachsen.", Region: "Bramsche · Niedersachsen", Task: "Moderation & Geschäftsführung", AtLandwelle: "Moderator & Geschäftsführer"}, + {ID: "joerg-weiss", Name: "Jörg Weiß", Role: "IT & Developer", Image: "/assets/joerg-weiss-v20.png", Bio: "Jörg kümmert sich bei Landwelle um die technische Entwicklung und sorgt dafür, dass Website, digitale Angebote und die Systeme hinter dem Sender zuverlässig funktionieren und weiterentwickelt werden.", Region: "Niedersachsen", Task: "IT & Development", AtLandwelle: "IT & Developer"}, + {ID: "antje-weiss", Name: "Antje Weiß", Role: "Marketing & Werbung", Image: "/assets/antje-weiss-v21.png", Bio: "Antje kümmert sich bei Landwelle um Marketing, Werbung und die Außendarstellung. Sie entwickelt Ideen für regionale Partnerschaften und sorgt dafür, dass Landwelle bei Hörerinnen, Hörern und Unternehmen sichtbar bleibt.", Region: "Niedersachsen", Task: "Marketing & Werbung", AtLandwelle: "Marketing & Werbung"}, + } +} + +type TrafficPageData struct { + StreamURL string +} + +type ProgramPageData struct { + StreamURL string + Days []ProgramDay + Updated string + Current ProgramItem + HasCurrent bool + TodayName string +} + +func excursionData() []Excursion { + return []Excursion{ + {Title: "Rund um Visselhövede", Category: "Radtour", Region: "Heidekreis", Description: "Entspannte Wege durch Wald, Wiesen und kleine Ortschaften rund um den Landwelle-Heimatort.", Distance: "ca. 35 km", Image: "/assets/tip-radtour.jpg", URL: "https://www.lueneburger-heide.de/", Featured: true}, + {Title: "Heide Park Resort", Category: "Freizeitpark", Region: "Soltau · Heidekreis", Description: "Achterbahnen, Themenwelten und Familienattraktionen für einen ganzen Tag voller Abenteuer.", Distance: "Tagesausflug", Image: "/assets/leisure-heidepark-v15.svg", URL: "https://www.heide-park.de/", Featured: true}, + {Title: "Serengeti-Park Hodenhagen", Category: "Freizeitpark", Region: "Hodenhagen · Heidekreis", Description: "Safari, Tierwelt, Fahrgeschäfte und Shows verbinden sich zu einem besonderen Freizeiterlebnis.", Distance: "Tagesausflug", Image: "/assets/leisure-serengeti-v15.svg", URL: "https://serengeti-park.de/", Featured: true}, + {Title: "Rasti-Land", Category: "Freizeitpark", Region: "Salzhemmendorf · Weserbergland", Description: "Familienfreundliche Fahrgeschäfte, Abenteuerwelten und Freizeitspaß am Rand des Weserberglands.", Distance: "Tagesausflug", Image: "/assets/leisure-rastiland-v15.svg", URL: "https://www.rasti-land.de/"}, + {Title: "Lüneburger Heide entdecken", Category: "Natur", Region: "Nordost", Description: "Heidelandschaften, Wacholder, Heidschnucken und viele Wege für einen Tagesausflug.", Distance: "Tagesausflug", Image: "/assets/story-land.jpg", URL: "https://www.lueneburger-heide.de/", Featured: true}, + {Title: "Weser-Radweg", Category: "Radfernweg", Region: "Mittelweser", Description: "Flussnahe Etappen durch historische Orte und weite Landschaften entlang der Weser.", Distance: "Mehrtagestour", Image: "/assets/tip-radtour.jpg", URL: "https://www.weserradweg-info.de/", Featured: true}, + {Title: "Steinhuder Meer", Category: "Familie", Region: "Region Hannover", Description: "Uferwege, Naturbeobachtung und Ausflugsorte rund um Niedersachsens größten Binnensee.", Distance: "Rundtour möglich", Image: "/assets/news-region.jpg", URL: "https://www.steinhuder-meer.de/"}, + {Title: "Harz und Nationalpark", Category: "Wandern", Region: "Südniedersachsen", Description: "Waldwege, Aussichtspunkte und abwechslungsreiche Touren zwischen Bergen und Tälern.", Distance: "verschiedene Touren", Image: "/assets/story-muehle.jpg", URL: "https://www.harzinfo.de/"}, + {Title: "Nordseeküste & Wattenmeer", Category: "Natur", Region: "Nordwest", Description: "Deiche, Küstenorte und das UNESCO-Weltnaturerbe Wattenmeer erleben.", Distance: "Tages- oder Wochenendtrip", Image: "/assets/news-village.jpg", URL: "https://www.nordsee53grad.de/"}, + {Title: "Elberadweg in Niedersachsen", Category: "Radfernweg", Region: "Elbe-Weser", Description: "Radtouren entlang der Elbe mit weitem Blick, kleinen Häfen und historischen Orten.", Distance: "Etappen frei wählbar", Image: "/assets/tip-radtour.jpg", URL: "https://www.elberadweg.de/"}, + {Title: "Mühlenroute im Landkreis Rotenburg", Category: "Kultur", Region: "Elbe-Weser", Description: "Historische Mühlen, Dörfer und ländliche Kultur zwischen Wümme und Oste.", Distance: "Tagestour", Image: "/assets/story-muehle.jpg", URL: "https://www.rotenburg-wuemme.de/"}, + {Title: "Emsland-Route", Category: "Radtour", Region: "Weser-Ems", Description: "Flache Wege, Kanäle, Moorlandschaften und technische Kultur im Westen Niedersachsens.", Distance: "mehrere Etappen", Image: "/assets/story-land.jpg", URL: "https://www.emsland.com/"}, + } +} + +func contentPages() map[string]ContentPage { + updated := time.Now().Format("02.01.2006") + return map[string]ContentPage{ + "app": {Slug: "app", Kicker: "Unterwegs hören", Title: "Die Landwelle App", Lead: "Die Android-App startet zunächst als lokal installierbare APK. Google Play und iOS folgen später.", Updated: updated, Sections: []ContentSection{{Title: "Geplante Funktionen", Text: "Livestream, Hintergrundwiedergabe, aktuelle Titel, regionale Nachrichten, Programm, Veranstaltungen und Firebase-Push."}, {Title: "Verfügbarkeit", Text: "Ein Download wird hier eingeblendet, sobald die erste geprüfte APK bereitsteht."}}}, + "moderatoren": {Slug: "moderatoren", Kicker: "On Air", Title: "Moderatoren", Lead: "Die Stimmen hinter Landwelle – dieser Bereich wird mit dem Programmplan automatisch erweitert.", Updated: updated, Sections: []ContentSection{{Title: "Jan-Henrik Gerdes", Text: "Moin Niedersachsen – der Start in den Tag."}, {Title: "Anna Leineweber", Text: "Das Land am Mittag – regionale Themen und Musik."}, {Title: "Tom Westerholt", Text: "Landwelle am Nachmittag – Musik, Verkehr und Service."}}}, + "frequenzen": {Slug: "frequenzen", Kicker: "Empfang", Title: "Landwelle empfangen", Lead: "Aktuell ist Landwelle als Webradio über den Livestream verfügbar.", Updated: updated, Sections: []ContentSection{{Title: "Online-Stream", Text: "Nutze den eigenständigen Landwelle-Player im Browser oder die direkte Stream-Adresse."}, {Title: "Weitere Empfangswege", Text: "Apps und Desktop-Player sind geplant. UKW- oder DAB+-Frequenzen werden hier veröffentlicht, sobald sie verfügbar sind."}}}, + "nachricht-senden": {Slug: "nachricht-senden", Kicker: "Mitmachen", Title: "Nachricht senden", Lead: "Du hast ein wichtiges Thema aus deiner Region? Gib der Landwelle-Redaktion einen Hinweis.", Updated: updated, Sections: []ContentSection{{Title: "Was wir brauchen", Text: "Ort, kurzer Sachverhalt, Zeitpunkt und eine erreichbare Kontaktmöglichkeit. Bitte sende nur Inhalte, für die du die nötigen Rechte hast.", CTA: "Nachricht an die Redaktion", URL: "mailto:redaktion@landwelle.de?subject=Nachricht%20aus%20der%20Region"}}}, + "gewinnspiele": {Slug: "gewinnspiele", Kicker: "Mitmachen", Title: "Gewinnspiele", Lead: "Hier erscheinen zukünftig aktuelle Landwelle-Gewinnspiele und Teilnahmebedingungen.", Updated: updated, Sections: []ContentSection{{Title: "Aktuell", Text: "Derzeit läuft kein öffentliches Gewinnspiel."}}}, + "ki-transparenz": {Slug: "ki-transparenz", Kicker: "Offen & nachvollziehbar", Title: "KI-Transparenz bei Landwelle", Lead: "Hier erklären wir verständlich, wo Landwelle künstliche Intelligenz einsetzt und wie entsprechende Inhalte gekennzeichnet, geprüft und verantwortet werden.", Updated: "02.08.2026", Sections: []ContentSection{ + {Title: "Unser Grundsatz", Text: "Künstliche Intelligenz unterstützt einzelne redaktionelle und technische Arbeitsabläufe bei Landwelle. Sie ersetzt nicht die journalistische Verantwortung. Wo KI einen Inhalt erstellt oder wesentlich bearbeitet hat, machen wir das für Hörerinnen, Hörer und Websitebesucher klar erkennbar."}, + {Title: "Texte und regionale Beiträge", Text: "Beiträge können mit KI-Unterstützung vorbereitet, vollständig KI-generiert oder wesentlich KI-bearbeitet sein. Solche Inhalte erhalten unmittelbar am Beitrag eine verständliche Kennzeichnung. Zusätzlich dokumentieren wir, ob eine redaktionelle Prüfung erfolgt ist und wer die redaktionelle Verantwortung trägt. Reine Rechtschreib-, Recherche- oder Formulierungshilfen ohne maßgeblichen Einfluss auf den veröffentlichten Inhalt werden nicht automatisch als KI-generierter Beitrag eingestuft."}, + {Title: "Audio, KI-Stimmen und Mediathek", Text: "Von künstlicher Intelligenz erzeugte Audioinhalte und synthetische Stimmen werden vor dem Abspielen sichtbar gekennzeichnet. Neu erzeugte KI-Audios beginnen zusätzlich mit einem gesprochenen Transparenzhinweis. In der Mediathek zeigen wir außerdem, ob eine redaktionelle Prüfung dokumentiert wurde."}, + {Title: "Bilder und wesentlich bearbeitete Medien", Text: "KI-generierte oder wesentlich KI-bearbeitete Bilder werden in der Medienverwaltung klassifiziert. Für ausgewählte Motive kann zusätzlich ein gut sichtbares Wasserzeichen wie „Mit KI erstellt“ oder „Mit KI bearbeitet“ aktiviert werden. Das gilt insbesondere für realistisch wirkende KI-Bilder und eigene Fotos, die wesentlich mit KI verändert wurden. Die Originaldatei bleibt dabei unverändert."}, + {Title: "Virtuelle Teammitglieder und KI-Stimmen", Text: "Virtuelle oder KI-gestützte Landwelle-Persönlichkeiten werden auf der Teamseite und im Programm eindeutig als KI-Profil beziehungsweise KI-Stimme gekennzeichnet. Ein zusätzlicher Hinweis erklärt, dass es sich nicht um eine reale Person handelt."}, + {Title: "KI-Informationen in den Jahrescharts", Text: "Automatisch erzeugte Hintergrundinformationen zu Künstlern und Titeln sind im jeweiligen Informationsfenster als KI-generiert gekennzeichnet. Sie dienen als ergänzende Orientierung und können trotz redaktioneller Plausibilitätsprüfung Fehler enthalten."}, + {Title: "Keine verdeckte KI-Interaktion", Text: "Landwelle bietet derzeit keinen öffentlichen KI-Chatbot und keine Funktion zur Emotionserkennung oder biometrischen Kategorisierung an. Sollte sich das ändern, wird die KI-Interaktion bereits zu Beginn klar offengelegt und diese Seite entsprechend aktualisiert."}, + {Title: "Eingesetzte Dienste", Text: "In geschützten redaktionellen Arbeitsabläufen können unter anderem OpenAI für Textentwürfe und ElevenLabs für Sprachsynthese eingesetzt werden. Veröffentlichungen bleiben dem Landwelle-Redaktionsprozess und der dokumentierten redaktionellen Verantwortung unterstellt."}, + {Title: "Fragen und Hinweise", Text: "Du hast eine Frage zu einer Kennzeichnung oder vermutest einen Fehler in einem KI-unterstützten Inhalt? Schreib uns bitte mit dem Link zum betreffenden Beitrag. Wir prüfen den Hinweis und korrigieren oder ergänzen die Kennzeichnung bei Bedarf.", CTA: "Redaktion kontaktieren", URL: "mailto:redaktion@landwelle.de?subject=Hinweis%20zur%20KI-Transparenz"}, + }}, + "impressum": {Slug: "impressum", Kicker: "Rechtliches", Title: "Impressum", Lead: "Anbieterkennzeichnung für Landwelle Radio und das digitale Angebot unter landwelle.de.", Updated: updated, Sections: []ContentSection{ + {Title: "Angaben gemäß § 5 DDG", Text: "SLMM GbR\nLandwelle\n\nGesellschafter und Geschäftsinhaber:\n\nJens Bramsche\nDreeßel 15\n27374 Visselhövede\n\nJörg Weiß\nKäthe-Kollwitz-Weg 9\n29699 Walsrode\n\nDeutschland"}, + {Title: "Kontakt", Text: "Telefon: +49 177 301 9001\nE-Mail: radio@landwelle.de", CTA: "E-Mail an Landwelle", URL: "mailto:radio@landwelle.de"}, + {Title: "Redaktionell verantwortlich", Text: "Verantwortlich für journalistisch-redaktionelle Inhalte gemäß § 18 Abs. 2 MStV:\nJens Bramsche\nDreeßel 15\n27374 Visselhövede"}, + {Title: "IT & Technik", Text: "Jörg Weiß\nKäthe-Kollwitz-Weg 9\n29699 Walsrode\nTelefon: +49 176 411 15984\nE-Mail: it@landwelle.de", CTA: "Technik kontaktieren", URL: "mailto:it@landwelle.de"}, + {Title: "Design & Konzept", Text: "SLMM GbR\nJens Bramsche & Jörg Weiß\nDreeßel 15\n27374 Visselhövede\nhttps://www.slmm.de\nE-Mail: design@slmm.de", CTA: "SLMM Website", URL: "https://www.slmm.de"}, + {Title: "KI-Transparenz", Text: "Informationen zum Einsatz künstlicher Intelligenz, zu synthetischen Stimmen, redaktioneller Prüfung und Kennzeichnung veröffentlichen wir auf einer eigenen Transparenzseite.", CTA: "KI-Transparenz öffnen", URL: "/ki-transparenz"}, + {Title: "Haftung für Inhalte", Text: "Als Diensteanbieter sind wir für eigene Inhalte nach den allgemeinen Gesetzen verantwortlich. Eine Gewähr für Vollständigkeit, Richtigkeit und dauerhafte Aktualität redaktioneller oder automatisch bezogener Informationen wird nicht übernommen. Hinweise auf mögliche Fehler prüfen wir nach Kenntnis unverzüglich."}, + {Title: "Haftung für externe Links", Text: "Unser Angebot enthält Links zu externen Webseiten Dritter. Auf deren Inhalte haben wir keinen Einfluss. Für die Inhalte verlinkter Seiten ist stets der jeweilige Anbieter verantwortlich. Rechtswidrige Inhalte waren bei der Verlinkung nicht erkennbar; bei Bekanntwerden entfernen wir betroffene Links unverzüglich."}, + {Title: "Urheberrecht", Text: "Die von Landwelle erstellten Inhalte und Werke unterliegen dem deutschen Urheberrecht. Beiträge, Bilder, Audioinhalte und sonstige Werke Dritter werden entsprechend gekennzeichnet. Jede Nutzung außerhalb der gesetzlichen Grenzen bedarf der vorherigen Zustimmung der jeweiligen Rechteinhaber."}, + }}, + "datenschutz": {Slug: "datenschutz", Kicker: "Rechtliches", Title: "Datenschutzerklärung", Lead: "Informationen zur Verarbeitung personenbezogener Daten bei der Nutzung von Landwelle Radio, landwelle.de und den zugehörigen Diensten.", Updated: updated, Sections: []ContentSection{ + {Title: "1. Verantwortlicher", Text: "Verantwortlicher im Sinne der Datenschutz-Grundverordnung (DSGVO):\nSLMM GbR, handelnd unter Landwelle\nDreeßel 15\n27374 Visselhövede\nTelefon: +49 177 301 9001\nE-Mail: radio@landwelle.de"}, + {Title: "2. Datenschutz- und Technikkontakt", Text: "Für Datenschutzfragen und technische Anliegen können Sie sich zusätzlich an Jörg Weiß, Käthe-Kollwitz-Weg 9, 29699 Walsrode, E-Mail: it@landwelle.de, Telefon: +49 176 411 15984 wenden. Dieser Kontakt ist keine förmlich bestellte Datenschutzbeauftragtenstelle."}, + {Title: "3. Aufruf der Website und Server-Protokolle", Text: "Beim Aufruf der Website verarbeitet der Server technisch notwendige Verbindungsdaten, insbesondere IP-Adresse, Datum und Uhrzeit, aufgerufene Adresse, Referrer, Browser- und Betriebssysteminformationen sowie den HTTP-Status. Die Verarbeitung ist zur sicheren und stabilen Bereitstellung erforderlich und erfolgt auf Grundlage von Art. 6 Abs. 1 lit. f DSGVO. Protokolle werden nur so lange gespeichert, wie dies für Betrieb, Fehleranalyse und Missbrauchsabwehr erforderlich ist, und anschließend gelöscht oder anonymisiert."}, + {Title: "4. Cookies und lokale Speicherung", Text: "Landwelle verwendet technisch notwendige Cookies und lokale Speicherungen insbesondere für Anmeldung, Sitzungsverwaltung, CSRF-Schutz, den Radioplayer und die Speicherung deiner Einwilligungsentscheidung. Diese Funktionen sind für Betrieb und Sicherheit erforderlich. Die freiwillige Reichweitenmessung wird ausschließlich nach ausdrücklicher Zustimmung aktiviert. Deine Auswahl kannst du jederzeit über „Cookie-Einstellungen“ im Seitenfuß ändern."}, + {Title: "5. Einwilligungsbasierte Reichweitenmessung", Text: "Nach deiner freiwilligen Einwilligung zählt Landwelle Seitenaufrufe, Sitzungen und pseudonyme Besucher sowie aufgerufene Seiten, Geräteklasse und die Domain eines Verweises. Dazu erzeugt dein Browser zufällige Kennungen; auf dem Server werden ausschließlich daraus gebildete Hashwerte gespeichert. Für diese Statistik werden keine Roh-IP-Adressen gespeichert, keine Werbenetzwerke eingebunden und keine Daten mit anderen Websites zusammengeführt. Adminseiten, bekannte Bots, Assets, APIs und Mediendateien werden nicht gezählt. Eine Sitzung endet nach 30 Minuten ohne Aktivität. Die Rohereignisse werden nach spätestens 25 Monaten gelöscht. Rechtsgrundlage ist deine Einwilligung nach Art. 6 Abs. 1 lit. a DSGVO und § 25 Abs. 1 TDDDG; der Widerruf wirkt für die Zukunft."}, + {Title: "6. Livestream und AzuraCast", Text: "Beim Start des Livestreams wird eine Verbindung zum Landwelle-Streamingserver beziehungsweise zur eingesetzten AzuraCast-Instanz hergestellt. Dabei fallen technisch notwendige Verbindungsdaten an. Die Verarbeitung dient der Auslieferung des angeforderten Audiostreams auf Grundlage von Art. 6 Abs. 1 lit. b beziehungsweise lit. f DSGVO. Die Website ruft außerdem aktuelle Titel-, Cover- und Zuhörerinformationen vom Streamingdienst ab."}, + {Title: "7. Wetter, Verkehr und externe Datenquellen", Text: "Für Wetterinformationen wird Open-Meteo verwendet. Verkehrsdaten werden unter anderem von der Autobahn GmbH des Bundes und Blitzermeldungen aus einem externen Verkehrsfeed bezogen. Die Website ruft diese Daten serverseitig ab; eine direkte Verbindung des Browsers zu diesen Quellen ist grundsätzlich nicht erforderlich. Rechtsgrundlage ist Art. 6 Abs. 1 lit. f DSGVO, unser Interesse an aktuellen Serviceinformationen."}, + {Title: "8. Cover- und Musikmetadaten", Text: "Zur Darstellung von Musiktiteln können Cover- und Metadaten serverseitig über Apple iTunes abgerufen und zwischengespeichert werden. Dabei werden Suchbegriffe wie Interpret und Titel an die jeweiligen Dienste übertragen, jedoch grundsätzlich keine IP-Adresse des Websitebesuchers. Rechtsgrundlage ist Art. 6 Abs. 1 lit. f DSGVO."}, + {Title: "9. Kontaktaufnahme, Musikwünsche und Einsendungen", Text: "Wenn Sie uns per E-Mail, Kontaktformular, Musikwunsch- oder Einsendeformular kontaktieren, verarbeiten wir die von Ihnen übermittelten Angaben, etwa Name, Ort, E-Mail-Adresse, Betreff, Musikwunsch und Nachricht. Kontaktformular-Nachrichten werden im geschützten Redaktionsbereich gespeichert und mit einem Bearbeitungsstatus versehen. Die Verarbeitung erfolgt zur Bearbeitung Ihres Anliegens auf Grundlage von Art. 6 Abs. 1 lit. b DSGVO oder Art. 6 Abs. 1 lit. f DSGVO. Veröffentlichte Wünsche werden erst nach redaktioneller Freigabe angezeigt. Daten werden gelöscht, sobald der Zweck entfällt und keine gesetzlichen Aufbewahrungspflichten entgegenstehen."}, + {Title: "10. Benutzerkonten und Adminbereich", Text: "Für Benutzer- und Administratorkonten werden insbesondere Benutzername, E-Mail-Adresse, Rollen, Berechtigungen, Passwort-Hash, Anmeldezeitpunkte, Sicherheitsereignisse und interne Verwaltungsdaten verarbeitet. Dies ist für Authentifizierung, Rechteverwaltung und Systemsicherheit erforderlich. Passwörter werden nicht im Klartext gespeichert. Rechtsgrundlage ist Art. 6 Abs. 1 lit. b und lit. f DSGVO."}, + {Title: "11. OpenAI, ElevenLabs und KI-Transparenz", Text: "OpenAI und ElevenLabs werden ausschließlich in geschützten redaktionellen beziehungsweise administrativen Arbeitsabläufen eingesetzt, etwa zur Text- oder Sprachgenerierung. Personenbezogene Daten sollen nur übermittelt werden, wenn dies für den jeweiligen Auftrag erforderlich und datenschutzrechtlich zulässig ist. Verantwortliche Redakteure müssen Eingaben vor der Übermittlung prüfen. Je nach Anbieter kann eine Verarbeitung in Drittländern stattfinden; hierfür werden die jeweils erforderlichen Garantien und vertraglichen Vereinbarungen zugrunde gelegt. KI-generierte oder wesentlich KI-bearbeitete öffentliche Inhalte werden nach Maßgabe unserer KI-Transparenzseite gekennzeichnet. Öffentliche KI-Audioinhalte erhalten einen sichtbaren und bei neu erzeugten Audios zusätzlich gesprochenen Hinweis."}, + {Title: "12. Facebook und WhatsApp", Text: "Landwelle unterhält Auftritte und Kanäle bei Meta-Diensten. Wenn redaktionelle Beiträge über die Facebook-Schnittstelle veröffentlicht werden, übermittelt unser Server den Beitrag und die zugehörigen Metadaten an Meta. Beim bloßen Besuch von landwelle.de werden Facebook oder WhatsApp nicht automatisch geladen, sofern keine entsprechenden externen Inhalte eingebettet sind. Für die Nutzung der Plattformen gelten zusätzlich die Datenschutzbestimmungen des jeweiligen Anbieters."}, + {Title: "13. Firebase Cloud Messaging und Apps", Text: "Für spätere App-Push-Benachrichtigungen ist Firebase Cloud Messaging vorgesehen. Dabei können Gerätekennungen beziehungsweise Push-Tokens, Plattform, App-Version, Benachrichtigungseinstellungen und Zustellstatistiken verarbeitet werden. Die Verarbeitung erfolgt nach Aktivierung der Benachrichtigungen auf Grundlage Ihrer Einwilligung nach Art. 6 Abs. 1 lit. a DSGVO. Die Einwilligung kann in der App beziehungsweise in den Geräteeinstellungen widerrufen werden."}, + {Title: "14. E-Mail-, FTP- und technische Dienstleister", Text: "Für den E-Mail-Versand sowie die technische Bereitstellung von Mediathek-Audio, KI-Beiträgen, Sendungsmitschnitten oder Download-Dateien können konfigurierte SMTP-, FTP- oder Hostinganbieter eingesetzt werden. Personenbezogene Daten werden nur im erforderlichen Umfang übermittelt. Soweit Dienstleister personenbezogene Daten in unserem Auftrag verarbeiten, werden die Anforderungen des Art. 28 DSGVO berücksichtigt."}, + {Title: "15. Empfänger und Drittlandübermittlungen", Text: "Empfänger personenbezogener Daten können technische Dienstleister, Hostinganbieter, E-Mail-Dienstleister, Plattformanbieter und von uns eingesetzte Auftragsverarbeiter sein. Eine Übermittlung außerhalb des Europäischen Wirtschaftsraums erfolgt nur, wenn ein Angemessenheitsbeschluss, geeignete Garantien oder eine andere Rechtsgrundlage nach Kapitel V DSGVO vorliegt."}, + {Title: "16. Speicherdauer", Text: "Wir speichern personenbezogene Daten nur so lange, wie es für den jeweiligen Zweck erforderlich ist. Abweichende Fristen ergeben sich insbesondere aus gesetzlichen Aufbewahrungspflichten, Sicherheitsanforderungen, laufenden Vertragsverhältnissen oder der Bearbeitung von Ansprüchen. Konkrete Löschfristen werden abhängig von Datenkategorie und Dienst festgelegt."}, + {Title: "17. Ihre Rechte", Text: "Sie haben nach Maßgabe der gesetzlichen Voraussetzungen das Recht auf Auskunft, Berichtigung, Löschung, Einschränkung der Verarbeitung, Datenübertragbarkeit und Widerspruch. Erteilte Einwilligungen können jederzeit mit Wirkung für die Zukunft widerrufen werden. Außerdem besteht ein Beschwerderecht bei einer Datenschutzaufsichtsbehörde, insbesondere bei der für Niedersachsen zuständigen Aufsichtsbehörde."}, + {Title: "18. Sicherheit", Text: "Wir setzen angemessene technische und organisatorische Maßnahmen ein, darunter verschlüsselte Übertragung per HTTPS, Zugriffsbeschränkungen, Rollen- und Rechteverwaltung, sichere Passwortspeicherung, geschützte Serververzeichnisse und Protokollierung sicherheitsrelevanter Vorgänge. Ein absoluter Schutz kann dennoch nicht garantiert werden."}, + {Title: "19. Änderungen dieser Erklärung", Text: "Wir aktualisieren diese Datenschutzerklärung, wenn sich Funktionen, eingesetzte Dienste oder rechtliche Anforderungen ändern. Es gilt die auf dieser Seite veröffentlichte Fassung."}, + }}, + } +} diff --git a/content_analytics_test.go b/content_analytics_test.go new file mode 100644 index 0000000..632a46d --- /dev/null +++ b/content_analytics_test.go @@ -0,0 +1,319 @@ +package main + +import ( + "bytes" + "html/template" + "net/http" + "net/http/httptest" + "net/url" + "os" + "path/filepath" + "strings" + "testing" +) + +func TestPublicContentMigrationContract(t *testing.T) { + raw, err := os.ReadFile(filepath.Join("migrations", "0033_public_content_mediathek_analytics.sql")) + if err != nil { + t.Fatal(err) + } + migration := string(raw) + for _, want := range []string{ + "landwelle.public_pages", + "landwelle.contact_messages", + "landwelle.mediathek_entries", + "landwelle.web_analytics_events", + "visitor_hash", + "session_hash", + "source_key", + "mediathek_entries_source_key_uidx", + } { + if !strings.Contains(migration, want) { + t.Fatalf("migration 0033 is missing %q", want) + } + } + for _, forbidden := range []string{"ip_address", "user_agent", "\nBEGIN;", "\nCOMMIT;"} { + if strings.Contains(strings.ToLower(migration), strings.ToLower(forbidden)) { + t.Fatalf("migration 0033 contains forbidden analytics or transaction detail %q", forbidden) + } + } +} + +func TestChartPresentationFixes(t *testing.T) { + cssRaw, err := os.ReadFile(filepath.Join("web", "assets", "charts-v8.css")) + if err != nil { + t.Fatal(err) + } + css := string(cssRaw) + for _, want := range []string{ + "aspect-ratio:16/10;max-height:255px", + ".chart-vote-countdown[hidden]{display:none!important}", + "background:#203422", + } { + if !strings.Contains(css, want) { + t.Fatalf("chart stylesheet is missing %q", want) + } + } + + templateRaw, err := os.ReadFile(filepath.Join("web", "charts-listener.html")) + if err != nil { + t.Fatal(err) + } + page := string(templateRaw) + for _, want := range []string{"Aktuelle Punkte", "Letzte Woche", "Dabei seit", "Tendenz"} { + if !strings.Contains(page, want) { + t.Fatalf("chart wording is missing %q", want) + } + } + for _, forbidden := range []string{"VOTING-STAND", "EINSTIEG"} { + if strings.Contains(page, forbidden) { + t.Fatalf("chart template still contains technical label %q", forbidden) + } + } +} + +func TestAnalyticsPrivacyFilters(t *testing.T) { + cases := map[string]string{ + "/charts/zuhoerer?utm_source=test": "/charts/zuhoerer", + "/presse#kontakt": "/presse", + "/admin/statistik": "", + "/api/v1/news": "", + "/media/audio.mp3": "", + "/assets/app-v16.js": "", + } + for input, want := range cases { + if got := normalizeAnalyticsPath(input); got != want { + t.Fatalf("normalizeAnalyticsPath(%q) = %q, want %q", input, got, want) + } + } + if !analyticsBot("Mozilla/5.0 compatible; ExampleBot/1.0") { + t.Fatal("known bot user agent was not excluded") + } + if analyticsBot("Mozilla/5.0 Firefox/140.0") { + t.Fatal("normal browser was classified as bot") + } + if got := analyticsHash("visitor", "abc-123456789"); len(got) != 64 || strings.Contains(got, "abc") { + t.Fatalf("visitor identifier is not pseudonymized correctly: %q", got) + } +} + +func TestPublicAndAdminContentAssets(t *testing.T) { + for _, name := range []string{ + "web/managed-page.html", + "web/faq.html", + "web/contact.html", + "web/mediathek.html", + "web/admin/site-content.html", + "web/admin/mediathek.html", + "web/admin/analytics.html", + "web/assets/site-content-v2.css", + "web/assets/admin-site-content-v2.css", + "web/assets/mediathek-v1.js", + "web/assets/mediathek-v4.css", + "web/assets/mediathek-hero-landwelle-v1.webp", + "web/assets/admin-analytics-v1.js", + "web/assets/admin-forum-v2.css", + } { + if _, err := webFS.ReadFile(name); err != nil { + t.Fatalf("missing embedded content asset %s: %v", name, err) + } + } + + partials, err := webFS.ReadFile("web/partials.html") + if err != nil { + t.Fatal(err) + } + footer := string(partials) + if !strings.Contains(footer, `href="/presse"`) { + t.Fatal("public footer has no press link") + } + if strings.Contains(strings.ToLower(footer), "fotos & video") || strings.Contains(footer, "/fotos-videos") { + t.Fatal("removed photo/video navigation is still present") + } + + adminMediathek, err := webFS.ReadFile("web/admin/mediathek.html") + if err != nil { + t.Fatal(err) + } + for _, want := range []string{"Direkt aus ElevenLabs", "Als Entwurf übernehmen"} { + if !strings.Contains(string(adminMediathek), want) { + t.Fatalf("admin mediathek is missing generated-audio action %q", want) + } + } + + publicMediathek, err := webFS.ReadFile("web/mediathek.html") + if err != nil { + t.Fatal(err) + } + for _, want := range []string{"/assets/mediathek-hero-landwelle-v1.webp", "/assets/mediathek-v4.css", "fetchpriority=\"high\"", "mediathek-hero-shade"} { + if !strings.Contains(string(publicMediathek), want) { + t.Fatalf("public mediathek hero is missing %q", want) + } + } + heroAsset, err := webFS.ReadFile("web/assets/mediathek-hero-landwelle-v1.webp") + if err != nil { + t.Fatal(err) + } + if len(heroAsset) < 12 || string(heroAsset[:4]) != "RIFF" || string(heroAsset[8:12]) != "WEBP" { + t.Fatal("mediathek hero is not a valid embedded WebP container") + } + + for _, name := range []string{"web/managed-page.html", "web/faq.html", "web/contact.html", "web/mediathek.html"} { + raw, err := webFS.ReadFile(name) + if err != nil { + t.Fatal(err) + } + if !strings.Contains(string(raw), "/assets/app-v16.js") { + t.Fatalf("public template %s does not load consent-aware analytics", name) + } + } +} + +func TestContentTemplatesParse(t *testing.T) { + publicFuncs := template.FuncMap{ + "year": func() int { return 2026 }, + "seoHead": seoHead, + "playlistURL": playlistPageURL, + "paragraphs": managedParagraphs, + "publicNavigation": func() template.HTML { return navigationHTML(defaultNavigationItems()) }, + "seq": func(a, b int) []int { + out := make([]int, 0, b-a+1) + for i := a; i <= b; i++ { + out = append(out, i) + } + return out + }, + } + if _, err := template.New("public-content").Funcs(publicFuncs).ParseFS(webFS, + "web/partials.html", "web/managed-page.html", "web/faq.html", "web/contact.html", "web/mediathek.html"); err != nil { + t.Fatalf("new public templates do not parse: %v", err) + } + for _, file := range []string{"web/admin/site-content.html", "web/admin/mediathek.html", "web/admin/analytics.html", "web/admin/forum.html", "web/admin/management.html"} { + if _, err := parseAdminTemplate(file); err != nil { + t.Fatalf("admin template %s does not parse: %v", file, err) + } + } +} + +func TestHomeHasHonestVorOrtEmptyState(t *testing.T) { + raw, err := os.ReadFile(filepath.Join("web", "index.html")) + if err != nil { + t.Fatal(err) + } + page := string(raw) + for _, want := range []string{"Aktuell liegen uns keine neuen Geschichten aus der Region vor.", "home-stories-empty"} { + if !strings.Contains(page, want) { + t.Fatalf("home page is missing honest empty state %q", want) + } + } +} + +func TestAnalyticsRequestValidation(t *testing.T) { + valid := "abcDEF0123456789-identifier_42" + if !validAnalyticsIdentifier(valid) { + t.Fatalf("valid analytics identifier rejected: %q", valid) + } + for _, invalid := range []string{"short", strings.Repeat("a", 81), "abcdefghijklmnopqrst!", "abcdefghijklmnopqrstä"} { + if validAnalyticsIdentifier(invalid) { + t.Fatalf("invalid analytics identifier accepted: %q", invalid) + } + } + + req := httptest.NewRequest(http.MethodPost, "https://landwelle.de/api/site-analytics/pageview", nil) + req.Host = "landwelle.de" + req.Header.Set("Origin", "https://landwelle.de") + req.Header.Set("Sec-Fetch-Site", "same-origin") + if !analyticsSameOriginRequest(req) { + t.Fatal("same-origin analytics request was rejected") + } + req.Header.Set("Origin", "https://example.org") + if analyticsSameOriginRequest(req) { + t.Fatal("cross-origin analytics request was accepted") + } + req.Header.Set("Origin", "https://landwelle.de") + req.Header.Set("Sec-Fetch-Site", "cross-site") + if analyticsSameOriginRequest(req) { + t.Fatal("cross-site Sec-Fetch-Site request was accepted") + } + + consent := `{"version":1,"necessary":true,"analytics":true,"externalMedia":false,"expiresAt":"2099-01-01T00:00:00Z"}` + req.AddCookie(&http.Cookie{Name: "landwelle_consent", Value: url.QueryEscape(consent)}) + if !analyticsConsentCookieValid(req) { + t.Fatal("valid analytics consent cookie was rejected") + } + expired := `{"version":1,"necessary":true,"analytics":true,"expiresAt":"2020-01-01T00:00:00Z"}` + req = httptest.NewRequest(http.MethodPost, "https://landwelle.de/api/site-analytics/pageview", nil) + req.AddCookie(&http.Cookie{Name: "landwelle_consent", Value: url.QueryEscape(expired)}) + if analyticsConsentCookieValid(req) { + t.Fatal("expired analytics consent cookie was accepted") + } +} + +func TestVisibleManagedPageFiltersInactiveBlocks(t *testing.T) { + page := ManagedPublicPage{Blocks: []PublicPageBlock{ + {ID: 1, Title: "Sichtbar", Active: true}, + {ID: 2, Title: "Entwurf", Active: false}, + }} + got := visibleManagedPage(page) + if len(got.Blocks) != 1 || got.Blocks[0].ID != 1 { + t.Fatalf("inactive public content leaked into public page: %#v", got.Blocks) + } + if len(page.Blocks) != 2 { + t.Fatal("visibleManagedPage unexpectedly modified the source page") + } +} + +func TestMediathekAudioValidation(t *testing.T) { + store := &mediaStore{dir: t.TempDir()} + cases := []struct { + name string + data []byte + }{ + {name: "test.mp3", data: append([]byte("ID3\x04\x00\x00\x00\x00\x00\x15"), bytes.Repeat([]byte{0}, 64)...)}, + {name: "test.ogg", data: append([]byte("OggS\x00\x02"), bytes.Repeat([]byte{0}, 64)...)}, + {name: "test.wav", data: append([]byte("RIFF\x24\x00\x00\x00WAVEfmt \x10\x00\x00\x00\x01\x00\x01\x00"), bytes.Repeat([]byte{0}, 64)...)}, + {name: "test.m4a", data: append([]byte("\x00\x00\x00\x18ftypM4A \x00\x00\x00\x00M4A "), bytes.Repeat([]byte{0}, 64)...)}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + url, err := store.saveAudio(bytes.NewReader(tc.data), int64(len(tc.data)), tc.name) + if err != nil { + t.Fatalf("valid audio was rejected: %v", err) + } + if !strings.HasPrefix(url, "/media/audio-") { + t.Fatalf("unexpected audio URL %q", url) + } + }) + } + fake := []byte("This is not an audio file") + if _, err := store.saveAudio(bytes.NewReader(fake), int64(len(fake)), "fake.mp3"); err == nil { + t.Fatal("fake MP3 was accepted") + } +} + +func TestContactAndScheduledMediathekGuards(t *testing.T) { + raw, err := os.ReadFile("site_content.go") + if err != nil { + t.Fatal(err) + } + source := string(raw) + for _, want := range []string{ + `WHERE me.active=true AND me.published_at<=now()`, + `limiter := newWishRateLimiter()`, + `Bitte warte einen kurzen Moment`, + } { + if !strings.Contains(source, want) { + t.Fatalf("site content guard is missing %q", want) + } + } + + limiter := newWishRateLimiter() + req := httptest.NewRequest(http.MethodPost, "https://landwelle.de/kontakt", nil) + req.RemoteAddr = "192.0.2.5:12345" + if !limiter.Allow(req) { + t.Fatal("first contact request was rate-limited") + } + if limiter.Allow(req) { + t.Fatal("immediate duplicate contact request was not rate-limited") + } +} diff --git a/deploy/keyhelp-api-subdomain-https.conf b/deploy/keyhelp-api-subdomain-https.conf new file mode 100644 index 0000000..1da79aa --- /dev/null +++ b/deploy/keyhelp-api-subdomain-https.conf @@ -0,0 +1,45 @@ +# Landwelle API-Subdomain – KeyHelp „Anweisungen für HTTPS“ +# Stand: Landwelle v1.5.20 +# +# Dieses Fragment vollständig in der Subdomain api.landwelle.de in das Feld +# „Anweisungen für HTTPS“ einfügen. Bei HTTPS-Erzwingung reicht das HTTP-Feld +# allein nicht aus. + + + ProxyRequests Off + ProxyPreserveHost On + + RewriteEngine On + + # Neutrale API-Startseite. + RewriteRule ^/?$ http://127.0.0.1:2200/api/info [P,L] + + # Öffentliche Radio-App-API. Beide Varianten abdecken, damit /v1 und /v1/ + # zuverlässig funktionieren. + ProxyPass /v1/ http://127.0.0.1:2200/v1/ connectiontimeout=5 timeout=45 retry=0 + ProxyPassReverse /v1/ http://127.0.0.1:2200/v1/ + ProxyPass /v1 http://127.0.0.1:2200/v1 connectiontimeout=5 timeout=45 retry=0 + ProxyPassReverse /v1 http://127.0.0.1:2200/v1 + + # Interne Landwelle-IT-App-API. + ProxyPass /api/mobile/ http://127.0.0.1:2200/api/mobile/ connectiontimeout=5 timeout=45 retry=0 + ProxyPassReverse /api/mobile/ http://127.0.0.1:2200/api/mobile/ + ProxyPass /api/mobile http://127.0.0.1:2200/api/mobile connectiontimeout=5 timeout=45 retry=0 + ProxyPassReverse /api/mobile http://127.0.0.1:2200/api/mobile + + # Externe Dienstchecks. + ProxyPass /health http://127.0.0.1:2200/health connectiontimeout=5 timeout=10 retry=0 + ProxyPassReverse /health http://127.0.0.1:2200/health + ProxyPass /ready http://127.0.0.1:2200/ready connectiontimeout=5 timeout=10 retry=0 + ProxyPassReverse /ready http://127.0.0.1:2200/ready + + + + RequestHeader set X-Forwarded-Proto "https" + RequestHeader set X-Forwarded-Port "443" + + Header always set X-Content-Type-Options "nosniff" + Header always set Referrer-Policy "no-referrer" + Header always set X-Frame-Options "DENY" + Header always set X-Robots-Tag "noindex, nofollow, noarchive" + diff --git a/deploy/landwelle-radio.service b/deploy/landwelle-radio.service new file mode 100644 index 0000000..10b8a17 --- /dev/null +++ b/deploy/landwelle-radio.service @@ -0,0 +1,37 @@ +[Unit] +Description=Landwelle Radio Portal +Wants=network-online.target +After=network-online.target + +[Service] +Type=simple +User=landwelle +Group=landwelle +WorkingDirectory=/opt/landwelle +EnvironmentFile=/etc/landwelle/landwelle.env +Environment=LANDWELLE_STATE_DIR=/var/lib/landwelle +Environment=LANDWELLE_DOWNLOAD_DIR=/var/lib/landwelle/downloads +StateDirectory=landwelle +StateDirectoryMode=0750 +ExecStart=/opt/landwelle/landwelle-portal +Restart=always +RestartSec=5 +TimeoutStopSec=20 +KillSignal=SIGTERM +UMask=0027 +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=strict +ProtectHome=true +ProtectKernelTunables=true +ProtectKernelModules=true +ProtectControlGroups=true +LockPersonality=true +MemoryDenyWriteExecute=true +RestrictSUIDSGID=true +RestrictRealtime=true +SystemCallArchitectures=native +ReadWritePaths=/var/lib/landwelle + +[Install] +WantedBy=multi-user.target diff --git a/destination_one.go b/destination_one.go new file mode 100644 index 0000000..e6a284e --- /dev/null +++ b/destination_one.go @@ -0,0 +1,722 @@ +package main + +import ( + "context" + "encoding/json" + "errors" + "fmt" + stdhtml "html" + "io" + "log" + "net/http" + "net/url" + "regexp" + "sort" + "strconv" + "strings" + "sync" + "time" +) + +type destinationOneImporter struct { + settings *settingsStore + store *eventStore + logger *log.Logger + client *http.Client + wake, stop, done chan struct{} + once sync.Once +} + +func newDestinationOneImporter(settings *settingsStore, store *eventStore, logger *log.Logger) *destinationOneImporter { + return &destinationOneImporter{settings: settings, store: store, logger: logger, client: &http.Client{Timeout: 45 * time.Second}, wake: make(chan struct{}, 1), stop: make(chan struct{}), done: make(chan struct{})} +} +func (i *destinationOneImporter) Start() { + if i == nil || i.store == nil || i.store.db == nil || !i.store.db.Enabled() { + return + } + go func() { + defer close(i.done) + i.runOnce(context.Background()) + for { + m := i.settings.Get().DestinationOne.IntervalMinutes + if m < 15 { + m = 360 + } + t := time.NewTimer(time.Duration(m) * time.Minute) + select { + case <-t.C: + i.runOnce(context.Background()) + case <-i.wake: + if !t.Stop() { + select { + case <-t.C: + default: + } + } + i.runOnce(context.Background()) + case <-i.stop: + if !t.Stop() { + select { + case <-t.C: + default: + } + } + return + } + } + }() +} +func (i *destinationOneImporter) Wake() { + if i != nil { + select { + case i.wake <- struct{}{}: + default: + } + } +} +func (i *destinationOneImporter) Stop(ctx context.Context) { + if i == nil { + return + } + i.once.Do(func() { close(i.stop) }) + select { + case <-i.done: + case <-ctx.Done(): + } +} +func (i *destinationOneImporter) runOnce(parent context.Context) { + if !i.settings.Get().DestinationOne.Enabled { + return + } + ctx, cancel := context.WithTimeout(parent, 2*time.Minute) + defer cancel() + n, err := i.Sync(ctx) + if err != nil { + i.logger.Printf("destination.one Import: %v", err) + } else { + i.logger.Printf("destination.one Import: %d Veranstaltungen verarbeitet", n) + } +} +func (i *destinationOneImporter) Sync(ctx context.Context) (int, error) { + cfg := i.settings.Get().DestinationOne + if !cfg.Enabled { + return 0, errors.New("destination.one ist nicht aktiviert") + } + if strings.TrimSpace(cfg.APIKey) == "" { + return 0, errors.New("destination.one Lizenzschlüssel fehlt") + } + + baseURL, err := destinationOneURL(cfg) + if err != nil { + return 0, err + } + + const pageSize = 100 + const maxPages = 50 + total := 0 + seen := map[string]struct{}{} + var lastTopKeys []string + + for page := 0; page < maxPages; page++ { + u := *baseURL + q := u.Query() + q.Set("limit", strconv.Itoa(pageSize)) + q.Set("offset", strconv.Itoa(page*pageSize)) + u.RawQuery = q.Encode() + + req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil) + if err != nil { + return total, err + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", "Landwelle-Radio/1.1") + resp, err := i.client.Do(req) + if err != nil { + return total, fmt.Errorf("API-Aufruf fehlgeschlagen: %w", err) + } + body, readErr := io.ReadAll(io.LimitReader(resp.Body, 32<<20)) + resp.Body.Close() + if readErr != nil { + return total, fmt.Errorf("API-Antwort konnte nicht gelesen werden: %w", readErr) + } + if resp.StatusCode < 200 || resp.StatusCode > 299 { + preview := strings.TrimSpace(string(body)) + if len(preview) > 1200 { + preview = preview[:1200] + } + return total, fmt.Errorf("API antwortet mit %s: %s", resp.Status, preview) + } + + var payload any + if err := json.Unmarshal(body, &payload); err != nil { + preview := strings.TrimSpace(string(body)) + if len(preview) > 500 { + preview = preview[:500] + } + return total, fmt.Errorf("API liefert kein gültiges JSON. Prüfe, ob die URL das JSON-Template verwendet: %w (%s)", err, preview) + } + lastTopKeys = destinationTopKeys(payload) + items := destinationMaps(payload) + if len(items) == 0 { + if page == 0 { + return 0, fmt.Errorf("API-Verbindung funktioniert, aber der ET2014A-Parser v5 fand im Feld items keine Datensätze. Erkannte Antwortfelder: %s", strings.Join(lastTopKeys, ", ")) + } + break + } + + processedThisPage := 0 + parseErrors := map[string]int{} + for _, m := range items { + e, id, img, lic, err := parseDestinationEvent(m) + if err != nil { + parseErrors[err.Error()]++ + continue + } + if _, exists := seen[id]; exists { + continue + } + seen[id] = struct{}{} + status := "pending" + if cfg.AutoPublish { + status = "published" + } + if err = i.store.UpsertExternal(ctx, e, id, img, lic, status); err != nil { + return total, fmt.Errorf("Veranstaltung konnte nicht gespeichert werden. Wurde Migration 0014 ausgeführt? %w", err) + } + total++ + processedThisPage++ + } + if processedThisPage == 0 { + reasons := make([]string, 0, len(parseErrors)) + for reason, count := range parseErrors { + reasons = append(reasons, fmt.Sprintf("%dx %s", count, reason)) + } + sort.Strings(reasons) + if len(reasons) > 5 { + reasons = reasons[:5] + } + return total, fmt.Errorf("destination.one lieferte %d Event-Datensätze, aber keiner konnte übernommen werden. Gründe: %s", len(items), strings.Join(reasons, "; ")) + } + if len(items) < pageSize { + break + } + } + if i.store != nil && i.store.db != nil && i.store.db.Enabled() { + _, _ = i.store.db.exec(ctx, `DELETE FROM landwelle.event_submissions WHERE source_type='open_data' AND COALESCE(end_at,start_at) < now();`) + } + return total, nil +} + +func destinationOneURL(cfg DestinationOneSettings) (*url.URL, error) { + if strings.TrimSpace(cfg.APIKey) == "" { + return nil, errors.New("destination.one Lizenzschlüssel fehlt") + } + u, err := url.Parse("https://meta.et4.de/rest.ashx/search/") + if err != nil { + return nil, errors.New("destination.one API-URL ist ungültig") + } + q := u.Query() + q.Set("experience", "open-data-niedersachsen-tourismus") + q.Set("licensekey", strings.TrimSpace(cfg.APIKey)) + q.Set("type", "Event") + q.Set("template", "ET2014A.json") + u.RawQuery = q.Encode() + return u, nil +} + +func destinationTopKeys(v any) []string { + m, ok := v.(map[string]any) + if !ok { + return []string{"Antwort ist keine Objektstruktur"} + } + keys := make([]string, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + sort.Strings(keys) + if len(keys) > 12 { + keys = keys[:12] + } + return keys +} + +func destinationMaps(v any) []map[string]any { + root, ok := v.(map[string]any) + if !ok { + return nil + } + container, found := d1ValueCaseInsensitive(root, "items") + if !found { + return nil + } + out := make([]map[string]any, 0) + switch typed := container.(type) { + case []any: + for _, raw := range typed { + if item, ok := raw.(map[string]any); ok { + out = append(out, item) + } + } + case map[string]any: + if child, ok := d1ValueCaseInsensitive(typed, "item"); ok { + if list, ok := child.([]any); ok { + for _, raw := range list { + if item, ok := raw.(map[string]any); ok { + out = append(out, item) + } + } + } + } else { + out = append(out, typed) + } + } + return out +} + +func d1ValueCaseInsensitive(m map[string]any, wanted string) (any, bool) { + if value, ok := m[wanted]; ok { + return value, true + } + for key, value := range m { + if strings.EqualFold(strings.TrimSpace(key), wanted) { + return value, true + } + } + return nil, false +} + +func d1FirstStringCI(m map[string]any, keys ...string) string { + for _, key := range keys { + value, ok := d1ValueCaseInsensitive(m, key) + if !ok { + continue + } + switch typed := value.(type) { + case string: + if text := strings.TrimSpace(typed); text != "" { + return text + } + case map[string]any: + if text := d1FirstStringCI(typed, "value", "name", "title", "url", "text"); text != "" { + return text + } + } + } + return "" +} + +func parseDestinationEvent(m map[string]any) (EventSubmission, string, string, string, error) { + e := EventSubmission{ + Title: d1FirstStringCI(m, "title", "name", "headline"), + Description: d1TextByRel(m, "details", "detail", "teaser", "description", "shortdescription"), + Website: d1URL(m), + Organizer: d1NestedString(m, []string{"organizer", "author", "provider", "source", "owner"}, "name", "title", "value"), + Category: d1Category(m), + } + if e.Description == "" { + e.Description = d1FirstString(m, "description", "text", "shortDescription", "longDescription", "body") + } + e.Description = normalizeDestinationText(e.Description) + if strings.TrimSpace(e.Title) == "" { + return e, "", "", "", errors.New("Titel fehlt") + } + if e.Category == "" || strings.EqualFold(e.Category, "Event") { + e.Category = "Sonstiges" + } + id := d1FirstStringCI(m, "global_id", "globalId", "id", "identifier", "uuid") + + startValue, endValue := d1EventTimes(m) + var err error + e.StartAt, err = parseFlexTime(startValue) + if err != nil { + return e, "", "", "", fmt.Errorf("Startdatum fehlt oder ist ungültig: %w", err) + } + e.EndAt, _ = parseFlexTime(endValue) + + address := d1Address(m) + e.Venue = d1FirstString(m, "venue", "locationName", "placeName") + e.City = d1FirstString(m, "city", "locality", "town") + e.PostalCode = d1FirstString(m, "postalCode", "postal_code", "zip") + if address != nil { + if e.Venue == "" { + e.Venue = d1FirstString(address, "name", "venue", "locationName", "company") + } + if e.City == "" { + e.City = d1FirstString(address, "city", "addressLocality", "locality", "town", "municipality") + } + if e.PostalCode == "" { + e.PostalCode = d1FirstString(address, "postalCode", "zip", "postal_code") + } + } + if e.City == "" { + // ET2014A kann den Ort zusätzlich in relations/locations ablegen. + e.City = d1RecursiveStringForKeys(m, "city", "addressLocality", "locality", "town", "municipality") + } + if e.Venue == "" { + e.Venue = d1RecursiveStringForKeys(m, "venue", "locationName", "placeName") + } + if e.PostalCode == "" { + e.PostalCode = d1RecursiveStringForKeys(m, "postalCode", "postal_code", "zip") + } + if e.City == "" { + return e, "", "", "", errors.New("Ort fehlt") + } + if id == "" { + id = e.Title + "|" + e.StartAt.Format(time.RFC3339) + } + return e, id, extractImage(m), d1License(m), nil +} + +var ( + d1BreakTagPattern = regexp.MustCompile(`(?is)<\s*(?:br\s*/?|/p|/div|/li|/ul|/ol|/h[1-6]|/section|/article|/tr)\s*>`) + d1ListItemPattern = regexp.MustCompile(`(?is)<\s*li(?:\s+[^>]*)?>`) + d1BlockStartPattern = regexp.MustCompile(`(?is)<\s*(?:p|div|ul|ol|h[1-6]|section|article|tr)(?:\s+[^>]*)?>`) + d1AnyTagPattern = regexp.MustCompile(`(?is)<[^>]+>`) + d1ManySpacesPattern = regexp.MustCompile(`[\t\r ]+`) + d1ManyNewlinesPattern = regexp.MustCompile(`\n{3,}`) +) + +func normalizeDestinationText(value string) string { + value = strings.TrimSpace(value) + if value == "" { + return "" + } + value = d1BreakTagPattern.ReplaceAllString(value, "\n") + value = d1ListItemPattern.ReplaceAllString(value, "\n• ") + value = d1BlockStartPattern.ReplaceAllString(value, "\n") + value = d1AnyTagPattern.ReplaceAllString(value, "") + value = stdhtml.UnescapeString(value) + value = strings.ReplaceAll(value, "\u00a0", " ") + lines := strings.Split(value, "\n") + cleaned := make([]string, 0, len(lines)) + for _, line := range lines { + line = strings.TrimSpace(d1ManySpacesPattern.ReplaceAllString(line, " ")) + if line != "" { + cleaned = append(cleaned, line) + } + } + value = strings.Join(cleaned, "\n") + return strings.TrimSpace(d1ManyNewlinesPattern.ReplaceAllString(value, "\n\n")) +} + +func d1TextByRel(m map[string]any, rels ...string) string { + wanted := map[string]int{} + for idx, rel := range rels { + wanted[strings.ToLower(rel)] = idx + 1 + } + bestRank := 1 << 30 + best := "" + for _, key := range []string{"texts", "text", "descriptions"} { + values, ok := m[key].([]any) + if !ok { + continue + } + for _, value := range values { + entry, ok := value.(map[string]any) + if !ok { + continue + } + rel := strings.ToLower(d1FirstString(entry, "rel", "type", "name")) + rank, found := wanted[rel] + if !found { + continue + } + text := d1FirstString(entry, "value", "text", "content") + if text != "" && rank < bestRank { + best, bestRank = text, rank + } + } + } + return best +} + +func d1Category(m map[string]any) string { + if value := d1FirstString(m, "category", "classification"); value != "" { + return value + } + for _, key := range []string{"categories", "classifications"} { + values, ok := m[key].([]any) + if !ok { + continue + } + for _, value := range values { + switch v := value.(type) { + case string: + if strings.TrimSpace(v) != "" { + return strings.TrimSpace(v) + } + case map[string]any: + if category := d1FirstString(v, "name", "title", "value", "label"); category != "" { + return category + } + } + } + } + return "" +} + +func d1EventTimes(m map[string]any) (any, any) { + for _, key := range []string{"timeIntervals", "timeintervals", "time_intervals", "dates", "dateIntervals", "occurrences", "schedules"} { + if values, ok := m[key].([]any); ok && len(values) > 0 { + for _, value := range values { + if entry, ok := value.(map[string]any); ok { + start := d1FirstAny(entry, "start", "startDate", "start_date", "begin", "from", "date") + end := d1FirstAny(entry, "end", "endDate", "end_date", "until", "to") + if start != nil { + return start, end + } + } + } + } + if entry, ok := m[key].(map[string]any); ok { + start := d1FirstAny(entry, "start", "startDate", "start_date", "begin", "from", "date") + end := d1FirstAny(entry, "end", "endDate", "end_date", "until", "to") + if start != nil { + return start, end + } + } + } + start := d1FirstAny(m, "start", "startDate", "start_date", "begin", "from", "date") + end := d1FirstAny(m, "end", "endDate", "end_date", "until", "to") + if start != nil { + return start, end + } + return d1RecursiveDate(m, true), d1RecursiveDate(m, false) +} + +func d1RecursiveDate(v any, start bool) any { + keys := map[string]bool{} + if start { + for _, key := range []string{"start", "startdate", "start_date", "begin", "from", "datefrom"} { + keys[key] = true + } + } else { + for _, key := range []string{"end", "enddate", "end_date", "until", "to", "dateto"} { + keys[key] = true + } + } + var walk func(any) any + walk = func(value any) any { + switch typed := value.(type) { + case map[string]any: + for key, child := range typed { + if keys[strings.ToLower(key)] { + if _, err := parseFlexTime(child); err == nil { + return child + } + } + } + for _, child := range typed { + if found := walk(child); found != nil { + return found + } + } + case []any: + for _, child := range typed { + if found := walk(child); found != nil { + return found + } + } + } + return nil + } + return walk(v) +} + +func d1Address(m map[string]any) map[string]any { + for _, key := range []string{"address", "location", "place", "venue"} { + if address, ok := m[key].(map[string]any); ok { + return address + } + if values, ok := m[key].([]any); ok { + for _, value := range values { + if address, ok := value.(map[string]any); ok { + return address + } + } + } + } + return nil +} + +func d1URL(m map[string]any) string { + if value := d1FirstString(m, "url", "website", "web", "link"); strings.HasPrefix(value, "http") { + return value + } + for _, key := range []string{"links", "urls", "websites"} { + if values, ok := m[key].([]any); ok { + for _, value := range values { + if entry, ok := value.(map[string]any); ok { + candidate := d1FirstString(entry, "url", "href", "value", "link") + if strings.HasPrefix(candidate, "http") { + return candidate + } + } + } + } + } + return "" +} + +func d1License(m map[string]any) string { + if value := d1FirstString(m, "license", "licence", "copyright", "attribution"); value != "" { + return value + } + for _, key := range []string{"licenses", "licences", "rights"} { + if values, ok := m[key].([]any); ok { + parts := make([]string, 0, len(values)) + for _, value := range values { + switch typed := value.(type) { + case string: + parts = append(parts, strings.TrimSpace(typed)) + case map[string]any: + if text := d1FirstString(typed, "name", "title", "value", "url", "identifier"); text != "" { + parts = append(parts, text) + } + } + } + return strings.Join(parts, " · ") + } + } + return "" +} + +func d1NestedString(m map[string]any, keys []string, nested ...string) string { + for _, key := range keys { + if value := d1FirstString(m, key); value != "" { + return value + } + if entry, ok := m[key].(map[string]any); ok { + if value := d1FirstString(entry, nested...); value != "" { + return value + } + } + } + return "" +} + +func d1RecursiveStringForKeys(v any, keys ...string) string { + wanted := map[string]bool{} + for _, key := range keys { + wanted[strings.ToLower(key)] = true + } + var walk func(any) string + walk = func(value any) string { + switch typed := value.(type) { + case map[string]any: + for key, child := range typed { + if wanted[strings.ToLower(key)] { + if text, ok := child.(string); ok && strings.TrimSpace(text) != "" { + return strings.TrimSpace(text) + } + } + } + for _, child := range typed { + if found := walk(child); found != "" { + return found + } + } + case []any: + for _, child := range typed { + if found := walk(child); found != "" { + return found + } + } + } + return "" + } + return walk(v) +} + +func (s *eventStore) UpsertExternal(ctx context.Context, e EventSubmission, id, img, lic, status string) error { + end := "NULL" + if !e.EndAt.IsZero() { + end = sqlText(e.EndAt.UTC().Format(time.RFC3339)) + "::timestamptz" + } + q := `INSERT INTO landwelle.event_submissions(title,category,start_at,end_at,venue,city,postal_code,organizer,contact_name,contact_email,description,website,status,source_type,source_name,source_url,external_id,external_image_url,license_text) VALUES (` + sqlText(e.Title) + `,` + sqlText(e.Category) + `,` + sqlText(e.StartAt.UTC().Format(time.RFC3339)) + `::timestamptz,` + end + `,` + sqlText(e.Venue) + `,` + sqlText(e.City) + `,` + sqlText(e.PostalCode) + `,` + sqlText(e.Organizer) + `,'destination.one','',` + sqlText(e.Description) + `,` + sqlText(e.Website) + `,` + sqlText(status) + `,'open_data','Niedersachsen Hub / destination.one',` + sqlText(e.Website) + `,` + sqlText(id) + `,` + sqlText(img) + `,` + sqlText(lic) + `) ON CONFLICT(source_name,external_id) WHERE external_id<>'' DO UPDATE SET title=excluded.title,category=excluded.category,start_at=excluded.start_at,end_at=excluded.end_at,venue=excluded.venue,city=excluded.city,postal_code=excluded.postal_code,organizer=excluded.organizer,description=excluded.description,website=excluded.website,external_image_url=excluded.external_image_url,license_text=excluded.license_text,updated_at=now();` + _, err := s.db.exec(ctx, q) + return err +} +func d1FirstString(m map[string]any, ks ...string) string { + for _, k := range ks { + if v, ok := m[k]; ok { + if s, ok := v.(string); ok && strings.TrimSpace(s) != "" { + return strings.TrimSpace(s) + } + if mm, ok := v.(map[string]any); ok { + if s := d1FirstString(mm, "value", "name", "title", "url", "text"); s != "" { + return s + } + } + } + } + return "" +} +func d1FirstAny(m map[string]any, ks ...string) any { + for _, k := range ks { + if v, ok := m[k]; ok { + return v + } + } + return nil +} +func d1FirstMap(m map[string]any, ks ...string) map[string]any { + for _, k := range ks { + if v, ok := m[k].(map[string]any); ok { + return v + } + } + return nil +} +func parseFlexTime(v any) (time.Time, error) { + s, ok := v.(string) + if !ok || strings.TrimSpace(s) == "" { + return time.Time{}, errors.New("Datum fehlt") + } + for _, l := range []string{time.RFC3339Nano, time.RFC3339, "2006-01-02T15:04:05", "2006-01-02T15:04", "2006-01-02", "02.01.2006 15:04", "02.01.2006"} { + if t, e := time.ParseInLocation(l, s, time.Local); e == nil { + return t, nil + } + } + return time.Time{}, errors.New("Datum ungültig") +} +func extractImage(m map[string]any) string { + if s := d1FirstString(m, "image", "image_url", "imageUrl", "thumbnail", "photo"); strings.HasPrefix(s, "http") { + return s + } + + // ET2014A liefert Bilder im Feld media_objects. Bevorzugt wird das + // als Standardbild markierte Medium, danach das erste echte Bild. + for _, key := range []string{"media_objects", "mediaObjects", "images", "media", "photos"} { + values, ok := m[key].([]any) + if !ok { + continue + } + var fallback string + for _, value := range values { + medium, ok := value.(map[string]any) + if !ok { + continue + } + candidate := d1FirstString(medium, "url", "src", "imageUrl") + if !strings.HasPrefix(candidate, "http://") && !strings.HasPrefix(candidate, "https://") { + continue + } + mediaType := strings.ToLower(d1FirstString(medium, "type", "mime_type", "mimeType")) + if mediaType != "" && !strings.HasPrefix(mediaType, "image/") { + continue + } + rel := strings.ToLower(d1FirstString(medium, "rel", "relation")) + if rel == "default" || rel == "primary" || rel == "main" || rel == "hero" { + return candidate + } + if fallback == "" && (rel == "imagegallery" || rel == "gallery" || rel == "") { + fallback = candidate + } + } + if fallback != "" { + return fallback + } + } + return "" +} diff --git a/destination_one_test.go b/destination_one_test.go new file mode 100644 index 0000000..24df68e --- /dev/null +++ b/destination_one_test.go @@ -0,0 +1,183 @@ +package main + +import ( + "testing" +) + +func TestDestinationOneURLUsesFixedNiedersachsenHubRequest(t *testing.T) { + cfg := DestinationOneSettings{APIKey: "secret"} + u, err := destinationOneURL(cfg) + if err != nil { + t.Fatal(err) + } + want := "https://meta.et4.de/rest.ashx/search/?experience=open-data-niedersachsen-tourismus&licensekey=secret&template=ET2014A.json&type=Event" + if u.String() != want { + t.Fatalf("unerwartete URL: %s", u.String()) + } +} + +func TestParseDestinationEventET2014A(t *testing.T) { + item := map[string]any{ + "global_id": "e_101284067", + "id": "101284067", + "title": "Führung auf der Elbinsel Lühesand", + "type": "Event", + "categories": []any{ + "Tradition, Brauchtum, Volksfest sonstige", + }, + "texts": []any{ + map[string]any{"rel": "details", "type": "text/html", "value": "Natur und Erlebnisführung auf der Elbinsel Lühesand."}, + map[string]any{"rel": "teaser", "type": "text/plain", "value": "Kurze Führung."}, + }, + "timeIntervals": []any{ + map[string]any{"start": "2026-08-12T10:00:00+02:00", "end": "2026-08-12T12:00:00+02:00"}, + }, + "address": map[string]any{ + "name": "Anleger Lühesand", + "city": "Grünendeich", + "postalCode": "21720", + }, + } + event, id, _, _, err := parseDestinationEvent(item) + if err != nil { + t.Fatal(err) + } + if id != "e_101284067" { + t.Fatalf("id=%q", id) + } + if event.Title != "Führung auf der Elbinsel Lühesand" { + t.Fatalf("title=%q", event.Title) + } + if event.Description != "Natur und Erlebnisführung auf der Elbinsel Lühesand." { + t.Fatalf("description=%q", event.Description) + } + if event.City != "Grünendeich" || event.PostalCode != "21720" { + t.Fatalf("address=%q %q", event.PostalCode, event.City) + } + if event.StartAt.IsZero() || event.EndAt.IsZero() { + t.Fatal("time interval not parsed") + } +} + +func TestDestinationMapsAcceptsET2014AItemsWithoutTopLevelStart(t *testing.T) { + payload := map[string]any{ + "status": "OK", + "count": 1.0, + "items": []any{ + map[string]any{"global_id": "e_1", "title": "Dorffest", "type": "Event", "timeIntervals": []any{map[string]any{"start": "2026-09-01T12:00:00+02:00"}}}, + }, + } + items := destinationMaps(payload) + if len(items) != 1 { + t.Fatalf("items=%d", len(items)) + } +} + +func TestDestinationMapsDoesNotDiscardET2014AItemsBeforeParsing(t *testing.T) { + payload := map[string]any{ + "status": "OK", + "count": 2.0, + "items": []any{ + map[string]any{"global_id": "e_101", "title": "Führung", "type": "Event"}, + map[string]any{"GLOBAL_ID": "e_102", "TITLE": "Flohmarkt", "TYPE": "Event"}, + }, + } + items := destinationMaps(payload) + if len(items) != 2 { + t.Fatalf("items=%d, want 2", len(items)) + } +} + +func TestDestinationMapsAcceptsNestedItemsContainer(t *testing.T) { + payload := map[string]any{ + "status": "OK", + "items": map[string]any{ + "item": []any{map[string]any{"id": "1", "title": "Treffen"}}, + }, + } + items := destinationMaps(payload) + if len(items) != 1 { + t.Fatalf("items=%d, want 1", len(items)) + } +} + +func TestDestinationMapsAcceptsAnyObjectInsideItems(t *testing.T) { + payload := map[string]any{ + "status": "OK", + "items": []any{ + map[string]any{"id": float64(101284067), "global_id": "e_101284067", "title": "Führung auf der Elbinsel"}, + }, + } + items := destinationMaps(payload) + if len(items) != 1 { + t.Fatalf("items=%d, want 1", len(items)) + } +} + +func TestDestinationMapsKeepsEventWithFeaturesField(t *testing.T) { + payload := map[string]any{"items": []any{map[string]any{ + "global_id": "e_101284067", + "title": "Führung auf der Elbinsel Lühesand", + "features": []any{map[string]any{"name": "barrierefrei"}}, + }}} + items := destinationMaps(payload) + if len(items) != 1 { + t.Fatalf("erwartet 1 Event, erhalten %d", len(items)) + } + if items[0]["title"] != "Führung auf der Elbinsel Lühesand" { + t.Fatalf("Event wurde falsch gelesen: %#v", items[0]) + } +} + +func TestExtractImageFromET2014AMediaObjects(t *testing.T) { + event := map[string]any{ + "media_objects": []any{ + map[string]any{"rel": "venuewebsite", "url": "https://example.org/venue"}, + map[string]any{"rel": "imagegallery", "url": "https://dam.destination.one/gallery.jpg", "type": "image/jpeg"}, + map[string]any{"rel": "default", "url": "https://dam.destination.one/default.jpg", "type": "image/jpeg"}, + }, + } + got := extractImage(event) + if got != "https://dam.destination.one/default.jpg" { + t.Fatalf("unexpected image URL: %q", got) + } +} + +func TestExtractImageFallsBackToGallery(t *testing.T) { + event := map[string]any{ + "media_objects": []any{ + map[string]any{"rel": "canonical", "url": "https://example.org/event"}, + map[string]any{"rel": "imagegallery", "url": "https://dam.destination.one/gallery.png", "type": "image/png"}, + }, + } + got := extractImage(event) + if got != "https://dam.destination.one/gallery.png" { + t.Fatalf("unexpected image URL: %q", got) + } +} + +func TestNormalizeDestinationTextConvertsHTMLToReadableText(t *testing.T) { + input := `

Erster Absatz & mehr.

Zweiter Absatz
mit Zeile.

  • Punkt eins
  • Punkt zwei
` + got := normalizeDestinationText(input) + want := "Erster Absatz & mehr.\nZweiter Absatz\nmit Zeile.\n• Punkt eins\n• Punkt zwei" + if got != want { + t.Fatalf("got %q, want %q", got, want) + } +} + +func TestParseDestinationEventNormalizesHTMLDescription(t *testing.T) { + item := map[string]any{ + "global_id": "e_html", + "title": "Dorffest", + "city": "Visselhövede", + "texts": []any{map[string]any{"rel": "details", "type": "text/html", "value": `

Musik & Markt

Eintritt frei

`}}, + "timeIntervals": []any{map[string]any{"start": "2026-09-01T12:00:00+02:00"}}, + } + event, _, _, _, err := parseDestinationEvent(item) + if err != nil { + t.Fatal(err) + } + if event.Description != "Musik & Markt\nEintritt frei" { + t.Fatalf("description=%q", event.Description) + } +} diff --git a/directory.go b/directory.go new file mode 100644 index 0000000..2395b19 --- /dev/null +++ b/directory.go @@ -0,0 +1,425 @@ +package main + +import ( + "context" + "errors" + "html/template" + "log" + "net/http" + "net/mail" + "net/url" + "strconv" + "strings" + "time" +) + +type DirectoryEntry struct { + ID int64 `json:"id"` + RequestToken string `json:"request_token,omitempty"` + Name string `json:"name"` + Category string `json:"category"` + Description string `json:"description"` + City string `json:"city"` + PostalCode string `json:"postal_code"` + Address string `json:"address"` + Phone string `json:"phone"` + Email string `json:"email"` + Website string `json:"website"` + ContactName string `json:"contact_name"` + OpeningHours string `json:"opening_hours"` + PartnershipInterest bool `json:"partnership_interest"` + Status string `json:"status"` + CreatedAt time.Time `json:"created_at"` +} + +type DirectoryPageLink struct { + Number int + URL string + Current bool + Ellipsis bool +} + +type DirectoryPageData struct { + PageData + Entries []DirectoryEntry + Categories []string + Selected string + Query string + Success bool + EntryID int64 + Error string + Submission DirectoryEntry + RequestToken string + CurrentPage int + TotalPages int + TotalEntries int + PageLinks []DirectoryPageLink + PreviousURL string + NextURL string +} + +type directoryStore struct{ db *postgresStore } + +func newDirectoryStore(db *postgresStore) *directoryStore { return &directoryStore{db: db} } + +func directoryCategories() []string { + return []string{ + "Firmen & Handwerk", "Vereine & Initiativen", "Gastronomie", "Hotels & Pensionen", "Ferienwohnungen & Urlaub", + "Musiker, DJs & Bands", "Landwirtschaft & Hofläden", "Handel & Dienstleistungen", "Freizeit & Tourismus", "Gesundheit & Pflege", "Sonstiges", + } +} + +func validDirectoryCategory(category string) bool { + for _, allowed := range directoryCategories() { + if category == allowed { + return true + } + } + return false +} + +func (s *directoryStore) ListPublished(ctx context.Context, category, query string, limit, offset int) ([]DirectoryEntry, int, error) { + if s == nil || s.db == nil || !s.db.Enabled() { + return nil, 0, nil + } + if limit <= 0 || limit > 100 { + limit = 12 + } + if offset < 0 { + offset = 0 + } + where := "status='published'" + if strings.TrimSpace(category) != "" { + where += " AND category=" + sqlText(strings.TrimSpace(category)) + } + if q := strings.TrimSpace(query); q != "" { + pattern := "%" + q + "%" + where += ` AND (name ILIKE ` + sqlText(pattern) + ` OR description ILIKE ` + sqlText(pattern) + ` OR city ILIKE ` + sqlText(pattern) + ` OR postal_code ILIKE ` + sqlText(pattern) + ` OR category ILIKE ` + sqlText(pattern) + `)` + } + sql := `SELECT json_build_object( +'items',COALESCE((SELECT json_agg(row_to_json(x)) FROM ( + SELECT id,name,category,description,city,postal_code,address,phone,email,website,contact_name,opening_hours,partnership_interest,status,created_at + FROM landwelle.directory_entries WHERE ` + where + ` ORDER BY category,name LIMIT ` + strconv.Itoa(limit) + ` OFFSET ` + strconv.Itoa(offset) + ` +) x),'[]'::json), +'total',(SELECT count(*) FROM landwelle.directory_entries WHERE ` + where + `) +)::text;` + var result struct { + Items []DirectoryEntry `json:"items"` + Total int `json:"total"` + } + if err := s.db.queryJSON(ctx, sql, &result); err != nil { + return nil, 0, err + } + return result.Items, result.Total, nil +} + +func (s *directoryStore) SaveSubmission(ctx context.Context, entry DirectoryEntry) (int64, bool, error) { + if s == nil || s.db == nil || !s.db.Enabled() { + return 0, false, errors.New("Das Branchenbuch ist derzeit nicht verfügbar") + } + q := `WITH inserted AS ( +INSERT INTO landwelle.directory_entries(request_token,name,category,description,city,postal_code,address,phone,email,website,contact_name,opening_hours,partnership_interest) +VALUES (` + sqlText(entry.RequestToken) + `,` + sqlText(entry.Name) + `,` + sqlText(entry.Category) + `,` + sqlText(entry.Description) + `,` + sqlText(entry.City) + `,` + sqlText(entry.PostalCode) + `,` + sqlText(entry.Address) + `,` + sqlText(entry.Phone) + `,` + sqlText(entry.Email) + `,` + sqlText(entry.Website) + `,` + sqlText(entry.ContactName) + `,` + sqlText(entry.OpeningHours) + `,` + sqlBool(entry.PartnershipInterest) + `) +ON CONFLICT(request_token) DO NOTHING RETURNING id) +SELECT COALESCE(json_agg(json_build_object('id',id)),'[]'::json)::text FROM inserted;` + var rows []struct { + ID int64 `json:"id"` + } + if err := s.db.queryJSON(ctx, q, &rows); err != nil { + return 0, false, err + } + if len(rows) > 0 { + return rows[0].ID, true, nil + } + var existing []struct { + ID int64 `json:"id"` + } + if err := s.db.queryJSON(ctx, `SELECT COALESCE(json_agg(json_build_object('id',id)),'[]'::json)::text FROM landwelle.directory_entries WHERE request_token=`+sqlText(entry.RequestToken)+` LIMIT 1;`, &existing); err != nil { + return 0, false, err + } + if len(existing) == 0 { + return 0, false, errors.New("Eintrag konnte nicht gespeichert werden") + } + return existing[0].ID, false, nil +} + +func (s *directoryStore) ListAdmin(ctx context.Context, status string) ([]DirectoryEntry, error) { + if s == nil || s.db == nil || !s.db.Enabled() { + return nil, errors.New("PostgreSQL ist nicht verfügbar") + } + where := "true" + if status != "" && status != "all" { + where = "status=" + sqlText(status) + } + q := `SELECT COALESCE(json_agg(json_build_object( +'id',id,'name',name,'category',category,'description',description,'city',city,'postal_code',postal_code,'address',address, +'phone',phone,'email',email,'website',website,'contact_name',contact_name,'opening_hours',opening_hours,'partnership_interest',partnership_interest,'status',status,'created_at',created_at +) ORDER BY CASE status WHEN 'pending' THEN 0 WHEN 'published' THEN 1 ELSE 2 END, created_at DESC),'[]'::json)::text +FROM landwelle.directory_entries WHERE ` + where + ` LIMIT 300;` + var out []DirectoryEntry + if err := s.db.queryJSON(ctx, q, &out); err != nil { + return nil, err + } + return out, nil +} + +func (s *directoryStore) Update(ctx context.Context, entry DirectoryEntry) error { + if entry.ID <= 0 { + return errors.New("Ungültiger Eintrag") + } + if s == nil || s.db == nil || !s.db.Enabled() { + return errors.New("PostgreSQL ist nicht verfügbar") + } + q := `UPDATE landwelle.directory_entries SET name=` + sqlText(entry.Name) + `,category=` + sqlText(entry.Category) + `,description=` + sqlText(entry.Description) + `,city=` + sqlText(entry.City) + `,postal_code=` + sqlText(entry.PostalCode) + `,address=` + sqlText(entry.Address) + `,phone=` + sqlText(entry.Phone) + `,email=` + sqlText(entry.Email) + `,website=` + sqlText(entry.Website) + `,contact_name=` + sqlText(entry.ContactName) + `,opening_hours=` + sqlText(entry.OpeningHours) + `,partnership_interest=` + sqlBool(entry.PartnershipInterest) + `,updated_at=now() WHERE id=` + strconv.FormatInt(entry.ID, 10) + `;` + _, err := s.db.exec(ctx, q) + return err +} + +func (s *directoryStore) SetStatus(ctx context.Context, id int64, status string) error { + if id <= 0 || (status != "pending" && status != "published" && status != "rejected" && status != "archived") { + return errors.New("Ungültiger Status") + } + _, err := s.db.exec(ctx, `UPDATE landwelle.directory_entries SET status=`+sqlText(status)+`,updated_at=now() WHERE id=`+strconv.FormatInt(id, 10)+`;`) + return err +} + +func (s *directoryStore) Delete(ctx context.Context, id int64) error { + if id <= 0 { + return errors.New("Ungültiger Eintrag") + } + _, err := s.db.exec(ctx, `DELETE FROM landwelle.directory_entries WHERE id=`+strconv.FormatInt(id, 10)+`;`) + return err +} + +type directoryWorkflow struct { + settings *settingsStore + templates *emailTemplateStore +} + +func newDirectoryWorkflow(settings *settingsStore, templates *emailTemplateStore) *directoryWorkflow { + return &directoryWorkflow{settings: settings, templates: templates} +} + +func (w *directoryWorkflow) Notify(ctx context.Context, entry DirectoryEntry) error { + if w == nil || w.settings == nil || w.templates == nil { + return nil + } + cfg := w.settings.Get().SMTP + if !cfg.Enabled { + return nil + } + base := strings.TrimRight(envOr("LANDWELLE_PUBLIC_URL", "https://landwelle.de"), "/") + vars := map[string]string{ + "entry_id": strconv.FormatInt(entry.ID, 10), "name": entry.Name, "category": entry.Category, "description": entry.Description, + "city": entry.City, "postal_code": entry.PostalCode, "address": entry.Address, "phone": entry.Phone, "email": entry.Email, + "website": entry.Website, "contact_name": entry.ContactName, "opening_hours": entry.OpeningHours, "partnership_interest": strconv.FormatBool(entry.PartnershipInterest), + "logo_url": base + "/assets/landwelle-logo-trim.png", + } + var errs []string + if tpl, ok := w.templates.Get("directory_submission_admin"); ok && tpl.Enabled { + if err := sendTemplateMail(ctx, cfg, "radio@landwelle.de", tpl, vars); err != nil { + errs = append(errs, "Redaktionsmail: "+err.Error()) + } + } + if tpl, ok := w.templates.Get("directory_submission_confirmation"); ok && tpl.Enabled { + if err := sendTemplateMail(ctx, cfg, entry.Email, tpl, vars); err != nil { + errs = append(errs, "Bestätigungsmail: "+err.Error()) + } + } + if entry.PartnershipInterest { + if tpl, ok := w.templates.Get("directory_partnership_admin"); ok && tpl.Enabled { + if err := sendTemplateMail(ctx, cfg, "radio@landwelle.de", tpl, vars); err != nil { + errs = append(errs, "Partnerschaftsmail: "+err.Error()) + } + } + } + if len(errs) > 0 { + return errors.New(strings.Join(errs, "; ")) + } + return nil +} + +func directoryPageHandler(t *template.Template, logger *log.Logger, data PageData, store *directoryStore, workflow *directoryWorkflow) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/branchenbuch" { + http.NotFound(w, r) + return + } + if r.Method == http.MethodPost { + handleDirectorySubmission(w, r, t, logger, data, store, workflow) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", "GET, HEAD, POST") + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + category := strings.TrimSpace(r.URL.Query().Get("kategorie")) + query := strings.TrimSpace(r.URL.Query().Get("suche")) + page := 1 + if value, err := strconv.Atoi(r.URL.Query().Get("seite")); err == nil && value > 0 { + page = value + } + const pageSize = 12 + entries, total, err := store.ListPublished(r.Context(), category, query, pageSize, (page-1)*pageSize) + if err != nil { + logger.Printf("branchenbuch laden: %v", err) + } + totalPages := (total + pageSize - 1) / pageSize + if totalPages < 1 { + totalPages = 1 + } + if page > totalPages { + page = totalPages + entries, total, _ = store.ListPublished(r.Context(), category, query, pageSize, (page-1)*pageSize) + } + pageURL := func(target int) string { + values := url.Values{} + if category != "" { + values.Set("kategorie", category) + } + if query != "" { + values.Set("suche", query) + } + if target > 1 { + values.Set("seite", strconv.Itoa(target)) + } + if encoded := values.Encode(); encoded != "" { + return "/branchenbuch?" + encoded + "#eintraege" + } + return "/branchenbuch#eintraege" + } + token, _ := randomToken(24) + payload := DirectoryPageData{PageData: data, Entries: entries, Categories: directoryCategories(), Selected: category, Query: query, Success: r.URL.Query().Get("eingesendet") == "1", RequestToken: token, CurrentPage: page, TotalPages: totalPages, TotalEntries: total} + if id, _ := strconv.ParseInt(r.URL.Query().Get("id"), 10, 64); id > 0 { + payload.EntryID = id + } + payload.PageLinks = compactDirectoryPageLinks(page, totalPages, pageURL) + if page > 1 { + payload.PreviousURL = pageURL(page - 1) + } + if page < totalPages { + payload.NextURL = pageURL(page + 1) + } + renderDirectoryPage(w, r, t, logger, payload) + } +} + +func handleDirectorySubmission(w http.ResponseWriter, r *http.Request, t *template.Template, logger *log.Logger, data PageData, store *directoryStore, workflow *directoryWorkflow) { + r.Body = http.MaxBytesReader(w, r.Body, 256<<10) + if err := r.ParseForm(); err != nil { + renderDirectoryPage(w, r, t, logger, DirectoryPageData{PageData: data, Categories: directoryCategories(), Error: "Das Formular konnte nicht gelesen werden."}) + return + } + if strings.TrimSpace(r.FormValue("office_fax_extra")) != "" { + http.Redirect(w, r, "/branchenbuch?eingesendet=1", http.StatusSeeOther) + return + } + entry := DirectoryEntry{ + RequestToken: strings.TrimSpace(r.FormValue("request_token")), Name: strings.TrimSpace(r.FormValue("name")), Category: strings.TrimSpace(r.FormValue("category")), + Description: strings.TrimSpace(r.FormValue("description")), City: strings.TrimSpace(r.FormValue("city")), PostalCode: strings.TrimSpace(r.FormValue("postal_code")), + Address: strings.TrimSpace(r.FormValue("address")), Phone: strings.TrimSpace(r.FormValue("phone")), Email: strings.TrimSpace(r.FormValue("email")), + Website: strings.TrimSpace(r.FormValue("website")), ContactName: strings.TrimSpace(r.FormValue("contact_name")), OpeningHours: strings.TrimSpace(r.FormValue("opening_hours")), PartnershipInterest: r.FormValue("partnership_interest") != "", + } + if err := validateDirectoryEntry(entry); err != nil { + renderDirectoryPage(w, r, t, logger, DirectoryPageData{PageData: data, Categories: directoryCategories(), Submission: entry, RequestToken: entry.RequestToken, Error: err.Error()}) + return + } + ctx, cancel := context.WithTimeout(r.Context(), 12*time.Second) + defer cancel() + id, inserted, err := store.SaveSubmission(ctx, entry) + if err != nil { + logger.Printf("branchenbuch speichern: %v", err) + renderDirectoryPage(w, r, t, logger, DirectoryPageData{PageData: data, Categories: directoryCategories(), Submission: entry, RequestToken: entry.RequestToken, Error: "Der Eintrag konnte nicht gespeichert werden. Bitte versuche es später erneut."}) + return + } + entry.ID = id + if inserted { + go func(item DirectoryEntry) { + mailCtx, mailCancel := context.WithTimeout(context.Background(), 30*time.Second) + defer mailCancel() + if err := workflow.Notify(mailCtx, item); err != nil { + logger.Printf("branchenbuch e-mail id=%d: %v", item.ID, err) + } + }(entry) + } + http.Redirect(w, r, "/branchenbuch?eingesendet=1&id="+strconv.FormatInt(id, 10), http.StatusSeeOther) +} + +func validateDirectoryEntry(entry DirectoryEntry) error { + if len(entry.RequestToken) < 20 || len(entry.RequestToken) > 160 { + return errors.New("Die Formularsitzung ist abgelaufen. Bitte lade die Seite neu.") + } + if entry.Name == "" || entry.Category == "" || entry.Description == "" || entry.City == "" || entry.ContactName == "" || entry.Email == "" { + return errors.New("Name, Kategorie, Beschreibung, Ort, Kontaktname und E-Mail-Adresse werden benötigt.") + } + if !validDirectoryCategory(entry.Category) { + return errors.New("Bitte wähle eine gültige Kategorie aus.") + } + if _, err := mail.ParseAddress(entry.Email); err != nil { + return errors.New("Bitte gib eine gültige E-Mail-Adresse ein.") + } + if entry.Website != "" { + u, err := url.Parse(entry.Website) + if err != nil || (u.Scheme != "https" && u.Scheme != "http") || u.Host == "" { + return errors.New("Bitte gib eine vollständige Webseite mit https:// ein.") + } + } + if len([]rune(entry.Description)) > 4000 { + return errors.New("Die Beschreibung darf höchstens 4000 Zeichen enthalten.") + } + return nil +} + +func renderDirectoryPage(w http.ResponseWriter, r *http.Request, t *template.Template, logger *log.Logger, payload DirectoryPageData) { + if payload.RequestToken == "" { + payload.RequestToken, _ = randomToken(24) + } + w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.Header().Set("Cache-Control", "no-store") + if r.Method == http.MethodHead { + w.WriteHeader(http.StatusOK) + return + } + if err := t.ExecuteTemplate(w, "directory.html", payload); err != nil { + logger.Printf("branchenbuch template: %v", err) + } +} + +func directorySearchAPI(store *directoryStore) http.HandlerFunc { + return getOnly(func(w http.ResponseWriter, r *http.Request) { + query := strings.TrimSpace(r.URL.Query().Get("q")) + category := strings.TrimSpace(r.URL.Query().Get("category")) + items, total, err := store.ListPublished(r.Context(), category, query, 60, 0) + if err != nil { + writeAPIError(w, http.StatusInternalServerError, "directory_unavailable", "Das Branchenbuch konnte nicht durchsucht werden.") + return + } + writeJSON(w, http.StatusOK, apiEnvelope{Data: items, Meta: map[string]any{"count": len(items), "total": total, "query": query, "category": category}}) + }) +} + +func compactDirectoryPageLinks(current, total int, pageURL func(int) string) []DirectoryPageLink { + if total <= 1 { + return nil + } + wanted := map[int]bool{1: true, total: true} + for n := current - 2; n <= current+2; n++ { + if n >= 1 && n <= total { + wanted[n] = true + } + } + out := make([]DirectoryPageLink, 0, 9) + previous := 0 + for n := 1; n <= total; n++ { + if !wanted[n] { + continue + } + if previous > 0 && n-previous > 1 { + out = append(out, DirectoryPageLink{Ellipsis: true}) + } + out = append(out, DirectoryPageLink{Number: n, URL: pageURL(n), Current: n == current}) + previous = n + } + return out +} diff --git a/docs/ADMINBEREICH.md b/docs/ADMINBEREICH.md new file mode 100644 index 0000000..40b56f4 --- /dev/null +++ b/docs/ADMINBEREICH.md @@ -0,0 +1,123 @@ +# Landwelle-Adminbereich + +**Stand: Landwelle v1.5.26** + +Der Adminbereich ist unter `/admin` erreichbar. Ohne konfiguriertes Administratorkonto bleibt er gesperrt. Navigation, Rechteprüfung, CSRF-Schutz und Audit gelten für alle schreibenden Verwaltungsfunktionen. + +## Navigation + +Die linke Sidebar erkennt die aktuelle Route, öffnet die zuständige Kategorie und markiert den aktiven Menüpunkt mit `aria-current="page"`. Sie ist fachlich gegliedert in: + +- Inhalte & Sendeplanung +- Hörer & Community +- KI & Automatisierung +- Apps & Veröffentlichung +- Benutzer & Rechte +- System & Betrieb + +Die konkrete Navigation wird zentral erzeugt. Admin-Templates dürfen keine abweichenden eigenen Menüstrukturen pflegen. + +## Zentrale Verwaltungsbereiche + +### Inhalte und Sendeplanung + +- Programm unter `/admin/program` +- Team unter `/admin/team` +- Mediengalerie unter `/admin/media` +- Redaktion, Inhalte und Kategorien unter `/admin/editorial` +- Veranstaltungen und destination.one +- öffentliche Navigation unter `/admin/navigation` +- Presse, Karriere, FAQ und Kontaktinhalte +- Mediathek unter `/admin/mediathek` + +### Hörer und Community + +- Zuhörer-, docX-, Schlager- und Jahrescharts +- Forum, Kategorien, Themen und Moderation +- Kontaktanfragen +- Branchenbuchmoderation +- Aufgaben und Status unter `/admin/todos` + +### KI und Automatisierung + +- Nachrichten Welt unter `/admin/ai/news` +- Nachrichten Lokal unter `/admin/ai/news-local` +- automatische Aufgaben +- weitere redaktionelle KI-Module + +### Benutzer und Betrieb + +- Benutzer, Rollen und Berechtigungen +- E-Mail-Vorlagen +- Audit unter `/admin/audit` +- Reichweitenstatistik unter `/admin/statistik` +- Einstellungen, Downloads und technische Statusbereiche + +## Programmverwaltung + +Sendungen können angelegt, bearbeitet, aktiviert, gelöscht und mit Teammitgliedern verknüpft werden. Konflikte bei überschneidenden Zeiten werden geprüft, einschließlich Sendungen über Mitternacht. + +Bei aktivem PostgreSQL werden Programmdaten aus `landwelle.program_slots` geladen und dort gespeichert. Ohne Datenbank greift für Entwicklung und Fallback die atomar geschriebene Datei `LANDWELLE_PROGRAM_FILE`, standardmäßig `/var/lib/landwelle/program.json`. + +## Charts + +Die Chartverwaltung trennt Zuhörer-, docX-, Schlager-, Archiv- und Jahresbestände. Laufende Charts besitzen Top 3, Hauptchart und Neuvorstellungen. Felder speichern automatisch über authentifizierte JSON-Endpunkte mit CSRF-Prüfung. + +Positionen werden atomar gespeichert. Die Constraints für `(chart_key, position)` und `(chart_year, position)` sind deferrierbar, damit echte Positionswechsel innerhalb einer Transaktion möglich bleiben. + +## Redaktion und Mediathek + +Die Redaktion besitzt getrennte Tabs für die Inhaltsliste, das Anlegen beziehungsweise Bearbeiten von Inhalten und die Kategorien. Kategorien werden über ein Modal angelegt, sortiert und optional für „Landwelle vor Ort“ freigeschaltet. Veröffentlichte Beiträge erscheinen auf der Startseite und besitzen eine eigene Detailseite. Facebook-Ausgaben zeigen Vorschau, Versandstatus, Fehlergrund und eine manuelle Wiederholungsaktion. + +Die Mediathek verwaltet Sendungen, KI-Beiträge, Interviews und Specials. Unterstützte Audioformate werden serverseitig geprüft. Fertige Nachrichtenstudio-Audios können als nichtöffentlicher Entwurf übernommen und anschließend redaktionell freigegeben werden. + +## Forum + +Die Verwaltung bietet Kategorien, Themenübersicht und Moderationsfunktionen. Öffentliche Beiträge unterstützen sichere BBCodes und Emoticons, jedoch keine Bilder. Benutzerprofile zeigen Rang, Sterne, Beiträge, Themen, erhaltene und vergebene Dankeschöns sowie Registrierungsdatum. + +## Todo und Firebase + +`/admin/todos` zeigt Aufgaben nach Status und Priorität. Neue Jens-Todos können einen idempotenten Firebase-Push auslösen. Die Oberfläche unterscheidet: + +- kein Push erforderlich +- Versand fehlgeschlagen +- an Firebase übergeben +- in der Landwelle-IT-App bestätigt + +Die letzte Stufe setzt eine tatsächliche Quittung der App über `/api/mobile/todos/push-receipt` voraus. + +## Audit und Statistik + +`/admin/audit` bietet Suche, Filter, Kennzahlen und Pagination. Administrativ relevante Änderungen sollen dort nachvollziehbar protokolliert werden. + +`/admin/statistik` zeigt einwilligungsbasierte, pseudonyme First-Party-Werte mit Tagesverlauf, Top-Seiten, Gerätetypen, Verweisquellen und CSV-Export. Admin-, API-, Asset- und Medienzugriffe sind ausgeschlossen. + +## Sicherheitsregeln + +- klassische HTML-Formulare senden `csrf_token` +- JSON-/AJAX-Aufrufe senden `X-CSRF-Token` +- Multipart-Formulare werden vor der CSRF-Auswertung geparst +- Rechte werden serverseitig geprüft; versteckte Buttons sind kein Schutz +- Fehlerausgaben enthalten keine Secrets oder internen Pfade +- relevante Schreibvorgänge erhalten Audit-Einträge +- große Listen werden serverseitig paginiert + +## Betrieb + +Adminzugang einrichten: + +```bash +sudo ./scripts/setup-admin-on-pi.sh +sudo systemctl restart landwelle-radio +``` + +Bei Problemen: + +```bash +sudo journalctl -u landwelle-radio -n 100 --no-pager +curl -fsS http://127.0.0.1:2200/ready +``` + +## Chartverwaltung + +Die Chartseite rendert jeden gewählten Bereich genau einmal. Die Schaltfläche `L` leert nur die Eingaben der angeklickten Zeile. Die Position bleibt erhalten und kann anschließend neu befüllt werden. Leere Zeilen sind nicht öffentlich sichtbar. Die Schaltfläche „Generieren“ kann ohne Wochen- oder 24-Stunden-Sperre jederzeit verwendet werden. diff --git a/docs/ADVERTISING.md b/docs/ADVERTISING.md new file mode 100644 index 0000000..79ef804 --- /dev/null +++ b/docs/ADVERTISING.md @@ -0,0 +1,10 @@ +# Werbeanfragen + +Öffentliche Route: `/werbung` + +Werbeinteressenten wählen mindestens eine Möglichkeit und senden ihre Kontaktdaten, Region, Budgetrahmen, Startwunsch, Laufzeit und Nachricht. Der Datensatz wird zuerst in `landwelle.advertising_inquiries` gespeichert. Nur bei einem neuen Datensatz werden danach zwei E-Mails ausgelöst: + +1. interne Anfrage an `radio@landwelle.de` über `advertising_inquiry_admin` +2. Bestätigung an die angegebene Adresse über `advertising_inquiry_confirmation` + +Die E-Mail-Templates sind unter `/admin/email-templates` editierbar. Der Request-Token verhindert doppelte Datensätze bei wiederholtem Absenden. Ein SMTP-Fehler löscht die gespeicherte Anfrage nicht. diff --git a/docs/AI_AUDIO_MODULES.md b/docs/AI_AUDIO_MODULES.md new file mode 100644 index 0000000..2a55f64 --- /dev/null +++ b/docs/AI_AUDIO_MODULES.md @@ -0,0 +1,76 @@ +# KI-Audio-Rubriken + +**Stand: Landwelle v1.5.48 – 23. August 2026** + +Ab v1.5.48 besitzt `KI & Automatisierung` 28 frei konfigurierbare Audiobereiche. Die Seiten verwenden eine gemeinsame Produktionspipeline, speichern ihre Inhalte und Ausgabeparameter jedoch vollständig getrennt. + +## Verfügbare Bereiche + +- Lokalnews +- Lokalwetter +- Lokalevent +- Funfacts +- ABC +- Mythen Check +- Polizeimeldungen +- Tipps & Tricks +- Trend im Prozent +- Unnützes Wissen +- Wissen in 60 Sekunden +- Wissenswertes +- Unsere Dörfer Unsere Städte +- Unsere Land Unsere Region +- Charts Zuhörer +- Charts dockX +- Charts History +- Hitarchiv +- Song Content +- Musiknews +- Prominews +- Kinonews +- Streamingnews +- Techniknews +- Podcast +- Show +- Moderationen +- Stellenbörse + +`Lokalnews` verwendet aus Kompatibilitätsgründen weiterhin die vorhandene Route `/admin/ai/news-local`. + +## Einstellungen je Rubrik + +Jede Rubrik speichert separat: + +- sendefertigen Sprechtext +- ElevenLabs Voice ID über die zentrale Stimmenauswahl +- optionales zentrales Hintergrundmusikbett +- TTS-Pegel in dB +- Hintergrundpegel in dB +- Ein-/Aus-Schalter für den gesprochenen KI-Transparenzhinweis +- FTP-Zielordner +- MP3-Dateiname + +Die Daten liegen in der bestehenden Runtime-Datei `settings.json` unter `ai_audio_modules`. Es ist deshalb keine PostgreSQL-Migration erforderlich. + +## Produktionsablauf + +Der Button `Erzeugen & hochladen` speichert zuerst den aktuellen Rubrikstand und startet anschließend einen serverseitigen Hintergrundjob. Das Statusmodal zeigt: + +1. Sprechtext prüfen +2. MP3 über ElevenLabs erzeugen +3. optional Stimme und Musikbett mit ffmpeg mischen +4. MP3 auf den konfigurierten FTP-Pfad hochladen +5. lokale Arbeitsdateien löschen +6. Abschluss + +Der eingetragene Text wird unverändert als Sprechtext verwendet. Die Rubrik führt keine zusätzliche OpenAI-Umschreibung durch. + +Nach erfolgreichem FTP-Upload werden lokale ElevenLabs- und Mix-Arbeitsdateien gelöscht, damit der Webspace nicht vollläuft. Bei ElevenLabs-, ffmpeg- oder FTP-Fehlern bleiben bereits erzeugte lokale Dateien für die Fehlersuche erhalten. + +## Zentrale Provider + +FTP-Zugangsdaten, ElevenLabs-Zugangsdaten, Stimmen und Musikbetten werden weiterhin zentral unter den Systemeinstellungen verwaltet. Die Rubrikseiten speichern keine Provider-Passwörter und keine API-Schlüssel. + +## Pegelverarbeitung ab v1.5.43 + +Die gespeicherten `tts_gain_db`- und `background_gain_db`-Werte sind Bestandteil der tatsächlichen Audioausgabe. Bei ausgewähltem Musikbett setzt `mixAudio` beide ffmpeg-Volume-Filter vor dem Mix. Ohne Musikbett wird die erzeugte ElevenLabs-Datei mit `applyAudioGain` auf den gespeicherten TTS-Pegel gebracht und erst diese gepegelte Datei auf FTP geladen. diff --git a/docs/AI_TRANSPARENCY.md b/docs/AI_TRANSPARENCY.md new file mode 100644 index 0000000..a231735 --- /dev/null +++ b/docs/AI_TRANSPARENCY.md @@ -0,0 +1,57 @@ +# KI-Transparenz + +**Stand: Landwelle v1.5.26 – 4. August 2026** + +Dieses Dokument beschreibt die technische und redaktionelle Umsetzung der Transparenzpflichten für KI-Inhalte im Landwelle-Portal. Maßgeblich sind insbesondere Art. 50 der Verordnung (EU) 2024/1689 sowie die dazu veröffentlichten Leitlinien der Europäischen Kommission. Das Dokument ersetzt keine individuelle Rechtsberatung. + +## Grundprinzipien + +- KI-generierte oder wesentlich KI-bearbeitete Inhalte werden am ersten Kontaktpunkt verständlich gekennzeichnet. +- Die Kennzeichnung bleibt sichtbar und wird nicht nur in versteckten Metadaten abgelegt. +- Zusätzlich werden maschinenlesbare HTML-Attribute wie `data-ai-generated`, `data-ai-usage` und bei Audio `data-ai-voice` ausgegeben. +- Redaktionelle Prüfung und redaktionelle Verantwortung werden getrennt dokumentiert. +- Synthetische Audioinhalte erhalten bei neu erzeugten Dateien einen gesprochenen Hinweis am Anfang. +- Bekannte ältere KI-Audios werden in der Mediathek sichtbar gekennzeichnet, auch wenn die Audiodatei selbst noch keinen gesprochenen Vorspann enthält. + +## Redaktion und „Landwelle vor Ort“ + +Für jeden Beitrag kann der KI-Einsatz als `none`, `assisted`, `generated` oder `manipulated` klassifiziert werden. Zusätzlich werden eine substanzielle menschliche Prüfung, die redaktionell verantwortliche Stelle und ein optionaler eigener Transparenztext gespeichert. + +Die öffentliche Detailseite zeigt die Kennzeichnung bereits im Hero. Auf der Startseite erhalten regionale Karten ebenfalls einen sichtbaren Hinweis. Facebook-Veröffentlichungen übernehmen den Transparenzhinweis automatisch. + +## Medien und Bilder + +Die Medienverwaltung unterscheidet `none`, `generated` und `manipulated`. Bei Verwendung eines gekennzeichneten Bildes wird der Hinweis am öffentlichen Beitrag ausgegeben. Die bekannte KI-generierte Mediathek-Herografik ist direkt als „Illustration mit KI erstellt“ gekennzeichnet. + +## Mediathek und KI-Stimmen + +Mediathek-Einträge speichern KI-Art, synthetische Stimme, menschliche Prüfung, verantwortliche Stelle und Transparenztext. Der Hinweis erscheint vor dem Audioplayer. `GenerateSpeech` fügt neuen ElevenLabs-Ausgaben zentral einen gesprochenen Transparenzvorspann hinzu. + +## Jahrescharts + +Automatisch erzeugte Künstler- und Titelinformationen tragen im Informationsdialog einen sichtbaren KI-Hinweis. Die API liefert außerdem `ai_generated` und `ai_disclosure`. + +## Öffentliche KI-Interaktion + +Das Portal stellt derzeit keinen öffentlichen KI-Chatbot, keine Emotionserkennung und keine biometrische Kategorisierung bereit. Wird künftig eine solche Funktion ergänzt, muss die Offenlegung bereits beim Beginn der Interaktion erfolgen. + +## Redaktionsablauf + +1. Vor Veröffentlichung die tatsächliche Art des KI-Einsatzes auswählen. +2. Eine menschliche Prüfung nur markieren, wenn Inhalt, Fakten und endgültige Fassung substanziell geprüft wurden. +3. Die redaktionell verantwortliche Stelle eintragen. +4. Bilder und Audios separat klassifizieren. +5. Öffentliche Vorschau einschließlich KI-Hinweis kontrollieren. +6. Fehlerhafte oder fehlende Kennzeichnungen unverzüglich korrigieren. + +## Datenbank + +Migration `0037_ai_transparency.sql` ergänzt die erforderlichen Felder in `editorial_entries`, `mediathek_entries` und `media_assets`. Bestehende bekannte KI-Beiträge werden vorsichtig zurückklassifiziert. Bereits ausgeführte frühere Migrationen werden nicht verändert. + +## Virtuelle Teammitglieder und sichtbare Bildwasserzeichen ab v1.5.25 + +Teamprofile können als KI-/virtuelle Persönlichkeit gekennzeichnet werden. Die Kennzeichnung erscheint auf der öffentlichen Teamseite und bei verknüpften Programmeinträgen. Der optionale Profilhinweis soll eindeutig erklären, dass keine reale Person dargestellt wird. + +Für ausgewählte Bilder kann in der Mediengalerie ein sichtbares Wasserzeichen aktiviert werden. Vorgesehen sind insbesondere realistisch wirkende KI-Bilder sowie eigene Fotos, die wesentlich mit KI bearbeitet wurden. Das Wasserzeichen ergänzt die ausführliche Transparenzinformation und ersetzt sie nicht. + +Migration `0038_team_ai_media_watermark.sql` ergänzt `team_members.is_ai`, `team_members.ai_disclosure`, `media_assets.ai_watermark_enabled` und `media_assets.ai_watermark_text`. diff --git a/docs/ANALYTICS_PRIVACY.md b/docs/ANALYTICS_PRIVACY.md new file mode 100644 index 0000000..f3fb2be --- /dev/null +++ b/docs/ANALYTICS_PRIVACY.md @@ -0,0 +1,73 @@ +# Datenschutzfreundliche Statistik bei Landwelle + +**Stand: Landwelle v1.5.26** + +Landwelle unterscheidet die öffentliche Webstatistik von der optionalen App-Statistik. + +## Öffentliche Website + +Route der Verwaltung: + +```text +/admin/statistik +``` + +Erfasst werden nach freiwilliger Einwilligung: + +- Besucher als pseudonyme Zufallskennung +- Sitzungen +- Seitenaufrufe +- Seitentitel +- normalisierter öffentlicher Pfad ohne Query-String +- grobe Geräteklasse +- Referrer-Hostname +- Zeitpunkt + +Nicht als Statistikprofil gespeichert werden: + +- vollständige IP-Adresse +- vollständiger User-Agent +- Klarnamen oder E-Mail-Adressen +- genaue Position +- Werbe-ID oder Gerätefingerprint +- Admin-, API-, Asset- oder Medienzugriffe + +Browser- und Sitzungskennungen werden zufällig erzeugt und vor der Speicherung serverseitig mit SHA-256 gehasht. Die IP-Adresse wird ausschließlich flüchtig und gehasht für das Rate-Limit verwendet. + +Schutzmaßnahmen: + +- gültiges First-Party-Consent-Cookie +- Same-Origin- und Sec-Fetch-Site-Prüfung +- JSON- und Größenlimit +- Botfilter +- 90 Anfragen je Minute und Quelladresse +- Deduplizierung desselben Sitzungs-/Seitenaufrufs innerhalb von fünf Sekunden +- automatische Löschung von Ereignissen nach 25 Monaten +- Global Privacy Control und Do Not Track werden im Browser respektiert + +Auswertung: + +- 7, 30, 90, 180 oder 365 Tage +- Besucher, Sitzungen, Seitenaufrufe, Seiten je Sitzung +- Verlaufskurve +- Top-Seiten +- Geräteklassen +- Referrer +- CSV-Export + +Die Daten sind eine **einwilligungsbasierte First-Party-Messung**. Sie bilden nicht alle Besucher ab und sind nicht durch einen unabhängigen Reichweitenanbieter auditiert. Diese Einschränkung muss in Sponsorendokumenten transparent bleiben. + +## Mobile Apps + +Für die getrennten mobilen Apps gelten weiterhin: + +- zufällige Installations-UUID statt Hardwarekennung +- getrennte Einwilligung für Statistik und Push +- keine Advertising IDs, IMEI oder genaue Standortprofile +- serverseitige Ereignis-Whitelist +- verschlüsselte Push-Tokens +- keine freie Übertragung beliebiger Nutzerdaten + +## Recht und Betrieb + +Vor Produktivverwendung sind Rechtsgrundlage, Aufbewahrungsfrist, Verzeichnis der Verarbeitungstätigkeiten, Consenttext und Datenschutzerklärung final zu prüfen. Exporte aus dem Adminbereich dürfen nur zweckgebunden verwendet werden. diff --git a/docs/API.md b/docs/API.md new file mode 100644 index 0000000..8880fc4 --- /dev/null +++ b/docs/API.md @@ -0,0 +1,354 @@ +# Landwelle App API v1 + +**Vertrag:** 1.0.0 +**Portalversion:** Landwelle v1.5.24 +**Stand:** 21. Juli 2026 + +## Zweck + +Die API ist die verbindliche Schnittstelle für die eigenständig entwickelte Landwelle-App auf Android und iOS. Die Apps lesen keine Portal-HTML-Seiten aus, greifen nicht direkt auf PostgreSQL, AzuraCast, RSS-Dienste oder andere interne Systeme zu und enthalten keine Zugangsdaten für OpenAI, ElevenLabs, FTP oder Adminfunktionen. + +Öffentliche Produktionsbasis: + +```text +https://api.landwelle.de/v1 +``` + +Kompatibler Portalpfad: + +```text +https://landwelle.de/api/v1 +``` + +Lokale Entwicklung: + +```text +http://localhost:2200/api/v1 +``` + +Der maschinenlesbare Vertrag liegt in: + +```text +openapi/landwelle-app-api.yaml +``` + +## Grundregeln + +- Alle fachlichen Antworten sind JSON. +- Erfolgreiche Antworten verwenden `data` und optional `meta`. +- Fehler verwenden immer `error.code`, `error.message` und optional `error.fields`. +- Unbekannte v1-Endpunkte liefern JSON mit HTTP 404, niemals eine HTML-Fehlerseite. +- Zeitangaben sind ISO 8601/RFC 3339. +- Der Sender arbeitet in `Europe/Berlin`; Serverzeit in Metadaten ist UTC. +- Die App muss Feature-Flags aus dem Bootstrap beachten. +- Neue App-Funktionen dürfen nicht durch Website-Scraping oder fest eingebaute interne URLs ergänzt werden. + +## App-Start + +Der erste fachliche Aufruf ist: + +```http +GET /v1/app/bootstrap +``` + +Die Antwort enthält: + +- Branding und Logo +- Streamadresse +- aktuelle Titel- und Sendungsdaten +- Feature-Flags +- die Pfade aller App-Endpunkte +- API-Version und Serverzeit + +Danach kann die App parallel laden: + +```text +GET /v1/station +GET /v1/now +GET /v1/program/current +GET /v1/news +GET /v1/events +GET /v1/weather +``` + +## Radio und Player + +```text +GET /v1/station +GET /v1/now +GET /v1/livestudio +GET /v1/playlist/history?limit=30 +GET /v1/covers/{coverId} +``` + +`/station` enthält Stream-, Support-, Datenschutz- und Impressumsadressen. `/now` enthält die aktuellen AzuraCast-Daten. `/livestudio` kombiniert Now Playing, aktuelle und nächste Sendung sowie Wetterdaten. Die App verwendet für Hintergrundaudio immer die Streamadresse aus Bootstrap beziehungsweise Station und nicht eine fest einprogrammierte Adresse. + +## Nachrichten + +```text +GET /v1/news?limit=20&cursor=0®ion=niedersachsen +GET /v1/news/editorial/{slug} +GET /v1/news/rss/{id} +``` + +Die Liste mischt: + +- veröffentlichte Beiträge der Landwelle-Redaktion +- freigegebene RSS-Meldungen + +Jeder Eintrag hat eine stabile, typisierte Kennung wie: + +```text +editorial:neue-sendung-am-morgen +rss:1842 +``` + +Redaktionelle Details können einen vollständigen Body enthalten. RSS-Details liefern nur die nach den Quellenrechten freigegebenen Felder, Zusammenfassung, Attribution und den externen Link. + +## Veranstaltungen + +```text +GET /v1/events?limit=30&category=Markt +GET /v1/events/{id} +``` + +Die API liefert veröffentlichte, laufende oder zukünftige Termine aus den Portalquellen. Detailobjekte enthalten Ort, Zeit, Beschreibung, Veranstalter, Bild, Quelle und Kalenderadresse. + +## Programm, Team und Charts + +```text +GET /v1/program +GET /v1/program/current +GET /v1/team +GET /v1/charts +GET /v1/charts/listener +GET /v1/charts/schlager +GET /v1/charts/annual +``` + +Chart-Voting erfolgt installationsgebunden: + +```http +POST /v1/charts/listener/votes +Authorization: Installation +Content-Type: application/json + +{ + "entry_id": 42, + "rating": 5 +} +``` + +Die vorhandene 24-Stunden-Sperre gilt auch für die App. + +## Wetter, Verkehr und Ausflüge + +```text +GET /v1/weather +GET /v1/traffic +GET /v1/speed-cameras +GET /v1/excursions +GET /v1/regions +``` + +Die App zeigt Fehlerzustände aus der API an und greift nicht eigenständig auf Open-Meteo, Autobahn- oder andere Drittanbieter zu. + +## Anonyme Installationsidentität + +Die App erzeugt beim ersten Start eine UUID oder lässt sie vom Server erzeugen: + +```http +POST /v1/installations +Content-Type: application/json + +{ + "platform": "android", + "device_class": "phone", + "distribution_channel": "development", + "app_version": "1.0.0", + "app_build": "1", + "os_version": "16", + "locale": "de-DE", + "timezone": "Europe/Berlin" +} +``` + +Die Antwort enthält einmalig: + +```json +{ + "data": { + "installation_id": "uuid", + "installation_token": "opaque-secret", + "authorization_scheme": "Installation" + } +} +``` + +Die App speichert das Secret nur im sicheren Plattform-Speicher. Der Server speichert ausschließlich dessen SHA-256-Hash. Es werden keine IMEI, Advertising-ID, Seriennummer oder Geräte-Fingerprints verwendet. + +Autorisierung: + +```http +Authorization: Installation +``` + +Kompatibel wird auch `Bearer` akzeptiert. + +Aktualisierung und Löschung: + +```text +PATCH /v1/installations/{installationId} +DELETE /v1/installations/{installationId} +``` + +Die Löschung deaktiviert Push und Statistik für diese Installation. + +## Push + +```text +PUT /v1/installations/{installationId}/push-token +DELETE /v1/installations/{installationId}/push-token +GET /v1/installations/{installationId}/topics +PUT /v1/installations/{installationId}/topics +POST /v1/push/opened +``` + +Push-Registrierung ist nur aktiv, wenn PostgreSQL und `LANDWELLE_APP_PUSH_ENCRYPTION_KEY` konfiguriert sind. FCM-Tokens werden mit AES-256-GCM verschlüsselt gespeichert. Die API gibt gespeicherte Tokens niemals zurück. + +## Optionale Nutzungsstatistik + +```http +POST /v1/usage-events +Authorization: Installation +``` + +Voraussetzungen: + +- `LANDWELLE_APP_ANALYTICS_ENABLED=true` +- ausdrückliche Einwilligung in der Installation +- maximal 50 Ereignisse pro Anfrage +- nur vorgegebene Ereignisnamen und Eigenschaften +- keine Werbe-ID, genaue Position oder beliebige personenbezogene Payloads + +Unterstützte Ereignisse: + +```text +app_open +session_start +session_end +stream_start +stream_stop +news_open +event_open +program_open +push_open +download_open +``` + +Erlaubte Eigenschaften werden je Ereignis serverseitig geprüft: + +| Ereignis | erlaubte Eigenschaften | +|---|---| +| `app_open`, `session_start`, `stream_start` | keine | +| `session_end`, `stream_stop` | `duration_seconds`, `reason` | +| `news_open` | `content_id` | +| `event_open` | `event_id` | +| `program_open` | `program_id` | +| `push_open` | `campaign_id` | +| `download_open` | `release_id` | + +Andere Schlüssel, zu große Texte und ungültige IDs werden mit `invalid_event_properties` abgewiesen. + +## Releases und Store-Kompatibilität + +```text +GET /v1/releases?platform=android&channel=beta +GET /v1/releases?platform=android&channel=google_play +GET /v1/releases?platform=ios&channel=app_store +GET /v1/app/compatibility?platform=android&version=1.0.0&build=1&channel=beta +``` + +Die Kompatibilitätsantwort enthält das passende neueste Release, `update_available` und `mandatory`. Ein Update wird über den jeweiligen Store beziehungsweise den Betriebssystemdialog installiert; die App besitzt keinen stillen Installer. + +## Feature-Flags + +Wichtige Flags im Bootstrap: + +```text +installation_identity +push_registration +push_topics +usage_analytics +android_sideload +google_play +ios_app +store_release_checks +chart_voting +``` + +Ein deaktiviertes Flag ist verbindlich. Die App darf die zugehörige Funktion dann nicht anbieten. + +## API-Änderungsprozess für den App-Chat + +Fehlt der App ein Endpunkt, Feld oder Schreibvorgang, darf der App-Chat die Website nicht parsen und keine nicht dokumentierte Route erfinden. Er muss dem Nutzer eine kopierbare Anforderung für den Portal-Chat ausgeben. Das verbindliche Format steht in: + +```text +docs/API_CHANGE_REQUEST_TEMPLATE.md +APP_CHATUEBERGABE.md +``` + +Erst nach Erweiterung des Portalprojekts, Aktualisierung der OpenAPI-Datei und Veröffentlichung einer neuen Portalversion wird die App-Integration fortgesetzt. + +## Interne Landwelle-IT-App-API + +Die Android-App `de.landwelle.itmonitor` verwendet neben der öffentlichen Radio-App-API eine kleine interne Schnittstelle mit eigener Basis: + +```text +https://api.landwelle.de +``` + +Endpunkte: + +```http +GET /api/mobile/todos?author=Jens +GET /api/mobile/status +``` + +Endgültige URLs: + +```text +https://api.landwelle.de/api/mobile/todos?author=Jens +https://api.landwelle.de/api/mobile/status +``` + +Der Reverse Proxy reicht `/api/mobile/...` unverändert an denselben Portalpfad weiter. Es gibt keinen zweiten `/api`-Präfix und daher keinen Pfad `/api/api/mobile/...`. + +Optional schützt `LANDWELLE_MOBILE_API_TOKEN` beide Endpunkte: + +```http +Authorization: Bearer +``` + +Antworten und Fehler sind JSON. Der separate Vertrag liegt unter: + +```text +openapi/landwelle-it-api.yaml +``` + +Die automatische Firebase-Nachricht nach einem neu angelegten Jens-Todo ist kein öffentlicher API-Endpunkt. Sie wird ausschließlich serverseitig nach dem erfolgreichen Datenbank-Insert ausgelöst. Details: `docs/FIREBASE_PUSH.md`. + + +## Öffentliche Website-Hilfsendpunkte v1.5.0 + +```http +GET /api/events/search?q=fest&category=Markt +GET /api/events/{id} +GET /api/directory/search?q=hofladen&category=Landwirtschaft%20%26%20Hofläden +``` + +Diese Endpunkte liefern JSON für die Live-Suche und Detailmodale der öffentlichen Website. Sie gehören nicht zum mobilen `/v1`-App-Vertrag. + +## KI-Transparenz in redaktionellen Meldungen + +Redaktionelle Nachrichteneinträge können das optionale Objekt `ai_transparency` enthalten. Es umfasst `ai_generated`, `usage`, `disclosure`, `human_reviewed`, `editorial_responsible` und bei gekennzeichneten Bildern ein untergeordnetes `media`-Objekt. Clients müssen den Hinweis vor oder gemeinsam mit dem Inhalt sichtbar ausgeben; unbekannte Zusatzfelder bleiben gemäß API-v1-Kompatibilitätsregel tolerierbar. diff --git a/docs/API_CHANGE_REQUEST_TEMPLATE.md b/docs/API_CHANGE_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..47de198 --- /dev/null +++ b/docs/API_CHANGE_REQUEST_TEMPLATE.md @@ -0,0 +1,51 @@ +# Vorlage: API-Erweiterung aus dem App-Chat + +Der App-Chat muss diese Vorlage vollständig ausfüllen, sobald ihm für Android oder iOS eine API-Funktion fehlt. Der Nutzer kopiert den Block anschließend in den Landwelle-Portal-Chat. + +```text +API-ERWEITERUNG FÜR DAS LANDWELLE-PORTAL + +App-Funktion: + + +Plattform: + + +Aktueller API-Endpunkt: + + +Fehlende API-Funktion: + + +Vorgeschlagene HTTP-Methode und Route: + + +Benötigte Anfrage: + + +Benötigte Antwort: + + +Authentifizierung: +<öffentlich, Installation-Secret oder andere bestehende Methode> + +Fehlerfälle: + + +Warum die vorhandene API nicht ausreicht: + + +Datenschutz-/Store-Auswirkung: + + +Abwärtskompatibilität: + +``` + +Nicht zulässig sind als Ersatz: + +- Auslesen von HTML-Seiten +- direkter Zugriff auf Datenbank oder interne Dienste +- fest codierte Admin- oder Drittanbieter-Zugangsdaten +- Annahmen über nicht dokumentierte JSON-Felder +- dauerhafte Mockdaten in einer produktiven Funktion diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md new file mode 100644 index 0000000..42a3543 --- /dev/null +++ b/docs/ARCHITECTURE.md @@ -0,0 +1,127 @@ +# Architektur + +**Stand:** Landwelle v1.5.26 + +## Laufende Architektur + +```text +Webbrowser Radio-App Android/iOS Landwelle IT Android + │ │ │ +landwelle.de api.landwelle.de/v1 api.landwelle.de/api/mobile + │ │ │ + └────────────────── HTTPS / Reverse Proxy ────────────────┘ + │ + Go-Anwendung :2200 + ┌───────────────────────┼─────────────────────────┐ + │ │ │ +Public Web Public App API Admin + │ │ │ + └──────────────────── Service-/Store-Schicht ─────┘ + │ + ┌───────────────────┼──────────────────────┐ + │ │ │ + PostgreSQL RSS/Externe Daten Audio/Push + Inhalte, Nutzer, Landeszeitung/NDR, OpenAI, + Programm, Events, destination.one, ElevenLabs, + App-Installationen Wetter, Verkehr FTP, FCM/APNs +``` + +Das Portal ist ein Go-basierter modularer Monolith. HTML und Assets werden mit `go:embed` ausgeliefert. PostgreSQL ist die persistente Datenbasis. + +## Öffentliche Schnittstellen + +```text +/ serverseitig gerendertes Portal +/assets/* eingebettete Web-Assets +/api/v1/* kompatibler API-Pfad auf landwelle.de +/v1/* kanonischer API-Pfad auf api.landwelle.de +/health Liveness/Abhängigkeiten +/version laufende Portalversion +/admin/* geschützte Administration +``` + +Die API liefert echte Portal-, PostgreSQL-, RSS-, Programm-, Chart-, Wetter- und Now-Playing-Daten. Sie ist nicht nur eine Demonstrationsschnittstelle. + +## Mobile Clientstrategie + +Android und iOS werden getrennt vom Portal als Flutter-App entwickelt. Die App kennt ausschließlich `https://api.landwelle.de/v1` und den OpenAPI-Vertrag. + +```text +Flutter UI + ├── Audio Service + ├── API Client + ├── Cache + ├── Installationsidentität + ├── Push/Deep Links + └── freiwillige Statistik + │ + ▼ +Landwelle App API 1.0.0 +``` + +Direkte Zugriffe auf PostgreSQL, AzuraCast, RSS, Wetter- oder Verkehrsdienste sind in der App ausgeschlossen. + +## API-Schichten + +```text +/v1/app/bootstrap Bootstrap und Feature-Flags +/v1/station, /now, /livestudio Playerdaten +/v1/playlist/history Titelverlauf +/v1/news* Nachrichten und Details +/v1/events* Veranstaltungen und Details +/v1/program* Programm +/v1/team Team +/v1/charts* Charts und Voting +/v1/weather, /traffic Wetter und Verkehr +/v1/installations* anonyme Installation und Push +/v1/usage-events freiwillige Statistik +/v1/releases Releaseinformationen +/v1/app/compatibility Store-/Versionsprüfung +/admin/* Redaktion und Administration +``` + +Der OpenAPI-Vertrag `openapi/landwelle-app-api.yaml` ist die Quelle für Clientmodelle und Contract-Tests. + +## Installation und Schutz + +Eine App-Installation verwendet eine zufällige UUID und ein einmalig ausgegebenes Secret. Das Backend speichert nur den SHA-256-Hash. Push-Tokens werden mit AES-256-GCM verschlüsselt. Hardware-IDs, Werbe-IDs und genaue Standortdaten werden nicht verwendet. + +## Nutzungsstatistik + +Rohereignisse werden nur nach ausdrücklicher Einwilligung angenommen. Ereignisnamen, Eigenschaften, Zeitfenster und Größen sind serverseitig begrenzt. Beliebige Payloads und freie Ereignisnamen werden abgewiesen. + +## Projektgrenze + +Ein produktiver Desktop-Player gehört nicht zur aktuellen Roadmap. Die vorhandenen historischen Desktop-Konzeptdateien sind keine aktive Implementierungsfreigabe. + + +## Firebase-Todo-Push + +Der Firebase Admin SDK Client wird beim Erzeugen des zentralen `adminHandler` einmalig initialisiert. Nach einem erfolgreichen neuen Todo-Insert entscheidet die Portal-Logik über `author_user_id` und `created_by_user_id`, ob Jens beteiligt ist. Erst dann wird die Kombination aus Todo-ID und Topic in PostgreSQL reserviert und an FCM gesendet. Die Service-Account-Datei bleibt außerhalb des Projekt- und Webverzeichnisses. + + +## Wachstums- und Redaktionsmodule + +```text +/werbung Werbeauswahl, Anfrage und E-Mail-Workflow +/veranstaltungen Suche und Detailmodal +/ontour YouTube-Feed mit datenschutzfreundlichem Embed +/branchenbuch Öffentliches Verzeichnis und Einreichung +/admin/navigation Datenbankbasierte Hauptnavigation +/admin/directory Branchenbuchmoderation +``` + +Die Hauptnavigation wird aus PostgreSQL gelesen, 45 Sekunden zwischengespeichert und bei Änderungen invalidiert. Ist die Datenbank nicht erreichbar oder sind noch keine Navigationseinträge vorhanden, verwendet das Portal eine feste sichere Standardnavigation. + +## Zustandsabhängige Adminnavigation + +Die Adminnavigation wird serverseitig als gemeinsame HTML-Struktur ausgegeben. `admin-sidebar-v2.js` vergleicht den aktuellen Pfad und Hash mit den Navigationszielen, setzt `aria-current="page"`, öffnet die zuständige `details`-Kategorie und schließt nicht aktive Kategorien. Dadurch bleibt die Navigation über alle Adminmodule konsistent, ohne dass jeder Handler den aktiven Zustand separat berechnen muss. + +## Stellenbörse + +Die Seite `/service/stellenboerse` spricht die Fremd-API ausschließlich aus dem Go-Backend an. Der Browser kommuniziert nur mit Landwelle. Suchanfragen werden serverseitig an `/pc/v6/jobs` weitergereicht; Details werden über den internen Endpunkt `/api/jobs/details` geladen und serverseitig aus `/pc/v4/jobdetails/{base64-referenz}` bezogen. Der API-Schlüssel wird niemals an den Browser ausgegeben. + +## Chart-Bestandsimport + +Migration `0028` erweitert das bestehende Chartmodell um Archiv-, Jahres- und Metadatenfelder und importiert die freigegebenen Inhalte aus dem bereitgestellten MariaDB-Dump. Der Import ist über natürliche beziehungsweise Legacy-Schlüssel idempotent. Personenbezogene historische Votingdaten werden nicht übernommen. + diff --git a/docs/AUDIO_WISHES.md b/docs/AUDIO_WISHES.md new file mode 100644 index 0000000..7dc51b2 --- /dev/null +++ b/docs/AUDIO_WISHES.md @@ -0,0 +1,53 @@ +# Audio-Wünsche / Wunschbox-Produktion + +**Stand: Landwelle v1.5.42 – 18. August 2026** + +## Zweck + +`/admin/ai/wishes` ist die zentrale fachliche Konfiguration für die automatische und manuelle Vertonung von Musikwünschen aus der öffentlichen Wunschbox. Die Zugangsdaten für OpenAI, ElevenLabs und FTP bleiben weiterhin unter `/admin/settings`. + +## Manuell und automatisch + +Der Master `Automatik aktiv` gilt ausschließlich für automatische Verarbeitung. Ein Admin kann unter `/admin/wishes` jederzeit bewusst `KI/MP3 erzeugen` anklicken; dieser manuelle Lauf verwendet `ProcessManual` und wird nicht durch den Master blockiert. + +Eine Produktion unmittelbar nach einer Freigabe findet nur statt, wenn beide Optionen gesetzt sind: + +1. `Automatik aktiv` +2. `Bei Freigabe automatisch produzieren` + +## Prompt und Wunschdaten + +Der unter `/admin/ai/wishes` gespeicherte Prompt wird für jeden Musikwunsch verwendet. Folgende Platzhalter können direkt im Prompt eingesetzt werden: + +- `{{id}}` +- `{{name}}` +- `{{place}}` +- `{{artist}}` +- `{{song}}` +- `{{message}}` + +Unabhängig von Platzhaltern werden Name, Ort, Interpret, Titel und Grußtext zusätzlich als strukturiertes Ausgangsmaterial an OpenAI übergeben. Das globale redaktionelle OpenAI-Systemprompt bleibt ebenfalls aktiv. + +Das OpenAI-Modell kann für die Wunschbox überschrieben werden. Bleibt das Feld leer, wird das globale Modell verwendet. Die Wunschbox besitzt zusätzlich eine eigene Temperatur; bei Modellen ohne Temperatur-Unterstützung wird sie vom OpenAI-Aufruf automatisch weggelassen. + +## Stimme und Musikbett + +Die ElevenLabs-Stimme wird aus den zentral gepflegten Sprecherprofilen ausgewählt. Optional kann eines der zentral hochgeladenen Musikbetten verwendet werden. TTS- und Hintergrundpegel werden getrennt in dB konfiguriert. Der Mix erfolgt über `ffmpeg`. + +Der gesprochene KI-Transparenzhinweis wird unabhängig vom Wunschbox-Prompt gesteuert. Unter `KI & Automatisierung → Audio-Wünsche` kann er für Musikwunsch-MP3s aktiviert oder deaktiviert werden. Die Einstellung wird serverseitig angewendet und gilt sowohl für manuelle als auch für automatische Wunschproduktionen. + +## Datei und FTP + +Konfigurierbar sind FTP-Zielordner und MP3-Dateinamensmuster. Der Standard lautet: + +`musikwunsch-{{id}}.mp3` + +Für Dateinamen stehen `{{id}}`, `{{name}}`, `{{place}}`, `{{artist}}` und `{{song}}` zur Verfügung. Ordnerzeichen in Dateinamensmustern werden nicht akzeptiert. + +Ist FTP global aktiviert, wird die fertige Datei in den konfigurierten Wunschbox-Zielordner hochgeladen. Ist `Lokale MP3 nach FTP-Upload löschen` aktiv, wird die lokale Datei erst nach erfolgreichem Upload entfernt. Bei Upload-, Mix- oder Bereinigungsfehlern bleibt der Fehler am Musikwunsch sichtbar. + +Ist FTP global deaktiviert, findet kein Upload und keine automatische lokale Löschung statt; die MP3 verbleibt lokal. + +## Persistenz + +Die Wunschbox-Konfiguration ist Teil von `RuntimeSettings.WishAutomation` und wird in der geschützten Runtime-Konfiguration `settings.json` gespeichert. Für v1.5.36 ist keine PostgreSQL-Migration erforderlich. Alte Einstellungen werden beim Laden um die neuen Standardwerte ergänzt. diff --git a/docs/AUTOMATION_CRON.md b/docs/AUTOMATION_CRON.md new file mode 100644 index 0000000..3b67388 --- /dev/null +++ b/docs/AUTOMATION_CRON.md @@ -0,0 +1,104 @@ +# Zentrale KI-Automatisierung und KeyHelp-Cron + +**Stand: Landwelle v1.5.42 – 18. August 2026** + +## Ziel + +KeyHelp ist der einzige externe Taktgeber für die unter `/admin/ai/auto-tasks` gepflegten automatischen Aufgaben. Das Portal startet keinen eigenen Minutenticker mehr. + +Der zentrale Runner ist: + +```text +POST /internal/cron +``` + +Der Runner liest ausschließlich aktive Datensätze aus `landwelle.ai_auto_tasks`. Eine Aufgabe wird nur gestartet, wenn der konfigurierte Wochentag und die konfigurierte Uhrzeit in der Zeitzone `Europe/Berlin` erreicht sind. + +## Authentifizierung + +Der zentrale Endpoint akzeptiert nur einen gültigen Cron-Token aus: + +```text +LANDWELLE_CRON_TOKEN +``` + +Der Token wird über den HTTP-Header `X-Landwelle-Cron-Token` oder alternativ als Bearer-Token erwartet. Ein Query-Parameter wird absichtlich nicht unterstützt, damit das Secret nicht in URLs und Proxylogs landet. + +Ein Token kann auf dem Produktivsystem erzeugt werden mit: + +```bash +sudo ./scripts/setup-cron-token.sh +``` + +Danach den Adminbereich `/admin/ai/auto-tasks` öffnen. Dort wird der fertige KeyHelp-Befehl angezeigt. + +## KeyHelp + +In KeyHelp genau eine geplante Aufgabe anlegen und auf **jede Minute** stellen. Erwarteter Cron-Ausdruck: + +```text +* * * * * +``` + +Empfohlen wird der lokale Aufruf auf Port 2200. Dadurch muss der Request nicht über DNS und Reverse Proxy laufen. Der Adminbereich zeigt die zur aktuellen `ADDR`-Konfiguration passende lokale URL und den vollständigen Curl-Befehl an. + +## Prüfung im Admin + +Landwelle greift nicht auf die KeyHelp-Konfigurationsdatenbank oder KeyHelp-API zu. Stattdessen prüft der Adminbereich die tatsächlich eingehenden Aufrufe. + +Migration `0041_ai_central_cron_runner.sql` legt `landwelle.ai_cron_state` an. Gespeichert werden unter anderem: + +- letzter gültiger Cron-Aufruf +- vorheriger gültiger Cron-Aufruf +- Gesamtzahl gültiger Aufrufe +- Abstand der letzten beiden Aufrufe +- Status des letzten Runner-Durchlaufs +- Anzahl fälliger und gestarteter Aufgaben +- Laufzeit der zentralen Prüfung +- letzter technischer Fehler + +Der Status wird erst grün, wenn wiederholte gültige Aufrufe ungefähr im 60-Sekunden-Takt ankommen. Ein einzelner manueller Test bestätigt nur die Verbindung. + +## Sicherheitsmodell + +Der Cron-Endpoint führt keine Shellbefehle aus und interpretiert `task_key` nicht als Kommando. Zulässig sind ausschließlich drei serverseitig fest freigegebene Aufgabentypen: + +1. `news:news` – Nachrichten Welt, drei MP3-Dateien +2. `news:sport` – Sport, eine MP3-Datei +3. `news:weather` – Wetter, eine MP3-Datei + +Jede fällige Aufgabe startet ausschließlich den zugehörigen Bereich des Nachrichtenstudios. Die dort gespeicherten Prompts, Voice-ID, Musikbett, Pegel, Dateinamen, FTP-Ziele und Audio-Transparenzschalter bleiben maßgeblich. Manipulierte oder unbekannte Task-Keys werden beim Speichern abgewiesen und vom Runner nicht ausgeführt. + +Migration `0042_split_ai_auto_tasks.sql` überführt vorhandene `news:bundle`-Datensätze aus älteren Versionen in drei getrennte Zeitpläne. Der ursprüngliche Datensatz wird zu `news:news`; zusätzlich entstehen Sport und Wetter mit identischer Uhrzeit, identischen Ausführungstagen und identischem Aktivstatus. + +Eine fällige Aufgabe wird vor dem Start atomar in PostgreSQL auf `running` gesetzt und mit `last_run_at` markiert. Ein erneuter Cron-Aufruf in derselben Minute kann denselben Datensatz deshalb nicht nochmals starten. Mehrere unterschiedliche Aufgaben dürfen dagegen in derselben Minute gleichzeitig fällig sein und werden unabhängig voneinander gestartet. + +## Verhalten ohne Aufgaben + +Ist keine aktive Aufgabe für die aktuelle Minute fällig, liefert der zentrale Runner erfolgreich `200 OK` zurück und startet nichts. Das ist der Normalzustand für die meisten Minuten. + +Ist eine Aufgabe deaktiviert, gelöscht oder für einen anderen Wochentag beziehungsweise eine andere Uhrzeit geplant, wird sie nicht ausgeführt. + +## Betrieb + +Beim Update auf v1.5.41 ist Migration `0042_split_ai_auto_tasks.sql` erforderlich: + +```bash +./scripts/build-migrator-pi.sh +sudo ./scripts/update-migrations-on-pi.sh +./scripts/build-pi.sh +sudo ./scripts/update-portal-on-pi.sh +``` + +Der vorhandene KeyHelp-Minutenjob und `LANDWELLE_CRON_TOKEN` bleiben unverändert. Anschließend `/admin/ai/auto-tasks` prüfen. Bestehende Paket-Zeitpläne wurden automatisch in Nachrichten Welt, Sport und Wetter aufgeteilt; neue Zeitpläne werden ausschließlich getrennt angelegt. + + +## Lokale MP3-Bereinigung + +Nach einem erfolgreichen FTP-Upload entfernt das Nachrichtenstudio die lokal erzeugte Sprachdatei und – falls ein Musikbett verwendet wurde – auch die zusätzlich erzeugte Mixdatei aus dem KI-Audio-Verzeichnis. Die Produktionshistorie bleibt als Nachweis erhalten, enthält dann aber keinen lokalen Download mehr. + +Schlägt Erzeugung, Mix oder FTP fehl, bleiben vorhandene lokale MP3-Dateien erhalten. Unter `/admin/ai/news` können einzelne Einträge oder die gesamte Liste „Letzte Produktionen“ gelöscht werden; dabei werden noch vorhandene lokale Dateien mit entfernt. Bereits auf den FTP-Zielserver hochgeladene Dateien werden von dieser Bereinigung niemals gelöscht. + +## Gesprochener KI-Transparenzhinweis + +Der zentrale Cron besitzt keinen eigenen Audio-Transparenzschalter. Für jede getrennte Aufgabe wird der im Nachrichtenstudio gespeicherte Transparenzschalter des jeweiligen Bereichs verwendet. Dadurch entspricht der automatische Lauf exakt der manuellen Produktionskonfiguration dieses Bereichs. diff --git a/docs/AZURACAST.md b/docs/AZURACAST.md new file mode 100644 index 0000000..2088e47 --- /dev/null +++ b/docs/AZURACAST.md @@ -0,0 +1,203 @@ +# AzuraCast- und Cover-Integration + +## Ziel + +Landwelle übernimmt die laufenden Titelmetadaten aus AzuraCast. Interpret, Titel, Album, Live-DJ, Hörerzahl und Zeitinformationen kommen aus der öffentlichen Now-Playing-Schnittstelle. Das Artwork aus der AzuraCast-Antwort wird ausdrücklich ignoriert. + +Passende Cover sucht das Go-Backend stattdessen in dieser Reihenfolge: + +1. Apple iTunes Search API +2. MusicBrainz mit Cover Art Archive als Fallback +3. lokales Landwelle-Fallbackbild, falls kein eindeutiges Cover gefunden wird + +Der Browser greift nie direkt auf Apple iTunes zu. Das Backend lädt ein gefundenes Bild, prüft Typ und Größe, speichert es im lokalen Cache und liefert es über eine Landwelle-URL aus. + +## Adminbereich + +Die Konfiguration befindet sich unter: + +```text +/admin → Radio & AzuraCast +``` + +Dort können ohne Neustart geändert werden: + +- AzuraCast aktiv oder inaktiv +- Basis-URL der AzuraCast-Installation +- Stations-Kurzname +- Standard- oder statischer Now-Playing-Endpunkt +- Abrufintervall zwischen 5 und 300 Sekunden +- iTunes als Coverquelle +- +- iTunes-Ländercode +- Cover-Cachezeit + +Die Schaltfläche **Verbindung testen** prüft die eingegebenen Werte, ohne sie vorher zu speichern. **Speichern & aktivieren** schreibt sie atomar in die Laufzeitkonfiguration und lädt sofort neue Now-Playing-Daten. + +## Voreinstellung für Landwelle + +```text +Basis-URL: https://stream.slmm.de +Stations-Kurzname: landwelle +Statischer Endpunkt: aktiv +Intervall: 15 Sekunden +``` + +Daraus entsteht: + +```text +https://stream.slmm.de/api/nowplaying_static/landwelle.json +``` + +Alternativ kann der Standardendpunkt verwendet werden: + +```text +https://stream.slmm.de/api/nowplaying/landwelle +``` + +## Öffentliche Schnittstellen + +Aktuelle, normalisierte Metadaten: + +```text +GET /api/v1/now +``` + +Kompatibilitätsendpunkt: + +```text +GET /api/now +``` + +Gecachtes Cover: + +```text +GET /api/v1/covers/{sha256-id} +``` + +Beispielausgabe von `/api/v1/now`: + +```json +{ + "data": { + "station_name": "Landwelle Radio", + "show": "Landwelle am Nachmittag", + "presenter": "Sound & Infos aus Niedersachsen", + "artist": "Interpret", + "title": "Titel", + "album": "Album", + "live": false, + "online": true, + "listeners": 42, + "cover_url": "https://landwelle.de/api/v1/covers/…", + "cover_provider": "Apple iTunes", + "source": "azuracast", + "stale": false, + "azuracast_art_used": false, + "updated_at": "2026-07-15T12:00:00Z" + } +} +``` + +`azuracast_art_used` bleibt immer `false` und dient als explizite technische Zusicherung. + +## Speicherung + +Admin-Einstellungen: + +```text +/var/lib/landwelle/settings.json +``` + +Covercache: + +```text +/var/lib/landwelle/covers/ +``` + +Die systemd-Unit verwendet `StateDirectory=landwelle`. Dadurch bleibt `ProtectSystem=strict` aktiv, während nur `/var/lib/landwelle` für den Dienst beschreibbar ist. + +Die Datei `/etc/landwelle/landwelle.env` enthält weiterhin sensible Serverkonfiguration. Sie wird durch den Adminbereich nicht verändert. + +## Cover-Suche + +Die Suchanfrage kombiniert Interpret und Titel. Ergebnisse werden normalisiert und nur bei ausreichender Übereinstimmung akzeptiert. Dadurch sollen falsche Cover bei ähnlichen Songnamen reduziert werden. + +Ein Cover wird standardmäßig 720 Stunden, also 30 Tage, gespeichert. Ein neuer Titel erzeugt eine eigene SHA-256-ID. Bei gleicher Interpret-Titel-Kombination wird derselbe Cacheeintrag wiederverwendet. + +Maximale Bildgröße: + +```text +6 MiB +``` + +Akzeptierte Inhalte: + +```text +image/* +``` + +Weiterleitungen sind begrenzt. Externe Antworten werden mit festen Zeitlimits und Größenlimits verarbeitet. + +## Frontend + +Das Frontend ruft `/api/v1/now` alle 15 Sekunden ab und aktualisiert ohne Neuladen: + +- Interpret +- Titel +- Sendung beziehungsweise Playlist +- Moderator oder Live-DJ +- Cover +- Coverquelle +- Live- und Cachezustand + +Falls AzuraCast vorübergehend nicht erreichbar ist, bleibt die letzte erfolgreiche Anzeige sichtbar und wird als zwischengespeichert markiert. Ohne bisherige Live-Daten erscheint das lokale Fallback. + +## Fehlerdiagnose + +Portalstatus: + +```bash +curl -fsS http://127.0.0.1:2200/health +``` + +Now Playing: + +```bash +curl -fsS http://127.0.0.1:2200/api/v1/now | python3 -m json.tool +``` + +AzuraCast direkt testen: + +```bash +curl -fsS https://stream.slmm.de/api/nowplaying_static/landwelle.json | python3 -m json.tool +``` + +Einstellungen prüfen: + +```bash +sudo -u landwelle cat /var/lib/landwelle/settings.json +``` + +Logs: + +```bash +sudo journalctl -u landwelle-radio -n 100 --no-pager +``` + +Schreibrechte prüfen: + +```bash +sudo -u landwelle test -w /var/lib/landwelle && echo beschreibbar +``` + +## Externe Dokumentation + +- AzuraCast Now Playing: `https://www.azuracast.com/docs/developers/now-playing-data/` +- Apple iTunes Search API: `https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/iTuneSearchAPI/` +- MusicBrainz API: `https://musicbrainz.org/doc/MusicBrainz_API` +- Cover Art Archive API: `https://musicbrainz.org/doc/Cover_Art_Archive/API` + +## Verbindliche Coverregel ab v1.1.7 + +AzuraCast liefert Metadaten, aber kein zu verwendendes Artwork. Angezeigte Cover werden ausschließlich über Apple iTunes ermittelt und serverseitig gecacht. diff --git a/docs/CHART_IMPORT.md b/docs/CHART_IMPORT.md new file mode 100644 index 0000000..876208d --- /dev/null +++ b/docs/CHART_IMPORT.md @@ -0,0 +1,46 @@ +# SLMM-Radio-Chartimport + +**Quelldatei:** `slmmradio_charts.sql` +**Erstimport:** `migrations/0028_slmmradio_charts_import.sql` +**Verbindliche Reparatur und Verifikation:** `migrations/0029_slmmradio_charts_import_repair.sql` + +Die ursprüngliche Datei ist ein MariaDB-/MySQL-Dump und darf nicht direkt gegen die Landwelle-PostgreSQL-Datenbank ausgeführt werden. Migration `0028` enthält die geprüfte PostgreSQL-Konvertierung. + +## Importumfang + +- 120 laufende Chart-Einträge +- 293 Archiveinträge +- 96 Jahresdefinitionen +- 6237 Jahreschart-Einträge +- 1457 redaktionelle Künstler- und Songinformationen + +Nicht übernommen werden historische IP-Adressen, Voting-Fingerprints, Chatnachrichten und sonstige nicht für die neue Chartverwaltung erforderliche personenbezogene Bestandsdaten. + +## Tabellen + +- `chart_entries` +- `chart_archive` +- `chart_years` +- `chart_year_entries` +- `chart_song_infos` + +Beide Migrationen ergänzen erforderliche Spalten und Indizes mit `IF NOT EXISTS` und verwenden `ON CONFLICT`, damit der Datenimport nicht unbeabsichtigt doppelte Datensätze erzeugt. Migration 0029 wiederholt den vollständigen Import unter einer neuen Versionsnummer und prüft abschließend die erwarteten Mindestbestände. Bei einer Abweichung wird die Migration nicht als erfolgreich registriert. + +## Installation + +```bash +./scripts/build-migrator-pi.sh +sudo ./scripts/update-migrations-on-pi.sh +``` + +Migration 0029 kann wegen der mehreren Tausend Datensätze einige Minuten benötigen und darf nicht abgebrochen werden. Danach im Adminbereich `/admin/charts` die sichtbaren Importkennzahlen sowie die Tabs Zuhörer, dockX, SLMM Schlagercharts, Archiv und Jahrescharts prüfen. + +## Kontrolle + +```sql +SELECT chart_key, count(*) FROM landwelle.chart_entries GROUP BY chart_key ORDER BY chart_key; +SELECT count(*) FROM landwelle.chart_archive; +SELECT count(*) FROM landwelle.chart_years; +SELECT count(*) FROM landwelle.chart_year_entries; +SELECT count(*) FROM landwelle.chart_song_infos; +``` diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md new file mode 100644 index 0000000..ab18453 --- /dev/null +++ b/docs/CONFIGURATION.md @@ -0,0 +1,203 @@ +# Konfiguration + +## Aktuelle Werte + +| Variable | Standardwert | Bedeutung | +|---|---|---| +| `ADDR` | `:2200` | Adresse und Port des Go-Webservers | +| `LANDWELLE_STREAM_URL` | `https://stream.slmm.de/listen/landwelle/landwelle` | Livestreamquelle | + +## Geplante PostgreSQL-Werte + +| Variable | Beispiel | Bedeutung | +|---|---|---| +| `DATABASE_URL` | `postgres://landwelle_app:...@db:5432/landwelle?sslmode=require` | vollständige Datenbankverbindung | +| `DB_MAX_OPEN_CONNS` | `10` | maximale offene Verbindungen | +| `DB_MAX_IDLE_CONNS` | `5` | maximale Leerlaufverbindungen | +| `DB_CONN_MAX_LIFETIME` | `30m` | maximale Lebensdauer einer Verbindung | +| `DB_CONNECT_TIMEOUT` | `5s` | Verbindungsaufbau | + +## Geplante RSS-Werte + +| Variable | Standard | Bedeutung | +|---|---|---| +| `RSS_WORKER_ENABLED` | `true` | Importworker aktivieren | +| `RSS_SCHEDULER_TICK` | `1m` | Prüfung auf fällige Feeds | +| `RSS_DEFAULT_INTERVAL` | `10m` | Standardabrufintervall | +| `RSS_HTTP_TIMEOUT` | `15s` | Timeout pro Feed | +| `RSS_MAX_RESPONSE_BYTES` | `5242880` | maximales Feedvolumen | +| `RSS_USER_AGENT` | `LandwelleBot/1.0 (+Kontakt-URL)` | identifizierbarer User-Agent | +| `RSS_MAX_ITEM_AGE` | `14d` | maximale Erstimport-Altersgrenze | +| `RSS_RETENTION_DAYS` | `90` | Aufbewahrung aktiver Feedmetadaten | + +## systemd EnvironmentFile + +Empfohlener Pfad: + +```text +/etc/landwelle/landwelle.env +``` + +Beispiel: + +```text +ADDR=127.0.0.1:2200 +LANDWELLE_STREAM_URL=https://stream.slmm.de/listen/landwelle/landwelle +DATABASE_URL=postgres://landwelle_app:PASSWORT@192.168.1.20:5432/landwelle?sslmode=require +DB_MAX_OPEN_CONNS=10 +DB_MAX_IDLE_CONNS=5 +RSS_WORKER_ENABLED=true +RSS_DEFAULT_INTERVAL=10m +RSS_HTTP_TIMEOUT=15s +RSS_USER_AGENT=LandwelleBot/1.0 (+https://landwelle.de/kontakt) +``` + +Dateirechte: + +```bash +sudo chown root:landwelle /etc/landwelle/landwelle.env +sudo chmod 0640 /etc/landwelle/landwelle.env +``` + +## Adminbereich + +Ohne Neustart administrierbar: + +- Stream-URL +- Sendername und Hero-Texte +- Kontakt- und Social-Links +- sichtbare Regionen +- Startseitengewichtung +- RSS-Quellen, Intervalle, Prioritäten und Regionszuordnungen +- Publikationsmodus und Nutzungsstatus pro Quelle + +Nicht im Adminbereich: + +- Datenbankpasswort und `DATABASE_URL` +- Session- und CSRF-Schlüssel +- SMTP-Passwörter +- private TLS-Schlüssel +- Feedzugangsdaten für geschützte Quellen +- Backup-Zugangsdaten + +## Priorität + +```text +Secrets und Systemumgebung + ↓ +PostgreSQL-Einstellungen aus dem Adminbereich + ↓ +Standardwerte im Code +``` + +## Validierung + +- URLs nur mit erlaubtem Schema +- Datenbankverbindung beim Start testen +- RSS-URLs gegen private und lokale Zielnetze absichern, sofern nicht explizit erlaubt +- Zeitintervalle begrenzen +- Pflichtangaben für Quelle, Attribution und Nutzungsstatus erzwingen +- fehlerhafte Einstellungen dürfen die öffentliche Seite nicht vollständig unbrauchbar machen + +## App- und API-Werte + +| Variable | Standard | Bedeutung | +|---|---|---| +| `LANDWELLE_PUBLIC_BASE_URL` | `https://landwelle.de` | Basis für absolute Asset- und Inhalts-URLs | +| `LANDWELLE_APP_PUSH_ENCRYPTION_KEY` | leer | 32-Byte-Schlüssel als Base64 oder Hex für AES-256-GCM-Push-Token-Speicherung | +| `LANDWELLE_APP_ANALYTICS_ENABLED` | `false` | Annahme freiwilliger Nutzungsereignisse aktivieren | +| `LANDWELLE_APP_ANDROID_SIDELOAD_ENABLED` | `false` | Sideload/Test-Download im Bootstrap freigeben | +| `LANDWELLE_APP_GOOGLE_PLAY_ENABLED` | `false` | Google-Play-Verfügbarkeit im Bootstrap freigeben | +| `LANDWELLE_APP_IOS_ENABLED` | `false` | iOS/App-Store-Verfügbarkeit im Bootstrap freigeben | +| `LANDWELLE_APP_BETA_ENABLED` | `true` | vorübergehenden App-Beta-Aufruf auf der Startseite anzeigen | +| `LANDWELLE_APP_BETA_GROUP_URL` | `https://groups.google.com/g/landwelle-betatest` | Ziel des Teilnahmebuttons | +| `LANDWELLE_APP_BETA_GROUP_EMAIL` | `landwelle-betatest@googlegroups.com` | sichtbare Gruppenadresse im Beta-Bereich | + +Schlüssel erzeugen: + +```bash +openssl rand -base64 32 +``` + +Der Schlüssel gehört ausschließlich in `/etc/landwelle/landwelle.env` und nicht ins Repository. Wird er später geändert, sind bestehende verschlüsselte Push-Tokens nicht mehr entschlüsselbar und müssen von den Apps neu registriert werden. + +## Firebase- und Push-Secrets + +| Variable | Bedeutung | +|---|---| +| `FIREBASE_PROJECT_ID` | Firebase-Projekt | +| `FIREBASE_SERVICE_ACCOUNT_FILE` | Absoluter serverseitiger Pfad zur Service-Account-JSON | +| `LANDWELLE_TODO_JENS_USER_ID` | Eindeutige Benutzer-ID für den Jens-Todo-Push | +| `LANDWELLE_MOBILE_API_TOKEN` | Optionaler Bearer-Token der internen Landwelle-IT-App-API | +| `PUSH_WORKER_ENABLED` | späteren Push-Worker aktivieren | +| `PUSH_BATCH_SIZE` | Batchgröße beim Versand | + +Die App-API kann Push-Tokens bereits registrieren und verschlüsselt speichern. Der eigentliche Kampagnenversand bleibt deaktiviert, solange `PUSH_WORKER_ENABLED=false` ist beziehungsweise kein Versandworker betrieben wird. + +Beispiel: + +```text +LANDWELLE_PUBLIC_BASE_URL=https://landwelle.de +LANDWELLE_APP_PUSH_ENCRYPTION_KEY= +LANDWELLE_APP_ANALYTICS_ENABLED=false +LANDWELLE_APP_ANDROID_SIDELOAD_ENABLED=true +LANDWELLE_APP_GOOGLE_PLAY_ENABLED=false +LANDWELLE_APP_IOS_ENABLED=false +LANDWELLE_APP_BETA_ENABLED=true +LANDWELLE_APP_BETA_GROUP_URL=https://groups.google.com/g/landwelle-betatest +LANDWELLE_APP_BETA_GROUP_EMAIL=landwelle-betatest@googlegroups.com +FIREBASE_PROJECT_ID=landwelle-radio +FIREBASE_SERVICE_ACCOUNT_FILE=/etc/landwelle/firebase-service-account.json +LANDWELLE_TODO_JENS_USER_ID= +LANDWELLE_MOBILE_API_TOKEN= +PUSH_WORKER_ENABLED=false +``` + +Dateirechte für Environment- und Firebase-Dateien: nur für Root und Dienstgruppe lesbar. + +Für den Jens-Todo-Push wird `LANDWELLE_TODO_JENS_USER_ID` ausdrücklich empfohlen. Das Portal vergleicht dann `author_user_id` und `created_by_user_id` gegen diese unveränderliche ID. Ohne konfigurierte ID wird nur auf ein eindeutig auflösbares aktives Benutzerkonto `Jens` zurückgegriffen. + +Die interne App verwendet: + +```text +https://api.landwelle.de/api/mobile/todos?author=Jens +https://api.landwelle.de/api/mobile/status +``` + +Wenn `LANDWELLE_MOBILE_API_TOKEN` gesetzt ist, muss die App ihn als `Authorization: Bearer ...` senden. + +## AzuraCast und Cover ab v11 + +Die folgenden Environment-Werte sind Startvorgaben. Sobald im Adminbereich gespeichert wurde, haben die Werte aus `/var/lib/landwelle/settings.json` Vorrang: + +```dotenv +LANDWELLE_AZURACAST_ENABLED=true +LANDWELLE_AZURACAST_BASE_URL=https://stream.slmm.de +LANDWELLE_AZURACAST_STATION=landwelle +LANDWELLE_AZURACAST_STATIC=true +LANDWELLE_AZURACAST_POLL_SECONDS=15 +LANDWELLE_AZURACAST_TIMEOUT=8s + +LANDWELLE_COVER_ITUNES_ENABLED=true +LANDWELLE_COVER_MUSICBRAINZ_ENABLED=true +LANDWELLE_COVER_COUNTRY=DE +LANDWELLE_COVER_CACHE_HOURS=720 +LANDWELLE_COVER_TIMEOUT=8s +LANDWELLE_STATE_DIR=/var/lib/landwelle +``` + +Die Runtime-Datei enthält keine Adminpasswörter, Datenbankkennwörter oder Firebase-Schlüssel. + + +## YouTube und Landwelle OnTour + +| Variable | Standard | Bedeutung | +|---|---|---| +| `LANDWELLE_YOUTUBE_CHANNEL_URL` | `https://www.youtube.com/@landwelle` | Öffentliche Kanalseite zur automatischen Ermittlung der Kanal-ID | +| `LANDWELLE_YOUTUBE_CHANNEL_ID` | leer | Optionale feste YouTube-Kanal-ID, falls die automatische Ermittlung nicht möglich ist | + +Die Variablen enthalten keine geheimen Zugangsdaten. Für den öffentlichen Atom-Feed ist kein API-Schlüssel erforderlich. Ist keine Kanal-ID auflösbar oder YouTube vorübergehend nicht erreichbar, rendert `/ontour` eine stabile Fallbackseite. + +## Öffentliche Anfragen und SMTP + +Werbe- und Branchenbuchanfragen werden zuerst in PostgreSQL gespeichert. Anschließend werden die interne Benachrichtigung und die Bestätigung über die vorhandenen SMTP-Einstellungen versendet. Maßgebliche Werte sind `LANDWELLE_SMTP_ENABLED`, `LANDWELLE_SMTP_HOST`, `LANDWELLE_SMTP_PORT`, `LANDWELLE_SMTP_USER`, `LANDWELLE_SMTP_PASSWORD`, `LANDWELLE_SMTP_FROM_EMAIL` und `LANDWELLE_ADMIN_EMAIL`. Standardziel für interne Anfragen ist `radio@landwelle.de`. Ein E-Mail-Fehler verwirft den gespeicherten Datensatz nicht. diff --git a/docs/CONTENT_MODEL.md b/docs/CONTENT_MODEL.md new file mode 100644 index 0000000..4e8ea53 --- /dev/null +++ b/docs/CONTENT_MODEL.md @@ -0,0 +1,271 @@ +# Inhalts- und Datenmodell + +Dieses Dokument beschreibt das fachliche Zielmodell für PostgreSQL. Eigene Landwelle-Inhalte und externe RSS-Meldungen werden bewusst getrennt gespeichert. + +## Article + +Eigener Landwelle-Beitrag, Bericht, Ausflugstipp oder redaktionelle Geschichte. + +| Feld | Bedeutung | +|---|---| +| `id` | interne ID | +| `title` | Überschrift | +| `slug` | stabiler URL-Teil | +| `teaser` | Kurztext | +| `body` | eigener Hauptinhalt | +| `category_id` | Kategorie | +| `primary_region_id` | Hauptregion | +| `hero_media_id` | Titelbild | +| `status` | Entwurf, Prüfung, veröffentlicht, archiviert | +| `published_at` | Veröffentlichungszeitpunkt | +| `expires_at` | optionales Ablaufdatum | +| `author_id` | verantwortlicher Nutzer | +| `created_at` | Anlagezeitpunkt | +| `updated_at` | letzter Änderungszeitpunkt | + +## FeedSource + +Konfiguration und rechtlicher Status einer externen RSS-/Atom-Quelle. + +| Feld | Bedeutung | +|---|---| +| `id` | interne ID | +| `name` | sichtbarer Quellenname | +| `feed_url` | RSS-/Atom-Adresse | +| `website_url` | Website der Quelle | +| `source_type` | Kommune, Landkreis, Medium, Behörde, Landwirtschaft, Kultur usw. | +| `enabled` | wird abgerufen | +| `publication_mode` | automatisch oder Prüfung | +| `rights_status` | erlaubt, Freigabe erforderlich, nur nichtkommerziell, gesperrt | +| `allow_title` | Überschrift darf angezeigt werden | +| `allow_summary` | Anrisstext darf angezeigt werden | +| `allow_image` | Feedbild darf verwendet werden | +| `attribution_text` | vorgeschriebene Quellenangabe | +| `fetch_interval_seconds` | Abrufintervall | +| `priority` | redaktionelle Gewichtung | +| `etag` | letzter ETag-Wert | +| `last_modified` | letzter Last-Modified-Wert | +| `last_success_at` | letzter erfolgreicher Abruf | +| `last_error_at` | letzter Fehler | +| `consecutive_failures` | Fehlerzähler | +| `created_at` | Anlagezeitpunkt | +| `updated_at` | Änderung | + +## FeedItem + +Normalisierte externe Meldung. Der Volltext der Originalseite wird nicht übernommen. + +| Feld | Bedeutung | +|---|---| +| `id` | interne ID | +| `source_id` | FeedSource | +| `external_id` | GUID oder stabiler Quellenschlüssel | +| `canonical_url` | Originalartikel | +| `title` | Überschrift | +| `summary` | bereinigter Anrisstext, soweit erlaubt | +| `author` | optionale Quellenangabe | +| `published_at` | Veröffentlichungszeitpunkt der Quelle | +| `updated_at_source` | Aktualisierung laut Quelle | +| `fetched_at` | Abrufzeitpunkt | +| `image_url` | Bildadresse, nur bei erlaubter Nutzung | +| `language` | Sprache | +| `content_hash` | Fingerabdruck zur Deduplizierung | +| `status` | importiert, veröffentlicht, ausgeblendet, Duplikat | +| `reviewed_by` | optionaler Redaktionsnutzer | +| `metadata` | ergänzende strukturierte Metadaten als JSONB | + +## FeedFetchRun + +Pro Abrufversuch: + +| Feld | Bedeutung | +|---|---| +| `id` | interne ID | +| `source_id` | FeedSource | +| `started_at` | Start | +| `finished_at` | Ende | +| `http_status` | HTTP-Status | +| `items_seen` | gelesene Einträge | +| `items_inserted` | neue Einträge | +| `items_updated` | aktualisierte Einträge | +| `not_modified` | HTTP 304 erhalten | +| `error_code` | normalisierter Fehler | +| `error_message` | begrenzte technische Beschreibung | + +## Region + +Die Abdeckung orientiert sich an Landkreisen, Region Hannover und kreisfreien Städten. Zusätzlich können redaktionelle Großräume als Elternregionen angelegt werden. + +| Feld | Bedeutung | +|---|---| +| `id` | interne ID | +| `name` | Regionsname | +| `slug` | URL-Teil | +| `kind` | Großraum, Landkreis, Region Hannover, kreisfreie Stadt oder lokal | +| `parent_id` | optionale übergeordnete Region | +| `official_code` | optionaler amtlicher Schlüssel | +| `active` | sichtbar oder verborgen | +| `sort_order` | Reihenfolge | + +Zuordnungstabellen: + +- `feed_source_regions` +- `feed_item_regions` +- `article_regions` +- `event_regions` + +## Category + +Beispiele: Landwirtschaft, Politik, Verkehr, Feuerwehr, Vereine, Kultur, Wirtschaft, Umwelt, Tourismus und Ausflugstipps. + +| Feld | Bedeutung | +|---|---| +| `id` | interne ID | +| `name` | Name | +| `slug` | URL-Teil | +| `color` | optionale Akzentangabe | +| `sort_order` | Reihenfolge | + +## Event + +| Feld | Bedeutung | +|---|---| +| `id` | interne ID | +| `title` | Veranstaltungsname | +| `slug` | URL-Teil | +| `description` | Beschreibung | +| `starts_at` | Beginn | +| `ends_at` | optionales Ende | +| `venue_name` | Veranstaltungsort | +| `address` | Anschrift | +| `primary_region_id` | Hauptregion | +| `organizer` | Veranstalter | +| `external_url` | Veranstaltungsseite | +| `ticket_url` | Ticketlink | +| `hero_media_id` | Bild | +| `status` | Entwurf, Prüfung, veröffentlicht, archiviert | +| `created_at` | Anlagezeitpunkt | +| `updated_at` | letzter Änderungszeitpunkt | + +## ProgramSlot, Show, Presenter und NowPlaying + +Diese Modelle bleiben wie bisher vorgesehen. Programmdaten werden in PostgreSQL gespeichert; Now-Playing-Daten können kurzzeitig gecacht oder als Historie persistiert werden. + +## SiteSetting + +Nur nicht geheime, administrierbare Werte. + +Beispiele: + +```text +stream.url +hero.title +hero.subtitle +news.homepage_limit +news.statewide_ratio +weather.location +contact.editorial_email +``` + +## User, Session und AuditEvent + +- Benutzer mit Rollen Administrator, Redaktion und Autor +- widerrufbare Sessions mit Ablaufzeit +- Auditprotokoll für alle schreibenden Aktionen +- keine Secrets oder Passwortwerte in normalen Einstellungs- oder Auditdatensätzen + +## Deduplizierung + +Reihenfolge: + +1. eindeutige Kombination aus Quelle und GUID +2. normalisierte kanonische URL +3. Inhaltsfingerabdruck aus Titel, Datum und Quelle +4. optionale redaktionelle Duplikatmarkierung über mehrere Quellen hinweg + +## Aufbewahrung + +- aktive Feedmeldungen: konfigurierbarer Zeitraum, beispielsweise 90 Tage +- Metadaten älterer Meldungen können archiviert oder gelöscht werden +- Abrufprotokolle werden nach festgelegter Frist verdichtet +- eigene Landwelle-Artikel werden nicht automatisch gelöscht +- Lösch- und Archivierungsjobs werden protokolliert + +--- + +## AppInstallation + +Anonyme technische Installation der Android- oder iOS-App. + +| Feld | Bedeutung | +|---|---| +| `id` | zufällige Installations-UUID | +| `installation_token_hash` | Hash des Client-Secrets | +| `platform` | Android oder iOS | +| `device_class` | Telefon, Tablet oder unbekannt | +| `distribution_channel` | Sideload, Google Play, App Store, Direct usw. | +| `app_version` | semantische Version | +| `app_build` | Buildnummer | +| `os_version` | Betriebssystemversion | +| `locale` | Sprache/Region | +| `timezone` | Zeitzone | +| `preferred_region_slug` | bevorzugte redaktionelle Region | +| `notifications_enabled` | Push-Einwilligung/Status | +| `analytics_consent` | Statistik-Einwilligung | +| `first_seen_at` | erster Kontakt | +| `last_seen_at` | letzter Kontakt | + +Keine IMEI, Seriennummer, Advertising ID oder exakte Position. + +## AppPushToken + +| Feld | Bedeutung | +|---|---| +| `installation_id` | zugehörige Installation | +| `provider` | FCM, Webpush oder native Erweiterung | +| `token_ciphertext` | verschlüsselter Versandtoken | +| `token_fingerprint` | nicht reversibler Duplikatschlüssel | +| `environment` | Entwicklung, Staging oder Produktion | +| `active` | aktuell verwendbar | +| `last_error_code` | letzter normalisierter Fehler | + +## PushTopic + +Themen für Eilmeldungen, Regionen, Kategorien und Sendungen. + +## PushCampaign + +| Feld | Bedeutung | +|---|---| +| `title` | Notification-Titel | +| `body` | kurzer Nachrichtentext | +| `image_url` | optionales Bild | +| `deep_link` | Ziel in App oder Portal | +| `target` | Plattformen, Regionen, Themen, Versionen | +| `priority` | normal oder high | +| `status` | Entwurf, geplant, sendend, gesendet usw. | +| `created_by` | Ersteller | +| `approved_by` | optionaler Freigeber | +| `sent_count` | von FCM akzeptiert | +| `failed_count` | Versandfehler | +| `opened_count` | über App zurückgemeldete Öffnungen | + +## AppUsageEvent und AppUsageDaily + +Rohereignisse werden nur bei Einwilligung und mit kurzer Aufbewahrung gespeichert. Ein Aggregationsjob erzeugt Tageswerte nach Plattform, Version und Region. + +## AppRelease + +| Feld | Bedeutung | +|---|---| +| `platform` | Android, iOS, Windows, Linux oder macOS | +| `architecture` | universal, amd64, arm64 usw. | +| `channel` | Sideload, Store, Direct, Beta | +| `version` | Version | +| `build_number` | Buildkennung | +| `minimum_os_version` | Mindestbetriebssystem | +| `download_url` | direkter Download | +| `store_url` | Store-Link | +| `sha256` | Prüfsumme | +| `mandatory` | zwingendes Update | +| `published` | öffentlich sichtbar | diff --git a/docs/CONTENT_PAGES.md b/docs/CONTENT_PAGES.md new file mode 100644 index 0000000..181cbc2 --- /dev/null +++ b/docs/CONTENT_PAGES.md @@ -0,0 +1,95 @@ +# Öffentliche Inhaltsseiten + +**Stand: Landwelle v1.5.26** + +## Redaktionsfähige Seiten + +Die folgenden Seiten werden aus PostgreSQL geladen und im Adminbereich gepflegt: + +```text +/presse → /admin/presse +/karriere → /admin/karriere +/faq → /admin/faq +/kontakt → /admin/kontakt +/mediathek → /admin/mediathek +``` + +Presse, Karriere, FAQ und Kontakt bestehen aus: + +- Kicker +- Seitentitel +- Einleitung +- Kontaktadresse +- sortierbaren Inhaltsblöcken +- optionalem Link beziehungsweise Call-to-Action +- sichtbaren und ausgeblendeten Blöcken + +Ausgeblendete Blöcke bleiben im Adminbereich sichtbar, werden öffentlich aber serverseitig entfernt. + +## Mehrzeilige Texte und Absätze + +Texte aus Presse, Karriere, FAQ und Kontakt werden als reiner Text gespeichert. Leerzeilen erzeugen bei der öffentlichen Ausgabe eigene Absätze; einzelne Zeilenumbrüche bleiben als Zeilenumbruch erhalten. HTML aus dem Editor wird nicht direkt ausgeführt, sondern escaped. + +Version 1.5.22 erkennt zusätzlich ältere Daten, in denen `\n` oder `\r\n` versehentlich als sichtbare Zeichenfolge gespeichert wurden. Migration `0035_press_paragraph_breaks.sql` bereinigt diese Altwerte im Pressebereich; die Laufzeitnormalisierung schützt außerdem Fallbacks und spätere Importe. + +## Kontakt + +Das Kontaktformular speichert Anfragen in `landwelle.contact_messages`. + +Schutzmaßnahmen: + +- Body-Größenlimit +- Pflichtfelder und Datenschutzbestätigung +- strenge E-Mail-Validierung +- Honeypot-Feld +- 45-Sekunden-Rate-Limit +- serverseitiges Escaping durch Go-Templates + +Status: + +```text +new +in_progress +answered +archived +``` + +## Mediathek + +Die Mediathek speichert Sendungen, KI-Beiträge, Interviews, Beiträge und Specials. Audio wird als MP3, M4A, OGG oder WAV geprüft und im Landwelle-Medienspeicher abgelegt. + +Der Kopfbereich von `/mediathek` verwendet die eingebettete, textfreie Landwelle-Grafik `web/assets/mediathek-hero-landwelle-v1.webp`. Überschrift und Einleitung bleiben als HTML erhalten; dadurch sind sie responsiv, zugänglich und unabhängig vom Bild austauschbar. + +Fertige Produktionen aus dem Nachrichtenstudio können als nichtöffentlicher Entwurf übernommen werden. Eine redaktionelle Prüfung vor der öffentlichen Freigabe bleibt verpflichtend. + +## Weitere öffentliche Bereiche + +```text +/ueber-landwelle +/team +/werbung +/ontour +/branchenbuch +/app +/moderatoren +/frequenzen +/nachricht-senden +/veranstaltung-eintragen +/gewinnspiele +/impressum +/datenschutz +``` + +Der frühere Menüpunkt `/fotos-videos` wird nicht mehr öffentlich angeboten. + +## Rechtlicher Hinweis + +Impressum, Datenschutz, Consenttexte, Aufbewahrungsfristen und Formulierungen für Presse-/Sponsorenkennzahlen müssen vor dem produktiven Einsatz mit den tatsächlichen Abläufen abgeglichen und rechtlich geprüft werden. + +## Erster Pressebericht + +Migration `0034_press_beta_release.sql` legt auf bestehenden Installationen den Beitrag „Landwelle Android-App startet in den Beta-Test“ an. Der Text verweist auf die offene Google-Gruppe `landwelle-betatest@googlegroups.com` und nennt die SLMM GbR als Entwickler und Bereitsteller. Der Block kann anschließend wie alle Presse-Inhalte unter `/admin/presse` bearbeitet oder ausgeblendet werden. + +## KI-Transparenzseite + +`/ki-transparenz` ist eine statische öffentliche Rechtstransparenzseite. Sie erläutert Text-, Bild- und Audioeinsatz, synthetische Stimmen, Jahreschart-Informationen, menschliche Prüfung und redaktionelle Verantwortung. Der Footer verlinkt die Seite dauerhaft. diff --git a/docs/COOKIE_CONSENT.md b/docs/COOKIE_CONSENT.md new file mode 100644 index 0000000..97b0c81 --- /dev/null +++ b/docs/COOKIE_CONSENT.md @@ -0,0 +1,53 @@ +# Cookie-Consent im Landwelle-Portal + +**Stand: Landwelle v1.5.26 / `app-v16.js`** + +## Kategorien + +- **Notwendig:** Consententscheidung und technisch erforderliche Funktionen. +- **Statistik:** optionale, pseudonyme First-Party-Reichweitenmessung. +- **Externe Medien:** optionale Einbettungen wie externe Videos. + +Die freiwilligen Kategorien werden erst nach ausdrücklicher Zustimmung aktiviert. Der Livestream startet unabhängig davon erst nach einem bewussten Klick. + +## Speicherung + +Die Auswahl gilt 180 Tage und wird gespeichert als: + +- Local-Storage-Eintrag `landwelle-consent-v1` +- First-Party-Cookie `landwelle_consent` + +Das Cookie verwendet `Path=/`, `SameSite=Lax`, eine begrenzte Lebensdauer und unter HTTPS das Attribut `Secure`. Es wird auch dann gesetzt, wenn Local Storage verfügbar ist, weil der Server die Statistik-Einwilligung damit vor dem Speichern eines Pageviews prüft. + +## Statistik + +Die Statistik wird nur gestartet, wenn: + +- `analytics=true` in der gültigen Einwilligung steht, +- kein Global Privacy Control Signal aktiv ist, +- Do Not Track nicht aktiviert ist, +- die Seite keine Adminseite ist. + +Der Server prüft zusätzlich Same-Origin, Content-Type, Rate-Limit und das gültige Consent-Cookie. Admin-, API-, Medien- und Assetpfade werden nicht gespeichert. + +## Widerruf + +Im Footer öffnet **Cookie-Einstellungen** den Dialog erneut. Eine geänderte Entscheidung wird sofort angewendet. Nach Ablauf oder Änderung der Consent-Version wird erneut gefragt. + +## JavaScript-Schnittstelle + +```javascript +window.landwelleConsent.get(); +window.landwelleConsent.has('analytics'); +window.landwelleConsent.has('externalMedia'); +window.landwelleConsent.open(); +``` + +Änderungen lösen `landwelle:consent-changed` aus. + +## Regeln + +1. Optionale Skripte und Einbettungen dürfen vor der passenden Einwilligung nicht geladen werden. +2. Bei wesentlichen Zweckänderungen muss `CONSENT_VERSION` erhöht werden. +3. Datenschutzerklärung und Dialogtext müssen denselben tatsächlichen Stand beschreiben. +4. Die finale rechtliche Prüfung bleibt erforderlich. diff --git a/docs/CURRENT_STATE.md b/docs/CURRENT_STATE.md new file mode 100644 index 0000000..34575c6 --- /dev/null +++ b/docs/CURRENT_STATE.md @@ -0,0 +1,89 @@ +# Aktueller Projektstand + +**Version:** Landwelle v1.5.58 +**Stand:** 23. September 2026 +**Datenbankstand:** bis Migration `0040`; Produktivmigration `0039_event_categories_admin.sql` belegt die Nummer 0039 + +## Betriebsmodell + +Das Portal ist ein Go-Monolith mit eingebetteten Templates und Assets. PostgreSQL ist die einzige Datenbank. Produktiv läuft das Portal auf Linux ARM64 hinter dem vorhandenen Reverse Proxy; intern lauscht es standardmäßig auf Port `2200`. + +## Öffentliche Website + +Aktiv sind insbesondere Livestream und Player, Programm, Playlist, Nachrichten, Veranstaltungen, Verkehr, Ausflugstipps, Wünsche und Grüße, Team, Forum, Charts, OnTour, Werbung, Branchenbuch, Stellenbörse, Presse, Karriere, FAQ, Kontakt, Mediathek und die neue Seite „Landwelle Zuhause“ unter `/zuhause/landwelle`. Die öffentliche Navigation wird in PostgreSQL gepflegt und besitzt eine sichere Standardkonfiguration als Fallback. + +Die Startseite enthält vorübergehend einen responsiven Aufruf zum Landwelle-App-Beta-Test. Der Button führt zur offenen Google-Gruppe `landwelle-betatest`; Anmeldung und Mitgliedschaft werden vollständig durch Google Groups abgewickelt. Das Portal erfasst dabei keine Google-Zugangsdaten. Über `LANDWELLE_APP_BETA_ENABLED=false` lässt sich der vorübergehende Bereich später ohne Codeänderung deaktivieren. + +Die Chartbereiche umfassen Zuhörer-, docX-, Schlager- und Jahrescharts. Votingstatus und Sperrzeit kommen serverseitig aus PostgreSQL. Während der 24-Stunden-Sperre sind die Bewertungsbuttons ausgeblendet und ein klarer Countdown wird angezeigt. + +„Landwelle vor Ort“ wird aus veröffentlichten Redaktionseinträgen gespeist. Liegt kein Beitrag vor, zeigt die Startseite einen ehrlichen Leerzustand. Einzelne oder ungerade Anzahlen von Beiträgen bleiben auf Smartphones sichtbar; die allgemeine Kartenregel blendet den letzten Regionalbeitrag nicht mehr aus. + +## Administration + +Der Adminbereich verwaltet Programm, Team, Medien, Redaktion, Veranstaltungen, Navigation, Charts, Mediathek, öffentliche Inhaltsseiten, Kontaktanfragen, Forum, Benutzer, Rollen, E-Mail-Vorlagen, Downloads, Todo-Board, Audit und Systemeinstellungen. + +`/admin/statistik` zeigt einwilligungsbasierte und pseudonyme First-Party-Werte zu Besuchern, Sitzungen und Seitenaufrufen. Admin-, API-, Asset- und Medienzugriffe werden nicht erfasst. Exporte stehen als CSV bereit. Die Tageskurve verwendet den PostgreSQL-sicheren Alias `visit_date`. + +## KI und Audio + +Das Nachrichtenstudio verbindet redaktionell kontrollierte RSS-Quellen mit OpenAI, ElevenLabs, ffmpeg und FTP. Produktionsläufe erzeugen getrennte Text- und Audioausgaben und können fertige Audios als nichtöffentlichen Mediathek-Entwurf übernehmen. Neue synthetische Sprachdateien erhalten zentral einen gesprochenen KI-Hinweis. Redaktion, Mediathek und Medienverwaltung dokumentieren KI-Art, menschliche Prüfung, redaktionelle Verantwortung und einen öffentlichen Transparenztext. Öffentliche Kennzeichnungen erscheinen am ersten Kontaktpunkt und zusätzlich in maschinenlesbaren HTML-Attributen. Die Seite `/ki-transparenz` beschreibt den Einsatz. Eine persistente Jobqueue mit Retry und Wiederaufnahme ist noch nicht umgesetzt. + +## Forum und Community + +Das Forum besitzt Forenübersicht, Kategorien, Themen und Beiträge, Benutzerprofile im MyBB-Stil, Ränge, Sterne, Beitrags- und Themenzahlen, Dankeschöns, Lesestatus, Neu-Markierungen, sichere BBCodes und Emoticons. Bild-BBCode und freie HTML-Bilder bleiben gesperrt. + +## Apps und Push + +Die öffentliche Android-/iOS-App ist ein getrenntes Flutter-Projekt und nutzt ausschließlich API v1 unter `https://api.landwelle.de/v1`. Der Vertrag liegt in `openapi/landwelle-app-api.yaml`. + +Die interne Android-App `de.landwelle.itmonitor` nutzt die dokumentierte API unter `/api/mobile`. Todo-Pushs werden über Firebase versendet. Eine tatsächliche Verarbeitung in der App kann über `POST /api/mobile/todos/push-receipt` bestätigt werden. + +## Aktueller Releasehinweis + +Version 1.5.58 ergänzt unter „Mitmachen“ die öffentliche Seite „Landwelle Zuhause“ für die digitale Landwelle-Welt in OpenGenesisLINK. Die Seite enthält vorbereitete Bildflächen und eine Slideshow, stellt Radio-Sendestation, Events, Festzelt und DJ Jens vor und erklärt den späteren Zugang über den OpenGenesisLINK Viewer. Migration `9000_landwelle_zuhause_navigation.sql` ergänzt den neuen Menüpunkt in bestehenden PostgreSQL-Installationen. + +Version 1.5.24 setzt die KI-Transparenzpflichten für redaktionelle Texte, Bilder, synthetische Audios und KI-generierte Chartinformationen um. Migration `0037_ai_transparency.sql` ergänzt die Metadaten; die öffentliche Transparenzseite und sichtbare Hinweise werden in den betroffenen Ansichten ausgegeben. + +Version 1.5.23 korrigiert die Chartauswertung und das wiederholte Frontend-Voting. Akzeptierte Stimmen werden dauerhaft in `chart_vote_history` gespeichert, während `chart_votes` die 24-Stunden-Sperre verwaltet. Die Adminanzeige ist schreibgeschützt, und die Generierung sortiert nach dem aktuellen Gesamtstand. + +Version 1.5.22 korrigiert die Darstellung mehrteiliger Pressetexte und aller verwalteten Inhaltsblöcke. Das Portal erkennt echte Zeilenumbrüche sowie ältere literal gespeicherte `\n`- und `\r\n`-Sequenzen. Leerzeilen werden als eigene Absätze ausgegeben, einzelne Zeilenumbrüche bleiben sichtbar, und der Inhalt wird vor der Ausgabe HTML-escaped. Migration `0035_press_paragraph_breaks.sql` bereinigt bereits gespeicherte Pressetexte. + +Version 1.5.20 platziert den vorübergehenden App-Beta-Bereich kompakt am Ende der Startseite direkt vor dem Footer. Interessierte öffnen über den primären Button die Google-Gruppe `landwelle-betatest`, treten dort ohne manuelle Freigabe bei und erhalten den vorgesehenen Testzugang. Der Abschnitt ist im Template ausdrücklich als temporär markiert. Es gibt keine neue Migration und keine Änderung der API-Verträge. + +Version 1.5.17 trennt die Redaktion in die Tabs „Inhalte“, „Inhalt anlegen“ und „Kategorien“. Kategorien werden in einem Modal angelegt. Die Inhaltsliste zeigt Kategorie, Status, Verteilungswege und den tatsächlichen Facebook-Übertragungsstatus. Facebook-Beiträge verwenden die öffentliche Landwelle-vor-Ort-URL; Fehler werden gespeichert, angezeigt und können gezielt erneut gesendet werden. Eine Live-Vorschau zeigt Text, Bild und Zielseite vor dem Speichern. Es gibt keine neue Migration und keine Änderung der API-Verträge. + +Version 1.5.16 stellt alle numerischen Eingaben der Chartverwaltung als normale Textfelder mit numerischer Eingabehilfe dar. Die Positionsspalte ist breiter, die Ziffern sind klarer ausgerichtet und Browser-Spinner werden nicht mehr angezeigt. Die serverseitige Validierung und Speicherung bleiben unverändert. Es gibt keine neue Migration und keine Änderung der API-Verträge. + +Version 1.5.14 stattet `/mediathek` mit einer neuen, textfreien Landwelle-Herografik aus. Das Bild liegt optimiert als WebP im eingebetteten Assetbestand, wird als Hero-Bild vorgeladen und auf kleinen Bildschirmen mit angepasstem Bildausschnitt dargestellt. Überschrift und Einleitung bleiben zugänglicher HTML-Text. Es gibt keine neue Migration und keine Änderung der API-Verträge. + +## Noch offene Hauptthemen + +- persistente Produktionswarteschlange und Retry-Strategien +- erweiterter redaktioneller Freigabeworkflow +- Mediathek-Reihen, automatische Dauer, Suche und Dateibereinigung +- Sponsorenauswertungen mit Vergleichszeiträumen und klarer Messdefinition +- weitere Forum-Moderations- und Benachrichtigungsfunktionen +- Ausbau der Todo-App-Quittierung und Geräteübersicht +- höhere automatisierte Testabdeckung älterer Admin- und Integrationspfade + +Verbindliche Details stehen in `README.md`, `ROADMAP.md`, `CHANGELOG.md` und `CHATUEBERGABE.md`. + +## Chartverwaltung und Presse in v1.5.21 + +Die Chartverwaltung enthält nur einen Arbeitsbereich pro gewähltem Chart. `L = Leeren` setzt die sichtbaren Inhalte der betroffenen Zeile zurück, ohne die Position oder andere Zeilen zu löschen. Solche leeren Zeilen bleiben als redaktionelle Arbeitsplätze im Admin erhalten, werden aber aus öffentlichen Chartseiten und App-Ausgaben herausgefiltert. Die Generierung darf jederzeit erneut ausgeführt werden; gespeichert wird weiterhin der letzte Auswertungszeitpunkt. + +Die öffentliche Presseseite enthält als ersten Pressebericht die Freigabe der Landwelle-Android-App zum Beta-Test. Die Migration `0034_press_beta_release.sql` ergänzt den Beitrag auf bestehenden Installationen. Das Impressum nennt die SLMM GbR als verantwortlich für Design und Konzept. + +## Erweiterung v1.5.25 + +Die Teamverwaltung unterscheidet reale Teammitglieder und KI-/virtuelle Persönlichkeiten. Öffentliche Teamprofile und verknüpfte Programme zeigen eine eindeutige Kennzeichnung. In der Mediengalerie können vorhandene Bilder nachträglich klassifiziert und mit einem sichtbaren KI-Wasserzeichen versehen werden. Die zentrale Einstellung wird in Redaktion, Team, Programm und Mediathek übernommen, wenn die jeweilige Bildadresse aus der Mediengalerie stammt. + + +## Router-Korrektur v1.5.58 + +`/ueber-landwelle` wird ausschließlich als verwaltete öffentliche Seite registriert. Der frühere gleichnamige Eintrag in `contentPages()` wurde entfernt, damit die dynamische statische Seitenschleife keine zweite identische ServeMux-Route erzeugt. + + +### Landwelle vor Ort URL-Struktur (v1.5.62) + +Die Gesamtübersicht bleibt `/landwelle-vor-ort`. Freigeschaltete Redaktionskategorien erhalten Kategorieübersichten unter `/landwelle-vor-ort/`. Beiträge verwenden `/landwelle-vor-ort//`. Frühere Links ohne Kategorie werden mit HTTP 301 auf den kanonischen Pfad umgeleitet. diff --git a/docs/DATABASE_MIGRATOR.md b/docs/DATABASE_MIGRATOR.md new file mode 100644 index 0000000..c17ae2d --- /dev/null +++ b/docs/DATABASE_MIGRATOR.md @@ -0,0 +1,118 @@ +# Automatischer PostgreSQL-Migrator + +Landwelle enthält ein eigenes Go-Werkzeug für PostgreSQL-Migrationen. Es liest `DATABASE_URL` aus `/etc/landwelle/landwelle.env`, sucht SQL-Dateien im Ordner `migrations/`, führt sie numerisch sortiert aus und verschiebt erfolgreiche Dateien nach `migrations/applied/`. + +## Verhalten + +Beispiel: + +```text +migrations/0001_postgresql_core.sql +``` + +wird nach erfolgreichem Import zu: + +```text +migrations/applied/0001_postgresql_core.sql.applied +``` + +Eine fehlgeschlagene Datei bleibt unverändert im normalen Migrationsordner. Der Migrator beendet sich beim ersten Fehler mit einem Fehlercode. + +Zusätzlich führt PostgreSQL die Tabelle `landwelle.schema_migrations`. Sie ist die verlässliche Historie. Das Verschieben der Dateien dient der einfachen Bedienung und Übersicht. Wird bei einem späteren Update eine bereits ausgeführte Datei erneut geliefert, erkennt der Migrator sie anhand von Versionsnummer und SHA-256-Prüfsumme und verschiebt sie ohne erneute Ausführung ins Archiv. + +## Voraussetzung + +In `/etc/landwelle/landwelle.env` muss eine Verbindung eingetragen sein: + +```dotenv +DATABASE_URL=postgres://landwelle_app:PASSWORT@127.0.0.1:5432/landwelle?sslmode=disable +``` + +Das Datenbankkonto benötigt Rechte zum Erstellen und Ändern der Landwelle-Tabellen. + +## Einfachste Aktualisierung auf dem Raspberry Pi + +Das Paket enthält ein Installationsskript. Im entpackten Projektordner genügt: + +```bash +sudo ./scripts/update-migrations-on-pi.sh +``` + +Das Skript installiert bei Bedarf den PostgreSQL-Client, kopiert den ARM64-Migrator und die offenen SQL-Dateien nach `/opt/landwelle`, setzt die nötigen Rechte, führt die Migrationen als Benutzer `landwelle` aus und startet anschließend `landwelle-radio` neu. + +## Ausführen auf dem Raspberry Pi + +Im Installationsordner `/opt/landwelle`: + +```bash +sudo -u landwelle /opt/landwelle/scripts/migrate.sh +``` + +Alternativ direkt: + +```bash +sudo -u landwelle /opt/landwelle/dist/landwelle-migrate-linux-arm64 \ + --env-file /etc/landwelle/landwelle.env \ + --dir /opt/landwelle/migrations \ + --archive-dir /opt/landwelle/migrations/applied +``` + +Danach kann das Portal neu gestartet werden: + +```bash +sudo systemctl restart landwelle-radio +``` + +## Vorher nur prüfen + +```bash +sudo -u landwelle /opt/landwelle/scripts/migrate.sh --dry-run +``` + +## Dateien behalten + +Normalerweise werden erfolgreiche Dateien verschoben. Für Entwicklungszwecke können sie am ursprünglichen Ort bleiben: + +```bash +./scripts/migrate.sh --keep-files +``` + +Die Datenbankhistorie verhindert trotzdem eine doppelte Ausführung. + +## Rechte + +Der Benutzer `landwelle` muss den Ordner `migrations` und dessen Unterordner `applied` beschreiben dürfen: + +```bash +sudo chown -R landwelle:landwelle /opt/landwelle/migrations +sudo chmod 750 /opt/landwelle/migrations /opt/landwelle/migrations/applied +``` + +Die Environment-Datei kann weiterhin nur für root und die Landwelle-Gruppe lesbar sein: + +```bash +sudo chown root:landwelle /etc/landwelle/landwelle.env +sudo chmod 640 /etc/landwelle/landwelle.env +``` + +## Sicherheitsmechanismen + +- numerische Reihenfolge nach Dateiname +- Abbruch beim ersten SQL-Fehler +- keine Archivierung bei einem Fehler +- Betriebssystem-Sperrdatei gegen parallele Läufe +- SHA-256-Prüfsummen gegen nachträglich veränderte Migrationen +- Datenbanktabelle als dauerhafte Migrationshistorie +- automatischer `search_path` auf `landwelle, public` + +## Regeln für neue SQL-Dateien + +Neue Dateien werden fortlaufend nummeriert, zum Beispiel `0004_admin_auth.sql`. Sie enthalten **kein** `BEGIN`, `COMMIT` oder `ROLLBACK`, weil der Migrator die gesamte SQL-Datei und den Eintrag in `schema_migrations` gemeinsam in einer PostgreSQL-Transaktion ausführt. + +## Aktueller Migrationsstand + +Der reguläre Quellstand reicht bis Migration `0045`. Für „Landwelle Zuhause“ wird aus Kompatibilitätsgründen mit dem bereits eingespielten Hotfix die separate Nummer `9000` verwendet. + +Die letzten Schritte ergänzen Chartgenerierung, atomare Chartpositionen, Redaktionstypen, Forum-Lesestatus, App-Empfangsbestätigungen, öffentliche Inhaltsseiten, Kontaktanfragen, Mediathek, consentbasierte Webstatistik, den ersten Pressebericht zum App-Beta-Test und die Reparatur seiner Absatztrennungen. + +Vor Portalupdates ist `update-migrations-on-pi.sh` auszuführen, wenn die Zielumgebung noch nicht alle vorhandenen Migrationen registriert hat. Version v1.5.57 konsolidiert `9000_landwelle_zuhause_navigation.sql`; der Migrator ist vor dem Portalupdate auszuführen, damit der neue Menüpunkt „Landwelle Zuhause“ in bestehenden Installationen angelegt wird. diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md new file mode 100644 index 0000000..7dad573 --- /dev/null +++ b/docs/DECISIONS.md @@ -0,0 +1,110 @@ +# Technische Entscheidungen + +## D-001 – Go als Servertechnologie + +**Status:** angenommen + +Das Portal wird als Go-Anwendung umgesetzt. Gründe sind geringe Laufzeitabhängigkeiten, ARM64-Unterstützung, serverseitiges Rendering und einfacher Betrieb auf Raspberry Pi 5. + +## D-002 – Eingebettete statische Assets + +**Status:** angenommen + +Markenassets und Frontenddateien werden mit `go:embed` ausgeliefert. Redaktionelle Uploads liegen außerhalb des Binaries. + +## D-003 – Standardport 2200 + +**Status:** angenommen + +Die Anwendung lauscht standardmäßig auf `2200` und wird öffentlich hinter einem Reverse Proxy betrieben. + +## D-004 – Fester Stream als Bootstrap-Konfiguration + +**Status:** angenommen + +Bis zum Adminbereich ist `https://stream.slmm.de/listen/landwelle/landwelle` der Standardstream. + +## D-005 – systemd als bevorzugter Raspberry-Pi-Betrieb + +**Status:** angenommen + +systemd ist der Standardweg; Docker bleibt optional. + +## D-006 – Modularer Monolith + +**Status:** angenommen + +Öffentliche Seite, Adminbereich, API und RSS-Worker bleiben zunächst eine Go-Anwendung mit getrennten Paketen. + +## D-007 – PostgreSQL als einzige Datenbank + +**Status:** angenommen + +SQLite wird nicht eingesetzt. Landwelle verwendet den bereits vorhandenen PostgreSQL-Server. + +**Begründung:** + +- bestehende Infrastruktur kann genutzt werden +- bessere Mehrbenutzer- und Parallelitätsfähigkeit +- saubere zentrale Backups und Migrationen +- geeignet für RSS-Import, Suche, Audit und spätere mehrere Anwendungsinstanzen + +**Folgen:** + +- `DATABASE_URL` ist Pflicht für die persistente Ausbaustufe +- Netzwerk, TLS, Rollen und Backups müssen betrieblich eingerichtet werden +- Raspberry Pi benötigt keine lokale Datenbankdatei +- Repository-Paket wird direkt für PostgreSQL entwickelt + +## D-008 – Server Side Rendering + +**Status:** angenommen + +Öffentliche Nachrichten-, Regions-, Veranstaltungs- und Programmseiten werden primär serverseitig gerendert. JavaScript ergänzt Player, Now Playing und Admininteraktionen. + +## D-009 – RSS/Atom als primäre externe Nachrichtenquelle + +**Status:** angenommen + +Regionale externe Meldungen werden über verwaltete RSS-/Atom-Feeds importiert. + +**Folgen:** + +- Quellen, Regionen und Nutzungsrechte werden in PostgreSQL verwaltet +- Abrufzustand und Fehlerhistorie werden persistiert +- RSS-Inhalte gelten als untrusted input +- Startseite erhält eine regionale Ausgleichslogik + +## D-010 – Keine automatische Volltextspiegelung + +**Status:** angenommen + +Von Fremdquellen werden nur erlaubte Metadaten angezeigt. Der Leser wird zum Originalartikel geleitet. Bilder und Anrisstexte werden ausschließlich im dokumentierten Nutzungsrahmen verwendet. + +## D-011 – Externe PostgreSQL-Instanz + +**Status:** angenommen + +Die Datenbank läuft nicht zwingend auf dem Raspberry Pi. Die Anwendung verbindet sich mit dem vorhandenen PostgreSQL-Server im privaten Netz. Liveness und Readiness werden getrennt behandelt. + +## ADR: Flutter für Android und iOS + +**Entscheidung:** Ein gemeinsamer Flutter-Codebestand für die mobilen Apps. + +**Gründe:** Gemeinsame UI, API-Modelle und Tests; Android kann zuerst ausgeliefert werden, ohne die spätere iOS-App neu zu erfinden. Native Medien- und Pushfunktionen bleiben über Plattformintegration möglich. + +## ADR: Desktop-Player nicht aktiv verfolgen + +**Entscheidung:** Ein produktiver Desktop-Player ist nicht Bestandteil der aktuellen Roadmap. Frühere Wails-Überlegungen bleiben nur als historische Projektnotiz erhalten und lösen keine Implementierungsarbeit aus. + +## ADR: Firebase Cloud Messaging + +**Entscheidung:** FCM für Android und iOS; iOS-Zustellung über APNs. + +**Gründe:** einheitliche Backend-Schnittstelle, Themen- und Zielgruppenversand sowie etablierte Integration in Flutter. + +## ADR: Eigene Landwelle-Gerätestatistik statt Advertising Tracking + +**Entscheidung:** anonyme Installations-UUID, feste Ereignisliste, Einwilligung und Tagesaggregation. + +**Gründe:** fachlich ausreichende Kennzahlen bei geringerer Datensammlung und besserer Kontrolle über Aufbewahrung und Löschung. diff --git a/docs/DEPLOYMENT_RASPBERRY_PI.md b/docs/DEPLOYMENT_RASPBERRY_PI.md new file mode 100644 index 0000000..947935e --- /dev/null +++ b/docs/DEPLOYMENT_RASPBERRY_PI.md @@ -0,0 +1,103 @@ +# Deployment auf Raspberry Pi 5 + +## Zielsystem + +- Raspberry Pi 5 mit 64-Bit Linux ARM64 +- zuverlässiges Netzteil und bevorzugt SSD +- feste lokale IP oder DHCP-Reservierung +- korrekte Systemzeit +- Netzwerkzugriff auf den vorhandenen PostgreSQL-Server + +## Anwendung starten + +```bash +cd landwelle-go-portal-v6-apps-api +chmod +x dist/landwelle-portal-linux-arm64 +./dist/landwelle-portal-linux-arm64 +``` + +Aktuelle Prototypseite: + +```text +http://IP-DES-RASPBERRY-PI:2200 +``` + +## systemd-Installation + +```bash +sudo useradd --system --home /opt/landwelle --shell /usr/sbin/nologin landwelle 2>/dev/null || true +sudo install -d -o landwelle -g landwelle /opt/landwelle +sudo install -d -o root -g landwelle -m 0750 /etc/landwelle +sudo install -d -o landwelle -g landwelle /var/lib/landwelle/uploads +sudo install -m 0755 dist/landwelle-portal-linux-arm64 /opt/landwelle/landwelle-portal +sudo install -m 0644 deploy/landwelle-radio.service /etc/systemd/system/landwelle-radio.service +``` + +Für die PostgreSQL-Ausbaustufe: + +```bash +sudo install -m 0640 -o root -g landwelle .env.example /etc/landwelle/landwelle.env +sudo editor /etc/landwelle/landwelle.env +``` + +Die Service-Datei soll enthalten: + +```ini +EnvironmentFile=-/etc/landwelle/landwelle.env +``` + +Anschließend: + +```bash +sudo systemctl daemon-reload +sudo systemctl enable --now landwelle-radio +``` + +## PostgreSQL-Verbindung testen + +Vom Raspberry Pi: + +```bash +sudo apt install -y postgresql-client +psql "$DATABASE_URL" -c 'select current_database(), current_user, now();' +``` + +Alternativ die Werte aus `/etc/landwelle/landwelle.env` exportieren oder explizit angeben. + +## Netzwerkregeln + +- PostgreSQL nur im privaten Netz erreichbar +- Datenbankserver erlaubt Verbindungen ausschließlich vom Raspberry Pi beziehungsweise Anwendungsnetz +- keine Routerfreigabe für Port 5432 +- Reverse Proxy veröffentlicht nur HTTPS +- Go-Anwendung intern an `127.0.0.1:2200` binden + +## Migrationen + +Vor der späteren produktiven RSS-/Adminversion: + +```bash +/opt/landwelle/landwelle-portal migrate up +``` + +Der genaue Befehl wird mit Implementierung des Migrationskommandos festgelegt. Migrationen werden nicht automatisch und unkontrolliert bei jedem Neustart ausgeführt. + +## Updates + +1. PostgreSQL-Backup und Uploadbackup erstellen. +2. bisheriges Binary sichern. +3. Migrationen prüfen und ausführen. +4. neues Binary installieren. +5. Dienst starten. +6. `/health` und `/ready` prüfen. +7. Startseite, Stream und Feedstatus kontrollieren. + +## Öffentlicher Betrieb + +```text +Internet → Reverse Proxy :443 → 127.0.0.1:2200 → PostgreSQL im privaten Netz +``` + +## Docker + +Docker bleibt optional. Der PostgreSQL-Server wird nicht zwingend als Container mitgeliefert, da er bereits vorhanden ist. Die Anwendung erhält `DATABASE_URL` über Secret/Environment und persistiert Uploads in einem Volume. diff --git a/docs/DESIGN_SYSTEM.md b/docs/DESIGN_SYSTEM.md new file mode 100644 index 0000000..6ef850e --- /dev/null +++ b/docs/DESIGN_SYSTEM.md @@ -0,0 +1,123 @@ +# Designsystem + +## Markenwirkung + +Die Oberfläche verbindet ländliche Bildwelten mit einer modernen Radio- und Nachrichtenästhetik. Schwarz beziehungsweise Anthrazit bildet den technischen Radio-Rahmen, Grün steht für Land, Region und Aktivität, Weiß sorgt für Lesbarkeit. + +## Farbvariablen + +Die aktuelle CSS-Basis verwendet: + +| Variable | Wert | Verwendung | +|---|---|---| +| `--green` | `#7fbd00` | primäre Aktionen, Livezustand, Kategorien | +| `--green-dark` | `#5f9200` | dunklere Grünzustände und Verläufe | +| `--ink` | `#101211` | Haupttext und dunkle Flächen | +| `--muted` | `#727872` | Sekundärtext | +| `--line` | `#e3e6e1` | Rahmen und Trennlinien | +| `--paper` | `#ffffff` | Karten und Hauptflächen | +| `--soft` | `#f4f5f2` | weiche Hintergrundflächen | + +## Typografie + +Aktuell wird ein System-Font-Stack eingesetzt: + +```css +Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif +``` + +Dadurch entstehen keine externen Fontabhängigkeiten. Überschriften verwenden eine kräftige Gewichtung, Karten bleiben kompakt und portalartig. + +## Logo + +- das offizielle Logo nicht verzerren +- ausreichend Abstand zu anderen Elementen lassen +- auf dunklem Hintergrund die kontrastreiche Variante verwenden +- in der Navigation die zugeschnittene kompakte Datei bevorzugen +- im Hero darf das vollständige Logo größer erscheinen +- keine zusätzlichen Farben oder Effekte verwenden, die die Wortmarke unlesbar machen + +## Hauptkomponenten + +### Header + +- dunkler Hintergrund +- kompakte horizontale Navigation +- sichtbarer grüner Button `Jetzt live hören` +- mobile Menüschaltfläche unterhalb des Desktop-Breakpoints + +### Hero + +- regionales Bild oder Video +- dunkler Verlauf für Textlesbarkeit +- klares Logo, Hauptüberschrift und maximal zwei primäre Aktionen +- kein automatisch startender Ton + +### Liveplayer + +- dunkle, eigenständige Fläche +- deutlicher Play/Pause-Button +- aktuelle Sendung, Moderator, Titel und Lautstärke +- Livezustand in Grün +- Status- und Fehlermeldungen müssen verständlich sein + +### Portal-Karten + +- weißer Hintergrund +- dezenter Rahmen und Schatten +- Bild oben, Inhalt darunter +- Kategorie beziehungsweise Datum als schneller Orientierungspunkt +- vollständige Karte oder eindeutige Überschrift verlinkbar + +### Sidebar + +- Wetter, Verkehr, Ausflugstipps und App-Hinweise +- Inhalte müssen auch ohne Sidebar in der mobilen Reihenfolge verständlich bleiben + +## Responsive Breakpoints + +Die aktuelle CSS-Datei verwendet: + +```text +1120 px +900 px +650 px +``` + +Grundprinzipien: + +- unter 1120 px werden Navigation, Sidebar und Abstände kompakter +- unter 900 px wird die Seitenstruktur stärker gestapelt und die mobile Navigation relevant +- unter 650 px werden Karten und Player auf eine schmale Smartphoneansicht angepasst + +## Bewegung + +- Video darf automatisch stumm laufen +- Audio startet ausschließlich nach Benutzeraktion +- Animationen bleiben dezent +- `prefers-reduced-motion` wird respektiert + +## Schreibstil + +- direkt und regional +- kurze, verständliche Überschriften +- keine künstlich übertriebene Werbesprache in Nachrichten +- klare Kennzeichnung von Werbung, Partnerinhalten und Gewinnspielen +- Orts- und Regionsbezug möglichst konkret nennen + +## Barrierefreiheit als Ziel + +- ausreichende Farbkontraste +- sichtbare Fokuszustände +- Tastaturbedienung +- verständliche Linktexte +- sinnvolle Überschriftenhierarchie +- Textalternativen für inhaltliche Bilder +- Statusmeldungen über geeignete ARIA-Live-Bereiche +- keine ausschließliche Informationsvermittlung durch Farbe + +## Komfortable Standardgröße (v8) + +Die Desktop-Oberfläche ist ab v8 nativ größer ausgelegt. Ziel ist eine Lesbarkeit, die auf großen Monitoren ungefähr der bisherigen Darstellung bei 125–130 Prozent Browser-Zoom entspricht. Dazu werden Typografie, Inhaltsbreite, Navigation, Hero, Liveplayer, Karten und Sidebar proportional vergrößert. + +Es wird bewusst kein pauschales `zoom` oder `transform: scale(...)` verwendet. Dadurch bleiben Textschärfe, Responsive Breakpoints, Fokusrahmen und Maus-/Touch-Ziele korrekt. Auf mittleren Desktopbreiten wird eine kompaktere Zwischenstufe verwendet; Smartphones und Tablets behalten ein eigenständiges responsives Layout. diff --git a/docs/DIRECTORY.md b/docs/DIRECTORY.md new file mode 100644 index 0000000..20a5777 --- /dev/null +++ b/docs/DIRECTORY.md @@ -0,0 +1,11 @@ +# Landwelle Branchenbuch + +Öffentliche Route: `/branchenbuch` +Adminroute: `/admin/directory` +Such-API: `GET /api/directory/search?q=&category=` + +Kostenlose Einträge werden zunächst mit Status `pending` gespeichert. Die Redaktion kann sie bearbeiten und auf `published`, `rejected` oder `archived` setzen. Öffentlich sichtbar sind ausschließlich veröffentlichte Einträge. + +Kategorien umfassen unter anderem Firmen und Handwerk, Vereine, Gastronomie, Hotels, Ferienwohnungen, Musiker/DJs/Bands, Landwirtschaft/Hofläden, Handel/Dienstleistungen, Freizeit/Tourismus sowie Gesundheit/Pflege. + +Nach erfolgreicher Einsendung gehen eine interne Nachricht an `radio@landwelle.de` und eine Bestätigung an die Kontaktperson. Die Templates heißen `directory_submission_admin` und `directory_submission_confirmation`. diff --git a/docs/EDITORIAL_MEDIA.md b/docs/EDITORIAL_MEDIA.md new file mode 100644 index 0000000..84c8ca8 --- /dev/null +++ b/docs/EDITORIAL_MEDIA.md @@ -0,0 +1,39 @@ +# Redaktion, Medien und Mediathek + +**Stand: Landwelle v1.5.26** + +## Mediengalerie + +Die Mediengalerie ist unter `/admin/media` erreichbar. Bilddateien liegen im konfigurierten `LANDWELLE_MEDIA_DIR`, standardmäßig `/var/lib/landwelle/media`. Metadaten, Alternativtext, Rechteinhaber, Quellenhinweis und Verknüpfungen werden in PostgreSQL gespeichert. + +Unterstützt werden JPG, PNG, GIF und WebP bis zur serverseitig festgelegten Uploadgrenze. Dateityp und Inhalt werden geprüft; eine passende Dateiendung allein reicht nicht. + +## Redaktion + +Unter `/admin/editorial` werden Inhalte und frei definierbare Kategorien gepflegt. Die Oberfläche trennt Inhaltsliste, Inhaltserfassung und Kategorien in eigene Tabs. Kategorien werden über „Kategorie anlegen“ in einem Modal erstellt. Eine Kategorie kann aktiv oder inaktiv sein, sortiert werden und festlegen, ob veröffentlichte Beiträge im Startseitenbereich „Landwelle vor Ort“ erscheinen. + +Beiträge besitzen Slug, Titel, Teaser, Inhalt, Veröffentlichungsstatus und optional ein Bild aus der Mediengalerie. Öffentliche Kategorieübersichten liegen unter `/landwelle-vor-ort/`; Detailseiten verwenden `/landwelle-vor-ort//`. Alte Detailpfade ohne Kategorie werden per 301 weitergeleitet. + +## Verteilung + +Bei veröffentlichten Inhalten mit aktivierter Facebook-Ausgabe sendet der Server den Beitrag unmittelbar über den Facebook-Publisher. Die Zieladresse ist bei öffentlichen Regionalbeiträgen `/landwelle-vor-ort//`. Vor dem Speichern zeigt der Adminbereich eine Live-Vorschau aus Titel, Teaser, Bild und Zieladresse. Erfolgreiche Übertragungen, ausstehende Zustände und Fehler werden am Inhalt angezeigt; ein manueller Wiederholungsversand ist möglich. Zugangsdaten und Plattformtokens bleiben ausschließlich serverseitig. Push-Ausgaben bleiben als eigener Verteilungsweg gespeichert. + +## Mediathek + +`/admin/mediathek` verwaltet Sendungen, KI-Beiträge, Interviews, redaktionelle Beiträge und Specials. Unterstützt werden MP3, M4A, OGG und WAV. Veröffentlichungszeit, Cover, Beschreibung, Ausgabe, Dauer, Hervorhebung und Sichtbarkeit sind pflegbar. + +Die öffentliche Seite `/mediathek` besitzt seit v1.5.14 eine eigene Landwelle-Herografik. Sie wird als optimiertes WebP eingebettet; der sichtbare Titel ist kein Bildbestandteil, sondern zugänglicher HTML-Text. + +Fertige Audios aus dem Nachrichtenstudio können als nichtöffentlicher Entwurf übernommen werden. Ein eindeutiger Quellschlüssel verhindert doppelte Importe derselben Produktion. + +Seit v1.5.15 ist der Textblock des Mediathek-Heros wieder exakt am globalen Seitenraster ausgerichtet. Das Stylesheet `mediathek-v3.css` ersetzt die fehlerhafte zwischengespeicherte Fassung. + +## KI-Transparenz ab v1.5.25 + +Redaktionseinträge speichern `ai_usage`, `ai_human_reviewed`, `ai_editorial_responsible` und `ai_disclosure`. Bilder aus der Medienverwaltung besitzen eine unabhängige Klassifizierung über `media_assets.ai_usage` und `media_assets.ai_disclosure`. Die öffentliche Detailseite, Startseitenkarten und Facebook-Ausgaben übernehmen die Kennzeichnung automatisch. Ein Häkchen für menschliche Prüfung darf nur nach einer substanziellen inhaltlichen Kontrolle gesetzt werden. + +## KI-Wasserzeichen und nachträgliche Bearbeitung ab v1.5.25 + +Jedes Bild in `/admin/media` kann nach dem Upload erneut bearbeitet werden. Neben Alternativtext und Rechteangaben werden KI-Klassifizierung, Transparenzhinweis, Wasserzeichenstatus und ein optionaler kurzer Wasserzeichentext gespeichert. Ohne individuellen Text verwendet das Portal „Mit KI erstellt“ beziehungsweise „Mit KI bearbeitet“. Ein Wasserzeichen kann nur bei einer KI-Klassifizierung wirksam sein. Die Originaldatei bleibt unverändert. + +Aktive Wasserzeichen werden derzeit in redaktionellen Beiträgen, Startseitenkarten, Teamprofilen, Programmkarten und Mediathek-Covern übernommen, sofern die Bildadresse auf ein Objekt der zentralen Mediengalerie verweist. diff --git a/docs/EVENT_CALENDAR.md b/docs/EVENT_CALENDAR.md new file mode 100644 index 0000000..1ce911e --- /dev/null +++ b/docs/EVENT_CALENDAR.md @@ -0,0 +1,46 @@ +# Veranstaltungskalender + +## Öffentliche Seite + +`GET /veranstaltungen` zeigt veröffentlichte Termine aus ganz Niedersachsen. Kategorien umfassen unter anderem Familie, Flohmarkt, Konzert, Kultur, Land & Leute, Markt, Sport, Tradition und Verein. + +## Einsendungen + +`POST /veranstaltungen/einsenden` nimmt Veranstaltungsdaten und optional eine Grafik als JPG, PNG oder WebP bis 8 MB entgegen. Neue Einsendungen erhalten den Status `pending` und werden erst nach redaktioneller Prüfung sichtbar. + +Der Absender erhält über das Template `event_submission_confirmation` eine Bestätigung. Die Redaktion erhält über `event_submission_admin` eine Nachricht an `radio@landwelle.de`; eine hochgeladene Grafik wird als Anhang versendet. + +## Externe Quellen für Niedersachsen + +Die bevorzugte landesweite Quelle ist der Niedersachsen Hub beziehungsweise dessen Open Data-Finder. Dort werden touristische Open-Data-Datensätze einschließlich Events aus niedersächsischen Regionen gebündelt. Ein produktiver Import sollte erst nach Klärung von API-Zugang, Lizenz, Aktualisierungsintervall und Quellenkennzeichnung aktiviert werden. + +Als ergänzende Quellen kommen offizielle kommunale und touristische Kalender in Betracht, sofern RSS, iCal, JSON-LD oder eine dokumentierte API angeboten wird. Jede Quelle muss einzeln auf Nutzungsrechte, Niedersachsen-Bezug und stabile Identifikatoren geprüft werden. Reines ungefragtes Scraping ist nicht vorgesehen. + +Empfohlene Priorität: + +1. Niedersachsen Hub / Open Data-Finder +2. offizielle Tourismusorganisationen und kommunale Kalender +3. iCal- oder RSS-Feeds von Vereinen, Städten und Veranstaltern +4. manuelle Landwelle-Einsendungen und eigene redaktionelle Termine + + +## destination.one-Import + +Der Niedersachsen-Hub-Import wird im Adminbereich unter **Einstellungen → Veranstaltungen** konfiguriert. Unterstützt werden eine vollständige API-URL, ein frei benennbarer Query-Parameter für den Lizenzschlüssel sowie Experience/Projekt und dessen Parametername. Standardwerte sind `licensekey`, `experience` und `Niedersachsen Hub`. + +Der Importer erwartet die destination.one-Ausgabe als JSON, erkennt gängige Container (`items`, `results`, `data`, `features`, `records`) und ordnet Titel, Termine, Ort, Beschreibung, Webseite, Bild, Quelle und Lizenz dem Landwelle-Datenmodell zu. Datensätze werden anhand von `source_name + external_id` aktualisiert. + +Bei aktivierter automatischer Veröffentlichung erscheinen importierte Termine unmittelbar. Ohne automatische Veröffentlichung werden sie als `pending` gespeichert. Die Lizenzentscheidung bleibt redaktionelle Verantwortung; zugelassen sind nur Daten und Bilder, deren konkrete Lizenz die Nutzung auf landwelle.de erlaubt. + +## Startseiten-Favoriten und Zufallsauswahl + +Unter `/admin/events?tab=submissions` können ausschließlich eigene Einsendungen und redaktionelle Termine als Startseiten-Favorit markiert werden. Importierte Open-Data-Termine bleiben von dieser Funktion ausgeschlossen. + +Die Startseite lädt alle veröffentlichten und noch gültigen Termine über `ListPublished`. Ist mindestens ein aktiver Favorit vorhanden, steht ein Favorit immer an Position 1. Bei mehreren aktiven Favoriten wird diese erste Position pro Seitenaufruf zufällig zwischen den Favoriten verteilt. Die beiden übrigen Plätze werden zufällig aus den noch nicht ausgewählten aktiven Veranstaltungen ergänzt. Doppelte Karten sind ausgeschlossen. Ohne aktiven Favoriten werden wie bisher bis zu drei Termine zufällig gewählt. Die Veranstaltungskalenderseite selbst bleibt chronologisch sortiert. + +Die Migration `0026_event_homepage_favorites.sql` ergänzt `homepage_favorite` und `homepage_favorite_at`. Abgelaufene Favoriten bleiben zwar historisch gespeichert, werden aufgrund der bestehenden Gültigkeitsprüfung aber nicht mehr auf der Startseite angezeigt. + + +## Live-Suche und Detailmodal + +Die öffentliche Seite durchsucht Titel, Beschreibung, Ort, Veranstalter und Kategorie über `/api/events/search`. Ein Klick auf eine Karte lädt `/api/events/` und zeigt den vollständigen Text in einem Modal. diff --git a/docs/EVENT_SEARCH.md b/docs/EVENT_SEARCH.md new file mode 100644 index 0000000..795ab3c --- /dev/null +++ b/docs/EVENT_SEARCH.md @@ -0,0 +1,6 @@ +# Veranstaltungssuche und Detailansicht + +- `GET /api/events/search?q=&category=` durchsucht veröffentlichte, laufende und zukünftige Veranstaltungen. +- `GET /api/events/` liefert die öffentliche Detailansicht einer Veranstaltung. +- Die Seite `/veranstaltungen` startet die Suche nach mindestens zwei Zeichen und aktualisiert die Karten ohne kompletten Seitenwechsel. +- Das Detailmodal zeigt den vollständigen Beschreibungstext und ersetzt nicht die öffentliche Quellverlinkung. diff --git a/docs/EXCURSIONS.md b/docs/EXCURSIONS.md new file mode 100644 index 0000000..4483cd9 --- /dev/null +++ b/docs/EXCURSIONS.md @@ -0,0 +1,23 @@ +# Ausflugstipps + +Öffentliche Seite: + +```text +/ausflugstipps +``` + +Die Seite bietet filterbare Ziele aus Niedersachsen in den Bereichen: + +- Radtouren +- Natur +- Familie +- Freizeitangebote und Freizeitparks +- Kultur + +Die Freizeitpark-Kategorie enthält zunächst Heide Park Resort, Serengeti-Park Hodenhagen und Rasti-Land. Öffnungszeiten, Preise und tagesaktuelle Hinweise werden nicht kopiert; die Karten verweisen auf die jeweiligen offiziellen Anbieter. + +API: + +```text +GET /api/v1/excursions +``` diff --git a/docs/FIREBASE_PUSH.md b/docs/FIREBASE_PUSH.md new file mode 100644 index 0000000..222a3cb --- /dev/null +++ b/docs/FIREBASE_PUSH.md @@ -0,0 +1,199 @@ +# Firebase-Push für Landwelle IT + +**Portalversion:** Landwelle v1.4.1 +**Android-App:** `de.landwelle.itmonitor` +**Topic:** `landwelle_it_jens_todos` + +## Zweck + +Das Go-Portal versendet unmittelbar nach dem erfolgreichen Anlegen einer neuen Todo-Aufgabe eine Firebase-Cloud-Messaging-Nachricht, wenn der Verfasser oder der tatsächlich angemeldete Ersteller Jens ist. Normale Seitenaufrufe, Listenabfragen, Änderungen und Löschungen erzeugen keinen Push. + +## Architektur + +```text +POST /admin/todos + → CSRF- und Rechteprüfung + → eindeutige Formular-ID prüfen + → Todo in PostgreSQL anlegen und ID zurückgeben + → Jens anhand unveränderlicher Benutzer-IDs prüfen + → Todo-ID + Topic als Idempotenzschlüssel reservieren + → Firebase Admin SDK sendet Topic-Nachricht + → Erfolg oder Fehler in PostgreSQL und Serverlog speichern +``` + +Firebase wird beim Start des Go-Portals genau einmal initialisiert. Verwendet wird das offizielle Firebase Admin SDK für Go. Die Service-Account-Datei wird nicht bei jedem Request neu geladen. + +## Service Account + +Standardpfad: + +```text +/etc/landwelle/firebase-service-account.json +``` + +Optional kann ausschließlich serverseitig ein anderer absoluter Pfad gesetzt werden: + +```dotenv +FIREBASE_SERVICE_ACCOUNT_FILE=/absoluter/serverpfad/firebase-service-account.json +``` + +Relative Pfade werden abgelehnt. Symbolische Links werden zu einem absoluten Ziel aufgelöst. Die Datei muss eine reguläre, lesbare Datei sein. + +Installation: + +```bash +sudo ./scripts/install-firebase-service-account.sh /sicherer/pfad/firebase-service-account.json +sudo systemctl restart landwelle-radio +``` + +Die Datei darf niemals: + +- im Repository oder Release-ZIP liegen, +- in `web/`, JavaScript oder HTML eingebunden werden, +- über eine API ausgegeben werden, +- in die Android- oder iOS-App kopiert werden, +- als Inhalt oder privater Schlüssel protokolliert werden. + +Die App enthält nur `google-services.json` beziehungsweise die öffentliche FlutterFire-Konfiguration. + +## Auslösendes Ereignis + +Auslöser ist ausschließlich ein erfolgreicher neuer Datenbankeintrag über: + +```text +POST /admin/todos +action=save +id leer oder 0 +``` + +Erst nachdem PostgreSQL den Datensatz angelegt und dessen ID zurückgegeben hat, beginnt der Pushversand. Bei einem Update mit vorhandener Todo-ID wird kein Push versendet. + +## Jens-Erkennung + +Neue Todos speichern zusätzlich zu `author`: + +- `author_user_id`: eindeutig aufgelöstes Benutzerkonto des Verfassers, +- `created_by_user_id`: Benutzer-ID der angemeldeten Adminsitzung. + +Die Erkennung verwendet folgende Reihenfolge: + +1. `LANDWELLE_TODO_JENS_USER_ID`, sofern als positive ID konfiguriert, +2. eindeutiges aktives Benutzerkonto mit `username = Jens`, +3. eindeutiges aktives Benutzerkonto mit `first_name = Jens` oder `display_name = Jens`, +4. nur wenn keine eindeutige Jens-ID ermittelt werden kann: kontrollierter Vergleich der tatsächlich gespeicherten Autor- und Sitzungsnamen mit `Jens`. + +Empfohlene Produktionskonfiguration: + +```dotenv +LANDWELLE_TODO_JENS_USER_ID= +``` + +Die ID kann in PostgreSQL ermittelt werden: + +```sql +SELECT id, username, display_name, first_name, email +FROM landwelle.users +WHERE deleted_at IS NULL + AND (lower(username)='jens' OR lower(first_name)='jens' OR lower(display_name)='jens'); +``` + +## FCM-Nachricht + +Produktivnachricht: + +```json +{ + "topic": "landwelle_it_jens_todos", + "notification": { + "title": "Neue Aufgabe von Jens", + "body": "Eine neue Landwelle-IT-Aufgabe wurde eingetragen." + }, + "data": { + "type": "todo", + "todo_id": "", + "author": "Jens" + }, + "android": { + "priority": "high", + "notification": { + "channel_id": "landwelle_monitoring" + } + } +} +``` + +Alle Werte unter `data` sind Strings. + +## Idempotenz + +Zwei Schutzebenen verhindern Doppelversand: + +1. Jedes neue Formular enthält eine kryptografisch zufällige `create_request_id`. Ein doppeltes Absenden erzeugt wegen des eindeutigen Datenbankindex keinen zweiten Todo-Datensatz. +2. `landwelle.todo_push_notifications` besitzt eine eindeutige Kombination aus `todo_id` und `topic`. Für dieselbe Aufgabe kann der automatische Jens-Push nur einmal reserviert werden. + +Ein fehlgeschlagener Versand setzt den Todo-Datensatz nicht zurück. Der Fehlerstatus bleibt in der Push-Tabelle nachvollziehbar. + +## Protokollierung + +Datenbanktabelle: + +```text +landwelle.todo_push_notifications +``` + +Gespeichert werden: + +- Todo-ID, +- Ziel-Topic, +- Status `pending`, `sent` oder `failed`, +- Anzahl der Versuche, +- Firebase Message-ID bei Erfolg, +- bereinigte Fehlermeldung bei Fehler, +- Erstellungs-, Versuch-, Versand- und Aktualisierungszeit. + +Das Serverlog enthält Zeitstempel, Todo-ID, Topic, Status und Message-ID beziehungsweise eine bereinigte Fehlermeldung. Private Schlüssel, Access Tokens, Authorization-Header und der JSON-Inhalt werden herausgefiltert und niemals ausgegeben. + +## Administrativer Test + +Der Test ist ausschließlich für angemeldete Benutzer mit `todos.manage` erreichbar: + +```text +POST /admin/todos/firebase-test +``` + +Im Adminbereich `/admin/todos` befindet sich der Button **Testnachricht senden**. Er verwendet CSRF-Schutz und sendet an dasselbe Topic. Die Testnachricht hat den Datentyp `todo_test` und `todo_id = test`. + +Testablauf: + +1. App starten und Topic `landwelle_it_jens_todos` abonnieren. +2. Android-Benachrichtigungskanal `landwelle_monitoring` anlegen. +3. `/admin/todos` öffnen. +4. Firebase-Status muss `Bereit` anzeigen. +5. **Testnachricht senden** drücken. +6. Message-ID im Serverlog und die Benachrichtigung auf dem Testgerät prüfen. + +## FCM API und Berechtigungen prüfen + +Im Firebase-Projekt muss die **Firebase Cloud Messaging API** aktiviert sein. Prüfung über Firebase Console: Projekteinstellungen → Cloud Messaging. Alternativ kann ein berechtigtes Google-Cloud-Konto verwendet werden: + +```bash +./scripts/verify-firebase-fcm.sh +sudo ./scripts/verify-firebase-fcm.sh --enable +``` + +Der zweite Aufruf versucht `fcm.googleapis.com` zu aktivieren und benötigt entsprechende Google-Cloud-Berechtigungen. Der administrative Testversand ist die abschließende Funktionsprüfung für API, Service Account, IAM und Topic. + +## Fehlerbehandlung + +- FCM-Fehler ändern den bereits gespeicherten Todo-Datensatz nicht. +- Fehler werden nur im Adminhinweis, in der Datenbank und im Serverlog sichtbar; keine Credentials gelangen in eine HTTP-Antwort. +- Ein technischer Fehler beim Service Account deaktiviert nur den Pushteil. Portal und Todo-Liste bleiben verfügbar. +- Updates und Löschungen senden standardmäßig keine Nachricht. + +## Migration + +```text +migrations/0021_todo_firebase_push.sql +``` + +Sie ergänzt die Benutzerbezüge und die Idempotenz-/Protokolltabelle. diff --git a/docs/FORUM.md b/docs/FORUM.md new file mode 100644 index 0000000..b466441 --- /dev/null +++ b/docs/FORUM.md @@ -0,0 +1,31 @@ +# Forum und öffentliche Benutzerkonten + +**Stand: Landwelle v1.5.26** + +Das Forum ist unter `/forum` erreichbar. Die öffentliche Struktur lautet: + +```text +Forenübersicht → Kategorie mit Themenliste → Thema mit Beiträgen +``` + +## Funktionen + +- Registrierung und Anmeldung +- Kategorien, Themen und Antworten +- Benutzerabhängiger Lesestatus und „Neu“-Markierungen +- Rangstufen mit bis zu fünf Sternen +- Beiträge, Themen, Dankeschön erhalten und Dankeschön vergeben +- Registrierungsdatum im deutschsprachigen Profilblock +- Danke-Funktion für Beiträge +- sichere BBCodes und Emoticons +- keine Bilder und kein freies HTML in Beiträgen + +Unterstützt werden unter anderem `[b]`, `[i]`, `[u]`, `[s]`, `[quote]`, `[code]`, `[url]` und Listen. Unsichere Protokolle und HTML werden neutralisiert; `[img]` wird ausdrücklich blockiert. + +## Administration + +`/admin/forum` verwaltet Kategorien und Übersicht. `/admin/forum/topics` bietet die Themenverwaltung mit Status, Filterung und Moderationszugriff. Schreibende Aktionen sind rollen- und CSRF-geschützt. + +## Datenbank + +Die Basis stammt aus `0009_team_forum_public_auth.sql` und `0010_forum_registration_email.sql`. Lesestatus, Dankeschöns und erweiterte Profilwerte werden durch `0032_editorial_forum_voting_ui.sql` ergänzt. diff --git a/docs/JOBS.md b/docs/JOBS.md new file mode 100644 index 0000000..b6cbe23 --- /dev/null +++ b/docs/JOBS.md @@ -0,0 +1,52 @@ +# Landwelle Stellenbörse + +**Route:** `/service/stellenboerse` +**Interner Detailendpunkt:** `/api/jobs/details?ref=` + +## Architektur + +Die Jobsuche wird ausschließlich serverseitig durch `jobs.go` angebunden. Der Browser erhält weder den Fremd-API-Schlüssel noch direkten Zugriff auf die externe Schnittstelle. + +- Primäre Suche: `GET /pc/v6/jobs` +- kontrollierter Rückfall bei widersprüchlicher leerer v6-Antwort: `GET /pc/v4/jobs` +- Details: `GET /pc/v4/jobdetails/{base64(referenznummer)}` +- Authentisierung der Fremd-API: Header `X-API-Key` +- Standardregion: Niedersachsen +- Seitengröße: 12 Angebote +- HTTP-Timeout: 14 Sekunden + +## Konfiguration + +```dotenv +LANDWELLE_JOBS_API_BASE=https://rest.arbeitsagentur.de/jobboerse/jobsuche-service +LANDWELLE_JOBS_API_KEY=jobboerse-jobsuche +``` + +Die Werte sind überschreibbar, stammen aber nicht aus Benutzereingaben. Suchparameter werden über `url.Values` kodiert. Referenznummern für Details werden längenbegrenzt und Base64-kodiert. + +## Öffentliche Filter + +- Suchbegriff +- Ort beziehungsweise Region +- Umkreis +- Angebotsart +- Arbeitszeit +- Veröffentlichungszeitraum +- Pagination + +## Fehlerverhalten + +Bei Nichterreichbarkeit bleibt die Landwelle-Seite verfügbar und zeigt einen verständlichen Fehlerzustand. Meldet die Fremd-API Treffer, liefert aber keine lesbaren Angebote, wird einmalig der kompatible v4-Suchendpunkt versucht. Bleibt auch dieser ohne lesbare Daten, erscheint ein technischer Fehler und nicht die sachlich falsche Meldung „Keine passenden Stellen gefunden“. Detailfehler werden als standardisierte Landwelle-JSON-Fehler ausgegeben; Fremd-API-Antworten und Schlüssel werden nicht durchgereicht. + +## Test + +```bash +curl -i 'https://landwelle.de/service/stellenboerse?was=Pflege&wo=Niedersachsen' +``` + +Anschließend ein Ergebnis öffnen und den internen Detailabruf im Browser prüfen. + + +## Antworttoleranz ab v1.5.4 + +Der Parser erwartet weiterhin das offizielle Feld `stellenangebote`, akzeptiert aber zusätzlich kontrollierte Wrapper wie `data`, `result` oder `_embedded` und die Listenfelder `jobs`, `items` oder `content`. Einzelne unlesbare Listeneinträge werden übersprungen; gültige Nachbarangebote bleiben sichtbar. diff --git a/docs/KEYHELP_API_SUBDOMAIN.md b/docs/KEYHELP_API_SUBDOMAIN.md new file mode 100644 index 0000000..4b24d43 --- /dev/null +++ b/docs/KEYHELP_API_SUBDOMAIN.md @@ -0,0 +1,119 @@ +# KeyHelp: `api.landwelle.de` + +**Stand:** Landwelle v1.5.20 + +Die Subdomain stellt zwei getrennte Schnittstellen bereit: + +- öffentliche Radio-App-API unter `https://api.landwelle.de/v1`, +- interne Landwelle-IT-App-API unter `https://api.landwelle.de/api/mobile`. + +Die zusätzlichen Apache-Anweisungen gehören in KeyHelp bei der Subdomain in das Feld **Anweisungen für HTTPS**. Bei aktivierter HTTPS-Erzwingung ist ausschließlich dieses HTTPS-Feld für Aufrufe wie `https://api.landwelle.de/v1/app/bootstrap` maßgeblich. Eine funktionierende neutrale Startseite unter `/` beweist nicht, dass auch `/v1/*` weitergeleitet wird. + +Das verbindliche, direkt kopierbare Fragment liegt zusätzlich in `deploy/keyhelp-api-subdomain-https.conf`. Es muss vollständig übernommen werden; eine einzelne Rewrite-Regel nur für `/` reicht nicht. + +```apache + + ProxyRequests Off + ProxyPreserveHost On + + RewriteEngine On + + # Neutrale Startseite ohne Endpunktliste oder interne Versionsdetails. + RewriteRule ^/?$ http://127.0.0.1:2200/api/info [P,L] + + # Interne Android-App „Landwelle IT“. + # Der externe und interne Pfad sind identisch; dadurch entsteht kein /api/api/. + ProxyPass /api/mobile/ http://127.0.0.1:2200/api/mobile/ connectiontimeout=5 timeout=45 retry=0 + ProxyPassReverse /api/mobile/ http://127.0.0.1:2200/api/mobile/ + ProxyPass /api/mobile http://127.0.0.1:2200/api/mobile connectiontimeout=5 timeout=45 retry=0 + ProxyPassReverse /api/mobile http://127.0.0.1:2200/api/mobile + + # Öffentliche Android-/iOS-Radio-App-API. + ProxyPass /v1/ http://127.0.0.1:2200/v1/ connectiontimeout=5 timeout=45 retry=0 + ProxyPassReverse /v1/ http://127.0.0.1:2200/v1/ + ProxyPass /v1 http://127.0.0.1:2200/v1 connectiontimeout=5 timeout=45 retry=0 + ProxyPassReverse /v1 http://127.0.0.1:2200/v1 + + # Externe Dienstchecks. + ProxyPass /health http://127.0.0.1:2200/health connectiontimeout=5 timeout=10 retry=0 + ProxyPassReverse /health http://127.0.0.1:2200/health + ProxyPass /ready http://127.0.0.1:2200/ready connectiontimeout=5 timeout=10 retry=0 + ProxyPassReverse /ready http://127.0.0.1:2200/ready + + + + RequestHeader set X-Forwarded-Proto "https" + RequestHeader set X-Forwarded-Port "443" + + Header always set X-Content-Type-Options "nosniff" + Header always set Referrer-Policy "no-referrer" + Header always set X-Frame-Options "DENY" + Header always set X-Robots-Tag "noindex, nofollow, noarchive" + +``` + +Benötigte Apache-Module: + +```text +proxy +proxy_http +rewrite +headers +``` + +## Fehlerbild „404 Not Found“ bei `/v1` + +Wenn `https://api.landwelle.de/` die Landwelle-API-Hinweisseite zeigt, aber `https://api.landwelle.de/v1/app/bootstrap` eine generische HTML-404-Seite liefert, erreicht nur die Root-Rewrite-Regel das Portal. Die `ProxyPass`-Regeln für `/v1` fehlen dann im wirksamen HTTPS-VHost oder wurden nur in das HTTP-Feld eingetragen. + +Nach dem Speichern in KeyHelp prüfen: + +```bash +./scripts/verify-api-subdomain.sh +``` + +Der direkte Portalpfad kann unabhängig davon geprüft werden: + +```bash +curl -i http://127.0.0.1:2200/v1/app/bootstrap +curl -i https://landwelle.de/v1/app/bootstrap +``` + +Antwortet einer dieser Pfade mit JSON und die API-Subdomain weiterhin mit HTML-404, liegt der Fehler sicher vor dem Go-Portal in der Reverse-Proxy-Konfiguration. + +## Prüfungen + +Ohne Mobile-API-Token: + +```bash +curl -i 'https://api.landwelle.de/api/mobile/todos?author=Jens' +curl -i 'https://api.landwelle.de/api/mobile/status' +``` + +Mit gesetztem `LANDWELLE_MOBILE_API_TOKEN`: + +```bash +curl -i -H 'Authorization: Bearer ' \ + 'https://api.landwelle.de/api/mobile/todos?author=Jens' +curl -i -H 'Authorization: Bearer ' \ + 'https://api.landwelle.de/api/mobile/status' +``` + +Weitere Prüfungen: + +```bash +curl -i https://api.landwelle.de/ +curl -i https://api.landwelle.de/v1 +curl -i https://api.landwelle.de/v1/app/bootstrap +curl -i https://api.landwelle.de/v1/does-not-exist +curl -i https://api.landwelle.de/health +curl -i https://api.landwelle.de/ready +``` + +Erwartungen: + +- `/` liefert die neutrale HTML-Hinweisseite. +- `/v1` und `/v1/...` liefern JSON. +- `/api/mobile/todos` und `/api/mobile/status` liefern JSON und werden nicht zu `/api/api/...` umgeschrieben. +- ein unbekannter `/v1/...`-Pfad liefert JSON mit HTTP 404. +- `/health` liefert den Liveness-Status und `/ready` den Abhängigkeitsstatus. +- Adminpfade werden nicht über die API-Subdomain weitergereicht. diff --git a/docs/LANDWELLE_IT_APP.md b/docs/LANDWELLE_IT_APP.md new file mode 100644 index 0000000..4ed6120 --- /dev/null +++ b/docs/LANDWELLE_IT_APP.md @@ -0,0 +1,79 @@ +# Landwelle IT – Android-App-Anbindung + +**Paketkennung:** `de.landwelle.itmonitor` +**API-Basis:** `https://api.landwelle.de` +**FCM-Topic:** `landwelle_it_jens_todos` +**Android-Kanal:** `landwelle_monitoring` + +## Endgültige API-Endpunkte + +```http +GET https://api.landwelle.de/api/mobile/todos?author=Jens +GET https://api.landwelle.de/api/mobile/status +``` + +Es gibt keinen zusätzlichen Basispräfix. Insbesondere darf die App niemals `/api/api/mobile/...` aufrufen. + +Sofern `LANDWELLE_MOBILE_API_TOKEN` auf dem Server gesetzt ist, sendet die App: + +```http +Authorization: Bearer +``` + +Der Token gehört in eine sichere Build-/Runtime-Konfiguration und nicht fest in ein öffentliches Repository. + +## Firebase in der App + +Die App enthält ausschließlich: + +- `google-services.json`, +- die von FlutterFire generierte öffentliche Konfiguration, +- `firebase_core`, +- `firebase_messaging`. + +Die Datei `firebase-service-account.json` gehört ausschließlich auf den Landwelle-Server und darf niemals in das Flutter-Projekt gelangen. + +Beim App-Start beziehungsweise nach erteilter Benachrichtigungsberechtigung: + +```dart +await FirebaseMessaging.instance.subscribeToTopic( + 'landwelle_it_jens_todos', +); +``` + +Android muss den Benachrichtigungskanal exakt mit folgender ID anlegen: + +```text +landwelle_monitoring +``` + +Die App behandelt die FCM-Datenfelder als Strings: + +```text +type=todo +todo_id= +author=Jens +``` + +Bei `type == todo` sollte die App die Todo-Liste neu laden und optional direkt zur Aufgabe mit `todo_id` navigieren. Bei `type == todo_test` genügt die Testanzeige. + +## Erforderliche Flutter-Prüfungen + +- Firebase initialisieren. +- Android-13+-Benachrichtigungsberechtigung anfragen. +- Topic abonnieren. +- Kanal `landwelle_monitoring` mit hoher Wichtigkeit anlegen. +- Vordergrund-, Hintergrund- und Start-aus-Benachrichtigung behandeln. +- `todo_id` nie als Zahl voraussetzen; zuerst als String lesen und kontrolliert konvertieren. +- API-Fehlerobjekte `error.code` und `error.message` anzeigen oder protokollieren. +- Nach Push die Daten über die API laden; der Pushtext ist kein vollständiger Todo-Datensatz. + +## API-Erweiterungen + +Benötigt die App ein weiteres Feld, einen Filter oder einen neuen Endpunkt, darf sie keine Website parsen und keinen Pfad erfinden. Der App-Chat muss eine konkrete Anforderung mit der Überschrift ausgeben: + +```text +API-ERWEITERUNG FÜR DAS LANDWELLE-PORTAL +``` + +Diese Anforderung wird anschließend im Portal-Chat umgesetzt und in `openapi/landwelle-it-api.yaml` dokumentiert. diff --git a/docs/LEGAL_PAGES.md b/docs/LEGAL_PAGES.md new file mode 100644 index 0000000..340e630 --- /dev/null +++ b/docs/LEGAL_PAGES.md @@ -0,0 +1,17 @@ +# Impressum und Datenschutz + +Stand: v41 + +Die öffentlichen Seiten `/impressum` und `/datenschutz` enthalten die Betreiberangaben von Landwelle sowie eine Datenschutzerklärung für die im Portal eingesetzten Funktionen. + +## Betreiber + +Landwelle Radio, Inhaber Jens Bramsche, Dreeßel 15, 27374 Visselhövede. + +## Pflegehinweis + +Die Datenschutzerklärung muss erneut geprüft werden, sobald neue externe Dienste, Tracking-Systeme, Apps, Werbenetzwerke, Einbettungen oder Auftragsverarbeiter produktiv aktiviert werden. Konkrete Speicherfristen und Hosting-Auftragsverarbeitung sind entsprechend der tatsächlichen Serverkonfiguration zu dokumentieren. + +## KI-Transparenz + +Seit v1.5.24 ergänzt `/ki-transparenz` die Rechtstexte. Impressum und Footer verlinken die Seite. Die Datenschutzerklärung beschreibt die Nutzung von OpenAI und ElevenLabs sowie die sichtbare und gesprochene Kennzeichnung öffentlicher KI-Inhalte. Die technische Umsetzung ist regelmäßig rechtlich zu überprüfen und ersetzt keine individuelle Rechtsberatung. diff --git a/docs/LISTENER_CHARTS.md b/docs/LISTENER_CHARTS.md new file mode 100644 index 0000000..9227a2b --- /dev/null +++ b/docs/LISTENER_CHARTS.md @@ -0,0 +1,100 @@ +# Landwelle-Chartplattform + +**Stand: Landwelle v1.5.26** + +## Öffentliche Bereiche + +```text +/charts/zuhoerer +/charts/docx +/charts/schlager +/charts/jahrescharts +``` + +- Zuhörercharts: bis zu 45 Positionen, Hauptchart bis Platz 32 +- docX-Charts: bis zu 40 Positionen, Hauptchart bis Platz 30 +- Schlagercharts: bis zu 35 Positionen, Hauptchart bis Platz 25 +- Jahrescharts: getrennte Jahrgänge mit Archivcharakter und optionalen Titelinformationen + +Die Top 3 werden als eigene Karten dargestellt. Danach folgt eine kompakte Liste mit Position, Cover, Interpret, Titel, Punkten, letzter Woche, Einstieg, Tendenz und Hörprobe. + +## Voting + +Jede akzeptierte Bewertung wird zweigleisig gespeichert: `chart_votes` hält den letzten Abstimmungszeitpunkt für die 24-Stunden-Sperre, `chart_vote_history` protokolliert jede gültige Stimme dauerhaft. Eine erneute Stimme nach Ablauf der Sperre erhöht den Gesamtstand deshalb erneut. Der sichtbare Voting-Stand besteht aus dem vorhandenen Basiswert und der Summe aller historisch gezählten Bewertungswerte. + +Bewertungen erfolgen über die dokumentierten Chart-Endpunkte. Der maßgebliche Status kommt serverseitig aus PostgreSQL und nicht aus `localStorage`. + +Nach einer gültigen Stimme: + +- werden die Bewertungsbuttons ausgeblendet +- erscheint ein deutlich sichtbarer Countdown +- liefert die API `next_vote_at` und `retry_after_seconds` +- erscheinen die Buttons nach Ablauf der 24-Stunden-Sperre wieder + +Die Voterkennung verwendet die normalisierte Client-IP ohne wechselnden Quellport und den User-Agent. Fehler bei der Statusabfrage dürfen nicht fälschlich „Du hast gevotet“ anzeigen. + +## Hörprobe + +Cover und Hörprobe werden aus den gepflegten Store- oder YouTube-Metadaten erzeugt. Die Vorschau öffnet in einem Modal. Beim Schließen wird die laufende Wiedergabe beendet. YouTube-Frames sind nur auf den dafür vorgesehenen Chart- und OnTour-Routen in der CSP freigegeben. + +## Adminverwaltung + +`/admin/charts` trennt laufende Charts, Archiv und Jahrescharts. Für laufende Charts gibt es Top 3, Hauptchart und Neuvorstellungen. + +- `A` ergänzt Metadaten automatisch +- `L` leert eine Position einschließlich zugehöriger Stimmen +- Text- und Zahlenfelder speichern automatisch +- „Auswertung fest“ ist eine schreibgeschützte Anzeige des aktuellen Gesamtstands +- Positionen können per Drag-and-drop oder Positionsfeld geändert werden +- die vollständige Reihenfolge wird atomar gespeichert +- „Generieren“ sortiert jederzeit nach dem aktuellen, automatisch berechneten Votingstand +- Jahrescharts können fehlende Titelinformationen gesammelt ergänzen + +## Datenbank + +Wichtige Migrationen: + +- `0012_listener_charts.sql` – Grundtabellen und Voting +- `0028_slmmradio_charts_import.sql` – importierter Altbestand +- `0029_slmmradio_charts_import_repair.sql` – idempotente Reparatur und Mindestbestände +- `0030_chart_generation_docx.sql` – docX-Generierung +- `0031_chart_reorder_deferrable.sql` – deferrierbare Positionsconstraints + +Positionsänderungen setzen die Constraints innerhalb der Transaktion auf `DEFERRED`. Beim Commit muss die endgültige Reihenfolge eindeutig sein. Temporäre Offsets wie `position + 1000` werden nicht verwendet. + +## Gestaltung + +Die Chartwelten bleiben erkennbar unterschiedlich, verwenden aber dieselbe Landwelle-Grundstruktur: + +- Zuhörercharts: warm und regional +- docX: modern und redaktionell +- Schlager: lebendig und festlich +- Jahrescharts: nostalgisches Archiv vergangener Jahrzehnte + +Texte sind hörernah formuliert, etwa „Aktuelle Punkte“, „Letzte Woche“, „Dabei seit“ und „Tendenz“. + +## Abnahme + +Mindestens prüfen: + +- Status vor der ersten Abstimmung +- gültige Bewertung von 1 bis 5 +- ausgeblendete Buttons und Countdown +- erneute Freigabe nach Ablauf +- Hörprobe und Stop beim Schließen +- Jahreswechsel ohne Inline-JavaScript +- Drag-and-drop und Positionswechsel +- wiederholte Generierung und korrekte Sortierung nach aktuellem Votingstand +- mobile Darstellung aller Chartwelten + + +## Admin-Eingabefelder + +Seit v1.5.16 verwendet `/admin/charts` für alle Zahlenwerte normale Textfelder mit `inputmode="numeric"`. Positionen sind breiter dargestellt und verwenden tabellarische Ziffern; Browser-Spinner werden nicht mehr angezeigt. + +## Verwaltungsverhalten ab v1.5.21 + +- `L` leert Interpret, Titel, Medienangaben und Auswertungsfelder nur in der betroffenen Zeile. +- Die Position und die restliche Rangliste bleiben erhalten. +- Leere Verwaltungszeilen werden öffentlich und in der App-API nicht ausgegeben. +- „Generieren“ kann jederzeit erneut ausgeführt werden; es gibt keine 24-Stunden- oder Wochensperre. diff --git a/docs/LIVE_PLAYER.md b/docs/LIVE_PLAYER.md new file mode 100644 index 0000000..65f2a59 --- /dev/null +++ b/docs/LIVE_PLAYER.md @@ -0,0 +1,73 @@ +# Eigenständiger Landwelle-Liveplayer + +## Verhalten + +Der grüne Button **„Jetzt live hören“** öffnet ab Version 13 keinen Dialog innerhalb der Startseite mehr. Stattdessen wird ein klassisches, eigenständiges Browserfenster mit der Route `/player` geöffnet. + +Das Fenster bleibt geöffnet und der Stream läuft weiter, wenn die eigentliche Landwelle-Webseite geschlossen wird. Ein erneuter Klick auf „Jetzt live hören“ fokussiert nach Möglichkeit das bereits geöffnete Playerfenster, statt mehrere Player zu erzeugen. + +Browser dürfen Popupfenster abhängig von den persönlichen Einstellungen als neuen Tab öffnen. Deshalb besitzen alle Playerlinks zusätzlich einen normalen Link-Fallback auf `/player?autoplay=1`. + +## Inhalte + +Der Player zeigt über `GET /api/v1/now`: + +- aktuelle Sendung oder AzuraCast-Playlist +- Moderator beziehungsweise Live-DJ +- Interpret und Titel +- extern aufgelöstes Cover +- Coverquelle und optionalen Store-Link +- Live-/On-Air-Status +- aktuelle Hörerzahl +- Status zwischengespeicherter Metadaten + +Das von AzuraCast gelieferte Artwork wird weiterhin nicht verwendet. Cover werden vom Landwelle-Backend über die konfigurierten externen Quellen aufgelöst und lokal ausgeliefert. + +## Audiowiedergabe + +Der eigenständige Player besitzt eine eigene HTML5-Audioinstanz. Dadurch ist er nicht vom Lebenszyklus der Startseite abhängig. + +Beim Öffnen wird die Wiedergabe nach Möglichkeit automatisch gestartet. Blockiert der Browser Autoplay, erscheint eine klare Aufforderung, einmal auf Play zu klicken. + +Startseite und Popup koordinieren sich über `BroadcastChannel`, sofern der Browser dies unterstützt. Beginnt ein Player mit der Wiedergabe, pausiert eine parallel laufende Landwelle-Audioinstanz im anderen Fenster. So entsteht kein Echo durch zwei gleichzeitig laufende Streams. + +Die Lautstärke wird unter dem notwendigen lokalen Schlüssel `landwelle-player-volume` gespeichert und zwischen Startseite und Playerfenster übernommen. + +## Media Session + +Unterstützte Browser erhalten Interpret, Titel, Sendung und Cover über die Media Session API. Dadurch können System-Medientasten und die Medienanzeige des Betriebssystems den Landwelle-Stream bedienen. + +## Routen und Dateien + +```text +GET /player +GET /api/v1/now +``` + +Dateien: + +- Player-Markup: `web/player.html` +- Player-Gestaltung: `web/assets/player-v15.css` +- Player-Logik: `web/assets/player-v15.js` +- Öffnungslogik der Startseite: `web/assets/app-v13.js` + +## Öffentliche JavaScript-Schnittstelle der Startseite + +```javascript +window.landwellePlayer.open(); +window.landwellePlayer.close(); +window.landwellePlayer.toggle(); +window.landwellePlayer.isPlaying(); +``` + +`open()` öffnet beziehungsweise fokussiert das klassische Playerfenster. `toggle()` steuert weiterhin den kompakten Player auf der Startseite. + +## Programmangabe + +Startseitenplayer und eigenständiges Playerfenster laden den aktuell laufenden Programmslot über: + +```text +GET /api/v1/program/current +``` + +Angezeigt werden Sendungsname, Start- und Endzeit, Moderator und Programmart. Technische AzuraCast-Status- und Coverquellenhinweise werden im öffentlichen Player nicht mehr ausgegeben. diff --git a/docs/MITMACHEN.md b/docs/MITMACHEN.md new file mode 100644 index 0000000..15229ec --- /dev/null +++ b/docs/MITMACHEN.md @@ -0,0 +1,53 @@ +# Musikwünsche und Grüße + +Die öffentliche Seite ist erreichbar unter: + +```text +/mitmachen +``` + +Sie enthält ein Formular für: + +- Name +- Ort +- Interpret +- Songtitel +- Grußtext +- ausdrückliche Zustimmung zur öffentlichen Anzeige + +Einträge werden serverseitig validiert, HTML-escaped ausgegeben und standardmäßig unter folgendem Pfad gespeichert: + +```text +/var/lib/landwelle/wishes.json +``` + +Der Speicherpfad kann geändert werden: + +```dotenv +LANDWELLE_WISHES_FILE=/var/lib/landwelle/wishes.json +``` + +## Pagination + +Die Seite zeigt maximal zehn Einträge. Weitere Einträge werden über `?page=2`, `?page=3` und so weiter geladen. Die Pagination wird vollständig serverseitig erzeugt und funktioniert daher auch ohne JavaScript. + +## Basisschutz + +- verstecktes Honeypot-Feld gegen einfache Bots +- maximal eine erfolgreiche Einsendung pro IP innerhalb von 45 Sekunden +- Längenbegrenzungen für alle Felder +- maximal 500 gespeicherte Einträge; danach werden die ältesten Einträge entfernt +- keine Telefonnummer oder E-Mail-Adresse erforderlich + +Eine redaktionelle Freigabe und Verwaltung im Adminbereich ist für einen späteren Ausbauschritt vorgesehen. + + +## Landwelle Zuhause + +Unter dem öffentlichen Dropdown „Mitmachen“ ist zusätzlich die digitale Landwelle-Welt verlinkt: + +```text +/zuhause/landwelle +``` + +Die Seite stellt die geplante Landwelle-Welt in OpenGenesisLINK vor, erläutert Radio-Sendestation, Events, Festzelt und DJ Jens und enthält eine vorbereitete Slideshow für spätere Originalbilder. Die Navigation wird auf bestehenden Installationen durch Migration `9000_landwelle_zuhause_navigation.sql` ergänzt. diff --git a/docs/MOBILE_APPS.md b/docs/MOBILE_APPS.md new file mode 100644 index 0000000..4bde319 --- /dev/null +++ b/docs/MOBILE_APPS.md @@ -0,0 +1,109 @@ +# Landwelle Mobile App – Android und iOS + +**Stand:** 21. Juli 2026 +**API-Vertrag:** 1.0.0 +**Portal-Mindeststand:** Landwelle v1.4.1 + +## Projektaufteilung + +Die Flutter-App wird in einem eigenen Projekt und einem separaten Chat entwickelt. Das Go-Portal stellt ausschließlich die versionierte Schnittstelle, Inhalte, Installation, Push-Registrierung, Releaseinformationen und optionale Statistik bereit. + +Verbindliche Produktionsbasis: + +```text +https://api.landwelle.de/v1 +``` + +Die App darf keine Website parsen und keine Drittanbieter wie AzuraCast, RSS, Open-Meteo oder Verkehrsdienste direkt abfragen. Alle fachlichen Daten kommen über die Landwelle API. + +## Gemeinsame technische Basis + +Flutter wird für Android und iOS eingesetzt. Gemeinsame Bestandteile: + +- API-Client aus `openapi/landwelle-app-api.yaml` +- Radio- und Audio-Service +- lokaler, zeitlich begrenzter Inhaltscache +- anonyme Installationsidentität +- Push-Service +- Deep-Link-Router +- optionale Nutzungsstatistik nach Einwilligung + +Plattformabhängig: + +- Android Media Session, Audio Focus und Foreground Service +- iOS Audio Session, Now Playing und Remote Command Center +- Android Keystore und iOS Keychain +- FCM auf Android und FCM über APNs auf iOS + +## App-Bereiche + +```text +Radio +Aktuelles +Veranstaltungen +Programm +Charts +Mehr +``` + +Der Player liest Streamadresse, aktuellen Titel, Sendung, Cover und Feature-Flags aus der API. Die Streamadresse wird nicht fest in die App eingebaut. + +## Startablauf + +1. `GET /v1/app/bootstrap` +2. API-Vertrag und Feature-Flags prüfen +3. `GET /v1/station` und `GET /v1/now` +4. Inhalte parallel laden +5. anonyme Installation registrieren +6. Installation-Secret im sicheren Plattform-Speicher ablegen +7. Push nur nach Freigabe registrieren +8. Statistik nur nach separater Einwilligung senden + +## Datenschutz + +Nicht vorgesehen: + +- Werbe-ID +- IMEI, Seriennummer oder Hardware-Fingerprint +- Kontakte +- genaue Standortdaten +- Mikrofonzugriff +- app-übergreifendes Tracking + +Die Installation kann über die API gelöscht werden. Push und Statistik sind getrennte Entscheidungen und dürfen den Radioempfang nicht beeinflussen. + +## Testreihenfolge + +### Android + +1. Debug- und Integrationstests +2. signierte interne APK +3. reale Gerätetests +4. Google Play Internal Testing +5. Closed Testing +6. gestufter Produktionsrollout nach erfolgreicher Abnahme + +### iOS + +1. Simulator- und Gerätetests +2. interne TestFlight-Gruppe +3. externe TestFlight-Gruppe +4. App Review +5. manuelle oder gestufte Veröffentlichung nach erfolgreicher Abnahme + +Die vollständige Storeplanung steht in `docs/MOBILE_STORE_RELEASE_PLAN.md`. + +## Pflichtregel bei API-Lücken + +Fehlt ein Endpunkt, Feld, Filter, Schreibvorgang oder Fehlerzustand, muss der App-Chat eine ausgefüllte Anforderung mit der Überschrift + +```text +API-ERWEITERUNG FÜR DAS LANDWELLE-PORTAL +``` + +ausgeben. Die Vorlage steht in `docs/API_CHANGE_REQUEST_TEMPLATE.md`. Die Serveränderung erfolgt anschließend ausschließlich im Portalprojekt. Website-Scraping oder erfundene API-Pfade sind keine Übergangslösung. + + +## Abgrenzung zur internen App „Landwelle IT“ + +Die Paketkennung `de.landwelle.itmonitor` gehört zu einer separaten internen Android-App. Sie verwendet nicht die Radio-App-Basis `/v1`, sondern ausschließlich die dokumentierten Endpunkte unter `https://api.landwelle.de/api/mobile`. Details stehen in `docs/LANDWELLE_IT_APP.md` und `LANDWELLE_IT_APP_CHATUEBERGABE.md`. diff --git a/docs/MOBILE_STORE_RELEASE_PLAN.md b/docs/MOBILE_STORE_RELEASE_PLAN.md new file mode 100644 index 0000000..28947c1 --- /dev/null +++ b/docs/MOBILE_STORE_RELEASE_PLAN.md @@ -0,0 +1,175 @@ +# Releaseplanung – Google Play und Apple App Store + +**Stand:** 20. Juli 2026 +**Geltung:** Landwelle-App für Android und iOS nach erfolgreichem technischem Test + +Store-Vorgaben ändern sich. Vor jedem Test- oder Produktionsrelease müssen die verlinkten offiziellen Anforderungen erneut geprüft werden. + +## Gemeinsame Freigabevoraussetzungen + +Vor dem ersten Store-Build müssen erfüllt sein: + +- API-Produktion unter `https://api.landwelle.de/v1` +- stabiler Stream bei Display-Aus, App-Wechsel und Netzwechsel +- Play/Pause über Sperrbildschirm, Bluetooth und Headset +- klare Offline-, Timeout- und Streamfehlerzustände +- Datenschutzerklärung innerhalb der App und als öffentliche Webseite +- Impressum, Supportkontakt und Löschmöglichkeit der anonymen Installation +- Push und optionale Nutzungsstatistik nur nach Einwilligung +- keine Server-Secrets im App-Bundle +- vollständige Tests auf mehreren realen Smartphones und mindestens einem Tablet je unterstützter Plattform +- Store-Screenshots aus dem tatsächlichen Releasebuild +- nachvollziehbare Release Notes +- Version und Buildnummer in App, Store und Release-API identisch + +## Android + +### Phase A – interner Landwelle-Test + +- Release-APK für direkte Installation erstellen +- dauerhaften Signierschlüssel sicher offline sichern +- Testkanal `sideload` oder `beta` in `/v1/releases` pflegen +- Installations-, Update-, Player-, Push- und Offlineabläufe testen +- keine automatische APK-Installation; nur Betriebssystemdialog + +### Phase B – Google Play vorbereiten + +- Google-Play-Entwicklerkonto und Identität vollständig verifizieren +- endgültige Application ID festlegen, beispielsweise `de.landwelle.radio` +- Android App Bundle (`.aab`) erstellen +- Play App Signing aktivieren +- Titel, Kurzbeschreibung, Langbeschreibung, Icon, Feature Graphic und Screenshots vorbereiten +- Kontaktadresse, Website und Datenschutzerklärung hinterlegen +- Inhaltsbewertung, Zielgruppe, Werbeangabe und Data-Safety-Formular ausfüllen +- verwendete Flutter-/Firebase-SDKs in die Datenschutzerklärung und Data-Safety-Prüfung einbeziehen + +Auch Apps ohne erhobene Nutzerdaten müssen bei Google Play das Data-Safety-Formular ausfüllen und eine Datenschutzerklärung verlinken. + +### Phase C – Tests in Google Play + +1. Internal Testing für Team und technische Prüfer +2. Closed Testing mit realen Hörern +3. Feedback, Abstürze, Akkuverbrauch und Streamstabilität auswerten +4. Fehler beheben und neuen AAB-Build veröffentlichen +5. Produktionszugang beantragen, sobald die im Play-Console-Konto angezeigten Voraussetzungen erfüllt sind + +Für neue persönliche Entwicklerkonten, die nach dem 13. November 2023 erstellt wurden, nennt Google derzeit mindestens 12 angemeldete Tester über 14 Tage vor dem Antrag auf Produktionszugang. Maßgeblich ist immer die konkrete Anzeige in der Play Console. + +### Phase D – Produktion + +- zunächst kleiner gestufter Rollout +- Crashrate, ANR, Streamabbrüche und API-Fehler überwachen +- Rollout bei kritischen Fehlern anhalten +- anschließend schrittweise auf 100 Prozent erhöhen +- `google_play` im Bootstrap erst aktivieren, wenn die Store-Seite tatsächlich verfügbar ist +- Store-URL und Release in `app_releases` veröffentlichen + +### Android-Ziel-API + +Google kündigt für den 31. August 2026 an, dass neue Apps und Updates für Mobilgeräte Android 16 beziehungsweise API-Level 36 oder höher als Ziel verwenden müssen. Da der Landwelle-Storestart danach liegen kann, soll der Releasebuild von Beginn an mit der dann aktuellen Flutter-/Android-Toolchain und mindestens diesem Target SDK vorbereitet werden. + +Offizielle Referenzen: + +- https://developer.android.com/google/play/requirements/target-sdk +- https://support.google.com/googleplay/android-developer/answer/14151465 +- https://support.google.com/googleplay/android-developer/answer/9845334 +- https://support.google.com/googleplay/android-developer/answer/10787469 +- https://support.google.com/googleplay/android-developer/answer/10144311 +- https://support.google.com/googleplay/android-developer/answer/9859152 +- https://support.google.com/googleplay/android-developer/answer/9866151 + +## iOS + +### Phase A – Voraussetzungen + +- Apple Developer Program abschließen +- bei Organisationskonto rechtliche Einheit, D-U-N-S-Nummer, Domain-E-Mail und Website vorbereiten +- endgültigen Bundle Identifier festlegen, beispielsweise `de.landwelle.radio` +- App ID, Signierung und benötigte Capabilities einrichten +- Background Audio aktivieren +- APNs-Schlüssel mit Firebase Cloud Messaging verbinden + +Apple nennt für das reguläre Developer Program derzeit eine jährliche Gebühr von 99 US-Dollar in lokaler Währung, sofern keine Gebührenbefreiung greift. + +### Phase B – interner TestFlight-Test + +- signierten Releasebuild zu App Store Connect hochladen +- interne TestFlight-Gruppe mit Teammitgliedern anlegen +- Player, Audio Session, Now Playing, Remote Command Center, Push und Deep Links prüfen +- IPv6-only-Netz, schlechte Verbindung, Bluetoothwechsel und Unterbrechungen testen +- Buildmetriken, Abstürze und Testerfeedback auswerten + +### Phase C – externer TestFlight-Test + +- Beta-Testinformationen und Kontaktangaben ausfüllen +- externe Testgruppe mit ausgewählten Landwelle-Hörern anlegen +- TestFlight Beta App Review durchlaufen +- mehrere reale iPhone-Generationen und mindestens ein iPad einbeziehen +- alle kritischen Fehler vor App-Store-Einreichung schließen + +### Phase D – App Store + +- Appname, Untertitel, Beschreibung, Keywords, Kategorie und Support-URL +- Screenshots für die verlangten Gerätegrößen +- App-Privacy-Angaben passend zum tatsächlichen Datenfluss +- Datenschutzerklärung und Löschmöglichkeit +- Review Notes mit Hinweis auf Livestream, Hintergrundwiedergabe, Push und Testschritte +- App-Version zur Prüfung einreichen +- nach Freigabe manuell oder gestuft veröffentlichen +- `ios_app` im Bootstrap erst nach tatsächlicher Verfügbarkeit aktivieren +- `app_store`-Release und Store-URL in `app_releases` pflegen + +Apple erlaubt Hintergrunddienste für ihren vorgesehenen Zweck, darunter Audiowiedergabe. Die App darf Background Audio daher ausschließlich für den laufenden Radiostream verwenden. Sie muss außerdem in IPv6-only-Netzen funktionsfähig sein. + +Offizielle Referenzen: + +- https://developer.apple.com/help/account/membership/program-enrollment/ +- https://developer.apple.com/help/app-store-connect/test-a-beta-version/testflight-overview/ +- https://developer.apple.com/help/app-store-connect/test-a-beta-version/add-internal-testers/ +- https://developer.apple.com/help/app-store-connect/test-a-beta-version/provide-test-information/ +- https://developer.apple.com/help/app-store-connect/manage-submissions-to-app-review/overview-of-submitting-for-review/ +- https://developer.apple.com/app-store/review/guidelines/ + +## Serverseitige Voraussetzungen vor Storefreigabe + +Vor der Aktivierung von Push und Store-Flags müssen im Portalprojekt zusätzlich abgeschlossen sein: + +- produktiv getesteter FCM-HTTP-v1-Versandworker einschließlich APNs-Zustellung für iOS +- Adminverwaltung für Push-Kampagnen oder ein dokumentierter sicherer Betriebsprozess +- Adminpflege für `app_releases`, Store-URLs, Mindestversionen und Pflichtupdates +- externes Monitoring für `https://api.landwelle.de/v1/app/bootstrap`, `/now` und `/health` +- Contract-Test der veröffentlichten API gegen `openapi/landwelle-app-api.yaml` + +Die API v1 unterstützt bereits Installations-, Push-Token-, Themen-, Release- und Kompatibilitätsdaten. Nicht aktiv konfigurierte oder noch nicht betriebene Funktionen bleiben über Feature-Flags ausgeschaltet. + +## Serverseitige Umschaltung nach erfolgreichem Test + +Erst nach erfolgreicher Abnahme werden die entsprechenden Variablen gesetzt: + +```text +LANDWELLE_APP_ANDROID_SIDELOAD_ENABLED=true +LANDWELLE_APP_GOOGLE_PLAY_ENABLED=true +LANDWELLE_APP_IOS_ENABLED=true +``` + +Nicht verfügbare Kanäle bleiben `false`. Die App muss diese Feature-Flags respektieren. + +Für jedes veröffentlichte Release wird ein Datensatz in `app_releases` gepflegt. Die App prüft den passenden Kanal über: + +```text +GET /v1/app/compatibility +GET /v1/releases +``` + +## Go/No-Go-Entscheidung + +Ein Store-Release erfolgt nur, wenn alle folgenden Punkte mit „Ja“ beantwortet sind: + +- Läuft der Stream über mehrere Stunden stabil im Hintergrund? +- Funktionieren Android Media Session und iOS Now Playing vollständig? +- Sind Datenschutzangaben und tatsächliches Verhalten deckungsgleich? +- Sind Installation löschen, Push-Abmeldung und Tokenwechsel getestet? +- Sind API und App rückwärtskompatibel? +- Gibt es keine kritischen oder hohen offenen Fehler? +- Sind Storetexte, Screenshots, Support und Rechtstexte vollständig? +- Wurde der Produktionsbuild auf realen Geräten geprüft? diff --git a/docs/NAVIGATION_ADMIN.md b/docs/NAVIGATION_ADMIN.md new file mode 100644 index 0000000..264d256 --- /dev/null +++ b/docs/NAVIGATION_ADMIN.md @@ -0,0 +1,9 @@ +# Datenbankbasierte öffentliche Navigation + +Adminroute: `/admin/navigation` +Berechtigung: `navigation.manage` +Tabelle: `landwelle.navigation_items` + +Die öffentliche Hauptnavigation wird zentral aus PostgreSQL geladen und für 45 Sekunden im Prozess zwischengespeichert. Speichern oder Löschen invalidiert den Cache sofort. Fällt PostgreSQL aus oder enthält die Tabelle keine aktive Struktur, wird die fest im Code definierte Landwelle-Standardnavigation verwendet. + +Unterstützt werden Hauptpunkte und genau eine Dropdown-Ebene. Interne Links beginnen mit `/`; externe Links müssen `https://` oder `mailto:` verwenden. Optional können Links in einem neuen Fenster geöffnet werden. diff --git a/docs/NEWS_STUDIO.md b/docs/NEWS_STUDIO.md new file mode 100644 index 0000000..b01ce79 --- /dev/null +++ b/docs/NEWS_STUDIO.md @@ -0,0 +1,68 @@ +# KI-Nachrichtenstudio + +**Stand: Landwelle v1.5.42 – 18. August 2026** + +## Produktionsumfang + +Die drei Bereiche werden manuell und über automatische Aufgaben getrennt produziert: + +- 3 Nachrichten +- 1 Sport +- 1 Wetter + +Alle Bereiche verwenden ihre im Admin gespeicherten Fach-Prompts, ElevenLabs-Stimmen, Musikbetten, Pegel und FTP-Ziele. Der zentrale KeyHelp-Cron startet jeden Bereich separat über die jeweils in `/admin/ai/auto-tasks` hinterlegte Aufgabe. Nachrichten, Sport und Wetter können unterschiedliche Uhrzeiten und Wochentage besitzen. + +## Nachrichten + +„Nachrichten Welt“ ist ab v1.5.40 vollständig von den lokalen Niedersachsen-News getrennt. Vor jeder Produktion lädt das Portal ausschließlich heutige Meldungen aus: + +- `welt.de` +- `ntv.de` +- `tagesschau.de` + +Die frühere Landeszeitung-Quelle und die technisch erzwungene Lokalquote werden in diesem Produktionsweg nicht mehr verwendet. Der gespeicherte Fach-Prompt ist für Aktualität, Themenauswahl, Stil und Ausgabeformat maßgeblich. Zusätzlich bindet der Server jede der drei erzeugten Meldungen an eine eindeutige `source_id` aus dem bereitgestellten Tagesmaterial. + +Die allgemeine OpenAI-Systemanweisung darf für diesen Bereich keine Niedersachsen-Quote oder zusätzliche Lokalquelle erzwingen. Rein lokale Niedersachsen-Themen sollen nicht gewählt werden, sofern sie nicht aufgrund ihrer bundesweiten oder internationalen Bedeutung eindeutig zu den wichtigsten Nachrichten des Tages gehören. + +Die Quellensammlung filtert nach dem aktuellen Kalendertag in `Europe/Berlin`. Stehen weniger als drei nachweislich heutige Meldungen aus den freigegebenen Feeds bereit, bricht die Produktion ab statt ältere oder fremde Quellen einzusetzen. + +## Sport + +Vor jeder Sportproduktion lädt das Portal automatisch aktuelle RSS-Meldungen aus: + +- Sportschau: `LANDWELLE_SPORT_SOURCE_SPORTSCHAU` +- kicker: `LANDWELLE_SPORT_SOURCE_KICKER` + +Standardwerte: + +```text +LANDWELLE_SPORT_SOURCE_SPORTSCHAU=https://www.sportschau.de/index~rss2.xml +LANDWELLE_SPORT_SOURCE_KICKER=https://newsfeed.kicker.de/news/aktuell +LANDWELLE_SPORT_SOURCE_MAX_AGE=48h +``` + +Der Sportbeitrag wird quellengebunden aus den automatisch geladenen Sportschau- und kicker-Meldungen erzeugt und verwendet genau eine passende `source_id`. + +Wenn eine der beiden Sportquellen vorübergehend nicht erreichbar ist, kann mit der verbleibenden Quelle weitergearbeitet werden, sofern mindestens eine geeignete aktuelle Meldung vorhanden ist. Ist keine geeignete aktuelle Meldung verfügbar, wird die Produktion mit einem Fehler beendet statt Inhalte zu erfinden. + +## Wetter + +Wetter verwendet den vorhandenen `WeatherService`. Dieser lädt aktuelle Mess- und Vorhersagedaten über Open-Meteo. Vor dem OpenAI-Aufruf werden unter anderem übergeben: + +- aktueller Zustand und Temperatur +- gefühlte Temperatur +- Luftfeuchtigkeit +- Windgeschwindigkeit und Windrichtung +- Niederschlag und Regenwahrscheinlichkeit +- UV-Index +- Vorhersage mit Tiefst-/Höchstwerten und Wetterlage + +Dadurch müssen Wetter-Rohdaten nicht mehr manuell in das Briefing eingefügt werden. Quellenanforderungen in älteren Fach-Prompts, die etwa wetter.de oder wetter.com verlangen, werden für den automatischen Produktionslauf durch die serverseitig bereitgestellten Wetterdaten übersteuert. + +## Schutz vor nicht sendefertigen Antworten + +`validateSendReadyAudioText` erkennt typische OpenAI-Rückfragen nach fehlenden Rohdaten oder nach den Themen bereits erzeugter Beiträge. Wird eine solche Antwort erkannt, endet der Lauf vor ElevenLabs und FTP mit einem klaren Fehler. Eine Rückfrage wird damit nicht mehr versehentlich vertont oder hochgeladen. + +## Optionales Briefing + +Das Feld „Ausgangsmaterial / Briefing“ im Admin bleibt erhalten. Es dient nur als zusätzliche redaktionelle Vorgabe. Die technischen Sport- und Wetter-Rohdaten werden unabhängig davon automatisch geladen. diff --git a/docs/ONTOUR.md b/docs/ONTOUR.md new file mode 100644 index 0000000..5cb6d6a --- /dev/null +++ b/docs/ONTOUR.md @@ -0,0 +1,8 @@ +# Landwelle OnTour + +Öffentliche Route: `/ontour` +Kanal: `https://www.youtube.com/@landwelle` + +Der Server ermittelt die YouTube-Kanal-ID und lädt anschließend den öffentlichen Atom-Feed `https://www.youtube.com/feeds/videos.xml?channel_id=...`. Die Ergebnisse werden 15 Minuten zwischengespeichert. Mit `LANDWELLE_YOUTUBE_CHANNEL_ID` kann die Kanal-ID fest gesetzt werden. + +Vorschaubilder werden serverseitig über `/ontour/thumbnail/` ausgeliefert. Die eigentliche YouTube-Einbettung wird nur nach Zustimmung zur Kategorie „Externe Medien“ geladen. Ohne Einwilligung bleibt ein direkter Link zum Video verfügbar. diff --git a/docs/OPERATIONS.md b/docs/OPERATIONS.md new file mode 100644 index 0000000..94e625c --- /dev/null +++ b/docs/OPERATIONS.md @@ -0,0 +1,174 @@ +# Betrieb und Wartung + +## Regelmäßige Kontrolle + +- Startseite und `/health` erreichbar +- `/ready` bestätigt PostgreSQL-Verbindung +- Livestream startet +- letzte erfolgreiche RSS-Runde aktuell +- keine Quelle in dauerhafter Fehlerlage +- ausreichend Speicherplatz für Uploads und Logs +- Datenbankbackup aktuell +- Dienst läuft ohne Neustartschleife + +## Kommandos + +```bash +sudo systemctl status landwelle-radio +journalctl -u landwelle-radio -f +curl -fsS http://127.0.0.1:2200/health +curl -fsS http://127.0.0.1:2200/ready +ss -ltnp | grep ':2200' +df -h +``` + +## Monitoring + +- Prozess/Liveness +- Readiness mit PostgreSQL +- Datenbankpool und Verbindungsfehler +- letzte erfolgreiche Feedrunde +- Feedfehler nach Quelle +- Importmengen und Duplikatrate +- Regionen ohne aktuelle Meldung +- Streamquelle +- Zertifikatsablauf +- Backupalter + +## PostgreSQL-Backups + +Zu sichern: + +- PostgreSQL-Datenbank per `pg_dump` +- `/var/lib/landwelle/uploads/` +- `/etc/landwelle/landwelle.env` +- Reverse-Proxy-Konfiguration + +Beispiel: + +```bash +pg_dump --format=custom --file=/srv/backups/landwelle-$(date +%F-%H%M).dump "$DATABASE_URL" +``` + +Empfehlungen: + +- tägliches automatisches Backup +- mehrere Generationen +- Kopie auf anderem Datenträger oder System +- Backup vor jeder Migration +- regelmäßiger Restore-Test + +## RSS-Betrieb + +- einzelne Feeds dürfen den Import nicht blockieren +- Abrufintervalle respektieren +- bei vielen Fehlern Backoff verwenden +- Nutzungsstatus regelmäßig kontrollieren +- Quellenänderungen und Freigaben auditieren +- Feed-URLs nicht automatisch aus unbekannten Weiterleitungen übernehmen + +## Updateablauf + +1. Changelog prüfen. +2. Datenbank und Uploads sichern. +3. Migrationen in Testumgebung prüfen. +4. neues Binary bereitstellen. +5. Migrationen ausführen. +6. Dienst neu starten. +7. `/health`, `/ready`, Startseite, Stream und Feedstatus prüfen. +8. bei Fehlern Anwendung zurückrollen; Datenbankänderungen nach Migrationsplan behandeln. + +## Typische Störungen + +### PostgreSQL nicht erreichbar + +- Netzwerk und DNS prüfen +- `pg_hba.conf` und Firewall prüfen +- Zertifikats- oder Passwortfehler im Journal prüfen +- Datenbankserverstatus kontrollieren +- keine lokale Ersatzdatenbank anlegen + +### RSS-Quelle fehlerhaft + +- Feedtest im Adminbereich +- HTTP-Status, Redirect und Content-Type prüfen +- ETag/Last-Modified zurücksetzen, falls Quelle fehlerhafte Werte liefert +- Parserfehler analysieren +- Quelle vorübergehend deaktivieren, andere Feeds weiterlaufen lassen + +### Keine regionale Vielfalt + +- Abdeckungsmatrix prüfen +- Quellen- und Regionszuordnung kontrollieren +- Startseitenquote und Quellenlimit prüfen +- veraltete oder ausgefallene Regionalfeeds ersetzen + +## App- und Push-Betrieb + +Zusätzlich überwachen: + +- letzte erfolgreiche Kommunikation mit FCM +- Push-Queue und älteste wartende Kampagne +- Anteil ungültiger Tokens +- Fehlerquote je App-Version +- letzte Tagesaggregation +- auslaufende Zertifikate und Signaturen +- veröffentlichte Releases und Download-Erreichbarkeit + +Backups umfassen PostgreSQL-Tabellen für Releases, Kampagnen und aggregierte Statistik. Firebase-Service-Account, App-Signierschlüssel, Apple-Zertifikate und Push-Verschlüsselungsschlüssel werden getrennt gesichert und niemals gemeinsam mit öffentlichen Artefakten ausgeliefert. + +## Releasebetrieb + +Für jede App-/Player-Version archivieren: + +- Originalartefakt +- Signatur +- SHA-256 +- Buildprotokoll +- Quellcommit +- Release Notes +- Veröffentlichungszeitpunkt +- Rückzug/Ersetzung + + +## Adminzugang einrichten + +```bash +sudo ./scripts/setup-admin-on-pi.sh +sudo systemctl status landwelle-radio --no-pager +``` + +Login anschließend unter `/admin`. Bei Problemen: + +```bash +sudo journalctl -u landwelle-radio -n 100 --no-pager +sudo grep -E '^LANDWELLE_ADMIN_(USER|PASSWORD_HASH)=' /etc/landwelle/landwelle.env +``` + +Den Hash niemals veröffentlichen oder in ein öffentliches Repository einchecken. + +## Wetter prüfen + +```bash +curl -fsS http://127.0.0.1:2200/api/v1/weather | python3 -m json.tool +``` + +Wenn der Wetteranbieter kurzzeitig nicht erreichbar ist, wird nach einem vorherigen erfolgreichen Abruf die letzte Cache-Antwort ausgeliefert. + +## AzuraCast und Cover überwachen + +```bash +curl -fsS http://127.0.0.1:2200/api/v1/now | python3 -m json.tool +sudo journalctl -u landwelle-radio -f +sudo du -sh /var/lib/landwelle/covers +``` + +Ein vorübergehender AzuraCast-Ausfall stoppt das Portal nicht. Die API liefert die letzte erfolgreiche Momentaufnahme oder ein lokales Fallback mit `stale: true`. Fehler werden nach fünf Sekunden erneut geprüft. + +Der Covercache kann bei Bedarf geleert werden. Beim nächsten Titelabruf werden benötigte Bilder erneut gesucht: + +```bash +sudo systemctl stop landwelle-radio +sudo rm -f /var/lib/landwelle/covers/*.img /var/lib/landwelle/covers/*.json +sudo systemctl start landwelle-radio +``` diff --git a/docs/PLAYLIST.md b/docs/PLAYLIST.md new file mode 100644 index 0000000..6a5922d --- /dev/null +++ b/docs/PLAYLIST.md @@ -0,0 +1,29 @@ +# Playlist-Historie + +**Stand: Landwelle v1.5.26** + +Die Seite `/playlist` zeigt die auf Landwelle gelaufenen Titel aus PostgreSQL. + +## Funktionen + +- 15 Einträge pro Seite +- chronologische Sortierung +- Gruppierung nach Wochentag und Datum +- Suche nach Titel, Interpret und Album +- Datumsfilter +- Uhrzeitfilter +- Pagination mit erhaltenen Filtern + +## Datenquelle + +AzuraCast liefert Interpret, Titel, Album und Zeitpunkt. Die Daten werden durch den Now-Playing-Dienst in `playlist_history` gespeichert. + +## Cover + +Cover werden ausschließlich über Apple iTunes gesucht und lokal gecacht. AzuraCast-Artwork wird nicht verwendet. + +## Migration + +```text +migrations/0011_playlist_history.sql +``` diff --git a/docs/POSTGRESQL.md b/docs/POSTGRESQL.md new file mode 100644 index 0000000..66dbfff --- /dev/null +++ b/docs/POSTGRESQL.md @@ -0,0 +1,117 @@ +# PostgreSQL für Landwelle + +## Grundsatz + +Landwelle verwendet ausschließlich PostgreSQL für persistente Daten. Auf dem Raspberry Pi wird keine SQLite-Datei angelegt. Der vorhandene PostgreSQL-Server bleibt ein separater Dienst im privaten Netz oder auf einem abgesicherten Host. + +## Empfohlene Datenbankobjekte + +- Datenbank: `landwelle` +- Anwendungsrolle: `landwelle_app` +- Migrationsrolle: optional `landwelle_migrator` +- Schema: `landwelle` + +Die Anwendungsrolle erhält nur die Rechte, die sie für den normalen Betrieb benötigt. Erweiterte DDL-Rechte können auf eine separate Migrationsrolle beschränkt werden. + +## Beispielhafte Einrichtung + +Als PostgreSQL-Administrator: + +```sql +CREATE ROLE landwelle_app LOGIN PASSWORD 'EIN_LANGES_ZUFAELLIGES_PASSWORT'; +CREATE DATABASE landwelle OWNER landwelle_app; +\connect landwelle +CREATE SCHEMA IF NOT EXISTS landwelle AUTHORIZATION landwelle_app; +ALTER ROLE landwelle_app IN DATABASE landwelle SET search_path = landwelle, public; +``` + +Für eine strengere Trennung sollte die Datenbank durch eine Eigentümer- oder Migrationsrolle verwaltet und der App-Rolle nur DML-Rechte erteilt werden. + +## Verbindung + +```text +DATABASE_URL=postgres://landwelle_app:PASSWORT@DB-HOST:5432/landwelle?sslmode=require +``` + +Im rein privaten Netz kann je nach vorhandener PostgreSQL-Konfiguration ein anderer TLS-Modus nötig sein. Für Verbindungen über nicht vollständig vertrauenswürdige Netze ist TLS mit Zertifikatsprüfung vorzusehen. + +## Netzwerk + +- PostgreSQL-Port nicht ins öffentliche Internet freigeben +- `pg_hba.conf` auf die IP des Raspberry Pi beziehungsweise das Anwendungsnetz begrenzen +- Firewall nur für die benötigte Verbindung öffnen +- DNS oder feste interne Adresse verwenden +- Verbindungsabbruch und Neustart des DB-Servers müssen von der Go-Anwendung abgefangen werden + +## Connection Pool + +Startwerte: + +```text +DB_MAX_OPEN_CONNS=10 +DB_MAX_IDLE_CONNS=5 +DB_CONN_MAX_LIFETIME=30m +DB_CONNECT_TIMEOUT=5s +``` + +Die endgültigen Werte werden anhand tatsächlicher Last und der Gesamtzahl anderer PostgreSQL-Clients angepasst. + +## Migrationen + +- SQL-Dateien versionieren +- vor jedem Deployment Backup erstellen +- Migrationen als separates Kommando ausführen +- Anwendung erst starten, wenn der erwartete Migrationsstand erreicht ist +- irreversible Änderungen in mehrere sichere Schritte aufteilen +- Schemaänderungen zuerst abwärtskompatibel ausrollen + +Geplante Dateien: + +```text +migrations/0001_postgresql_core.sql +migrations/0002_rss_ingestion.sql +``` + +## Backups + +Beispiel: + +```bash +pg_dump --format=custom --file=landwelle-$(date +%F-%H%M).dump "$DATABASE_URL" +``` + +Wiederherstellung muss regelmäßig in einer separaten Testdatenbank geprüft werden. Uploads werden unabhängig von PostgreSQL gesichert. + +## Monitoring + +- Verbindung und einfache Query im `/ready`-Endpunkt +- Poolauslastung +- langsame Abfragen +- Datenbankgröße +- letzte erfolgreiche Migration +- Backupalter +- Fehlerquote des RSS-Imports + +## Ausfallverhalten + +Bei kurzfristigem PostgreSQL-Ausfall: + +- bestehende HTTP-Anfragen erhalten eine verständliche Fehlerseite oder begrenzte Cacheantwort +- der Prozess stürzt nicht absichtlich ab +- der RSS-Worker pausiert und versucht später erneut +- `/health` bleibt positiv, `/ready` wird negativ +- keine lokalen Schattenkopien als zweite Datenbank einführen + +## App-, Push- und Releaseerweiterung + +Migration `0003_app_clients_push.sql` ergänzt: + +- anonyme App-Installationen +- verschlüsselte Push-Tokens +- Push-Themen und Abonnements +- Push-Kampagnen und Versandstatus +- kurzlebige Nutzungsereignisse +- aggregierte Tagesstatistik +- Android-, iOS-, Windows-, Linux- und macOS-Releases + +Der PostgreSQL-Server speichert keine Hardware-IDs. FCM-Tokens werden vor dem Schreiben in die Datenbank anwendungsseitig verschlüsselt. diff --git a/docs/PROGRAM_ADMIN.md b/docs/PROGRAM_ADMIN.md new file mode 100644 index 0000000..8f4fe78 --- /dev/null +++ b/docs/PROGRAM_ADMIN.md @@ -0,0 +1,27 @@ +# Programmverwaltung im Adminbereich + +**Stand: Landwelle v1.5.26** + +Die Programmverwaltung ist unter `/admin/program` erreichbar. + +## Funktionen + +Sendungen können angelegt, bearbeitet, aktiviert, deaktiviert und gelöscht werden. Pflegbar sind Wochentag, Start- und Endzeit, Sendungsname, Moderator beziehungsweise Teammitglied, Programmart, Beschreibung und Bild. + +Überschneidungen werden serverseitig geprüft, auch bei Sendungen über Mitternacht. Der aktuell laufende Eintrag wird anhand von Wochentag und Uhrzeit ermittelt. + +## Speicherung + +Bei konfiguriertem PostgreSQL werden Programmslots relational in `landwelle.program_slots` gespeichert. Teamdaten werden über die verknüpfte Teamtabelle ergänzt. + +Ohne PostgreSQL steht für Entwicklung und Fallback die atomar geschriebene Datei zur Verfügung: + +```text +/var/lib/landwelle/program.json +``` + +Der Pfad kann mit `LANDWELLE_PROGRAM_FILE` geändert werden. Produktiv ist PostgreSQL der verbindliche Datenbestand. + +## Veröffentlichung + +Änderungen erscheinen ohne Dienstneustart auf der Startseite, unter `/programm` und in der App-API. Deaktivierte Einträge werden öffentlich nicht ausgegeben. diff --git a/docs/PROJECT_VISION.md b/docs/PROJECT_VISION.md new file mode 100644 index 0000000..96e32bd --- /dev/null +++ b/docs/PROJECT_VISION.md @@ -0,0 +1,65 @@ +# Produktvision + +## Kernidee + +Landwelle soll das digitale Zuhause für Radio, Nachrichten und Gemeinschaft im ländlichen Niedersachsen werden. Der Livestream bleibt das Herzstück, wird aber durch ein glaubwürdiges Regionalportal ergänzt. + +## Zielgruppen + +### Hörerinnen und Hörer + +Sie möchten den Livestream schnell starten, wissen, welche Sendung läuft, regionale Nachrichten lesen und Veranstaltungen finden. + +### Vereine, Initiativen und Veranstalter + +Sie möchten Termine, Aktionen und Meldungen unkompliziert an die Redaktion übermitteln. + +### Redaktion und Moderation + +Sie benötigen einen einfachen Arbeitsbereich, um Inhalte, Programm, Streaminformationen und Medien ohne technische Kenntnisse zu pflegen. + +### Regionale Unternehmen und Partner + +Sie benötigen klar gekennzeichnete, seriöse Präsentations- und Werbemöglichkeiten mit regionalem Bezug. + +## Produktprinzipien + +1. **Radio zuerst:** Der Livestream muss auf jeder relevanten Seite leicht erreichbar sein. +2. **Regional statt beliebig:** Inhalte sollen einen klaren Bezug zu Niedersachsen und den ausgewählten Regionen besitzen. +3. **Schnell verständlich:** Startseite und Navigation müssen ohne Einarbeitung funktionieren. +4. **Redaktionell kontrolliert:** Öffentliche Einsendungen werden vor Veröffentlichung geprüft. +5. **Raspberry-Pi-tauglich:** Die Basisanwendung bleibt ressourcenschonend und einfach betreibbar. +6. **Mobile Nutzung:** Die Seite wird primär für reale Smartphone-Nutzung mitgedacht. +7. **Verlässlichkeit:** Stream, Kerninformationen und Kontaktwege dürfen nicht von unnötig komplexen Diensten abhängen. +8. **Schrittweiser Ausbau:** Neue Funktionen werden modular ergänzt, ohne das funktionierende Portal unnötig umzubauen. + +## Erfolgskriterien + +- der Stream lässt sich mit wenigen Interaktionen starten +- Besucher finden regionale Nachrichten und Veranstaltungen schnell +- Redakteure können Inhalte ohne Codeänderung veröffentlichen +- das System läuft stabil auf dem Raspberry Pi 5 +- Updates und Backups sind dokumentiert und wiederholbar +- die Marke Landwelle bleibt in Farbe, Tonalität und Bildsprache klar erkennbar + +## Nicht-Ziele der ersten Produktionsversion + +- vollständiges soziales Netzwerk +- ungeprüfte Nutzerveröffentlichungen +- komplexe Mandantenfähigkeit für mehrere Radiosender +- hochverfügbare Großcluster-Infrastruktur +- gleichzeitige Store-Erstveröffentlichung; Android wird zuerst intern getestet, iOS folgt über TestFlight + +## Landwelle auf allen relevanten Geräten + +Landwelle soll dort verfügbar sein, wo Menschen Radio hören und regionale Informationen abrufen: + +- im Browser +- auf Android, zunächst als direkte APK und später über Google Play +- auf iPhone und iPad, später über TestFlight und App Store + +Webportal sowie Android- und iOS-App erhalten Inhalte und Streamkonfiguration aus der zentralen Portal- und API-Plattform. Dadurch bleibt das redaktionelle System zentral und die Nutzererfahrung über Plattformen konsistent. + +## Direkter Kontakt ohne Plattformabhängigkeit + +Push-Mitteilungen ergänzen den Livestream und das Portal. Themen und Regionen werden freiwillig gewählt. Die Redaktion kann über den eigenen Adminbereich kommunizieren, während Firebase ausschließlich als technischer Zustelldienst eingesetzt wird. diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..44a5b9e --- /dev/null +++ b/docs/README.md @@ -0,0 +1,53 @@ +# Landwelle-Dokumentation + +Dieser Ordner enthält dauerhafte technische und fachliche Dokumentation. Releaseverläufe gehören nicht hierher, sondern ausschließlich in `../CHANGELOG.md`. + +## Einstieg und Architektur + +- `CURRENT_STATE.md` – verbindlicher Iststand +- `PROJECT_VISION.md` – fachliche Zielsetzung +- `ARCHITECTURE.md` – Systemaufbau und Modulgrenzen +- `CONTENT_MODEL.md` – Daten- und Inhaltsmodell +- `DECISIONS.md` – wichtige technische Entscheidungen +- `DESIGN_SYSTEM.md` – Gestaltungsgrundlagen + +## Betrieb und Sicherheit + +- `CONFIGURATION.md` – Umgebungsvariablen und Konfiguration +- `DEPLOYMENT_RASPBERRY_PI.md` – Bereitstellung auf dem Raspberry Pi +- `OPERATIONS.md` – laufender Betrieb, Monitoring und Backups +- `DATABASE_MIGRATOR.md` – Migrationsablauf +- `POSTGRESQL.md` – Datenbankbetrieb +- `SECURITY.md` – Sicherheitsregeln +- `TESTING.md` – Teststrategie +- `THIRD_PARTY_LICENSES.md` – eingesetzte Drittanbieter + +## APIs und Apps + +- `API.md` – öffentliche App-API +- `MOBILE_APPS.md` – Architektur der Radio-App +- `LANDWELLE_IT_APP.md` – interne Todo-App +- `FIREBASE_PUSH.md` – Firebase-Push +- `MOBILE_STORE_RELEASE_PLAN.md` – Store-Test- und Freigabeplanung +- `API_CHANGE_REQUEST_TEMPLATE.md` – verbindliche Vorlage für API-Erweiterungen + +Maschinenlesbare Verträge liegen in `../openapi/`. + +## Inhalte und öffentliche Funktionen + +- `ADMINBEREICH.md` – Verwaltungsoberfläche +- `CONTENT_PAGES.md` – Presse, Karriere, FAQ und Kontakt +- `EDITORIAL_MEDIA.md` – Redaktion und Medien +- `FORUM.md` – Forum und öffentliche Konten +- `LISTENER_CHARTS.md` – Chartplattform +- `EVENT_CALENDAR.md` und `EVENT_SEARCH.md` – Veranstaltungen +- `NAVIGATION_ADMIN.md` – öffentliche Navigation +- `ADVERTISING.md`, `DIRECTORY.md`, `JOBS.md`, `ONTOUR.md` – Wachstums- und Regionalmodule +- `LIVE_PLAYER.md`, `PLAYLIST.md`, `PROGRAM_ADMIN.md` – Radiobetrieb +- `RSS_INGESTION.md`, `RSS_SOURCES.md` – Nachrichtenquellen +- `ANALYTICS_PRIVACY.md`, `COOKIE_CONSENT.md`, `LEGAL_PAGES.md` – Statistik, Consent und Rechtstexte +- `AI_TRANSPARENCY.md` – Kennzeichnung, redaktionelle Verantwortung und KI-Audiohinweise + +## Pflegeprinzip + +Dokumente beschreiben den aktuellen Vertrag oder Betrieb und werden an Ort und Stelle aktualisiert. Für frühere Zustände wird keine neue Kopie angelegt. Historische Änderungen werden kompakt in `CHANGELOG.md` dokumentiert. diff --git a/docs/REGION_COVERAGE.md b/docs/REGION_COVERAGE.md new file mode 100644 index 0000000..ad40922 --- /dev/null +++ b/docs/REGION_COVERAGE.md @@ -0,0 +1,71 @@ +# Regionale Abdeckung Niedersachsens + +## Ziel + +Die Nachrichtenansicht soll Niedersachsen flächendeckend abbilden und nicht nur Meldungen aus Hannover oder einzelnen größeren Städten zeigen. + +## Verwaltungsebene + +Die Datenbank bildet mindestens ab: + +- Landkreise +- Region Hannover +- kreisfreie Städte +- optionale lokale Unterregionen und Gemeinden +- redaktionelle Großräume für Navigation und Startseite + +Die amtliche Zuordnung wird als Seed-Datenbestand gepflegt und bei Gebietsänderungen versioniert. + +## Redaktionelle Großräume + +Eine mögliche Navigationsstruktur: + +- Hannover und Weserbergland +- Braunschweig, Wolfsburg und Harz +- Göttingen und Südniedersachsen +- Osnabrück, Emsland und Grafschaft Bentheim +- Oldenburg, Ostfriesland und Nordwesten +- Lüneburg, Heide, Wendland und Elbe-Weser + +Diese Großräume ersetzen nicht die genaue Landkreis- oder Stadtzuordnung. Sie dienen der verständlichen Navigation und Ausspielung. + +## Zuordnungsregeln + +- kommunaler Feed: feste Zuordnung zur jeweiligen Gebietskörperschaft +- Landkreisfeed: Landkreis plus optional betroffene Gemeinden +- landesweite Behörde: Region `niedersachsen` und thematische Kategorie +- lokales Medium: mehrere explizit gepflegte Regionen +- einzelne Meldung: kann zusätzliche oder abweichende Regionen erhalten + +## Startseitenbalance + +Beispiel für eine Nachrichtenauswahl mit zwölf Karten: + +- mehrere unterschiedliche Großräume +- begrenzte Anzahl pro Quelle +- Mischung aus landesweiten und lokalen Meldungen +- mindestens eine ländliche Region außerhalb der größten Städte +- Aktualität bleibt wichtig, wird aber nicht zum einzigen Rankingkriterium + +Die konkrete Quote wird im Adminbereich konfigurierbar. Bei zu wenig aktuellen Meldungen darf die Auswahl flexibel zurückfallen, ohne veraltete Meldungen künstlich nach vorne zu ziehen. + +## Qualitätskennzahlen + +- aktive Quellen pro Region +- letzte Meldung pro Region +- Anteil der Startseitenmeldungen je Großraum +- Anteil je Quelle +- Regionen ohne Meldung innerhalb der letzten 24/48 Stunden +- Duplikatrate +- Fehlerquote je Feed + +## Regionale Landingpages + +Jede aktive Region erhält später: + +- aktuelle Meldungen +- Veranstaltungen +- Wetter- und Verkehrshinweise +- Landwelle-Beiträge +- zugehörige Quellen +- optionale lokale Ansprechpartner und Partner diff --git a/docs/RSS_INGESTION.md b/docs/RSS_INGESTION.md new file mode 100644 index 0000000..8268eae --- /dev/null +++ b/docs/RSS_INGESTION.md @@ -0,0 +1,104 @@ +# RSS-/Atom-Import + +## Ziel + +Landwelle sammelt aktuelle Meldungen aus lokalen und landesweiten Quellen für Niedersachsen. Der Import dient als Nachrichtenaggregator: Landwelle zeigt zulässige Metadaten mit Quellenangabe und führt Leser zum Originalartikel. + +## Unterstützte Formate + +- RSS 2.0 +- Atom 1.0 +- RDF/RSS 1.0, sofern der eingesetzte Parser dies zuverlässig unterstützt + +## Abrufzyklus + +1. Scheduler prüft jede Minute auf fällige Quellen. +2. Pro Quelle wird ein Job mit Timeout gestartet. +3. `If-None-Match` und `If-Modified-Since` vermeiden unnötige Downloads. +4. HTTP 304 aktualisiert nur den Erfolgszeitpunkt. +5. Neue oder geänderte Einträge werden normalisiert und in einer Transaktion gespeichert. +6. Fehler einer Quelle beeinflussen keine anderen Quellen. + +## HTTP-Regeln + +- eindeutiger User-Agent mit Kontaktmöglichkeit +- HTTPS bevorzugen +- Redirectzahl begrenzen +- Antwortgröße begrenzen +- nur erwartete XML-/Feed-Inhalte verarbeiten +- DNS-Rebinding und SSRF berücksichtigen +- private IP-Ziele nur für bewusst freigegebene interne Quellen erlauben +- keine Cookies oder Browser-Skripte ausführen + +## Normalisierung + +- Titel trimmen und Längen begrenzen +- Datumsformate in UTC überführen +- Original-Zeitzone optional erhalten +- HTML-Anrisstexte bereinigen +- Trackingparameter aus kanonischen URLs entfernen, soweit sicher möglich +- Sprache erkennen oder aus Quelle übernehmen +- Bilder nur speichern/anzeigen, wenn Quelle dies erlaubt +- Vorschaubilder aus Bild-Enclosures, Media-RSS sowie HTML-`img`-Elementen in `content:encoded` oder `description` übernehmen +- Audio-/Video-Enclosures nicht als Bilder behandeln +- ausschließlich absolute oder sicher aufgelöste HTTP-/HTTPS-Bildadressen speichern +- keine Volltextseiten nachladen + +## Deduplizierung + +1. GUID/Atom-ID innerhalb derselben Quelle +2. kanonische URL +3. stabiler Hash aus Quelle, Titel und Veröffentlichungszeit +4. redaktionelle Zusammenführung ähnlicher Meldungen verschiedener Quellen + +## Regionszuordnung + +Reihenfolge: + +1. feste Regionen der Feedquelle +2. strukturierte Feedkategorien oder Geo-Metadaten +3. Orts- und Landkreisregeln aus Titel und Anrisstext +4. manuelle Korrektur im Adminbereich + +Automatische Erkennung darf eine feste Quellenregion nicht ohne nachvollziehbare Regel überschreiben. + +## Veröffentlichungsmodi + +### Automatisch + +Für vertrauenswürdige, rechtlich geklärte Quellen. Importierte Meldungen werden sofort sichtbar, sofern Validierung und Mindestfelder erfüllt sind. + +### Prüfung + +Neue Meldungen landen zunächst im Feed-Eingang. Redaktion entscheidet über Veröffentlichung, Region und Hervorhebung. + +### Deaktiviert + +Quelle wird nicht abgerufen oder nicht ausgespielt. + +## Startseitenauswahl + +Die Auswahl soll Aktualität und regionale Vielfalt verbinden: + +- Mindestzahl unterschiedlicher Regionen +- Begrenzung pro Quelle +- Trennung zwischen landesweiten und lokalen Meldungen +- Prioritätsbonus für aktuelle Warnungen oder Serviceinformationen +- keine dauerhafte Bevorzugung großer Ballungsräume +- redaktionelle Pins haben Vorrang, aber ein Ablaufdatum + +## Fehlerbehandlung + +- exponentieller Backoff nach wiederholten Fehlern +- Warnstatus nach definierter Zahl aufeinanderfolgender Fehler +- automatische Deaktivierung nur bei klaren Dauerfehlern und mit Audit-Eintrag +- Parserfehler mit begrenztem Beispiel protokollieren, ohne komplette fremde Inhalte in Logs zu schreiben +- Feedtest im Adminbereich zeigt HTTP- und Parserergebnis + +## Aufbewahrung + +- neue Meldungen nur innerhalb eines konfigurierbaren Altersfensters importieren +- ältere FeedItems nach Frist archivieren oder löschen +- Quellen- und Auditdaten erhalten +- FeedFetchRuns nach einer Frist verdichten +- Original-URLs und Quellenangaben für sichtbare Meldungen unverändert erhalten diff --git a/docs/RSS_SOURCES.md b/docs/RSS_SOURCES.md new file mode 100644 index 0000000..79617f7 --- /dev/null +++ b/docs/RSS_SOURCES.md @@ -0,0 +1,120 @@ +# RSS-Quellenstrategie + +## Grundsatz + +Nicht jeder technisch erreichbare Feed darf automatisch auf einer kommerziellen oder werbefinanzierten Website verwendet werden. Vor Aktivierung werden Nutzungsbedingungen, Attribution, erlaubte Felder und Bildrechte dokumentiert. + +## Quellenklassen + +1. **Kommunen und Landkreise** – lokale Pressemitteilungen, Verkehr, Baustellen, Kultur und Veranstaltungen. +2. **Landesbehörden und öffentliche Einrichtungen** – landesweite Politik, Umwelt, Landwirtschaft und Service. +3. **Lokale Medien** – breite journalistische Abdeckung, Nutzung nur mit klarer Erlaubnis oder Vereinbarung. +4. **Vereine und Organisationen** – lokale Termine und Gemeinschaftsthemen, redaktionell prüfen. +5. **Warn- und Servicedienste** – nur über offiziell erlaubte Schnittstellen und mit besonderer Aktualitätslogik. + +## Verifizierte Startkandidaten + +Die folgenden Quellen sind als technische Kandidaten dokumentiert. Vor Produktivaktivierung wird die aktuelle Nutzungsregel nochmals geprüft. + +### Landwirtschaftskammer Niedersachsen + +Beispiele: + +```text +https://www.lwk-niedersachsen.de/rss_lwk.rdf +https://www.lwk-niedersachsen.de/rss_lwk_presse.rdf +https://www.lwk-niedersachsen.de/services/rss/rss_lwk_landwirtschaft.rdf +``` + +Dokumentierter Nutzungsrahmen: Überschriften und Anrisstexte dürfen mit aktivem Link und Quellenangabe übernommen werden; Bilder und vollständige Meldungen sind nicht freigegeben. Im Adminbereich daher standardmäßig: + +```text +allow_title=true +allow_summary=true +allow_image=false +rights_status=allowed_with_attribution +``` + +### Niedersächsischer Landtag + +Pressefeed: + +```text +https://www.landtag-niedersachsen.de/rss/presse.xml +``` + +Weitere parlamentarische Feeds sind vorhanden. Für Landwelle ist zunächst der Pressefeed relevant. Nutzungs- und Attributionsregeln müssen vor Aktivierung dokumentiert werden. + +### Niedersächsisches Umweltministerium + +```text +http://www.umwelt.niedersachsen.de/rss +``` + +Vor Aktivierung prüfen, ob eine aktuelle HTTPS-Adresse verfügbar ist und welche Übernahmeregeln gelten. + +### Stadt Braunschweig – Stadtmarketing + +```text +https://www.braunschweig.de/rss/stadtmarketing.php?sp%3Aout=rss +``` + +Geeignet für Veranstaltungen und Stadtmarketing-Meldungen der Region Braunschweig. Nutzungsstatus zunächst `review_required`. + + +### tagesschau.de – Ausland + +Die Rubrik „Welt Nachrichten“ verwendet den offiziellen Ausland-RSS-Feed: + +```text +https://www.tagesschau.de/ausland/index~rss2.xml +``` + +Die Meldungen werden technisch getrennt von den regionalen Landeszeitung-Beiträgen gespeichert und ausschließlich im Welt-Nachrichtenbereich angezeigt. Dargestellt werden höchstens fünf Meldungen je Seite; jeder Eintrag verlinkt auf den Originalartikel und nennt tagesschau.de als Quelle. Offizielle Vorschaubilder werden zuerst aus `content:encoded`, Media-RSS, verschachtelten `media:group`-Elementen oder einem als Bild gekennzeichneten Enclosure gelesen. Doppelt HTML-maskierte Inhalte werden sicher mehrfach dekodiert. Fehlt im RSS-Eintrag trotzdem ein Bild, ruft der Server ausschließlich den verlinkten HTTPS-Artikel auf `tagesschau.de` ab und übernimmt `og:image`, `twitter:image` oder `image_src`; fremde Hosts und Weiterleitungen werden verworfen. Audio-Enclosures werden ignoriert. Migration `0024_tagesschau_article_image_fallback.sql` erzwingt nach dem Parserupdate einen erneuten vollständigen Import. + +Der aktuelle Tagesschau-Hinweis beschränkt die allgemeine RSS-Nutzung auf private, nichtkommerzielle Zwecke und verweist kommerzielle Drittplattformen auf das ARD Publishing Portal. Vor produktiver werblicher Nutzung muss deshalb die erforderliche Registrierung beziehungsweise Freigabe dokumentiert werden. In der Datenbank ist die Quelle entsprechend als `noncommercial_only` gekennzeichnet. + +## Quellen mit besonderer Vorsicht + +### NDR + +Der NDR-Niedersachsen-RSS ist technisch aktiviert und in der Datenbank als `noncommercial_only` gekennzeichnet. Landwelle übernimmt ausschließlich Überschrift, direkten Original-Link und sichtbare Quellenangabe; Zusammenfassungen und NDR-Originalbilder bleiben deaktiviert. Für einen kommerziellen Betrieb ist weiterhin eine ausdrückliche Freigabe oder passende Vereinbarung erforderlich. + +### Zeitungsverlage + +RSS-Feeds von lokalen Zeitungen können technisch verfügbar sein, aber Paywall-, Bild- und Nutzungsrechte unterscheiden sich. Ohne dokumentierte Freigabe werden nur Quellenlinks im Rahmen einer Vereinbarung verwendet; kein automatisches Freischalten allein aufgrund einer auffindbaren Feed-URL. + +## Abdeckungsmatrix + +Für jede Region wird mindestens festgehalten: + +| Region | Kommunale Quelle | Lokales Medium | Fachquelle | Status | +|---|---|---|---|---| +| Beispielregion | vorhanden/fehlt | vorhanden/ungeklärt | vorhanden | grün/gelb/rot | + +Das Dashboard zeigt Regionen ohne aktive Quelle. Ziel ist nicht maximale Feedzahl, sondern zuverlässige, rechtlich saubere und geografisch ausgewogene Abdeckung. + +## Freigabecheck pro Quelle + +- Feed-URL technisch erreichbar +- Betreiber und Impressum eindeutig +- kommerzielle Einbindung erlaubt oder schriftlich genehmigt +- zulässige Felder dokumentiert +- Bildnutzung geklärt +- Quellenbezeichnung festgelegt +- Original-Links funktionieren +- Abrufintervall angemessen +- Datenschutz und Tracking geprüft +- verantwortlicher interner Prüfer und Prüfdatum gespeichert + +## NDR – Niedersachsen + +Feed: + +```text +https://www.ndr.de/nachrichten/niedersachsen/index~rss2.xml +``` + +Die Quelle wird durch Migration `0025_ndr_niedersachsen_balanced_news.sql` aktiviert und der Region `niedersachsen` zugeordnet. Auf der öffentlichen Website werden Landeszeitung und NDR fair abwechselnd gewichtet. Die Startseite verwendet dieselbe regionale Mischung. + +Die veröffentlichten NDR-RSS-Bedingungen erlauben die Einbindung von Schlagzeilen nur für nichtkommerzielle Internetangebote, verlangen eine erkennbare Quellenangabe und einen direkten Link zum Originalartikel und untersagen die Archivierung. Deshalb ist die Quelle als `noncommercial_only` gekennzeichnet; `allow_summary` und `allow_image` sind deaktiviert. Nach jedem vollständig erfolgreichen Abruf löscht Landwelle NDR-Einträge, die nicht mehr im aktuellen Feed enthalten sind. Vor einem kommerziellen Einsatz muss eine ausdrückliche Freigabe des NDR vorliegen. diff --git a/docs/SECURITY.md b/docs/SECURITY.md new file mode 100644 index 0000000..f28081d --- /dev/null +++ b/docs/SECURITY.md @@ -0,0 +1,135 @@ +# Sicherheit + +## Öffentlicher Betrieb + +- HTTPS über Reverse Proxy +- Port `2200` nicht direkt öffentlich freigeben +- PostgreSQL nicht öffentlich exponieren +- Dienst ohne Root-Rechte +- aktuelle Sicherheitsupdates +- Firewall auf notwendige Verbindungen begrenzen +- Impressum, Datenschutz und Quellenhinweise bereitstellen + +## PostgreSQL + +- dedizierte Rolle mit minimalen Rechten +- TLS je nach Netz- und Serverkonfiguration +- `pg_hba.conf` auf Raspberry-Pi-IP oder Anwendungsnetz begrenzen +- parametrisierte Abfragen +- Migrationen versionieren +- Verbindungsstring nur als Secret +- keine SQL-Details in Fehlerseiten +- Backups zugriffsgeschützt speichern +- Restore regelmäßig testen + +## RSS und externe Inhalte + +RSS-Feeds sind nicht vertrauenswürdig, auch wenn die Quelle seriös wirkt. + +- Feed-URLs validieren +- SSRF und DNS-Rebinding berücksichtigen +- private, Link-Local- und Metadaten-IP-Bereiche standardmäßig blockieren +- Redirectzahl und Zielhosts kontrollieren +- Downloadgröße und Timeout begrenzen +- XML sicher parsen; externe Entitäten deaktivieren +- HTML-Anrisstexte sanitizen +- keine Skripte, Iframes oder Eventhandler übernehmen +- externe Bilder nur bei erlaubter Nutzung und sicherer Auslieferung +- keine Volltextseiten automatisch scrapen +- Links mit `rel="noopener noreferrer external"` + +## Adminbereich + +- sichere Passwort-Hashes +- lange zufällige Session-IDs +- `HttpOnly`, `Secure`, `SameSite` +- CSRF-Schutz +- serverseitige Rollenprüfung +- Rate-Limit und Brute-Force-Schutz +- Sessionablauf und Widerruf +- Auditprotokoll +- Zwei-Faktor-Authentifizierung als spätere Ausbaustufe + +## Uploads + +- Dateien außerhalb des Binaries +- generierte Speichernamen +- Dateityperkennung serverseitig +- Größenlimits +- keine ausführbaren Dateien +- Bilder nach Möglichkeit dekodieren und neu schreiben +- Uploadverzeichnis nicht als Skriptverzeichnis behandeln + +## Content Security Policy + +Die CSP muss Streamhost, eigene Assets und gegebenenfalls einen kontrollierten Bildproxy berücksichtigen. Fremde Feedseiten werden nicht eingebettet, sondern nur verlinkt. + +## Datenschutz + +- nur erforderliche Daten speichern +- Aufbewahrungsfristen definieren +- IP-Adressen nicht unbegrenzt protokollieren +- Feedabruflogs ohne unnötige personenbezogene Inhalte +- externe Trackingparameter nach Möglichkeit aus Links entfernen + +## App- und Push-Sicherheit + +- App-Installationen erhalten ein eigenes, widerrufbares Installation-Secret. +- Nur der Hash dieses Secrets wird gespeichert. +- Ein Installation-Secret berechtigt niemals zu Adminaktionen. +- FCM-Tokens werden mit einem separaten Schlüssel verschlüsselt. +- Firebase-Service-Account und Verschlüsselungsschlüssel liegen nur im Dateisystem/Secret Store. +- Push-Kampagnen benötigen Rollenprüfung und Audit. +- Test- und Produktions-Firebase-Projekte beziehungsweise Umgebungen werden getrennt. +- Deep Links werden gegen erlaubte Ziele validiert. +- Batchgrößen und Payloads sind begrenzt. +- Geräte- und Statistikendpunkte erhalten Rate Limits. +- keine Advertising IDs oder Hardware-Fingerprints. +- Löschanforderungen entfernen Installation, Push-Token und Themenzuordnungen. + +## Release-Sicherheit + +- Android- und iOS-Releasebuilds werden mit dauerhaft geschützten Plattformschlüsseln signiert. +- Downloadseiten laufen ausschließlich über HTTPS. +- SHA-256-Prüfsummen werden veröffentlicht, ersetzen aber keine Signatur. +- macOS-Pakete werden signiert und notarisiert. +- Windows-Pakete erhalten Code Signing. +- Update-Metadaten dürfen nur von Administratoren veröffentlicht werden. + + +## Aktueller Adminschutz ab v10 + +- `/admin` ist nicht im Frontend verlinkt und wird mit `X-Robots-Tag: noindex, nofollow, noarchive` ausgeliefert. +- Passwörter werden als PBKDF2-SHA256-Hash konfiguriert. +- Sitzungen verwenden zufällige Tokens und ein `HttpOnly`-/`SameSite=Strict`-Cookie. +- Fünf fehlgeschlagene Anmeldungen einer Adresse führen zu einer zeitweisen Sperre. +- Logout-Formulare werden mit einem sitzungsgebundenen CSRF-Token geprüft. +- Der Adminbereich sollte öffentlich ausschließlich über HTTPS bereitgestellt werden. +- Persistente Benutzer, Rollen und Audit-Logs folgen mit PostgreSQL. + +## Firebase-Service-Account + +`firebase-service-account.json` ist ein ausschließlich serverseitiges Geheimnis. Der produktive Standardpfad ist `/etc/landwelle/firebase-service-account.json`; ein abweichender Pfad muss absolut und serverseitig konfiguriert sein. Die Datei darf nicht in Git, Webassets, API-Antworten, Logs, Releasepakete oder Mobile-App-Builds gelangen. Das Installationsskript setzt restriktive Dateirechte. Fehlermeldungen des Firebase-Clients werden vor der Protokollierung von Credential-Pfaden, Private-Key-Material, Bearer-Tokens und sensitiven Feldern bereinigt. + +Der administrative Testversand ist nur mit gültiger Adminsitzung, `todos.manage` und CSRF-Token erreichbar. Automatische Todo-Pushes sind durch `todo_id + topic` idempotent. + + +## Öffentliche Wachstumsformulare + +- Werbe- und Branchenbuchformulare besitzen Größenlimits und serverseitige Validierung. +- Zufällige Request-Tokens verhindern doppelte Datensätze bei wiederholtem Absenden. +- E-Mail-Templatewerte werden vor der HTML-Ausgabe maskiert. +- Anfragen werden vor dem Mailversand persistent gespeichert. +- SMTP-Fehler werden protokolliert, aber nicht an die Öffentlichkeit mit internen Verbindungsdetails ausgegeben. +- Branchenbucheinträge sind standardmäßig nicht veröffentlicht und benötigen redaktionelle Freigabe. +- Die öffentliche Navigation akzeptiert nur interne Pfade oder validierte HTTP-/HTTPS-Ziele. +- Es wird höchstens eine Dropdown-Ebene unterstützt, um unkontrollierte Navigationstiefen zu verhindern. +- YouTube-Videos werden erst nach Einwilligung als externe Medien eingebettet. + +## OnTour-Frames und Admin-CSRF ab v1.5.1 + +- Externe Frames bleiben global gesperrt. Nur `/ontour` erhält `frame-src` für `https://www.youtube-nocookie.com` und `https://www.youtube.com`. +- Der Service-Account und andere Geheimnisse werden dadurch nicht an den Browser übertragen. +- Standard-Adminformulare übermitteln den Sitzungstoken im Feld `csrf_token`. +- JSON-/AJAX-Endpunkte übermitteln denselben Sitzungstoken im Header `X-CSRF-Token`. +- Ist ein CSRF-Header vorhanden, wird dieser vorrangig geprüft; ein falscher Header kann nicht durch ein Formularfeld überstimmt werden. diff --git a/docs/SEO.md b/docs/SEO.md new file mode 100644 index 0000000..56656af --- /dev/null +++ b/docs/SEO.md @@ -0,0 +1,55 @@ +# SEO und Suchmaschinen + +## Enthaltene technische SEO-Funktionen + +- individuelle Seitentitel und Meta-Descriptions +- kanonische URLs +- hreflang für de-DE und x-default +- Open Graph und Twitter Cards +- JSON-LD für Organization, RadioStation, WebSite, WebPage und BreadcrumbList +- XML-Sitemap unter `/sitemap.xml` +- robots.txt mit Sitemap-Verweis +- Webmanifest und mobile Metadaten +- noindex für Admin, API, internen Status, Player und Livestudio +- große Bildvorschauen über `max-image-preview:large` + +## Produktion + +In `/etc/landwelle/landwelle.env` setzen: + +```env +LANDWELLE_PUBLIC_URL=https://landwelle.de +GOOGLE_SITE_VERIFICATION= +BING_SITE_VERIFICATION= +``` + +Danach Portal neu starten. + +## Google Search Console + +1. Domain-Property `landwelle.de` anlegen und per DNS verifizieren. +2. Optional den Verifikationstoken als `GOOGLE_SITE_VERIFICATION` setzen. +3. `https://landwelle.de/sitemap.xml` einreichen. +4. Startseite und wichtige Seiten mit der URL-Prüfung kontrollieren. +5. Berichte für Indexierung, Core Web Vitals und strukturierte Daten beobachten. + +## Bing Webmaster Tools + +1. Domain hinzufügen oder aus der Google Search Console importieren. +2. Optional `BING_SITE_VERIFICATION` setzen. +3. Sitemap einreichen. + +## Prüfungen nach jedem Deployment + +```bash +curl -I https://landwelle.de/ +curl https://landwelle.de/robots.txt +curl https://landwelle.de/sitemap.xml +curl -I https://landwelle.de/admin +``` + +Zusätzlich die Startseite und Unterseiten im Google Rich Results Test prüfen. + +## Redaktionelle Anforderungen + +Technische SEO allein garantiert keine Platzierung. Wichtig bleiben regelmäßig aktualisierte, eigenständige Inhalte aus Niedersachsen, aussagekräftige Überschriften, Bild-Alt-Texte, korrekte Quellenangaben, interne Verlinkung und schnelle Ladezeiten. diff --git a/docs/TESTING.md b/docs/TESTING.md new file mode 100644 index 0000000..731cc3a --- /dev/null +++ b/docs/TESTING.md @@ -0,0 +1,142 @@ +# Teststrategie + +**Stand: Landwelle v1.5.26** + +## Verbindliche Basisprüfung + +Jede Änderung muss mindestens formatiert, getestet und statisch geprüft werden: + +```bash +gofmt -w . +go test ./... +go vet ./... +``` + +Bei Änderungen an Nebenläufigkeit, Caches oder Hintergrundjobs zusätzlich: + +```bash +go test -race ./... +``` + +## Syntax- und Strukturprüfungen + +- alle JavaScript-Dateien mit `node --check` prüfen +- alle Shellskripte mit `bash -n` prüfen +- JSON- und YAML-Dateien parsen +- lokale Markdown-Links prüfen +- statische `/assets/`-Verweise gegen vorhandene Dateien prüfen +- Migrationen auf eigenes `BEGIN`, `COMMIT`, `ROLLBACK` oder `START TRANSACTION` prüfen +- Quellbaum auf Secrets, produktive Konfigurationen und generierte Artefakte prüfen + +## Buildprüfung + +Lokaler Build: + +```bash +go build -trimpath -o /tmp/landwelle-portal . +/tmp/landwelle-portal --version +``` + +Linux ARM64: + +```bash +GOOS=linux GOARCH=arm64 go build -o /tmp/landwelle-portal-arm64 . +GOOS=linux GOARCH=arm64 go build -o /tmp/landwelle-migrate-arm64 ./cmd/migrate +GOOS=linux GOARCH=arm64 go build -o /tmp/landwelle-adminpass-arm64 ./cmd/adminpass +file /tmp/landwelle-*-arm64 +``` + +Der Versionsstring in `main.go`, der lokalen Binary und der ausgelieferten ARM64-Binary muss übereinstimmen. + +## HTTP-Starttest + +Das Portal muss tatsächlich gestartet werden, damit doppelt registrierte Routen, Templatefehler und Startprobleme auffallen. Mit einer geeigneten Testkonfiguration mindestens prüfen: + +```bash +curl -fsS http://127.0.0.1:2200/health +curl -fsS http://127.0.0.1:2200/ready +curl -fsS http://127.0.0.1:2200/version +curl -fsS http://127.0.0.1:2200/ >/dev/null +``` + +Bei Datenbankbetrieb muss `/ready` die PostgreSQL-Verbindung bestätigen. + +## Testbereiche + +### Handler und Sicherheit + +- HTTP-Status und Content-Type +- Authentifizierung und Rollen +- CSRF für HTML- und JSON-Anfragen +- Eingabevalidierung und Uploadgrenzen +- 404- und Fehlerformate +- Content-Security-Policy und fremde Frames +- keine Ausgabe von Secrets oder internen Pfaden + +### Datenbank und Migrationen + +- Migrationen auf leerer Datenbank +- Upgrade einer aktuellen Sicherung +- Transaktionen und eindeutige Constraints +- serverseitige Pagination und Filter +- Backup und Restore mit Testdaten + +### Öffentliche Funktionen + +- Player, Now Playing und Playlist +- Nachrichtenquellen und Pagination +- Veranstaltungen und Detailansichten +- Chart-Voting, Countdown und Jahresauswahl +- Forum, BBCodes, Lesestatus und Dankeschöns +- Kontaktformular, Mediathek und Inhaltsseiten +- einwilligungsabhängige Statistik und Ausschluss interner Routen + +### Adminbereich + +- Navigation und aktive Zustände +- Formulare, Modale und Autosave +- Rollen und Audit +- Datei- und Medienverwaltung +- Todo-Pushstatus und App-Quittierung +- CSV-Exporte + +### Apps und APIs + +- OpenAPI-Dateien syntaktisch validieren +- implementierte Antworten gegen die Verträge prüfen +- Fehlerformat und Feature-Flags stabil halten +- keine HTML-Abhängigkeit in mobilen Clients +- Push-Einwilligung, Tokenrotation und Installation löschen + +## Browsermatrix + +Mindestens Firefox und Chromium auf Desktop sowie Chrome auf Android prüfen. Für wichtige Releases zusätzlich Safari/WebKit und ein reales iPhone testen. Zentrale Seiten müssen bei Desktop-, Tablet- und Smartphonebreite funktionieren und per Tastatur bedienbar bleiben. + +## Produktive Abnahme + +Nach einem Update prüfen: + +- `/health`, `/ready` und `/version` +- Startseite, Player und Livestream +- geänderte öffentliche und administrative Routen +- PostgreSQL-Migrationen und Logs +- Reverse Proxy und TLS +- Upload- und Medienverzeichnisse +- reale externe Dienste, sofern betroffen +- keine fehlenden Assets oder Browserfehler + +## Noch auszubauen + +- Testdatenbank in CI +- API-Contract-Tests gegen OpenAPI +- automatisierte Browser- und Barrierefreiheitstests +- visuelle Regressionstests für zentrale Seiten +- höhere Abdeckung älterer Admin- und Integrationspfade + +### Redaktion und Facebook + +- Facebook-Zielpfad muss `/landwelle-vor-ort//` verwenden und darf nicht auf `/news/` zeigen +- nichtöffentliche Kategorien dürfen nicht als Facebook-Linkziel veröffentlicht werden +- Formularübertragung an den Graph-Endpunkt mit Nachricht, Link und Page-Token testen +- Redaktionstabs, Kategorie-Modal, Inhaltsfilter und Facebook-Vorschau als Regression prüfen +- auf Smartphone-Breite muss auch ein einzelner „Landwelle vor Ort“-Beitrag sichtbar bleiben diff --git a/docs/THIRD_PARTY_LICENSES.md b/docs/THIRD_PARTY_LICENSES.md new file mode 100644 index 0000000..6318d1d --- /dev/null +++ b/docs/THIRD_PARTY_LICENSES.md @@ -0,0 +1,23 @@ +# Drittanbieter und Lizenzen + +Stand: v36 + +## Open-Source-Komponenten + +- Go und Go-Standardbibliothek — BSD-3-Clause. Die konkrete Go-Version ist der Buildinformation und `go.mod` zu entnehmen. +- PostgreSQL — PostgreSQL License. PostgreSQL läuft als externer Datenbankdienst. +- AzuraCast — Apache License 2.0. AzuraCast wird als externe Radio-/Now-Playing-Instanz verwendet. + +## Externe Daten- und Plattformdienste + +Diese Dienste sind keine im Landwelle-Portal ausgelieferten Open-Source-Komponenten: + +- Open-Meteo — Wetterdaten gemäß den Nutzungs- und Attributionsbedingungen des Anbieters. +- OpenAI API — optionale KI-Textfunktionen gemäß OpenAI-Nutzungsbedingungen. +- ElevenLabs API — optionale Sprachsynthese gemäß ElevenLabs-Nutzungsbedingungen. +- Meta Graph API — optionale Veröffentlichung auf der Facebook-Seite gemäß Meta Platform Terms. +- WhatsApp — derzeit wird ausschließlich die öffentliche Kanal-URL verwaltet; es gibt keine unterstützte automatische Kanal-Publishing-API. + +## Eigenes Frontend + +Das ausgelieferte Webfrontend verwendet HTML5, CSS3 und Vanilla JavaScript. Es wird zur Laufzeit kein externes UI-Framework geladen. diff --git a/docs/TRAFFIC.md b/docs/TRAFFIC.md new file mode 100644 index 0000000..3f98d4a --- /dev/null +++ b/docs/TRAFFIC.md @@ -0,0 +1,52 @@ +# Verkehr und Blitzer in Niedersachsen + +Version 14 stellt unter `/verkehr` eine eigenständige, automatisch aktualisierte Verkehrsseite bereit. + +## Datenfluss + +1. Das Go-Backend fragt die konfigurierten Verkehrsdienste ab. +2. Ergebnisse werden normalisiert, auf Niedersachsen begrenzt und serverseitig zwischengespeichert. +3. Der Browser lädt `GET /api/v1/traffic` und aktualisiert die Anzeige regelmäßig. +4. Bei einem kurzfristigen Quellenausfall bleibt der letzte erfolgreiche Datenstand sichtbar und wird als veraltet gekennzeichnet. + +## Autobahnmeldungen + +Standardmäßig werden Warnungen, Sperrungen und Baustellen für die wichtigsten niedersächsischen Autobahnen geladen. Die Basis-URL ist konfigurierbar: + +```dotenv +LANDWELLE_AUTOBAHN_API_URL=https://verkehr.autobahn.de/o/autobahn +``` + +Die Seite zeigt Quelle, Straße, Richtung, Ort, Beschreibung und Zeitpunkt, soweit die Quelle diese Felder liefert. + +## Blitzer + +Mobile Kontrollen werden aus einem konfigurierbaren RSS- oder Atom-Feed geladen: + +```dotenv +LANDWELLE_BLITZER_RSS_URL=https://www.ffn.de/traffic/blitzer.rss +``` + +Die Quelle kann später im Adminbereich verwaltet werden. Fällt der Feed aus oder ändert sein Format, bleibt die Verkehrsseite funktionsfähig und weist auf fehlende Blitzerdaten hin. + +## Cache und Aktualisierung + +```dotenv +LANDWELLE_TRAFFIC_CACHE_TTL=3m +LANDWELLE_TRAFFIC_TIMEOUT=10s +``` + +Der Browser aktualisiert die Ansicht zusätzlich alle zwei Minuten. Der Button „Aktualisieren“ stößt eine sofortige neue Anzeigeabfrage an. + +## Abdeckung + +Die integrierte Autobahnquelle deckt Autobahnen ab. Für Bundes-, Landes-, Kreis- und Stadtstraßen verweist die Seite ergänzend auf die Verkehrszentrale Niedersachsen. Dieser Hinweis ist bewusst sichtbar, damit Landwelle keine Vollständigkeit verspricht, die eine einzelne Datenquelle nicht leisten kann. + +## API + +```text +GET /api/v1/traffic +GET /api/v1/speed-cameras +``` + +`/api/v1/traffic` liefert den kombinierten Datenstand inklusive Zeitstempel, Quellstatus, Verkehrsmeldungen und Blitzern. diff --git a/docs/USER_MANAGEMENT.md b/docs/USER_MANAGEMENT.md new file mode 100644 index 0000000..fd2e471 --- /dev/null +++ b/docs/USER_MANAGEMENT.md @@ -0,0 +1,35 @@ +# Benutzerverwaltung + +Stand: v40 + +## Bereiche + +- `/admin/users/admins`: Administratoren, Redaktion, Autoren und Moderatoren +- `/admin/users/members`: normale Benutzer für Forum, App und Community +- `/admin/users/roles`: Rollen und Berechtigungen + +## Funktionen + +Benutzer können gesucht, gefiltert, paginiert, angelegt, bearbeitet, aktiviert, deaktiviert, zeitweise gesperrt, entsperrt, per E-Mail bestätigt und datenschutzfreundlich soft-gelöscht werden. Passwörter werden mit PBKDF2-SHA256 gespeichert. Nach einem administrativen Reset wird ein Passwortwechsel verlangt. + +## Rollen + +Die Migration legt Administrator, Redaktion, Autor, Moderator und Benutzer an. Eigene Rollen können im Adminbereich erstellt werden. Berechtigungen werden pro Rolle verwaltet und beim Zugriff auf Adminmodule geprüft. + +## Sicherheit + +- mindestens 12 Zeichen pro Passwort +- Sperre nach fünf fehlgeschlagenen Anmeldeversuchen +- keine Sperrung oder Löschung des aktuell angemeldeten Kontos +- der letzte aktive Administrator kann nicht deaktiviert, gesperrt, gelöscht oder herabgestuft werden +- Änderungen werden in `audit_events` protokolliert +- der Environment-Superadmin bleibt als Notfallzugang verfügbar + +## Migration + +Vor der Portalaktualisierung ausführen: + +```bash +sudo ./scripts/update-migrations-on-pi.sh +sudo ./scripts/update-portal-on-pi.sh +``` diff --git a/docs/WEATHER.md b/docs/WEATHER.md new file mode 100644 index 0000000..54145d1 --- /dev/null +++ b/docs/WEATHER.md @@ -0,0 +1,59 @@ +# Live-Wetter für Visselhövede + +Das Wetter-Widget im öffentlichen Portal zeigt ab Version 10 serverseitig abgerufene Live-Wetterdaten für Visselhövede. + +## Datenfluss + +```text +Open-Meteo + ↓ +Go-Backend mit 10-Minuten-Cache + ↓ +GET /api/v1/weather + ↓ +Frontend-Wetterkarte und Admin-Dashboard +``` + +Der Browser verbindet sich nicht direkt mit dem Wetteranbieter. Das Go-Backend ruft die Daten ab, normalisiert sie und speichert die letzte erfolgreiche Antwort kurzzeitig im Arbeitsspeicher. Dadurch wird die externe API nicht für jeden Seitenaufruf erneut belastet. + +Wenn ein Abruf vorübergehend fehlschlägt, liefert das Backend die letzte erfolgreiche Antwort als `stale: true`, sofern eine solche vorhanden ist. + +## Standardort + +```dotenv +LANDWELLE_WEATHER_LOCATION=Visselhövede +LANDWELLE_WEATHER_LATITUDE=52.9847 +LANDWELLE_WEATHER_LONGITUDE=9.5782 +``` + +## Konfiguration + +```dotenv +LANDWELLE_WEATHER_CACHE_TTL=10m +LANDWELLE_WEATHER_TIMEOUT=7s +LANDWELLE_WEATHER_API_URL=https://api.open-meteo.com/v1/forecast +``` + +Die API-URL sollte normalerweise nicht verändert werden. Sie ist vor allem für Tests vorgesehen. + +## Öffentlicher Endpunkt + +```http +GET /api/v1/weather +``` + +Die Antwort enthält: + +- aktuellen Temperaturwert +- gefühlte Temperatur +- Luftfeuchtigkeit +- Wetterzustand und Symbol +- Windgeschwindigkeit und Windrichtung +- Niederschlagswahrscheinlichkeit +- UV-Index +- Vier-Tage-Vorhersage +- Abrufzeit und Cache-Status + +## Attribution + +Die Oberfläche weist direkt am Widget auf Open-Meteo als Wetterdatenquelle hin. Diese Quellenangabe darf bei einer späteren Umgestaltung nicht entfernt werden. diff --git a/docs/WEB_PLAYER.md b/docs/WEB_PLAYER.md new file mode 100644 index 0000000..2ee469e --- /dev/null +++ b/docs/WEB_PLAYER.md @@ -0,0 +1,29 @@ +# Landwelle Webplayer + +**Stand: Landwelle v1.5.42 – 18. August 2026** + +## Player + +Der öffentliche Webstream besitzt zwei Player-Oberflächen: + +- Startseiten-Player mit `#live-audio` +- eigenständiger Popup-Player unter `/player` mit `#standalone-audio` + +Beide verwenden den konfigurierten Livestream getrennt von der Pre-Roll-Datei über `data-stream-src` und `data-preroll-src`. + +## KI-Transparenz-Pre-Roll + +Vor dem ersten Livestream-Start eines Player-Fensters wird `/assets/landwelle-ki-transparenz-preroll-v1.mp3` vollständig abgespielt. Nach Dateiende wechselt derselbe HTML-Audio-Player automatisch auf den Livestream. + +Die Pre-Roll-Datei ist die vom Betreiber bereitgestellte MP3. Im Release v1.5.38 besitzt sie 44,1 kHz, Stereo, 128 kbit/s und eine Laufzeit von rund 37,7 Sekunden. + +Pause und Resume wiederholen den Pre-Roll innerhalb derselben Player-Sitzung nicht. Nach Neuladen oder neuem Öffnen des Players startet die Wiedergabe erneut mit dem Pre-Roll. + +Kann die Pre-Roll-Datei nicht geladen werden, startet der Player den Livestream direkt, damit ein Defekt des Hinweis-Assets die Radio-Wiedergabe nicht blockiert. + +## Aktive JavaScript-Dateien + +- `/assets/app-v17.js` – Portal-/Startseitenplayer und Popup-Öffnung +- `/assets/player-v16.js` – eigenständiger Popup-Player + +Die Asset-Versionen wurden für v1.5.38 angehoben, damit Browser die neue Playerlogik nicht mit einer älteren gecachten JavaScript-Datei vermischen. diff --git a/downloads.go b/downloads.go new file mode 100644 index 0000000..2fd7e22 --- /dev/null +++ b/downloads.go @@ -0,0 +1,320 @@ +package main + +import ( + "crypto/rand" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "io" + "mime/multipart" + "os" + "path/filepath" + "strings" + "sync" + "time" +) + +type DownloadPlatform struct { + ID string + Name string + Description string + Filename string + Available bool + Size string + Updated string + DownloadURL string + PreviewURL string + IsWallpaper bool +} + +type downloadMetadata struct { + OriginalName string `json:"original_name"` + StoredName string `json:"stored_name"` + Size int64 `json:"size"` + UpdatedAt time.Time `json:"updated_at"` + Token string `json:"token"` + PreviewToken string `json:"preview_token,omitempty"` + PreviewStoredName string `json:"preview_stored_name,omitempty"` +} + +type downloadStore struct { + mu sync.RWMutex + dir string + meta map[string]downloadMetadata +} + +var downloadDefinitions = map[string]struct { + Name string + Description string + Extensions []string +}{ + "windows": {"Windows", "Windows 10 und 11 · 64 Bit", []string{".exe"}}, + "linux": {"Linux", "Linux AMD64 · AppImage oder ausführbare Datei", []string{".appimage", ".bin", ""}}, + "macos": {"macOS", "macOS Desktop-App · ZIP oder DMG", []string{".zip", ".dmg", ".pkg"}}, + "wallpaper": {"Offizielles Wallpaper-Paket", "Landwelle Wallpaper für Desktop, Smartphone und Tablet", []string{".zip"}}, +} + +func newDownloadStore() (*downloadStore, error) { + dir := strings.TrimSpace(os.Getenv("LANDWELLE_DOWNLOAD_DIR")) + if dir == "" { + stateDir := strings.TrimSpace(os.Getenv("LANDWELLE_STATE_DIR")) + if stateDir == "" { + stateDir = "/var/lib/landwelle" + } + dir = filepath.Join(stateDir, "downloads") + } + if err := os.MkdirAll(dir, 0o750); err != nil { + return nil, fmt.Errorf("Download-Verzeichnis erstellen: %w", err) + } + store := &downloadStore{dir: dir, meta: make(map[string]downloadMetadata)} + _ = store.load() + return store, nil +} + +func (s *downloadStore) metadataPath() string { return filepath.Join(s.dir, "downloads.json") } + +func (s *downloadStore) load() error { + raw, err := os.ReadFile(s.metadataPath()) + if errors.Is(err, os.ErrNotExist) { + return nil + } + if err != nil { + return err + } + return json.Unmarshal(raw, &s.meta) +} + +func (s *downloadStore) saveLocked() error { + raw, err := json.MarshalIndent(s.meta, "", " ") + if err != nil { + return err + } + tmp := s.metadataPath() + ".tmp" + if err := os.WriteFile(tmp, raw, 0o640); err != nil { + return err + } + return os.Rename(tmp, s.metadataPath()) +} + +func (s *downloadStore) List() []DownloadPlatform { + s.mu.RLock() + defer s.mu.RUnlock() + order := []string{"windows", "linux", "macos", "wallpaper"} + result := make([]DownloadPlatform, 0, len(order)) + for _, id := range order { + def := downloadDefinitions[id] + item := DownloadPlatform{ID: id, Name: def.Name, Description: def.Description, IsWallpaper: id == "wallpaper"} + if meta, ok := s.meta[id]; ok { + if info, err := os.Stat(filepath.Join(s.dir, meta.StoredName)); err == nil && !info.IsDir() { + item.Available = true + item.Filename = meta.OriginalName + item.Size = humanFileSize(meta.Size) + item.Updated = meta.UpdatedAt.Local().Format("02.01.2006 · 15:04 Uhr") + if meta.Token != "" { + item.DownloadURL = "/download/t/" + meta.Token + } else { + item.DownloadURL = "/download/" + id + } + if meta.PreviewToken != "" && meta.PreviewStoredName != "" { + item.PreviewURL = "/download-preview/" + meta.PreviewToken + } + } + } + result = append(result, item) + } + return result +} + +func secureDownloadToken() (string, error) { + buf := make([]byte, 24) + if _, err := rand.Read(buf); err != nil { + return "", err + } + return hex.EncodeToString(buf), nil +} + +func (s *downloadStore) Save(platform string, header *multipart.FileHeader) error { + return s.SaveWithPreview(platform, header, nil) +} + +func (s *downloadStore) SaveWithPreview(platform string, header, preview *multipart.FileHeader) error { + def, ok := downloadDefinitions[platform] + if !ok { + return errors.New("unbekannte Plattform") + } + original := filepath.Base(strings.TrimSpace(header.Filename)) + if original == "." || original == "" { + return errors.New("kein Dateiname übermittelt") + } + ext := strings.ToLower(filepath.Ext(original)) + allowed := false + for _, candidate := range def.Extensions { + if ext == candidate { + allowed = true + break + } + } + if !allowed { + return fmt.Errorf("für %s ist dieser Dateityp nicht erlaubt", def.Name) + } + source, err := header.Open() + if err != nil { + return err + } + defer source.Close() + stored := platform + ext + if ext == "" { + stored = platform + "-amd64" + } + temp, err := os.CreateTemp(s.dir, platform+"-upload-*") + if err != nil { + return err + } + tempName := temp.Name() + defer os.Remove(tempName) + written, copyErr := io.Copy(temp, source) + closeErr := temp.Close() + if copyErr != nil { + return copyErr + } + if closeErr != nil { + return closeErr + } + if written == 0 { + return errors.New("die Datei ist leer") + } + target := filepath.Join(s.dir, stored) + if err := os.Chmod(tempName, 0o750); err != nil { + return err + } + if err := os.Rename(tempName, target); err != nil { + return err + } + s.mu.Lock() + defer s.mu.Unlock() + if old, exists := s.meta[platform]; exists && old.StoredName != stored { + _ = os.Remove(filepath.Join(s.dir, old.StoredName)) + } + token, err := secureDownloadToken() + if err != nil { + return err + } + meta := downloadMetadata{OriginalName: original, StoredName: stored, Size: written, UpdatedAt: time.Now(), Token: token} + if preview != nil { + pname := filepath.Base(strings.TrimSpace(preview.Filename)) + pext := strings.ToLower(filepath.Ext(pname)) + if pext != ".jpg" && pext != ".jpeg" && pext != ".png" && pext != ".webp" { + return errors.New("Vorschaubild muss JPG, PNG oder WebP sein") + } + psrc, err := preview.Open() + if err != nil { + return err + } + defer psrc.Close() + pstored := platform + "-preview" + pext + ptmp, err := os.CreateTemp(s.dir, platform+"-preview-*") + if err != nil { + return err + } + ptmpName := ptmp.Name() + defer os.Remove(ptmpName) + if _, err = io.Copy(ptmp, psrc); err != nil { + ptmp.Close() + return err + } + if err = ptmp.Close(); err != nil { + return err + } + if err = os.Chmod(ptmpName, 0o640); err != nil { + return err + } + if err = os.Rename(ptmpName, filepath.Join(s.dir, pstored)); err != nil { + return err + } + ptoken, err := secureDownloadToken() + if err != nil { + return err + } + meta.PreviewStoredName, meta.PreviewToken = pstored, ptoken + } else if old, exists := s.meta[platform]; exists { + meta.PreviewStoredName, meta.PreviewToken = old.PreviewStoredName, old.PreviewToken + } + s.meta[platform] = meta + return s.saveLocked() +} + +func (s *downloadStore) Delete(platform string) error { + s.mu.Lock() + defer s.mu.Unlock() + meta, ok := s.meta[platform] + if !ok { + return nil + } + _ = os.Remove(filepath.Join(s.dir, meta.StoredName)) + if meta.PreviewStoredName != "" { + _ = os.Remove(filepath.Join(s.dir, meta.PreviewStoredName)) + } + delete(s.meta, platform) + return s.saveLocked() +} + +func (s *downloadStore) File(platform string) (string, downloadMetadata, bool) { + s.mu.RLock() + defer s.mu.RUnlock() + meta, ok := s.meta[platform] + if !ok { + return "", downloadMetadata{}, false + } + path := filepath.Join(s.dir, meta.StoredName) + if info, err := os.Stat(path); err != nil || info.IsDir() { + return "", downloadMetadata{}, false + } + return path, meta, true +} + +func (s *downloadStore) FileByToken(token string) (string, downloadMetadata, bool) { + s.mu.RLock() + defer s.mu.RUnlock() + for _, meta := range s.meta { + if meta.Token == token { + path := filepath.Join(s.dir, meta.StoredName) + if info, err := os.Stat(path); err == nil && !info.IsDir() { + return path, meta, true + } + } + } + return "", downloadMetadata{}, false +} + +func (s *downloadStore) PreviewByToken(token string) (string, bool) { + s.mu.RLock() + defer s.mu.RUnlock() + for _, meta := range s.meta { + if meta.PreviewToken == token && meta.PreviewStoredName != "" { + path := filepath.Join(s.dir, meta.PreviewStoredName) + if info, err := os.Stat(path); err == nil && !info.IsDir() { + return path, true + } + } + } + return "", false +} + +func humanFileSize(size int64) string { + const unit = 1024 + if size < unit { + return fmt.Sprintf("%d B", size) + } + div, exp := int64(unit), 0 + for n := size / unit; n >= unit; n /= unit { + div *= unit + exp++ + } + return fmt.Sprintf("%.1f %ciB", float64(size)/float64(div), "KMGTPE"[exp]) +} + +type DownloadsPageData struct { + PageData + Platforms []DownloadPlatform +} diff --git a/downloads_token_test.go b/downloads_token_test.go new file mode 100644 index 0000000..e0be8cc --- /dev/null +++ b/downloads_token_test.go @@ -0,0 +1,70 @@ +package main + +import ( + "bytes" + "mime/multipart" + "os" + "path/filepath" + "strings" + "testing" +) + +func testUploadHeader(t *testing.T, name string, body []byte) *multipart.FileHeader { + t.Helper() + var buf bytes.Buffer + mw := multipart.NewWriter(&buf) + part, err := mw.CreateFormFile("file", name) + if err != nil { + t.Fatal(err) + } + if _, err := part.Write(body); err != nil { + t.Fatal(err) + } + if err := mw.Close(); err != nil { + t.Fatal(err) + } + mr := multipart.NewReader(&buf, mw.Boundary()) + form, err := mr.ReadForm(1 << 20) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { form.RemoveAll() }) + return form.File["file"][0] +} + +func TestWallpaperUsesOpaqueTokenAndPreview(t *testing.T) { + dir := t.TempDir() + store := &downloadStore{dir: dir, meta: map[string]downloadMetadata{}} + zipHeader := testUploadHeader(t, "landwelle-wallpaper.zip", []byte("PK-test")) + preview := testUploadHeader(t, "preview.png", []byte("png-test")) + if err := store.SaveWithPreview("wallpaper", zipHeader, preview); err != nil { + t.Fatal(err) + } + list := store.List() + var found DownloadPlatform + for _, item := range list { + if item.ID == "wallpaper" { + found = item + } + } + if !found.Available || !strings.HasPrefix(found.DownloadURL, "/download/t/") { + t.Fatalf("opaque URL missing: %#v", found) + } + if strings.Contains(found.DownloadURL, "wallpaper.zip") { + t.Fatalf("original filename leaked: %s", found.DownloadURL) + } + token := strings.TrimPrefix(found.DownloadURL, "/download/t/") + path, meta, ok := store.FileByToken(token) + if !ok || meta.OriginalName != "landwelle-wallpaper.zip" { + t.Fatalf("token lookup failed") + } + if _, err := os.Stat(path); err != nil { + t.Fatal(err) + } + if !strings.HasPrefix(found.PreviewURL, "/download-preview/") { + t.Fatalf("preview URL missing") + } + if filepath.Dir(path) != dir { + t.Fatalf("file escaped store") + } +} diff --git a/editorial.go b/editorial.go new file mode 100644 index 0000000..3716e9b --- /dev/null +++ b/editorial.go @@ -0,0 +1,519 @@ +package main + +import ( + "context" + "errors" + "regexp" + "strconv" + "strings" + "time" + "unicode" +) + +type EditorialEntry struct { + ID int64 `json:"id"` + ContentType string `json:"content_type"` + ContentTypeLabel string `json:"content_type_label"` + Title string `json:"title"` + Slug string `json:"slug"` + Teaser string `json:"teaser"` + Body string `json:"body"` + Location string `json:"location"` + Status string `json:"status"` + AIGenerated bool `json:"ai_generated"` + AIUsage string `json:"ai_usage"` + AIHumanReviewed bool `json:"ai_human_reviewed"` + AIEditorialResponsible string `json:"ai_editorial_responsible"` + AIDisclosure string `json:"ai_disclosure"` + MediaAIUsage string `json:"media_ai_usage"` + MediaAIDisclosure string `json:"media_ai_disclosure"` + MediaWatermarkEnabled bool `json:"media_watermark_enabled"` + MediaWatermarkText string `json:"media_watermark_text"` + MediaAssetID int64 `json:"media_asset_id"` + MediaURL string `json:"media_url"` + MediaAlt string `json:"media_alt"` + PostToFacebook bool `json:"post_to_facebook"` + SendPush bool `json:"send_push"` + FacebookStatus string `json:"facebook_status"` + PushStatus string `json:"push_status"` + HomepageSection bool `json:"homepage_section"` + PublishedAt time.Time `json:"published_at"` + UpdatedAt time.Time `json:"updated_at"` +} + +func (e EditorialEntry) EffectiveAIUsage() string { + usage := normalizeAIUsage(e.AIUsage) + if usage == "none" && e.AIGenerated { + return "assisted" + } + return usage +} + +func (e EditorialEntry) HasAITransparency() bool { return e.EffectiveAIUsage() != "none" } +func (e EditorialEntry) AIShortLabel() string { return aiUsageShortLabel(e.EffectiveAIUsage()) } +func (e EditorialEntry) AITransparencyLabel() string { return aiUsageLabel(e.EffectiveAIUsage()) } +func (e EditorialEntry) AITransparencyText() string { + if text := strings.TrimSpace(e.AIDisclosure); text != "" { + return text + } + return defaultAIDisclosure(e.EffectiveAIUsage()) +} +func (e EditorialEntry) AIReviewLabel() string { + if !e.HasAITransparency() { + return "" + } + if e.AIHumanReviewed { + if responsible := strings.TrimSpace(e.AIEditorialResponsible); responsible != "" { + return "Redaktionell geprüft · Verantwortlich: " + responsible + } + return "Redaktionell geprüft" + } + return "Keine redaktionelle Prüfung dokumentiert" +} +func (e EditorialEntry) HasMediaAITransparency() bool { + return normalizeMediaAIUsage(e.MediaAIUsage) != "none" +} +func (e EditorialEntry) MediaAITransparencyText() string { + if text := strings.TrimSpace(e.MediaAIDisclosure); text != "" { + return text + } + switch normalizeMediaAIUsage(e.MediaAIUsage) { + case "generated": + return "Dieses Bild wurde mithilfe künstlicher Intelligenz erstellt." + case "manipulated": + return "Dieses Bild wurde mithilfe künstlicher Intelligenz wesentlich bearbeitet." + default: + return "" + } +} + +func (e EditorialEntry) HasMediaWatermark() bool { + return e.MediaWatermarkEnabled && normalizeMediaAIUsage(e.MediaAIUsage) != "none" +} +func (e EditorialEntry) MediaWatermarkLabel() string { + if !e.HasMediaWatermark() { + return "" + } + if text := strings.TrimSpace(e.MediaWatermarkText); text != "" { + return text + } + if normalizeMediaAIUsage(e.MediaAIUsage) == "manipulated" { + return "Mit KI bearbeitet" + } + return "Mit KI erstellt" +} + +func (e EditorialEntry) UpdatedLabel() string { + if e.UpdatedAt.IsZero() { + return "–" + } + return e.UpdatedAt.Local().Format("02.01.2006 · 15:04") +} + +func (e EditorialEntry) StatusLabel() string { + switch strings.TrimSpace(e.Status) { + case "draft": + return "Entwurf" + case "review": + return "In Prüfung" + case "published": + return "Veröffentlicht" + case "archived": + return "Archiviert" + default: + return e.Status + } +} + +func (e EditorialEntry) FacebookStatusKind() string { + if !e.PostToFacebook { + return "off" + } + status := strings.TrimSpace(e.FacebookStatus) + switch { + case strings.HasPrefix(status, "published"): + return "published" + case strings.HasPrefix(status, "failed"): + return "failed" + case status == "sending": + return "sending" + default: + return "pending" + } +} + +func (e EditorialEntry) FacebookStatusLabel() string { + switch e.FacebookStatusKind() { + case "off": + return "Facebook nicht ausgewählt" + case "published": + return "Auf Facebook veröffentlicht" + case "failed": + return "Facebook-Übertragung fehlgeschlagen" + case "sending": + return "Wird an Facebook übertragen" + default: + if e.Status != "published" { + return "Wird nach Veröffentlichung gesendet" + } + return "Facebook-Versand steht aus" + } +} + +func (e EditorialEntry) FacebookStatusDetail() string { + status := strings.TrimSpace(e.FacebookStatus) + if strings.HasPrefix(status, "published:") { + return strings.TrimSpace(strings.TrimPrefix(status, "published:")) + } + if strings.HasPrefix(status, "failed:") { + return strings.TrimSpace(strings.TrimPrefix(status, "failed:")) + } + return "" +} + +func (e EditorialEntry) PublicPath() string { + category := strings.TrimSpace(e.ContentType) + slug := strings.TrimSpace(e.Slug) + if !e.HomepageSection || category == "" || slug == "" { + return "" + } + return "/landwelle-vor-ort/" + category + "/" + slug +} + +func (e EditorialEntry) CategoryPath() string { + category := strings.TrimSpace(e.ContentType) + if !e.HomepageSection || category == "" { + return "/landwelle-vor-ort" + } + return "/landwelle-vor-ort/" + category +} + +var slugInvalid = regexp.MustCompile(`[^a-z0-9]+`) + +func slugify(title string) string { + title = strings.ToLower(strings.TrimSpace(title)) + r := strings.NewReplacer("ä", "ae", "ö", "oe", "ü", "ue", "ß", "ss") + title = r.Replace(title) + var b strings.Builder + for _, ch := range title { + if unicode.IsLetter(ch) || unicode.IsDigit(ch) || ch == ' ' || ch == '-' { + b.WriteRune(ch) + } + } + slug := strings.Trim(slugInvalid.ReplaceAllString(b.String(), "-"), "-") + if slug == "" { + slug = "inhalt-" + strconv.FormatInt(time.Now().Unix(), 10) + } + return slug +} + +type EditorialContentType struct { + Slug string `json:"slug"` + Name string `json:"name"` + Description string `json:"description"` + HomepageSection bool `json:"homepage_section"` + Active bool `json:"active"` + SortOrder int `json:"sort_order"` +} + +func (c EditorialContentType) PublicPath() string { + slug := strings.TrimSpace(c.Slug) + if !c.Active || !c.HomepageSection || slug == "" { + return "/landwelle-vor-ort" + } + return "/landwelle-vor-ort/" + slug +} + +type editorialStore struct{ db *postgresStore } + +func newEditorialStore(db *postgresStore) *editorialStore { return &editorialStore{db: db} } +func (s *editorialStore) Enabled() bool { return s != nil && s.db != nil && s.db.Enabled() } + +const editorialJSON = `'id',e.id,'content_type',e.content_type,'content_type_label',COALESCE(ct.name,e.content_type),'homepage_section',COALESCE(ct.homepage_section,false),'title',e.title,'slug',e.slug,'teaser',e.teaser,'body',e.body,'location',e.location,'status',e.status,'ai_generated',e.ai_generated,'ai_usage',COALESCE(e.ai_usage,'none'),'ai_human_reviewed',COALESCE(e.ai_human_reviewed,false),'ai_editorial_responsible',COALESCE(e.ai_editorial_responsible,''),'ai_disclosure',COALESCE(e.ai_disclosure,''),'media_asset_id',COALESCE(e.media_asset_id,0),'media_url',CASE WHEN m.storage_key IS NULL THEN '' ELSE '/media/'||m.storage_key END,'media_alt',COALESCE(m.alt_text,''),'media_ai_usage',COALESCE(m.ai_usage,'none'),'media_ai_disclosure',COALESCE(m.ai_disclosure,''),'media_watermark_enabled',COALESCE(m.ai_watermark_enabled,false),'media_watermark_text',COALESCE(m.ai_watermark_text,''),'post_to_facebook',e.post_to_facebook,'send_push',e.send_push,'facebook_status',e.facebook_status,'push_status',e.push_status,'published_at',COALESCE(e.published_at,e.updated_at),'updated_at',e.updated_at` + +func (s *editorialStore) List(ctx context.Context) ([]EditorialEntry, error) { + if !s.Enabled() { + return nil, errors.New("PostgreSQL ist nicht konfiguriert") + } + var items []EditorialEntry + q := `SELECT COALESCE(json_agg(json_build_object(` + editorialJSON + `) ORDER BY e.updated_at DESC),'[]'::json)::text FROM landwelle.editorial_entries e LEFT JOIN landwelle.media_assets m ON m.id=e.media_asset_id LEFT JOIN landwelle.editorial_content_types ct ON ct.slug=e.content_type;` + return items, s.db.queryJSON(ctx, q, &items) +} +func (s *editorialStore) Get(ctx context.Context, id int64) (EditorialEntry, bool, error) { + if !s.Enabled() { + return EditorialEntry{}, false, errors.New("PostgreSQL ist nicht konfiguriert") + } + var items []EditorialEntry + q := `SELECT COALESCE(json_agg(json_build_object(` + editorialJSON + `)),'[]'::json)::text FROM landwelle.editorial_entries e LEFT JOIN landwelle.media_assets m ON m.id=e.media_asset_id LEFT JOIN landwelle.editorial_content_types ct ON ct.slug=e.content_type WHERE e.id=` + strconv.FormatInt(id, 10) + `;` + if err := s.db.queryJSON(ctx, q, &items); err != nil { + return EditorialEntry{}, false, err + } + if len(items) == 0 { + return EditorialEntry{}, false, nil + } + return items[0], true, nil +} +func (s *editorialStore) Save(ctx context.Context, e EditorialEntry) error { + if !s.Enabled() { + return errors.New("PostgreSQL ist nicht konfiguriert") + } + e.ContentType = strings.TrimSpace(e.ContentType) + e.Title = strings.TrimSpace(e.Title) + e.Teaser = strings.TrimSpace(e.Teaser) + e.Body = strings.TrimSpace(e.Body) + e.Location = strings.TrimSpace(e.Location) + e.Status = strings.TrimSpace(e.Status) + e.AIUsage = normalizeAIUsage(e.AIUsage) + if e.AIUsage == "none" && e.AIGenerated { + e.AIUsage = "assisted" + } + e.AIGenerated = e.AIUsage != "none" + e.AIEditorialResponsible = compactText(e.AIEditorialResponsible) + e.AIDisclosure = strings.TrimSpace(e.AIDisclosure) + if e.AIUsage != "none" && e.AIEditorialResponsible == "" { + e.AIEditorialResponsible = "Landwelle Redaktion" + } + if e.Title == "" { + return errors.New("der Titel fehlt") + } + e.Slug = slugify(e.Title) + validType, err := s.ContentTypeExists(ctx, e.ContentType) + if err != nil { + return err + } + if !validType { + return errors.New("ungültiger oder inaktiver Inhaltstyp") + } + allowedStatus := map[string]bool{"draft": true, "review": true, "published": true, "archived": true} + if !allowedStatus[e.Status] { + return errors.New("ungültiger Status") + } + mediaSQL := "NULL" + if e.MediaAssetID > 0 { + mediaSQL = strconv.FormatInt(e.MediaAssetID, 10) + } + if e.ID == 0 { + q := `INSERT INTO landwelle.editorial_entries(content_type,title,slug,teaser,body,location,status,ai_generated,ai_usage,ai_human_reviewed,ai_editorial_responsible,ai_disclosure,media_asset_id,post_to_facebook,send_push,published_at) VALUES (` + sqlText(e.ContentType) + `,` + sqlText(e.Title) + `,` + sqlText(e.Slug) + `,` + sqlText(e.Teaser) + `,` + sqlText(e.Body) + `,` + sqlText(e.Location) + `,` + sqlText(e.Status) + `,` + sqlBool(e.AIGenerated) + `,` + sqlText(e.AIUsage) + `,` + sqlBool(e.AIHumanReviewed) + `,` + sqlText(e.AIEditorialResponsible) + `,` + sqlText(e.AIDisclosure) + `,` + mediaSQL + `,` + sqlBool(e.PostToFacebook) + `,` + sqlBool(e.SendPush) + `,` + func() string { + if e.Status == "published" { + return "now()" + } + return "NULL" + }() + `);` + _, err := s.db.exec(ctx, q) + return err + } + q := `UPDATE landwelle.editorial_entries SET content_type=` + sqlText(e.ContentType) + `,title=` + sqlText(e.Title) + `,slug=` + sqlText(e.Slug) + `,teaser=` + sqlText(e.Teaser) + `,body=` + sqlText(e.Body) + `,location=` + sqlText(e.Location) + `,status=` + sqlText(e.Status) + `,ai_generated=` + sqlBool(e.AIGenerated) + `,ai_usage=` + sqlText(e.AIUsage) + `,ai_human_reviewed=` + sqlBool(e.AIHumanReviewed) + `,ai_editorial_responsible=` + sqlText(e.AIEditorialResponsible) + `,ai_disclosure=` + sqlText(e.AIDisclosure) + `,media_asset_id=` + mediaSQL + `,post_to_facebook=` + sqlBool(e.PostToFacebook) + `,send_push=` + sqlBool(e.SendPush) + `,facebook_status=CASE WHEN NOT ` + sqlBool(e.PostToFacebook) + ` OR ` + sqlText(e.Status) + `<>'published' THEN 'pending' ELSE facebook_status END,push_status=CASE WHEN ` + sqlBool(e.SendPush) + ` THEN push_status ELSE 'pending' END,published_at=CASE WHEN ` + sqlText(e.Status) + `='published' THEN COALESCE(published_at,now()) ELSE published_at END,updated_at=now() WHERE id=` + strconv.FormatInt(e.ID, 10) + `;` + _, err = s.db.exec(ctx, q) + return err +} + +func (s *editorialStore) SaveAndGet(ctx context.Context, e EditorialEntry) (EditorialEntry, error) { + if err := s.Save(ctx, e); err != nil { + return EditorialEntry{}, err + } + if e.ID > 0 { + item, found, err := s.Get(ctx, e.ID) + if err != nil { + return EditorialEntry{}, err + } + if !found { + return EditorialEntry{}, errors.New("gespeicherter Inhalt konnte nicht erneut geladen werden") + } + return item, nil + } + item, found, err := s.GetBySlug(ctx, slugify(e.Title)) + if err != nil { + return EditorialEntry{}, err + } + if !found { + return EditorialEntry{}, errors.New("gespeicherter Inhalt konnte nicht erneut geladen werden") + } + return item, nil +} + +func (s *editorialStore) Delete(ctx context.Context, id int64) error { + if !s.Enabled() { + return errors.New("PostgreSQL ist nicht konfiguriert") + } + _, err := s.db.exec(ctx, "DELETE FROM landwelle.editorial_entries WHERE id="+strconv.FormatInt(id, 10)+";") + return err +} + +func (s *editorialStore) ContentTypes(ctx context.Context, includeInactive bool) ([]EditorialContentType, error) { + if !s.Enabled() { + return nil, errors.New("PostgreSQL ist nicht konfiguriert") + } + where := "WHERE active=true" + if includeInactive { + where = "" + } + query := `SELECT COALESCE(json_agg(row_to_json(t) ORDER BY t.sort_order,t.name),'[]'::json)::text FROM (SELECT slug,name,description,homepage_section,active,sort_order FROM landwelle.editorial_content_types ` + where + `) t;` + var types []EditorialContentType + if err := s.db.queryJSON(ctx, query, &types); err != nil { + return nil, err + } + return types, nil +} + +func (s *editorialStore) ContentTypeExists(ctx context.Context, slug string) (bool, error) { + if !s.Enabled() { + return false, errors.New("PostgreSQL ist nicht konfiguriert") + } + var rows []struct { + Count int `json:"count"` + } + query := `SELECT json_build_array(json_build_object('count',count(*)::int))::text FROM landwelle.editorial_content_types WHERE slug=` + sqlText(strings.TrimSpace(slug)) + ` AND active=true;` + if err := s.db.queryJSON(ctx, query, &rows); err != nil { + return false, err + } + return len(rows) > 0 && rows[0].Count > 0, nil +} + +func (s *editorialStore) SaveContentType(ctx context.Context, item EditorialContentType) error { + if !s.Enabled() { + return errors.New("PostgreSQL ist nicht konfiguriert") + } + item.Name = strings.TrimSpace(item.Name) + if item.Name == "" { + return errors.New("Name der Kategorie fehlt") + } + item.Slug = slugify(item.Slug) + if item.Slug == "" || strings.HasPrefix(item.Slug, "inhalt-") { + item.Slug = slugify(item.Name) + } + _, err := s.db.exec(ctx, `INSERT INTO landwelle.editorial_content_types(slug,name,description,homepage_section,active,sort_order) VALUES(`+sqlText(item.Slug)+`,`+sqlText(item.Name)+`,`+sqlText(strings.TrimSpace(item.Description))+`,`+sqlBool(item.HomepageSection)+`,`+sqlBool(item.Active)+`,`+strconv.Itoa(item.SortOrder)+`) ON CONFLICT(slug) DO UPDATE SET name=excluded.name,description=excluded.description,homepage_section=excluded.homepage_section,active=excluded.active,sort_order=excluded.sort_order,updated_at=now();`) + return err +} + +func (s *editorialStore) DeleteContentType(ctx context.Context, slug string) error { + if !s.Enabled() { + return errors.New("PostgreSQL ist nicht konfiguriert") + } + _, err := s.db.exec(ctx, `DELETE FROM landwelle.editorial_content_types WHERE slug=`+sqlText(strings.TrimSpace(slug))+`;`) + if err != nil { + return errors.New("Die Kategorie wird noch verwendet und kann nicht gelöscht werden") + } + return nil +} + +func homepageStoriesQuery(limit int) string { + limitClause := "" + if limit > 0 { + limitClause = " LIMIT " + strconv.Itoa(limit) + } + return `SELECT COALESCE(json_agg(json_build_object(` + editorialJSON + `) ORDER BY COALESCE(e.published_at,e.updated_at) DESC),'[]'::json)::text FROM (SELECT e.* FROM landwelle.editorial_entries e JOIN landwelle.editorial_content_types type_filter ON type_filter.slug=e.content_type WHERE e.status='published' AND type_filter.active=true AND type_filter.homepage_section=true ORDER BY COALESCE(e.published_at,e.updated_at) DESC` + limitClause + `) e LEFT JOIN landwelle.media_assets m ON m.id=e.media_asset_id LEFT JOIN landwelle.editorial_content_types ct ON ct.slug=e.content_type;` +} + +func (s *editorialStore) HomepageStories(ctx context.Context, limit int) ([]EditorialEntry, error) { + if !s.Enabled() { + return nil, errors.New("PostgreSQL ist nicht konfiguriert") + } + if limit < 1 || limit > 12 { + limit = 3 + } + var items []EditorialEntry + if err := s.db.queryJSON(ctx, homepageStoriesQuery(limit), &items); err != nil { + return nil, err + } + return items, nil +} + +// AllHomepageStories liefert alle veröffentlichten Beiträge aus den für +// „Landwelle vor Ort“ freigegebenen Rubriken. Die Startseite verwendet +// weiterhin HomepageStories mit einem kleinen Limit. +func (s *editorialStore) AllHomepageStories(ctx context.Context) ([]EditorialEntry, error) { + if !s.Enabled() { + return nil, errors.New("PostgreSQL ist nicht konfiguriert") + } + var items []EditorialEntry + if err := s.db.queryJSON(ctx, homepageStoriesQuery(0), &items); err != nil { + return nil, err + } + return items, nil +} + +// HomepageContentTypes liefert die aktiven Kategorien, die öffentlich unter +// „Landwelle vor Ort“ erscheinen dürfen. +func (s *editorialStore) HomepageContentTypes(ctx context.Context) ([]EditorialContentType, error) { + types, err := s.ContentTypes(ctx, false) + if err != nil { + return nil, err + } + items := make([]EditorialContentType, 0, len(types)) + for _, item := range types { + if item.Active && item.HomepageSection { + items = append(items, item) + } + } + return items, nil +} + +func homepageStoriesByCategoryQuery(category string) string { + return `SELECT COALESCE(json_agg(json_build_object(` + editorialJSON + `) ORDER BY COALESCE(e.published_at,e.updated_at) DESC),'[]'::json)::text FROM landwelle.editorial_entries e JOIN landwelle.editorial_content_types ct ON ct.slug=e.content_type LEFT JOIN landwelle.media_assets m ON m.id=e.media_asset_id WHERE e.status='published' AND ct.active=true AND ct.homepage_section=true AND e.content_type=` + sqlText(strings.TrimSpace(category)) + `;` +} + +// HomepageStoriesByCategory liefert alle veröffentlichten Vor-Ort-Beiträge +// einer freigegebenen Kategorie ohne künstliches Limit. +func (s *editorialStore) HomepageStoriesByCategory(ctx context.Context, category string) ([]EditorialEntry, error) { + if !s.Enabled() { + return nil, errors.New("PostgreSQL ist nicht konfiguriert") + } + var items []EditorialEntry + if err := s.db.queryJSON(ctx, homepageStoriesByCategoryQuery(category), &items); err != nil { + return nil, err + } + return items, nil +} + +func (s *editorialStore) HomepageStoryBySlug(ctx context.Context, slug string) (EditorialEntry, bool, error) { + if !s.Enabled() { + return EditorialEntry{}, false, errors.New("PostgreSQL ist nicht konfiguriert") + } + var items []EditorialEntry + query := `SELECT COALESCE(json_agg(json_build_object(` + editorialJSON + `)),'[]'::json)::text FROM landwelle.editorial_entries e JOIN landwelle.editorial_content_types ct ON ct.slug=e.content_type LEFT JOIN landwelle.media_assets m ON m.id=e.media_asset_id WHERE e.slug=` + sqlText(strings.TrimSpace(slug)) + ` AND e.status='published' AND ct.active=true AND ct.homepage_section=true LIMIT 1;` + if err := s.db.queryJSON(ctx, query, &items); err != nil { + return EditorialEntry{}, false, err + } + if len(items) == 0 { + return EditorialEntry{}, false, nil + } + return items[0], true, nil +} + +func (s *editorialStore) HomepageStoryByCategoryAndSlug(ctx context.Context, category, slug string) (EditorialEntry, bool, error) { + if !s.Enabled() { + return EditorialEntry{}, false, errors.New("PostgreSQL ist nicht konfiguriert") + } + var items []EditorialEntry + query := `SELECT COALESCE(json_agg(json_build_object(` + editorialJSON + `)),'[]'::json)::text FROM landwelle.editorial_entries e JOIN landwelle.editorial_content_types ct ON ct.slug=e.content_type LEFT JOIN landwelle.media_assets m ON m.id=e.media_asset_id WHERE e.content_type=` + sqlText(strings.TrimSpace(category)) + ` AND e.slug=` + sqlText(strings.TrimSpace(slug)) + ` AND e.status='published' AND ct.active=true AND ct.homepage_section=true LIMIT 1;` + if err := s.db.queryJSON(ctx, query, &items); err != nil { + return EditorialEntry{}, false, err + } + if len(items) == 0 { + return EditorialEntry{}, false, nil + } + return items[0], true, nil +} + +func (s *editorialStore) SetFacebookStatus(ctx context.Context, id int64, status string) error { + if !s.Enabled() { + return errors.New("PostgreSQL ist nicht konfiguriert") + } + _, err := s.db.exec(ctx, `UPDATE landwelle.editorial_entries SET facebook_status=`+sqlText(status)+`,updated_at=now() WHERE id=`+strconv.FormatInt(id, 10)+`;`) + return err +} + +func (s *editorialStore) GetBySlug(ctx context.Context, slug string) (EditorialEntry, bool, error) { + if !s.Enabled() { + return EditorialEntry{}, false, errors.New("PostgreSQL ist nicht konfiguriert") + } + var items []EditorialEntry + q := `SELECT COALESCE(json_agg(json_build_object(` + editorialJSON + `)),'[]'::json)::text FROM landwelle.editorial_entries e LEFT JOIN landwelle.media_assets m ON m.id=e.media_asset_id LEFT JOIN landwelle.editorial_content_types ct ON ct.slug=e.content_type WHERE e.slug=` + sqlText(slug) + ` LIMIT 1;` + if err := s.db.queryJSON(ctx, q, &items); err != nil { + return EditorialEntry{}, false, err + } + if len(items) == 0 { + return EditorialEntry{}, false, nil + } + return items[0], true, nil +} diff --git a/editorial_public.go b/editorial_public.go new file mode 100644 index 0000000..389cda8 --- /dev/null +++ b/editorial_public.go @@ -0,0 +1,196 @@ +package main + +import ( + "bytes" + "html/template" + "log" + "net/http" + "strings" +) + +type editorialStoriesPageData struct { + PageData + Entries []EditorialEntry + Categories []EditorialContentType + ActiveCategory EditorialContentType + HasActiveCategory bool + PageTitle string + MetaDescription string + CanonicalPath string + SectionTitle string + SectionDescription string +} + +func homepageCategoryBySlug(categories []EditorialContentType, slug string) (EditorialContentType, bool) { + slug = strings.TrimSpace(slug) + for _, category := range categories { + if category.Active && category.HomepageSection && category.Slug == slug { + return category, true + } + } + return EditorialContentType{}, false +} + +func renderEditorialStoriesPage(w http.ResponseWriter, r *http.Request, t *template.Template, logger *log.Logger, data PageData, store *editorialStore, category *EditorialContentType) { + categories, err := store.HomepageContentTypes(r.Context()) + if err != nil { + logger.Printf("landwelle-vor-ort kategorien laden: %v", err) + categories = nil + } + + page := editorialStoriesPageData{ + PageData: data, + Categories: categories, + PageTitle: "Landwelle vor Ort", + MetaDescription: "Geschichten, Begegnungen und Berichte aus Niedersachsen und dem Norden – Landwelle ist vor Ort dabei.", + CanonicalPath: "/landwelle-vor-ort", + SectionTitle: "Alle Beiträge", + SectionDescription: "Veröffentlichte Beiträge aus der Landwelle-Redaktion.", + } + + if category == nil { + page.Entries, err = store.AllHomepageStories(r.Context()) + } else { + page.ActiveCategory = *category + page.HasActiveCategory = true + page.PageTitle = "Landwelle vor Ort: " + category.Name + page.CanonicalPath = "/landwelle-vor-ort/" + category.Slug + page.SectionTitle = category.Name + if description := strings.TrimSpace(category.Description); description != "" { + page.MetaDescription = description + page.SectionDescription = description + } else { + page.MetaDescription = "Beiträge aus der Kategorie " + category.Name + " bei Landwelle vor Ort." + page.SectionDescription = "Alle veröffentlichten Beiträge aus der Kategorie " + category.Name + "." + } + page.Entries, err = store.HomepageStoriesByCategory(r.Context(), category.Slug) + } + if err != nil { + logger.Printf("landwelle-vor-ort übersicht laden: %v", err) + page.Entries = nil + } + + w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.Header().Set("Cache-Control", "no-store") + if r.Method == http.MethodHead { + w.WriteHeader(http.StatusOK) + return + } + var rendered bytes.Buffer + if err := t.ExecuteTemplate(&rendered, "landwelle-vor-ort.html", page); err != nil { + logger.Printf("landwelle-vor-ort übersicht template: %v", err) + http.Error(w, "Landwelle vor Ort konnte nicht dargestellt werden.", http.StatusInternalServerError) + return + } + _, _ = w.Write(rendered.Bytes()) +} + +func editorialStoriesHandler(t *template.Template, logger *log.Logger, data PageData, store *editorialStore) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/landwelle-vor-ort" { + http.NotFound(w, r) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", http.MethodGet+", "+http.MethodHead) + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + renderEditorialStoriesPage(w, r, t, logger, data, store, nil) + } +} + +type editorialStoryPageData struct { + PageData + Entry EditorialEntry +} + +func renderEditorialStory(w http.ResponseWriter, r *http.Request, t *template.Template, logger *log.Logger, data PageData, entry EditorialEntry) { + w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.Header().Set("Cache-Control", "no-store") + if r.Method == http.MethodHead { + w.WriteHeader(http.StatusOK) + return + } + var rendered bytes.Buffer + if err := t.ExecuteTemplate(&rendered, "editorial-story.html", editorialStoryPageData{PageData: data, Entry: entry}); err != nil { + logger.Printf("landwelle-vor-ort template: %v", err) + http.Error(w, "Der Beitrag konnte nicht dargestellt werden.", http.StatusInternalServerError) + return + } + _, _ = w.Write(rendered.Bytes()) +} + +// editorialStoryHandler verarbeitet die komplette Unterstruktur von +// /landwelle-vor-ort/: Kategorien, Beiträge und alte ungegliederte Beitragslinks. +func editorialStoryHandler(t *template.Template, logger *log.Logger, data PageData, store *editorialStore) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet && r.Method != http.MethodHead { + w.Header().Set("Allow", http.MethodGet+", "+http.MethodHead) + http.Error(w, "Methode nicht erlaubt", http.StatusMethodNotAllowed) + return + } + + relativePath := strings.Trim(strings.TrimPrefix(r.URL.Path, "/landwelle-vor-ort/"), "/") + if relativePath == "" { + http.Redirect(w, r, "/landwelle-vor-ort", http.StatusMovedPermanently) + return + } + parts := strings.Split(relativePath, "/") + if len(parts) > 2 { + http.NotFound(w, r) + return + } + + if len(parts) == 1 { + categories, err := store.HomepageContentTypes(r.Context()) + if err != nil { + logger.Printf("landwelle-vor-ort kategorien laden: %v", err) + http.Error(w, "Landwelle vor Ort konnte nicht geladen werden.", http.StatusInternalServerError) + return + } + if category, found := homepageCategoryBySlug(categories, parts[0]); found { + renderEditorialStoriesPage(w, r, t, logger, data, store, &category) + return + } + + // Abwärtskompatibilität: alte Links /landwelle-vor-ort/ + // dauerhaft auf die neue kanonische Kategorie-URL umleiten. + entry, found, err := store.HomepageStoryBySlug(r.Context(), parts[0]) + if err != nil { + logger.Printf("landwelle-vor-ort alten beitrag laden: %v", err) + } + if err != nil || !found { + http.NotFound(w, r) + return + } + canonical := entry.PublicPath() + if canonical == "" { + http.NotFound(w, r) + return + } + http.Redirect(w, r, canonical, http.StatusMovedPermanently) + return + } + + categorySlug := strings.TrimSpace(parts[0]) + storySlug := strings.TrimSpace(parts[1]) + if categorySlug == "" || storySlug == "" { + http.NotFound(w, r) + return + } + entry, found, err := store.HomepageStoryByCategoryAndSlug(r.Context(), categorySlug, storySlug) + if err != nil { + logger.Printf("landwelle-vor-ort beitrag laden: %v", err) + } + if err != nil || !found { + http.NotFound(w, r) + return + } + if canonical := entry.PublicPath(); canonical != "" && canonical != r.URL.Path { + http.Redirect(w, r, canonical, http.StatusMovedPermanently) + return + } + renderEditorialStory(w, r, t, logger, data, entry) + } +} diff --git a/editorial_workflow_test.go b/editorial_workflow_test.go new file mode 100644 index 0000000..0dc0b18 --- /dev/null +++ b/editorial_workflow_test.go @@ -0,0 +1,158 @@ +package main + +import ( + "bytes" + "context" + "io" + "net/http" + "net/http/httptest" + "net/url" + "os" + "strings" + "testing" +) + +func TestBuildFacebookPostUsesLandwelleVorOrtURL(t *testing.T) { + cfg := SocialSettings{ + FacebookEnabled: true, + FacebookPageID: "123", + FacebookPageToken: "token", + PublicBaseURL: "https://landwelle.de/", + } + entry := EditorialEntry{ + Title: "Vereinsfest in der Region", + Teaser: "Landwelle war vor Ort.", + Slug: "vereinsfest-in-der-region", + ContentType: "vereine", + HomepageSection: true, + } + post, err := buildFacebookPost(cfg, entry) + if err != nil { + t.Fatalf("buildFacebookPost: %v", err) + } + if got, want := post.Link, "https://landwelle.de/landwelle-vor-ort/vereine/vereinsfest-in-der-region"; got != want { + t.Fatalf("Link = %q, want %q", got, want) + } + if strings.Contains(post.Link, "/news/") { + t.Fatalf("Facebook link still points to news route: %s", post.Link) + } + if !strings.Contains(post.Message, entry.Title) || !strings.Contains(post.Message, entry.Teaser) { + t.Fatalf("Facebook message missing title or teaser: %q", post.Message) + } +} + +func TestBuildFacebookPostRejectsNonPublicCategory(t *testing.T) { + cfg := SocialSettings{FacebookEnabled: true, FacebookPageID: "123", FacebookPageToken: "token", PublicBaseURL: "https://landwelle.de"} + _, err := buildFacebookPost(cfg, EditorialEntry{Title: "Intern", Slug: "intern"}) + if err == nil || !strings.Contains(err.Error(), "keine öffentliche") { + t.Fatalf("expected public-category error, got %v", err) + } +} + +func TestFacebookPublisherSubmitsExpectedForm(t *testing.T) { + var receivedPath string + var received url.Values + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + receivedPath = r.URL.Path + body, _ := io.ReadAll(r.Body) + received, _ = url.ParseQuery(string(body)) + w.Header().Set("Content-Type", "application/json") + _, _ = io.WriteString(w, `{"id":"123_456"}`) + })) + defer server.Close() + + publisher := &facebookPublisher{client: server.Client(), graphBaseURL: server.URL} + cfg := SocialSettings{FacebookEnabled: true, FacebookPageID: "123", FacebookPageToken: "secret", FacebookAPIVersion: "v25.0", PublicBaseURL: "https://landwelle.de"} + entry := EditorialEntry{Title: "Titel", Teaser: "Teaser", Slug: "titel", ContentType: "traditionen", HomepageSection: true} + id, err := publisher.Publish(context.Background(), cfg, entry) + if err != nil { + t.Fatalf("Publish: %v", err) + } + if id != "123_456" { + t.Fatalf("post ID = %q", id) + } + if receivedPath != "/v25.0/123/feed" { + t.Fatalf("path = %q", receivedPath) + } + if received.Get("link") != "https://landwelle.de/landwelle-vor-ort/traditionen/titel" { + t.Fatalf("link = %q", received.Get("link")) + } + if received.Get("access_token") != "secret" { + t.Fatalf("access token missing") + } +} + +func TestEditorialAdminContainsTabsModalAndFacebookPreview(t *testing.T) { + raw, err := os.ReadFile("web/admin/editorial.html") + if err != nil { + t.Fatal(err) + } + text := string(raw) + for _, needle := range []string{ + "Inhalte ansehen und verwalten", + "Inhalt anlegen", + "Kategorie anlegen", + "data-category-modal", + "data-facebook-preview", + "Facebook erneut senden", + "{{.ContentTypeLabel}}", + } { + if !strings.Contains(text, needle) { + t.Fatalf("editorial template missing %q", needle) + } + } + if strings.Contains(text, "Redaktionstypen") || strings.Contains(text, "Typ anlegen") { + t.Fatal("legacy type wording is still visible in editorial template") + } +} + +func TestHomepageStoriesRemainVisibleOnSmartphones(t *testing.T) { + raw, err := os.ReadFile("web/assets/home-v5.css") + if err != nil { + t.Fatal(err) + } + text := string(raw) + if !strings.Contains(text, ".compact-grid.story-grid article:last-child{display:block!important}") { + t.Fatal("mobile override for the last Landwelle-vor-Ort card is missing") + } + index, err := os.ReadFile("web/index.html") + if err != nil { + t.Fatal(err) + } + if !strings.Contains(string(index), "/assets/home-v5.css") { + t.Fatal("homepage does not load the mobile story fix stylesheet") + } +} + +func TestEditorialAdminTemplateRendersActivePanels(t *testing.T) { + tmpl, err := parseAdminTemplate("web/admin/editorial.html") + if err != nil { + t.Fatal(err) + } + base := adminEditorialData{ + Username: "Jens", + CSRFToken: "csrf", + DatabaseReady: true, + Types: []EditorialContentType{{ + Slug: "vor_ort", Name: "Landwelle vor Ort", HomepageSection: true, Active: true, SortOrder: 10, + }}, + Items: []EditorialEntry{{ + ID: 1, ContentType: "vor_ort", ContentTypeLabel: "Landwelle vor Ort", HomepageSection: true, + Title: "Testbeitrag", Slug: "testbeitrag", Status: "published", PostToFacebook: true, + FacebookStatus: "failed:Testfehler", + }}, + Social: SocialSettings{PublicBaseURL: "https://landwelle.de"}, + FacebookReady: true, + } + for _, tab := range []string{"contents", "create", "categories"} { + data := base + data.ActiveTab = tab + var out bytes.Buffer + if err := tmpl.ExecuteTemplate(&out, "editorial-admin.html", data); err != nil { + t.Fatalf("render tab %s: %v", tab, err) + } + if !strings.Contains(out.String(), "Redaktionssystem") { + t.Fatalf("tab %s did not render expected content", tab) + } + } +} diff --git a/event_admin_v1528_test.go b/event_admin_v1528_test.go new file mode 100644 index 0000000..ed7a49f --- /dev/null +++ b/event_admin_v1528_test.go @@ -0,0 +1,74 @@ +package main + +import ( + "os" + "strings" + "testing" +) + +func TestEventAdminV1528MigrationCreatesManagedCategories(t *testing.T) { + raw, err := os.ReadFile("migrations/0039_event_categories_admin.sql") + if err != nil { + t.Fatal(err) + } + body := string(raw) + for _, needle := range []string{ + "CREATE TABLE IF NOT EXISTS event_categories", + "event_categories_name_ci_uidx", + "('Familie',10)", + "FROM event_submissions e", + } { + if !strings.Contains(body, needle) { + t.Fatalf("migration missing %q", needle) + } + } +} + +func TestEventAdminV1528UsesModalCreateEditAndCategoryManagement(t *testing.T) { + raw, err := os.ReadFile("web/admin/management.html") + if err != nil { + t.Fatal(err) + } + body := string(raw) + for _, needle := range []string{ + `data-admin-dialog-open="event-create-dialog"`, + `data-admin-dialog-open="event-category-dialog"`, + `data-admin-dialog-open="event-edit-{{.ID}}"`, + `enctype="multipart/form-data"`, + `value="category_create"`, + `value="category_update"`, + `name="graphic"`, + } { + if !strings.Contains(body, needle) { + t.Fatalf("admin event template missing %q", needle) + } + } +} + +func TestEventAdminV1528PublicCategoriesAreDynamic(t *testing.T) { + raw, err := os.ReadFile("web/events.html") + if err != nil { + t.Fatal(err) + } + body := string(raw) + if !strings.Contains(body, `
+{{end}} +Todo-Liste – Landwelle
Landwelle RadioVerwaltung
{{.Username}}
+
Aufgabensteuerung

Todo-Board

Aufgaben priorisieren, bearbeiten und ihren Firebase-Übergabestatus nachvollziehen.

+{{if .Saved}}
Änderung wurde gespeichert.
{{end}}{{if .Duplicate}}
Doppeltes Absenden erkannt. Es wurde kein zweites Todo und kein zweiter Push erzeugt.
{{end}}{{if eq .PushStatus "sent"}}
Die Push-Nachricht wurde von Firebase angenommen.
{{end}}{{if eq .PushStatus "failed"}}
Das Todo wurde gespeichert, aber die Übergabe an Firebase ist fehlgeschlagen.
{{end}}{{if eq .PushStatus "test_sent"}}
Firebase-Testnachricht wurde angenommen.
{{end}}{{if eq .PushStatus "test_failed"}}
Firebase-Test fehlgeschlagen.
{{end}}{{if .Error}}
{{.Error}}
{{end}} +
Alle Aufgaben{{.TotalCount}}
Offen{{len .OpenItems}}
In Arbeit{{len .ProgressItems}}
Hohe Priorität{{.HighCount}}
+
Firebase: {{.FirebaseStatus}}

„An Firebase übergeben“ bestätigt die Annahme durch FCM. Eine sichere Zustellbestätigung vom Android-Gerät stellt FCM hier nicht bereit.

+

Neue Aufgabe

+

Offen

{{len .OpenItems}}
{{range .OpenItems}}{{template "todo-item" .}}{{else}}
Keine offenen Aufgaben.
{{end}}

In Arbeit

{{len .ProgressItems}}
{{range .ProgressItems}}{{template "todo-item" .}}{{else}}
Noch nichts in Arbeit.
{{end}}

Erledigt

{{len .DoneItems}}
{{range .DoneItems}}{{template "todo-item" .}}{{else}}
Noch keine erledigten Aufgaben.
{{end}}
+
`)) diff --git a/todo_chart_v1549_test.go b/todo_chart_v1549_test.go new file mode 100644 index 0000000..612caf1 --- /dev/null +++ b/todo_chart_v1549_test.go @@ -0,0 +1,48 @@ +package main + +import ( + "context" + "strings" + "testing" +) + +func TestV1549LegacyITTodoScopeResolvesAdminDirectlyInDatabase(t *testing.T) { + t.Setenv("LANDWELLE_TODO_JENS_USER_ID", "") + t.Setenv("LANDWELLE_TODO_ADMIN_USER_ID", "") + where := (&adminHandler{}).mobileTodoAuthorWhere(context.Background(), "Jens") + for _, want := range []string{ + "lower(btrim(t.author)) IN ('jens','admin')", + "scope_user.id IN (t.author_user_id,t.created_by_user_id)", + "lower(btrim(scope_user.username)) IN ('jens','admin')", + } { + if !strings.Contains(where, want) { + t.Fatalf("gemeinsamer Jens/admin-Scope fehlt %q in: %s", want, where) + } + } +} + +func TestV1549ChartRangeExpandsToExistingPositions(t *testing.T) { + spec := extendChartRangeToEntries("listener", chartRanges("listener"), []ChartEntry{ + {Position: 44}, {Position: 45}, {Position: 46}, {Position: 47}, {Position: 48}, + }) + if spec.MainEnd != 32 { + t.Fatalf("Hauptbereich darf sich nicht verschieben: %d", spec.MainEnd) + } + if spec.TotalEnd != 48 { + t.Fatalf("erwartet dynamisches Ende 48, erhalten %d", spec.TotalEnd) + } + if spec.NewTitle != "Neuvorstellungen 33 bis 48" { + t.Fatalf("unerwarteter dynamischer Titel: %q", spec.NewTitle) + } + _, _, preview := splitChartEntries([]ChartEntry{{Position: 45}, {Position: 46}, {Position: 47}, {Position: 48}}, spec) + if len(preview) != 4 { + t.Fatalf("Positionen 45 bis 48 muessen sichtbar bleiben, erhalten %d Eintraege", len(preview)) + } +} + +func TestV1549ChartRangeKeepsDefaultWithoutExtraRows(t *testing.T) { + spec := extendChartRangeToEntries("listener", chartRanges("listener"), []ChartEntry{{Position: 45}}) + if spec.TotalEnd != 45 || spec.NewTitle != "Neuvorstellungen 33 bis 45" { + t.Fatalf("Standardbereich unerwartet veraendert: %#v", spec) + } +} diff --git a/todo_it_admin_v1548_test.go b/todo_it_admin_v1548_test.go new file mode 100644 index 0000000..312e622 --- /dev/null +++ b/todo_it_admin_v1548_test.go @@ -0,0 +1,35 @@ +package main + +import ( + "context" + "strings" + "testing" +) + +func TestV1548AdminTodoTriggersExistingITAppPush(t *testing.T) { + t.Setenv("LANDWELLE_TODO_JENS_USER_ID", "42") + t.Setenv("LANDWELLE_TODO_ADMIN_USER_ID", "7") + handler := &adminHandler{} + adminID := int64(7) + if !handler.todoRequiresITAppPush(context.Background(), todoInsertResult{CreatedByUserID: &adminID}, adminSession{}) { + t.Fatal("vom admin-Konto angelegte Aufgabe muss den IT-App-Push auslösen") + } + message := newLandwelleITTodoMessage(123, "admin") + if message.Topic != "landwelle_it_jens_todos" { + t.Fatalf("bestehendes App-Topic muss kompatibel bleiben: %q", message.Topic) + } + if message.Data["author"] != "admin" { + t.Fatalf("Push muss tatsächlichen Autor übertragen: %#v", message.Data) + } +} + +func TestV1548LegacyJensQueryCoversAdminScope(t *testing.T) { + t.Setenv("LANDWELLE_TODO_JENS_USER_ID", "") + t.Setenv("LANDWELLE_TODO_ADMIN_USER_ID", "") + where := (&adminHandler{}).mobileTodoAuthorWhere(context.Background(), "Jens") + for _, want := range []string{"'jens'", "'admin'"} { + if !strings.Contains(where, want) { + t.Fatalf("Legacy-Filter fehlt %s: %s", want, where) + } + } +} diff --git a/traffic.go b/traffic.go new file mode 100644 index 0000000..e019d4a --- /dev/null +++ b/traffic.go @@ -0,0 +1,447 @@ +package main + +import ( + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "html" + "io" + "log" + "net/http" + "net/url" + "regexp" + "sort" + "strconv" + "strings" + "sync" + "time" +) + +type TrafficItem struct { + ID string `json:"id"` + Road string `json:"road"` + Kind string `json:"kind"` + Title string `json:"title"` + Direction string `json:"direction,omitempty"` + Description string `json:"description,omitempty"` + Latitude float64 `json:"latitude,omitempty"` + Longitude float64 `json:"longitude,omitempty"` + UpdatedAt time.Time `json:"updated_at"` + SourceName string `json:"source_name"` + SourceURL string `json:"source_url"` +} + +type SpeedCameraItem struct { + ID string `json:"id"` + Title string `json:"title"` + Description string `json:"description,omitempty"` + Region string `json:"region,omitempty"` + PublishedAt time.Time `json:"published_at"` + SourceName string `json:"source_name"` + SourceURL string `json:"source_url"` +} + +type TrafficSnapshot struct { + Traffic []TrafficItem `json:"traffic"` + SpeedCameras []SpeedCameraItem `json:"speed_cameras"` + FetchedAt time.Time `json:"fetched_at"` + Stale bool `json:"stale"` + Warnings []string `json:"warnings,omitempty"` +} + +type trafficService struct { + mu sync.RWMutex + client *http.Client + logger *log.Logger + cached TrafficSnapshot + expires time.Time + loading bool + waiters []chan struct{} + cacheTTL time.Duration +} + +func newTrafficService(logger *log.Logger) *trafficService { + return &trafficService{ + client: &http.Client{Timeout: envDuration("LANDWELLE_TRAFFIC_TIMEOUT", 12*time.Second)}, logger: logger, + cacheTTL: envDuration("LANDWELLE_TRAFFIC_CACHE_TTL", 3*time.Minute), + } +} + +func (s *trafficService) Get(ctx context.Context, force bool) (TrafficSnapshot, error) { + s.mu.RLock() + cached, expires := s.cached, s.expires + s.mu.RUnlock() + if !force && !cached.FetchedAt.IsZero() && time.Now().Before(expires) { + return cached, nil + } + + s.mu.Lock() + if s.loading { + ch := make(chan struct{}) + s.waiters = append(s.waiters, ch) + s.mu.Unlock() + select { + case <-ch: + return s.Get(ctx, false) + case <-ctx.Done(): + return cached, ctx.Err() + } + } + s.loading = true + s.mu.Unlock() + + snapshot, err := s.fetch(ctx) + s.mu.Lock() + if err == nil { + s.cached = snapshot + s.expires = time.Now().Add(s.cacheTTL) + } else if !s.cached.FetchedAt.IsZero() { + s.cached.Stale = true + s.cached.Warnings = appendUnique(s.cached.Warnings, "Aktualisierung fehlgeschlagen; letzte erfolgreiche Daten werden angezeigt.") + snapshot = s.cached + } + s.loading = false + for _, ch := range s.waiters { + close(ch) + } + s.waiters = nil + s.mu.Unlock() + return snapshot, err +} + +func (s *trafficService) fetch(ctx context.Context) (TrafficSnapshot, error) { + var snapshot TrafficSnapshot + var errs []string + traffic, err := s.fetchAutobahn(ctx) + if err != nil { + errs = append(errs, "Verkehr: "+err.Error()) + } else { + snapshot.Traffic = traffic + } + cameras, err := s.fetchSpeedCameras(ctx) + if err != nil { + errs = append(errs, "Blitzer: "+err.Error()) + } else { + snapshot.SpeedCameras = cameras + } + if len(snapshot.Traffic) == 0 && len(snapshot.SpeedCameras) == 0 { + return snapshot, errors.New(strings.Join(errs, "; ")) + } + snapshot.FetchedAt = time.Now().UTC() + snapshot.Warnings = errs + return snapshot, nil +} + +var niedersachsenAutobahns = []string{"A1", "A2", "A7", "A27", "A28", "A29", "A30", "A31", "A33", "A36", "A37", "A39", "A261", "A280", "A293", "A352", "A391", "A392"} + +func (s *trafficService) fetchAutobahn(ctx context.Context) ([]TrafficItem, error) { + base := strings.TrimRight(envOr("LANDWELLE_AUTOBAHN_API_URL", "https://verkehr.autobahn.de/o/autobahn"), "/") + type result struct { + items []TrafficItem + err error + } + jobs := make(chan string) + results := make(chan result) + worker := func() { + for endpoint := range jobs { + items, err := s.fetchAutobahnEndpoint(ctx, base, endpoint) + results <- result{items, err} + } + } + workers := 6 + for i := 0; i < workers; i++ { + go worker() + } + endpoints := make([]string, 0, len(niedersachsenAutobahns)*3) + for _, road := range niedersachsenAutobahns { + for _, kind := range []string{"warning", "closure", "roadworks"} { + endpoints = append(endpoints, road+"/services/"+kind) + } + } + go func() { + for _, endpoint := range endpoints { + jobs <- endpoint + } + close(jobs) + }() + var all []TrafficItem + failures := 0 + for i := 0; i < len(endpoints); i++ { + r := <-results + if r.err != nil { + failures++ + continue + } + all = append(all, r.items...) + } + if len(all) == 0 && failures > 0 { + return nil, fmt.Errorf("Autobahn-API lieferte keine verwertbaren Meldungen (%d Abrufe fehlgeschlagen)", failures) + } + seen := map[string]bool{} + out := all[:0] + for _, item := range all { + if seen[item.ID] { + continue + } + seen[item.ID] = true + out = append(out, item) + } + sort.SliceStable(out, func(i, j int) bool { return out[i].UpdatedAt.After(out[j].UpdatedAt) }) + if len(out) > 120 { + out = out[:120] + } + return out, nil +} + +func (s *trafficService) fetchAutobahnEndpoint(ctx context.Context, base, endpoint string) ([]TrafficItem, error) { + req, err := http.NewRequestWithContext(ctx, http.MethodGet, base+"/"+endpoint, nil) + if err != nil { + return nil, err + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", "LandwelleRadio/"+applicationVersion+" (+https://landwelle.de)") + resp, err := s.client.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode == http.StatusNoContent { + return nil, nil + } + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("HTTP %d", resp.StatusCode) + } + body, err := io.ReadAll(io.LimitReader(resp.Body, 5<<20)) + if err != nil { + return nil, err + } + var payload map[string]json.RawMessage + if err := json.Unmarshal(body, &payload); err != nil { + return nil, err + } + parts := strings.Split(endpoint, "/") + road := parts[0] + kind := parts[len(parts)-1] + var raw json.RawMessage + for _, key := range []string{kind, strings.TrimSuffix(kind, "s"), "warning", "closure", "roadworks"} { + if v, ok := payload[key]; ok { + raw = v + break + } + } + if len(raw) == 0 { + return nil, nil + } + var objects []map[string]any + if err := json.Unmarshal(raw, &objects); err != nil { + return nil, err + } + items := make([]TrafficItem, 0, len(objects)) + for _, obj := range objects { + lat, lon, hasCoordinates := extractCoordinates(obj) + if hasCoordinates && !insideNiedersachsen(lat, lon) { + continue + } + title := firstString(obj, "title", "subtitle") + description := flattenText(obj["description"]) + direction := firstString(obj, "subtitle") + if title == "" { + title = description + } + if title == "" { + continue + } + identifier := firstString(obj, "identifier") + if identifier == "" { + identifier = road + "-" + kind + "-" + slugHash(title+direction) + } + updated := extractTime(obj) + if updated.IsZero() { + updated = time.Now().UTC() + } + items = append(items, TrafficItem{ID: identifier, Road: road, Kind: trafficKindLabel(kind), Title: cleanText(title), Direction: cleanText(direction), Description: cleanText(description), Latitude: lat, Longitude: lon, UpdatedAt: updated, SourceName: "Autobahn GmbH des Bundes", SourceURL: "https://www.autobahn.de/betrieb-verkehr/verkehrsmeldungen"}) + } + return items, nil +} + +func insideNiedersachsen(lat, lon float64) bool { + return lat >= 51.15 && lat <= 54.05 && lon >= 6.35 && lon <= 11.75 +} +func trafficKindLabel(kind string) string { + switch kind { + case "warning": + return "Verkehrsmeldung" + case "closure": + return "Sperrung" + case "roadworks": + return "Baustelle" + } + return kind +} + +func extractCoordinates(obj map[string]any) (float64, float64, bool) { + for _, key := range []string{"coordinate", "point"} { + m, ok := obj[key].(map[string]any) + if !ok { + continue + } + lat, ok1 := number(m["lat"]) + lon, ok2 := number(m["long"]) + if !ok2 { + lon, ok2 = number(m["lon"]) + } + if ok1 && ok2 { + return lat, lon, true + } + } + return 0, 0, false +} +func number(v any) (float64, bool) { + switch n := v.(type) { + case float64: + return n, true + case string: + f, e := strconv.ParseFloat(n, 64) + return f, e == nil + } + return 0, false +} +func firstString(obj map[string]any, keys ...string) string { + for _, k := range keys { + if v, ok := obj[k].(string); ok && strings.TrimSpace(v) != "" { + return v + } + } + return "" +} +func flattenText(v any) string { + switch x := v.(type) { + case string: + return x + case []any: + var p []string + for _, e := range x { + if s := flattenText(e); s != "" { + p = append(p, s) + } + } + return strings.Join(p, " ") + case map[string]any: + for _, k := range []string{"text", "description", "value"} { + if s := flattenText(x[k]); s != "" { + return s + } + } + } + return "" +} +func extractTime(obj map[string]any) time.Time { + for _, k := range []string{"startTimestamp", "timestamp", "updated_at", "start"} { + if s, ok := obj[k].(string); ok { + for _, layout := range []string{time.RFC3339, "2006-01-02T15:04:05", "02.01.06, 15:04"} { + if t, e := time.Parse(layout, s); e == nil { + return t.UTC() + } + } + } + } + return time.Time{} +} + +func (s *trafficService) fetchSpeedCameras(ctx context.Context) ([]SpeedCameraItem, error) { + feedURL := envOr("LANDWELLE_BLITZER_RSS_URL", "https://www.ffn.de/traffic/blitzer.rss") + req, err := http.NewRequestWithContext(ctx, http.MethodGet, feedURL, nil) + if err != nil { + return nil, err + } + req.Header.Set("Accept", "application/rss+xml, application/xml, text/xml") + req.Header.Set("User-Agent", "LandwelleRadio/"+applicationVersion+" (+https://landwelle.de)") + resp, err := s.client.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("HTTP %d", resp.StatusCode) + } + var feed struct { + Channel struct { + Items []struct { + Title string `xml:"title"` + Description string `xml:"description"` + Link string `xml:"link"` + GUID string `xml:"guid"` + PubDate string `xml:"pubDate"` + } `xml:"item"` + } `xml:"channel"` + } + decoder := xml.NewDecoder(io.LimitReader(resp.Body, 3<<20)) + if err := decoder.Decode(&feed); err != nil { + return nil, err + } + items := make([]SpeedCameraItem, 0, len(feed.Channel.Items)) + now := time.Now().UTC() + for _, entry := range feed.Channel.Items { + title := cleanText(entry.Title) + desc := cleanText(entry.Description) + if title == "" { + continue + } + published := now + for _, layout := range []string{time.RFC1123Z, time.RFC1123, time.RFC822Z, time.RFC822} { + if t, e := time.Parse(layout, strings.TrimSpace(entry.PubDate)); e == nil { + published = t.UTC() + break + } + } + id := strings.TrimSpace(entry.GUID) + if id == "" { + id = slugHash(title + entry.PubDate) + } + link := strings.TrimSpace(entry.Link) + if _, e := url.ParseRequestURI(link); e != nil { + link = "https://www.ffn.de/programm/flitzer-blitzer-staus-und-schulausfaelle/aktuelle-verkehrsmeldungen/" + } + items = append(items, SpeedCameraItem{ID: id, Title: title, Description: desc, Region: guessRegion(title + " " + desc), PublishedAt: published, SourceName: "radio ffn Verkehrsservice", SourceURL: link}) + } + sort.SliceStable(items, func(i, j int) bool { return items[i].PublishedAt.After(items[j].PublishedAt) }) + if len(items) > 80 { + items = items[:80] + } + return items, nil +} + +var tagRE = regexp.MustCompile(`<[^>]+>`) +var whitespaceRE = regexp.MustCompile(`\s+`) + +func cleanText(v string) string { + v = html.UnescapeString(tagRE.ReplaceAllString(v, " ")) + return strings.TrimSpace(whitespaceRE.ReplaceAllString(v, " ")) +} +func slugHash(v string) string { + h := uint64(1469598103934665603) + for _, b := range []byte(v) { + h ^= uint64(b) + h *= 1099511628211 + } + return strconv.FormatUint(h, 36) +} +func guessRegion(v string) string { + l := strings.ToLower(v) + for _, r := range []string{"hannover", "braunschweig", "osnabrück", "oldenburg", "lüneburg", "göttingen", "celle", "emden", "aurich", "leer", "stade", "harburg", "rotenburg", "heidekreis", "verden", "nienburg", "hildesheim", "wolfsburg", "salzgitter"} { + if strings.Contains(l, r) { + return strings.Title(r) + } + } + return "Niedersachsen" +} +func appendUnique(in []string, v string) []string { + for _, s := range in { + if s == v { + return in + } + } + return append(in, v) +} diff --git a/traffic_test.go b/traffic_test.go new file mode 100644 index 0000000..3960632 --- /dev/null +++ b/traffic_test.go @@ -0,0 +1,64 @@ +package main + +import ( + "context" + "io" + "log" + "net/http" + "net/http/httptest" + "strings" + "testing" + "time" +) + +func TestTrafficServiceCombinesAutobahnAndRSS(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if strings.HasSuffix(r.URL.Path, "/blitzer.rss") { + w.Header().Set("Content-Type", "application/rss+xml") + _, _ = io.WriteString(w, `Blitzer in HannoverMesseschnellweghttps://example.test/blitzerb1Wed, 15 Jul 2026 14:00:00 +0000`) + return + } + if strings.Contains(r.URL.Path, "/services/warning") { + w.Header().Set("Content-Type", "application/json") + _, _ = io.WriteString(w, `{"warning":[{"identifier":"w1","title":"Stau","subtitle":"Hannover Richtung Hamburg","coordinate":{"lat":52.7,"long":9.7}}]}`) + return + } + w.Header().Set("Content-Type", "application/json") + _, _ = io.WriteString(w, `{}`) + })) + defer server.Close() + + t.Setenv("LANDWELLE_AUTOBAHN_API_URL", server.URL) + t.Setenv("LANDWELLE_BLITZER_RSS_URL", server.URL+"/blitzer.rss") + service := newTrafficService(log.New(io.Discard, "", 0)) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + snapshot, err := service.Get(ctx, true) + if err != nil { + t.Fatalf("Get: %v", err) + } + if len(snapshot.Traffic) == 0 { + t.Fatal("expected traffic items") + } + if len(snapshot.SpeedCameras) != 1 { + t.Fatalf("expected one speed camera item, got %d", len(snapshot.SpeedCameras)) + } + if snapshot.SpeedCameras[0].Region != "Hannover" { + t.Fatalf("unexpected region: %q", snapshot.SpeedCameras[0].Region) + } +} + +func TestProgramStorePersists(t *testing.T) { + store := &programStore{path: t.TempDir() + "/program.json", items: nil} + item := ProgramItem{Weekday: 1, Start: "08:00", End: "10:00", Show: "Landfrühstück", Presenter: "Jens", ProgramType: "Magazin", Image: "/assets/presenter-jan-v14.svg", Active: true} + if err := store.Upsert(item); err != nil { + t.Fatalf("Upsert: %v", err) + } + reloaded := &programStore{path: store.path, items: defaultProgram()} + if err := reloaded.load(); err != nil { + t.Fatalf("load: %v", err) + } + if len(reloaded.List(time.Now())) != 1 { + t.Fatalf("expected one item") + } +} diff --git a/users.go b/users.go new file mode 100644 index 0000000..6529dcd --- /dev/null +++ b/users.go @@ -0,0 +1,367 @@ +package main + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "strconv" + "strings" + "time" + + "landwelle-portal/internal/auth" +) + +type ManagedUser struct { + ID int64 `json:"id"` + Username string `json:"username"` + Email string `json:"email"` + DisplayName string `json:"display_name"` + FirstName string `json:"first_name"` + LastName string `json:"last_name"` + Phone string `json:"phone"` + Role string `json:"role"` + RoleName string `json:"role_name"` + Active bool `json:"active"` + EmailVerified bool `json:"email_verified"` + PasswordResetRequired bool `json:"password_reset_required"` + FailedLoginCount int `json:"failed_login_count"` + LockedUntil *time.Time `json:"locked_until"` + LastLoginAt *time.Time `json:"last_login_at"` + LastSeenAt *time.Time `json:"last_seen_at"` + Notes string `json:"notes"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + EnvironmentAdmin bool `json:"-"` +} + +type UserRole struct { + Slug string `json:"slug"` + Name string `json:"name"` + Description string `json:"description"` + SystemRole bool `json:"system_role"` + Active bool `json:"active"` + SortOrder int `json:"sort_order"` + UserCount int `json:"user_count"` + Permissions []Permission `json:"permissions"` +} + +type Permission struct { + Slug string `json:"slug"` + Name string `json:"name"` + Description string `json:"description"` + Category string `json:"category"` + SortOrder int `json:"sort_order"` + Granted bool `json:"granted"` +} + +type UserListResult struct { + Items []ManagedUser + Total int +} + +type userStore struct{ db *postgresStore } + +func newUserStore(db *postgresStore) *userStore { return &userStore{db: db} } +func (s *userStore) Enabled() bool { return s != nil && s.db != nil && s.db.Enabled() } + +func (s *userStore) List(ctx context.Context, group, search, role, status string, page, perPage int) (UserListResult, error) { + if !s.Enabled() { + return UserListResult{}, errors.New("PostgreSQL ist nicht konfiguriert") + } + if page < 1 { + page = 1 + } + if perPage != 10 && perPage != 20 && perPage != 50 { + perPage = 20 + } + where := []string{"u.deleted_at IS NULL"} + if group == "admins" { + where = append(where, "u.role IN ('administrator','editor','author','moderator')") + } else if group == "members" { + where = append(where, "u.role = 'member'") + } + if search = strings.TrimSpace(search); search != "" { + q := "%" + search + "%" + where = append(where, fmt.Sprintf("(u.email ILIKE %s OR u.username ILIKE %s OR u.display_name ILIKE %s)", sqlText(q), sqlText(q), sqlText(q))) + } + if role = strings.TrimSpace(role); role != "" { + where = append(where, "u.role="+sqlText(role)) + } + switch status { + case "active": + where = append(where, "u.active=true AND (u.locked_until IS NULL OR u.locked_until <= now())") + case "inactive": + where = append(where, "u.active=false") + case "locked": + where = append(where, "u.locked_until > now()") + case "unverified": + where = append(where, "u.email_verified=false") + } + whereSQL := strings.Join(where, " AND ") + offset := (page - 1) * perPage + query := fmt.Sprintf(`SELECT json_build_object( + 'total',(SELECT count(*) FROM users u WHERE %s), + 'items',COALESCE((SELECT json_agg(row_to_json(x)) FROM ( + SELECT u.id,u.username,u.email,u.display_name,u.first_name,u.last_name,u.phone,u.role, + COALESCE(r.name,u.role) role_name,u.active,u.email_verified,u.password_reset_required, + u.failed_login_count,u.locked_until,u.last_login_at,u.last_seen_at,u.notes,u.created_at,u.updated_at + FROM users u LEFT JOIN roles r ON r.slug=u.role + WHERE %s ORDER BY u.created_at DESC,u.id DESC LIMIT %d OFFSET %d + ) x),'[]'::json) +);`, whereSQL, whereSQL, perPage, offset) + var raw struct { + Total int `json:"total"` + Items []ManagedUser `json:"items"` + } + out, err := s.db.exec(ctx, query) + if err != nil { + return UserListResult{}, err + } + if err := json.Unmarshal([]byte(strings.TrimSpace(string(out))), &raw); err != nil { + return UserListResult{}, err + } + return UserListResult{Items: raw.Items, Total: raw.Total}, nil +} + +func (s *userStore) Get(ctx context.Context, id int64) (ManagedUser, error) { + var item ManagedUser + q := fmt.Sprintf(`SELECT row_to_json(x) FROM (SELECT u.id,u.username,u.email,u.display_name,u.first_name,u.last_name,u.phone,u.role,COALESCE(r.name,u.role) role_name,u.active,u.email_verified,u.password_reset_required,u.failed_login_count,u.locked_until,u.last_login_at,u.last_seen_at,u.notes,u.created_at,u.updated_at FROM users u LEFT JOIN roles r ON r.slug=u.role WHERE u.id=%d AND u.deleted_at IS NULL) x;`, id) + out, err := s.db.exec(ctx, q) + if err != nil { + return item, err + } + raw := strings.TrimSpace(string(out)) + if raw == "" { + return item, errors.New("Benutzer nicht gefunden") + } + return item, json.Unmarshal([]byte(raw), &item) +} + +func (s *userStore) protectLastAdministrator(ctx context.Context, id int64, remainsAdministrator bool) error { + if id <= 0 || remainsAdministrator { + return nil + } + q := fmt.Sprintf(`SELECT json_build_object('target_admin',COALESCE((SELECT role='administrator' AND active FROM users WHERE id=%d AND deleted_at IS NULL),false),'active_admins',(SELECT count(*) FROM users WHERE role='administrator' AND active=true AND deleted_at IS NULL));`, id) + out, err := s.db.exec(ctx, q) + if err != nil { + return err + } + var state struct { + TargetAdmin bool `json:"target_admin"` + ActiveAdmins int `json:"active_admins"` + } + if json.Unmarshal([]byte(strings.TrimSpace(string(out))), &state) != nil { + return nil + } + if state.TargetAdmin && state.ActiveAdmins <= 1 { + return errors.New("der letzte aktive Administrator kann nicht deaktiviert, gesperrt, gelöscht oder herabgestuft werden") + } + return nil +} + +func (s *userStore) Upsert(ctx context.Context, u ManagedUser, password string, actor string) error { + if !s.Enabled() { + return errors.New("PostgreSQL ist nicht konfiguriert") + } + u.Email = strings.ToLower(strings.TrimSpace(u.Email)) + u.Username = strings.TrimSpace(u.Username) + u.DisplayName = strings.TrimSpace(u.DisplayName) + u.FirstName = strings.TrimSpace(u.FirstName) + u.LastName = strings.TrimSpace(u.LastName) + if u.Email == "" || !strings.Contains(u.Email, "@") { + return errors.New("bitte eine gültige E-Mail-Adresse eingeben") + } + if u.Username == "" { + return errors.New("bitte einen Benutzernamen eingeben") + } + if u.DisplayName == "" { + u.DisplayName = strings.TrimSpace(u.FirstName + " " + u.LastName) + } + if u.DisplayName == "" { + return errors.New("bitte einen Anzeigenamen eingeben") + } + if u.Role == "" { + u.Role = "member" + } + if u.ID > 0 { + if err := s.protectLastAdministrator(ctx, u.ID, u.Role == "administrator" && u.Active); err != nil { + return err + } + } + var hash string + var err error + if password != "" { + hash, err = auth.HashPassword(password) + if err != nil { + return err + } + } + if u.ID == 0 && hash == "" { + return errors.New("für neue Benutzer ist ein Passwort erforderlich") + } + if u.ID == 0 { + q := fmt.Sprintf(`BEGIN; +INSERT INTO users(username,email,display_name,first_name,last_name,phone,password_hash,role,active,email_verified,password_reset_required,notes) +VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s); +INSERT INTO audit_events(action,entity_type,summary,success) VALUES('user.create','user',%s,true); +COMMIT;`, sqlText(u.Username), sqlText(u.Email), sqlText(u.DisplayName), sqlText(u.FirstName), sqlText(u.LastName), sqlText(u.Phone), sqlText(hash), sqlText(u.Role), sqlBool(u.Active), sqlBool(u.EmailVerified), sqlBool(u.PasswordResetRequired), sqlText(u.Notes), sqlText(actor+" hat Benutzer "+u.Email+" angelegt")) + _, err = s.db.exec(ctx, q) + return err + } + passwordSQL := "" + if hash != "" { + passwordSQL = ",password_hash=" + sqlText(hash) + ",password_reset_required=" + sqlBool(u.PasswordResetRequired) + } + q := fmt.Sprintf(`BEGIN; +UPDATE users SET username=%s,email=%s,display_name=%s,first_name=%s,last_name=%s,phone=%s,role=%s,active=%s,email_verified=%s,notes=%s%s,updated_at=now() WHERE id=%d AND deleted_at IS NULL; +INSERT INTO audit_events(action,entity_type,entity_id,summary,success) VALUES('user.update','user',%d,%s,true); +COMMIT;`, sqlText(u.Username), sqlText(u.Email), sqlText(u.DisplayName), sqlText(u.FirstName), sqlText(u.LastName), sqlText(u.Phone), sqlText(u.Role), sqlBool(u.Active), sqlBool(u.EmailVerified), sqlText(u.Notes), passwordSQL, u.ID, u.ID, sqlText(actor+" hat Benutzer "+u.Email+" aktualisiert")) + _, err = s.db.exec(ctx, q) + return err +} + +func (s *userStore) Action(ctx context.Context, id int64, action, actor string) error { + if id <= 0 { + return errors.New("ungültige Benutzer-ID") + } + if action == "deactivate" || action == "lock" || action == "delete" { + if err := s.protectLastAdministrator(ctx, id, false); err != nil { + return err + } + } + var statement, auditAction string + switch action { + case "activate": + statement = "UPDATE users SET active=true,locked_until=NULL,failed_login_count=0,updated_at=now() WHERE id=" + strconv.FormatInt(id, 10) + auditAction = "user.activate" + case "deactivate": + statement = "UPDATE users SET active=false,updated_at=now() WHERE id=" + strconv.FormatInt(id, 10) + auditAction = "user.deactivate" + case "lock": + statement = "UPDATE users SET locked_until=now()+interval '30 days',updated_at=now() WHERE id=" + strconv.FormatInt(id, 10) + auditAction = "user.lock" + case "unlock": + statement = "UPDATE users SET locked_until=NULL,failed_login_count=0,updated_at=now() WHERE id=" + strconv.FormatInt(id, 10) + auditAction = "user.unlock" + case "verify": + statement = "UPDATE users SET email_verified=true,updated_at=now() WHERE id=" + strconv.FormatInt(id, 10) + auditAction = "user.verify" + case "delete": + statement = "UPDATE users SET active=false,deleted_at=now(),email=email||'.deleted.'||id,username=username||'.deleted.'||id,updated_at=now() WHERE id=" + strconv.FormatInt(id, 10) + " AND deleted_at IS NULL" + auditAction = "user.delete" + default: + return errors.New("unbekannte Aktion") + } + q := fmt.Sprintf("BEGIN;%s;INSERT INTO audit_events(action,entity_type,entity_id,summary,success) VALUES(%s,'user',%d,%s,true);COMMIT;", statement, sqlText(auditAction), id, sqlText(actor+" führte "+action+" aus")) + _, err := s.db.exec(ctx, q) + return err +} + +func (s *userStore) ResetPassword(ctx context.Context, id int64, password, actor string) error { + hash, err := auth.HashPassword(password) + if err != nil { + return err + } + q := fmt.Sprintf("BEGIN;UPDATE users SET password_hash=%s,password_reset_required=true,failed_login_count=0,locked_until=NULL,updated_at=now() WHERE id=%d AND deleted_at IS NULL;DELETE FROM admin_sessions WHERE user_id=%d;INSERT INTO audit_events(action,entity_type,entity_id,summary,success) VALUES('user.password_reset','user',%d,%s,true);COMMIT;", sqlText(hash), id, id, id, sqlText(actor+" hat das Passwort zurückgesetzt")) + _, err = s.db.exec(ctx, q) + return err +} + +func (s *userStore) Roles(ctx context.Context) ([]UserRole, error) { + q := `SELECT COALESCE(json_agg(row_to_json(x)),'[]'::json) FROM ( +SELECT r.slug,r.name,r.description,r.system_role,r.active,r.sort_order, + (SELECT count(*)::int FROM users u WHERE u.role=r.slug AND u.deleted_at IS NULL) user_count, + COALESCE((SELECT json_agg(row_to_json(p)) FROM ( + SELECT pe.slug,pe.name,pe.description,pe.category,pe.sort_order,(rp.permission_slug IS NOT NULL) granted + FROM permissions pe LEFT JOIN role_permissions rp ON rp.permission_slug=pe.slug AND rp.role_slug=r.slug + ORDER BY pe.category,pe.sort_order,pe.name + ) p),'[]'::json) permissions +FROM roles r ORDER BY r.sort_order,r.name) x;` + out, err := s.db.exec(ctx, q) + if err != nil { + return nil, err + } + var roles []UserRole + err = json.Unmarshal([]byte(strings.TrimSpace(string(out))), &roles) + return roles, err +} + +func (s *userStore) SaveRole(ctx context.Context, role UserRole, permissions []string, actor string) error { + role.Slug = strings.ToLower(slugify(role.Slug)) + role.Name = strings.TrimSpace(role.Name) + if role.Slug == "" || role.Name == "" { + return errors.New("Rollenname und Slug sind erforderlich") + } + vals := make([]string, 0, len(permissions)) + for _, p := range permissions { + p = strings.TrimSpace(p) + if p != "" { + vals = append(vals, "("+sqlText(role.Slug)+","+sqlText(p)+")") + } + } + insertPerm := "" + if len(vals) > 0 { + insertPerm = "INSERT INTO role_permissions(role_slug,permission_slug) VALUES" + strings.Join(vals, ",") + " ON CONFLICT DO NOTHING;" + } + q := fmt.Sprintf(`BEGIN; +INSERT INTO roles(slug,name,description,system_role,active,sort_order) VALUES(%s,%s,%s,false,%s,%d) +ON CONFLICT(slug) DO UPDATE SET name=EXCLUDED.name,description=EXCLUDED.description,active=EXCLUDED.active,sort_order=EXCLUDED.sort_order,updated_at=now(); +DELETE FROM role_permissions WHERE role_slug=%s; +%s +INSERT INTO audit_events(action,entity_type,summary,success) VALUES('role.update','role',%s,true); +COMMIT;`, sqlText(role.Slug), sqlText(role.Name), sqlText(role.Description), sqlBool(role.Active), role.SortOrder, sqlText(role.Slug), insertPerm, sqlText(actor+" hat Rolle "+role.Name+" aktualisiert")) + _, err := s.db.exec(ctx, q) + return err +} + +type AuthenticatedUser struct { + ID int64 + Username string + DisplayName string + Role string + Permissions map[string]bool +} + +func (s *userStore) Authenticate(ctx context.Context, login, password string) (AuthenticatedUser, bool) { + var result AuthenticatedUser + if !s.Enabled() { + return result, false + } + login = strings.TrimSpace(strings.ToLower(login)) + q := fmt.Sprintf(`SELECT row_to_json(x) FROM ( +SELECT u.id,u.username,u.display_name,u.password_hash,u.role,u.active,u.locked_until, + COALESCE((SELECT json_agg(rp.permission_slug) FROM role_permissions rp WHERE rp.role_slug=u.role),'[]'::json) permissions +FROM users u WHERE u.deleted_at IS NULL AND (lower(u.username)=%s OR lower(u.email)=%s) LIMIT 1) x;`, sqlText(login), sqlText(login)) + out, err := s.db.exec(ctx, q) + if err != nil { + return result, false + } + raw := strings.TrimSpace(string(out)) + if raw == "" { + return result, false + } + var row struct { + ID int64 `json:"id"` + Username string `json:"username"` + DisplayName string `json:"display_name"` + PasswordHash string `json:"password_hash"` + Role string `json:"role"` + Active bool `json:"active"` + LockedUntil *time.Time `json:"locked_until"` + Permissions []string `json:"permissions"` + } + if json.Unmarshal([]byte(raw), &row) != nil { + return result, false + } + if !row.Active || (row.LockedUntil != nil && row.LockedUntil.After(time.Now())) || !auth.VerifyPassword(row.PasswordHash, password) { + _, _ = s.db.exec(ctx, fmt.Sprintf("UPDATE users SET failed_login_count=failed_login_count+1,locked_until=CASE WHEN failed_login_count+1>=5 THEN now()+interval '15 minutes' ELSE locked_until END,updated_at=now() WHERE id=%d;", row.ID)) + return result, false + } + permissions := map[string]bool{} + for _, p := range row.Permissions { + permissions[p] = true + } + _, _ = s.db.exec(ctx, fmt.Sprintf("UPDATE users SET failed_login_count=0,locked_until=NULL,last_login_at=now(),last_seen_at=now(),updated_at=now() WHERE id=%d;", row.ID)) + return AuthenticatedUser{ID: row.ID, Username: row.Username, DisplayName: row.DisplayName, Role: row.Role, Permissions: permissions}, true +} diff --git a/v1550_regression_test.go b/v1550_regression_test.go new file mode 100644 index 0000000..a866bbc --- /dev/null +++ b/v1550_regression_test.go @@ -0,0 +1,97 @@ +package main + +import ( + "bytes" + "html/template" + "os" + "strings" + "testing" + "time" +) + +func TestHomeProgramHighlightsCanReturnFiveRows(t *testing.T) { + now := time.Date(2026, 8, 28, 14, 0, 0, 0, time.Local) + store := &programStore{items: []ProgramItem{ + {ID: "a", Weekday: -1, Start: "00:00", End: "05:00", Show: "Nacht", Active: true}, + {ID: "b", Weekday: -1, Start: "05:00", End: "10:00", Show: "Moin", Active: true}, + {ID: "c", Weekday: -1, Start: "10:00", End: "15:00", Show: "Tag", Active: true}, + {ID: "d", Weekday: -1, Start: "15:00", End: "20:00", Show: "Land", Active: true}, + {ID: "e", Weekday: -1, Start: "20:00", End: "00:00", Show: "Abend", Active: true}, + }} + got := store.Highlights(now, 5) + if len(got) != 5 { + t.Fatalf("expected 5 program highlights, got %d", len(got)) + } + if got[4].Start != "20:00" || got[4].End != "00:00" { + t.Fatalf("expected evening block 20:00-00:00, got %#v", got[4]) + } +} + +func TestAboutLandwelleIsManagedContentPage(t *testing.T) { + if normalizePublicPageKey("ueber-landwelle") != "ueber-landwelle" { + t.Fatal("ueber-landwelle is not enabled as managed page key") + } + page := fallbackManagedPage("ueber-landwelle") + if page.Title != "Über Landwelle" || len(page.Blocks) < 3 { + t.Fatalf("unexpected managed about fallback: %#v", page) + } + if adminContentKey("/admin/ueber-landwelle") != "ueber-landwelle" { + t.Fatal("admin route does not map to managed about page") + } +} + +func TestDirectoryTemplateOffersPartnershipAndDetailModal(t *testing.T) { + tpl, err := template.New("landwelle").Funcs(template.FuncMap{ + "year": func() int { return 2026 }, + "seoHead": seoHead, + "playlistURL": playlistPageURL, + "publicNavigation": func() template.HTML { return navigationHTML(defaultNavigationItems()) }, + "urlquery": func(v any) string { return template.URLQueryEscaper(v) }, + }).ParseFS(webFS, "web/partials.html", "web/directory.html") + if err != nil { + t.Fatal(err) + } + data := DirectoryPageData{ + PageData: PageData{}, Categories: directoryCategories(), RequestToken: strings.Repeat("x", 24), + Entries: []DirectoryEntry{{ID: 1, Name: "Musterbetrieb", Category: "Handel & Dienstleistungen", Description: "Vollständige Beschreibung", City: "Visselhövede", Email: "mail@example.de", PartnershipInterest: true}}, + } + var out bytes.Buffer + if err := tpl.ExecuteTemplate(&out, "directory.html", data); err != nil { + t.Fatal(err) + } + html := out.String() + for _, want := range []string{"Interesse an einer Partnerschaft mit Landwelle?", "data-directory-detail-modal", "data-directory-detail", "Alles ansehen"} { + if !strings.Contains(html, want) { + t.Fatalf("directory output missing %q", want) + } + } +} + +func TestDirectoryAdminTemplateShowsPartnershipInterest(t *testing.T) { + tpl, err := parseAdminTemplate("web/admin/directory.html") + if err != nil { + t.Fatal(err) + } + data := adminDirectoryData{Username: "admin", CSRFToken: "token", Categories: directoryCategories(), StatusFilter: "pending", DatabaseReady: true, + Items: []DirectoryEntry{{ID: 1, Name: "Musterbetrieb", Category: "Handel & Dienstleistungen", Description: "Text", City: "Visselhövede", ContactName: "Jens", Email: "mail@example.de", Status: "pending", CreatedAt: time.Now(), PartnershipInterest: true}}} + var out bytes.Buffer + if err := tpl.ExecuteTemplate(&out, "directory-admin.html", data); err != nil { + t.Fatal(err) + } + if !strings.Contains(out.String(), "partnership_interest") || !strings.Contains(out.String(), "checked") { + t.Fatal("partnership interest is not visible/editable in directory admin") + } +} + +func TestMigration0044SeedsAboutAndPartnership(t *testing.T) { + raw, err := os.ReadFile("migrations/0044_about_directory_partnership.sql") + if err != nil { + t.Fatal(err) + } + text := string(raw) + for _, want := range []string{"ueber-landwelle", "partnership_interest", "directory_partnership_admin"} { + if !strings.Contains(text, want) { + t.Fatalf("migration 0044 missing %q", want) + } + } +} diff --git a/v1551_regression_test.go b/v1551_regression_test.go new file mode 100644 index 0000000..ea8919b --- /dev/null +++ b/v1551_regression_test.go @@ -0,0 +1,64 @@ +package main + +import ( + "os" + "path/filepath" + "strings" + "testing" + "time" +) + +func TestWishDateTokenUsesBerlinCalendarDate(t *testing.T) { + // 22:30 UTC on Dec 31 is 23:30 CET; 23:30 UTC is Jan 1 CET. + now := time.Date(2026, 12, 31, 23, 30, 0, 0, time.UTC) + if got := wishDateToken(now); got != "2027-01-01" { + t.Fatalf("unexpected Berlin date token %q", got) + } +} + +func TestWishOutputFilenameSupportsDatumToken(t *testing.T) { + wish := ListenerWish{ID: "abc-123", Name: "Jens"} + now := time.Date(2026, 8, 28, 12, 0, 0, 0, time.UTC) + got := wishOutputFilenameAt("musikwunsch-{{datum}}-{{id}}.mp3", wish, now) + if got != "musikwunsch-2026-08-28-abc-123.mp3" { + t.Fatalf("unexpected dated filename %q", got) + } +} + +func TestAudioWishesAdminDocumentsDatumToken(t *testing.T) { + raw, err := os.ReadFile(filepath.Join("web", "admin", "ai-wishes.html")) + if err != nil { + t.Fatal(err) + } + text := string(raw) + if strings.Count(text, `{{"{{datum}}"}}`) < 2 { + t.Fatal("{{datum}} must be documented for prompt and filename pattern") + } + if !strings.Contains(text, "Jahr-Monat-Tag") { + t.Fatal("datum format hint missing") + } +} + +func TestHomeCurrentProgramUsesDynamicPresenterImage(t *testing.T) { + html, err := os.ReadFile(filepath.Join("web", "index.html")) + if err != nil { + t.Fatal(err) + } + page := string(html) + if !strings.Contains(page, "data-current-program-image") { + t.Fatal("homepage current-program presenter image hook missing") + } + if strings.Contains(page, `/assets/host-jan-v14.jpg`) { + t.Fatal("homepage still hardcodes Jan as current presenter image") + } + js, err := os.ReadFile(filepath.Join("web", "assets", "app-v18.js")) + if err != nil { + t.Fatal(err) + } + script := string(js) + for _, want := range []string{"[data-current-program-image]", "program.image_url", "/api/v1/program/current"} { + if !strings.Contains(script, want) { + t.Fatalf("public app JS missing %q", want) + } + } +} diff --git a/v1552_landwelle_vor_ort_test.go b/v1552_landwelle_vor_ort_test.go new file mode 100644 index 0000000..d7841de --- /dev/null +++ b/v1552_landwelle_vor_ort_test.go @@ -0,0 +1,161 @@ +package main + +import ( + "bytes" + "html/template" + "os" + "strings" + "testing" + "time" +) + +func TestDefaultNavigationContainsLandwelleVorOrtUnderUnserNorden(t *testing.T) { + items := defaultNavigationItems() + for _, item := range items { + if item.Label != "Unser Norden" { + continue + } + for _, child := range item.Children { + if child.Label == "Landwelle vor Ort" && child.URL == "/landwelle-vor-ort" && child.Active { + return + } + } + t.Fatal("Unser Norden enthält keinen aktiven Menüpunkt Landwelle vor Ort") + } + t.Fatal("Hauptnavigation enthält Unser Norden nicht") +} + +func TestLandwelleVorOrtOverviewTemplateListsPublishedEntries(t *testing.T) { + funcs := template.FuncMap{ + "seoHead": func(...any) template.HTML { return "" }, + "publicNavigation": func() template.HTML { return navigationHTML(defaultNavigationItems()) }, + "year": func() int { return 2026 }, + } + tmpl, err := template.New("root").Funcs(funcs).ParseFS(webFS, "web/partials.html", "web/landwelle-vor-ort.html") + if err != nil { + t.Fatal(err) + } + data := editorialStoriesPageData{Entries: []EditorialEntry{{ + Title: "Landwelle besucht den Norden", Slug: "landwelle-besucht-den-norden", ContentType: "traditionen", ContentTypeLabel: "Traditionen", HomepageSection: true, Teaser: "Ein Beitrag vor Ort.", Location: "Visselhövede", PublishedAt: time.Date(2026, 8, 28, 12, 0, 0, 0, time.UTC), + }}} + var out bytes.Buffer + if err := tmpl.ExecuteTemplate(&out, "landwelle-vor-ort.html", data); err != nil { + t.Fatal(err) + } + html := out.String() + for _, want := range []string{"Landwelle vor Ort", "Alle Beiträge", "/landwelle-vor-ort/traditionen/landwelle-besucht-den-norden", "Visselhövede", "Landwelle besucht den Norden"} { + if !strings.Contains(html, want) { + t.Fatalf("Übersicht enthält %q nicht", want) + } + } +} + +func TestLandwelleVorOrtNavigationMigration(t *testing.T) { + body, err := os.ReadFile("migrations/0045_landwelle_vor_ort_public_index.sql") + if err != nil { + t.Fatal(err) + } + s := string(body) + for _, want := range []string{"Unser Norden", "Landwelle vor Ort", "/landwelle-vor-ort", "navigation_items"} { + if !strings.Contains(s, want) { + t.Fatalf("Migration enthält %q nicht", want) + } + } +} + +func TestProductionPublicTemplateSetContainsLandwelleVorOrt(t *testing.T) { + want := "web/landwelle-vor-ort.html" + found := false + for _, file := range publicTemplateFiles { + if file == want { + found = true + break + } + } + if !found { + t.Fatalf("produktives öffentliches Template-Set enthält %s nicht", want) + } + + funcs := template.FuncMap{ + "seoHead": seoHead, + "publicNavigation": func() template.HTML { return navigationHTML(defaultNavigationItems()) }, + "year": func() int { return 2026 }, + "playlistURL": playlistPageURL, + "paragraphs": managedParagraphs, + "seq": func(a, b int) []int { + out := make([]int, 0, b-a+1) + for i := a; i <= b; i++ { + out = append(out, i) + } + return out + }, + } + tmpl, err := template.New("production-public").Funcs(funcs).ParseFS(webFS, publicTemplateFiles...) + if err != nil { + t.Fatalf("produktives öffentliches Template-Set kann nicht geladen werden: %v", err) + } + if tmpl.Lookup("landwelle-vor-ort.html") == nil { + t.Fatal("landwelle-vor-ort.html ist nach ParseFS im produktiven Template-Set nicht verfügbar") + } +} + +func TestLandwelleVorOrtOverviewQueryHasNoArtificialLimit(t *testing.T) { + allQuery := homepageStoriesQuery(0) + if strings.Contains(strings.ToUpper(allQuery), " LIMIT ") { + t.Fatalf("Übersichtsabfrage darf kein LIMIT enthalten: %s", allQuery) + } + + homeQuery := homepageStoriesQuery(3) + if !strings.Contains(strings.ToUpper(homeQuery), " LIMIT 3") { + t.Fatalf("Startseitenabfrage soll weiterhin auf drei Beiträge begrenzt sein: %s", homeQuery) + } +} + +func TestLandwelleVorOrtUsesCategoryHierarchy(t *testing.T) { + entry := EditorialEntry{ContentType: "traditionen", ContentTypeLabel: "Traditionen", Slug: "bauernmarkt", HomepageSection: true} + if got, want := entry.PublicPath(), "/landwelle-vor-ort/traditionen/bauernmarkt"; got != want { + t.Fatalf("PublicPath = %q, want %q", got, want) + } + if got, want := entry.CategoryPath(), "/landwelle-vor-ort/traditionen"; got != want { + t.Fatalf("CategoryPath = %q, want %q", got, want) + } +} + +func TestLandwelleVorOrtCategoryQueryFiltersWithoutLimit(t *testing.T) { + q := homepageStoriesByCategoryQuery("traditionen") + upper := strings.ToUpper(q) + if strings.Contains(upper, " LIMIT ") { + t.Fatalf("Kategorieabfrage darf kein LIMIT enthalten: %s", q) + } + if !strings.Contains(q, "e.content_type='traditionen'") { + t.Fatalf("Kategorieabfrage filtert nicht nach content_type: %s", q) + } +} + +func TestLandwelleVorOrtCategoryNavigationTemplate(t *testing.T) { + funcs := template.FuncMap{ + "seoHead": func(...any) template.HTML { return "" }, + "publicNavigation": func() template.HTML { return navigationHTML(defaultNavigationItems()) }, + "year": func() int { return 2026 }, + } + tmpl, err := template.New("root").Funcs(funcs).ParseFS(webFS, "web/partials.html", "web/landwelle-vor-ort.html") + if err != nil { + t.Fatal(err) + } + category := EditorialContentType{Slug: "traditionen", Name: "Traditionen", HomepageSection: true, Active: true} + data := editorialStoriesPageData{ + Categories: []EditorialContentType{category}, ActiveCategory: category, HasActiveCategory: true, + PageTitle: "Landwelle vor Ort: Traditionen", MetaDescription: "Traditionen aus dem Norden", CanonicalPath: "/landwelle-vor-ort/traditionen", SectionTitle: "Traditionen", + Entries: []EditorialEntry{{Title: "Bauernmarkt", Slug: "bauernmarkt", ContentType: "traditionen", ContentTypeLabel: "Traditionen", HomepageSection: true, PublishedAt: time.Date(2026, 9, 1, 12, 0, 0, 0, time.UTC)}}, + } + var out bytes.Buffer + if err := tmpl.ExecuteTemplate(&out, "landwelle-vor-ort.html", data); err != nil { + t.Fatal(err) + } + html := out.String() + for _, want := range []string{"/landwelle-vor-ort/traditionen", "/landwelle-vor-ort/traditionen/bauernmarkt", "Traditionen"} { + if !strings.Contains(html, want) { + t.Fatalf("Kategorieansicht enthält %q nicht", want) + } + } +} diff --git a/v1553_wish_post_without_audio_test.go b/v1553_wish_post_without_audio_test.go new file mode 100644 index 0000000..ded0e36 --- /dev/null +++ b/v1553_wish_post_without_audio_test.go @@ -0,0 +1,47 @@ +package main + +import ( + "os" + "strings" + "testing" +) + +func TestAdminWishesOffersPostWithoutAudio(t *testing.T) { + raw, err := os.ReadFile("web/admin/wishes.html") + if err != nil { + t.Fatal(err) + } + body := string(raw) + for _, want := range []string{`value="post_without_audio"`, `Nur posten – ohne MP3`, `ohne KI-Text, ElevenLabs, MP3 oder FTP-Produktion`} { + if !strings.Contains(body, want) { + t.Fatalf("wishes admin template missing %q", want) + } + } +} + +func TestPostWithoutAudioBypassesWishAutomation(t *testing.T) { + raw, err := os.ReadFile("admin.go") + if err != nil { + t.Fatal(err) + } + src := string(raw) + start := strings.Index(src, `case "post_without_audio":`) + if start < 0 { + t.Fatal("post_without_audio handler block missing") + } + end := strings.Index(src[start:], `case "approve", "status":`) + if end < 0 { + t.Fatal("post_without_audio handler end missing") + } + block := src[start : start+end] + for _, want := range []string{`a.wishes.Update(wish)`, `a.wishes.Moderate(id, "approved", wish.EditorialNote)`, `redirect+"&posted=1"`} { + if !strings.Contains(block, want) { + t.Fatalf("post_without_audio handler missing %q", want) + } + } + for _, forbidden := range []string{`.Process(`, `.ProcessManual(`, `GenerateSpeech`, `UploadFTP`} { + if strings.Contains(block, forbidden) { + t.Fatalf("post_without_audio unexpectedly invokes production path %q", forbidden) + } + } +} diff --git a/weather.go b/weather.go new file mode 100644 index 0000000..87523bf --- /dev/null +++ b/weather.go @@ -0,0 +1,328 @@ +package main + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "math" + "net/http" + "net/url" + "strconv" + "strings" + "sync" + "time" +) + +const defaultWeatherAPI = "https://api.open-meteo.com/v1/forecast" + +type WeatherService struct { + client *http.Client + endpoint string + location string + latitude float64 + longitude float64 + cacheTTL time.Duration + + mu sync.RWMutex + refreshMu sync.Mutex + cached WeatherSnapshot + cachedAt time.Time +} + +type WeatherSnapshot struct { + Location string `json:"location"` + Latitude float64 `json:"latitude"` + Longitude float64 `json:"longitude"` + Current WeatherCurrent `json:"current"` + Forecast []WeatherDay `json:"forecast"` + Source string `json:"source"` + SourceURL string `json:"source_url"` + FetchedAt time.Time `json:"fetched_at"` + Stale bool `json:"stale"` +} + +type WeatherCurrent struct { + Temperature float64 `json:"temperature"` + ApparentTemperature float64 `json:"apparent_temperature"` + Humidity int `json:"humidity"` + WeatherCode int `json:"weather_code"` + Description string `json:"description"` + Icon string `json:"icon"` + WindSpeed float64 `json:"wind_speed"` + WindDirection int `json:"wind_direction_degrees"` + WindDirectionText string `json:"wind_direction"` + Precipitation float64 `json:"precipitation"` + RainProbability int `json:"rain_probability"` + UVIndex float64 `json:"uv_index"` + ObservedAt string `json:"observed_at"` +} + +type WeatherDay struct { + Date string `json:"date"` + Weekday string `json:"weekday"` + WeatherCode int `json:"weather_code"` + Description string `json:"description"` + Icon string `json:"icon"` + TemperatureMax float64 `json:"temperature_max"` + TemperatureMin float64 `json:"temperature_min"` + RainProbability int `json:"rain_probability"` + UVIndex float64 `json:"uv_index"` +} + +type openMeteoResponse struct { + Latitude float64 `json:"latitude"` + Longitude float64 `json:"longitude"` + Timezone string `json:"timezone"` + Current struct { + Time string `json:"time"` + Temperature float64 `json:"temperature_2m"` + ApparentTemperature float64 `json:"apparent_temperature"` + Humidity int `json:"relative_humidity_2m"` + WeatherCode int `json:"weather_code"` + WindSpeed float64 `json:"wind_speed_10m"` + WindDirection int `json:"wind_direction_10m"` + Precipitation float64 `json:"precipitation"` + } `json:"current"` + Daily struct { + Time []string `json:"time"` + WeatherCode []int `json:"weather_code"` + TemperatureMax []float64 `json:"temperature_2m_max"` + TemperatureMin []float64 `json:"temperature_2m_min"` + RainProbability []int `json:"precipitation_probability_max"` + UVIndex []float64 `json:"uv_index_max"` + } `json:"daily"` +} + +func NewWeatherService() *WeatherService { + return &WeatherService{ + client: &http.Client{Timeout: envDuration("LANDWELLE_WEATHER_TIMEOUT", 7*time.Second)}, + endpoint: envOr("LANDWELLE_WEATHER_API_URL", defaultWeatherAPI), + location: envOr("LANDWELLE_WEATHER_LOCATION", "Visselhövede"), + latitude: envFloat("LANDWELLE_WEATHER_LATITUDE", 52.9847), + longitude: envFloat("LANDWELLE_WEATHER_LONGITUDE", 9.5782), + cacheTTL: envDuration("LANDWELLE_WEATHER_CACHE_TTL", 10*time.Minute), + } +} + +func (s *WeatherService) Get(ctx context.Context, force bool) (WeatherSnapshot, error) { + now := time.Now() + s.mu.RLock() + cached := s.cached + cachedAt := s.cachedAt + s.mu.RUnlock() + + if !force && !cachedAt.IsZero() && now.Sub(cachedAt) < s.cacheTTL { + return cached, nil + } + + s.refreshMu.Lock() + defer s.refreshMu.Unlock() + + // A concurrent request may already have refreshed the cache while this + // request was waiting for the refresh lock. + s.mu.RLock() + cached = s.cached + cachedAt = s.cachedAt + s.mu.RUnlock() + now = time.Now() + if !force && !cachedAt.IsZero() && now.Sub(cachedAt) < s.cacheTTL { + return cached, nil + } + + fresh, err := s.fetch(ctx) + if err != nil { + if !cachedAt.IsZero() { + cached.Stale = true + return cached, nil + } + return WeatherSnapshot{}, err + } + + s.mu.Lock() + s.cached = fresh + s.cachedAt = now + s.mu.Unlock() + return fresh, nil +} + +func (s *WeatherService) fetch(ctx context.Context) (WeatherSnapshot, error) { + endpoint, err := url.Parse(s.endpoint) + if err != nil { + return WeatherSnapshot{}, fmt.Errorf("Wetter-API-URL: %w", err) + } + query := endpoint.Query() + query.Set("latitude", strconv.FormatFloat(s.latitude, 'f', 4, 64)) + query.Set("longitude", strconv.FormatFloat(s.longitude, 'f', 4, 64)) + query.Set("current", "temperature_2m,apparent_temperature,relative_humidity_2m,weather_code,wind_speed_10m,wind_direction_10m,precipitation") + query.Set("daily", "weather_code,temperature_2m_max,temperature_2m_min,precipitation_probability_max,uv_index_max") + query.Set("timezone", "Europe/Berlin") + query.Set("forecast_days", "4") + endpoint.RawQuery = query.Encode() + + req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil) + if err != nil { + return WeatherSnapshot{}, err + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", "LandwelleRadio/1.0 (+https://landwelle.de)") + + resp, err := s.client.Do(req) + if err != nil { + return WeatherSnapshot{}, fmt.Errorf("Wetterdaten abrufen: %w", err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return WeatherSnapshot{}, fmt.Errorf("Wetter-API antwortet mit HTTP %d", resp.StatusCode) + } + + var raw openMeteoResponse + decoder := json.NewDecoder(io.LimitReader(resp.Body, 1<<20)) + if err := decoder.Decode(&raw); err != nil { + return WeatherSnapshot{}, fmt.Errorf("Wetterdaten lesen: %w", err) + } + if len(raw.Daily.Time) == 0 { + return WeatherSnapshot{}, errors.New("Wetter-API lieferte keine Vorhersage") + } + + description, icon := describeWeather(raw.Current.WeatherCode) + current := WeatherCurrent{ + Temperature: round1(raw.Current.Temperature), + ApparentTemperature: round1(raw.Current.ApparentTemperature), + Humidity: raw.Current.Humidity, + WeatherCode: raw.Current.WeatherCode, + Description: description, + Icon: icon, + WindSpeed: round1(raw.Current.WindSpeed), + WindDirection: raw.Current.WindDirection, + WindDirectionText: compassDirection(raw.Current.WindDirection), + Precipitation: round1(raw.Current.Precipitation), + ObservedAt: raw.Current.Time, + } + if len(raw.Daily.RainProbability) > 0 { + current.RainProbability = raw.Daily.RainProbability[0] + } + if len(raw.Daily.UVIndex) > 0 { + current.UVIndex = round1(raw.Daily.UVIndex[0]) + } + + forecast := make([]WeatherDay, 0, minInt(4, len(raw.Daily.Time))) + for i := 0; i < len(raw.Daily.Time) && i < 4; i++ { + code := intAt(raw.Daily.WeatherCode, i) + desc, dayIcon := describeWeather(code) + forecast = append(forecast, WeatherDay{ + Date: raw.Daily.Time[i], + Weekday: germanWeekday(raw.Daily.Time[i]), + WeatherCode: code, + Description: desc, + Icon: dayIcon, + TemperatureMax: round1(floatAt(raw.Daily.TemperatureMax, i)), + TemperatureMin: round1(floatAt(raw.Daily.TemperatureMin, i)), + RainProbability: intAt(raw.Daily.RainProbability, i), + UVIndex: round1(floatAt(raw.Daily.UVIndex, i)), + }) + } + + return WeatherSnapshot{ + Location: s.location, + Latitude: s.latitude, + Longitude: s.longitude, + Current: current, + Forecast: forecast, + Source: "Open-Meteo", + SourceURL: "https://open-meteo.com/", + FetchedAt: time.Now().UTC(), + }, nil +} + +func describeWeather(code int) (string, string) { + switch { + case code == 0: + return "klar", "☀️" + case code == 1: + return "überwiegend klar", "🌤️" + case code == 2: + return "teilweise bewölkt", "⛅" + case code == 3: + return "bewölkt", "☁️" + case code == 45 || code == 48: + return "neblig", "🌫️" + case code >= 51 && code <= 57: + return "Nieselregen", "🌦️" + case code >= 61 && code <= 67: + return "Regen", "🌧️" + case code >= 71 && code <= 77: + return "Schneefall", "🌨️" + case code >= 80 && code <= 82: + return "Regenschauer", "🌦️" + case code == 85 || code == 86: + return "Schneeschauer", "🌨️" + case code >= 95: + return "Gewitter", "⛈️" + default: + return "wechselhaft", "🌤️" + } +} + +func compassDirection(degrees int) string { + directions := []string{"N", "NO", "O", "SO", "S", "SW", "W", "NW"} + index := int(math.Round(float64((degrees%360+360)%360)/45.0)) % len(directions) + return directions[index] +} + +func germanWeekday(date string) string { + parsed, err := time.Parse("2006-01-02", date) + if err != nil { + return "–" + } + weekdays := []string{"SO", "MO", "DI", "MI", "DO", "FR", "SA"} + return weekdays[parsed.Weekday()] +} + +func round1(value float64) float64 { return math.Round(value*10) / 10 } + +func intAt(values []int, index int) int { + if index < 0 || index >= len(values) { + return 0 + } + return values[index] +} + +func floatAt(values []float64, index int) float64 { + if index < 0 || index >= len(values) { + return 0 + } + return values[index] +} + +func minInt(a, b int) int { + if a < b { + return a + } + return b +} + +func envFloat(key string, fallback float64) float64 { + value := strings.TrimSpace(envOr(key, "")) + if value == "" { + return fallback + } + parsed, err := strconv.ParseFloat(value, 64) + if err != nil { + return fallback + } + return parsed +} + +func envDuration(key string, fallback time.Duration) time.Duration { + value := strings.TrimSpace(envOr(key, "")) + if value == "" { + return fallback + } + parsed, err := time.ParseDuration(value) + if err != nil { + return fallback + } + return parsed +} diff --git a/weather_test.go b/weather_test.go new file mode 100644 index 0000000..69c4918 --- /dev/null +++ b/weather_test.go @@ -0,0 +1,40 @@ +package main + +import ( + "context" + "net/http" + "net/http/httptest" + "testing" + "time" +) + +func TestWeatherServiceFetchesAndNormalizes(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + _, _ = w.Write([]byte(`{ + "latitude":52.9847,"longitude":9.5782,"timezone":"Europe/Berlin", + "current":{"time":"2026-07-15T12:00","temperature_2m":22.4,"apparent_temperature":23.1,"relative_humidity_2m":62,"weather_code":2,"wind_speed_10m":13.7,"wind_direction_10m":310,"precipitation":0}, + "daily":{"time":["2026-07-15","2026-07-16"],"weather_code":[2,61],"temperature_2m_max":[23.4,19.2],"temperature_2m_min":[13.1,11.8],"precipitation_probability_max":[20,70],"uv_index_max":[5.2,2.0]} + }`)) + })) + defer server.Close() + + t.Setenv("LANDWELLE_WEATHER_API_URL", server.URL) + service := NewWeatherService() + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + + weather, err := service.Get(ctx, false) + if err != nil { + t.Fatalf("Get: %v", err) + } + if weather.Location != "Visselhövede" { + t.Fatalf("unexpected location: %q", weather.Location) + } + if weather.Current.WindDirectionText != "NW" { + t.Fatalf("expected NW, got %q", weather.Current.WindDirectionText) + } + if len(weather.Forecast) != 2 || weather.Forecast[1].Description != "Regen" { + t.Fatalf("unexpected forecast: %#v", weather.Forecast) + } +} diff --git a/web/404.html b/web/404.html new file mode 100644 index 0000000..d2ea136 --- /dev/null +++ b/web/404.html @@ -0,0 +1,45 @@ +{{define "404.html"}} + + + + + + + + Seite nicht gefunden – Landwelle Radio + + + + + + +{{template "public_header" .}} +
+
+
+
+ Falsche Frequenz +
404
+

Diese Seite sendet gerade nicht.

+

Der aufgerufene Inhalt wurde verschoben, entfernt oder die Adresse ist nicht korrekt. Über die Startseite oder den Livestream bist du sofort wieder bei Landwelle.

+ +
+ +
+
+
+{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/admin/ai-audio-module.html b/web/admin/ai-audio-module.html new file mode 100644 index 0000000..aabb100 --- /dev/null +++ b/web/admin/ai-audio-module.html @@ -0,0 +1,15 @@ +{{define "ai-audio-module-admin.html"}}{{.Module.Title}} – Landwelle Verwaltung +
KI & Automatisierung{{.Module.Title}}
{{printf "%.1s" .Username}}{{.Username}}
+
+
{{.Module.Icon}}
{{.Module.Group}}

{{.Module.Title}}

{{.Module.Description}}

ElevenLabsFTP
+{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} +
+
+
Sprechtext

Text für die MP3

Der gespeicherte Text wird beim Produzieren unverändert an ElevenLabs übergeben. Hier findet keine zusätzliche automatische Textumschreibung statt.

SpeicherungText und Audioeinstellungen werden dauerhaft für {{.Module.Title}} gespeichert und stehen beim nächsten Aufruf wieder bereit.
+
Audio

Stimme & Musikbett

Ein Musikbett wird mit ffmpeg unter Verwendung dieser Pegel in die Sprach-MP3 gemischt.
+
Ausgabe

FTP-Ziel

Nach erfolgreichem Upload werden die lokal erzeugten MP3-Arbeitsdateien automatisch gelöscht.

Zieldatei{{.Config.RemoteDirectory}}/{{.Config.FileName}}

FTP-Server, Benutzername und Kennwort werden zentral unter SMTP & FTP verwaltet.

+
+
Produktion

{{.Module.Title}} erzeugen

Speichere nur die Einstellungen oder starte direkt die komplette Kette aus ElevenLabs, optionalem Musikbett und FTP-Upload.

+
+
Live-Produktion

{{.Module.Title}} wird erstellt

Die Produktion läuft serverseitig weiter, auch wenn du dieses Fenster schließt.

+
{{end}} diff --git a/web/admin/ai-module.html b/web/admin/ai-module.html new file mode 100644 index 0000000..fccb02b --- /dev/null +++ b/web/admin/ai-module.html @@ -0,0 +1 @@ +{{define "ai-module-admin.html"}}{{.Title}} – Landwelle Verwaltung
KI & Audio{{.Title}}
{{printf "%.1s" .Username}}{{.Username}}
{{.Icon}}
{{.Kicker}}

{{.Title}}

{{.Description}}

{{.Status}}
Arbeitsbereich

{{.Title}} verwalten

{{.Icon}}

Bereit für die fachliche Umsetzung

Die eigene Adminroute und Navigation sind eingerichtet. Einstellungen, Datenquellen, Generatoren und Freigabeabläufe können in diesem Modul getrennt aufgebaut werden.

{{end}} \ No newline at end of file diff --git a/web/admin/ai-wishes.html b/web/admin/ai-wishes.html new file mode 100644 index 0000000..4dc9fba --- /dev/null +++ b/web/admin/ai-wishes.html @@ -0,0 +1,21 @@ +{{define "ai-wishes-admin.html"}} +Audio-Wünsche – Landwelle Verwaltung +
KI & AutomatisierungAudio-Wünsche
{{printf "%.1s" .Username}}{{.Username}}
+
{{$wish := .Settings.WishAutomation}} +
Wunschbox · KI & MP3

Audio-Wünsche konfigurieren

Hier steuerst du vollständig, wie ein Musikwunsch aus der Wunschbox in eine sendefertige KI-Anmoderation und MP3 umgewandelt wird.

+{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} + +
+
Steuerung

Automatische Verarbeitung

Der Schalter betrifft nur automatische Abläufe. „KI/MP3 erzeugen“ unter Musikwünsche funktioniert auch bei pausierter Automatik.

+ +
OpenAI

Prompt der Wunschbox

Dieser Prompt wird bei jeder manuellen und automatischen Musikwunsch-Produktion verwendet.

+ +
ElevenLabs & Mix

Stimme und Audio

Die Sprecherstimme sowie optional ein zentrales Musikbett für den Musikwunsch festlegen.

{{if not .Settings.AudioBackgrounds}}
Noch kein Musikbett vorhanden. Musikbetten kannst du unter OpenAI & ElevenLabs hochladen.
{{end}}
+ +
Datei & FTP

Ausgabe konfigurieren

FTP-Ziel und Dateinamen für die erzeugte Wunschbox-MP3.

+ +
+ +
Diese Einstellungen gelten für die Wunschbox.Manuelle Produktion unter /admin/wishes bleibt unabhängig vom Automatik-Schalter möglich.
+
+{{end}} diff --git a/web/admin/ai.html b/web/admin/ai.html new file mode 100644 index 0000000..536bbc5 --- /dev/null +++ b/web/admin/ai.html @@ -0,0 +1,11 @@ +{{define "ai-admin.html"}} +KI-Studio – Landwelle
+ +
Landwelle RadioKI-Studio
{{printf "%.1s" .Username}}
{{.Username}}Administrator
+
Redaktionsassistenz

Texte und Audio erzeugen

Entwürfe mit OpenAI erstellen oder freigegebene Texte mit ElevenLabs vertonen.

Integrationen einstellen
+{{if .Error}}
{{.Error}}
{{end}} +
OpenAI

Redaktioneller Assistent

{{if .Settings.OpenAI.Enabled}}aktiv{{else}}deaktiviert{{end}}
{{if .Result}}
Ergebnis
{{end}}
+
ElevenLabs

Audio produzieren

{{if .Settings.ElevenLabs.Enabled}}aktiv{{else}}deaktiviert{{end}}
{{if .AudioURL}}
Audio wurde erzeugtMP3 herunterladen
{{end}}
+

Redaktionelle Kontrolle

KI-Ergebnisse sind immer Entwürfe. Fakten, Namen, Orte, Termine, Rechte und Aussprache müssen vor Veröffentlichung oder Ausstrahlung redaktionell geprüft werden.

+
+{{end}} diff --git a/web/admin/analytics.html b/web/admin/analytics.html new file mode 100644 index 0000000..db3e8e7 --- /dev/null +++ b/web/admin/analytics.html @@ -0,0 +1,7 @@ +{{define "admin-analytics.html"}}Reichweite & Statistik – Landwelle
Vermarktung & AuswertungReichweite
{{printf "%.1s" .Username}}
{{.Username}}Auswertung
+
Landwelle Reichweitenmessung

Besucher & Seitenaufrufe

Einwilligungsbasierte, pseudonyme Kennzahlen für Redaktion, Entwicklung und Sponsorenunterlagen.

{{if .Error}}
{{.Error}}
{{end}} +
Eingewilligte Besucher{{.Summary.Visitors}}pseudonym gezählte Nutzer
Sitzungen{{.Summary.Sessions}}30 Minuten ohne Aktivität beenden eine Sitzung
Seitenaufrufe{{.Summary.Pageviews}}nur öffentliche Inhaltsseiten
Seiten je Sitzung{{.Summary.PagesPerSession}}durchschnittliche Nutzungstiefe
+
Verlauf

Entwicklung im gewählten Zeitraum

Besucher und Seitenaufrufe pro Tag.

BesucherSeitenaufrufe
+
Interesse

Meistbesuchte Seiten

{{range .Summary.TopPages}}{{else}}{{end}}
SeiteBesucherAufrufe
{{if .PageTitle}}{{.PageTitle}}{{else}}{{.Path}}{{end}}{{.Path}}{{.Visitors}}{{.Pageviews}}
Für diesen Zeitraum liegen noch keine eingewilligten Messwerte vor.
Nutzung

Geräteklassen

{{range .Summary.Devices}}
{{if eq .Label "mobile"}}Smartphone{{else if eq .Label "tablet"}}Tablet{{else if eq .Label "desktop"}}Desktop{{else}}Sonstige{{end}}{{.Count}}
{{else}}

Noch keine Daten.

{{end}}
Herkunft

Verweise

{{range .Summary.Referrers}}
{{.Label}}{{.Count}}
{{else}}

Noch keine Daten.

{{end}}
+
So sind diese Zahlen einzuordnen

Gezählt werden ausschließlich öffentliche Seitenaufrufe von Besucherinnen und Besuchern, die der freiwilligen Statistik zugestimmt haben. Adminzugriffe, bekannte Bots, APIs, Assets und direkte Mediendateien sind ausgeschlossen. Es werden keine Roh-IP-Adressen gespeichert. Die Werte sind belastbare Messwerte der eingewilligten Nutzung, aber keine Hochrechnung auf alle Websitebesucher.

+
{{end}} diff --git a/web/admin/auto-tasks.html b/web/admin/auto-tasks.html new file mode 100644 index 0000000..9957851 --- /dev/null +++ b/web/admin/auto-tasks.html @@ -0,0 +1 @@ +{{define "auto-tasks-admin.html"}}Auto Aufgaben – Landwelle Verwaltung
KI & AudioAuto Aufgaben
{{printf "%.1s" .Username}}{{.Username}}
Automatisierung

Auto Aufgaben

Getrennte Zeitpläne für Nachrichten, Sport und Wetter. Der zentrale KeyHelp-Cron stößt die Prüfung jede Minute an.

{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}}
Zentrale Cron-Steuerung

{{.Cron.HealthLabel}}

{{.Cron.HealthText}}

{{.Cron.Health}}
Lokaler Endpunkt{{.Cron.LocalEndpoint}}
Zeitplan{{.Cron.Schedule}}
Zeitzone{{.Cron.Timezone}}
Aufrufe{{.Cron.CallCount}}
{{if .Cron.TokenConfigured}}{{else}}
LANDWELLE_CRON_TOKEN ist noch nicht konfiguriert.
{{end}}
Zeitplan

Geplante Aufgaben

{{if .Tasks}}
{{range .Tasks}}
{{.Name}}{{.TaskKey}} · {{.RunTime}} Uhr{{if .Active}}Aktiv{{else}}Deaktiviert{{end}} · Tage: {{range .Days}}{{.}} {{end}}{{if .LastRunAt}}Letzter Lauf: {{.LastRunAt.Format "02.01.2006 15:04"}} · {{.LastStatus}}{{end}}{{if .LastError}}{{.LastError}}{{end}}
{{end}}
{{else}}
Noch keine Auto-Aufgaben

Lege den ersten Zeitplan für Nachrichten, Sport oder Wetter an.

{{end}}
Zeitplan

Neue Auto-Aufgabe

Ausführungstage
{{end}} diff --git a/web/admin/dashboard.html b/web/admin/dashboard.html new file mode 100644 index 0000000..863fe1b --- /dev/null +++ b/web/admin/dashboard.html @@ -0,0 +1,252 @@ +{{define "dashboard.html"}} + + + + + + + + Landwelle Verwaltung + + + + + + +
+ + +
+
+ +
Landwelle RadioVerwaltung
+
+ {{printf "%.1s" .Username}} +
{{.Username}}Administrator
+
+ + +
+
+
+ +
+
+
+
Übersicht

Moin, {{.Username}}!

Hier siehst du den aktuellen Zustand deiner Landwelle-Plattform.

+
System läuft seit{{.StartedAt}}
+
+ +
+
+ Landwelle Systemzentrale +

Alles Wichtige auf einen Blick

+

Live-Status von Radio, KI-Diensten, Auslieferung, App und Server.

+
+
Portal betriebsbereit{{.Version}}
+
+ +
+
●
PortalstatusOnline{{.ListenAddress}}
+
◷
Laufzeit{{.Uptime}}Start: {{.StartedAt}}
+
▦
PostgreSQL{{if .DatabaseConfigured}}Verbunden{{else}}Nicht verbunden{{end}}{{.DBStats.AdminUsers}} Admins · {{.DBStats.NormalUsers}} Nutzer
+
♫
AzuraCast{{if .NowPlaying.Online}}Live{{else}}Offline{{end}}{{.NowPlaying.Listeners}} Zuhörer
+
+ +
+
+
♫
Radio

AzuraCast & Landwelle

{{if .NowPlaying.Online}}Online{{else}}Offline{{end}}
+
Aktueller Titel{{.NowPlaying.Artist}} – {{.NowPlaying.Title}}{{.NowPlaying.Listeners}} Zuhörer live · Quelle {{.NowPlaying.Source}}
+
Station{{.RuntimeSettings.AzuraCast.StationShortcode}}
Stream{{if .NowPlaying.Online}}aktiv{{else}}gestört{{end}}
+
+ +
+
✦
KI

OpenAI

{{.OpenAIStatus}}
+
{{.RuntimeSettings.OpenAI.Model}}aktives Modell
+
Verfügbare Modelle{{.OpenAIModels}}
Integration{{if .RuntimeSettings.OpenAI.Enabled}}aktiv{{else}}aus{{end}}
+
+ +
+
◉
Audio

ElevenLabs

{{.ElevenStatus}}
+
Credits / Zeichen{{.ElevenUsed}} / {{.ElevenLimit}}
+
Modell{{.RuntimeSettings.ElevenLabs.Model}}
Status{{if .RuntimeSettings.ElevenLabs.Enabled}}aktiv{{else}}aus{{end}}
+
+ +
+
⇧
Auslieferung

FTP

{{.FTPStatus}}
+
{{if .RuntimeSettings.FTP.Host}}{{.RuntimeSettings.FTP.Host}}{{else}}Nicht konfiguriert{{end}}Zielserver
+
Port{{.RuntimeSettings.FTP.Port}}
TLS{{if .RuntimeSettings.FTP.TLS}}aktiv{{else}}aus{{end}}
+
+ +
+
▣
Mobile App

Android & Push

App {{.DBStats.LatestAndroidVersion}}
+
{{.DBStats.Installations}}Installationen
{{.DBStats.PushEnabled}}Push aktiv
{{.DBStats.PushAccepted}}FCM akzeptiert
{{.DBStats.PushOpened}}geöffnet
+
+ +
+
◆
Firebase

Cloud Messaging

{{.FirebaseStatus}}
+
{{if .FirebaseProject}}{{.FirebaseProject}}{{else}}Kein Projekt{{end}}Firebase-Projekt
+
Service Accountserverseitig
APIFCM HTTP v1
+
+ +
+
▦
Datenbank

PostgreSQL

{{if .DatabaseConfigured}}Aktiv{{else}}Fehlt{{end}}
+
{{.DBStats.AdminUsers}}Administratoren
{{.DBStats.NormalUsers}}Benutzer
{{.DBStats.Installations}}App-Geräte
+
+ +
+
{ }
Backend

Go-Anwendung

Läuft
+
{{.Version}}Portal-Version
+
Go{{.GoVersion}}
System{{.GoOS}} / {{.GoArch}}
+
Goroutinen{{.GoRoutines}}
Speicher{{.MemoryMB}} MB
+
+
+ +
+
Redaktion

Inhalte

Hier werden später eigene Meldungen, Veranstaltungen und Startseiten-Highlights gepflegt.

+
▤

Redaktionsmodul vorbereitet

Die Oberfläche ist bereits eingeplant. Aktiviert wird sie, sobald PostgreSQL als Datenquelle im Portal angeschlossen ist.

+
+ +
+
Niedersachsen-Nachrichten

RSS-Feeds

Lokale Quellen aus allen Regionen Niedersachsens zentral verwalten.

+
+
+

Quelle hinzufügen

Feed-URL, Region, Kategorie, Intervall und rechtliche Hinweise.

Folgt mit RSS-Worker
+
✓

Feed testen

Statuscode, Format, letzte Meldung und Dubletten direkt prüfen.

Backend vorbereitet
+
⌁

Regional gewichten

Ausgewogene Startseite für Nordwest, Nordost, Mitte und Süden.

Konzept vorhanden
+
+
+ +
+
+
On Air

AzuraCast & Cover

Live-Metadaten aus AzuraCast holen und passende Cover unabhängig über öffentliche Musikkataloge auflösen.

+
Frontend-API/api/v1/now
+
+ +
+
+
+
Verbindung

AzuraCast konfigurieren

+ Now Playing +
+ +
+
+ + +
+ + + +
+ + +
Effektiver Endpunkt{{.AzuraCastEndpoint}}
+
+ +
+
Cover-Auflösung

Nicht aus AzuraCast

AzuraCast-Artwork wird ignoriert
+

Interpret und Titel kommen aus AzuraCast. Das Cover wird serverseitig gesucht, lokal gecacht und anschließend über Landwelle ausgeliefert.

+
+ +
+
+ + +
+
+ +
+

Einstellungen werden unter {{.SettingsPath}} gespeichert.

+
+
+
+
+ + +
+
+ +
+
Apps & Geräte

Push-Nachrichten

Später Nachrichten nach Region, Plattform, Thema und App-Version versenden.

+
Push-Vorschau

Landwelle Eilmeldung

Wichtige Nachricht aus deiner Region – direkt auf Smartphone und Desktop.

Landwelle🔔 Neue Meldung

Aktuelles aus Niedersachsen

+
+ +
+
System

Einstellungen

Aktuelle Laufzeitkonfiguration und Sicherheitsstatus.

+
+

Server

Version
{{.Version}}
Adresse
{{.ListenAddress}}
Uptime
{{.Uptime}}
PostgreSQL
{{if .DatabaseConfigured}}Konfiguriert{{else}}Noch nicht aktiv{{end}}
+

Sicherheit

Login
Aktiv
Passworthash
{{if .AdminHashActive}}PBKDF2-SHA256{{else}}Klartext-Environment{{end}}
Sitzung
HttpOnly · SameSite Strict
Indexierung
Adminbereich gesperrt
+

Wetter

Ort
Visselhövede
Koordinaten
52.9847 / 9.5782
Datenquelle
Open-Meteo
Cache
10 Minuten
+

AzuraCast

Station
{{.RuntimeSettings.AzuraCast.StationShortcode}}
Endpunkt
{{.AzuraCastEndpoint}}
Cover
Apple iTunes
Statusdatei
{{.SettingsPath}}
+
+
+
Transparenz & Lizenzen

Open-Source-Komponenten

Geschützter technischer Hinweis für Administratoren. Die Angaben müssen bei Versionswechseln aktualisiert werden.

+
+
+
+ + +{{end}} diff --git a/web/admin/directory.html b/web/admin/directory.html new file mode 100644 index 0000000..d9517b9 --- /dev/null +++ b/web/admin/directory.html @@ -0,0 +1 @@ +{{define "directory-admin.html"}}Branchenbuch verwalten – Landwelle
Inhalte & RedaktionBranchenbuch
{{.Username}}
Regionale Einträge prüfen

Branchenbuch verwalten

Neue kostenlose Einträge redaktionell prüfen, bearbeiten, veröffentlichen oder archivieren.

Öffentliches Branchenbuch
{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}}{{if not .DatabaseReady}}
PostgreSQL oder Migration 0027 ist nicht verfügbar.
{{end}}
{{range .Items}}{{$entry := .}}
{{.Category}}

{{.Name}}

{{.PostalCode}} {{.City}} · Eingang {{.CreatedAt.Format "02.01.2006 15:04"}}
{{.Status}}
{{if ne .Status "published"}}{{end}}{{if ne .Status "rejected"}}{{end}}{{if ne .Status "archived"}}{{end}}
{{else}}

Keine Einträge in dieser Auswahl

Neue Einsendungen erscheinen automatisch im Status „Neu“.

{{end}}
{{end}} diff --git a/web/admin/downloads.html b/web/admin/downloads.html new file mode 100644 index 0000000..3c6944e --- /dev/null +++ b/web/admin/downloads.html @@ -0,0 +1,15 @@ +{{define "downloads-admin.html"}} + +Desktop-Downloads verwalten – Landwelle +
+ +
Landwelle RadioVerwaltung
{{printf "%.1s" .Username}}
{{.Username}}Administrator
+
Radio-Software

Desktop-Downloads

Hier stellst du die fertigen Landwelle-Player für Windows, Linux, macOS und das offizielle Wallpaper-Paket bereit. Ohne Datei zeigt die Website automatisch „Coming soon“.

Speicherort{{.StorePath}}
+{{if .Success}}
{{.Success}}
{{end}}{{if .Error}}
{{.Error}}
{{end}} +
{{range .Platforms}}
{{if eq .ID "windows"}}WIN{{else if eq .ID "linux"}}LIN{{else if eq .ID "macos"}}MAC{{else}}WALL{{end}}
{{if .IsWallpaper}}Fan-Download{{else}}Desktop-App{{end}}

{{.Name}}

{{.Description}}

{{if .Available}}Veröffentlicht{{else}}Coming soon{{end}}
+{{if .Available}}{{if .PreviewURL}}Vorschau {{.Name}}{{end}}
{{.Filename}}{{.Size}} · aktualisiert {{.Updated}}Datei testen ↗
{{else}}
Noch keine Datei bereitgestellt. Auf der öffentlichen Downloadseite bleibt der Button deaktiviert.
{{end}} +
{{if .IsWallpaper}}{{end}}
+{{if .Available}}
{{end}}
{{end}}
+

So funktioniert die Veröffentlichung

Die Dateien werden außerhalb der eingebetteten Webassets im konfigurierbaren Download-Verzeichnis gespeichert. Dadurch kannst du neue Player-Versionen bereitstellen, ohne das Landwelle-Portal neu zu kompilieren. Bestehende Links bleiben stabil.

LANDWELLE_DOWNLOAD_DIR={{.StorePath}}
+
+{{end}} diff --git a/web/admin/editorial.html b/web/admin/editorial.html new file mode 100644 index 0000000..d8c3159 --- /dev/null +++ b/web/admin/editorial.html @@ -0,0 +1,137 @@ +{{define "editorial-admin.html"}} + + + + + + + Redaktion – Landwelle + + + + + +
+ +
Landwelle RadioRedaktionssystem
{{printf "%.1s" .Username}}
{{.Username}}Administrator
+
+
Inhalte & Veröffentlichungen

Redaktion

Beiträge, regionale Geschichten, Kategorien und Veröffentlichungswege übersichtlich verwalten.

Datenbank{{if .DatabaseReady}}PostgreSQL aktiv{{else}}nicht verbunden{{end}}
+ {{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} + {{if not .DatabaseReady}} +
▦

PostgreSQL erforderlich

Führe die vorhandenen Datenbankmigrationen aus und prüfe DATABASE_URL.

+ {{else}} + + + + {{if eq .ActiveTab "contents"}} +
+
+
Redaktionsarchiv

{{len .Items}} Inhalte

Hier siehst du sofort, in welcher Kategorie ein Beitrag liegt, welchen Status er hat und ob Facebook ihn übernommen hat.

+ + Inhalt anlegen +
+
+ + + +
+
+
InhaltKategorie & StatusVerteilungAktionen
+ {{range .Items}} +
+
+ {{if .MediaURL}}{{.MediaAlt}}{{else}}LW{{end}} +
{{.Title}}

{{if .Teaser}}{{.Teaser}}{{else}}Noch kein Teaser hinterlegt.{{end}}

{{if .Location}}⌖ {{.Location}} · {{end}}Aktualisiert {{.UpdatedLabel}}
+
+
{{.ContentTypeLabel}}{{.StatusLabel}}{{if .HomepageSection}}Landwelle vor Ort{{end}}{{if .HasAITransparency}}✦ {{.AIShortLabel}}{{.AIReviewLabel}}{{end}}{{if .HasMediaAITransparency}}Bild: KI-Inhalt{{end}}
+
+ + {{if .SendPush}}↗ Push ausgewählt{{else}}Kein Push{{end}} +
+
+ {{if .PublicPath}}Ansehen{{end}} + Bearbeiten + {{if and .PostToFacebook (eq .Status "published")}}
{{end}} +
+
+
+ {{else}}

Noch keine Inhalte

Lege den ersten redaktionellen Beitrag an.

Ersten Inhalt anlegen
{{end}} + +
+
+ {{end}} + + {{if eq .ActiveTab "create"}} +
+
+
{{if .HasEdit}}Beitrag bearbeiten{{else}}Neuer Inhalt{{end}}

{{if .HasEdit}}{{.Edit.Title}}{{else}}Inhalt anlegen{{end}}

Erst speichern, dann erscheint der Inhalt in der übersichtlichen Inhaltsliste.

{{if .HasEdit}}Bearbeitung schließen{{end}}
+
+
+ + + + + + + +
Beitragsbild aus der Mediengalerie
{{range .Media}}{{end}}
Zur Mediengalerie / neues Bild hochladen
+
Veröffentlichung
+
KI-Transparenz nach Art. 50 EU-KI-Verordnung

Lege fest, welchen Anteil künstliche Intelligenz am veröffentlichten Inhalt hatte. Die öffentliche Kennzeichnung wird daraus automatisch erzeugt.

Öffentliche KI-Transparenzseite öffnen ↗
+
Zur Inhaltsliste
+
+
+ + +
+ {{end}} + + {{if eq .ActiveTab "categories"}} +
+
Redaktionelle Struktur

Kategorien

Kategorien ordnen deine Inhalte. Mit „Landwelle vor Ort“ freigeschaltete Kategorien erscheinen nach Veröffentlichung auf der Startseite.

+
+ {{range .Types}} +
+
{{printf "%.1s" .Name}}
+
{{.Name}}{{.Slug}}

{{if .Description}}{{.Description}}{{else}}Keine Beschreibung hinterlegt.{{end}}

+
{{if .HomepageSection}}Landwelle vor Ort{{end}}{{if not .Active}}Inaktiv{{end}}Sortierung {{.SortOrder}}
+
+
+ {{else}}

Noch keine Kategorien vorhanden

Lege die erste redaktionelle Kategorie an.

{{end}} +
+
+ + +
+ +
Neue Struktur

Kategorie anlegen

Lege fest, wofür die Kategorie genutzt wird und ob sie Beiträge für „Landwelle vor Ort“ bereitstellt.

+
+ + + + + + +
+
+
+
+ {{end}} + {{end}} +
+{{end}} diff --git a/web/admin/email-templates.html b/web/admin/email-templates.html new file mode 100644 index 0000000..ffd5337 --- /dev/null +++ b/web/admin/email-templates.html @@ -0,0 +1,9 @@ +{{define "email-templates-admin.html"}} +E-Mail-Templates – Landwelle
+ +
Landwelle RadioE-Mail-Templates
{{printf "%.1s" .Username}}
{{.Username}}Administrator
+
Kommunikation

Landwelle E-Mail-Templates

Standardmails im Landwelle-Stil mit Logo, dunklem Layout und grünen Akzenten verwalten.

+{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} +
Vorlagen

Verfügbare Templates

+
Bearbeiten

{{.Edit.Name}}

Verfügbare Platzhalter{{"{{name}}"}}{{"{{place}}"}}{{"{{artist}}"}}{{"{{song}}"}}{{"{{message}}"}}{{"{{admin_url}}"}}
+
{{end}} diff --git a/web/admin/excursions.html b/web/admin/excursions.html new file mode 100644 index 0000000..f918b4f --- /dev/null +++ b/web/admin/excursions.html @@ -0,0 +1,13 @@ +{{define "excursions-admin.html"}}Ausflugstipps – Landwelle Verwaltung
Inhalte & RedaktionAusflugstipps
{{printf "%.1s" .Username}}{{.Username}}
+
Freizeit & Region

Ausflugstipps verwalten

Tipps anlegen, bearbeiten, veröffentlichen und in eigenen Rubriken organisieren.

Öffentliche Seite ↗
+{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}}{{if not .DatabaseReady}}
PostgreSQL oder Migration 0040 ist nicht verfügbar.
{{end}} +
{{len .Items}}Ausflugstipps gesamt
{{len .Categories}}Rubriken
+
{{range .Items}}
{{if .Image}}{{else}}Kein Bild{{end}}{{if .Featured}}Hervorgehoben{{end}}
{{.Category}}Sortierung {{.SortOrder}}

{{.Title}}

{{.Region}}{{if .Distance}} · {{.Distance}}{{end}}

{{.Description}}

{{if .Active}}Öffentlich{{else}}Deaktiviert{{end}}
{{else}}

Noch keine Ausflugstipps

Über „Ausflugstipp anlegen“ kannst du den ersten Tipp erstellen.

{{end}}
+
+ +
Neuer Inhalt

Ausflugstipp anlegen

+ +
Ausflugstipp

Ausflugstipp bearbeiten

Kein Bild hinterlegt
+ +
Struktur

Rubriken verwalten

Neue Rubrik

Vorhandene Rubriken

{{range .Categories}}
{{.ItemCount}} Tipps
{{else}}

Noch keine Rubriken vorhanden.

{{end}}
+{{end}} diff --git a/web/admin/forum.html b/web/admin/forum.html new file mode 100644 index 0000000..f446107 --- /dev/null +++ b/web/admin/forum.html @@ -0,0 +1,11 @@ +{{define "admin-forum.html"}}{{.Title}} – Landwelle
Community & ModerationForum
{{printf "%.1s" .Username}}
{{.Username}}Moderation
+
Landwelle Community

{{.Title}}

Themen im Blick behalten, Diskussionen moderieren und die Forenstruktur übersichtlich pflegen.

Öffentliches Forum öffnen ↗
+{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} + +{{if or (eq .Mode "overview") (eq .Mode "topics")}}
Alle Themen{{.TopicTotal}}in allen Kategorien
Veröffentlicht{{.PublishedCount}}öffentlich sichtbar
Geschlossen{{.LockedCount}}keine neuen Antworten
Antworten{{.ReplyTotal}}gesamte Community
Fixiert{{.PinnedCount}}oben hervorgehoben
{{end}} +{{if eq .Mode "overview"}}
Aktivität

Neueste Themen

Die letzten Diskussionen auf einen Blick.

Alle Themen →
{{template "forum_topic_cards" .}}
+{{else if eq .Mode "categories"}}
Forenstruktur

{{len .Categories}} Kategorien

Reihenfolge, Sichtbarkeit und Mitgliederzugriff.

{{range .Categories}}
{{.Icon}}

{{.Name}}

{{.Description}}

{{.TopicCount}} Themen · {{.PostCount}} Beiträge{{if .MembersOnly}} · nur Mitglieder{{end}}{{if not .Active}} · inaktiv{{end}}
Bearbeiten
{{else}}

Noch keine Kategorien

{{end}}
{{if .EditCategory}}Bearbeiten{{else}}Neu anlegen{{end}}

{{if .EditCategory}}{{.EditCategory.Name}}{{else}}Forum-Kategorie{{end}}

{{if .EditCategory}}Abbrechen{{end}}
+{{else if eq .Mode "topics"}}
Moderation

Themen & Beiträge

Suche, Statusfilter und direkte Moderationsaktionen.

{{if or .Query .StatusFilter}}Zurücksetzen{{end}}
{{template "forum_topic_cards" .}}
+{{else}}
Community-Schutz

Gemeldete Inhalte

Hinweise aus der Community prüfen und nachvollziehbar bearbeiten.

{{range .Reports}}
Meldung #{{.ID}}

{{.Reason}}

{{.CreatedAt.Format "02.01.2006 · 15:04"}} · gemeldet von {{.Reporter}} · Status {{.Status}}
{{if .TopicID}}Thema prüfen →{{end}}
{{else}}
✓

Keine offenen Meldungen

In der Community ist aktuell nichts zur Prüfung vorgemerkt.

{{end}}
{{end}} +
{{end}} +{{define "forum_topic_cards"}}
{{range .Topics}}
{{if .Pinned}}★{{else if eq .Status "locked"}}🔒{{else if eq .Status "published"}}✓{{else}}○{{end}}
{{.CategoryName}}{{if .Pinned}}Fixiert{{end}}{{if eq .Status "locked"}}Geschlossen{{else if ne .Status "published"}}Ausgeblendet{{end}}

{{.Title}}

von {{.AuthorName}} · zuletzt {{.LastPostAt.Format "02.01.2006 · 15:04"}}

{{.ReplyCount}} Antworten{{.Views}} Aufrufe{{.ThankCount}} Danke
{{else}}

Keine passenden Themen gefunden

Ändere den Suchbegriff oder den Statusfilter.

{{end}}
{{end}} diff --git a/web/admin/login.html b/web/admin/login.html new file mode 100644 index 0000000..b1c2774 --- /dev/null +++ b/web/admin/login.html @@ -0,0 +1,64 @@ +{{define "login.html"}} + + + + + + + + Landwelle Verwaltung – Anmeldung + + + + +
+ + + +
+ + +{{end}} diff --git a/web/admin/management.html b/web/admin/management.html new file mode 100644 index 0000000..f76eec6 --- /dev/null +++ b/web/admin/management.html @@ -0,0 +1,61 @@ +{{define "chart-editor-row"}} +
+ +
+ + +
{{if .CoverURL}}Cover {{.Artist}} – {{.Title}}{{else}}♪{{end}}
+
+ +{{if .Annual}}{{else}}{{.VotePoints}}{{.VoteCount}} {{if eq .VoteCount 1}}Online-Stimme{{else}}Online-Stimmen{{end}}{{end}} +
/
+ + + +
+{{end}} + +{{define "chart-table-head"}}
PosKünstlerTitelCoverAktionenStore / YouTubePunkte manuellVoting-StandEinstieg Jahr / Monat/KWAktuelle WocheVorwoche
{{end}} +{{define "chart-annual-head"}}
PosKünstlerTitelCoverAktionenStore / YouTubePunkteEinstieg Jahr / Monat/KWAktuellVorwoche
{{end}} + +{{define "management-admin.html"}}Verwaltung – Landwelle{{if eq .Module "charts"}}{{end}}{{if eq .Module "events"}}{{end}}
Landwelle Radio{{if eq .Module "charts"}}Chartverwaltung{{else if eq .Module "events"}}Veranstaltungsprüfung{{else}}Audit-Protokoll{{end}}
{{printf "%.1s" .Username}}{{.Username}}
{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}}{{if not .DatabaseReady}}
PostgreSQL ist nicht verfügbar.
{{end}} +{{if eq .Module "charts"}} +
+
Musik & Voting

{{.ChartTitle}}

Die bewährte Chartlogik aus dem bisherigen System – neu aufgebaut im Landwelle-Design.

+{{if .ChartLoadError}}
Chartdaten konnten nicht vollständig geladen werden.

{{.ChartLoadError}}

{{end}} +
Laufende Titel{{.ChartImportStats.CurrentEntries}}
Archiv{{.ChartImportStats.ArchiveEntries}}
Jahre{{.ChartImportStats.Years}}
Jahrescharttitel{{.ChartImportStats.YearEntries}}
Songinfos{{.ChartImportStats.SongInfos}}
+ +
+ +{{if or (eq .ChartKey "listener") (eq .ChartKey "dockx") (eq .ChartKey "schlager")}} +
Aktiver Bereich{{.ChartTitle}}{{len .Charts}} Titel geladen · Positionen per Drag-and-drop verschiebbar
+ Neuen Charttitel anlegen
+
Chartauswertung{{if .ChartLastGenerated}}Zuletzt generiert: {{.ChartLastGenerated}}. Die Liste kann jederzeit erneut generiert werden.{{else}}Für diesen Chart wurde noch keine Auswertung ausgeführt. Die Liste kann jederzeit generiert werden.{{end}}
+
A = Autoübernimmt Cover und Hörprobe aus Apple Music/iTunes oder dem YouTube-Link.L = Leerenleert nur die Eingaben der betroffenen Zeile. Die Position und die übrige Chartliste bleiben erhalten.
+

Top 3 – Spitzenplätze

Die drei führenden Titel.

Platz 1–3
{{template "chart-table-head" .}}
{{range .TopChartRows}}{{template "chart-editor-row" .}}{{else}}

Noch keine Top-3-Titel vorhanden.

{{end}}
+

{{.ChartMainTitle}}

Der laufende Hauptbereich des Charts.

Platz 4–{{.ChartMainEnd}}
{{template "chart-table-head" .}}
{{range .MainChartRows}}{{template "chart-editor-row" .}}{{else}}

Noch keine Hauptcharttitel vorhanden.

{{end}}
+{{if .ChartPreviewTitle}}

{{.ChartPreviewTitle}}

Neue Titel, die sich dem Voting stellen.

bis Platz {{.ChartTotalEnd}}
{{template "chart-table-head" .}}
{{range .PreviewChartRows}}{{template "chart-editor-row" .}}{{else}}

Keine Neuvorstellungen vorhanden.

{{end}}
{{end}} + +{{else if eq .ChartKey "archive"}} +

Chart-Archiv

Archivierte Titel wiederherstellen oder endgültig entfernen.

{{len .ChartArchive}} Einträge
{{range .ChartArchive}}
{{if .CoverURL}}Cover{{else}}♪{{end}}
{{.SourceChartKey}} · früher Platz {{.OriginalPosition}} · {{.ArchivedAt.Format "02.01.2006"}}

{{.Artist}} – {{.Title}}

{{.ArchiveReason}}

{{if .RestoredAt.IsZero}}{{else}}Wiederhergestellt{{end}}
{{else}}

Das Archiv ist leer.

{{end}}
+ +{{else}} +
+ Neuen Jahrescharttitel anlegen
+
KI-Titelinformationen{{.ChartInfoCount}} von {{len .ChartYearEntries}} Titeln besitzen bereits Informationen. Der KI-Lauf ergänzt nur fehlende Einträge.
+

Jahrescharts {{.SelectedYear}}

Positionen lassen sich per Drag-and-drop verschieben und werden direkt gespeichert.

{{len .ChartYearEntries}} Titel
{{template "chart-annual-head" .}}
{{range .AnnualChartRows}}{{template "chart-editor-row" .}}{{else}}

Für dieses Jahr sind keine Titel vorhanden.

{{end}}
+{{end}} +
+{{else if eq .Module "events"}} +
Kalender

Veranstaltungen verwalten

Hub-Termine und eigene Veranstaltungen getrennt verwalten. Eigene Termine kannst du direkt anlegen, bearbeiten und veröffentlichen.

+ +{{if eq .EventTab "hub"}}
Niedersachsen HubHier erscheinen aktuelle importierte Termine. Änderungen an importierten Datensätzen können beim nächsten Import wieder überschrieben werden.
{{else}}
Eigene VeranstaltungenEinsendungen und redaktionell angelegte Termine lassen sich hier vollständig bearbeiten. Veröffentlichte eigene Veranstaltungen nehmen automatisch an der zufälligen Auswahl der bis zu drei Startseiten-Termine teil.
{{end}} +
+{{range .Events}}{{$event := .}}
{{if .ImageURL}}Veranstaltungsbild {{.Title}}{{else}}
Termin
{{end}}
{{.Title}}{{.StartAt.Format "02.01.2006 15:04"}} · {{.City}} · {{.SourceName}}
{{.Category}}{{if eq .Status "published"}}Veröffentlicht{{else if eq .Status "pending"}}Offen{{else if eq .Status "rejected"}}Abgelehnt{{else if eq .Status "archived"}}Archiviert{{else}}{{.Status}}{{end}}
{{if ne .Status "published"}}{{end}}{{if and (eq $.EventTab "submissions") (eq .Status "pending")}}{{end}}
+
Veranstaltung bearbeiten

{{.Title}}

{{if .ImageURL}}{{end}}
{{else}}

{{if eq .EventTab "hub"}}Keine aktuellen Hub-Veranstaltungen{{else}}Keine eigenen Veranstaltungen{{end}}

{{if eq .EventTab "hub"}}Beim nächsten Import erscheinen hier neue Termine aus dem Niedersachsen Hub.{{else}}Lege oben eine Veranstaltung an oder warte auf eine neue Einsendung über die Webseite.{{end}}

{{end}}
+{{if or (and (eq .EventTab "hub") (gt .HubCount 0)) (gt .EventTotalPages 1)}}{{end}}
+
Landwelle Redaktion

Neue Veranstaltung eintragen

Der Termin wird als eigene Landwelle-Veranstaltung gespeichert und kann direkt veröffentlicht werden.

+
Veranstaltungskalender

Rubriken verwalten

Aktive Rubriken stehen auf der Webseite und beim Eintragen neuer Veranstaltungen zur Auswahl.

Neue Rubrik

{{range .EventCategories}}
Verwendet{{.EventCount}}×
{{else}}

Noch keine Rubriken vorhanden.

{{end}}
+{{else}}
Sicherheit & Nachvollziehbarkeit

Audit-Protokoll

Verwaltungsaktionen prüfen, Fehler schneller finden und Änderungen lückenlos nachvollziehen.

{{.AuditTotal}} Einträge
+
Erfolgreich{{.AuditSuccessCount}}Aktionen im Filter
Fehlgeschlagen{{.AuditFailureCount}}benötigen Aufmerksamkeit
Aktive Konten{{.AuditActorCount}}unterschiedliche Akteure
Heute{{.AuditTodayCount}}Aktionen seit 0 Uhr
+
Protokollsuche

Verwaltungsaktivitäten

Suche nach Benutzer, Aktion, Objekt oder Beschreibung.

{{if or .AuditQuery .AuditAction .AuditResult}}Zurücksetzen{{end}}
+
{{range .Audit}}
{{if .Success}}✓{{else}}!{{end}}
{{.Action}}{{if .Success}}Erfolgreich{{else}}Fehlgeschlagen{{end}}

{{if .Summary}}{{.Summary}}{{else}}Keine zusätzliche Beschreibung{{end}}

{{.CreatedAt.Format "02.01.2006 · 15:04:05"}}Benutzer: {{if .ActorName}}{{.ActorName}}{{else}}System{{end}}Objekt: {{.EntityType}}{{if .EntityID}} #{{.EntityID}}{{end}}{{if .IPAddress}}IP: {{.IPAddress}}{{end}}
{{else}}
⌕

Keine passenden Protokolleinträge

Ändere die Filter oder prüfe einen anderen Zeitraum.

{{end}}
+{{if gt .AuditTotalPages 1}}{{end}}
{{end}}
{{end}} \ No newline at end of file diff --git a/web/admin/media.html b/web/admin/media.html new file mode 100644 index 0000000..dbbd763 --- /dev/null +++ b/web/admin/media.html @@ -0,0 +1,65 @@ +{{define "media-admin.html"}} + + + + + + + Mediengalerie – Landwelle + + + + + + +
+ +
+
Landwelle RadioMedienverwaltung
{{printf "%.1s" .Username}}
{{.Username}}Administrator
+
+
Bilder & Rechte

Mediengalerie

Bilder zentral verwalten, KI-Nutzung dokumentieren und bei ausgewählten Motiven einen sichtbaren Hinweis einblenden.

+ {{if .Error}}
{{.Error}}
{{end}} + {{if .Success}}
{{.Success}}
{{end}} + {{if not .DatabaseReady}} +
▦

PostgreSQL erforderlich

Führe die erforderlichen Migrationen aus.

+ {{else}} +
Medien gesamt{{.Total}}In der Datenbank
Aktuelle Seite{{.Page}} / {{.TotalPages}}{{.PerPage}} Bilder je Seite
KennzeichnungGezieltNur aktivierte Bilder erhalten ein Wasserzeichen
+
+
Bibliothek

Alle Bilder

{{.Total}} Medien
+
+ {{range .Items}} +
+
{{.AltText}}{{if .HasAIWatermark}}{{.AIWatermarkLabel}}{{end}}
+
+ {{.OriginalName}} + {{.Width}} × {{.Height}} px · {{.CreatedLabel}} + {{if .HasAITransparency}}✦ KI-Medium

{{.AITransparencyLabel}}

{{end}} + {{if .HasAIWatermark}}Wasserzeichen aktiv: {{.AIWatermarkLabel}}{{end}} + {{.URL}} +
+ + +
+
+
+
+ {{else}}

Noch keine Bilder

Lade das erste Bild über „Neues Bild“ hoch.

{{end}} +
+ {{if gt .TotalPages 1}}{{end}} +
+ {{end}} +
+
+
+ + + + + + +{{end}} diff --git a/web/admin/mediathek.html b/web/admin/mediathek.html new file mode 100644 index 0000000..a90b0c6 --- /dev/null +++ b/web/admin/mediathek.html @@ -0,0 +1,6 @@ +{{define "admin-mediathek.html"}}Mediathek – Landwelle
Audio & SendungenMediathek
{{printf "%.1s" .Username}}
{{.Username}}Redaktion
+
Landwelle zum Nachhören

Mediathek verwalten

KI-Beiträge, Interviews, Specials und eigene Sendungen mit einem echten Audioplayer veröffentlichen.

Mediathek öffnen ↗
{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} +{{if .Generated}}
Direkt aus ElevenLabs

Erzeugte Beiträge übernehmen

Die letzten fertigen Audios aus dem Landwelle Nachrichtenstudio können ohne erneuten Upload als Mediathek-Entwurf übernommen werden.

{{range .Generated}}
{{.ChannelLabel}} · Beitrag {{.OutputNumber}}

{{.CreatedAt.Format "02.01.2006 · 15:04"}}

{{.Text}}

{{if .Imported}}Bereits übernommen{{else}}
{{end}}
{{end}}
{{end}} +
{{if .Edit}}Bearbeiten{{else}}Neuer Beitrag{{end}}

{{if .Edit}}{{.Edit.Title}}{{else}}Audio veröffentlichen{{end}}

MP3, M4A, OGG oder WAV hochladen – alternativ eine bereits vorhandene Audio-URL verwenden.

{{if .Edit}}Abbrechen{{end}}
Audioquelle{{with .Edit}}{{if .AudioURL}}{{end}}{{end}}
KI-Transparenz

Kennzeichne KI-generierte oder wesentlich KI-bearbeitete Audios. Bei einer synthetischen Stimme muss der Hinweis unabhängig von einer redaktionellen Prüfung sichtbar bleiben.

Öffentliche KI-Transparenzseite öffnen ↗
+
Archiv

{{len .Entries}} Audioeinträge

Veröffentlichte und vorbereitete Inhalte.

{{range .Entries}}
{{if .CoverURL}}Cover{{else}}
♪
{{end}}

{{.Title}}

{{if .Subtitle}}

{{.Subtitle}}

{{end}}{{.DateLabel}}{{if .EpisodeLabel}} · {{.EpisodeLabel}}{{end}}{{if .DurationLabel}} · {{.DurationLabel}}{{end}}{{if .AudioURL}}{{end}}
Bearbeiten
{{else}}
♪

Noch keine Audioinhalte

Lege links den ersten Beitrag zum Nachhören an.

{{end}}
+
{{end}} diff --git a/web/admin/navigation.html b/web/admin/navigation.html new file mode 100644 index 0000000..a3f65ce --- /dev/null +++ b/web/admin/navigation.html @@ -0,0 +1 @@ +{{define "navigation-admin.html"}}Navigation verwalten – Landwelle
Inhalte & RedaktionNavigation
{{.Username}}
Datenbankbasiertes Menü

Hauptnavigation verwalten

Lege Hauptpunkte und eine Dropdown-Ebene an. Änderungen erscheinen nach dem Speichern auf allen öffentlichen Seiten.

Website öffnen
{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}}{{if not .DatabaseReady}}
PostgreSQL oder Migration 0027 ist nicht verfügbar.
{{end}}
{{end}} diff --git a/web/admin/news-studio.html b/web/admin/news-studio.html new file mode 100644 index 0000000..ac789c9 --- /dev/null +++ b/web/admin/news-studio.html @@ -0,0 +1,13 @@ +{{define "news-studio-admin.html"}}Nachrichtenstudio – Landwelle Verwaltung
KI & AudioNachrichtenstudio
{{printf "%.1s" .Username}}{{.Username}}
+
Informationsstudio

Nachrichten, Sport und Wetter

Nachrichten mit drei eigenständigen Radiobeiträgen sowie Sport und Wetter mit jeweils einem Beitrag erzeugen, über ElevenLabs vertonen und an die festgelegten FTP-Ziele übertragen.

OpenAIElevenLabsFTP
+{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} +
+
Produktionsbereich

Redaktion und Ausgabe konfigurieren

Wähle einen Bereich und hinterlege dessen Prompt, Stimme sowie die vorgesehenen MP3-Ziele.

+
{{range .Channels}}{{end}}
+
+{{range .Channels}}
{{.Label}}

Fach-Prompt

Dieser Prompt steuert ausschließlich {{.Label}}. {{if eq .Key "weather"}}Pro Produktionslauf entsteht ein Wetterbeitrag. Aktuelle Wetterdaten werden automatisch vom Landwelle-Wetterdienst geladen und als Ausgangsmaterial an OpenAI übergeben.{{else if eq .Key "sport"}}Pro Produktionslauf entsteht ein Sportbeitrag. Aktuelle Sportmeldungen werden automatisch aus den konfigurierten Sportschau- und kicker-RSS-Feeds geladen und als Ausgangsmaterial an OpenAI übergeben.{{else}}Pro Produktionslauf entstehen drei unterschiedliche Beiträge. Als Ausgangsmaterial werden ausschließlich heutige Meldungen von tagesschau.de, ntv.de und welt.de geladen; lokale Niedersachsen-Feeds werden in „Nachrichten Welt“ nicht verwendet.{{end}}

Stimme & Musikbett

{{$channel := .}}Ausgeschaltet beginnt die MP3 direkt mit dem Beitrag. Diese Einstellung gilt für manuelle und automatische Produktionen.
Die Pegel werden als dB-Werte dauerhaft in der Datenbank gespeichert und beim MP3-Mix berücksichtigt. Standard: TTS +12 dB, Hintergrund −16 dB. Für Musikbetten muss ffmpeg installiert sein.
FTP-Ausgabe

{{if eq .Key "news"}}Drei getrennte MP3-Dateien{{else if eq .Key "sport"}}Eine Sport-MP3-Datei{{else}}Eine Wetter-MP3-Datei{{end}}

je Beitrag eine Datei
{{if eq .Key "news"}}{{template "newsOutputs" .}}{{else if eq .Key "sport"}}{{template "sportOutputs" .}}{{else}}{{template "weatherOutputs" .}}{{end}}
{{end}} +
{{if eq .Active "news"}}Drei Beiträge erzeugen{{else}}Einen Beitrag erzeugen{{end}}Aktiver Bereich: {{range .Channels}}{{if eq $.Active .Key}}{{.Label}}{{end}}{{end}}
+
Ausgabe

Letzte Produktionen

Erfolgreich hochgeladene MP3-Dateien werden lokal automatisch gelöscht. Die Historie kann unabhängig davon bereinigt werden.

{{if .History}}{{end}}
{{if .History}}
{{range .History}}
{{.ChannelLabel}} · MP3 {{.OutputNumber}}

{{.Text}}

{{if eq .Status "done"}}Erfolgreich{{else}}Fehler{{end}}{{if .RemotePath}}{{.RemotePath}}{{end}}
{{if .AudioFile}}MP3 herunterladen{{else if .LocalAudioDeleted}}Lokale MP3 nach FTP-Upload automatisch gelöscht.{{end}}
{{if .Error}}{{.Error}}{{end}}
{{end}}
{{else}}
Noch keine Produktionen

Nach dem ersten Lauf erscheinen hier die erzeugten Beiträge. Erfolgreich hochgeladene MP3-Dateien werden anschließend automatisch vom Webspace entfernt.

{{end}}
Zugangsdaten

Zentrale Provider-Einstellungen

OpenAI-, ElevenLabs- und FTP-Zugangsdaten werden weiterhin unter Einstellungen verwaltet. Hier werden nur Fach-Prompts, Voice-IDs, Zielordner und Dateinamen gespeichert.

+
+
Live-Produktion

{{if eq .Active "weather"}}1 MP3-Datei wird erstellt{{else}}3 MP3-Dateien werden erstellt{{end}}

Die Erzeugung läuft vollständig serverseitig. Das Schließen des Fensters beendet den Auftrag nicht.

+
{{end}} \ No newline at end of file diff --git a/web/admin/program.html b/web/admin/program.html new file mode 100644 index 0000000..1984e1f --- /dev/null +++ b/web/admin/program.html @@ -0,0 +1,19 @@ +{{define "program-admin.html"}} +Programmverwaltung – Landwelle +
+ +
Landwelle RadioProgrammverwaltung
{{printf "%.1s" .Username}}
{{.Username}}Administrator
+
+
Sendeplan

Programm verwalten

Sendungen, Moderation und Sendezeiten zentral pflegen. Änderungen erscheinen direkt im öffentlichen Wochenprogramm.

Programm ansehen ↗
+{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} +
Programmeinträge{{len .Items}}im aktuellen Sendeplan
DatenquelleLive{{.StorePath}}
AusgabeWochenplanMontag bis Sonntag
+
Wochenübersicht

Alle Sendungen

Wähle einen Wochentag und verwalte nur die dafür geplanten Sendungen.

+ +
MontagSendungen am Montag
0 Einträge
+
{{range .Items}}{{end}}
SendungSendezeitProgrammartStatusAktionen
{{.Show}}{{.PresenterLabel}}
{{.Time}}{{if eq .Weekday -1}}Täglich{{else}}{{.WeekdayName}}{{end}}{{if .ProgramType}}{{.ProgramType}}{{else}}Allgemein{{end}}{{if .Live}}Jetzt live{{else if .Active}}Aktiv{{else}}Inaktiv{{end}}Bearbeiten
+
+{{if .HasEdit}}
{{end}} + + +{{end}} diff --git a/web/admin/push.html b/web/admin/push.html new file mode 100644 index 0000000..31f4bf0 --- /dev/null +++ b/web/admin/push.html @@ -0,0 +1,9 @@ +{{define "push-admin.html"}}App-Push – Landwelle Verwaltung +
Apps & VeröffentlichungPush-Nachrichten
{{printf "%.1s" .Username}}{{.Username}}
+
Landwelle App

Push-Nachrichten

Versende redaktionelle Mitteilungen an registrierte App-Installationen und kontrolliere Zustellung und Öffnungen.

+{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} +
Installationen{{.Stats.Installations}}
Push aktiviert{{.Stats.PushEnabled}}
Aktive FCM-Tokens{{.Stats.ActiveTokens}}
Gesendet{{.Stats.Sent}}
Fehlgeschlagen{{.Stats.Failed}}
Geöffnet{{.Stats.Opened}}
+
Sofortversand

Push erstellen

Nur Geräte mit aktiviertem FCM-Token und dem ausgewählten Thema erhalten die Nachricht.

+
+
Historie

Letzte Push-Kampagnen

{{range .Campaigns}}{{else}}{{end}}
ZeitTitelThemaStatusErfolgreichFehlerGeöffnet
{{.CreatedAt}}{{.Title}}{{.Body}}{{if .Topic}}{{.Topic}}{{else}}–{{end}}{{.Status}}{{.SentCount}}{{.FailedCount}}{{.OpenedCount}}
Noch keine Push-Kampagnen vorhanden.
+
{{end}} diff --git a/web/admin/roles.html b/web/admin/roles.html new file mode 100644 index 0000000..c2390da --- /dev/null +++ b/web/admin/roles.html @@ -0,0 +1,3 @@ +{{define "roles-admin.html"}} +Rollen & Rechte – Landwelle
Landwelle RadioBenutzerverwaltung
{{printf "%.1s" .Username}}
{{.Username}}Administrator
Zugriffssteuerung

Rollen & Rechte

Lege fest, welche Bereiche Administratoren, Redaktion, Moderation und normale Benutzer verwenden dürfen.

{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}}{{if not .DatabaseReady}}

Migration erforderlich

Führe 0008_user_management.sql aus.

{{else}}
{{range .Roles}}
{{.UserCount}} Benutzer

{{.Name}}

{{.Slug}}
{{range .Permissions}}{{end}}
{{end}}

Eigene Rolle anlegen

Neue Rollen erscheinen nach dem Speichern in der Benutzerverwaltung und können anschließend detailliert konfiguriert werden.

{{end}}
+{{end}} diff --git a/web/admin/settings.html b/web/admin/settings.html new file mode 100644 index 0000000..55d0a0f --- /dev/null +++ b/web/admin/settings.html @@ -0,0 +1,41 @@ +{{define "settings-admin.html"}} +Einstellungen – Landwelle +
+ +
Landwelle RadioSystemeinstellungen
{{printf "%.1s" .Username}}
{{.Username}}Administrator
+
Integrationen

Systemeinstellungen

Radio, KI, Kommunikation, Auslieferung und soziale Netzwerke übersichtlich verwalten.

Konfigurationsdatei{{.SettingsPath}}
+{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} +
+
+
Webseite & Werbung

Google AdSense

Steuert die Einbindung von Google AdSense auf den öffentlichen Landwelle-Seiten. Änderungen werden direkt beim Speichern übernommen; ein Neustart ist nicht erforderlich.

+
+
Text & Redaktion

OpenAI

+
+
Stimme & Audio

ElevenLabs

+
+
Sprecherprofile

Stimmen

{{range .Settings.ElevenLabs.Voices}}
{{end}}
+
Audiobett

Hintergrundmusik

Hochgeladene Musikbetten können in den einzelnen KI-Modulen ausgewählt und getrennt von der TTS-Stimme eingepegelt werden.

{{range .Settings.AudioBackgrounds}}
{{.Label}}{{.FileName}}
{{else}}

Noch keine Hintergrundmusik hinterlegt.

{{end}}
+ +
Benachrichtigungen

SMTP / E-Mail

+
Auslieferung

FTP

+
Musikwünsche

Automatischer Audio-Workflow

+
+
Meta Pages API

Facebook-Seite

+

Bei veröffentlichten Redaktionsbeiträgen mit aktivem Facebook-Haken wird der Beitrag unmittelbar über die Facebook Pages API veröffentlicht.

+
WhatsApp

Landwelle Kanal

Die offizielle WhatsApp Cloud API unterstützt derzeit keine automatische Veröffentlichung in WhatsApp-Kanälen. Die Kanal-URL wird zentral gespeichert; automatische Posts werden erst aktiviert, sobald Meta dafür eine offizielle Schreib-API bereitstellt.

+
+
Niedersachsen Hub

destination.one Veranstaltungsimport

+
+
Fester Niedersachsen-Hub-Abruf

Der Import nutzt automatisch meta.et4.de, das Projekt open-data-niedersachsen-tourismus, den Typ Event und das Template ET2014A.json. Du musst nur deinen Lizenzschlüssel hinterlegen.

+ + + + + + + +

Das Speichern ändert nur die Einstellungen. Der Import wird ausschließlich über den separaten Button gestartet. Du erhältst danach eine klare Erfolgs- oder Fehlermeldung. Die API-Abfrage wird automatisch auf Veranstaltungen, deutsche Inhalte und die kommenden zwölf Monate begrenzt. Bereits importierte Termine werden aktualisiert und nicht doppelt angelegt.

+
Niedersachsen-Hub jetzt importieren

Dieser Vorgang läuft getrennt vom Speichern und kann bei vielen Veranstaltungen länger dauern.

+

Sicherheitshinweis

API-Schlüssel werden serverseitig in der geschützten Laufzeitkonfiguration gespeichert und in dieser Oberfläche nie wieder ausgegeben. Dateirechte und Zugriff auf /var/lib/landwelle müssen auf den Portal-Dienst beschränkt bleiben.

+
+{{end}} diff --git a/web/admin/site-content.html b/web/admin/site-content.html new file mode 100644 index 0000000..2ae4cf1 --- /dev/null +++ b/web/admin/site-content.html @@ -0,0 +1,9 @@ +{{define "admin-site-content.html"}}{{.Title}} – Landwelle
Website-Inhalte{{.Title}}
{{printf "%.1s" .Username}}
{{.Username}}Redaktion
+
Öffentlicher Auftritt

{{.Title}}

Texte und Informationsblöcke pflegen, ohne den Quellcode bearbeiten zu müssen.

Öffentliche Seite öffnen ↗
+{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} +
Inhaltsblöcke{{len .Page.Blocks}}auf dieser Seite
Kontaktadresse{{.Page.ContactEmail}}öffentlich angegeben
{{if eq .Section "kontakt"}}
Neue Anfragen{{.NewContacts}}noch nicht bearbeitet
{{end}}
+
Seiteneinstieg

Überschrift und Einleitung

Dieser Bereich bildet den Kopf der öffentlichen Seite.

+
Öffentliche Inhalte

{{len .Page.Blocks}} Inhaltsblöcke

Die Sortierung bestimmt die Reihenfolge auf der Website.

{{range .Page.Blocks}}
{{.SortOrder}}
{{if .Active}}Sichtbar{{else}}Ausgeblendet{{end}}{{if .CTALabel}} · mit Schaltfläche{{end}}

{{.Title}}

{{paragraphs .Body}}
{{if .CTALabel}}{{.CTALabel}} → {{.CTAURL}}{{end}}
Bearbeiten
{{else}}

Noch keine Inhalte

Lege rechts den ersten Inhaltsblock an.

{{end}}
+
{{if .EditBlock}}Bearbeiten{{else}}Neuer Inhalt{{end}}

{{if .EditBlock}}{{.EditBlock.Title}}{{else}}Inhaltsblock anlegen{{end}}

{{if .EditBlock}}Abbrechen{{end}}
+{{if eq .Section "kontakt"}}
Posteingang

Kontaktanfragen

Nachrichten aus dem öffentlichen Kontaktformular.

{{range .Contacts}}
{{.StatusLabel}}

{{.Subject}}

{{.CreatedAt.Format "02.01.2006 · 15:04"}} · {{.Name}} · {{.Email}}

{{.Message}}

{{else}}

Keine Nachrichten in dieser Ansicht

{{end}}
{{end}} +
{{end}} diff --git a/web/admin/team.html b/web/admin/team.html new file mode 100644 index 0000000..b32b092 --- /dev/null +++ b/web/admin/team.html @@ -0,0 +1,53 @@ +{{define "admin-team.html"}} + + + + + + + Team verwalten – Landwelle + + + + +
+ +
+
Inhalte & RedaktionTeamverwaltung
{{.Username}}
+
+
Menschen & virtuelle Stimmen

Team verwalten

Profile, Rollen, Bilder, KI-Kennzeichnung und öffentliche Sichtbarkeit des Landwelle-Teams zentral pflegen.

Öffentliche Teamseite
+ {{if .Error}}
{{.Error}}
{{end}} + {{if .Success}}
{{.Success}}
{{end}} +
Teammitglieder{{len .Items}}Gesamt gepflegt
Öffentlich{{.ActiveCount}}Auf der Teamseite sichtbar
KI-Profile{{.AICount}}Als virtuell / KI gekennzeichnet
+
Übersicht

Alle Teammitglieder

Sortiert nach der hinterlegten Reihenfolge.

+
+ {{range .Items}} +
+
{{.Name}}{{if .HasImageWatermark}}{{.ImageWatermarkLabel}}{{end}}{{if .Active}}Öffentlich{{else}}Ausgeblendet{{end}}{{if .IsAI}}✦ KI-Profil{{end}}
+

{{.Name}}

{{.Role}}

Region
{{if .Region}}{{.Region}}{{else}}–{{end}}
Sortierung
{{.SortOrder}}
{{if .IsAI}}

{{.AITransparencyText}}

{{end}}
+
+ {{else}}
Noch keine Teammitglieder vorhanden.

Lege das erste Profil über „Neues Teammitglied“ an.

{{end}} +
+
+
+
+
+ + + + + + + +{{end}} diff --git a/web/admin/users.html b/web/admin/users.html new file mode 100644 index 0000000..e1c1d67 --- /dev/null +++ b/web/admin/users.html @@ -0,0 +1,13 @@ +{{define "users-admin.html"}} +{{.Title}} – Landwelle
+ +
Landwelle RadioBenutzerverwaltung
{{printf "%.1s" .Username}}
{{.Username}}Administrator
+
Konten & Zugriffe

{{.Title}}

{{.Description}}

+{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} +{{if not .DatabaseReady}}

PostgreSQL-Migration erforderlich

Führe die Migration 0008_user_management.sql aus.

{{else}} +
Gesamt{{.Total}}
Aktiv auf dieser Seite{{.ActiveCount}}
Gesperrt{{.LockedCount}}
Ohne E-Mail-Bestätigung{{.UnverifiedCount}}
+
+
Konten

{{.Total}} Einträge

Seite {{.Page}} von {{.TotalPages}}
{{range .Items}}{{else}}{{end}}
BenutzerRolleStatusLetzte AktivitätErstelltAktionen
{{printf "%.1s" .DisplayName}}
{{.DisplayName}}@{{.Username}} · {{.Email}}{{if .EnvironmentAdmin}}Geschütztes Environment-/Notfallkonto{{end}}
{{.RoleName}}
{{if .Active}}Aktiv{{else}}Deaktiviert{{end}}{{if .EnvironmentAdmin}}Systemkonto{{end}}{{if .LockedUntil}}Gesperrt{{end}}{{if not .EmailVerified}}E-Mail offen{{end}}{{if .PasswordResetRequired}}Passwortwechsel{{end}}
{{if .LastSeenAt}}{{.LastSeenAt.Format "02.01.2006 15:04"}}{{else if .LastLoginAt}}{{.LastLoginAt.Format "02.01.2006 15:04"}}{{else}}Noch nie{{end}}{{if .EnvironmentAdmin}}Konfiguration{{else}}{{.CreatedAt.Format "02.01.2006"}}{{end}}{{if .EnvironmentAdmin}}
{{else}}
Bearbeiten
{{if .Active}}{{else}}{{end}}{{if .LockedUntil}}{{else}}{{end}}{{if not .EmailVerified}}{{end}}
{{end}}

Keine Benutzer gefunden

Passe die Filter an oder lege ein neues Konto an.

+
{{if .Edit.ID}}Bearbeiten{{else}}Neu anlegen{{end}}

{{if .Edit.ID}}{{.Edit.DisplayName}}{{else}}Benutzerkonto{{end}}

{{if .Edit.ID}}Abbrechen{{end}}
{{if .Edit.ID}}

Passwort zurücksetzen

{{end}}
{{end}} +
+{{end}} diff --git a/web/admin/wishes.html b/web/admin/wishes.html new file mode 100644 index 0000000..c07ec50 --- /dev/null +++ b/web/admin/wishes.html @@ -0,0 +1,13 @@ +{{define "wishes-admin.html"}} +Musikwünsche – Landwelle
+ +
Landwelle RadioMusikwünsche
{{printf "%.1s" .Username}}
{{.Username}}Administrator
+
Automatisierter Workflow

Musikwünsche verwalten

Bearbeiten, freigeben, KI-Text erzeugen, mit ElevenLabs vertonen und per FTP bereitstellen.

Speicher{{.StorePath}}
+{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}} +
{{.Total}} EinträgeSeite {{.Page}} von {{.TotalPages}}
+
{{range .Items}}
{{.Status}}

{{.Name}} aus {{.Place}}

{{.DateLabel}}
+
+{{if .GeneratedText}}
KI-Anmoderation

{{.GeneratedText}}

{{end}}{{if .AudioFile}}
MP3: {{.AudioFile}}{{if .RemotePath}} · FTP: {{.RemotePath}}{{end}}
{{end}}{{if .ProcessingError}}
{{.ProcessingError}}
{{end}} +
Freigeben und veröffentlichen ohne KI-Text, ElevenLabs, MP3 oder FTP-Produktion.
{{else}}

Noch keine Musikwünsche

Neue Eingänge werden hier automatisch angezeigt und per E-Mail gemeldet.

{{end}}
+ +
{{end}} diff --git a/web/advertising.html b/web/advertising.html new file mode 100644 index 0000000..67106cd --- /dev/null +++ b/web/advertising.html @@ -0,0 +1,16 @@ +{{define "advertising.html"}} + +{{seoHead "Werbung & Sponsoring bei Landwelle" "Regionale Radiowerbung, Sponsorings, digitale Werbeformate und Landwelle-OnTour-Partnerschaften individuell anfragen." "/werbung" "website"}} + +{{template "public_header" .}} +
+
Regional werben. Persönlich ankommen.

Deine Marke auf Landwelle

Radio, Web, OnTour und regionale Sonderformate: Wir entwickeln Werbepakete, die zu deinem Unternehmen, deiner Region und deinen Zielen passen.

+{{if .Success}}
✓

Deine Anfrage ist angekommen

Vielen Dank. Wir haben deine Werbeanfrage{{if .InquiryID}} unter der Nummer {{.InquiryID}}{{end}} gespeichert und senden dir eine Bestätigung per E-Mail.

{{end}} +
Werbemöglichkeiten

So kann dein Unternehmen bei Landwelle sichtbar werden

Wähle eine oder mehrere Möglichkeiten. Wir kombinieren sie anschließend zu einem passenden Angebot.

RegionalFokus auf Niedersachsen und den ländlichen Raum
FlexibelEinzelaktion, Kampagne oder langfristige Partnerschaft
PersönlichDirekte Abstimmung mit dem Landwelle-Team
+
+
{{range .Formats}}{{end}}
+
Unverbindliche Anfrage

Erzähl uns von deinem Vorhaben

Du erhältst kein automatisches Standardangebot. Wir schauen uns deine Ziele an und melden uns persönlich.

{{if .Error}}
{{.Error}}
{{end}} +

Oder direkt an radio@landwelle.de

+
So geht es weiter

Von der Idee zur passenden Kampagne

01

Anfrage

Du wählst passende Formate und beschreibst dein Vorhaben.

02

Beratung

Wir klären Zielgruppe, Region, Laufzeit und mögliche Kombinationen.

03

Angebot

Du erhältst ein individuelles, nachvollziehbares Werbepaket.

04

Umsetzung

Nach Freigabe produzieren und veröffentlichen wir die vereinbarten Maßnahmen.

+
{{template "public_footer" .}}{{template "cookie_consent" .}} +{{end}} diff --git a/web/assets/admin-ai-audio-module-v1.css b/web/assets/admin-ai-audio-module-v1.css new file mode 100644 index 0000000..9d20388 --- /dev/null +++ b/web/assets/admin-ai-audio-module-v1.css @@ -0,0 +1 @@ +.ai-audio-module-page{display:grid;gap:22px}.audio-module-hero{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:18px;align-items:center;padding:24px;border:1px solid #dbe4dc;border-radius:20px;background:linear-gradient(135deg,#fff,#f4f8f3)}.audio-module-icon{display:grid;place-items:center;width:58px;height:58px;border-radius:17px;background:#173f2a;color:#fff;font-size:24px;font-weight:800}.audio-module-hero h1{margin:3px 0 7px;font-size:clamp(25px,3vw,36px)}.audio-module-hero p{margin:0;color:#5b6d61;max-width:760px;line-height:1.55}.audio-module-provider-state{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.audio-module-provider-state span{padding:7px 10px;border-radius:999px;font-size:12px;font-weight:800;background:#fbe7e6;color:#8b2927}.audio-module-provider-state .ok{background:#e4f5e9;color:#176a35}.audio-module-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(300px,.8fr);gap:18px}.audio-module-text-card{grid-row:span 2}.audio-module-grid .admin-card,.audio-module-actions{padding:21px}.audio-module-grid header,.audio-module-actions{display:flex;justify-content:space-between;gap:16px}.audio-module-grid h2,.audio-module-actions h2{margin:3px 0 7px}.audio-module-grid header p,.audio-module-actions p{margin:0;color:#68766d;line-height:1.5}.audio-module-grid label{display:grid;gap:7px;margin-top:16px;font-weight:700;color:#294133}.audio-module-grid input,.audio-module-grid select,.audio-module-grid textarea{width:100%;border:1px solid #ccd8cf;border-radius:11px;background:#fff;padding:11px 12px;font:inherit;color:#1f3326}.audio-module-grid textarea{resize:vertical;min-height:360px;line-height:1.55}.audio-module-grid input:focus,.audio-module-grid select:focus,.audio-module-grid textarea:focus{outline:2px solid rgba(30,111,65,.15);border-color:#4e9a68}.audio-module-inline-note,.audio-module-ftp-preview{display:flex;justify-content:space-between;gap:14px;align-items:center;margin-top:16px;padding:12px 14px;border-radius:12px;background:#f5f8f4;color:#5d6c62}.audio-module-inline-note strong{color:#274331}.audio-module-switch{grid-template-columns:auto 1fr!important;align-items:flex-start!important;padding:12px;border:1px solid #e0e7e1;border-radius:12px}.audio-module-switch input{width:auto;margin-top:3px}.audio-module-switch span{display:grid;gap:3px}.audio-module-switch small{font-weight:400;color:#6a786e}.audio-module-volume-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.audio-module-settings-card>small{display:block;margin-top:10px;color:#6b796f}.audio-module-ftp-preview code{font-size:12px;overflow-wrap:anywhere}.audio-module-provider-note{margin:15px 0 0;color:#68766d;line-height:1.5}.audio-module-provider-note a{font-weight:700}.audio-module-actions{align-items:center}.audio-module-buttons{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}.audio-production-modal{border:0;padding:0;background:transparent;max-width:min(680px,calc(100vw - 30px));width:100%}.audio-production-modal::backdrop{background:rgba(17,28,21,.56);backdrop-filter:blur(2px)}.audio-production-card{overflow:hidden;border-radius:18px;background:#fff;box-shadow:0 28px 80px rgba(0,0,0,.25)}.audio-production-card>header{display:flex;justify-content:space-between;gap:16px;align-items:center;padding:18px 20px;border-bottom:1px solid #e2e8e3}.audio-production-card>header h2{margin:3px 0 0}.audio-production-card>header button{border:0;background:#eef3ef;border-radius:999px;width:36px;height:36px;font-size:24px;cursor:pointer}.audio-production-card>p{margin:0;padding:14px 20px;color:#617067;background:#f8faf8}.audio-production-frame{display:block;width:100%;height:390px;border:0;background:#f5f7f3}.audio-production-card>footer{display:flex;justify-content:flex-end;padding:14px 20px;border-top:1px solid #e2e8e3}@media(max-width:980px){.audio-module-grid{grid-template-columns:1fr}.audio-module-text-card{grid-row:auto}.audio-module-hero{grid-template-columns:auto 1fr}.audio-module-provider-state{grid-column:1/-1;justify-content:flex-start}}@media(max-width:640px){.audio-module-hero{grid-template-columns:1fr}.audio-module-icon{width:50px;height:50px}.audio-module-volume-grid{grid-template-columns:1fr}.audio-module-actions{display:grid}.audio-module-buttons{justify-content:stretch}.audio-module-buttons button{width:100%}.audio-module-inline-note,.audio-module-ftp-preview{align-items:flex-start;flex-direction:column}} diff --git a/web/assets/admin-ai-audio-module-v1.js b/web/assets/admin-ai-audio-module-v1.js new file mode 100644 index 0000000..67e712d --- /dev/null +++ b/web/assets/admin-ai-audio-module-v1.js @@ -0,0 +1,53 @@ +document.addEventListener('DOMContentLoaded',()=>{ + const form=document.getElementById('aiAudioModuleForm'); + const action=document.getElementById('aiAudioModuleAction'); + const modal=document.getElementById('aiAudioProductionModal'); + const frame=document.getElementById('aiAudioProductionFrame'); + const produce=form?.querySelector('[data-produce-button]'); + const directory=form?.querySelector('[name="remote_directory"]'); + const filename=form?.querySelector('[name="file_name"]'); + const preview=document.getElementById('aiAudioRemotePreview'); + + const updatePreview=()=>{ + if(!preview)return; + const dir=(directory?.value||'').trim().replace(/\/+$/,''); + const file=(filename?.value||'').trim().replace(/^\/+/,''); + preview.textContent=(dir||'/')+(file?'/'+file:''); + }; + directory?.addEventListener('input',updatePreview); + filename?.addEventListener('input',updatePreview); + updatePreview(); + + document.querySelectorAll('[data-close-production]').forEach(button=>button.addEventListener('click',()=>{ + modal?.close(); + if(frame)frame.src='about:blank'; + })); + + form?.addEventListener('submit',event=>{ + const submitter=event.submitter; + if(!submitter)return; + const value=submitter.value||''; + if(action)action.value=value; + if(value==='produce_stream'){ + if(frame){ + frame.srcdoc='Der Produktionsauftrag wird an den Server übergeben …'; + } + modal?.showModal(); + form.setAttribute('aria-busy','true'); + setTimeout(()=>{submitter.disabled=true;submitter.dataset.originalText=submitter.textContent;submitter.textContent='Produktion läuft …'},0); + }else{ + setTimeout(()=>{submitter.disabled=true;submitter.textContent='Wird gespeichert …'},0); + } + }); + + window.addEventListener('message',event=>{ + if(event.origin!==location.origin||!event.data||event.data.type!=='landwelle-ai-production')return; + if(event.data.status==='done'){ + form?.removeAttribute('aria-busy'); + if(produce){produce.disabled=false;produce.textContent=produce.dataset.originalText||'Erzeugen & hochladen'} + }else if(event.data.status==='error'){ + form?.removeAttribute('aria-busy'); + if(produce){produce.disabled=false;produce.textContent=produce.dataset.originalText||'Erzeugen & hochladen'} + } + }); +}); diff --git a/web/assets/admin-ai-modules-v1.css b/web/assets/admin-ai-modules-v1.css new file mode 100644 index 0000000..5f1bde7 --- /dev/null +++ b/web/assets/admin-ai-modules-v1.css @@ -0,0 +1 @@ +.ai-module-page{display:grid;gap:22px}.ai-module-hero{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:20px;align-items:center;padding:28px;border-radius:18px;background:linear-gradient(135deg,#162019,#243225);color:#fff;box-shadow:0 18px 45px rgba(26,36,27,.16)}.ai-module-hero h1{margin:4px 0 8px;font-size:clamp(30px,4vw,48px)}.ai-module-hero p{max-width:760px;margin:0;color:#d9e3d6}.ai-module-icon{display:grid;place-items:center;width:66px;height:66px;border-radius:18px;background:#75b82a;color:#fff;font-size:30px;font-weight:900}.ai-module-status{padding:9px 13px;border-radius:999px;background:rgba(117,184,42,.16);border:1px solid rgba(185,236,106,.35);color:#c9f18c;font-size:12px;font-weight:900;text-transform:uppercase;white-space:nowrap}.ai-module-grid{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(280px,.7fr);gap:22px}.ai-module-empty{min-height:330px;display:grid;place-content:center;text-align:center;padding:34px}.ai-module-empty>span{font-size:46px;color:#75b82a}.ai-module-empty h3{margin:14px 0 8px;font-size:24px}.ai-module-empty p{max-width:620px;margin:0 auto;color:#687168;line-height:1.65}.ai-module-features{align-self:start}.ai-module-features ul{display:grid;gap:12px;padding:0;margin:22px 0;list-style:none}.ai-module-features li{display:flex;gap:10px;align-items:flex-start;padding:12px;border-radius:10px;background:#f2f7ed}.ai-module-features li i{display:grid;place-items:center;min-width:24px;height:24px;border-radius:50%;background:#75b82a;color:#fff;font-style:normal;font-weight:900}@media(max-width:900px){.ai-module-grid{grid-template-columns:1fr}.ai-module-hero{grid-template-columns:auto 1fr}.ai-module-status{grid-column:1/-1;justify-self:start}}@media(max-width:600px){.ai-module-hero{grid-template-columns:1fr;padding:22px}.ai-module-icon{width:54px;height:54px}.ai-module-hero h1{font-size:32px}} \ No newline at end of file diff --git a/web/assets/admin-ai-wishes-v1.css b/web/assets/admin-ai-wishes-v1.css new file mode 100644 index 0000000..883a823 --- /dev/null +++ b/web/assets/admin-ai-wishes-v1.css @@ -0,0 +1 @@ +.wish-audio-page{max-width:1500px}.wish-audio-hero{display:flex;justify-content:space-between;align-items:flex-end;gap:24px;margin-bottom:20px}.wish-audio-hero h1{margin:5px 0 7px;font-size:34px}.wish-audio-hero p{max-width:850px;margin:0;color:#617066}.wish-hero-actions{display:flex;gap:10px;flex-wrap:wrap}.wish-config-form{display:grid;gap:18px}.wish-master-card .admin-card-heading{align-items:flex-start}.wish-toggle-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.wish-check{display:flex;gap:12px;padding:15px;border:1px solid #dce6dc;border-radius:14px;background:#f8faf7;align-items:flex-start}.wish-check input{margin-top:4px}.wish-check span{display:grid;gap:4px}.wish-check small{color:#718078;line-height:1.45}.wish-config-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(340px,.85fr);gap:18px;align-items:start}.wish-prompt-card{grid-row:span 2}.wish-output-card{grid-column:1/2}.wish-status-card{grid-column:2/3}.wish-status-card ul{display:grid;gap:10px;padding:0;margin:14px 0 18px;list-style:none}.wish-status-card li{display:flex;justify-content:space-between;gap:12px;padding:12px 13px;border-radius:12px;background:#f5f7f4;border:1px solid #dfe7df}.wish-status-card li.ok{border-left:4px solid #71b52d}.wish-status-card li.warn{border-left:4px solid #d89f26}.wish-status-card li span{color:#6d7b72;text-align:right}.wish-status-card p,.wish-inline-note{color:#66746b;line-height:1.5}.wish-inline-note{margin-top:14px;padding:12px 14px;border-radius:12px;background:#f4f7f1}.wish-inline-note a{font-weight:700}.wish-savebar{position:sticky;bottom:14px;z-index:4;display:flex;justify-content:space-between;align-items:center;gap:20px;padding:16px 18px;border:1px solid #d9e5d7;border-radius:16px;background:rgba(255,255,255,.96);box-shadow:0 14px 40px rgba(23,45,28,.12);backdrop-filter:blur(12px)}.wish-savebar div{display:grid;gap:3px}.wish-savebar span{color:#6e7a72;font-size:13px}.wish-audio-page code{font-size:.92em;background:#eef3eb;padding:2px 5px;border-radius:5px}@media(max-width:1050px){.wish-config-grid{grid-template-columns:1fr}.wish-prompt-card,.wish-output-card,.wish-status-card{grid-column:auto;grid-row:auto}}@media(max-width:760px){.wish-audio-hero{align-items:flex-start;flex-direction:column}.wish-toggle-grid{grid-template-columns:1fr}.wish-savebar{position:static;align-items:stretch;flex-direction:column}.wish-savebar button{width:100%}} diff --git a/web/assets/admin-analytics-v1.css b/web/assets/admin-analytics-v1.css new file mode 100644 index 0000000..a1475ad --- /dev/null +++ b/web/assets/admin-analytics-v1.css @@ -0,0 +1 @@ +@import url('/assets/admin-site-content-v2.css');.analytics-admin{display:grid;gap:24px}.analytics-hero form label{display:grid;gap:6px;color:#dce8da}.analytics-hero select{padding:12px 42px 12px 14px;border:1px solid rgba(255,255,255,.24);border-radius:12px;background:#fff;color:#21331f;font:inherit;font-weight:800}.analytics-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:15px}.analytics-kpis article{padding:20px;border:1px solid #dce4d9;border-radius:18px;background:#fff}.analytics-kpis span,.analytics-kpis small{display:block;color:#71806e}.analytics-kpis strong{display:block;margin:8px 0;font-size:2rem;color:#213620}.analytics-exports{display:flex;gap:8px;flex-wrap:wrap}.analytics-exports a{padding:9px 11px;border:1px solid #cbd7c8;border-radius:9px;color:#37542f;text-decoration:none;font-weight:750}.analytics-legend{display:flex;gap:18px;margin-bottom:8px}.analytics-legend span{display:flex;align-items:center;gap:7px;color:#61705f}.analytics-legend i{width:24px;height:4px;border-radius:99px;background:#6a9e2d}.analytics-legend i.views{background:#243d26}.analytics-canvas-wrap{height:340px;min-height:260px}.analytics-canvas-wrap canvas{width:100%;height:100%;display:block}.analytics-detail-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(280px,.65fr);gap:24px}.analytics-side-stack{display:grid;gap:24px}.analytics-table-wrap{overflow:auto}.analytics-table-wrap table{width:100%;border-collapse:collapse}.analytics-table-wrap th,.analytics-table-wrap td{padding:12px 10px;border-bottom:1px solid #e2e8df;text-align:left}.analytics-table-wrap th{color:#748171;font-size:.72rem;text-transform:uppercase}.analytics-table-wrap td strong,.analytics-table-wrap td small{display:block}.analytics-table-wrap td small{margin-top:3px;color:#839080}.breakdown-list{display:grid;gap:8px}.breakdown-list>div{display:flex;justify-content:space-between;gap:12px;padding:11px 12px;border-radius:11px;background:#f2f5ef}.breakdown-list strong{color:#426f1d}.analytics-disclosure{padding:20px 22px;border:1px solid #d8e1d4;border-left:5px solid #729e3d;border-radius:15px;background:#f7faf5}.analytics-disclosure p{margin:7px 0 0;color:#5f6c5d;line-height:1.6}@media(max-width:1050px){.analytics-kpis{grid-template-columns:1fr 1fr}.analytics-detail-grid{grid-template-columns:1fr}}@media(max-width:650px){.analytics-kpis{grid-template-columns:1fr}.analytics-canvas-wrap{height:280px}} diff --git a/web/assets/admin-analytics-v1.js b/web/assets/admin-analytics-v1.js new file mode 100644 index 0000000..caa083a --- /dev/null +++ b/web/assets/admin-analytics-v1.js @@ -0,0 +1 @@ +(()=>{const canvas=document.querySelector('[data-analytics-chart]');if(!canvas)return;let rows=[];try{rows=JSON.parse(canvas.dataset.series||'[]')}catch{return}const draw=()=>{const ratio=window.devicePixelRatio||1,w=Math.max(320,canvas.clientWidth),h=Math.max(240,canvas.clientHeight);canvas.width=w*ratio;canvas.height=h*ratio;const c=canvas.getContext('2d');c.scale(ratio,ratio);c.clearRect(0,0,w,h);const pad={l:46,r:18,t:20,b:38},cw=w-pad.l-pad.r,ch=h-pad.t-pad.b,max=Math.max(1,...rows.map(x=>Math.max(x.visitors||0,x.pageviews||0)));c.font='12px system-ui';c.fillStyle='#778375';c.strokeStyle='#e0e6dd';c.lineWidth=1;for(let i=0;i<=4;i++){const y=pad.t+ch*i/4;c.beginPath();c.moveTo(pad.l,y);c.lineTo(w-pad.r,y);c.stroke();c.fillText(String(Math.round(max*(4-i)/4)),5,y+4)}if(!rows.length){c.fillText('Noch keine Messwerte für diesen Zeitraum.',pad.l+10,pad.t+40);return}const x=i=>pad.l+(rows.length===1?cw/2:cw*i/(rows.length-1)),y=v=>pad.t+ch-(v/max)*ch;const line=(field,color)=>{c.strokeStyle=color;c.lineWidth=3;c.lineJoin='round';c.lineCap='round';c.beginPath();rows.forEach((r,i)=>{const px=x(i),py=y(Number(r[field]||0));i?c.lineTo(px,py):c.moveTo(px,py)});c.stroke()};line('pageviews','#243d26');line('visitors','#6a9e2d');c.fillStyle='#778375';const step=Math.max(1,Math.ceil(rows.length/6));rows.forEach((r,i)=>{if(i%step===0||i===rows.length-1){const label=(r.date||'').slice(5).split('-').reverse().join('.');c.fillText(label,x(i)-14,h-12)}})};draw();window.addEventListener('resize',draw,{passive:true})})(); diff --git a/web/assets/admin-auto-tasks-v1.css b/web/assets/admin-auto-tasks-v1.css new file mode 100644 index 0000000..378a2a9 --- /dev/null +++ b/web/assets/admin-auto-tasks-v1.css @@ -0,0 +1 @@ +.auto-task-page{display:grid;gap:20px}.task-list{display:grid;gap:12px}.task-row{display:flex;justify-content:space-between;gap:20px;padding:18px;border:1px solid #dfe7df;border-radius:14px;background:#fff}.task-row>div:first-child{display:grid;gap:5px}.task-row>div:last-child{display:flex;align-items:center;gap:8px}.task-row form{margin:0}.task-error{color:#a32626}#taskModal{border:0;border-radius:18px;padding:0;width:min(620px,calc(100% - 32px));box-shadow:0 24px 80px #0005}#taskModal::backdrop{background:#10231799}.task-form{display:grid;gap:16px;padding:24px}.task-form header,.task-form footer{display:flex;align-items:center;justify-content:space-between;gap:12px}.task-form header button{border:0;background:none;font-size:28px}.task-form label{display:grid;gap:7px;font-weight:700}.task-form input,.task-form select{padding:12px;border:1px solid #cbd8cc;border-radius:10px}.day-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:8px}.day-grid label input{position:absolute;opacity:0}.day-grid span{display:block;text-align:center;padding:10px;border:1px solid #ccd8cd;border-radius:10px}.day-grid input:checked+span{background:#1f7a3f;color:white;border-color:#1f7a3f}.toggle{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center}@media(max-width:700px){.task-row{display:grid}.task-row>div:last-child{flex-wrap:wrap}.day-grid{grid-template-columns:repeat(4,1fr)}} diff --git a/web/assets/admin-auto-tasks-v1.js b/web/assets/admin-auto-tasks-v1.js new file mode 100644 index 0000000..ca9c184 --- /dev/null +++ b/web/assets/admin-auto-tasks-v1.js @@ -0,0 +1 @@ +(()=>{const d=document,m=d.getElementById('taskModal');if(!m)return;const open=(b)=>{d.getElementById('taskId').value=b?.dataset.id||'';d.getElementById('taskName').value=b?.dataset.name||'';d.getElementById('taskKey').value=b?.dataset.key||'news:news';d.getElementById('taskTime').value=b?.dataset.time||'08:00';d.getElementById('taskActive').checked=!b||b.dataset.active==='true';const days=(b?.dataset.days||'1,2,3,4,5,6,7').split(',');m.querySelectorAll('[name=days]').forEach(x=>x.checked=days.includes(x.value));d.getElementById('taskTitle').textContent=b?'Auto-Aufgabe bearbeiten':'Neue Auto-Aufgabe';m.showModal()};d.querySelector('[data-open-task]')?.addEventListener('click',()=>open());d.querySelectorAll('[data-edit-task]').forEach(b=>b.addEventListener('click',()=>open(b)));d.querySelectorAll('[data-close-task]').forEach(b=>b.addEventListener('click',()=>m.close()));})(); diff --git a/web/assets/admin-auto-tasks-v2.css b/web/assets/admin-auto-tasks-v2.css new file mode 100644 index 0000000..a31a350 --- /dev/null +++ b/web/assets/admin-auto-tasks-v2.css @@ -0,0 +1 @@ +.auto-task-page{display:grid;gap:20px}.task-list{display:grid;gap:12px}.task-row{display:flex;justify-content:space-between;gap:20px;padding:18px;border:1px solid #dfe7df;border-radius:14px;background:#fff}.task-row>div:first-child{display:grid;gap:5px}.task-row>div:last-child{display:flex;align-items:center;gap:8px}.task-row form{margin:0}.task-error{color:#a32626}#taskModal{border:0;border-radius:18px;padding:0;width:min(620px,calc(100% - 32px));box-shadow:0 24px 80px #0005}#taskModal::backdrop{background:#10231799}.task-form{display:grid;gap:16px;padding:24px}.task-form header,.task-form footer{display:flex;align-items:center;justify-content:space-between;gap:12px}.task-form header button{border:0;background:none;font-size:28px}.task-form label{display:grid;gap:7px;font-weight:700}.task-form input,.task-form select{padding:12px;border:1px solid #cbd8cc;border-radius:10px}.day-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:8px}.day-grid label input{position:absolute;opacity:0}.day-grid span{display:block;text-align:center;padding:10px;border:1px solid #ccd8cd;border-radius:10px}.day-grid input:checked+span{background:#1f7a3f;color:white;border-color:#1f7a3f}.toggle{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center}.cron-control-card{display:grid;gap:18px;border-left:4px solid #8a968c}.cron-health-ok{border-left-color:#20884a}.cron-health-warning{border-left-color:#c78a13}.cron-health-error{border-left-color:#b83a36}.cron-heading{align-items:center}.cron-health-badge{display:inline-flex;align-items:center;padding:7px 11px;border-radius:999px;font-weight:800;font-size:13px;background:#edf1ed;color:#3b4b40}.cron-health-ok .cron-health-badge{background:#e6f5ea;color:#176c38}.cron-health-warning .cron-health-badge{background:#fff3d8;color:#82570b}.cron-health-error .cron-health-badge{background:#fde8e7;color:#8f2926}.cron-health-text{margin:0;color:#4b5b50;line-height:1.55}.cron-status-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.cron-status-grid article{display:grid;gap:5px;padding:14px;border:1px solid #dfe7df;border-radius:13px;background:#f8faf8;min-width:0}.cron-status-grid small,.cron-endpoints small{color:#657369;font-size:12px;font-weight:700}.cron-status-grid strong{font-size:15px}.cron-status-grid span{font-size:12px;color:#657369;line-height:1.4}.cron-status-grid code{font-size:13px}.cron-endpoints{display:grid;grid-template-columns:1fr 1fr;gap:12px}.cron-endpoints>div{display:grid;gap:7px;min-width:0}.cron-endpoints code,.cron-command-row code{display:block;padding:11px 12px;border-radius:10px;background:#14251a;color:#e9f5ec;overflow-wrap:anywhere;word-break:break-word;font-size:12px;line-height:1.5}.cron-command-box{padding:14px;border:1px solid #dce5dd;border-radius:13px;background:#fafcf9}.cron-command-box summary{cursor:pointer;font-weight:800}.cron-command-box p{color:#58675d;line-height:1.5}.cron-command-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:start}.cron-run-error,.cron-setup-warning{display:grid;gap:5px;padding:13px 14px;border-radius:12px}.cron-run-error{background:#fdebea;color:#8f2725}.cron-setup-warning{background:#fff3d8;color:#77520f}.cron-setup-warning p{margin:0;line-height:1.5}.cron-verification-note{margin:0;padding-top:4px;color:#56655b;font-size:13px;line-height:1.55}.cron-verification-note strong{color:#263b2d}@media(max-width:900px){.cron-status-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.cron-endpoints{grid-template-columns:1fr}}@media(max-width:700px){.task-row{display:grid}.task-row>div:last-child{flex-wrap:wrap}.day-grid{grid-template-columns:repeat(4,1fr)}.cron-status-grid{grid-template-columns:1fr}.cron-command-row{grid-template-columns:1fr}.cron-command-row button{justify-self:start}} diff --git a/web/assets/admin-auto-tasks-v2.js b/web/assets/admin-auto-tasks-v2.js new file mode 100644 index 0000000..c02d8c9 --- /dev/null +++ b/web/assets/admin-auto-tasks-v2.js @@ -0,0 +1 @@ +(()=>{const d=document,m=d.getElementById('taskModal');if(m){const open=(b)=>{d.getElementById('taskId').value=b?.dataset.id||'';d.getElementById('taskName').value=b?.dataset.name||'';d.getElementById('taskKey').value=b?.dataset.key||'news:news';d.getElementById('taskTime').value=b?.dataset.time||'08:00';d.getElementById('taskActive').checked=!b||b.dataset.active==='true';const days=(b?.dataset.days||'1,2,3,4,5,6,7').split(',');m.querySelectorAll('[name=days]').forEach(x=>x.checked=days.includes(x.value));d.getElementById('taskTitle').textContent=b?'Auto-Aufgabe bearbeiten':'Neue Auto-Aufgabe';m.showModal()};d.querySelector('[data-open-task]')?.addEventListener('click',()=>open());d.querySelectorAll('[data-edit-task]').forEach(b=>b.addEventListener('click',()=>open(b)));d.querySelectorAll('[data-close-task]').forEach(b=>b.addEventListener('click',()=>m.close()))}d.querySelector('[data-copy-cron]')?.addEventListener('click',async e=>{const code=d.getElementById('cronCommand');if(!code)return;try{await navigator.clipboard.writeText(code.textContent||'');const b=e.currentTarget,old=b.textContent;b.textContent='Kopiert';setTimeout(()=>b.textContent=old,1600)}catch{}})})(); diff --git a/web/assets/admin-auto-tasks-v4.css b/web/assets/admin-auto-tasks-v4.css new file mode 100644 index 0000000..a31a350 --- /dev/null +++ b/web/assets/admin-auto-tasks-v4.css @@ -0,0 +1 @@ +.auto-task-page{display:grid;gap:20px}.task-list{display:grid;gap:12px}.task-row{display:flex;justify-content:space-between;gap:20px;padding:18px;border:1px solid #dfe7df;border-radius:14px;background:#fff}.task-row>div:first-child{display:grid;gap:5px}.task-row>div:last-child{display:flex;align-items:center;gap:8px}.task-row form{margin:0}.task-error{color:#a32626}#taskModal{border:0;border-radius:18px;padding:0;width:min(620px,calc(100% - 32px));box-shadow:0 24px 80px #0005}#taskModal::backdrop{background:#10231799}.task-form{display:grid;gap:16px;padding:24px}.task-form header,.task-form footer{display:flex;align-items:center;justify-content:space-between;gap:12px}.task-form header button{border:0;background:none;font-size:28px}.task-form label{display:grid;gap:7px;font-weight:700}.task-form input,.task-form select{padding:12px;border:1px solid #cbd8cc;border-radius:10px}.day-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:8px}.day-grid label input{position:absolute;opacity:0}.day-grid span{display:block;text-align:center;padding:10px;border:1px solid #ccd8cd;border-radius:10px}.day-grid input:checked+span{background:#1f7a3f;color:white;border-color:#1f7a3f}.toggle{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center}.cron-control-card{display:grid;gap:18px;border-left:4px solid #8a968c}.cron-health-ok{border-left-color:#20884a}.cron-health-warning{border-left-color:#c78a13}.cron-health-error{border-left-color:#b83a36}.cron-heading{align-items:center}.cron-health-badge{display:inline-flex;align-items:center;padding:7px 11px;border-radius:999px;font-weight:800;font-size:13px;background:#edf1ed;color:#3b4b40}.cron-health-ok .cron-health-badge{background:#e6f5ea;color:#176c38}.cron-health-warning .cron-health-badge{background:#fff3d8;color:#82570b}.cron-health-error .cron-health-badge{background:#fde8e7;color:#8f2926}.cron-health-text{margin:0;color:#4b5b50;line-height:1.55}.cron-status-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.cron-status-grid article{display:grid;gap:5px;padding:14px;border:1px solid #dfe7df;border-radius:13px;background:#f8faf8;min-width:0}.cron-status-grid small,.cron-endpoints small{color:#657369;font-size:12px;font-weight:700}.cron-status-grid strong{font-size:15px}.cron-status-grid span{font-size:12px;color:#657369;line-height:1.4}.cron-status-grid code{font-size:13px}.cron-endpoints{display:grid;grid-template-columns:1fr 1fr;gap:12px}.cron-endpoints>div{display:grid;gap:7px;min-width:0}.cron-endpoints code,.cron-command-row code{display:block;padding:11px 12px;border-radius:10px;background:#14251a;color:#e9f5ec;overflow-wrap:anywhere;word-break:break-word;font-size:12px;line-height:1.5}.cron-command-box{padding:14px;border:1px solid #dce5dd;border-radius:13px;background:#fafcf9}.cron-command-box summary{cursor:pointer;font-weight:800}.cron-command-box p{color:#58675d;line-height:1.5}.cron-command-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:start}.cron-run-error,.cron-setup-warning{display:grid;gap:5px;padding:13px 14px;border-radius:12px}.cron-run-error{background:#fdebea;color:#8f2725}.cron-setup-warning{background:#fff3d8;color:#77520f}.cron-setup-warning p{margin:0;line-height:1.5}.cron-verification-note{margin:0;padding-top:4px;color:#56655b;font-size:13px;line-height:1.55}.cron-verification-note strong{color:#263b2d}@media(max-width:900px){.cron-status-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.cron-endpoints{grid-template-columns:1fr}}@media(max-width:700px){.task-row{display:grid}.task-row>div:last-child{flex-wrap:wrap}.day-grid{grid-template-columns:repeat(4,1fr)}.cron-status-grid{grid-template-columns:1fr}.cron-command-row{grid-template-columns:1fr}.cron-command-row button{justify-self:start}} diff --git a/web/assets/admin-auto-tasks-v4.js b/web/assets/admin-auto-tasks-v4.js new file mode 100644 index 0000000..3b1e7fa --- /dev/null +++ b/web/assets/admin-auto-tasks-v4.js @@ -0,0 +1 @@ +(()=>{const d=document,m=d.getElementById('taskModal');if(m){const open=(b)=>{d.getElementById('taskId').value=b?.dataset.id||'';d.getElementById('taskName').value=b?.dataset.name||'';const raw=b?.dataset.key||'news:news';d.getElementById('taskKey').value=['news:news','news:sport','news:weather'].includes(raw)?raw:'news:news';d.getElementById('taskTime').value=b?.dataset.time||'08:00';d.getElementById('taskActive').checked=!b||b.dataset.active==='true';const days=(b?.dataset.days||'1,2,3,4,5,6,7').split(',');m.querySelectorAll('[name=days]').forEach(x=>x.checked=days.includes(x.value));d.getElementById('taskTitle').textContent=b?'Auto-Aufgabe bearbeiten':'Neue Auto-Aufgabe';m.showModal()};d.querySelector('[data-open-task]')?.addEventListener('click',()=>open());d.querySelectorAll('[data-edit-task]').forEach(b=>b.addEventListener('click',()=>open(b)));d.querySelectorAll('[data-close-task]').forEach(b=>b.addEventListener('click',()=>m.close()))}d.querySelector('[data-copy-cron]')?.addEventListener('click',async e=>{const code=d.getElementById('cronCommand');if(!code)return;try{await navigator.clipboard.writeText(code.textContent||'');const b=e.currentTarget,old=b.textContent;b.textContent='Kopiert';setTimeout(()=>b.textContent=old,1600)}catch{}})})(); diff --git a/web/assets/admin-charts-v7.css b/web/assets/admin-charts-v7.css new file mode 100644 index 0000000..9708256 --- /dev/null +++ b/web/assets/admin-charts-v7.css @@ -0,0 +1,29 @@ +.charts-admin-shell{display:grid;gap:22px;max-width:1580px;margin:0 auto;color:var(--lw-text)} +.charts-heading{margin-bottom:0}.charts-heading h1{margin-bottom:9px}.chart-load-error{margin:0} +.chart-import-status{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}.chart-import-status article{display:grid;gap:4px;padding:16px 18px;border:1px solid var(--lw-line);border-radius:15px;background:#fff;box-shadow:0 8px 24px rgba(15,25,16,.035)}.chart-import-status span{color:var(--lw-muted);font-size:.72rem;font-weight:750}.chart-import-status strong{font-size:1.45rem;letter-spacing:-.04em;color:var(--lw-green-dark)} +.chart-tabs{display:flex;gap:8px;flex-wrap:wrap;padding:7px;border:1px solid var(--lw-line);border-radius:15px;background:#fff;box-shadow:0 8px 24px rgba(15,25,16,.03)}.chart-tabs a{display:inline-flex;align-items:center;min-height:42px;padding:0 16px;border:1px solid transparent;border-radius:10px;color:#536057;text-decoration:none;font-size:.84rem;font-weight:800;transition:.18s}.chart-tabs a:hover{background:#f1f6ee;color:var(--lw-green-dark)}.chart-tabs a.is-active{border-color:#cbe9d3;background:linear-gradient(135deg,var(--lw-green),#0b8739);color:#fff;box-shadow:0 8px 18px rgba(18,145,59,.2)} +.chart-toolbar{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;flex-wrap:wrap}.chart-section-intro{display:grid;gap:3px;padding:2px 0}.chart-section-intro>strong{font-size:1.08rem}.chart-section-intro>small{color:var(--lw-muted)} +.chart-create{min-width:min(100%,330px);border:1px solid #cfe4d2;border-radius:14px;background:#f6fbf5;overflow:hidden}.chart-create>summary{cursor:pointer;list-style:none;padding:12px 16px;color:var(--lw-green-dark);font-weight:850}.chart-create>summary::-webkit-details-marker{display:none}.chart-create[open]{width:min(100%,1040px);padding-bottom:16px;background:#fff;box-shadow:var(--lw-shadow)}.chart-create form{padding:0 16px}.chart-create-grid{display:grid;grid-template-columns:repeat(3,minmax(180px,1fr));gap:12px;margin:10px 0 15px}.chart-create-grid label,.annual-toolbar label{display:grid;gap:6px}.chart-create-grid span,.annual-toolbar label span{font-size:.76rem;color:#59635b;font-weight:800}.chart-create input,.annual-toolbar select{width:100%;box-sizing:border-box;border:1px solid #d9e1d8;border-radius:10px;background:#fff;color:var(--lw-text);padding:10px 11px}.chart-create input:focus,.annual-toolbar select:focus{outline:3px solid rgba(24,168,75,.13);border-color:var(--lw-green)} +.chart-primary,.chart-secondary,.chart-danger,.year-actions button{border:0;border-radius:10px;padding:10px 14px;font-weight:850;cursor:pointer}.chart-primary{background:linear-gradient(135deg,var(--lw-green),var(--lw-green-dark));color:#fff}.chart-secondary{border:1px solid var(--lw-line);background:#fff;color:#344038}.chart-danger{background:#fff0ef;color:#a62a20} +.chart-usage-note{display:grid;grid-template-columns:auto minmax(0,1fr) auto minmax(0,1fr);gap:7px 12px;align-items:center;padding:13px 16px;border:1px solid #d9e8d8;border-radius:13px;background:#f7fbf5;color:#566158;font-size:.79rem}.chart-usage-note strong{color:var(--lw-green-dark)} +.chart-panel{overflow:hidden;border:1px solid var(--lw-line);border-radius:17px;background:#fff;box-shadow:0 12px 34px rgba(16,28,17,.055)}.chart-panel-top{border-color:#cfe7d2}.chart-panel>header{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:18px 20px;border-bottom:1px solid var(--lw-line);background:linear-gradient(180deg,#fbfdfb,#f5f8f4)}.chart-panel h2{margin:0 0 4px;font-size:1.08rem}.chart-panel header p{margin:0;color:var(--lw-muted);font-size:.82rem}.chart-panel>header>span{padding:7px 11px;border:1px solid #d8e3d7;border-radius:999px;background:#fff;color:#657067;font-size:.72rem;font-weight:800} +.chart-grid-wrap{overflow-x:auto;padding:10px;scrollbar-color:#a8b9a7 #f2f5f1}.chart-grid-head,.chart-editor-row{display:grid;grid-template-columns:86px minmax(180px,1.2fr) minmax(205px,1.35fr) 62px 76px minmax(240px,1.55fr) 72px 80px 118px 72px 72px;gap:9px;align-items:center;min-width:1280px}.chart-grid-head{padding:11px 9px;border-radius:10px;background:#17341f;color:#f3fff5;font-size:.67rem;font-weight:850;line-height:1.12}.chart-editor-row{position:relative;padding:9px;border-bottom:1px solid #edf0ec;transition:background .18s,box-shadow .18s}.chart-editor-row:last-child{border-bottom:0}.chart-editor-row:hover{background:#f8fbf7}.chart-editor-row.is-saving{background:#fffbea;box-shadow:inset 3px 0 #d9a400}.chart-editor-row.is-saved{background:#f0faef;box-shadow:inset 3px 0 var(--lw-green)}.chart-editor-row.is-error{background:#fff1ef;box-shadow:inset 3px 0 #c43b2d} +.chart-editor-row input{min-width:0;width:100%;box-sizing:border-box;border:1px solid #dbe2da;border-radius:7px;background:#fff;color:var(--lw-text);padding:7px 8px;font-size:.75rem}.chart-editor-row input:focus,.year-chart-row input:focus{outline:3px solid rgba(24,168,75,.12);border-color:var(--lw-green)}.chart-editor-row .chart-number{justify-self:center;width:62px;text-align:center;padding-left:7px;padding-right:7px;font-size:.82rem;font-weight:750;font-variant-numeric:tabular-nums}.chart-editor-row .chart-year-input{width:66px}.chart-position{display:flex;gap:4px;align-items:center}.chart-position .chart-position-input{width:54px;font-size:.88rem;font-weight:900;font-variant-numeric:tabular-nums}.chart-drag{color:#9aa49c}.chart-cover-cell{position:relative;display:grid;place-items:center;height:40px}.chart-cover-cell img,.chart-cover-cell>span{width:38px;height:38px;border-radius:7px;object-fit:cover;background:#edf2ec;display:grid;place-items:center;color:var(--lw-green-dark)} +.chart-actions-cell{display:flex;gap:6px;justify-content:center}.chart-action{width:30px;height:30px;border:1px solid #d7dfd6;border-radius:8px;background:#fff;color:#3e4941;font-weight:900;cursor:pointer}.chart-action:hover{border-color:#91b996;background:#f1f8ef}.chart-action.is-auto{border-color:#b9dfc2;background:#eaf8ee;color:var(--lw-green-dark)}.chart-action.is-clear{border-color:#ead5aa;background:#fff8e7;color:#8b640c}.chart-action:disabled{opacity:.55;cursor:wait}.chart-year-month{display:grid;grid-template-columns:66px auto 48px;gap:3px;align-items:center}.chart-empty{margin:0;padding:30px;color:var(--lw-muted);text-align:center} +.chart-notification-stack{position:fixed;z-index:1200;right:22px;bottom:22px;display:grid;gap:9px;pointer-events:none}.chart-notification{display:grid;gap:2px;width:min(360px,calc(100vw - 32px));padding:12px 15px;border:1px solid #cce0cc;border-radius:12px;background:#fff;box-shadow:0 16px 45px rgba(20,33,21,.2);opacity:0;transform:translateY(8px);transition:.2s}.chart-notification.is-visible{opacity:1;transform:none}.chart-notification strong{font-size:.78rem;color:var(--lw-green-dark)}.chart-notification span{font-size:.78rem;color:#566158}.chart-notification.is-error{border-color:#efc4c0;background:#fff7f6}.chart-notification.is-error strong{color:#a52f25} +.chart-archive-list{display:grid;gap:9px;padding:14px}.chart-archive-list article{display:grid;grid-template-columns:58px 1fr auto;gap:14px;align-items:center;padding:12px;border:1px solid var(--lw-line);border-radius:12px;background:#fbfcfb}.chart-archive-list img,.archive-cover{width:56px;height:56px;border-radius:10px;object-fit:cover;background:#edf2ec;display:grid;place-items:center}.chart-archive-list h3{margin:3px 0;font-size:.95rem}.chart-archive-list p,.chart-archive-list small{margin:0;color:var(--lw-muted)}.chart-archive-list form{display:flex;gap:8px;align-items:center}.restored-badge{padding:8px;border-radius:8px;background:var(--lw-green-soft);color:var(--lw-green-dark);font-size:.75rem} +.annual-toolbar form{display:flex;gap:10px;align-items:end}.annual-toolbar select{min-width:250px}.year-chart-list{overflow-x:auto;padding:10px}.year-chart-head,.year-chart-row{display:grid;grid-template-columns:72px minmax(180px,1.1fr) minmax(200px,1.2fr) 68px minmax(180px,1.2fr) 80px 120px 80px 80px 150px;gap:9px;align-items:center;min-width:1250px}.year-chart-head{padding:11px;border-radius:10px;background:#17341f;color:#fff;font-size:.68rem;font-weight:850}.year-chart-row{padding:10px 9px;border-bottom:1px solid #edf0ec}.year-chart-row:hover{background:#f8fbf7}.year-chart-row input{width:100%;min-width:0;box-sizing:border-box;border:1px solid #dbe2da;border-radius:8px;background:#fff;color:var(--lw-text);padding:8px}.year-actions{display:flex;gap:5px}.year-actions button{padding:8px;font-size:.7rem;background:#eef5ec;color:#2f4a34}.year-actions .chart-danger{background:#fff0ef;color:#a62a20} +@media(max-width:1180px){.chart-import-status{grid-template-columns:repeat(3,minmax(0,1fr))}} +@media(max-width:900px){.chart-create-grid{grid-template-columns:1fr}.chart-panel>header{align-items:flex-start}.chart-toolbar{display:grid}.chart-create,.chart-create[open]{width:100%}.chart-usage-note{grid-template-columns:auto 1fr}.chart-archive-list article{grid-template-columns:50px 1fr}.chart-archive-list form{grid-column:1/-1}.annual-toolbar form{align-items:stretch;flex-direction:column}.annual-toolbar select{min-width:0}} +@media(max-width:650px){.chart-import-status{grid-template-columns:repeat(2,minmax(0,1fr))}.chart-tabs{display:grid;grid-template-columns:1fr 1fr}.chart-tabs a{justify-content:center;padding:0 10px}.chart-import-status article:last-child{grid-column:1/-1}.chart-notification-stack{right:16px;bottom:16px}} +.chart-toolbar-actions{display:flex;align-items:flex-start;justify-content:flex-end;gap:10px;flex-wrap:wrap}.chart-generate,.chart-info-generate{min-height:43px;border:1px solid #a9d7b3;border-radius:12px;padding:0 17px;background:linear-gradient(135deg,#effbef,#def4e2);color:var(--lw-green-dark);font-weight:900;cursor:pointer;box-shadow:0 8px 20px rgba(19,94,40,.08)}.chart-generate:hover,.chart-info-generate:hover{border-color:var(--lw-green);transform:translateY(-1px)}.chart-generate:disabled,.chart-info-generate:disabled{opacity:.48;cursor:not-allowed;transform:none} +.chart-generation-note{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:13px 16px;border:1px solid #d9e8d8;border-radius:13px;background:linear-gradient(135deg,#f8fcf6,#eef7eb);font-size:.8rem;color:#566158}.chart-generation-note strong{color:var(--lw-green-dark)}.chart-generation-note progress{width:min(360px,100%);height:10px;margin-left:auto;accent-color:var(--lw-green)} +.chart-sort-zone{min-height:48px}.chart-sort-zone.is-drag-over{background:#f1f9ee}.chart-editor-row[draggable="true"]{cursor:default}.chart-editor-row.is-dragging{opacity:.42;background:#eaf7e8;border:1px dashed var(--lw-green);box-shadow:0 12px 24px rgba(18,112,44,.12)}.chart-drag{display:grid;place-items:center;width:25px;height:29px;border:0;border-radius:7px;background:#edf4eb;color:#4e6b53;cursor:grab;font-weight:900}.chart-drag:active{cursor:grabbing} +.chart-panel-preview{border-color:#d7e3c9}.chart-panel-preview>header{background:linear-gradient(180deg,#fbfdf8,#f5f9ef)} +.chart-grid-head.is-annual,.chart-editor-row.is-annual{grid-template-columns:86px minmax(180px,1.2fr) minmax(205px,1.35fr) 62px 76px minmax(250px,1.6fr) 72px 118px 72px 72px}.chart-editor-row.is-annual{min-width:1200px}.chart-grid-head.is-annual{min-width:1200px} +.chart-main-toolbar{align-items:flex-start}.chart-create[open]{position:relative;z-index:4}.chart-info-generate{background:linear-gradient(135deg,#fff8d9,#f1ecc2);border-color:#dfd28d;color:#67560a} +@media(max-width:900px){.chart-toolbar-actions{width:100%;justify-content:stretch}.chart-toolbar-actions>.chart-generate,.chart-toolbar-actions>.chart-info-generate{flex:1}.chart-generation-note progress{width:100%;margin-left:0}} + +.chart-editor-row input[inputmode="numeric"],.year-chart-row input[inputmode="numeric"],.chart-create input[inputmode="numeric"]{font-variant-numeric:tabular-nums} + +.chart-evaluation{display:grid;justify-items:center;align-content:center;gap:2px;min-height:42px;padding:5px 4px;border:1px solid #d6e3d5;border-radius:8px;background:#f3f8f1;color:var(--lw-green-dark);font-variant-numeric:tabular-nums;text-align:center}.chart-evaluation strong{font-size:.9rem;line-height:1}.chart-evaluation small{font-size:.56rem;line-height:1.1;color:#6b776d;white-space:nowrap}.chart-editor-row.is-saving .chart-evaluation{opacity:.72} diff --git a/web/assets/admin-charts-v7.js b/web/assets/admin-charts-v7.js new file mode 100644 index 0000000..2b6e835 --- /dev/null +++ b/web/assets/admin-charts-v7.js @@ -0,0 +1,160 @@ +(()=>{ + const shell=document.querySelector('[data-chart-admin]'); + if(!shell)return; + const notices=document.querySelector('[data-chart-notifications]'); + const csrf=shell.dataset.csrf||''; + const chartKey=shell.dataset.chartKey||'listener'; + const chartYear=Number(shell.dataset.chartYear||0); + const timers=new WeakMap(); + const requests=new WeakMap(); + let dragged=null; + let reordering=false; + + function notify(message,type='success'){ + if(!notices)return; + const item=document.createElement('div'); + item.className=`chart-notification is-${type}`; + item.setAttribute('role',type==='error'?'alert':'status'); + const title=document.createElement('strong');title.textContent=type==='error'?'Nicht gespeichert':'Gespeichert'; + const text=document.createElement('span');text.textContent=message; + item.append(title,text);notices.appendChild(item); + requestAnimationFrame(()=>item.classList.add('is-visible')); + setTimeout(()=>{item.classList.remove('is-visible');setTimeout(()=>item.remove(),220)},type==='error'?6500:3200); + } + function messageFrom(payload,fallback){return (typeof payload?.error==='string'?payload.error:payload?.error?.message)||payload?.message||fallback;} + function position(row){return Number(row.querySelector('[name="position"]')?.value||row.dataset.position||0);} + function setState(row,state){row.classList.remove('is-saving','is-saved','is-error');if(state)row.classList.add(`is-${state}`);} + function rows(){return [...document.querySelectorAll('[data-chart-row]')];} + function formPayload(row,action){const data=new FormData(row);if(action)data.set('action',action);return data;} + function applyVotingSummary(row,payload){ + if(!row||!payload)return; + if(payload.vote_points!==undefined&&payload.vote_points!==null){const total=row.querySelector('[data-chart-vote-total]');if(total)total.textContent=String(payload.vote_points);} + if(payload.vote_count!==undefined&&payload.vote_count!==null){const count=row.querySelector('.chart-evaluation small');if(count)count.textContent=`${payload.vote_count} Online-Stimmen`;} + } + + async function saveRow(row,{action='',message=true}={}){ + clearTimeout(timers.get(row)); + const old=requests.get(row);if(old)old.abort(); + const controller=new AbortController();requests.set(row,controller);setState(row,'saving'); + try{ + const response=await fetch('/admin/api/charts/autosave',{method:'POST',body:formPayload(row,action),credentials:'same-origin',headers:{Accept:'application/json','X-Requested-With':'XMLHttpRequest'},signal:controller.signal}); + const payload=await response.json().catch(()=>({})); + if(!response.ok||payload.ok===false)throw new Error(messageFrom(payload,'Die Änderung konnte nicht gespeichert werden.')); + setState(row,'saved');setTimeout(()=>setState(row,''),1100); + row.dataset.position=String(position(row)); + applyVotingSummary(row,payload); + if(message)notify(payload.message||`Position ${position(row)} wurde gespeichert.`); + return payload; + }catch(error){ + if(error?.name==='AbortError')return null; + setState(row,'error');notify(`Position ${position(row)||'?'}: ${error?.message||'Speichern fehlgeschlagen.'}`,'error');return null; + } + } + function queueSave(row,delay=650){if(reordering)return;clearTimeout(timers.get(row));timers.set(row,setTimeout(()=>saveRow(row),delay));} + + function youtubeID(raw){ + const value=(raw||'').trim();if(/^[A-Za-z0-9_-]{11}$/.test(value))return value; + try{const u=new URL(value,location.origin);const host=u.hostname.toLowerCase().replace(/^www\./,'');if(host==='youtu.be')return u.pathname.split('/').filter(Boolean)[0]||'';if(['youtube.com','m.youtube.com','music.youtube.com','youtube-nocookie.com'].includes(host)){const q=u.searchParams.get('v');if(q)return q;const p=u.pathname.split('/').filter(Boolean);if(['embed','shorts','live'].includes(p[0]))return p[1]||'';}}catch{} + return ''; + } + function updateCover(row,url){ + const cell=row.querySelector('[data-chart-cover]'),hidden=row.querySelector('[name="cover_url"]');if(hidden)hidden.value=url||'';if(!cell)return; + let img=cell.querySelector('img'),empty=cell.querySelector('span'); + if(url){if(!img){img=document.createElement('img');img.loading='lazy';img.alt='Cover';cell.prepend(img)}img.src=url;if(empty)empty.remove();} + else{img?.remove();if(!empty){empty=document.createElement('span');empty.textContent='♪';cell.prepend(empty)}} + } + function applyYouTube(row){const store=row.querySelector('[name="store_url"]'),id=youtubeID(store?.value||'');if(!id)return false;const preview=row.querySelector('[name="preview_url"]');if(preview)preview.value=store.value.trim();updateCover(row,`https://i.ytimg.com/vi/${id}/hqdefault.jpg`);return true;} + async function autoFill(row,button){ + const artist=row.querySelector('[name="artist"]')?.value.trim()||'',title=row.querySelector('[name="title"]')?.value.trim()||'',store=row.querySelector('[name="store_url"]')?.value.trim()||''; + if(!artist||!title){notify(`Position ${position(row)}: Interpret und Titel werden für Auto benötigt.`,'error');return;} + const original=button.textContent;button.disabled=true;button.textContent='…';setState(row,'saving'); + try{ + const query=new URLSearchParams({artist,title,fallback_url:store}); + const response=await fetch(`/admin/api/charts/lookup-meta?${query}`,{credentials:'same-origin',headers:{Accept:'application/json','X-Requested-With':'XMLHttpRequest'}}); + const payload=await response.json().catch(()=>({}));if(!response.ok||payload.ok===false)throw new Error(messageFrom(payload,'Keine automatischen Daten gefunden.')); + const data=payload.data||{};if(data.store_url)row.querySelector('[name="store_url"]').value=data.store_url;if(data.preview_url)row.querySelector('[name="preview_url"]').value=data.preview_url;if(data.cover_url)updateCover(row,data.cover_url); + const year=row.querySelector('[name="entry_year"]'),month=row.querySelector('[name="entry_month"]');if(data.entry_year&&Number(year?.value||0)===0)year.value=data.entry_year;if(data.entry_month&&Number(month?.value||0)===0)month.value=data.entry_month; + if(await saveRow(row,{message:false}))notify(`Position ${position(row)} wurde automatisch ergänzt und gespeichert.`); + }catch(error){setState(row,'error');notify(`Position ${position(row)}: ${error.message||'Auto fehlgeschlagen.'}`,'error');} + finally{button.disabled=false;button.textContent=original;} + } + async function clearRow(row){ + const pos=position(row);if(!confirm(`Nur die Eingaben in Position ${pos} leeren? Die Zeile und ihre Position bleiben erhalten.`))return; + const annual=row.dataset.annual==='1'; + const fields=['artist','title','store_url','preview_url','cover_url','manual_points','fixed_points','entry_year','entry_month','current_week_position','previous_week_position','weeks']; + fields.forEach(name=>{const input=row.querySelector(`[name="${name}"]`);if(input)input.value='';}); + updateCover(row,''); + const result=await saveRow(row,{action:annual?'reset_year':'reset',message:false}); + if(!result)return; + const total=row.querySelector('[data-chart-vote-total]');if(total)total.textContent='0'; + const count=row.querySelector('.chart-evaluation small');if(count)count.textContent='0 Online-Stimmen'; + notify(`Position ${pos}: Die Eingabefelder dieser Zeile wurden geleert.`); + } + + function chartZones(){return [...document.querySelectorAll('[data-chart-zone]')];} + function normalizeZones(preferredOrder){ + const zones=chartZones(); + const ordered=preferredOrder||zones.flatMap(zone=>[...zone.querySelectorAll(':scope > [data-chart-row]')]); + let cursor=0; + zones.forEach(zone=>{ + const start=Number(zone.dataset.start||1),end=Number(zone.dataset.end||200),capacity=Math.max(0,end-start+1); + ordered.slice(cursor,cursor+capacity).forEach((row,index)=>{ + zone.appendChild(row);const pos=start+index;row.dataset.position=String(pos);const input=row.querySelector('[name="position"]');if(input)input.value=String(pos); + }); + cursor+=capacity; + }); + } + function allOrder(){return rows().map(row=>({id:Number(row.dataset.id||row.querySelector('[name="id"]')?.value||0),position:position(row)})).filter(item=>item.id>0&&item.position>0);} + async function persistOrder(successMessage='Die neue Reihenfolge wurde gespeichert.'){ + normalizeZones();const order=allOrder();if(!order.length)return; + rows().forEach(row=>setState(row,'saving')); + try{ + const response=await fetch('/admin/api/charts/reorder',{method:'POST',credentials:'same-origin',headers:{'Content-Type':'application/json',Accept:'application/json','X-CSRF-Token':csrf},body:JSON.stringify({chart_key:chartKey,chart_year:chartYear,order})}); + const payload=await response.json().catch(()=>({}));if(!response.ok||payload.ok===false)throw new Error(messageFrom(payload,'Reihenfolge konnte nicht gespeichert werden.')); + rows().forEach(row=>{setState(row,'saved');setTimeout(()=>setState(row,''),1000)});notify(successMessage); + }catch(error){rows().forEach(row=>setState(row,'error'));notify(error.message||'Reihenfolge konnte nicht gespeichert werden.','error');setTimeout(()=>location.reload(),1400);} + } + function targetZoneFor(positionValue){return [...document.querySelectorAll('[data-chart-zone]')].find(zone=>positionValue>=Number(zone.dataset.start||1)&&positionValue<=Number(zone.dataset.end||200));} + async function moveToPosition(row,newPosition){ + if(!targetZoneFor(newPosition)){notify(`Position ${newPosition} liegt außerhalb dieses Charts.`,'error');row.querySelector('[name="position"]').value=row.dataset.position;return;} + reordering=true;const ordered=rows().filter(item=>item!==row);const index=Math.max(0,Math.min(ordered.length,newPosition-1));ordered.splice(index,0,row);normalizeZones(ordered);reordering=false;await persistOrder(`Position ${newPosition} wurde gespeichert.`); + } + + document.querySelectorAll('[data-chart-zone]').forEach(zone=>{ + zone.addEventListener('dragenter',()=>{if(dragged)zone.classList.add('is-drag-over');}); + zone.addEventListener('dragleave',event=>{if(!zone.contains(event.relatedTarget))zone.classList.remove('is-drag-over');}); + zone.addEventListener('dragover',event=>{if(!dragged)return;event.preventDefault();event.dataTransfer.dropEffect='move';const candidates=[...zone.querySelectorAll(':scope > [data-chart-row]:not(.is-dragging)')];const after=candidates.find(item=>event.clientY{event.preventDefault();zone.classList.remove('is-drag-over');if(!dragged)return;const dropped=dragged;dropped.classList.remove('is-dragging');dragged=null;normalizeZones();const pos=position(dropped);await persistOrder(`Position ${pos} und die neue Reihenfolge wurden gespeichert.`);}); + }); + + rows().forEach(row=>{ + const handle=row.querySelector('.chart-drag'); + handle?.addEventListener('dragstart',event=>{dragged=row;row.classList.add('is-dragging');event.dataTransfer.effectAllowed='move';event.dataTransfer.setData('text/plain',row.dataset.id||'');if(event.dataTransfer.setDragImage)event.dataTransfer.setDragImage(row,24,20);}); + handle?.addEventListener('dragend',()=>{row.classList.remove('is-dragging');document.querySelectorAll('[data-chart-zone]').forEach(zone=>zone.classList.remove('is-drag-over'));dragged=null;normalizeZones();}); + row.querySelector('[data-chart-auto]')?.addEventListener('click',event=>autoFill(row,event.currentTarget)); + row.querySelector('[data-chart-clear]')?.addEventListener('click',()=>clearRow(row)); + row.querySelectorAll('input').forEach(input=>{ + if(['hidden','button','submit'].includes((input.type||'').toLowerCase()))return; + if(input.name==='position'){input.addEventListener('change',()=>moveToPosition(row,Number(input.value||0)));return;} + input.addEventListener('input',()=>queueSave(row)); + input.addEventListener('change',()=>{if(input.name==='store_url')applyYouTube(row);saveRow(row)}); + input.addEventListener('blur',()=>{if(input.name==='store_url')applyYouTube(row);queueSave(row,180)}); + }); + row.addEventListener('submit',event=>{event.preventDefault();saveRow(row)}); + }); + + + document.querySelector('[data-chart-generate]')?.addEventListener('click',async event=>{ + const button=event.currentTarget;if(!confirm('Die Chartpositionen jetzt nach dem aktuellen Voting-Stand neu generieren?'))return;button.disabled=true;const old=button.textContent;button.textContent='Generiere …'; + try{const response=await fetch('/admin/api/charts/generate',{method:'POST',credentials:'same-origin',headers:{'Content-Type':'application/json',Accept:'application/json','X-CSRF-Token':csrf},body:JSON.stringify({chart_key:chartKey})});const payload=await response.json().catch(()=>({}));if(!response.ok||payload.ok===false)throw new Error(messageFrom(payload,'Generierung fehlgeschlagen.'));notify(payload.message||'Charts wurden generiert.');setTimeout(()=>location.reload(),900);}catch(error){notify(error.message||'Generierung fehlgeschlagen.','error');button.disabled=false;button.textContent=old;} + }); + + document.querySelector('[data-chart-info-generate]')?.addEventListener('click',async event=>{ + const button=event.currentTarget,missing=rows().filter(row=>row.dataset.annual==='1'&&row.dataset.hasInfo!=='1'); + if(!missing.length){notify('Für alle Jahrescharttitel liegen bereits KI-Informationen vor.');return;} + if(!confirm(`${missing.length} fehlende Titelinformationen jetzt nacheinander mit KI erzeugen?`))return; + const progress=document.querySelector('[data-chart-info-progress]');if(progress){progress.max=missing.length;progress.value=0;}button.disabled=true;const old=button.textContent;let done=0,failed=0; + for(const row of missing){button.textContent=`KI ${done+failed+1}/${missing.length}`;try{const response=await fetch('/admin/api/charts/year-info/generate',{method:'POST',credentials:'same-origin',headers:{'Content-Type':'application/json',Accept:'application/json','X-CSRF-Token':csrf},body:JSON.stringify({year:chartYear,position:position(row),force:false})});const payload=await response.json().catch(()=>({}));if(!response.ok||payload.ok===false)throw new Error(messageFrom(payload,'KI-Titelinfo fehlgeschlagen.'));row.dataset.hasInfo='1';done++;}catch(error){failed++;notify(`Position ${position(row)}: ${error.message}`,'error');}if(progress)progress.value=done+failed;} + button.textContent=old;button.disabled=false;notify(`${done} Titelinformationen erzeugt${failed?`, ${failed} Fehler`:''}.`,failed?'error':'success'); + }); +})(); diff --git a/web/assets/admin-dashboard-v38.css b/web/assets/admin-dashboard-v38.css new file mode 100644 index 0000000..3c69e25 --- /dev/null +++ b/web/assets/admin-dashboard-v38.css @@ -0,0 +1,6 @@ +/* v38 – Landwelle Dashboard Widgets */ +.lw-dashboard-hero{position:relative;display:flex;align-items:center;justify-content:space-between;gap:24px;margin-bottom:22px;padding:26px 30px;border:1px solid rgba(125,184,42,.28);border-radius:24px;background:radial-gradient(circle at 90% 10%,rgba(151,216,75,.20),transparent 32%),linear-gradient(135deg,#111712,#0b0f0c);box-shadow:0 18px 45px rgba(15,22,15,.13);overflow:hidden}.lw-dashboard-hero:before{content:"";position:absolute;inset:0 auto 0 0;width:5px;background:linear-gradient(#9bd84c,#5d9618)}.lw-dashboard-hero h2{margin:4px 0 5px;color:#fff;font-size:clamp(25px,2vw,36px)}.lw-dashboard-hero p{margin:0;color:#aeb8ae}.lw-hero-status{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;align-items:center;min-width:220px;padding:14px 17px;border:1px solid rgba(151,216,75,.2);border-radius:16px;background:rgba(255,255,255,.035)}.lw-hero-status i{grid-row:1/3;width:13px;height:13px;border-radius:50%;background:#91d342;box-shadow:0 0 18px rgba(145,211,66,.65)}.lw-hero-status span{color:#e9f2e4;font-weight:850}.lw-hero-status strong{color:#8e998e;font-size:12px;overflow-wrap:anywhere} +.lw-metric-grid{margin-bottom:22px}.lw-metric{position:relative;border:1px solid #dfe7dc;border-radius:19px;background:linear-gradient(145deg,#fff,#f7faf5);box-shadow:0 10px 28px rgba(22,36,20,.08);overflow:hidden;transition:transform .18s ease,box-shadow .18s ease}.lw-metric:hover{transform:translateY(-2px);box-shadow:0 15px 34px rgba(22,36,20,.12)}.lw-metric:after{content:"";position:absolute;left:0;right:0;bottom:0;height:4px;background:#a9b3a8}.lw-metric.is-online:after{background:linear-gradient(90deg,#6fac22,#a3db54)}.lw-metric.is-warning:after{background:#e4ad35}.lw-metric.is-offline:after{background:#cf5555}.lw-metric .metric-icon{display:grid;place-items:center;width:48px;height:48px;border-radius:15px;background:#edf4e8;color:#6ea91d;font-size:22px}.lw-metric strong{color:#1c261d}.lw-metric em{color:#758075} +.lw-dashboard-widgets{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}.lw-widget{padding:0!important;border:1px solid #dce5d9!important;border-radius:23px!important;background:#fff!important;box-shadow:0 12px 34px rgba(24,38,22,.09)!important;overflow:hidden}.lw-widget:before{display:none!important}.lw-widget-head{display:flex;align-items:center;gap:13px;padding:20px 22px;border-bottom:1px solid #e8ede6;background:linear-gradient(135deg,#fbfdf9,#f2f7ee)}.lw-widget-head>div:nth-child(2){min-width:0}.lw-widget-head h2{margin:2px 0 0;color:#172018;font-size:21px}.lw-widget-icon{display:grid;place-items:center;flex:0 0 46px;width:46px;height:46px;border-radius:15px;background:linear-gradient(145deg,#7cbb2d,#5c9516);color:#fff;font-size:21px;font-weight:900;box-shadow:0 8px 19px rgba(107,163,31,.23)}.lw-status{display:inline-flex;align-items:center;gap:7px;margin-left:auto;max-width:44%;padding:7px 10px;border-radius:999px;background:#edf0ec;color:#647064;font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.035em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lw-status i{width:8px;height:8px;border-radius:50%;background:#8d978d}.lw-status.is-ok{background:#e9f6dc;color:#568716}.lw-status.is-ok i{background:#78bd29;box-shadow:0 0 10px rgba(120,189,41,.4)}.lw-status.is-error{background:#fbe7e7;color:#a63b3b}.lw-status.is-error i{background:#d75252}.lw-status.is-warning{background:#fff3d8;color:#906a16}.lw-status.is-warning i{background:#e0a829}.lw-status.is-muted{background:#eff2ee;color:#737c73}.lw-now-playing{display:grid;gap:5px;padding:23px 24px;background:radial-gradient(circle at 100% 0,rgba(126,184,42,.15),transparent 38%),#101510;color:#fff}.lw-now-playing span{color:#99ce52;font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.12em}.lw-now-playing strong{font-size:clamp(20px,1.7vw,28px);line-height:1.2}.lw-now-playing small{color:#aeb9ae}.lw-primary-value{display:flex;flex-direction:column;gap:5px;padding:25px 24px}.lw-primary-value strong{color:#273228;font-size:clamp(21px,1.65vw,28px);overflow-wrap:anywhere}.lw-primary-value span{color:#788178;font-size:12px;text-transform:uppercase;font-weight:850;letter-spacing:.08em}.lw-stat-row{display:grid;grid-template-columns:1fr 1fr;border-top:1px solid #e9ede7}.lw-stat-row>div{display:flex;flex-direction:column;gap:4px;padding:16px 22px}.lw-stat-row>div+div{border-left:1px solid #e9ede7}.lw-stat-row span{color:#7b857b;font-size:12px}.lw-stat-row strong{color:#263026;overflow-wrap:anywhere}.lw-credit-meter{display:grid;gap:13px;padding:23px 24px}.lw-credit-meter>div:first-child{display:flex;justify-content:space-between;gap:15px}.lw-credit-meter span{color:#727c72}.lw-credit-meter strong{color:#263026}.lw-meter{height:10px;border-radius:999px;background:#e7ece4;overflow:hidden}.lw-meter i{display:block;width:42%;height:100%;border-radius:inherit;background:linear-gradient(90deg,#71ab24,#9bd84c)}.lw-big-stats{display:grid;grid-template-columns:repeat(4,1fr);padding:21px 12px}.lw-big-stats.is-three{grid-template-columns:repeat(3,1fr)}.lw-big-stats>div{display:flex;flex-direction:column;align-items:center;gap:5px;padding:13px 9px;text-align:center;border-right:1px solid #e6ebe4}.lw-big-stats>div:last-child{border-right:0}.lw-big-stats strong{color:#5f9917;font-size:clamp(25px,2.2vw,38px);line-height:1}.lw-big-stats span{color:#758075;font-size:11px;font-weight:750}.lw-widget-radio{grid-column:span 2}.lw-widget-app{grid-column:span 2} +@media(max-width:1050px){.lw-dashboard-widgets{grid-template-columns:1fr}.lw-widget-radio,.lw-widget-app{grid-column:auto}.lw-dashboard-hero{align-items:flex-start;flex-direction:column}.lw-hero-status{width:100%}} +@media(max-width:650px){.lw-dashboard-hero{padding:22px}.lw-widget-head{align-items:flex-start;flex-wrap:wrap}.lw-status{max-width:100%;margin-left:59px}.lw-stat-row{grid-template-columns:1fr}.lw-stat-row>div+div{border-left:0;border-top:1px solid #e9ede7}.lw-big-stats,.lw-big-stats.is-three{grid-template-columns:repeat(2,1fr)}.lw-big-stats>div:nth-child(2){border-right:0}.lw-big-stats>div:nth-child(n+3){border-top:1px solid #e6ebe4}} diff --git a/web/assets/admin-directory-v1.css b/web/assets/admin-directory-v1.css new file mode 100644 index 0000000..ff698f8 --- /dev/null +++ b/web/assets/admin-directory-v1.css @@ -0,0 +1 @@ +.directory-admin-page{display:grid;gap:18px}.directory-admin-page .admin-page-heading{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}.directory-public-button{display:inline-flex;padding:11px 16px;border-radius:10px;background:#172119;color:#fff;text-decoration:none;font-weight:800}.directory-admin-tabs{display:flex;gap:8px;flex-wrap:wrap}.directory-admin-tabs a{padding:9px 13px;border:1px solid #dce3dc;border-radius:999px;background:#fff;color:#273229;text-decoration:none;font-weight:800}.directory-admin-tabs a.is-active{background:#78bd24;border-color:#78bd24;color:#12200f}.directory-admin-list{display:grid;gap:16px}.directory-admin-card{padding:20px}.directory-admin-card>header{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;padding-bottom:16px;border-bottom:1px solid #edf0ed}.directory-admin-card header span{color:#649a20;font-size:12px;font-weight:900;text-transform:uppercase;letter-spacing:.05em}.directory-admin-card h2{margin:4px 0}.directory-admin-card header small{color:#6b756d}.directory-admin-card header b{padding:5px 9px;border-radius:999px;font-size:10px;text-transform:uppercase}.status-pending{background:#fff0c6;color:#805e00}.status-published{background:#e2f3cf;color:#477514}.status-rejected{background:#fde1df;color:#a3322b}.status-archived{background:#e8ece8;color:#5e675f}.directory-admin-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px;padding:18px 0}.directory-admin-form label{display:grid;gap:5px;font-weight:800}.directory-admin-form .is-wide{grid-column:1/-1}.directory-admin-form input,.directory-admin-form select,.directory-admin-form textarea{width:100%;padding:10px 11px;border:1px solid #dbe2dc;border-radius:9px;background:#fff}.directory-admin-card footer{display:flex;gap:8px;flex-wrap:wrap}.directory-admin-card footer button{padding:9px 12px;border:1px solid #dbe2dc;border-radius:9px;background:#fff;font-weight:800;cursor:pointer}.directory-admin-card footer .is-publish{background:#78bd24;border-color:#78bd24;color:#10200d}.directory-admin-card footer .is-reject{background:#fff1d1;border-color:#e8c46c;color:#735300}.directory-admin-card footer .is-delete{margin-left:auto;color:#a42d27}@media(max-width:760px){.directory-admin-page .admin-page-heading{flex-direction:column}.directory-admin-form{grid-template-columns:1fr}.directory-admin-form .is-wide{grid-column:auto}.directory-admin-card footer .is-delete{margin-left:0}} diff --git a/web/assets/admin-directory-v2.css b/web/assets/admin-directory-v2.css new file mode 100644 index 0000000..8291651 --- /dev/null +++ b/web/assets/admin-directory-v2.css @@ -0,0 +1,2 @@ +.directory-admin-page{display:grid;gap:18px}.directory-admin-page .admin-page-heading{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}.directory-public-button{display:inline-flex;padding:11px 16px;border-radius:10px;background:#172119;color:#fff;text-decoration:none;font-weight:800}.directory-admin-tabs{display:flex;gap:8px;flex-wrap:wrap}.directory-admin-tabs a{padding:9px 13px;border:1px solid #dce3dc;border-radius:999px;background:#fff;color:#273229;text-decoration:none;font-weight:800}.directory-admin-tabs a.is-active{background:#78bd24;border-color:#78bd24;color:#12200f}.directory-admin-list{display:grid;gap:16px}.directory-admin-card{padding:20px}.directory-admin-card>header{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;padding-bottom:16px;border-bottom:1px solid #edf0ed}.directory-admin-card header span{color:#649a20;font-size:12px;font-weight:900;text-transform:uppercase;letter-spacing:.05em}.directory-admin-card h2{margin:4px 0}.directory-admin-card header small{color:#6b756d}.directory-admin-card header b{padding:5px 9px;border-radius:999px;font-size:10px;text-transform:uppercase}.status-pending{background:#fff0c6;color:#805e00}.status-published{background:#e2f3cf;color:#477514}.status-rejected{background:#fde1df;color:#a3322b}.status-archived{background:#e8ece8;color:#5e675f}.directory-admin-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px;padding:18px 0}.directory-admin-form label{display:grid;gap:5px;font-weight:800}.directory-admin-form .is-wide{grid-column:1/-1}.directory-admin-form input,.directory-admin-form select,.directory-admin-form textarea{width:100%;padding:10px 11px;border:1px solid #dbe2dc;border-radius:9px;background:#fff}.directory-admin-card footer{display:flex;gap:8px;flex-wrap:wrap}.directory-admin-card footer button{padding:9px 12px;border:1px solid #dbe2dc;border-radius:9px;background:#fff;font-weight:800;cursor:pointer}.directory-admin-card footer .is-publish{background:#78bd24;border-color:#78bd24;color:#10200d}.directory-admin-card footer .is-reject{background:#fff1d1;border-color:#e8c46c;color:#735300}.directory-admin-card footer .is-delete{margin-left:auto;color:#a42d27}@media(max-width:760px){.directory-admin-page .admin-page-heading{flex-direction:column}.directory-admin-form{grid-template-columns:1fr}.directory-admin-form .is-wide{grid-column:auto}.directory-admin-card footer .is-delete{margin-left:0}} +.directory-admin-partnership{grid-template-columns:auto 1fr!important;align-items:start;padding:12px 14px;border:1px solid #cfe2b5;border-radius:10px;background:#f4faec}.directory-admin-partnership input{width:auto!important;margin-top:4px}.directory-admin-partnership span{display:grid;gap:3px}.directory-admin-partnership small{color:#677267;font-weight:500} diff --git a/web/assets/admin-downloads-v25.css b/web/assets/admin-downloads-v25.css new file mode 100644 index 0000000..48c2204 --- /dev/null +++ b/web/assets/admin-downloads-v25.css @@ -0,0 +1,3 @@ +.download-admin-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}.download-admin-card{padding:24px;position:relative}.download-admin-head{display:flex;align-items:flex-start;gap:15px}.download-admin-head h2{margin:3px 0 5px}.download-admin-head p{margin:0;color:#66706a;font-size:.9rem}.download-admin-icon{display:grid;place-items:center;width:52px;height:52px;border-radius:16px;background:#101410;color:#32d16d;font-weight:900;font-size:.75rem;letter-spacing:.08em;flex:none}.download-admin-status{position:absolute;right:20px;top:20px;padding:6px 9px;border-radius:999px;background:#ecefec;color:#68706a;font-size:.7rem;font-weight:800;text-transform:uppercase}.download-admin-status.is-live{background:#daf7e3;color:#08752e}.download-admin-current,.download-admin-empty{margin:22px 0 18px;padding:14px;border-radius:14px;background:#f4f6f4}.download-admin-current{display:grid;gap:4px}.download-admin-current strong{overflow-wrap:anywhere}.download-admin-current span{font-size:.8rem;color:#6d746f}.download-admin-current a{margin-top:5px;color:#078338;font-weight:800;text-decoration:none}.download-admin-empty{color:#6a716c;font-size:.88rem;line-height:1.55}.download-admin-form{display:grid;gap:12px}.download-admin-form label{display:grid;gap:7px;font-weight:800;font-size:.85rem}.download-admin-form input[type=file]{width:100%;padding:11px;border:1px dashed #bfc8c1;border-radius:12px;background:#fff}.download-admin-delete{margin-top:10px}.download-admin-delete button{border:0;background:transparent;color:#a62b2b;font-weight:800;cursor:pointer;padding:7px 0}.download-admin-message{padding:14px 17px;border-radius:13px;margin-bottom:18px;font-weight:750}.download-admin-message.is-success{background:#dcf8e5;color:#076d2c}.download-admin-message.is-error{background:#fde5e5;color:#9b2020}.download-admin-help{margin-top:22px;padding:24px}.download-admin-help h2{margin-top:0}.download-admin-help p{max-width:850px;color:#626a65;line-height:1.65}.download-admin-help code{display:inline-block;background:#111511;color:#63e58d;padding:9px 12px;border-radius:9px}@media(max-width:1100px){.download-admin-grid{grid-template-columns:1fr}.download-admin-status{position:static;margin-left:auto}}@media(max-width:700px){.download-admin-head{flex-wrap:wrap}.download-admin-status{margin-left:0}} + +.download-admin-preview{width:100%;max-height:220px;object-fit:cover;border-radius:14px;margin:14px 0} diff --git a/web/assets/admin-editorial-v37.js b/web/assets/admin-editorial-v37.js new file mode 100644 index 0000000..39ea3be --- /dev/null +++ b/web/assets/admin-editorial-v37.js @@ -0,0 +1,122 @@ +(() => { + const makeSlug = value => value.toLowerCase().trim() + .replace(/ä/g, 'ae').replace(/ö/g, 'oe').replace(/ü/g, 'ue').replace(/ß/g, 'ss') + .normalize('NFD').replace(/[\u0300-\u036f]/g, '') + .replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, ''); + + const form = document.querySelector('[data-editorial-form]'); + if (form) { + const title = form.querySelector('[data-editorial-title]'); + const slug = form.querySelector('[data-editorial-slug]'); + const teaser = form.querySelector('[data-editorial-teaser]'); + const category = form.querySelector('[data-editorial-category]'); + const status = form.querySelector('[data-editorial-status]'); + const facebookToggle = form.querySelector('[data-facebook-toggle]'); + const aiUsage = form.querySelector('[name="ai_usage"]'); + const aiDisclosure = form.querySelector('[name="ai_disclosure"]'); + const preview = document.querySelector('[data-facebook-preview]'); + + const updatePreview = () => { + const generatedSlug = makeSlug(title?.value || ''); + if (slug) slug.value = generatedSlug; + if (!preview) return; + + preview.hidden = !facebookToggle?.checked; + if (preview.hidden) return; + + const titleValue = (title?.value || '').trim() || 'Titel des Beitrags'; + const teaserValue = (teaser?.value || '').trim() || 'Der kurze Einstieg deines Beitrags erscheint hier.'; + const selectedCategory = category?.selectedOptions?.[0]; + const isHomepageCategory = selectedCategory?.dataset.homepage === '1'; + const isPublished = status?.value === 'published'; + const base = (preview.dataset.publicBase || 'https://landwelle.de').replace(/\/+$/, ''); + const categorySlug = category?.value || 'kategorie'; + const publicPath = `/landwelle-vor-ort/${categorySlug}/${generatedSlug || 'dein-beitrag'}`; + + const message = preview.querySelector('[data-facebook-message]'); + const previewTitle = preview.querySelector('[data-facebook-title]'); + const previewTeaser = preview.querySelector('[data-facebook-teaser]'); + const previewLink = preview.querySelector('[data-facebook-link]'); + const note = preview.querySelector('[data-facebook-note]'); + const aiValue = aiUsage?.value || 'none'; + const aiDefaults = { + assisted: 'Dieser Inhalt wurde mit Unterstützung künstlicher Intelligenz erstellt.', + generated: 'Dieser Inhalt wurde mithilfe künstlicher Intelligenz erstellt.', + manipulated: 'Dieser Inhalt wurde mithilfe künstlicher Intelligenz wesentlich bearbeitet.' + }; + const aiText = (aiDisclosure?.value || '').trim() || aiDefaults[aiValue] || ''; + if (message) message.textContent = `${titleValue}\n\n${teaserValue}${aiText ? `\n\nKI-Transparenz: ${aiText}` : ''}`; + if (previewTitle) previewTitle.textContent = titleValue; + if (previewTeaser) previewTeaser.textContent = teaserValue; + if (previewLink) previewLink.textContent = isHomepageCategory ? `${base}${publicPath}` : 'Noch keine öffentliche Beitragsseite'; + + if (note) { + note.classList.toggle('is-warning', !isHomepageCategory); + if (!isHomepageCategory) { + note.textContent = 'Diese Kategorie ist nicht für „Landwelle vor Ort“ freigeschaltet. Facebook kann den Beitrag deshalb nicht mit einer öffentlichen Landwelle-Seite verknüpfen.'; + } else if (!isPublished) { + note.textContent = 'Der Beitrag wird erst an Facebook gesendet, wenn du den Status auf „Veröffentlicht“ stellst.'; + } else { + note.textContent = 'Beim Speichern wird der Beitrag direkt an die eingerichtete Facebook-Seite gesendet.'; + } + } + + const selectedMedia = form.querySelector('input[name="media_asset_id"]:checked'); + const mediaURL = selectedMedia?.dataset.mediaUrl || ''; + const image = preview.querySelector('[data-facebook-image]'); + const emptyImage = preview.querySelector('[data-facebook-image-empty]'); + if (image) { + image.hidden = !mediaURL; + if (mediaURL) image.src = mediaURL; + } + if (emptyImage) emptyImage.hidden = Boolean(mediaURL); + }; + + [title, teaser, category, status, facebookToggle, aiUsage, aiDisclosure].forEach(element => { + element?.addEventListener('input', updatePreview); + element?.addEventListener('change', updatePreview); + }); + form.querySelectorAll('input[name="media_asset_id"]').forEach(input => input.addEventListener('change', updatePreview)); + updatePreview(); + } + + const categoryModal = document.querySelector('[data-category-modal]'); + const openCategory = document.querySelector('[data-open-category-modal]'); + const closeCategoryButtons = document.querySelectorAll('[data-close-category-modal]'); + openCategory?.addEventListener('click', () => { + if (typeof categoryModal?.showModal === 'function') categoryModal.showModal(); + else categoryModal?.setAttribute('open', ''); + }); + closeCategoryButtons.forEach(button => button.addEventListener('click', () => categoryModal?.close())); + categoryModal?.addEventListener('click', event => { + if (event.target === categoryModal) categoryModal.close(); + }); + + const list = document.querySelector('[data-editorial-content-list]'); + if (list) { + const categoryFilter = document.querySelector('[data-editorial-filter-category]'); + const statusFilter = document.querySelector('[data-editorial-filter-status]'); + const searchFilter = document.querySelector('[data-editorial-filter-search]'); + const empty = document.querySelector('[data-editorial-filter-empty]'); + const rows = [...list.querySelectorAll('[data-editorial-row]')]; + const applyFilters = () => { + const categoryValue = categoryFilter?.value || ''; + const statusValue = statusFilter?.value || ''; + const searchValue = (searchFilter?.value || '').trim().toLocaleLowerCase('de'); + let visible = 0; + rows.forEach(row => { + const matchesCategory = !categoryValue || row.dataset.category === categoryValue; + const matchesStatus = !statusValue || row.dataset.status === statusValue; + const haystack = (row.dataset.search || '').toLocaleLowerCase('de'); + const matchesSearch = !searchValue || haystack.includes(searchValue); + row.hidden = !(matchesCategory && matchesStatus && matchesSearch); + if (!row.hidden) visible += 1; + }); + if (empty) empty.hidden = visible !== 0 || rows.length === 0; + }; + [categoryFilter, statusFilter, searchFilter].forEach(element => { + element?.addEventListener('input', applyFilters); + element?.addEventListener('change', applyFilters); + }); + } +})(); diff --git a/web/assets/admin-editorial-v38.js b/web/assets/admin-editorial-v38.js new file mode 100644 index 0000000..39ea3be --- /dev/null +++ b/web/assets/admin-editorial-v38.js @@ -0,0 +1,122 @@ +(() => { + const makeSlug = value => value.toLowerCase().trim() + .replace(/ä/g, 'ae').replace(/ö/g, 'oe').replace(/ü/g, 'ue').replace(/ß/g, 'ss') + .normalize('NFD').replace(/[\u0300-\u036f]/g, '') + .replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, ''); + + const form = document.querySelector('[data-editorial-form]'); + if (form) { + const title = form.querySelector('[data-editorial-title]'); + const slug = form.querySelector('[data-editorial-slug]'); + const teaser = form.querySelector('[data-editorial-teaser]'); + const category = form.querySelector('[data-editorial-category]'); + const status = form.querySelector('[data-editorial-status]'); + const facebookToggle = form.querySelector('[data-facebook-toggle]'); + const aiUsage = form.querySelector('[name="ai_usage"]'); + const aiDisclosure = form.querySelector('[name="ai_disclosure"]'); + const preview = document.querySelector('[data-facebook-preview]'); + + const updatePreview = () => { + const generatedSlug = makeSlug(title?.value || ''); + if (slug) slug.value = generatedSlug; + if (!preview) return; + + preview.hidden = !facebookToggle?.checked; + if (preview.hidden) return; + + const titleValue = (title?.value || '').trim() || 'Titel des Beitrags'; + const teaserValue = (teaser?.value || '').trim() || 'Der kurze Einstieg deines Beitrags erscheint hier.'; + const selectedCategory = category?.selectedOptions?.[0]; + const isHomepageCategory = selectedCategory?.dataset.homepage === '1'; + const isPublished = status?.value === 'published'; + const base = (preview.dataset.publicBase || 'https://landwelle.de').replace(/\/+$/, ''); + const categorySlug = category?.value || 'kategorie'; + const publicPath = `/landwelle-vor-ort/${categorySlug}/${generatedSlug || 'dein-beitrag'}`; + + const message = preview.querySelector('[data-facebook-message]'); + const previewTitle = preview.querySelector('[data-facebook-title]'); + const previewTeaser = preview.querySelector('[data-facebook-teaser]'); + const previewLink = preview.querySelector('[data-facebook-link]'); + const note = preview.querySelector('[data-facebook-note]'); + const aiValue = aiUsage?.value || 'none'; + const aiDefaults = { + assisted: 'Dieser Inhalt wurde mit Unterstützung künstlicher Intelligenz erstellt.', + generated: 'Dieser Inhalt wurde mithilfe künstlicher Intelligenz erstellt.', + manipulated: 'Dieser Inhalt wurde mithilfe künstlicher Intelligenz wesentlich bearbeitet.' + }; + const aiText = (aiDisclosure?.value || '').trim() || aiDefaults[aiValue] || ''; + if (message) message.textContent = `${titleValue}\n\n${teaserValue}${aiText ? `\n\nKI-Transparenz: ${aiText}` : ''}`; + if (previewTitle) previewTitle.textContent = titleValue; + if (previewTeaser) previewTeaser.textContent = teaserValue; + if (previewLink) previewLink.textContent = isHomepageCategory ? `${base}${publicPath}` : 'Noch keine öffentliche Beitragsseite'; + + if (note) { + note.classList.toggle('is-warning', !isHomepageCategory); + if (!isHomepageCategory) { + note.textContent = 'Diese Kategorie ist nicht für „Landwelle vor Ort“ freigeschaltet. Facebook kann den Beitrag deshalb nicht mit einer öffentlichen Landwelle-Seite verknüpfen.'; + } else if (!isPublished) { + note.textContent = 'Der Beitrag wird erst an Facebook gesendet, wenn du den Status auf „Veröffentlicht“ stellst.'; + } else { + note.textContent = 'Beim Speichern wird der Beitrag direkt an die eingerichtete Facebook-Seite gesendet.'; + } + } + + const selectedMedia = form.querySelector('input[name="media_asset_id"]:checked'); + const mediaURL = selectedMedia?.dataset.mediaUrl || ''; + const image = preview.querySelector('[data-facebook-image]'); + const emptyImage = preview.querySelector('[data-facebook-image-empty]'); + if (image) { + image.hidden = !mediaURL; + if (mediaURL) image.src = mediaURL; + } + if (emptyImage) emptyImage.hidden = Boolean(mediaURL); + }; + + [title, teaser, category, status, facebookToggle, aiUsage, aiDisclosure].forEach(element => { + element?.addEventListener('input', updatePreview); + element?.addEventListener('change', updatePreview); + }); + form.querySelectorAll('input[name="media_asset_id"]').forEach(input => input.addEventListener('change', updatePreview)); + updatePreview(); + } + + const categoryModal = document.querySelector('[data-category-modal]'); + const openCategory = document.querySelector('[data-open-category-modal]'); + const closeCategoryButtons = document.querySelectorAll('[data-close-category-modal]'); + openCategory?.addEventListener('click', () => { + if (typeof categoryModal?.showModal === 'function') categoryModal.showModal(); + else categoryModal?.setAttribute('open', ''); + }); + closeCategoryButtons.forEach(button => button.addEventListener('click', () => categoryModal?.close())); + categoryModal?.addEventListener('click', event => { + if (event.target === categoryModal) categoryModal.close(); + }); + + const list = document.querySelector('[data-editorial-content-list]'); + if (list) { + const categoryFilter = document.querySelector('[data-editorial-filter-category]'); + const statusFilter = document.querySelector('[data-editorial-filter-status]'); + const searchFilter = document.querySelector('[data-editorial-filter-search]'); + const empty = document.querySelector('[data-editorial-filter-empty]'); + const rows = [...list.querySelectorAll('[data-editorial-row]')]; + const applyFilters = () => { + const categoryValue = categoryFilter?.value || ''; + const statusValue = statusFilter?.value || ''; + const searchValue = (searchFilter?.value || '').trim().toLocaleLowerCase('de'); + let visible = 0; + rows.forEach(row => { + const matchesCategory = !categoryValue || row.dataset.category === categoryValue; + const matchesStatus = !statusValue || row.dataset.status === statusValue; + const haystack = (row.dataset.search || '').toLocaleLowerCase('de'); + const matchesSearch = !searchValue || haystack.includes(searchValue); + row.hidden = !(matchesCategory && matchesStatus && matchesSearch); + if (!row.hidden) visible += 1; + }); + if (empty) empty.hidden = visible !== 0 || rows.length === 0; + }; + [categoryFilter, statusFilter, searchFilter].forEach(element => { + element?.addEventListener('input', applyFilters); + element?.addEventListener('change', applyFilters); + }); + } +})(); diff --git a/web/assets/admin-editorial-v42.css b/web/assets/admin-editorial-v42.css new file mode 100644 index 0000000..5d0e683 --- /dev/null +++ b/web/assets/admin-editorial-v42.css @@ -0,0 +1,6 @@ +.editorial-admin-page{display:grid;gap:18px}.editorial-admin-page [hidden]{display:none!important}.editorial-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.editorial-tabs a{display:grid;grid-template-columns:42px minmax(0,1fr);column-gap:11px;align-items:center;padding:15px 17px;border:1px solid #dce5da;border-radius:15px;background:#fff;color:#263128;text-decoration:none;box-shadow:0 5px 18px rgba(28,42,26,.05)}.editorial-tabs a>span{grid-row:1/3;display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:#eff4ec;color:#5d8f20;font-size:21px;font-weight:900}.editorial-tabs strong{font-size:15px}.editorial-tabs small{color:#758078;font-size:11px}.editorial-tabs a.is-active{border-color:#8fbd55;background:linear-gradient(135deg,#fbfef8,#eef7e6);box-shadow:0 10px 24px rgba(93,143,32,.12)}.editorial-tabs a.is-active>span{background:#6faa24;color:#fff}.editorial-panel-heading{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;margin-bottom:20px}.editorial-panel-heading h2{margin:4px 0 5px;font-size:25px}.editorial-panel-heading p{max-width:760px;margin:0;color:#68736b}.editorial-contents-panel,.editorial-category-panel{padding:22px}.editorial-list-toolbar{display:grid;grid-template-columns:220px 200px minmax(240px,1fr);gap:12px;padding:14px;border:1px solid #e0e7de;border-radius:14px;background:#f7faf5}.editorial-list-toolbar label{display:grid;gap:5px}.editorial-list-toolbar label>span{color:#647066;font-size:11px;font-weight:850;text-transform:uppercase;letter-spacing:.05em}.editorial-list-toolbar select,.editorial-list-toolbar input{width:100%;box-sizing:border-box;padding:10px 11px;border:1px solid #cad6cb;border-radius:9px;background:#fff;color:#263027}.editorial-content-table{margin-top:16px;border:1px solid #e1e7df;border-radius:14px;overflow:hidden}.editorial-content-head,.editorial-content-table>article{display:grid;grid-template-columns:minmax(300px,1.65fr) minmax(160px,.72fr) minmax(210px,.9fr) minmax(150px,.6fr);gap:16px;align-items:center}.editorial-content-head{padding:11px 15px;background:#eef3eb;color:#657066;font-size:10px;font-weight:900;text-transform:uppercase;letter-spacing:.07em}.editorial-content-table>article{padding:14px 15px;border-top:1px solid #e8ede7;background:#fff}.editorial-content-table>article:hover{background:#fbfdf9}.editorial-content-main{display:grid;grid-template-columns:72px minmax(0,1fr);gap:13px;align-items:center;min-width:0}.admin-editorial-thumb,.admin-editorial-placeholder{width:72px;height:64px;border-radius:10px}.admin-editorial-thumb{object-fit:cover}.admin-editorial-placeholder{display:grid;place-items:center;background:linear-gradient(145deg,#223023,#101810);color:#9bda4e;font-weight:950}.editorial-content-main strong{display:block;color:#1e271f;font-size:15px;line-height:1.25}.editorial-content-main p{display:-webkit-box;overflow:hidden;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:4px 0;color:#68736b;font-size:11px;line-height:1.4}.editorial-content-main small{color:#879088;font-size:10px}.editorial-content-classification{display:flex;align-items:flex-start;flex-direction:column;gap:7px}.editorial-category-chip,.editorial-status-chip{display:inline-flex;padding:6px 9px;border-radius:999px;font-size:10px;font-weight:900}.editorial-category-chip{background:#edf4e8;color:#537b22}.editorial-status-chip{background:#eff1ef;color:#657066}.editorial-status-chip.is-published{background:#e4f5d6;color:#4f7f17}.editorial-status-chip.is-review{background:#fff1cd;color:#866311}.editorial-status-chip.is-archived{background:#e8e9e8;color:#676b68}.editorial-content-classification small{color:#7b857c;font-size:10px}.editorial-distribution-status{display:grid;gap:8px}.facebook-state{display:flex;gap:8px;align-items:flex-start;min-width:0}.facebook-state>b{display:grid;place-items:center;flex:0 0 25px;width:25px;height:25px;border-radius:50%;background:#e9edf4;color:#4267a9;font-family:Arial,sans-serif;font-size:16px}.facebook-state>span{display:grid;min-width:0}.facebook-state strong{font-size:10px;color:#536058}.facebook-state small{overflow:hidden;text-overflow:ellipsis;color:#8b4d4d;font-size:9px;line-height:1.35}.facebook-state.is-published>b{background:#4267b2;color:#fff}.facebook-state.is-published strong{color:#37653a}.facebook-state.is-failed>b{background:#f9dddd;color:#a13d3d}.facebook-state.is-failed strong{color:#9a3535}.facebook-state.is-off{opacity:.65}.push-state{font-size:10px;font-weight:800;color:#547c23}.push-state.is-muted{color:#929a93}.editorial-row-actions{display:flex;flex-direction:column;align-items:stretch;gap:6px}.editorial-row-actions a,.editorial-row-actions button{display:block;width:100%;box-sizing:border-box;padding:7px 9px;border:1px solid #d9e1d8;border-radius:8px;background:#fff;color:#566159;text-align:center;text-decoration:none;font:inherit;font-size:10px;font-weight:850;cursor:pointer}.editorial-row-actions a.is-primary{border-color:#7eaf42;background:#eef7e6;color:#4e761d}.editorial-row-actions button.is-danger{color:#a14646}.editorial-filter-empty{display:grid;place-items:center;gap:4px;padding:35px;color:#68736b}.editorial-filter-empty strong{color:#2b362d}.editorial-create-layout{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(310px,.7fr);gap:18px;align-items:start}.editorial-editor-card{padding:22px}.editorial-editor-card .admin-card-heading p{margin:4px 0 0;color:#6d776f}.editorial-editor-card .admin-form-actions{display:flex;justify-content:flex-end;align-items:center;gap:14px}.editorial-editor-card .admin-form-actions>a{color:#667168}.facebook-preview-card{position:sticky;top:88px;padding:0;overflow:hidden}.facebook-preview-heading{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:17px 18px;border-bottom:1px solid #e5e9e4;background:#f8faf7}.facebook-preview-heading>div{display:flex;gap:10px;align-items:center}.facebook-preview-heading>div>div{display:grid}.facebook-preview-heading small{color:#788078;font-size:10px}.facebook-mark{display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:#4267b2;color:#fff;font-family:Arial,sans-serif;font-size:22px;font-weight:900}.facebook-connection{padding:6px 8px;border-radius:999px;font-size:9px;font-weight:900;text-transform:uppercase}.facebook-connection.is-ready{background:#e3f3d7;color:#4f7b1c}.facebook-connection.is-missing{background:#fde5d7;color:#a05b2d}.facebook-setup-warning{display:grid;gap:4px;margin:14px 14px 0;padding:12px;border:1px solid #f1cfae;border-radius:11px;background:#fff8ec;color:#79522e}.facebook-setup-warning strong{font-size:11px}.facebook-setup-warning span,.facebook-setup-warning a{font-size:10px}.facebook-setup-warning a{color:#80531f;font-weight:850}.facebook-post-preview{margin:14px;border:1px solid #dfe3e8;border-radius:12px;background:#fff;overflow:hidden;box-shadow:0 5px 17px rgba(26,39,60,.08)}.facebook-post-preview>header{display:grid;grid-template-columns:38px minmax(0,1fr) auto;gap:9px;align-items:center;padding:12px}.facebook-post-preview>header>div{display:grid}.facebook-post-preview>header small{color:#7a8189;font-size:9px}.facebook-page-avatar{display:grid;place-items:center;width:38px;height:38px;border-radius:50%;background:#162017;color:#9edb50;font-weight:950}.facebook-post-preview>p{margin:0;padding:2px 12px 13px;color:#222;font-size:12px;line-height:1.45;white-space:pre-line}.facebook-link-card{border-top:1px solid #e2e5e8;background:#f1f3f5}.facebook-preview-image{display:grid;place-items:center;height:150px;overflow:hidden;background:linear-gradient(145deg,#1a251b,#4b6631);color:#bce67c;font-size:17px;font-weight:900}.facebook-preview-image img{width:100%;height:100%;object-fit:cover}.facebook-link-card>div:last-child{padding:10px 12px}.facebook-link-card small{color:#727b84;font-size:9px}.facebook-link-card strong{display:block;margin:2px 0;color:#20252b;font-size:13px}.facebook-link-card p{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2;margin:0;color:#69717a;font-size:10px;line-height:1.35}.facebook-link-card span{display:block;overflow:hidden;margin-top:5px;color:#777f87;font-size:8px;text-overflow:ellipsis;white-space:nowrap}.facebook-preview-note{margin:0 14px 14px;padding:10px 11px;border-radius:9px;background:#edf5e8;color:#4f6f31;font-size:10px;line-height:1.45}.facebook-preview-note.is-warning{background:#fff2dc;color:#80591f}.facebook-current-status{display:grid;gap:3px;margin:0 14px 14px;padding:11px;border-radius:10px;background:#f1f4f0}.facebook-current-status strong{font-size:10px}.facebook-current-status small{overflow-wrap:anywhere;color:#7b4b4b;font-size:9px}.facebook-current-status.is-published{background:#e8f5df;color:#47751d}.facebook-current-status.is-failed{background:#fde8e8;color:#973b3b}.editorial-category-list{display:grid;gap:10px}.editorial-category-list article{display:grid;grid-template-columns:44px minmax(250px,1fr) auto auto;gap:14px;align-items:center;padding:14px;border:1px solid #e1e7df;border-radius:13px;background:#fff}.editorial-category-list article.is-inactive{opacity:.65;background:#f4f5f3}.editorial-category-icon{display:grid;place-items:center;width:44px;height:44px;border-radius:13px;background:#edf5e7;color:#5d8c24;font-size:18px;font-weight:950;text-transform:uppercase}.editorial-category-list strong,.editorial-category-list code{display:inline-block;margin-right:8px}.editorial-category-list code{padding:3px 6px;border-radius:6px;background:#edf1ec;color:#617063}.editorial-category-list p{margin:4px 0 0;color:#6b756d;font-size:11px}.editorial-type-badges{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.editorial-type-badges span,.editorial-type-badges small{padding:5px 8px;border-radius:999px;background:#e9f4db;color:#527b18;font-size:9px;font-weight:850}.editorial-type-badges small{background:#eef1ed;color:#626d64}.editorial-category-dialog{width:min(680px,calc(100% - 28px));padding:0;border:0;border-radius:18px;background:#fff;box-shadow:0 28px 90px rgba(15,24,16,.35)}.editorial-category-dialog::backdrop{background:rgba(10,15,11,.62);backdrop-filter:blur(3px)}.editorial-category-form>header{display:flex;justify-content:space-between;gap:18px;padding:22px 24px;border-bottom:1px solid #e4e9e3;background:#f7faf5}.editorial-category-form>header h2{margin:4px 0}.editorial-category-form>header p{max-width:520px;margin:0;color:#6a756c}.editorial-category-form>header>button{width:38px;height:38px;border:0;border-radius:10px;background:#e9eee7;color:#465148;font-size:24px;cursor:pointer}.editorial-category-form>.admin-form-grid{padding:22px 24px}.editorial-category-form textarea{resize:vertical}.editorial-switch{display:flex!important;grid-template-columns:auto 1fr;gap:10px;align-items:flex-start;padding:12px;border:1px solid #e0e6df;border-radius:10px}.editorial-switch input{width:auto!important;margin-top:3px}.editorial-switch>span{display:grid;gap:3px}.editorial-switch small{color:#768078;font-weight:500}.editorial-category-form>footer{display:flex;justify-content:flex-end;gap:10px;padding:16px 24px;border-top:1px solid #e4e9e3;background:#fafcf9} +@media(max-width:1180px){.editorial-content-head,.editorial-content-table>article{grid-template-columns:minmax(270px,1.5fr) minmax(145px,.7fr) minmax(180px,.85fr) 130px}.editorial-create-layout{grid-template-columns:1fr}.facebook-preview-card{position:static;max-width:620px}.editorial-category-list article{grid-template-columns:44px minmax(220px,1fr) auto}.editorial-category-list article>form{grid-column:2/-1;justify-self:end}} +@media(max-width:900px){.editorial-tabs{grid-template-columns:1fr}.editorial-list-toolbar{grid-template-columns:1fr 1fr}.editorial-search{grid-column:1/-1}.editorial-content-head{display:none}.editorial-content-table{display:grid;gap:12px;border:0;overflow:visible}.editorial-content-table>article{grid-template-columns:1fr 1fr;padding:15px;border:1px solid #e1e7df;border-radius:13px}.editorial-content-main{grid-column:1/-1}.editorial-row-actions{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.editorial-category-list article{grid-template-columns:44px minmax(0,1fr)}.editorial-category-list .editorial-type-badges,.editorial-category-list article>form{grid-column:2}} +@media(max-width:620px){.editorial-panel-heading{align-items:stretch;flex-direction:column}.editorial-panel-heading .admin-primary-button{width:100%;box-sizing:border-box;text-align:center}.editorial-list-toolbar{grid-template-columns:1fr}.editorial-search{grid-column:auto}.editorial-content-table>article{grid-template-columns:1fr}.editorial-content-classification,.editorial-distribution-status,.editorial-row-actions{grid-column:auto}.editorial-row-actions{grid-template-columns:1fr 1fr}.editorial-content-main{grid-template-columns:58px minmax(0,1fr)}.admin-editorial-thumb,.admin-editorial-placeholder{width:58px;height:58px}.editorial-category-list article{grid-template-columns:1fr}.editorial-category-list .editorial-category-icon,.editorial-category-list .editorial-type-badges,.editorial-category-list article>form{grid-column:auto}.editorial-category-list article>form,.editorial-category-list article>form button{width:100%}.editorial-category-form>.admin-form-grid{grid-template-columns:1fr}.editorial-category-form .is-wide{grid-column:auto}.facebook-preview-card{min-width:0}.editorial-category-dialog{width:calc(100% - 18px)}} +/* v1.5.24 – KI-Transparenz */ +.editorial-ai-chip{display:inline-flex;align-items:center;gap:5px;width:max-content;padding:5px 8px;border-radius:999px;background:#ede7ff;color:#5f3a8f;font-size:9px;font-weight:900;text-transform:uppercase}.editorial-ai-chip.is-media{background:#e2eef8;color:#315f83}.editorial-ai-panel{display:grid;gap:14px;padding:18px;border:1px solid #cbd8c5;border-radius:15px;background:linear-gradient(145deg,#f8fbf5,#f0f5ec)}.editorial-ai-panel legend{padding:0 8px;color:#29482b;font-weight:900}.editorial-ai-panel>p{margin:0;color:#667365;line-height:1.55}.editorial-ai-panel>a{width:max-content;color:#527d20;font-weight:800;text-decoration:none}.editorial-ai-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.editorial-ai-grid label{display:grid;gap:7px}.editorial-ai-grid .is-wide{grid-column:1/-1}.editorial-ai-grid label>span{font-weight:780}.editorial-ai-grid small{color:#758174;font-weight:500;line-height:1.45}.editorial-ai-grid input,.editorial-ai-grid select,.editorial-ai-grid textarea{width:100%;box-sizing:border-box;padding:12px;border:1px solid #cbd7c7;border-radius:10px;background:#fff;font:inherit}.editorial-ai-review{display:flex!important;grid-template-columns:auto 1fr!important;align-items:flex-start;padding:13px;border:1px solid #d5e0d0;border-radius:11px;background:#fff}.editorial-ai-review input{width:auto!important;margin-top:3px}.editorial-ai-review>span{display:grid;gap:3px}.editorial-ai-review strong{font-size:.92rem}@media(max-width:700px){.editorial-ai-grid{grid-template-columns:1fr}.editorial-ai-grid .is-wide{grid-column:auto}} diff --git a/web/assets/admin-events-v2.css b/web/assets/admin-events-v2.css new file mode 100644 index 0000000..9c29992 --- /dev/null +++ b/web/assets/admin-events-v2.css @@ -0,0 +1 @@ +.admin-event-heading-actions{display:flex;gap:.75rem;align-items:center}.admin-event-heading-actions button,.event-admin-summary button{border:0;border-radius:10px;padding:.75rem 1rem;font:inherit;font-weight:800;cursor:pointer;background:#0b6b50;color:#fff}.admin-event-heading-actions .is-secondary,.admin-event-form-actions .is-secondary{background:#eef2f1;color:#17352c}.event-admin-summary{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start;width:100%}.event-admin-summary>div{display:grid;gap:.35rem}.admin-event-dialog{width:min(880px,calc(100vw - 2rem));max-height:90vh;border:0;border-radius:20px;padding:0;box-shadow:0 24px 80px rgba(0,0,0,.28);overflow:auto}.admin-event-dialog::backdrop{background:rgba(4,18,14,.62);backdrop-filter:blur(4px)}.admin-event-dialog-head{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;padding:1.4rem 1.5rem;border-bottom:1px solid #e7ecea}.admin-event-dialog-head span{font-size:.8rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:#587068}.admin-event-dialog-head h2{margin:.25rem 0 0}.admin-event-dialog-head>button{border:0;background:#eef2f1;border-radius:999px;width:2.5rem;height:2.5rem;font-size:1.5rem;cursor:pointer}.admin-event-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;padding:1.5rem}.admin-event-form label{display:grid;gap:.4rem;font-weight:700}.admin-event-form input,.admin-event-form select,.admin-event-form textarea,.admin-event-category-row input,.admin-event-category-create input{width:100%;box-sizing:border-box;border:1px solid #ccd8d4;border-radius:10px;padding:.72rem .8rem;font:inherit}.admin-event-form .is-wide{grid-column:1/-1}.admin-event-form-actions{display:flex;justify-content:flex-end;gap:.75rem}.admin-event-form-actions button,.admin-event-category-row button,.admin-event-category-create button{border:0;border-radius:10px;padding:.75rem 1rem;font-weight:800;cursor:pointer;background:#0b6b50;color:#fff}.admin-event-category-list{display:grid;gap:.6rem;padding:1.25rem 1.5rem}.admin-event-category-row{display:grid;grid-template-columns:minmax(180px,1fr) 100px auto auto;gap:.65rem;align-items:center}.admin-event-category-row label{display:flex;gap:.35rem;align-items:center;white-space:nowrap}.admin-event-category-row label input{width:auto}.admin-event-category-create{display:grid;grid-template-columns:1fr 100px auto;gap:.65rem;padding:1.25rem 1.5rem;border-top:1px solid #e7ecea}@media(max-width:700px){.admin-event-form{grid-template-columns:1fr}.admin-event-form .is-wide{grid-column:auto}.admin-event-category-row,.admin-event-category-create{grid-template-columns:1fr}.event-admin-summary{flex-direction:column}} diff --git a/web/assets/admin-events-v2.js b/web/assets/admin-events-v2.js new file mode 100644 index 0000000..ba8fc47 --- /dev/null +++ b/web/assets/admin-events-v2.js @@ -0,0 +1,33 @@ +(() => { + const openDialog = (id) => { + const dialog = document.getElementById(id); + if (!dialog) return; + if (typeof dialog.showModal === 'function') dialog.showModal(); + else dialog.setAttribute('open', ''); + }; + const closeDialog = (dialog) => { + if (!dialog) return; + if (typeof dialog.close === 'function') dialog.close(); + else dialog.removeAttribute('open'); + }; + + document.addEventListener('click', (event) => { + const opener = event.target.closest('[data-admin-dialog-open]'); + if (opener) { + event.preventDefault(); + openDialog(opener.getAttribute('data-admin-dialog-open')); + return; + } + const closer = event.target.closest('[data-admin-dialog-close]'); + if (closer) { + event.preventDefault(); + closeDialog(closer.closest('dialog')); + } + }); + + document.querySelectorAll('.admin-event-dialog').forEach((dialog) => { + dialog.addEventListener('click', (event) => { + if (event.target === dialog) closeDialog(dialog); + }); + }); +})(); diff --git a/web/assets/admin-excursions-v1.css b/web/assets/admin-excursions-v1.css new file mode 100644 index 0000000..c4dcde4 --- /dev/null +++ b/web/assets/admin-excursions-v1.css @@ -0,0 +1 @@ +.excursion-admin-heading{align-items:flex-end;gap:20px}.excursion-admin-actions{display:flex;flex-wrap:wrap;gap:9px;justify-content:flex-end}.excursion-primary-button,.excursion-secondary-button,.excursion-edit-button,.excursion-delete-button{border:0;border-radius:8px;padding:10px 14px;font:inherit;font-size:12px;font-weight:850;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;justify-content:center}.excursion-primary-button{background:#7db500;color:#fff}.excursion-secondary-button,.excursion-edit-button{background:#eef2eb;color:#31402d;border:1px solid #d8dfd3}.excursion-delete-button{background:#f6e6e6;color:#9d3030}.excursion-delete-button:disabled{opacity:.45;cursor:not-allowed}.excursion-admin-summary{display:grid;grid-template-columns:repeat(2,minmax(0,210px));gap:12px;margin:0 0 18px}.excursion-admin-summary article{background:#fff;border:1px solid #e1e6dd;border-radius:10px;padding:15px 18px}.excursion-admin-summary strong,.excursion-admin-summary span{display:block}.excursion-admin-summary strong{font-size:25px;color:#668f08}.excursion-admin-summary span{font-size:11px;color:#6c756a;margin-top:2px}.excursion-admin-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.excursion-admin-card{padding:0;overflow:hidden}.excursion-admin-card.is-inactive{opacity:.7}.excursion-admin-image{height:175px;background:#e8ece5;position:relative;display:flex;align-items:center;justify-content:center;color:#6d756b}.excursion-admin-image img{width:100%;height:100%;object-fit:cover}.excursion-admin-image b{position:absolute;top:11px;left:11px;background:#172015;color:#a8dc39;padding:6px 9px;border-radius:999px;font-size:9px;text-transform:uppercase;letter-spacing:.04em}.excursion-admin-card-body{padding:17px}.excursion-admin-meta{display:flex;justify-content:space-between;gap:10px;align-items:center}.excursion-admin-meta span{font-weight:900;font-size:10px;text-transform:uppercase;color:#6d9b08}.excursion-admin-meta small{font-size:10px;color:#8a9188}.excursion-admin-card h2{font-size:19px;margin:7px 0}.excursion-admin-card p{font-size:12px;line-height:1.5;color:#626a60;margin:0 0 12px}.excursion-admin-card .excursion-admin-region{font-weight:800;color:#424b40}.excursion-admin-status span{display:inline-block;padding:5px 8px;border-radius:999px;font-size:9px;font-weight:900;text-transform:uppercase}.excursion-admin-status .is-active{background:#e8f4dc;color:#578200}.excursion-admin-status .is-off{background:#efefef;color:#707070}.excursion-admin-card footer{display:flex;gap:8px;margin-top:15px;padding-top:13px;border-top:1px solid #e9ece7}.excursion-admin-card footer form{margin:0}.excursion-modal{width:min(820px,calc(100vw - 28px));max-height:92vh;padding:0;border:0;border-radius:14px;box-shadow:0 24px 70px rgba(0,0,0,.28);background:#fff;color:#273025}.excursion-modal::backdrop{background:rgba(13,19,12,.62)}.excursion-modal>form>header,.excursion-category-dialog>header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:20px 22px;border-bottom:1px solid #e6eae3}.excursion-modal header span{font-size:10px;text-transform:uppercase;font-weight:900;color:#739f11}.excursion-modal header h2{margin:3px 0 0;font-size:23px}.excursion-modal header>button{border:0;background:#eef1ec;border-radius:50%;width:34px;height:34px;font-size:22px;cursor:pointer}.excursion-modal-body{padding:20px 22px;overflow:auto;max-height:68vh}.excursion-modal>form>footer,.excursion-category-dialog>footer{display:flex;justify-content:flex-end;gap:9px;padding:16px 22px;border-top:1px solid #e6eae3}.excursion-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.excursion-form-grid label,.excursion-category-row label,.excursion-category-new label{display:grid;gap:6px}.excursion-form-grid label>span,.excursion-category-row label>span,.excursion-category-new label>span{font-size:10px;font-weight:850;color:#566053}.excursion-form-grid .is-wide{grid-column:1/-1}.excursion-form-grid input,.excursion-form-grid select,.excursion-form-grid textarea,.excursion-category-row input,.excursion-category-new input{width:100%;box-sizing:border-box;border:1px solid #d9ded5;border-radius:8px;background:#fff;color:#263024;padding:10px 11px;font:inherit;font-size:12px}.excursion-form-grid textarea{resize:vertical}.excursion-form-grid small{color:#7b8379}.excursion-check{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center;gap:8px!important}.excursion-check input{width:auto!important}.excursion-current-image{min-height:90px;border:1px dashed #d7ddd2;border-radius:9px;padding:9px;display:flex;align-items:center;justify-content:center;background:#f7f9f5}.excursion-current-image img{max-height:150px;max-width:100%;border-radius:7px}.excursion-category-modal{width:min(960px,calc(100vw - 28px))}.excursion-category-new{border:1px solid #e0e5dc;border-radius:10px;padding:15px;margin-bottom:20px}.excursion-category-new h3,.excursion-category-list h3{margin:0 0 12px;font-size:15px}.excursion-category-new form{display:grid;grid-template-columns:minmax(0,1.6fr) 120px auto auto;align-items:end;gap:10px}.excursion-category-row{display:grid;grid-template-columns:minmax(0,1.7fr) 105px auto 75px auto;align-items:end;gap:9px;padding:11px 0;border-top:1px solid #e9ece6}.excursion-category-count{align-self:center;font-size:10px;color:#788075;font-weight:800}.excursion-category-row>div{display:flex;gap:7px}.admin-empty-state{grid-column:1/-1}@media(max-width:1100px){.excursion-admin-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.excursion-category-row{grid-template-columns:1fr 90px auto}.excursion-category-count{grid-column:1}.excursion-category-row>div{grid-column:2/-1;justify-content:flex-end}}@media(max-width:700px){.excursion-admin-heading{align-items:flex-start}.excursion-admin-actions{justify-content:flex-start}.excursion-admin-grid{grid-template-columns:1fr}.excursion-admin-summary{grid-template-columns:1fr 1fr}.excursion-form-grid{grid-template-columns:1fr}.excursion-form-grid .is-wide{grid-column:auto}.excursion-category-new form,.excursion-category-row{grid-template-columns:1fr}.excursion-category-count,.excursion-category-row>div{grid-column:auto}.excursion-category-row>div{justify-content:flex-start}.excursion-modal-body{max-height:72vh}} diff --git a/web/assets/admin-excursions-v1.js b/web/assets/admin-excursions-v1.js new file mode 100644 index 0000000..f106442 --- /dev/null +++ b/web/assets/admin-excursions-v1.js @@ -0,0 +1,44 @@ +(() => { + 'use strict'; + const createModal = document.querySelector('[data-create-modal]'); + const editModal = document.querySelector('[data-edit-modal]'); + const categoryModal = document.querySelector('[data-category-modal]'); + const open = (dialog) => { if (dialog && typeof dialog.showModal === 'function') dialog.showModal(); }; + document.querySelector('[data-open-create]')?.addEventListener('click', () => open(createModal)); + document.querySelector('[data-open-categories]')?.addEventListener('click', () => open(categoryModal)); + document.querySelectorAll('[data-close-dialog]').forEach((button) => button.addEventListener('click', () => button.closest('dialog')?.close())); + document.querySelectorAll('dialog').forEach((dialog) => dialog.addEventListener('click', (event) => { + if (event.target === dialog) dialog.close(); + })); + + const setValue = (name, value) => { + const field = editModal?.querySelector(`[data-field="${name}"]`); + if (!field) return; + if (field.type === 'checkbox') field.checked = value === 'true'; + else field.value = value || ''; + }; + document.querySelectorAll('[data-edit-excursion]').forEach((button) => button.addEventListener('click', () => { + const d = button.dataset; + ['id','categoryId','title','region','description','distance','url','sortOrder'].forEach((key) => { + const fieldName = key === 'categoryId' ? 'category_id' : key === 'sortOrder' ? 'sort_order' : key; + setValue(fieldName, d[key]); + }); + setValue('current_image', d.image); + setValue('image_url', d.image); + setValue('featured', d.featured); + setValue('active', d.active); + const remove = editModal?.querySelector('input[name="remove_image"]'); + if (remove) remove.checked = false; + const file = editModal?.querySelector('input[name="image_file"]'); + if (file) file.value = ''; + const preview = editModal?.querySelector('[data-image-preview]'); + const noImage = editModal?.querySelector('[data-no-image]'); + if (preview && noImage) { + preview.hidden = !d.image; + noImage.hidden = !!d.image; + if (d.image) preview.src = d.image; + else preview.removeAttribute('src'); + } + open(editModal); + })); +})(); diff --git a/web/assets/admin-forum-v2.css b/web/assets/admin-forum-v2.css new file mode 100644 index 0000000..d0f75f9 --- /dev/null +++ b/web/assets/admin-forum-v2.css @@ -0,0 +1 @@ +@import url('/assets/admin-team-forum-v1.css');.forum-admin-page{display:grid;gap:22px}.forum-admin-hero{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;padding:30px;border-radius:24px;background:linear-gradient(135deg,#172619,#395035);color:#fff;box-shadow:0 20px 50px rgba(22,44,22,.16)}.forum-admin-hero span,.admin-card>header span,.side-kicker{color:#aee262;font-size:.72rem;font-weight:900;letter-spacing:.12em;text-transform:uppercase}.forum-admin-hero h1{margin:5px 0 8px;font-size:clamp(1.9rem,3vw,2.7rem)}.forum-admin-hero p{margin:0;color:#dde9da}.forum-admin-hero>a{padding:12px 15px;border:1px solid rgba(255,255,255,.25);border-radius:12px;color:#fff;text-decoration:none;font-weight:800}.forum-admin-tabs{display:flex;gap:8px;flex-wrap:wrap;padding:7px;border:1px solid #dbe4d8;border-radius:15px;background:#fff}.forum-admin-tabs a{padding:10px 14px;border-radius:10px;color:#52614f;text-decoration:none;font-weight:800}.forum-admin-tabs a.is-active{background:#243c23;color:#fff}.forum-admin-tabs b{display:inline-grid;place-items:center;min-width:21px;height:21px;margin-left:5px;border-radius:50%;background:#cbe992;color:#2f4b1f;font-size:.72rem}.forum-admin-kpis{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:13px}.forum-admin-kpis article{padding:18px;border:1px solid #dce4d8;border-radius:17px;background:#fff}.forum-admin-kpis span,.forum-admin-kpis small{display:block;color:#748171}.forum-admin-kpis strong{display:block;margin:5px 0;font-size:1.8rem;color:#213720}.forum-overview-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(280px,.5fr);gap:22px}.admin-card>header{display:flex;justify-content:space-between;gap:20px;margin-bottom:18px}.admin-card>header h2{margin:4px 0}.admin-card>header p{margin:0;color:#71806e}.admin-card>header>a,.forum-admin-side a{color:#477321;text-decoration:none;font-weight:800}.forum-admin-side{display:grid;gap:18px;align-content:start}.forum-admin-side .admin-card{background:#f9fbf7}.forum-admin-side h2{margin:7px 0}.forum-admin-side p{color:#657363;line-height:1.55}.forum-topic-list{display:grid;gap:12px}.forum-topic-card{display:grid;grid-template-columns:48px minmax(0,1fr) auto auto;gap:15px;align-items:center;padding:15px;border:1px solid #dde5da;border-radius:16px;background:#fbfcfa}.forum-topic-status>span{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:#e9f2e3;color:#527f23;font-size:1.15rem}.forum-topic-card.status-locked .forum-topic-status>span{background:#f2e7d7;color:#825a25}.forum-topic-card:not(.status-published):not(.status-locked) .forum-topic-status>span{background:#eee;color:#777}.forum-topic-badges{display:flex;gap:6px;flex-wrap:wrap}.forum-topic-badges span,.forum-topic-badges b{padding:4px 7px;border-radius:999px;background:#e8f1e2;color:#567f2e;font-size:.67rem;text-transform:uppercase}.forum-topic-badges b{background:#fff0cc;color:#7c5b10}.forum-topic-main h3{margin:6px 0 3px}.forum-topic-main h3 a{color:#263824;text-decoration:none}.forum-topic-main p{margin:0;color:#768373;font-size:.85rem}.forum-topic-numbers{display:flex;gap:12px}.forum-topic-numbers span{min-width:62px;color:#748171;font-size:.72rem;text-align:center}.forum-topic-numbers strong{display:block;color:#2d4329;font-size:1.05rem}.forum-topic-actions{display:grid;grid-template-columns:1fr 1fr;gap:6px}.forum-topic-actions button{padding:7px 9px;border:1px solid #ccd8c9;border-radius:8px;background:#fff;color:#3c5138;font:inherit;font-size:.75rem;font-weight:750;cursor:pointer}.forum-topic-actions .danger{color:#a33c34}.forum-category-layout{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(320px,.75fr);gap:22px;align-items:start}.forum-category-list{display:grid;gap:11px}.forum-category-list article{display:grid;grid-template-columns:52px minmax(0,1fr) auto;gap:14px;align-items:center;padding:15px;border:1px solid #dde5da;border-radius:15px}.forum-category-list article.is-inactive{opacity:.58}.forum-category-icon{display:grid;place-items:center;width:48px;height:48px;border-radius:14px;background:#edf3e8;font-size:1.4rem}.forum-category-list h3{margin:0 0 4px}.forum-category-list p{margin:0;color:#6c796a}.forum-category-list small{display:block;margin-top:6px;color:#839080}.forum-category-list a{color:#4d7826;font-weight:800;text-decoration:none}.forum-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.forum-form-grid label{display:grid;gap:7px}.forum-form-grid input,.forum-form-grid textarea,.forum-form-grid select,.forum-filterbar input,.forum-filterbar select{width:100%;padding:11px 12px;border:1px solid #cdd9ca;border-radius:10px;background:#fbfcfa;font:inherit}.forum-form-grid .is-wide{grid-column:1/-1}.forum-checks{display:flex;gap:15px;align-items:center}.forum-checks label{display:flex;grid-template-columns:auto 1fr}.forum-filterbar{display:grid;grid-template-columns:minmax(220px,1fr) 210px auto auto;gap:12px;align-items:end;margin-bottom:18px;padding:15px;border-radius:14px;background:#f1f5ee}.forum-filterbar label{display:grid;gap:5px}.forum-filterbar span{font-size:.72rem;font-weight:850;color:#60705d}.forum-filterbar button,.forum-filterbar a{padding:11px 14px;border:0;border-radius:10px;background:#294329;color:#fff;text-decoration:none;font:inherit;font-weight:800}.forum-filterbar a{background:#fff;color:#52624f;border:1px solid #ccd7c9}.forum-report-list{display:grid;gap:12px}.forum-report-list article{display:flex;justify-content:space-between;gap:18px;padding:17px;border:1px solid #e2dfd3;border-radius:15px;background:#fffcf4}.forum-report-list span{color:#9a6f20;font-size:.72rem;font-weight:900;text-transform:uppercase}.forum-report-list h3{margin:5px 0}.forum-report-list small{color:#796f5f}.forum-report-list a{color:#7b5b20;font-weight:800;text-decoration:none}@media(max-width:1150px){.forum-admin-kpis{grid-template-columns:repeat(3,1fr)}.forum-topic-card{grid-template-columns:46px 1fr}.forum-topic-numbers,.forum-topic-actions{grid-column:2}}@media(max-width:900px){.forum-overview-grid,.forum-category-layout{grid-template-columns:1fr}.forum-admin-kpis{grid-template-columns:1fr 1fr}.forum-filterbar{grid-template-columns:1fr 1fr}}@media(max-width:650px){.forum-admin-hero{align-items:flex-start;flex-direction:column}.forum-admin-kpis{grid-template-columns:1fr}.forum-topic-numbers{flex-wrap:wrap}.forum-topic-actions{grid-template-columns:1fr 1fr}.forum-form-grid,.forum-filterbar{grid-template-columns:1fr}.forum-form-grid .is-wide{grid-column:auto}} diff --git a/web/assets/admin-management-v1.css b/web/assets/admin-management-v1.css new file mode 100644 index 0000000..47f08d3 --- /dev/null +++ b/web/assets/admin-management-v1.css @@ -0,0 +1,7 @@ +.management-tabs{display:flex;gap:8px;margin:0 0 18px}.management-tabs a,.snapshot-form button{padding:10px 14px;border:1px solid #dbe2dc;border-radius:999px;background:#fff;color:#1e2b21;text-decoration:none;font-weight:800}.management-form{margin-bottom:18px}.snapshot-form{display:flex;gap:10px;padding:16px 24px;border-top:1px solid #e6ebe7}.snapshot-form input{max-width:140px}.management-list{display:grid}.management-list article{display:flex;align-items:center;gap:14px;padding:15px 18px;border-bottom:1px solid #edf0ed}.management-list article>div{display:grid;gap:4px;flex:1}.management-list small{color:#69736b}.management-list form{display:flex;gap:6px;flex-wrap:wrap}.management-list button{padding:8px 10px;border:1px solid #d9dfda;border-radius:9px;background:#fff;cursor:pointer}.events-admin-list img{width:84px;height:62px;object-fit:cover;border-radius:10px}.audit-list p{margin:0;color:#4e5951}@media(max-width:760px){.management-list article{align-items:flex-start;flex-wrap:wrap}.management-list form{width:100%}}.program-weekdays{display:flex;gap:8px;align-items:center;flex-wrap:wrap;border:0;padding:0}.program-weekdays label{display:flex;gap:5px;align-items:center;padding:8px 10px;border:1px solid #dfe5df;border-radius:9px}.program-weekdays small{width:100%;color:#69736b}.inline-edit{display:grid!important;grid-template-columns:80px 80px 80px repeat(2,minmax(140px,1fr));gap:7px;flex:1}.inline-edit input,.inline-edit textarea{min-width:0;padding:8px;border:1px solid #dfe5df;border-radius:8px}.event-editor{flex:1}.event-editor summary{display:grid;gap:5px;cursor:pointer}.event-editor .inline-edit{grid-template-columns:repeat(2,minmax(180px,1fr));margin-top:12px}.event-editor textarea{grid-column:1/-1;min-height:100px}@media(max-width:1000px){.inline-edit,.event-editor .inline-edit{grid-template-columns:1fr 1fr}} +.event-source-tabs a{display:inline-flex;align-items:center;gap:8px}.event-source-tabs a b{display:inline-grid;place-items:center;min-width:24px;height:24px;padding:0 7px;border-radius:999px;background:#eef3ec;color:#536052;font-size:11px}.event-source-tabs a.is-active{background:#77bc1f;border-color:#77bc1f;color:#10200d}.event-source-tabs a.is-active b{background:rgba(16,32,13,.14);color:inherit}.admin-info-strip{display:flex;gap:12px;align-items:center;margin:0 0 16px;padding:13px 16px;border:1px solid #dce6d8;border-left:4px solid #76b927;border-radius:12px;background:#f7faf5;color:#536052}.admin-info-strip strong{color:#1c2b1c;white-space:nowrap}.event-status{display:inline-flex;padding:3px 8px;border-radius:999px;font-size:10px;font-weight:900;text-transform:uppercase;letter-spacing:.04em}.event-status.is-published{background:#e4f4ce;color:#4b7915}.event-status.is-pending{background:#fff1c9;color:#8a6500}.event-status.is-rejected{background:#fde1df;color:#a43129}.event-actions button.is-publish{background:#74b91f;border-color:#74b91f;color:#10200d;font-weight:800}.event-actions button.is-reject{background:#fff5e5;border-color:#f0c675;color:#7b5700}.event-actions button.is-delete{color:#a72828}.events-admin-list .admin-empty-state{padding:36px 24px;text-align:center}.events-admin-list .admin-empty-state h2{margin:0 0 8px}.events-admin-list .admin-empty-state p{margin:0;color:#69736b}@media(max-width:760px){.admin-info-strip{align-items:flex-start;flex-direction:column}.event-source-tabs{overflow:auto;padding-bottom:4px}.event-source-tabs a{white-space:nowrap}} + +.event-favorite-badge{display:inline-flex;align-items:center;gap:4px;padding:3px 8px;border-radius:999px;background:#fff1b8;color:#765500;font-size:10px;font-weight:900;text-transform:uppercase;letter-spacing:.04em}.event-actions button.is-favorite{background:#fff9df;border-color:#e7c75c;color:#705100;font-weight:800}.event-actions button.is-favorite.is-active{background:#f2cc42;border-color:#d2a900;color:#3d2d00} + +/* v1.5.11 – professionelles Audit-Protokoll */ +.audit-admin-hero{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin-bottom:22px;padding:30px;border-radius:24px;background:linear-gradient(135deg,#172619,#354c33);color:#fff;box-shadow:0 20px 50px rgba(20,42,21,.16)}.audit-admin-hero span,.audit-admin-card>header span{color:#aee262;font-size:.72rem;font-weight:900;letter-spacing:.12em;text-transform:uppercase}.audit-admin-hero h1{margin:5px 0 8px;font-size:clamp(1.9rem,3vw,2.7rem)}.audit-admin-hero p{margin:0;color:#dce8da}.audit-admin-hero>b{padding:11px 14px;border:1px solid rgba(255,255,255,.25);border-radius:12px;white-space:nowrap}.audit-admin-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:22px}.audit-admin-kpis article{padding:18px;border:1px solid #dce4d8;border-radius:17px;background:#fff}.audit-admin-kpis span,.audit-admin-kpis small{display:block;color:#748171}.audit-admin-kpis strong{display:block;margin:6px 0;font-size:1.8rem;color:#223821}.audit-admin-card>header{display:flex;justify-content:space-between;gap:20px;margin-bottom:16px}.audit-admin-card>header h2{margin:4px 0}.audit-admin-card>header p{margin:0;color:#71806e}.audit-filterbar{display:grid;grid-template-columns:minmax(230px,1fr) minmax(190px,.65fr) 180px auto auto;gap:12px;align-items:end;margin-bottom:20px;padding:16px;border-radius:15px;background:#f1f5ee}.audit-filterbar label{display:grid;gap:5px}.audit-filterbar label>span{color:#62715f;font-size:.72rem;font-weight:850}.audit-filterbar input,.audit-filterbar select{width:100%;padding:11px 12px;border:1px solid #cdd9ca;border-radius:10px;background:#fff;font:inherit}.audit-filterbar button,.audit-filterbar>a{padding:11px 14px;border:0;border-radius:10px;background:#294329;color:#fff;text-decoration:none;font:inherit;font-weight:800}.audit-filterbar>a{border:1px solid #ccd7c9;background:#fff;color:#52624f}.audit-professional-list{display:grid;gap:10px}.audit-professional-list article{display:grid;grid-template-columns:46px minmax(0,1fr);gap:14px;padding:15px;border:1px solid #dfe6dc;border-radius:15px;background:#fbfcfa}.audit-professional-list article.is-failure{border-color:#ead0cc;background:#fff9f8}.audit-result-icon{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:#e5f2df;color:#3e7b2d;font-size:1.15rem;font-weight:900}.is-failure .audit-result-icon{background:#f7dfdc;color:#a34036}.audit-action-row{display:flex;align-items:center;justify-content:space-between;gap:12px}.audit-action-row strong{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:#273d25}.audit-action-row span{padding:4px 8px;border-radius:999px;background:#e4f1dd;color:#39742a;font-size:.68rem;font-weight:900;text-transform:uppercase}.is-failure .audit-action-row span{background:#f6dfdc;color:#9a3c34}.audit-main p{margin:7px 0;color:#566553}.audit-meta{display:flex;gap:7px 14px;flex-wrap:wrap;color:#788575;font-size:.76rem}.audit-meta b{color:#536250}.audit-pagination{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;margin-top:20px}.audit-pagination>div{display:flex;gap:5px}.audit-pagination a{padding:8px 11px;border:1px solid #ccd8c9;border-radius:9px;background:#fff;color:#405b38;text-decoration:none;font-weight:750}.audit-pagination a.is-active{background:#294329;color:#fff}.audit-pagination a.is-disabled{pointer-events:none;opacity:.45}.audit-pagination span{color:#71806e}@media(max-width:1000px){.audit-admin-kpis{grid-template-columns:1fr 1fr}.audit-filterbar{grid-template-columns:1fr 1fr}}@media(max-width:650px){.audit-admin-hero{align-items:flex-start;flex-direction:column}.audit-admin-kpis,.audit-filterbar{grid-template-columns:1fr}.audit-action-row{align-items:flex-start;flex-direction:column}.audit-professional-list article{grid-template-columns:38px 1fr}.audit-result-icon{width:36px;height:36px}} diff --git a/web/assets/admin-media-v38.css b/web/assets/admin-media-v38.css new file mode 100644 index 0000000..1ae4136 --- /dev/null +++ b/web/assets/admin-media-v38.css @@ -0,0 +1,7 @@ +.admin-media-page .media-command{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;padding:30px;border-radius:24px;background:linear-gradient(135deg,#102019,#1d3826);color:#fff;margin-bottom:22px}.media-command h1{margin:5px 0 8px;color:#fff}.media-command p{margin:0;color:#cdd9cf;max-width:720px}.media-command button{white-space:nowrap}.media-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:22px}.media-stats article{padding:20px;border:1px solid #dfe6dc;border-radius:18px;background:#fff}.media-stats span,.media-stats small{display:block;color:#687267}.media-stats strong{display:block;margin:6px 0;font-size:28px}.media-library-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:18px}.media-library-head h2{margin:0}.media-prof-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}.media-prof-card{overflow:hidden;border:1px solid #dfe6dc;border-radius:18px;background:#fff}.media-prof-card img{width:100%;aspect-ratio:4/3;object-fit:cover;background:#edf1eb}.media-prof-body{padding:14px}.media-prof-body strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.media-prof-body small{display:block;margin:5px 0 10px;color:#70796f}.media-prof-path{display:block;padding:8px;border-radius:9px;background:#f3f6f1;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.media-prof-actions{display:flex;justify-content:space-between;gap:8px;margin-top:12px}.media-pagination{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:24px;padding-top:18px;border-top:1px solid #e2e7df}.media-pagination-links{display:flex;flex-wrap:wrap;gap:7px}.media-pagination a,.media-pagination span{display:inline-flex;align-items:center;justify-content:center;min-width:38px;height:38px;padding:0 11px;border:1px solid #d7dfd4;border-radius:10px;text-decoration:none;color:#263126;background:#fff}.media-pagination .is-active{border-color:#7eb42c;background:#7eb42c;color:#fff}.media-upload-modal{position:fixed;inset:0;z-index:1100;display:grid;place-items:center;padding:20px}.media-upload-modal[hidden]{display:none}.media-upload-backdrop{position:absolute;inset:0;background:rgba(4,12,7,.7);backdrop-filter:blur(5px)}.media-upload-dialog{position:relative;z-index:1;width:min(780px,96vw);max-height:90vh;overflow:auto;border-radius:24px;background:#fff;padding:26px}.media-upload-dialog header{display:flex;justify-content:space-between;gap:20px}.media-upload-dialog header button{width:42px;height:42px;border:0;border-radius:50%;font-size:25px}.admin-media-page.media-modal-open{overflow:hidden}@media(max-width:1100px){.media-prof-grid{grid-template-columns:repeat(3,1fr)}}@media(max-width:760px){.admin-media-page .media-command{display:grid;padding:22px}.media-stats{grid-template-columns:1fr}.media-prof-grid{grid-template-columns:repeat(2,1fr)}.media-pagination{align-items:flex-start;flex-direction:column}}@media(max-width:480px){.media-prof-grid{grid-template-columns:1fr}} +/* v1.5.24 – KI-Medienkennzeichnung */ +.media-ai-badge{display:inline-flex;width:max-content;margin-top:8px;padding:4px 7px;border-radius:999px;background:#eee7f8;color:#604086;font-size:.68rem;font-weight:900;text-transform:uppercase}.media-ai-note{margin:5px 0 0!important;color:#655b6d!important;font-size:.75rem;line-height:1.4}.media-upload-dialog select{width:100%;padding:11px;border:1px solid #ced8cc;border-radius:10px;background:#fff;font:inherit}.admin-field-grid small{display:block;margin-top:5px;color:#768075;font-size:.72rem;line-height:1.4} + +/* v1.5.25 – nachträgliche KI-Kennzeichnung und sichtbare Wasserzeichen */ +.media-prof-image{position:relative;overflow:hidden;background:#eef2ec}.media-prof-image>img{display:block;width:100%;aspect-ratio:4/3;object-fit:cover}.media-visible-watermark{position:absolute;right:10px;bottom:10px;z-index:3;display:inline-flex;max-width:calc(100% - 20px);align-items:center;padding:7px 11px;border:1px solid rgba(255,255,255,.72);border-radius:8px;color:#fff;background:rgba(13,20,14,.88);box-shadow:0 4px 14px rgba(0,0,0,.3);font-size:12px;font-weight:900;line-height:1.2;letter-spacing:.02em;text-shadow:0 1px 2px #000}.media-watermark-state{display:inline-flex;width:max-content;max-width:100%;padding:6px 9px;border-radius:8px;color:#2f5611;background:#e8f4dc;font-size:11px;font-weight:850}.media-prof-actions{flex-wrap:wrap}.media-prof-actions form{margin-left:auto}.media-edit-modal{position:fixed;inset:0;z-index:1250;display:grid;place-items:center;padding:20px}.media-edit-modal[hidden]{display:none}.media-edit-preview{display:grid;gap:8px;padding:0 26px 18px}.media-edit-preview>div{position:relative;overflow:hidden;max-width:420px;border-radius:14px;background:#e9eee7}.media-edit-preview img{display:block;width:100%;max-height:260px;object-fit:contain}.media-edit-preview small{color:#68736a}.admin-switch{display:grid!important;grid-template-columns:auto 1fr!important;align-items:flex-start;gap:12px;padding:14px;border:1px solid #dce5d8;border-radius:12px;background:#f5f8f3}.admin-switch input{width:auto!important;margin-top:4px}.admin-switch span{display:grid;gap:3px}.admin-switch strong{color:#263b27}.admin-switch small{color:#6d766e}.media-upload-dialog select{width:100%;box-sizing:border-box;border:1px solid #ccd5ca;border-radius:11px;padding:11px 12px;font:inherit;background:#fff}.media-upload-dialog select:focus{outline:3px solid rgba(143,198,63,.22);border-color:#84b93c} +@media(max-width:760px){.media-edit-modal{padding:8px}.media-edit-preview{padding:0 20px 16px}.media-prof-actions>*{flex:1}.media-prof-actions form{margin-left:0}.media-prof-actions button{width:100%}} diff --git a/web/assets/admin-media-v38.js b/web/assets/admin-media-v38.js new file mode 100644 index 0000000..14e48d3 --- /dev/null +++ b/web/assets/admin-media-v38.js @@ -0,0 +1,86 @@ +(() => { + const modal = document.querySelector('[data-media-modal]'); + if (!modal) return; + const open = () => { modal.hidden = false; document.body.style.overflow = 'hidden'; }; + const close = () => { modal.hidden = true; document.body.style.overflow = ''; }; + document.querySelectorAll('[data-media-open]').forEach(button => button.addEventListener('click', open)); + modal.querySelectorAll('[data-media-close]').forEach(button => button.addEventListener('click', close)); + const input = modal.querySelector('[data-file-input]'); + const label = modal.querySelector('[data-file-name]'); + if (input && label) input.addEventListener('change', () => { label.textContent = input.files?.[0]?.name || 'Noch keine Datei ausgewählt'; }); + document.addEventListener('keydown', event => { if (event.key === 'Escape' && !modal.hidden) close(); }); +})(); + +(() => { + const modal = document.querySelector('[data-media-edit-modal]'); + const form = document.querySelector('[data-media-edit-form]'); + if (!modal || !form) return; + const fields = { + id: form.querySelector('[data-media-edit-id]'), + alt: form.querySelector('[data-media-edit-alt]'), + holder: form.querySelector('[data-media-edit-holder]'), + note: form.querySelector('[data-media-edit-note]'), + usage: form.querySelector('[data-media-edit-ai-usage]'), + disclosure: form.querySelector('[data-media-edit-disclosure]'), + enabled: form.querySelector('[data-media-edit-watermark-toggle]'), + text: form.querySelector('[data-media-edit-watermark-text]') + }; + const image = modal.querySelector('[data-media-edit-image]'); + const name = modal.querySelector('[data-media-edit-name]'); + const preview = modal.querySelector('[data-media-edit-watermark]'); + let lastFocus = null; + const defaultLabel = () => fields.usage.value === 'manipulated' ? 'Mit KI bearbeitet' : 'Mit KI erstellt'; + const refresh = () => { + const visible = fields.enabled.checked && fields.usage.value !== 'none'; + preview.hidden = !visible; + preview.textContent = fields.text.value.trim() || defaultLabel(); + fields.enabled.disabled = fields.usage.value === 'none'; + fields.text.disabled = fields.usage.value === 'none'; + if (fields.usage.value === 'none') fields.enabled.checked = false; + }; + const open = button => { + lastFocus = button; + fields.id.value = button.dataset.id || ''; + fields.alt.value = button.dataset.alt || ''; + fields.holder.value = button.dataset.holder || ''; + fields.note.value = button.dataset.note || ''; + fields.usage.value = button.dataset.aiUsage || 'none'; + fields.disclosure.value = button.dataset.aiDisclosure || ''; + fields.enabled.checked = button.dataset.watermarkEnabled === 'true'; + fields.text.value = button.dataset.watermarkText || ''; + image.src = button.dataset.url || ''; + name.textContent = button.dataset.name || ''; + modal.hidden = false; + document.body.style.overflow = 'hidden'; + refresh(); + requestAnimationFrame(() => fields.alt.focus()); + }; + const close = () => { + modal.hidden = true; + document.body.style.overflow = ''; + if (lastFocus instanceof HTMLElement) lastFocus.focus(); + }; + document.querySelectorAll('[data-media-edit]').forEach(button => button.addEventListener('click', () => open(button))); + modal.querySelectorAll('[data-media-edit-close]').forEach(button => button.addEventListener('click', close)); + fields.usage.addEventListener('change', refresh); + fields.enabled.addEventListener('change', refresh); + fields.text.addEventListener('input', refresh); + document.addEventListener('keydown', event => { if (event.key === 'Escape' && !modal.hidden) close(); }); +})(); + +(() => { + document.querySelectorAll('form').forEach(form => { + const usage = form.querySelector('[data-ai-usage-select]'); + const toggle = form.querySelector('[data-watermark-toggle]'); + const textWrap = form.querySelector('[data-watermark-text-wrap]'); + if (!usage || !toggle) return; + const refresh = () => { + const allowed = usage.value !== 'none'; + toggle.disabled = !allowed; + if (!allowed) toggle.checked = false; + if (textWrap) textWrap.hidden = !allowed; + }; + usage.addEventListener('change', refresh); + refresh(); + }); +})(); diff --git a/web/assets/admin-mediathek-v2.css b/web/assets/admin-mediathek-v2.css new file mode 100644 index 0000000..19871e9 --- /dev/null +++ b/web/assets/admin-mediathek-v2.css @@ -0,0 +1,6 @@ +@import url('/assets/admin-site-content-v2.css');.mediathek-admin{display:grid;gap:24px}.mediathek-admin-grid{display:grid;grid-template-columns:minmax(350px,.75fr) minmax(0,1.25fr);gap:24px;align-items:start}.media-entry-form{display:grid;grid-template-columns:1fr 1fr;gap:15px}.media-entry-form label{display:grid;gap:7px}.media-entry-form label>span,.audio-source legend{font-weight:750;color:#344432}.media-entry-form input,.media-entry-form select,.media-entry-form textarea{width:100%;padding:12px;border:1px solid #ced9ca;border-radius:11px;background:#fbfcfa;font:inherit}.media-entry-form .is-wide{grid-column:1/-1}.audio-source{display:grid;gap:12px;padding:16px;border:1px solid #dbe4d8;border-radius:14px}.audio-source audio{width:100%}.media-checkboxes{display:flex;gap:18px;flex-wrap:wrap}.media-checkboxes label{display:flex;grid-template-columns:auto 1fr;align-items:center}.media-checkboxes input{width:auto}.mediathek-entry-list{display:grid;gap:13px}.mediathek-entry-list article{display:grid;grid-template-columns:90px minmax(0,1fr) auto;gap:16px;padding:15px;border:1px solid #dce4d9;border-radius:16px;background:#fbfcfa}.mediathek-entry-list article.is-inactive{opacity:.6}.mediathek-entry-list img,.media-cover-placeholder{width:90px;height:90px;border-radius:13px;object-fit:cover}.media-cover-placeholder{display:grid;place-items:center;background:#e4ecdf;color:#618c2b;font-size:2rem}.media-entry-meta{display:flex;gap:7px;flex-wrap:wrap}.media-entry-meta span,.media-entry-meta b{padding:4px 7px;border-radius:999px;background:#e8f2df;color:#517d20;font-size:.69rem;text-transform:uppercase}.media-entry-meta b{background:#fff0c8;color:#7b590a}.mediathek-entry-list h3{margin:7px 0 3px}.mediathek-entry-list p{margin:0;color:#677466}.mediathek-entry-list small{display:block;margin-top:7px;color:#7c887a}.mediathek-entry-list audio{width:100%;height:36px;margin-top:10px}.media-entry-actions{display:flex;gap:7px;align-items:flex-start}.media-entry-actions a,.media-entry-actions button{padding:8px 10px;border:1px solid #ccd8c9;border-radius:9px;background:#fff;color:#354b31;text-decoration:none;font:inherit;font-weight:750}.media-entry-actions button{color:#a13b32}@media(max-width:1100px){.mediathek-admin-grid{grid-template-columns:1fr}}@media(max-width:700px){.media-entry-form{grid-template-columns:1fr}.media-entry-form .is-wide{grid-column:auto}.mediathek-entry-list article{grid-template-columns:70px 1fr}.mediathek-entry-list img,.media-cover-placeholder{width:70px;height:70px}.media-entry-actions{grid-column:1/-1}} + +/* v1.5.11 – direkte Übernahme aus dem KI-Nachrichtenstudio */ +.generated-audio-card{overflow:hidden}.generated-audio-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.generated-audio-list article{display:flex;flex-direction:column;justify-content:space-between;gap:14px;padding:16px;border:1px solid #dce5d9;border-radius:16px;background:#fbfcfa}.generated-audio-list article.is-imported{background:#f0f4ed;opacity:.72}.generated-audio-list span{color:#628f29;font-size:.7rem;font-weight:850;letter-spacing:.08em;text-transform:uppercase}.generated-audio-list h3{margin:5px 0 8px}.generated-audio-list p{display:-webkit-box;overflow:hidden;margin:0;color:#617060;line-height:1.55;-webkit-box-orient:vertical;-webkit-line-clamp:4}.generated-audio-list audio{width:100%;height:38px;margin-top:12px}.generated-audio-list form button,.generated-audio-list>article>strong{width:100%;padding:10px 12px;border:0;border-radius:10px;background:#203d28;color:#fff;font:inherit;font-weight:800}.generated-audio-list>article>strong{display:block;background:#dce8d7;color:#45603f;text-align:center}.media-entry-meta b+ b{background:#e5ebf2;color:#4a5e78}@media(max-width:1200px){.generated-audio-list{grid-template-columns:1fr 1fr}}@media(max-width:720px){.generated-audio-list{grid-template-columns:1fr}} +/* v1.5.24 – KI-Transparenz */ +.mediathek-ai-fields{display:grid;gap:13px;padding:16px;border:1px solid #cfdacb;border-radius:14px;background:#f6faf3}.mediathek-ai-fields legend{padding:0 7px;font-weight:900;color:#304b31}.mediathek-ai-fields>p{margin:0;color:#687565;line-height:1.5}.mediathek-ai-fields>div{display:grid;grid-template-columns:1fr 1fr;gap:13px}.mediathek-ai-fields>div>.is-wide{grid-column:1/-1}.mediathek-ai-fields>a{width:max-content;color:#577e27;font-weight:800;text-decoration:none}.mediathek-ai-check{display:flex!important;grid-template-columns:auto 1fr!important;align-items:flex-start;padding:12px;border:1px solid #d7e0d3;border-radius:11px;background:#fff}.mediathek-ai-check input{width:auto!important;margin-top:3px}.mediathek-ai-check>span{display:grid;gap:3px}.mediathek-ai-check small{color:#778176}.media-entry-meta .is-ai{background:#ede7f7;color:#63438a}@media(max-width:700px){.mediathek-ai-fields>div{grid-template-columns:1fr}.mediathek-ai-fields>div>.is-wide{grid-column:auto}} diff --git a/web/assets/admin-navigation-v1.css b/web/assets/admin-navigation-v1.css new file mode 100644 index 0000000..83de470 --- /dev/null +++ b/web/assets/admin-navigation-v1.css @@ -0,0 +1 @@ +.navigation-admin-page{display:grid;gap:18px}.navigation-admin-page .admin-page-heading{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}.nav-preview-button{display:inline-flex;padding:11px 16px;border-radius:10px;background:#172119;color:#fff;text-decoration:none;font-weight:800}.navigation-admin-grid{display:grid;grid-template-columns:minmax(290px,390px) minmax(0,1fr);gap:18px;align-items:start}.nav-editor,.nav-tree{padding:22px}.nav-editor header,.nav-tree header{margin-bottom:18px}.nav-editor h2,.nav-tree h2{margin:4px 0}.nav-editor form{display:grid;gap:14px}.nav-editor label{display:grid;gap:6px;font-weight:800}.nav-editor input,.nav-editor select{width:100%;padding:11px 12px;border:1px solid #d8e0d8;border-radius:10px;background:#fff}.nav-editor small,.nav-row small{color:#6b756d;font-weight:500}.nav-editor .admin-check{display:flex;align-items:flex-start;gap:10px;padding:12px;border:1px solid #e0e6e0;border-radius:10px}.nav-editor .admin-check input{width:auto;margin-top:3px}.nav-editor .admin-check span{display:grid;gap:2px}.nav-form-actions{display:flex;justify-content:flex-end;align-items:center;gap:10px;padding-top:8px}.nav-form-actions a{color:#58645b}.nav-form-actions button{border:0;border-radius:10px;padding:11px 15px;background:#78bd24;color:#10200d;font-weight:900;cursor:pointer}.nav-tree-list{display:grid;gap:12px}.nav-root{border:1px solid #e0e6e0;border-radius:13px;overflow:hidden;background:#fff}.nav-row{display:grid;grid-template-columns:30px minmax(0,1fr) auto;gap:10px;align-items:center;padding:13px 14px}.nav-row.is-inactive,.nav-root.is-inactive>.nav-row{opacity:.58}.nav-grip,.nav-branch{display:grid;place-items:center;width:27px;height:27px;border-radius:8px;background:#edf4e8;color:#4e741e;font-weight:900}.nav-children{border-top:1px solid #edf0ed;background:#fafcf9}.nav-children .nav-row{padding-left:26px;border-bottom:1px solid #edf0ed}.nav-children .nav-row:last-child{border-bottom:0}.nav-row>div:nth-child(2){display:grid;gap:3px}.nav-row-actions{display:flex;gap:7px;align-items:center}.nav-row-actions a,.nav-row-actions button{padding:7px 9px;border:1px solid #dce2dc;border-radius:8px;background:#fff;color:#253029;text-decoration:none;font-size:12px;font-weight:800;cursor:pointer}.nav-row-actions button{color:#a2322b}@media(max-width:980px){.navigation-admin-grid{grid-template-columns:1fr}.navigation-admin-page .admin-page-heading{flex-direction:column}.nav-row{grid-template-columns:28px minmax(0,1fr)}.nav-row-actions{grid-column:2;justify-content:flex-start}}@media(max-width:560px){.nav-row-actions{flex-wrap:wrap}.nav-editor,.nav-tree{padding:16px}} diff --git a/web/assets/admin-news-studio-v4.js b/web/assets/admin-news-studio-v4.js new file mode 100644 index 0000000..9e43f80 --- /dev/null +++ b/web/assets/admin-news-studio-v4.js @@ -0,0 +1,65 @@ +document.addEventListener('DOMContentLoaded',()=>{ + const tabs=[...document.querySelectorAll('[data-studio-tab]')]; + const panels=[...document.querySelectorAll('[data-channel-panel]')]; + const input=document.getElementById('activeChannel'); + const label=document.getElementById('activeChannelLabel'); + const form=document.getElementById('newsStudioForm'); + const actionInput=document.getElementById('newsStudioAction'); + const modal=document.getElementById('productionProgressModal'); + const frame=document.getElementById('productionProgressFrame'); + + function activate(key,push=true){ + tabs.forEach(button=>{ + const active=button.dataset.studioTab===key; + button.classList.toggle('active',active); + button.setAttribute('aria-selected',active?'true':'false'); + }); + panels.forEach(panel=>panel.classList.toggle('active',panel.dataset.channelPanel===key)); + if(input)input.value=key; + const button=tabs.find(item=>item.dataset.studioTab===key); + if(label&&button)label.textContent=button.textContent.trim(); + if(push){ + const url=new URL(location.href); + url.searchParams.set('tab',key); + history.replaceState({},'',url); + } + } + + tabs.forEach(button=>button.addEventListener('click',()=>activate(button.dataset.studioTab))); + document.querySelectorAll('[data-close-progress]').forEach(button=>button.addEventListener('click',()=>{modal?.close();if(frame)frame.src='about:blank'})); + + if(form){ + form.addEventListener('submit',event=>{ + const submitter=event.submitter; + if(!submitter)return; + const action=submitter.value||submitter.dataset.action||''; + if(actionInput)actionInput.value=action; + if(action==='produce_stream'){ + if(frame){ + frame.srcdoc='Der Produktionsauftrag wird an den Server übergeben …'; + } + modal?.showModal(); + form.setAttribute('aria-busy','true'); + setTimeout(()=>{ + submitter.disabled=true; + submitter.textContent=submitter.dataset.submitLabel||'Produktion läuft …'; + },0); + return; + } + const nextLabel=submitter.dataset.submitLabel; + if(nextLabel)submitter.textContent=nextLabel; + setTimeout(()=>{submitter.disabled=true},0); + }); + } + + window.addEventListener('message',event=>{ + if(event.origin!==location.origin||!event.data||event.data.type!=='landwelle-news-production')return; + if(event.data.status==='done'){ + setTimeout(()=>location.reload(),1400); + }else if(event.data.status==='error'){ + form?.removeAttribute('aria-busy'); + const button=form?.querySelector('button[value="produce_stream"]'); + if(button){button.disabled=false;button.textContent='3 MP3s erzeugen und hochladen'} + } + }); +}); diff --git a/web/assets/admin-news-studio-v5.css b/web/assets/admin-news-studio-v5.css new file mode 100644 index 0000000..b823fdb --- /dev/null +++ b/web/assets/admin-news-studio-v5.css @@ -0,0 +1,6 @@ +.news-studio-page{display:grid;gap:22px}.studio-hero{display:flex;justify-content:space-between;align-items:flex-start;gap:24px;padding:28px;border-radius:22px;background:linear-gradient(135deg,#101b12,#172819);color:#fff;box-shadow:0 18px 44px rgba(13,28,16,.13)}.studio-hero h1{margin:5px 0 8px;font-size:clamp(28px,4vw,42px)}.studio-hero p{max-width:800px;margin:0;color:#c9d4ca;line-height:1.6}.provider-state{display:flex;gap:8px;flex-wrap:wrap}.provider-state span{padding:7px 11px;border-radius:999px;font-size:12px;font-weight:800;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.16)}.provider-state .ok{color:#b9ef68;border-color:rgba(185,239,104,.45)}.provider-state .bad{color:#ffd0cb;border-color:rgba(255,160,150,.38)}.studio-control-card{padding:0;overflow:hidden}.studio-section-head{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;padding:22px 24px}.studio-section-head h2{margin:4px 0 5px}.studio-section-head p{margin:0;color:#6b746d}.studio-tabs{display:flex;gap:4px;padding:0 24px;border-top:1px solid #edf0ec;border-bottom:1px solid #dfe5dd;overflow:auto}.studio-tabs button{padding:14px 18px;border:0;border-bottom:3px solid transparent;background:transparent;font:inherit;font-weight:800;color:#647068;cursor:pointer;white-space:nowrap}.studio-tabs button.active{color:#315c16;border-bottom-color:#8fc63f}.global-settings{display:grid;grid-template-columns:1fr 220px;gap:16px;padding:20px 24px;background:#f7f9f6;border-bottom:1px solid #e4e9e2}.news-studio-page label{display:grid;gap:7px;font-weight:750;color:#344138}.news-studio-page input,.news-studio-page textarea{width:100%;box-sizing:border-box;border:1px solid #ccd5ca;border-radius:11px;padding:11px 12px;background:#fff;color:#243126;font:inherit;line-height:1.5}.news-studio-page input:focus,.news-studio-page textarea:focus{outline:3px solid rgba(143,198,63,.22);border-color:#84b93c}.news-studio-page small{color:#737d75;line-height:1.5}.channel-panel{display:none;padding:24px}.channel-panel.active{display:block}.channel-grid{display:grid;grid-template-columns:minmax(0,.9fr) minmax(460px,1.1fr);gap:20px;align-items:start}.editor-column{display:grid;gap:16px}.field-card{padding:18px;border:1px solid #e0e7de;border-radius:16px;background:#fff}.field-card h3,.outputs-head h3{margin:4px 0 12px}.outputs-column{padding:18px;border:1px solid #dfe7dc;border-radius:17px;background:#f7faf5}.outputs-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:14px}.outputs-head>span{padding:6px 9px;border-radius:999px;background:#e8f3dc;color:#4d7326;font-size:12px;font-weight:800}.output-card-list{display:grid;gap:12px}.output-card{display:grid;grid-template-columns:42px 1fr;gap:12px;align-items:start;padding:14px;border:1px solid #dce4da;border-radius:14px;background:#fff}.output-number{display:grid;place-items:center;width:38px;height:38px;border-radius:11px;background:#8fc63f;color:#15210f;font-weight:900}.output-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.production-box{margin:0 24px 24px;padding:20px;border:1px solid #dce4da;border-radius:16px;background:#f7faf5}.production-box label>span{font-weight:500;color:#788079}.production-actions{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-top:15px}.production-actions>div{display:grid;gap:3px}.production-actions span{color:#6e786f}.production-actions b{color:#4b7621}.studio-bottom-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(300px,.7fr);gap:18px}.production-history,.setup-note{min-width:0}.history-list{display:grid;gap:12px;padding:0 24px 24px;max-height:760px;overflow:auto}.history-list article{padding:16px;border:1px solid #e0e6de;border-radius:15px;background:#fafcf9}.history-top,.history-meta{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.history-top time{color:#79817b;font-size:12px}.history-list p{color:#4f5b52;line-height:1.55}.history-meta{margin:10px 0}.history-meta code{overflow-wrap:anywhere;padding:4px 7px;border-radius:7px;background:#edf2ea;color:#3f6520;font-size:12px}.status-done{color:#4d7b20;font-weight:800}.status-error,.history-error{color:#a63b35}.history-list a,.setup-note a{color:#527f25;font-weight:800}.setup-note{padding:24px}.setup-note h2{margin:5px 0 8px}.setup-note p{margin:0;color:#657067;line-height:1.65}.empty-state{padding:28px 24px;color:#687269}.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}@media(max-width:1100px){.channel-grid,.studio-bottom-grid{grid-template-columns:1fr}}@media(max-width:760px){.studio-hero,.studio-section-head,.production-actions{align-items:stretch;flex-direction:column}.provider-state{justify-content:flex-start}.global-settings,.output-fields{grid-template-columns:1fr}.channel-panel,.studio-section-head,.global-settings{padding-left:18px;padding-right:18px}.production-box{margin-left:18px;margin-right:18px}.studio-tabs{padding:0 18px}.output-card{grid-template-columns:36px 1fr}.production-actions button{width:100%}} +.volume-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.field-card select{width:100%}@media(max-width:680px){.volume-grid{grid-template-columns:1fr}} +.production-progress-modal{border:0;border-radius:18px;padding:0;width:min(680px,calc(100% - 32px));box-shadow:0 28px 90px #0005}.production-progress-modal::backdrop{background:#102317aa}.production-progress-card{padding:24px;display:grid;gap:18px}.production-progress-card header,.production-progress-card footer{display:flex;align-items:center;justify-content:space-between;gap:16px}.production-progress-card header button{border:0;background:transparent;font-size:30px}.production-progress-steps{display:grid;gap:9px}.production-step{display:flex;gap:12px;padding:12px;border:1px solid #dde6de;border-radius:12px}.production-step i{width:12px;height:12px;border-radius:50%;margin-top:4px;background:#bbc5bc}.production-step.running i{background:#d69b24;box-shadow:0 0 0 4px #d69b2422}.production-step.done i{background:#1f7a3f}.production-step.error i{background:#b62e2e}.production-step div{display:grid;gap:3px}.production-step span{font-size:.9rem;color:#5d695f} +.production-progress-frame{display:block;width:100%;height:min(560px,62vh);border:0;border-radius:13px;background:#f5f7f3}.production-progress-card{width:100%}.production-progress-card>p{margin:0;color:#5d695f}.production-progress-modal[open]{max-height:calc(100vh - 32px);overflow:auto}@media(max-width:680px){.production-progress-card{padding:18px}.production-progress-frame{height:64vh}} +/* v1.5.24 – KI-Transparenzhinweis */ +.studio-ai-transparency{display:grid;grid-template-columns:42px minmax(0,1fr) auto;gap:14px;align-items:center;padding:15px 17px;border:1px solid #d8cdea;border-radius:15px;background:#f7f3fc;color:#3c3048}.studio-ai-transparency>span{display:grid;place-items:center;width:40px;height:40px;border-radius:12px;background:#70509c;color:#fff;font-size:1.1rem}.studio-ai-transparency strong{display:block}.studio-ai-transparency p{margin:4px 0 0;color:#655a6f;line-height:1.5}.studio-ai-transparency a{color:#5f3f83;font-weight:850;text-decoration:none;white-space:nowrap}@media(max-width:720px){.studio-ai-transparency{grid-template-columns:38px 1fr}.studio-ai-transparency a{grid-column:2;white-space:normal}} diff --git a/web/assets/admin-news-studio-v5.js b/web/assets/admin-news-studio-v5.js new file mode 100644 index 0000000..332d220 --- /dev/null +++ b/web/assets/admin-news-studio-v5.js @@ -0,0 +1,79 @@ +document.addEventListener('DOMContentLoaded',()=>{ + const tabs=[...document.querySelectorAll('[data-studio-tab]')]; + const panels=[...document.querySelectorAll('[data-channel-panel]')]; + const input=document.getElementById('activeChannel'); + const label=document.getElementById('activeChannelLabel'); + const form=document.getElementById('newsStudioForm'); + const actionInput=document.getElementById('newsStudioAction'); + const modal=document.getElementById('productionProgressModal'); + const frame=document.getElementById('productionProgressFrame'); + const productionCountLabel=document.getElementById('productionCountLabel'); + const produceButton=document.getElementById('produceButton'); + const productionModalTitle=document.getElementById('productionModalTitle'); + + function activate(key,push=true){ + tabs.forEach(button=>{ + const active=button.dataset.studioTab===key; + button.classList.toggle('active',active); + button.setAttribute('aria-selected',active?'true':'false'); + }); + panels.forEach(panel=>panel.classList.toggle('active',panel.dataset.channelPanel===key)); + if(input)input.value=key; + const button=tabs.find(item=>item.dataset.studioTab===key); + if(label&&button)label.textContent=button.textContent.trim(); + const weather=key==='weather'; + if(productionCountLabel)productionCountLabel.textContent=weather?'Einen Beitrag erzeugen':'Drei Beiträge erzeugen'; + if(produceButton&&!produceButton.disabled)produceButton.textContent=weather?'1 MP3 erzeugen und hochladen':'3 MP3s erzeugen und hochladen'; + if(productionModalTitle)productionModalTitle.textContent=weather?'1 MP3-Datei wird erstellt':'3 MP3-Dateien werden erstellt'; + if(push){ + const url=new URL(location.href); + url.searchParams.set('tab',key); + history.replaceState({},'',url); + } + } + + tabs.forEach(button=>button.addEventListener('click',()=>activate(button.dataset.studioTab))); + document.querySelectorAll('[data-close-progress]').forEach(button=>button.addEventListener('click',()=>{modal?.close();if(frame)frame.src='about:blank'})); + + if(form){ + form.addEventListener('submit',event=>{ + const submitter=event.submitter; + if(!submitter)return; + if(submitter.dataset.confirm&&!window.confirm(submitter.dataset.confirm)){ + event.preventDefault(); + return; + } + const action=submitter.value||submitter.dataset.action||''; + if(actionInput)actionInput.value=action; + if(action==='produce_stream'){ + if(frame){ + frame.srcdoc='Der Produktionsauftrag wird an den Server übergeben …'; + } + modal?.showModal(); + form.setAttribute('aria-busy','true'); + setTimeout(()=>{ + submitter.disabled=true; + submitter.textContent=submitter.dataset.submitLabel||'Produktion läuft …'; + },0); + return; + } + const nextLabel=submitter.dataset.submitLabel; + if(nextLabel)submitter.textContent=nextLabel; + setTimeout(()=>{submitter.disabled=true},0); + }); + } + + window.addEventListener('message',event=>{ + if(event.origin!==location.origin||!event.data||event.data.type!=='landwelle-news-production')return; + if(event.data.status==='done'){ + setTimeout(()=>location.reload(),1400); + }else if(event.data.status==='error'){ + form?.removeAttribute('aria-busy'); + const button=form?.querySelector('button[value="produce_stream"]'); + if(button){ + button.disabled=false; + button.textContent=input?.value==='weather'?'1 MP3 erzeugen und hochladen':'3 MP3s erzeugen und hochladen'; + } + } + }); +}); diff --git a/web/assets/admin-news-studio-v6.css b/web/assets/admin-news-studio-v6.css new file mode 100644 index 0000000..879065c --- /dev/null +++ b/web/assets/admin-news-studio-v6.css @@ -0,0 +1,8 @@ +.news-studio-page{display:grid;gap:22px}.studio-hero{display:flex;justify-content:space-between;align-items:flex-start;gap:24px;padding:28px;border-radius:22px;background:linear-gradient(135deg,#101b12,#172819);color:#fff;box-shadow:0 18px 44px rgba(13,28,16,.13)}.studio-hero h1{margin:5px 0 8px;font-size:clamp(28px,4vw,42px)}.studio-hero p{max-width:800px;margin:0;color:#c9d4ca;line-height:1.6}.provider-state{display:flex;gap:8px;flex-wrap:wrap}.provider-state span{padding:7px 11px;border-radius:999px;font-size:12px;font-weight:800;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.16)}.provider-state .ok{color:#b9ef68;border-color:rgba(185,239,104,.45)}.provider-state .bad{color:#ffd0cb;border-color:rgba(255,160,150,.38)}.studio-control-card{padding:0;overflow:hidden}.studio-section-head{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;padding:22px 24px}.studio-section-head h2{margin:4px 0 5px}.studio-section-head p{margin:0;color:#6b746d}.studio-tabs{display:flex;gap:4px;padding:0 24px;border-top:1px solid #edf0ec;border-bottom:1px solid #dfe5dd;overflow:auto}.studio-tabs button{padding:14px 18px;border:0;border-bottom:3px solid transparent;background:transparent;font:inherit;font-weight:800;color:#647068;cursor:pointer;white-space:nowrap}.studio-tabs button.active{color:#315c16;border-bottom-color:#8fc63f}.global-settings{display:grid;grid-template-columns:1fr 220px;gap:16px;padding:20px 24px;background:#f7f9f6;border-bottom:1px solid #e4e9e2}.news-studio-page label{display:grid;gap:7px;font-weight:750;color:#344138}.news-studio-page input,.news-studio-page textarea{width:100%;box-sizing:border-box;border:1px solid #ccd5ca;border-radius:11px;padding:11px 12px;background:#fff;color:#243126;font:inherit;line-height:1.5}.news-studio-page input:focus,.news-studio-page textarea:focus{outline:3px solid rgba(143,198,63,.22);border-color:#84b93c}.news-studio-page small{color:#737d75;line-height:1.5}.channel-panel{display:none;padding:24px}.channel-panel.active{display:block}.channel-grid{display:grid;grid-template-columns:minmax(0,.9fr) minmax(460px,1.1fr);gap:20px;align-items:start}.editor-column{display:grid;gap:16px}.field-card{padding:18px;border:1px solid #e0e7de;border-radius:16px;background:#fff}.field-card h3,.outputs-head h3{margin:4px 0 12px}.outputs-column{padding:18px;border:1px solid #dfe7dc;border-radius:17px;background:#f7faf5}.outputs-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:14px}.outputs-head>span{padding:6px 9px;border-radius:999px;background:#e8f3dc;color:#4d7326;font-size:12px;font-weight:800}.output-card-list{display:grid;gap:12px}.output-card{display:grid;grid-template-columns:42px 1fr;gap:12px;align-items:start;padding:14px;border:1px solid #dce4da;border-radius:14px;background:#fff}.output-number{display:grid;place-items:center;width:38px;height:38px;border-radius:11px;background:#8fc63f;color:#15210f;font-weight:900}.output-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.production-box{margin:0 24px 24px;padding:20px;border:1px solid #dce4da;border-radius:16px;background:#f7faf5}.production-box label>span{font-weight:500;color:#788079}.production-actions{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-top:15px}.production-actions>div{display:grid;gap:3px}.production-actions span{color:#6e786f}.production-actions b{color:#4b7621}.studio-bottom-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(300px,.7fr);gap:18px}.production-history,.setup-note{min-width:0}.history-list{display:grid;gap:12px;padding:0 24px 24px;max-height:760px;overflow:auto}.history-list article{padding:16px;border:1px solid #e0e6de;border-radius:15px;background:#fafcf9}.history-top,.history-meta{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.history-top time{color:#79817b;font-size:12px}.history-list p{color:#4f5b52;line-height:1.55}.history-meta{margin:10px 0}.history-meta code{overflow-wrap:anywhere;padding:4px 7px;border-radius:7px;background:#edf2ea;color:#3f6520;font-size:12px}.status-done{color:#4d7b20;font-weight:800}.status-error,.history-error{color:#a63b35}.history-list a,.setup-note a{color:#527f25;font-weight:800}.setup-note{padding:24px}.setup-note h2{margin:5px 0 8px}.setup-note p{margin:0;color:#657067;line-height:1.65}.empty-state{padding:28px 24px;color:#687269}.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}@media(max-width:1100px){.channel-grid,.studio-bottom-grid{grid-template-columns:1fr}}@media(max-width:760px){.studio-hero,.studio-section-head,.production-actions{align-items:stretch;flex-direction:column}.provider-state{justify-content:flex-start}.global-settings,.output-fields{grid-template-columns:1fr}.channel-panel,.studio-section-head,.global-settings{padding-left:18px;padding-right:18px}.production-box{margin-left:18px;margin-right:18px}.studio-tabs{padding:0 18px}.output-card{grid-template-columns:36px 1fr}.production-actions button{width:100%}} +.volume-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.field-card select{width:100%}@media(max-width:680px){.volume-grid{grid-template-columns:1fr}} +.production-progress-modal{border:0;border-radius:18px;padding:0;width:min(680px,calc(100% - 32px));box-shadow:0 28px 90px #0005}.production-progress-modal::backdrop{background:#102317aa}.production-progress-card{padding:24px;display:grid;gap:18px}.production-progress-card header,.production-progress-card footer{display:flex;align-items:center;justify-content:space-between;gap:16px}.production-progress-card header button{border:0;background:transparent;font-size:30px}.production-progress-steps{display:grid;gap:9px}.production-step{display:flex;gap:12px;padding:12px;border:1px solid #dde6de;border-radius:12px}.production-step i{width:12px;height:12px;border-radius:50%;margin-top:4px;background:#bbc5bc}.production-step.running i{background:#d69b24;box-shadow:0 0 0 4px #d69b2422}.production-step.done i{background:#1f7a3f}.production-step.error i{background:#b62e2e}.production-step div{display:grid;gap:3px}.production-step span{font-size:.9rem;color:#5d695f} +.production-progress-frame{display:block;width:100%;height:min(560px,62vh);border:0;border-radius:13px;background:#f5f7f3}.production-progress-card{width:100%}.production-progress-card>p{margin:0;color:#5d695f}.production-progress-modal[open]{max-height:calc(100vh - 32px);overflow:auto}@media(max-width:680px){.production-progress-card{padding:18px}.production-progress-frame{height:64vh}} +/* v1.5.24 – KI-Transparenzhinweis */ +.studio-ai-transparency{display:grid;grid-template-columns:42px minmax(0,1fr) auto;gap:14px;align-items:center;padding:15px 17px;border:1px solid #d8cdea;border-radius:15px;background:#f7f3fc;color:#3c3048}.studio-ai-transparency>span{display:grid;place-items:center;width:40px;height:40px;border-radius:12px;background:#70509c;color:#fff;font-size:1.1rem}.studio-ai-transparency strong{display:block}.studio-ai-transparency p{margin:4px 0 0;color:#655a6f;line-height:1.5}.studio-ai-transparency a{color:#5f3f83;font-weight:850;text-decoration:none;white-space:nowrap}@media(max-width:720px){.studio-ai-transparency{grid-template-columns:38px 1fr}.studio-ai-transparency a{grid-column:2;white-space:normal}} + +.history-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.history-delete{padding:7px 10px;font-size:12px}.history-local-clean{color:#55705d;font-weight:700}.history-warning{display:block;margin-top:8px;color:#8a650f}.production-history .studio-section-head>button{flex:0 0 auto}@media(max-width:760px){.production-history .studio-section-head>button{width:100%}} diff --git a/web/assets/admin-news-studio-v6.js b/web/assets/admin-news-studio-v6.js new file mode 100644 index 0000000..332d220 --- /dev/null +++ b/web/assets/admin-news-studio-v6.js @@ -0,0 +1,79 @@ +document.addEventListener('DOMContentLoaded',()=>{ + const tabs=[...document.querySelectorAll('[data-studio-tab]')]; + const panels=[...document.querySelectorAll('[data-channel-panel]')]; + const input=document.getElementById('activeChannel'); + const label=document.getElementById('activeChannelLabel'); + const form=document.getElementById('newsStudioForm'); + const actionInput=document.getElementById('newsStudioAction'); + const modal=document.getElementById('productionProgressModal'); + const frame=document.getElementById('productionProgressFrame'); + const productionCountLabel=document.getElementById('productionCountLabel'); + const produceButton=document.getElementById('produceButton'); + const productionModalTitle=document.getElementById('productionModalTitle'); + + function activate(key,push=true){ + tabs.forEach(button=>{ + const active=button.dataset.studioTab===key; + button.classList.toggle('active',active); + button.setAttribute('aria-selected',active?'true':'false'); + }); + panels.forEach(panel=>panel.classList.toggle('active',panel.dataset.channelPanel===key)); + if(input)input.value=key; + const button=tabs.find(item=>item.dataset.studioTab===key); + if(label&&button)label.textContent=button.textContent.trim(); + const weather=key==='weather'; + if(productionCountLabel)productionCountLabel.textContent=weather?'Einen Beitrag erzeugen':'Drei Beiträge erzeugen'; + if(produceButton&&!produceButton.disabled)produceButton.textContent=weather?'1 MP3 erzeugen und hochladen':'3 MP3s erzeugen und hochladen'; + if(productionModalTitle)productionModalTitle.textContent=weather?'1 MP3-Datei wird erstellt':'3 MP3-Dateien werden erstellt'; + if(push){ + const url=new URL(location.href); + url.searchParams.set('tab',key); + history.replaceState({},'',url); + } + } + + tabs.forEach(button=>button.addEventListener('click',()=>activate(button.dataset.studioTab))); + document.querySelectorAll('[data-close-progress]').forEach(button=>button.addEventListener('click',()=>{modal?.close();if(frame)frame.src='about:blank'})); + + if(form){ + form.addEventListener('submit',event=>{ + const submitter=event.submitter; + if(!submitter)return; + if(submitter.dataset.confirm&&!window.confirm(submitter.dataset.confirm)){ + event.preventDefault(); + return; + } + const action=submitter.value||submitter.dataset.action||''; + if(actionInput)actionInput.value=action; + if(action==='produce_stream'){ + if(frame){ + frame.srcdoc='Der Produktionsauftrag wird an den Server übergeben …'; + } + modal?.showModal(); + form.setAttribute('aria-busy','true'); + setTimeout(()=>{ + submitter.disabled=true; + submitter.textContent=submitter.dataset.submitLabel||'Produktion läuft …'; + },0); + return; + } + const nextLabel=submitter.dataset.submitLabel; + if(nextLabel)submitter.textContent=nextLabel; + setTimeout(()=>{submitter.disabled=true},0); + }); + } + + window.addEventListener('message',event=>{ + if(event.origin!==location.origin||!event.data||event.data.type!=='landwelle-news-production')return; + if(event.data.status==='done'){ + setTimeout(()=>location.reload(),1400); + }else if(event.data.status==='error'){ + form?.removeAttribute('aria-busy'); + const button=form?.querySelector('button[value="produce_stream"]'); + if(button){ + button.disabled=false; + button.textContent=input?.value==='weather'?'1 MP3 erzeugen und hochladen':'3 MP3s erzeugen und hochladen'; + } + } + }); +}); diff --git a/web/assets/admin-news-studio-v7.js b/web/assets/admin-news-studio-v7.js new file mode 100644 index 0000000..8200baf --- /dev/null +++ b/web/assets/admin-news-studio-v7.js @@ -0,0 +1,79 @@ +document.addEventListener('DOMContentLoaded',()=>{ + const tabs=[...document.querySelectorAll('[data-studio-tab]')]; + const panels=[...document.querySelectorAll('[data-channel-panel]')]; + const input=document.getElementById('activeChannel'); + const label=document.getElementById('activeChannelLabel'); + const form=document.getElementById('newsStudioForm'); + const actionInput=document.getElementById('newsStudioAction'); + const modal=document.getElementById('productionProgressModal'); + const frame=document.getElementById('productionProgressFrame'); + const productionCountLabel=document.getElementById('productionCountLabel'); + const produceButton=document.getElementById('produceButton'); + const productionModalTitle=document.getElementById('productionModalTitle'); + + function activate(key,push=true){ + tabs.forEach(button=>{ + const active=button.dataset.studioTab===key; + button.classList.toggle('active',active); + button.setAttribute('aria-selected',active?'true':'false'); + }); + panels.forEach(panel=>panel.classList.toggle('active',panel.dataset.channelPanel===key)); + if(input)input.value=key; + const button=tabs.find(item=>item.dataset.studioTab===key); + if(label&&button)label.textContent=button.textContent.trim(); + const single=key==='weather'||key==='sport'; + if(productionCountLabel)productionCountLabel.textContent=single?'Einen Beitrag erzeugen':'Drei Beiträge erzeugen'; + if(produceButton&&!produceButton.disabled)produceButton.textContent=single?'1 MP3 erzeugen und hochladen':'3 MP3s erzeugen und hochladen'; + if(productionModalTitle)productionModalTitle.textContent=single?'1 MP3-Datei wird erstellt':'3 MP3-Dateien werden erstellt'; + if(push){ + const url=new URL(location.href); + url.searchParams.set('tab',key); + history.replaceState({},'',url); + } + } + + tabs.forEach(button=>button.addEventListener('click',()=>activate(button.dataset.studioTab))); + document.querySelectorAll('[data-close-progress]').forEach(button=>button.addEventListener('click',()=>{modal?.close();if(frame)frame.src='about:blank'})); + + if(form){ + form.addEventListener('submit',event=>{ + const submitter=event.submitter; + if(!submitter)return; + if(submitter.dataset.confirm&&!window.confirm(submitter.dataset.confirm)){ + event.preventDefault(); + return; + } + const action=submitter.value||submitter.dataset.action||''; + if(actionInput)actionInput.value=action; + if(action==='produce_stream'){ + if(frame){ + frame.srcdoc='Der Produktionsauftrag wird an den Server übergeben …'; + } + modal?.showModal(); + form.setAttribute('aria-busy','true'); + setTimeout(()=>{ + submitter.disabled=true; + submitter.textContent=submitter.dataset.submitLabel||'Produktion läuft …'; + },0); + return; + } + const nextLabel=submitter.dataset.submitLabel; + if(nextLabel)submitter.textContent=nextLabel; + setTimeout(()=>{submitter.disabled=true},0); + }); + } + + window.addEventListener('message',event=>{ + if(event.origin!==location.origin||!event.data||event.data.type!=='landwelle-news-production')return; + if(event.data.status==='done'){ + setTimeout(()=>location.reload(),1400); + }else if(event.data.status==='error'){ + form?.removeAttribute('aria-busy'); + const button=form?.querySelector('button[value="produce_stream"]'); + if(button){ + button.disabled=false; + button.textContent=(input?.value==='weather'||input?.value==='sport')?'1 MP3 erzeugen und hochladen':'3 MP3s erzeugen und hochladen'; + } + } + }); +}); diff --git a/web/assets/admin-program-v4.css b/web/assets/admin-program-v4.css new file mode 100644 index 0000000..1d17568 --- /dev/null +++ b/web/assets/admin-program-v4.css @@ -0,0 +1,6 @@ +.program-admin-page{max-width:1500px;margin:0 auto}.program-admin-hero{display:flex;align-items:flex-end;justify-content:space-between;gap:30px;padding:28px 30px;margin-bottom:22px;border-radius:24px;background:linear-gradient(135deg,#101810,#1f2d1f);color:#fff;box-shadow:0 18px 45px rgba(18,35,19,.16)}.program-admin-hero h1{margin:7px 0 8px;font-size:clamp(2rem,3vw,3.4rem);line-height:1;letter-spacing:-.055em}.program-admin-hero p{max-width:720px;margin:0;color:#c9d3c8;line-height:1.6}.program-admin-actions{display:flex;gap:10px;flex-wrap:wrap}.program-primary-button,.program-secondary-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:42px;padding:0 16px;border-radius:10px;font-weight:850;text-decoration:none;cursor:pointer}.program-primary-button{border:0;background:linear-gradient(180deg,#92ca19,#72a700);color:#fff;box-shadow:0 8px 18px rgba(112,165,0,.2)}.program-secondary-button{border:1px solid #d8ded5;background:#fff;color:#263127}.program-admin-hero .program-secondary-button{border-color:rgba(255,255,255,.2);background:rgba(255,255,255,.08);color:#fff}.program-admin-metrics{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-bottom:22px}.program-admin-metrics article{padding:20px 22px;border:1px solid var(--lw-line);border-radius:18px;background:#fff;box-shadow:0 10px 26px rgba(16,28,17,.04)}.program-admin-metrics span,.program-admin-metrics small,.program-admin-metrics strong{display:block}.program-admin-metrics span{font-size:.7rem;text-transform:uppercase;letter-spacing:.08em;font-weight:900;color:#758075}.program-admin-metrics strong{margin:7px 0 4px;font-size:1.35rem}.program-admin-metrics small{color:#778078;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.program-edit-card{margin-bottom:22px}.program-edit-card form{padding:0 24px 24px}.program-close-link{color:#688f13;font-weight:800;text-decoration:none}.program-overview-card{overflow:hidden}.program-overview-head{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:24px 26px;border-bottom:1px solid var(--lw-line)}.program-overview-head h2{margin:5px 0 3px;font-size:1.35rem}.program-overview-head p{margin:0;color:#748075}.program-table-wrap{overflow-x:auto}.program-admin-table{width:100%;border-collapse:collapse;min-width:850px}.program-admin-table th{padding:13px 18px;background:#f7f9f6;color:#6d786e;font-size:.68rem;text-align:left;text-transform:uppercase;letter-spacing:.075em}.program-admin-table td{padding:15px 18px;border-top:1px solid #edf0eb;vertical-align:middle}.program-admin-table tr.is-live{background:#f4faea}.program-title-cell{display:flex;align-items:center;gap:13px;min-width:240px}.program-title-cell img{width:46px;height:46px;border-radius:12px;object-fit:cover;background:#edf1eb}.program-title-cell strong,.program-title-cell span,.program-admin-table td>strong,.program-admin-table td>span{display:block}.program-title-cell span,.program-admin-table td>span{margin-top:3px;color:#758075;font-size:.78rem}.program-type-badge{display:inline-flex!important;margin:0!important;padding:6px 9px;border-radius:7px;background:#eef3e9;color:#53624f!important;font-weight:750}.program-status{display:inline-flex!important;margin:0!important;padding:6px 9px;border-radius:999px;font-size:.7rem!important;font-weight:900}.program-status.is-live{background:#7daf10;color:#fff!important}.program-status.is-active{background:#e9f5da;color:#567d05!important}.program-status.is-inactive{background:#f0f1ef;color:#7c827c!important}.program-row-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px}.program-row-actions a,.program-row-actions button{border:0;border-radius:8px;padding:8px 10px;font-weight:800;font-size:.75rem;text-decoration:none;cursor:pointer}.program-row-actions a{background:#edf5e5;color:#5e8d00}.program-row-actions button{background:#f8e9e9;color:#9c3333}.program-modal[hidden]{display:none}.program-modal{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px}.program-modal-backdrop{position:absolute;inset:0;background:rgba(9,15,10,.65);backdrop-filter:blur(3px)}.program-modal-dialog{position:relative;width:min(820px,100%);max-height:calc(100vh - 40px);overflow:auto;border-radius:22px;background:#fff;box-shadow:0 30px 90px rgba(0,0,0,.35)}.program-modal-dialog>header{display:flex;justify-content:space-between;gap:20px;padding:24px 26px;border-bottom:1px solid var(--lw-line)}.program-modal-dialog h2{margin:5px 0 4px;font-size:1.45rem}.program-modal-dialog p{margin:0;color:#748075}.program-modal-dialog>header>button{width:38px;height:38px;border:0;border-radius:50%;background:#f1f3ef;font-size:1.5rem;cursor:pointer}.program-modal-dialog form{padding:24px 26px}.program-modal-dialog footer{display:flex;justify-content:flex-end;gap:10px;margin:22px -26px -24px;padding:18px 26px;border-top:1px solid var(--lw-line);background:#fafbf9}.program-weekdays{display:flex;align-items:center;gap:8px;flex-wrap:wrap;border:1px solid #d9ded7;border-radius:12px;padding:14px}.program-weekdays legend{padding:0 6px;font-size:11px;text-transform:uppercase;font-weight:900;color:#657065}.program-weekdays label{display:inline-flex!important}.program-weekdays input{position:absolute;opacity:0}.program-weekdays label span{display:grid;place-items:center;width:38px;height:34px;border:1px solid #d8ded5;border-radius:8px;background:#fff;color:#596359!important;font-size:.75rem!important}.program-weekdays input:checked+span{background:#79ad0c;border-color:#79ad0c;color:#fff!important}.program-weekdays small{flex-basis:100%;color:#748075}@media(max-width:900px){.program-admin-hero{align-items:flex-start;flex-direction:column}.program-admin-metrics{grid-template-columns:1fr}.program-overview-head{align-items:flex-start;flex-direction:column}}@media(max-width:620px){.program-admin-hero{padding:24px 20px}.program-admin-actions,.program-admin-actions>*{width:100%}.program-overview-head{padding:20px}.program-modal{padding:0}.program-modal-dialog{max-height:100vh;height:100vh;border-radius:0}.program-modal-dialog form,.program-modal-dialog>header{padding-left:18px;padding-right:18px}.program-modal-dialog footer{margin-left:-18px;margin-right:-18px;padding-left:18px;padding-right:18px}} + +.program-day-tabs{display:grid;grid-template-columns:repeat(7,minmax(90px,1fr));gap:8px;padding:18px 22px;border-bottom:1px solid var(--lw-line);background:#fbfcfa;overflow-x:auto}.program-day-tabs button{position:relative;display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:8px;min-width:105px;padding:12px 11px;border:1px solid #dde3da;border-radius:12px;background:#fff;color:#536052;text-align:left;cursor:pointer;transition:.18s ease}.program-day-tabs button:hover{border-color:#a9c87a;transform:translateY(-1px)}.program-day-tabs button[aria-selected="true"]{border-color:#78a91a;background:#edf6df;color:#345000;box-shadow:0 8px 20px rgba(91,132,12,.12)}.program-day-tabs button>span{display:grid;place-items:center;width:30px;height:30px;border-radius:8px;background:#f0f3ed;font-size:.72rem;font-weight:900}.program-day-tabs button[aria-selected="true"]>span{background:#78a91a;color:#fff}.program-day-tabs button>strong{font-size:.78rem}.program-day-tabs button>small{display:grid;place-items:center;min-width:24px;height:24px;padding:0 6px;border-radius:999px;background:#eef1ec;color:#697469;font-size:.66rem;font-weight:900}.program-day-tabs button[aria-selected="true"]>small{background:#fff;color:#5d8609}.program-day-summary{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:15px 24px;border-bottom:1px solid #e8ece5;background:#fff}.program-day-summary div span,.program-day-summary div strong{display:block}.program-day-summary div span{margin-bottom:2px;color:#79904e;font-size:.66rem;font-weight:900;text-transform:uppercase;letter-spacing:.08em}.program-day-summary div strong{font-size:1rem}.program-day-total{padding:6px 10px;border-radius:999px;background:#f0f4eb;color:#62705e;font-size:.72rem;font-weight:850}.program-admin-table tr[hidden]{display:none}.program-admin-table tbody tr[data-program-row]:not([hidden]){animation:programRowIn .2s ease both}@keyframes programRowIn{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}@media(max-width:1000px){.program-day-tabs{grid-template-columns:repeat(7,120px)}}@media(max-width:620px){.program-day-tabs{padding:14px 16px;grid-template-columns:repeat(7,92px)}.program-day-tabs button{min-width:92px;grid-template-columns:1fr auto}.program-day-tabs button>strong{display:none}.program-day-summary{padding:14px 18px}} +.program-modal[data-program-edit-modal] .program-modal-dialog{width:min(760px,100%)} +.program-modal[data-program-edit-modal] .program-modal-dialog>header{background:linear-gradient(135deg,#fbfdf9,#f2f7ee)} +.program-modal[data-program-edit-modal] form{padding-bottom:24px} diff --git a/web/assets/admin-program-v4.js b/web/assets/admin-program-v4.js new file mode 100644 index 0000000..82df802 --- /dev/null +++ b/web/assets/admin-program-v4.js @@ -0,0 +1,114 @@ +(() => { + const setupModal = ({ modal, openers = [], closeSelector, autoOpen = false, clearEdit = false }) => { + if (!modal) return; + let previousFocus = null; + const firstField = () => modal.querySelector('input:not([type="hidden"]), select, textarea, button'); + const open = () => { + previousFocus = document.activeElement; + modal.hidden = false; + document.body.style.overflow = 'hidden'; + requestAnimationFrame(() => firstField()?.focus()); + }; + const close = () => { + modal.hidden = true; + document.body.style.overflow = ''; + if (clearEdit) { + const url = new URL(location.href); + url.searchParams.delete('edit'); + history.replaceState({}, '', url.pathname + url.search + url.hash); + } + previousFocus?.focus(); + }; + openers.forEach((button) => button.addEventListener('click', open)); + modal.querySelectorAll(closeSelector).forEach((button) => button.addEventListener('click', close)); + document.addEventListener('keydown', (event) => { + if (event.key === 'Escape' && !modal.hidden) close(); + }); + if (autoOpen) open(); + }; + + setupModal({ + modal: document.querySelector('[data-program-modal]'), + openers: [...document.querySelectorAll('[data-program-modal-open]')], + closeSelector: '[data-program-modal-close]' + }); + + const editModal = document.querySelector('[data-program-edit-modal]'); + setupModal({ + modal: editModal, + closeSelector: '[data-program-edit-close]', + autoOpen: Boolean(editModal?.hasAttribute('data-program-modal-auto')), + clearEdit: true + }); + + const day = new URLSearchParams(location.search).get('day'); + document.querySelectorAll('[data-program-return-day]').forEach((input) => { input.value = day || ''; }); +})(); + +(() => { + const view = document.querySelector('[data-program-week-view]'); + if (!view) return; + const tabs = [...view.querySelectorAll('[data-program-day-tab]')]; + const rows = [...view.querySelectorAll('[data-program-row]')]; + const empty = view.querySelector('[data-program-empty]'); + const title = view.querySelector('[data-program-selected-title]'); + const kicker = view.querySelector('[data-program-selected-kicker]'); + const total = view.querySelector('[data-program-selected-count]'); + const names = {0:'Sonntag',1:'Montag',2:'Dienstag',3:'Mittwoch',4:'Donnerstag',5:'Freitag',6:'Samstag'}; + const params = new URLSearchParams(location.search); + const requested = Number(params.get('day')); + const today = new Date().getDay(); + let active = Number.isInteger(requested) && requested >= 0 && requested <= 6 ? requested : today; + const countFor = (day) => rows.filter((row) => Number(row.dataset.programWeekday) === day || Number(row.dataset.programWeekday) === -1).length; + tabs.forEach((tab) => { + const day = Number(tab.dataset.programDayTab); + const count = countFor(day); + view.querySelector(`[data-program-day-count="${day}"]`).textContent = String(count); + tab.addEventListener('click', () => select(day, true)); + }); + function select(day, updateURL) { + active = day; + let visible = 0; + tabs.forEach((tab) => { + const selected = Number(tab.dataset.programDayTab) === day; + tab.setAttribute('aria-selected', selected ? 'true' : 'false'); + tab.tabIndex = selected ? 0 : -1; + }); + rows.forEach((row) => { + const weekday = Number(row.dataset.programWeekday); + const show = weekday === day || weekday === -1; + row.hidden = !show; + if (show) { + visible += 1; + const edit = row.querySelector('[data-program-edit-link]'); + if (edit) { + const url = new URL(edit.href, location.origin); + url.searchParams.set('day', String(day)); + edit.href = url.pathname + url.search; + } + } + }); + empty.hidden = visible !== 0; + kicker.textContent = names[day]; + title.textContent = `Sendungen am ${names[day]}`; + total.textContent = `${visible} ${visible === 1 ? 'Eintrag' : 'Einträge'}`; + if (updateURL) { + const url = new URL(location.href); + url.searchParams.set('day', String(day)); + url.searchParams.delete('edit'); + history.replaceState({}, '', url); + } + } + tabs.forEach((tab, index) => tab.addEventListener('keydown', (event) => { + if (!['ArrowLeft','ArrowRight','Home','End'].includes(event.key)) return; + event.preventDefault(); + let next = index; + if (event.key === 'ArrowRight') next = (index + 1) % tabs.length; + if (event.key === 'ArrowLeft') next = (index - 1 + tabs.length) % tabs.length; + if (event.key === 'Home') next = 0; + if (event.key === 'End') next = tabs.length - 1; + tabs[next].focus(); + tabs[next].click(); + })); + select(active, false); +})(); diff --git a/web/assets/admin-push-v1.css b/web/assets/admin-push-v1.css new file mode 100644 index 0000000..cd81023 --- /dev/null +++ b/web/assets/admin-push-v1.css @@ -0,0 +1 @@ +.app-push-page{display:grid;gap:22px}.push-status-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}.push-status-grid article{display:grid;gap:8px}.push-status-grid span{font-size:.78rem;color:var(--admin-muted,#718078)}.push-status-grid strong{font-size:1.7rem}.push-main-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(280px,.7fr);gap:18px}.push-form{display:grid;gap:14px}.push-form label{display:grid;gap:7px}.push-form label>span{font-size:.8rem;font-weight:700}.push-form input,.push-form textarea,.push-form select{width:100%;box-sizing:border-box}.push-health dl{display:grid;gap:0}.push-health dl div{display:flex;justify-content:space-between;gap:16px;padding:11px 0;border-bottom:1px solid rgba(90,110,98,.14)}.push-health dt{color:#718078}.push-health dd{font-weight:700;text-align:right}.push-history{overflow:hidden}.push-table-wrap{overflow:auto}.push-history table{width:100%;border-collapse:collapse;min-width:850px}.push-history th,.push-history td{text-align:left;padding:12px 10px;border-bottom:1px solid rgba(90,110,98,.14);vertical-align:top}.push-history td small{display:block;max-width:420px;color:#718078;margin-top:3px}.push-state{display:inline-flex;padding:4px 8px;border-radius:999px;background:rgba(90,110,98,.12);font-size:.75rem;font-weight:700}.push-state-sent{background:rgba(35,132,83,.12)}.push-state-failed{background:rgba(180,51,51,.12)}.push-state-sending{background:rgba(196,132,28,.14)}@media(max-width:1050px){.push-status-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.push-main-grid{grid-template-columns:1fr}}@media(max-width:620px){.push-status-grid{grid-template-columns:repeat(2,minmax(0,1fr))}} diff --git a/web/assets/admin-settings-v37.js b/web/assets/admin-settings-v37.js new file mode 100644 index 0000000..5e72537 --- /dev/null +++ b/web/assets/admin-settings-v37.js @@ -0,0 +1 @@ +(()=>{const tabs=[...document.querySelectorAll('[data-settings-tab]')],panels=[...document.querySelectorAll('[data-settings-panel]')];function open(k){tabs.forEach(x=>x.classList.toggle('is-active',x.dataset.settingsTab===k));panels.forEach(x=>x.classList.toggle('is-active',x.dataset.settingsPanel===k))}tabs.forEach(x=>x.addEventListener('click',()=>{open(x.dataset.settingsTab);history.replaceState(null,'','#'+x.dataset.settingsTab)}));open((location.hash||'#ki').slice(1));const rows=document.getElementById('voiceRows');document.getElementById('addVoiceRow')?.addEventListener('click',()=>{const d=document.createElement('div');d.className='voice-row';d.innerHTML='';rows.appendChild(d);d.querySelector('input').focus()});rows?.addEventListener('click',e=>{if(e.target.closest('.voice-remove'))e.target.closest('.voice-row').remove()})})(); diff --git a/web/assets/admin-sidebar-v2.js b/web/assets/admin-sidebar-v2.js new file mode 100644 index 0000000..7a82165 --- /dev/null +++ b/web/assets/admin-sidebar-v2.js @@ -0,0 +1,111 @@ +(() => { + 'use strict'; + + const navigation = document.querySelector('[data-admin-navigation]'); + if (!navigation) return; + + const normalisePath = (value) => { + let path = String(value || '/').trim() || '/'; + try { path = new URL(path, window.location.origin).pathname; } catch (_) {} + if (path.length > 1) path = path.replace(/\/+$/, ''); + return path || '/'; + }; + + const currentPath = normalisePath(window.location.pathname); + const currentHash = window.location.hash || ''; + const links = Array.from(navigation.querySelectorAll('[data-admin-nav-link]')); + const groups = Array.from(navigation.querySelectorAll('details[data-admin-nav-group]')); + + const routeScore = (link) => { + if (link.hasAttribute('data-admin-external')) return -1; + const href = link.getAttribute('href') || ''; + let target; + try { target = new URL(href, window.location.origin); } catch (_) { return -1; } + const candidates = (link.dataset.adminMatch || '') + .split(',') + .map((value) => value.trim()) + .filter(Boolean); + candidates.push(`${normalisePath(target.pathname)}${target.hash || ''}`); + + let best = -1; + for (const candidate of candidates) { + const prefix = candidate.endsWith('/*'); + const clean = prefix ? candidate.slice(0, -2) : candidate; + const hashIndex = clean.indexOf('#'); + const candidatePath = normalisePath(hashIndex >= 0 ? clean.slice(0, hashIndex) : clean); + const candidateHash = hashIndex >= 0 ? clean.slice(hashIndex) : ''; + if (prefix) { + if (currentPath === candidatePath || currentPath.startsWith(`${candidatePath}/`)) { + best = Math.max(best, 60 + candidatePath.length); + } + continue; + } + if (currentPath !== candidatePath) continue; + if (candidateHash) { + if (currentHash === candidateHash) best = Math.max(best, 200 + candidatePath.length); + } else if (!currentHash) { + best = Math.max(best, 150 + candidatePath.length); + } else if (link.dataset.adminMatch) { + best = Math.max(best, 80 + candidatePath.length); + } + } + return best; + }; + + const activateCurrentRoute = () => { + links.forEach((link) => { + link.removeAttribute('aria-current'); + link.classList.remove('is-active'); + }); + groups.forEach((group) => group.classList.remove('is-current')); + + let activeLink = null; + let activeScore = -1; + for (const link of links) { + const score = routeScore(link); + if (score > activeScore) { + activeScore = score; + activeLink = link; + } + } + if (!activeLink || activeScore < 0) return; + + activeLink.setAttribute('aria-current', 'page'); + activeLink.classList.add('is-active'); + const currentGroup = activeLink.closest('details[data-admin-nav-group]'); + groups.forEach((group) => { + const isCurrent = group === currentGroup; + group.open = isCurrent; + group.classList.toggle('is-current', isCurrent); + }); + + window.requestAnimationFrame(() => { + const navBox = navigation.getBoundingClientRect(); + const linkBox = activeLink.getBoundingClientRect(); + if (linkBox.top < navBox.top || linkBox.bottom > navBox.bottom) { + activeLink.scrollIntoView({ block: 'center', behavior: 'auto' }); + } + }); + }; + + groups.forEach((group) => { + group.addEventListener('toggle', () => { + if (!group.open) return; + groups.forEach((other) => { + if (other !== group) other.open = false; + }); + }); + }); + + links.forEach((link) => { + link.addEventListener('click', () => { + if (window.matchMedia('(max-width: 820px)').matches) { + document.querySelector('.admin-sidebar')?.classList.remove('is-open'); + document.querySelector('.admin-mobile-menu')?.setAttribute('aria-expanded', 'false'); + } + }); + }); + + window.addEventListener('hashchange', activateCurrentRoute); + activateCurrentRoute(); +})(); diff --git a/web/assets/admin-site-content-v2.css b/web/assets/admin-site-content-v2.css new file mode 100644 index 0000000..957d25c --- /dev/null +++ b/web/assets/admin-site-content-v2.css @@ -0,0 +1,2 @@ +.site-content-admin{display:grid;gap:24px}.content-admin-hero,.mediathek-admin-hero,.analytics-hero{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;padding:30px;border-radius:24px;background:linear-gradient(135deg,#172619,#2f4a2d);color:#fff;box-shadow:0 20px 50px rgba(20,42,21,.17)}.content-admin-hero span,.mediathek-admin-hero span,.analytics-hero>div>span{color:#aee262;font-size:.75rem;font-weight:900;letter-spacing:.13em;text-transform:uppercase}.content-admin-hero h1,.mediathek-admin-hero h1,.analytics-hero h1{margin:6px 0 8px;font-size:clamp(1.8rem,3vw,2.7rem)}.content-admin-hero p,.mediathek-admin-hero p,.analytics-hero p{margin:0;color:#dce7da;max-width:720px;line-height:1.6}.content-admin-hero>a,.mediathek-admin-hero>a{flex:0 0 auto;padding:12px 16px;border:1px solid rgba(255,255,255,.25);border-radius:12px;color:#fff;text-decoration:none;font-weight:800}.content-admin-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.content-admin-stats article{padding:19px;border:1px solid #dce4d8;border-radius:18px;background:#fff}.content-admin-stats small,.content-admin-stats span{display:block;color:#71806e}.content-admin-stats strong{display:block;margin:7px 0;font-size:1.7rem;color:#203220}.content-admin-stats .is-email{font-size:1rem;word-break:break-word}.admin-card>header{display:flex;justify-content:space-between;gap:20px;margin-bottom:20px}.admin-card>header span{color:#6b9d24;font-size:.72rem;font-weight:900;letter-spacing:.11em;text-transform:uppercase}.admin-card>header h2{margin:4px 0}.admin-card>header p{margin:0;color:#728071}.content-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.content-form-grid label{display:grid;gap:7px}.content-form-grid label>span{font-weight:750;color:#344432}.content-form-grid input,.content-form-grid textarea,.content-form-grid select,.contact-message-head select{width:100%;padding:12px 13px;border:1px solid #ccd8c8;border-radius:11px;background:#fbfcfa;font:inherit}.content-form-grid .is-wide{grid-column:1/-1}.content-checkbox{align-content:end;grid-template-columns:auto 1fr!important;align-items:center}.content-checkbox input{width:auto}.content-admin-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(320px,.65fr);gap:24px;align-items:start}.content-block-list{display:grid;gap:12px}.content-block-list article{display:grid;grid-template-columns:48px minmax(0,1fr) auto;gap:15px;padding:16px;border:1px solid #dde5da;border-radius:15px;background:#fbfcfa}.content-block-list article.is-inactive{opacity:.58}.content-block-order{display:grid;place-items:center;width:42px;height:42px;border-radius:12px;background:#eaf2e4;color:#56851c;font-weight:900}.content-block-meta{color:#6e9a36;font-size:.72rem;font-weight:850;text-transform:uppercase}.content-block-list h3{margin:4px 0}.content-block-list p{margin:0;color:#657363;white-space:pre-line;line-height:1.55}.content-block-list small{display:block;margin-top:8px;color:#7b8879}.content-block-actions{display:flex;align-items:flex-start;gap:8px}.content-block-actions a,.content-block-actions button,.contact-message-head button{padding:8px 10px;border:1px solid #ccd7c8;border-radius:9px;background:#fff;color:#344b30;text-decoration:none;font:inherit;font-weight:750;cursor:pointer}.content-block-actions button{color:#a13b32}.contact-inbox nav{display:flex;flex-wrap:wrap;gap:7px}.contact-inbox nav a{padding:8px 11px;border-radius:999px;background:#eef2eb;color:#536150;text-decoration:none}.contact-inbox nav a.is-active{background:#233b22;color:#fff}.contact-message-list{display:grid;gap:14px}.contact-message-list article{padding:18px;border:1px solid #dbe4d8;border-radius:16px}.contact-message-head{display:flex;justify-content:space-between;gap:20px}.contact-message-head h3{margin:6px 0}.contact-message-head small{color:#71806f}.contact-message-head form{display:flex;gap:8px;align-items:flex-start}.contact-message-list p{white-space:pre-line;line-height:1.6;color:#465444}.contact-message-head [class^=status-]{display:inline-block;padding:4px 8px;border-radius:999px;background:#edf2e9;color:#547a29;font-size:.7rem;font-weight:900;text-transform:uppercase}.contact-message-head .status-new{background:#fff1cf;color:#855d00}.contact-message-head .status-in_progress{background:#dceeff;color:#176095}.contact-message-head .status-answered{background:#dff2dc;color:#327231}@media(max-width:1050px){.content-admin-grid{grid-template-columns:1fr}.content-admin-stats{grid-template-columns:1fr 1fr}}@media(max-width:700px){.content-admin-hero,.mediathek-admin-hero,.analytics-hero{align-items:flex-start;flex-direction:column}.content-admin-stats,.content-form-grid{grid-template-columns:1fr}.content-form-grid .is-wide{grid-column:auto}.content-block-list article{grid-template-columns:42px 1fr}.content-block-actions{grid-column:1/-1}.contact-message-head{flex-direction:column}.contact-message-head form{flex-wrap:wrap}} +.content-block-body p{margin:0;color:#657363;line-height:1.55}.content-block-body p+p{margin-top:.8em} diff --git a/web/assets/admin-team-forum-v1.css b/web/assets/admin-team-forum-v1.css new file mode 100644 index 0000000..47db057 --- /dev/null +++ b/web/assets/admin-team-forum-v1.css @@ -0,0 +1 @@ +.team-admin-grid{display:grid;grid-template-columns:1fr 1.1fr;gap:22px}.team-admin-list{display:grid;gap:12px}.team-admin-list article,.admin-row-card{display:flex;align-items:center;gap:15px;padding:14px;border:1px solid #e1e6df;border-radius:14px}.team-admin-list img{width:62px;height:62px;border-radius:50%;object-fit:cover;border:3px solid #83bd37}.team-admin-list article>div,.admin-row-card>div{display:flex;flex:1;flex-direction:column;gap:3px}.team-admin-list span,.admin-row-card span{color:#626a62}.team-admin-list small,.admin-row-card small{color:#7ca62e}.forum-admin-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-bottom:22px}.forum-admin-stats article{background:linear-gradient(145deg,#132015,#0b100d);color:#fff;border:1px solid rgba(126,188,54,.25);border-radius:18px;padding:24px}.forum-admin-stats strong{display:block;font-size:40px;color:#9bd34e}.forum-admin-stats span{color:#bec8bf}.inline-actions{display:flex;flex-wrap:wrap;gap:6px}.inline-actions button{border:0;border-radius:8px;padding:7px 9px}.inline-actions .danger{background:#8f3131;color:#fff}.admin-table td small{display:block;color:#777}@media(max-width:1000px){.team-admin-grid{grid-template-columns:1fr}.forum-admin-stats{grid-template-columns:1fr}} diff --git a/web/assets/admin-team-v3.css b/web/assets/admin-team-v3.css new file mode 100644 index 0000000..f06380a --- /dev/null +++ b/web/assets/admin-team-v3.css @@ -0,0 +1,5 @@ +.team-admin-page{display:grid;gap:22px}.team-admin-hero{display:flex;justify-content:space-between;align-items:flex-end;gap:24px;padding:28px;border-radius:22px;background:linear-gradient(135deg,#101b12,#172819);color:#fff;box-shadow:0 18px 44px rgba(13,28,16,.13)}.team-admin-hero h1{margin:5px 0 8px;font-size:clamp(28px,4vw,42px)}.team-admin-hero p{max-width:720px;margin:0;color:#c9d4ca}.team-admin-hero-actions,.team-member-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.team-primary-button,.team-secondary-button,.team-danger-button{display:inline-flex;align-items:center;justify-content:center;min-height:42px;padding:0 16px;border:0;border-radius:11px;font:inherit;font-weight:750;text-decoration:none;cursor:pointer}.team-primary-button{background:#8fc63f;color:#11210e;box-shadow:0 8px 20px rgba(143,198,63,.22)}.team-primary-button:hover{background:#a1d953}.team-primary-button.is-compact{min-height:38px;padding:0 14px}.team-secondary-button{background:#eef2ec;color:#263128;border:1px solid #dce3da}.team-admin-hero .team-secondary-button{background:rgba(255,255,255,.08);color:#fff;border-color:rgba(255,255,255,.16)}.team-danger-button{background:#fff0f0;color:#9c3030;border:1px solid #f2cece}.team-admin-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.team-admin-stats article{padding:20px;border:1px solid #e2e8df;border-radius:17px;background:#fff;box-shadow:0 10px 25px rgba(23,36,25,.05)}.team-admin-stats span,.team-admin-stats small{display:block;color:#6d766e}.team-admin-stats strong{display:block;margin:5px 0;font-size:34px;color:#203221}.team-section-header{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;margin-bottom:20px}.team-section-header h2{margin:4px 0}.team-section-header p{margin:0;color:#6b746d}.team-member-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.team-member-card{overflow:hidden;border:1px solid #e0e7de;border-radius:18px;background:#fff;box-shadow:0 9px 24px rgba(19,35,22,.055)}.team-member-visual{position:relative;aspect-ratio:16/10;background:#edf1ec}.team-member-visual img{width:100%;height:100%;object-fit:cover}.team-status{position:absolute;top:12px;right:12px;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:800;box-shadow:0 3px 10px rgba(0,0,0,.12)}.team-status.is-active{background:#e5f5d4;color:#3d6d18}.team-status.is-inactive{background:#ecefee;color:#646c66}.team-member-content{display:grid;gap:16px;padding:18px}.team-member-content h3{margin:0 0 4px;font-size:20px}.team-member-content p{margin:0;color:#667068}.team-member-content dl{display:grid;grid-template-columns:1fr auto;gap:10px;margin:0;padding:12px 0;border-top:1px solid #edf0ec;border-bottom:1px solid #edf0ec}.team-member-content dl div{display:grid;gap:2px}.team-member-content dt{font-size:12px;color:#7b837d}.team-member-content dd{margin:0;font-weight:700;color:#344138}.team-member-actions form{margin-left:auto}.team-empty-state{grid-column:1/-1;padding:48px;text-align:center;border:1px dashed #cbd5c9;border-radius:18px;background:#fafcf9}.team-empty-state p{color:#6b746d}.team-modal[hidden]{display:none}.team-modal{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px}.team-modal-backdrop{position:absolute;inset:0;background:rgba(7,13,9,.72);backdrop-filter:blur(4px)}.team-modal-dialog{position:relative;width:min(820px,100%);max-height:calc(100vh - 40px);overflow:auto;border-radius:22px;background:#fff;box-shadow:0 28px 80px rgba(0,0,0,.3)}.team-modal-dialog>header{display:flex;justify-content:space-between;gap:20px;padding:24px 26px;border-bottom:1px solid #e5eae3}.team-modal-dialog>header h2{margin:4px 0 6px}.team-modal-dialog>header p{margin:0;color:#69726b}.team-modal-dialog>header>button{width:40px;height:40px;border:0;border-radius:50%;background:#edf1ec;font-size:24px;cursor:pointer}.team-modal-dialog form{padding:24px 26px}.team-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:17px}.team-form-grid label{display:grid;gap:7px}.team-form-grid label>span{font-weight:750;color:#344138}.team-form-grid input,.team-form-grid textarea{width:100%;box-sizing:border-box;border:1px solid #ccd5ca;border-radius:11px;padding:11px 12px;font:inherit}.team-form-grid input:focus,.team-form-grid textarea:focus{outline:3px solid rgba(143,198,63,.22);border-color:#84b93c}.team-form-grid small{color:#737d75}.team-form-grid .is-wide{grid-column:1/-1}.team-check{display:flex!important;grid-template-columns:auto 1fr!important;align-items:flex-start;padding:14px;border-radius:12px;background:#f4f7f2}.team-check input{width:auto;margin-top:4px}.team-check span{display:grid;gap:2px}.team-modal-dialog footer{display:flex;justify-content:flex-end;gap:10px;margin-top:22px;padding-top:18px;border-top:1px solid #e8ece7}body.team-modal-open{overflow:hidden}@media(max-width:1100px){.team-member-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:760px){.team-admin-hero,.team-section-header{align-items:stretch;flex-direction:column}.team-admin-hero-actions{width:100%}.team-admin-hero-actions>*{flex:1}.team-admin-stats,.team-member-grid,.team-form-grid{grid-template-columns:1fr}.team-form-grid .is-wide{grid-column:auto}.team-modal{padding:8px}.team-modal-dialog{max-height:calc(100vh - 16px);border-radius:16px}.team-modal-dialog>header,.team-modal-dialog form{padding:20px}.team-member-actions>*{flex:1}.team-member-actions form{margin-left:0}.team-member-actions button{width:100%}} +.team-image-field{display:grid;grid-template-columns:1fr auto;gap:10px;align-items:end}.team-image-field>label{min-width:0}.team-media-button{min-height:44px;white-space:nowrap}.team-media-modal{position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:24px}.team-media-modal[hidden]{display:none}.team-media-backdrop{position:absolute;inset:0;background:rgba(5,14,9,.72);backdrop-filter:blur(5px)}.team-media-dialog{position:relative;z-index:1;width:min(1040px,96vw);max-height:88vh;overflow:hidden;border-radius:24px;background:#fff;box-shadow:0 30px 90px rgba(0,0,0,.35)}.team-media-dialog>header{display:flex;justify-content:space-between;gap:20px;padding:24px 26px;border-bottom:1px solid #e4e9e2}.team-media-dialog>header h2{margin:3px 0 0}.team-media-dialog>header button{width:42px;height:42px;border:0;border-radius:50%;font-size:26px;cursor:pointer}.team-media-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;max-height:64vh;overflow:auto;padding:22px}.team-media-choice{display:grid;gap:8px;padding:8px;border:1px solid #dce4da;border-radius:15px;background:#fff;text-align:left;cursor:pointer}.team-media-choice:hover,.team-media-choice:focus{border-color:#80b92d;box-shadow:0 0 0 3px rgba(128,185,45,.14)}.team-media-choice img{width:100%;aspect-ratio:4/3;object-fit:cover;border-radius:10px;background:#eef2ec}.team-media-choice strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}.team-image-preview{display:flex;align-items:center;gap:12px;margin-top:10px}.team-image-preview img{width:72px;height:72px;object-fit:cover;border-radius:14px;background:#edf2ea}.team-image-preview[hidden]{display:none}@media(max-width:760px){.team-image-field{grid-template-columns:1fr}.team-media-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.team-media-modal{padding:10px}} + +/* v1.5.25 – KI-Teamprofile und Medienwasserzeichen */ +.team-ai-status{position:absolute;left:12px;top:12px;padding:6px 10px;border-radius:999px;color:#fff;background:rgba(42,29,69,.9);box-shadow:0 3px 10px rgba(0,0,0,.18);font-size:12px;font-weight:900}.team-image-watermark{position:absolute;right:9px;bottom:9px;z-index:3;display:inline-flex;max-width:calc(100% - 18px);padding:6px 9px;border:1px solid rgba(255,255,255,.75);border-radius:7px;color:#fff;background:rgba(12,18,13,.88);box-shadow:0 3px 12px rgba(0,0,0,.3);font-size:11px;font-weight:900;line-height:1.15;text-shadow:0 1px 2px #000}.team-ai-copy{padding:10px 12px;border-left:3px solid #7d57a5;border-radius:0 8px 8px 0;color:#4d3a60!important;background:#f3eef8;font-size:12px}.team-ai-panel{display:grid;gap:12px;margin:0;padding:16px;border:1px solid #d8cbe5;border-radius:14px;background:#faf7fd}.team-ai-panel legend{padding:0 8px;color:#513d68;font-weight:900}.team-ai-panel>label:not(.team-check){display:grid;gap:7px}.team-ai-panel textarea{width:100%;box-sizing:border-box}.team-image-preview>div,.team-media-choice>div{position:relative}.team-image-preview>div{width:72px;height:72px;flex:0 0 auto}.team-image-preview>div img{width:100%;height:100%}.team-media-choice>div{overflow:hidden;border-radius:10px}.team-media-choice small{color:#5b426f;font-size:11px;font-weight:800}.team-media-choice .team-image-watermark{right:5px;bottom:5px;max-width:calc(100% - 10px);padding:4px 6px;font-size:9px}.team-image-preview .team-image-watermark{right:3px;bottom:3px;max-width:calc(100% - 6px);padding:3px 5px;font-size:8px} diff --git a/web/assets/admin-team-v3.js b/web/assets/admin-team-v3.js new file mode 100644 index 0000000..cd1c1c2 --- /dev/null +++ b/web/assets/admin-team-v3.js @@ -0,0 +1,58 @@ +(() => { + const modal = document.querySelector('[data-team-modal]'); + const form = document.querySelector('[data-team-form]'); + if (!modal || !form) return; + const fields = { + id: form.querySelector('[data-team-id]'), name: form.querySelector('[data-team-name]'), role: form.querySelector('[data-team-role]'), + image: form.querySelector('[data-team-image]'), region: form.querySelector('[data-team-region]'), task: form.querySelector('[data-team-task]'), + at: form.querySelector('[data-team-at]'), sort: form.querySelector('[data-team-sort]'), bio: form.querySelector('[data-team-bio]'), + active: form.querySelector('[data-team-active]'), isAI: form.querySelector('[data-team-is-ai]'), disclosure: form.querySelector('[data-team-ai-disclosure]') + }; + const disclosureWrap = form.querySelector('[data-team-ai-disclosure-wrap]'); + const title = modal.querySelector('[data-team-modal-title]'); + const kicker = modal.querySelector('[data-team-modal-kicker]'); + const submit = modal.querySelector('[data-team-submit]'); + let lastFocus = null; + const refreshAI = () => { if (disclosureWrap) disclosureWrap.hidden = !fields.isAI.checked; }; + const open = (card = null) => { + lastFocus = document.activeElement; + form.reset(); fields.id.value = ''; fields.sort.value = '100'; fields.active.checked = true; fields.isAI.checked = false; + if (card) { + fields.id.value = card.dataset.id || ''; fields.name.value = card.dataset.name || ''; fields.role.value = card.dataset.role || ''; + fields.image.value = card.dataset.image || ''; fields.region.value = card.dataset.region || ''; fields.task.value = card.dataset.task || ''; + fields.at.value = card.dataset.atLandwelle || ''; fields.sort.value = card.dataset.sortOrder || '100'; fields.bio.value = card.dataset.bio || ''; + fields.active.checked = card.dataset.active === 'true'; fields.isAI.checked = card.dataset.isAi === 'true'; fields.disclosure.value = card.dataset.aiDisclosure || ''; + title.textContent = 'Teammitglied bearbeiten'; kicker.textContent = 'Profil aktualisieren'; submit.textContent = 'Änderungen speichern'; + } else { title.textContent = 'Teammitglied hinzufügen'; kicker.textContent = 'Neues Profil'; submit.textContent = 'Teammitglied speichern'; } + refreshAI(); modal.hidden = false; document.body.classList.add('team-modal-open'); requestAnimationFrame(() => fields.name.focus()); + }; + const close = () => { modal.hidden = true; document.body.classList.remove('team-modal-open'); if (lastFocus instanceof HTMLElement) lastFocus.focus(); }; + fields.isAI.addEventListener('change', refreshAI); + document.querySelectorAll('[data-team-create]').forEach(button => button.addEventListener('click', () => open())); + document.querySelectorAll('[data-team-edit]').forEach(button => button.addEventListener('click', () => open(button.closest('[data-team-card]')))); + modal.querySelectorAll('[data-team-close]').forEach(button => button.addEventListener('click', close)); + document.addEventListener('keydown', event => { if (event.key === 'Escape' && !modal.hidden) close(); }); +})(); + +(() => { + const picker = document.querySelector('[data-team-media-modal]'); + const imageInput = document.querySelector('[data-team-image]'); + const preview = document.querySelector('[data-team-image-preview]'); + const previewImg = document.querySelector('[data-team-image-preview-img]'); + const previewWatermark = document.querySelector('[data-team-image-preview-watermark]'); + if (!picker || !imageInput) return; + let selectedWatermark = ''; + const refreshPreview = () => { + const url = imageInput.value.trim(); + if (preview && previewImg) { preview.hidden = !url; if (url) previewImg.src = url; } + if (previewWatermark) { previewWatermark.hidden = !selectedWatermark; previewWatermark.textContent = selectedWatermark; } + }; + const openPicker = () => { picker.hidden = false; document.body.classList.add('team-modal-open'); }; + const closePicker = () => { picker.hidden = true; }; + document.querySelectorAll('[data-team-media-open]').forEach(b => b.addEventListener('click', openPicker)); + picker.querySelectorAll('[data-team-media-close]').forEach(b => b.addEventListener('click', closePicker)); + picker.querySelectorAll('[data-team-media-choice]').forEach(b => b.addEventListener('click', () => { imageInput.value = b.dataset.url || ''; selectedWatermark = b.dataset.watermark || ''; refreshPreview(); closePicker(); imageInput.dispatchEvent(new Event('change', {bubbles:true})); })); + imageInput.addEventListener('input', () => { selectedWatermark = ''; refreshPreview(); }); + document.querySelectorAll('[data-team-edit],[data-team-create]').forEach(b => b.addEventListener('click', () => setTimeout(() => { selectedWatermark = ''; refreshPreview(); }, 0))); + document.addEventListener('keydown', e => { if (e.key === 'Escape' && !picker.hidden) closePicker(); }); +})(); diff --git a/web/assets/admin-users-v40.css b/web/assets/admin-users-v40.css new file mode 100644 index 0000000..e0aab8f --- /dev/null +++ b/web/assets/admin-users-v40.css @@ -0,0 +1,2 @@ +.user-stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:22px}.user-stats-grid article{padding:20px;border:1px solid #dfe6dc;border-radius:18px;background:linear-gradient(145deg,#fff,#f4f8f1);box-shadow:0 10px 28px rgba(25,45,29,.07)}.user-stats-grid span{display:block;color:#687268;font-size:.76rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em}.user-stats-grid strong{display:block;margin-top:8px;font-size:2rem;color:#3f6f0f}.user-filter-card form{display:grid;grid-template-columns:2fr 1fr 1fr .7fr auto;gap:14px;align-items:end}.user-filter-card label,.user-form-card label,.role-card label,.new-role-card label{display:grid;gap:7px}.user-filter-card label>span,.user-form-card label>span,.role-card label>span,.new-role-card label>span{font-size:.76rem;font-weight:850;color:#4b554d}.user-filter-card input,.user-filter-card select,.user-form-card input,.user-form-card select,.user-form-card textarea,.role-card input,.role-card textarea,.new-role-card input,.new-role-card textarea{width:100%;border:1px solid #d8e0d5;border-radius:11px;background:#fff;padding:11px 12px;color:#202820;font:inherit}.user-table-wrap{overflow:auto}.user-table{width:100%;border-collapse:collapse;min-width:1080px}.user-table th{padding:12px 14px;border-bottom:1px solid #dfe5dc;color:#717a72;text-align:left;font-size:.7rem;text-transform:uppercase;letter-spacing:.08em}.user-table td{padding:15px 14px;border-bottom:1px solid #edf0eb;vertical-align:middle;font-size:.87rem}.user-identity{display:flex;align-items:center;gap:12px}.user-identity>span{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:linear-gradient(135deg,#76b82a,#14753a);color:#fff;font-weight:900;text-transform:uppercase}.user-identity div{display:grid;gap:3px}.user-identity small{color:#788079}.role-badge,.status-badge{display:inline-flex;align-items:center;width:max-content;padding:6px 9px;border-radius:999px;background:#edf5e5;color:#5b880d;font-size:.7rem;font-weight:850}.status-stack{display:flex;flex-wrap:wrap;gap:5px}.status-badge.is-ok{background:#e6f7eb;color:#16833d}.status-badge.is-off{background:#f0f1ef;color:#687067}.status-badge.is-warn{background:#fff1d9;color:#a46200}.row-actions{display:grid;gap:7px}.row-actions>a{color:#5d9500;font-weight:850}.row-actions form{display:flex;flex-wrap:wrap;gap:5px}.row-actions button{border:1px solid #dce3d9;border-radius:8px;background:#fff;padding:6px 8px;color:#4f5951;font-size:.7rem;font-weight:800;cursor:pointer}.row-actions button.danger{color:#ac342b;border-color:#efcbc8}.pagination{display:flex;justify-content:center;align-items:center;gap:18px;padding:20px 0 0}.pagination a{padding:9px 13px;border-radius:9px;background:#edf5e5;color:#568700;font-weight:850}.user-form-card{margin-top:22px}.password-reset-box{margin-top:24px;padding:18px;border-radius:15px;background:#f5f7f3;border:1px solid #e0e5dc}.password-reset-box h3{margin:0 0 10px}.password-reset-box form{display:flex;gap:10px}.password-reset-box input{flex:1}.roles-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.role-card form{display:grid;gap:15px}.role-card-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start}.role-card h2{margin:8px 0 3px}.role-card code{color:#7b847d}.permission-grid{display:grid;gap:8px;max-height:430px;overflow:auto;padding-right:5px}.permission-choice{grid-template-columns:auto 1fr!important;align-items:flex-start;padding:11px;border:1px solid #e2e7df;border-radius:12px;background:#fafcf9}.permission-choice input{width:auto;margin-top:3px}.permission-choice span{display:grid;gap:3px}.permission-choice small{color:#707971;font-weight:500}.new-role-card{margin-top:22px}.admin-secondary-button{border:1px solid #cfd8cb;border-radius:10px;background:#fff;padding:11px 15px;font-weight:850;color:#435044}.admin-check{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center!important;gap:9px!important}.admin-check input{width:auto!important}@media(max-width:1200px){.user-stats-grid{grid-template-columns:repeat(2,1fr)}.user-filter-card form{grid-template-columns:1fr 1fr}.roles-grid{grid-template-columns:1fr}}@media(max-width:700px){.user-stats-grid,.user-filter-card form{grid-template-columns:1fr}.password-reset-box form{flex-direction:column}} +.environment-admin-note{display:block;margin-top:4px;color:#82b936;font-weight:750}.status-badge.is-system{background:#eaf4dc;color:#527d16;border-color:#cfe4ae}.protected-account{display:block;max-width:220px;color:#667066;font-size:12px;line-height:1.45}.protected-account code{font-size:11px;overflow-wrap:anywhere} diff --git a/web/assets/admin-v11.js b/web/assets/admin-v11.js new file mode 100644 index 0000000..b6afe86 --- /dev/null +++ b/web/assets/admin-v11.js @@ -0,0 +1,216 @@ +(() => { + 'use strict'; + + const navButtons = Array.from(document.querySelectorAll('[data-admin-view]')); + const panels = Array.from(document.querySelectorAll('[data-admin-panel]')); + const sidebar = document.querySelector('.admin-sidebar'); + const mobileMenu = document.querySelector('.admin-mobile-menu'); + + const openView = (name) => { + navButtons.forEach((button) => button.classList.toggle('is-active', button.dataset.adminView === name)); + panels.forEach((panel) => panel.classList.toggle('is-active', panel.dataset.adminPanel === name)); + sidebar?.classList.remove('is-open'); + mobileMenu?.setAttribute('aria-expanded', 'false'); + window.scrollTo({ top: 0, behavior: 'smooth' }); + }; + + navButtons.forEach((button) => button.addEventListener('click', () => openView(button.dataset.adminView))); + document.querySelectorAll('[data-admin-jump]').forEach((button) => { + button.addEventListener('click', () => openView(button.dataset.adminJump)); + }); + mobileMenu?.addEventListener('click', () => { + const open = sidebar?.classList.toggle('is-open') === true; + mobileMenu.setAttribute('aria-expanded', String(open)); + }); + + const audio = document.querySelector('[data-admin-audio]'); + const streamButton = document.querySelector('[data-admin-stream-toggle]'); + const streamStatus = document.querySelector('[data-admin-stream-status]'); + streamButton?.addEventListener('click', async () => { + if (!audio) return; + try { + if (audio.paused) { + await audio.play(); + streamButton.textContent = '❚❚'; + streamButton.classList.add('is-playing'); + if (streamStatus) streamStatus.textContent = 'Livestream läuft'; + } else { + audio.pause(); + streamButton.textContent = '▶'; + streamButton.classList.remove('is-playing'); + if (streamStatus) streamStatus.textContent = 'Livestream pausiert'; + } + } catch (error) { + if (streamStatus) streamStatus.textContent = 'Stream konnte nicht gestartet werden'; + console.error('Admin stream test:', error); + } + }); + audio?.addEventListener('error', () => { + if (streamStatus) streamStatus.textContent = 'Stream ist momentan nicht erreichbar'; + }); + + const weatherButton = document.querySelector('[data-admin-weather-refresh]'); + const setText = (selector, value) => { + const element = document.querySelector(selector); + if (element) element.textContent = value; + }; + const loadWeather = async () => { + weatherButton?.classList.add('is-loading'); + try { + const response = await fetch('/admin/api/weather', { headers: { Accept: 'application/json' }, cache: 'no-store' }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const payload = await response.json(); + const weather = payload.data; + if (!document.querySelector('[data-admin-weather-temp]')) { + window.location.reload(); + return; + } + setText('[data-admin-weather-icon]', weather.current.icon); + setText('[data-admin-weather-temp]', `${Math.round(weather.current.temperature)}°`); + setText('[data-admin-weather-description]', weather.current.description); + setText('[data-admin-weather-feels]', `Gefühlt ${Math.round(weather.current.apparent_temperature)}°`); + setText('[data-admin-weather-wind]', `${weather.current.wind_direction} · ${Math.round(weather.current.wind_speed)} km/h`); + setText('[data-admin-weather-rain]', `Regen ${weather.current.rain_probability} %`); + setText('[data-admin-weather-uv]', `UV ${weather.current.uv_index.toFixed(1)}`); + } catch (error) { + setText('[data-admin-weather-error]', 'Wetterdaten konnten gerade nicht aktualisiert werden.'); + console.error('Admin weather:', error); + } finally { + weatherButton?.classList.remove('is-loading'); + } + }; + weatherButton?.addEventListener('click', loadWeather); + + + const azuraForm = document.querySelector('[data-azuracast-form]'); + const azuraTestButton = document.querySelector('[data-azuracast-test]'); + const azuraMessage = document.querySelector('[data-azuracast-message]'); + const azuraEndpoint = document.querySelector('[data-azuracast-endpoint]'); + const csrfToken = document.body?.dataset.adminCsrf || ''; + + const readAzuraSettings = () => { + if (!azuraForm) return null; + const data = new FormData(azuraForm); + return { + azuracast: { + enabled: data.get('enabled') === 'on', + base_url: String(data.get('base_url') || '').trim().replace(/\/+$/, ''), + station_shortcode: String(data.get('station_shortcode') || '').trim(), + use_static_json: data.get('use_static_json') === 'on', + poll_seconds: Number(data.get('poll_seconds') || 15) + }, + covers: { + itunes_enabled: true, + musicbrainz_enabled: false, + country: String(data.get('country') || 'DE').trim().toUpperCase(), + cache_hours: Number(data.get('cache_hours') || 720) + } + }; + }; + + const calculateEndpoint = (settings) => { + const base = settings?.azuracast?.base_url || ''; + const station = encodeURIComponent(settings?.azuracast?.station_shortcode || 'station'); + return settings?.azuracast?.use_static_json + ? `${base}/api/nowplaying_static/${station}.json` + : `${base}/api/nowplaying/${station}`; + }; + + const refreshEndpoint = () => { + const settings = readAzuraSettings(); + if (azuraEndpoint && settings) azuraEndpoint.textContent = calculateEndpoint(settings); + }; + + const setAzuraMessage = (text, type = '') => { + if (!azuraMessage) return; + azuraMessage.textContent = text; + azuraMessage.dataset.type = type; + }; + + const setAzuraBusy = (busy) => { + azuraForm?.classList.toggle('is-busy', busy); + if (azuraTestButton) azuraTestButton.disabled = busy; + const submit = azuraForm?.querySelector('[type="submit"]'); + if (submit) submit.disabled = busy; + }; + + const updateNowPreview = (now, connected = true) => { + if (!now) return; + setText('[data-admin-now-artist]', now.artist || 'Landwelle Radio'); + setText('[data-admin-now-title]', now.title || 'Live aus Niedersachsen'); + setText('[data-admin-now-show]', now.show || 'Landwelle Radio'); + setText('[data-admin-now-presenter]', now.presenter || 'Sound & Infos aus Niedersachsen'); + setText('[data-admin-now-source]', now.source || 'azuracast'); + setText('[data-admin-now-provider]', now.cover_provider || 'Kein externes Cover gefunden'); + setText('[data-admin-now-listeners]', String(now.listeners ?? 0)); + setText('[data-admin-now-status] span', connected ? 'AzuraCast verbunden' : 'Verbindung noch nicht bestätigt'); + const status = document.querySelector('[data-admin-now-status]'); + status?.classList.toggle('is-error', !connected); + const cover = document.querySelector('[data-admin-now-cover]'); + if (cover && now.cover_url) { + const preload = new Image(); + preload.onload = () => { cover.src = now.cover_url; }; + preload.src = now.cover_url; + } + }; + + const azuraRequest = async (path) => { + const settings = readAzuraSettings(); + if (!settings) throw new Error('Formular nicht gefunden'); + const response = await fetch(path, { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + 'X-CSRF-Token': csrfToken + }, + cache: 'no-store', + body: JSON.stringify(settings) + }); + const payload = await response.json().catch(() => ({})); + if (!response.ok) { + throw new Error(payload?.error?.message || `HTTP ${response.status}`); + } + return payload.data; + }; + + azuraForm?.querySelectorAll('input').forEach((input) => input.addEventListener('input', refreshEndpoint)); + azuraForm?.querySelectorAll('input[type="checkbox"]').forEach((input) => input.addEventListener('change', refreshEndpoint)); + refreshEndpoint(); + + azuraTestButton?.addEventListener('click', async () => { + setAzuraBusy(true); + setAzuraMessage('AzuraCast und Cover-Suche werden geprüft …', 'loading'); + try { + const data = await azuraRequest('/admin/api/azuracast/test'); + setAzuraMessage(data.message || 'Verbindung erfolgreich.', 'success'); + updateNowPreview(data.now, true); + if (azuraEndpoint && data.endpoint) azuraEndpoint.textContent = data.endpoint; + } catch (error) { + setAzuraMessage(error.message || 'Verbindung fehlgeschlagen.', 'error'); + const status = document.querySelector('[data-admin-now-status]'); + status?.classList.add('is-error'); + setText('[data-admin-now-status] span', 'AzuraCast nicht erreichbar'); + } finally { + setAzuraBusy(false); + } + }); + + azuraForm?.addEventListener('submit', async (event) => { + event.preventDefault(); + if (!azuraForm.reportValidity()) return; + setAzuraBusy(true); + setAzuraMessage('Einstellungen werden gespeichert und aktiviert …', 'loading'); + try { + const data = await azuraRequest('/admin/api/azuracast/save'); + setAzuraMessage(data.message || 'Einstellungen gespeichert.', data.connected ? 'success' : 'warning'); + updateNowPreview(data.now, Boolean(data.connected)); + if (azuraEndpoint && data.endpoint) azuraEndpoint.textContent = data.endpoint; + } catch (error) { + setAzuraMessage(error.message || 'Speichern fehlgeschlagen.', 'error'); + } finally { + setAzuraBusy(false); + } + }); + +})(); diff --git a/web/assets/admin-v14.css b/web/assets/admin-v14.css new file mode 100644 index 0000000..7ee5e3d --- /dev/null +++ b/web/assets/admin-v14.css @@ -0,0 +1,137 @@ +:root{ + --lw-green:#18a84b; + --lw-green-dark:#087b34; + --lw-green-soft:#e9f8ee; + --lw-black:#090b09; + --lw-panel:#121512; + --lw-text:#151915; + --lw-muted:#6d746e; + --lw-line:#e4e8e4; + --lw-bg:#f4f6f4; + --lw-white:#fff; + --lw-shadow:0 18px 55px rgba(11,18,12,.12); + font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; + color-scheme:light; +} +*{box-sizing:border-box} +html,body{margin:0;min-height:100%;background:var(--lw-bg);color:var(--lw-text)} +body{font-size:16px} +button,input{font:inherit} +button,a{ -webkit-tap-highlight-color:transparent} +a{color:inherit;text-decoration:none} +.admin-kicker{display:block;color:var(--lw-green);font-size:.72rem;font-weight:850;letter-spacing:.13em;text-transform:uppercase} + +/* Login */ +.admin-login-page{background:#0a0d0a;min-height:100vh;overflow-x:hidden} +.admin-login-shell{display:grid;grid-template-columns:minmax(420px,1.04fr) minmax(430px,.96fr);min-height:100vh} +.admin-login-brand{position:relative;display:flex;flex-direction:column;justify-content:flex-start;overflow:hidden;padding:42px 5.5vw 64px;color:#fff;background: + linear-gradient(135deg,rgba(5,9,5,.95),rgba(7,19,10,.82)), + url('/assets/hero-poster.jpg') center/cover no-repeat} +.admin-login-brand:after{content:"";position:absolute;inset:auto -8% -20% 16%;height:52%;background:radial-gradient(circle at center,rgba(25,168,75,.33),transparent 65%);filter:blur(10px)} +.admin-login-brand>img{position:relative;z-index:2;width:min(310px,64%);height:auto;filter:drop-shadow(0 8px 24px rgba(0,0,0,.26))} +.admin-login-brand>p{position:relative;z-index:2;margin:2px 0 0 7px;color:#dce7dd;font-size:.76rem;letter-spacing:.11em;text-transform:uppercase} +.admin-login-message{position:relative;z-index:2;margin-top:auto;max-width:670px} +.admin-login-message>span{display:inline-flex;align-items:center;gap:9px;color:#7fe59f;font-weight:800;letter-spacing:.08em;text-transform:uppercase;font-size:.78rem} +.admin-login-message>span:before{content:"";width:24px;height:3px;border-radius:9px;background:var(--lw-green)} +.admin-login-message h1{margin:18px 0 20px;font-size:clamp(3rem,5.2vw,6.4rem);line-height:.91;letter-spacing:-.065em} +.admin-login-message p{max-width:520px;margin:0;color:#d1d9d2;font-size:1.08rem;line-height:1.65} +.admin-radio-waves{position:absolute;right:-110px;top:13%;width:450px;height:450px;opacity:.33} +.admin-radio-waves i{position:absolute;inset:50%;border:3px solid var(--lw-green);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;transform:translate(-50%,-50%) rotate(45deg)} +.admin-radio-waves i:nth-child(1){width:170px;height:170px}.admin-radio-waves i:nth-child(2){width:285px;height:285px}.admin-radio-waves i:nth-child(3){width:405px;height:405px} +.admin-login-panel{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:48px;background: + radial-gradient(circle at 100% 0,rgba(25,168,75,.12),transparent 29%),#f5f7f5} +.admin-login-card{width:min(520px,100%);background:#fff;border:1px solid rgba(20,40,25,.08);border-radius:28px;padding:50px;box-shadow:var(--lw-shadow)} +.admin-login-card h2{margin:10px 0 8px;font-size:2.15rem;letter-spacing:-.04em} +.admin-login-intro{margin:0 0 30px;color:var(--lw-muted);line-height:1.55} +.admin-alert{display:grid;gap:5px;margin:0 0 20px;padding:14px 16px;border-radius:13px;font-size:.9rem;line-height:1.45} +.admin-alert-error{background:#fff0ef;color:#a62a20;border:1px solid #ffd1cd} +.admin-alert-config{background:#fff8e5;color:#775800;border:1px solid #f5dda1} +.admin-alert code{font-size:.77rem;background:rgba(255,255,255,.55);padding:2px 5px;border-radius:5px} +.admin-login-form{display:grid;gap:18px} +.admin-login-form label>span{display:block;margin:0 0 8px;font-size:.83rem;font-weight:800;color:#343a35} +.admin-input-wrap{display:flex;align-items:center;gap:12px;height:55px;padding:0 16px;border:1px solid #dce3dd;border-radius:13px;background:#fbfcfb;transition:.2s} +.admin-input-wrap:focus-within{border-color:var(--lw-green);box-shadow:0 0 0 4px rgba(25,168,75,.11);background:#fff} +.admin-input-wrap b{color:var(--lw-green);font-size:.7rem} +.admin-input-wrap input{width:100%;border:0;outline:0;background:transparent;font-size:1rem;color:var(--lw-text)} +.admin-primary-button{display:flex;align-items:center;justify-content:space-between;height:57px;margin-top:5px;padding:0 22px;border:0;border-radius:14px;background:linear-gradient(135deg,var(--lw-green),#0d8d3d);color:#fff;font-weight:850;box-shadow:0 12px 25px rgba(17,150,62,.25);cursor:pointer;transition:.2s} +.admin-primary-button:hover{transform:translateY(-2px);box-shadow:0 16px 30px rgba(17,150,62,.31)} +.admin-primary-button:disabled{cursor:not-allowed;opacity:.45;transform:none} +.admin-primary-button i{font-size:1.3rem;font-style:normal} +.admin-login-security{display:flex;gap:12px;align-items:flex-start;margin-top:27px;padding-top:24px;border-top:1px solid var(--lw-line)} +.admin-login-security>span{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--lw-green-soft);color:var(--lw-green);font-weight:900} +.admin-login-security p{display:grid;gap:2px;margin:0}.admin-login-security small{color:var(--lw-muted);line-height:1.45} +.admin-login-footer{margin:22px 0 0;color:#879089;font-size:.75rem;text-align:center} + +/* Dashboard shell */ +.admin-dashboard-page{min-height:100vh;background:var(--lw-bg)} +.admin-layout{display:grid;grid-template-columns:265px minmax(0,1fr);min-height:100vh} +.admin-sidebar{position:sticky;top:0;display:flex;flex-direction:column;height:100vh;padding:25px 18px;background:linear-gradient(180deg,#090c09,#101510);color:#fff;z-index:20} +.admin-sidebar-brand{display:grid;justify-items:start;gap:4px;padding:0 13px 27px;border-bottom:1px solid rgba(255,255,255,.09)} +.admin-sidebar-brand img{width:176px;max-height:65px;object-fit:contain;object-position:left center} +.admin-sidebar-brand span{color:#87e5a4;font-size:.68rem;font-weight:850;letter-spacing:.2em;text-transform:uppercase} +.admin-navigation{display:grid;gap:7px;margin-top:26px} +.admin-navigation button{display:grid;grid-template-columns:28px 1fr auto;align-items:center;gap:9px;min-height:48px;padding:0 13px;border:0;border-radius:12px;background:transparent;color:#aeb9b0;text-align:left;cursor:pointer;transition:.18s} +.admin-navigation button:hover{background:rgba(255,255,255,.055);color:#fff} +.admin-navigation button.is-active{background:linear-gradient(90deg,rgba(25,168,75,.24),rgba(25,168,75,.08));color:#fff;box-shadow:inset 3px 0 var(--lw-green)} +.admin-navigation i{font-style:normal;color:#64d989;font-size:1.05rem;text-align:center} +.admin-navigation span{font-size:.88rem;font-weight:730} +.admin-navigation b{padding:3px 6px;border-radius:6px;background:rgba(255,255,255,.09);color:#839087;font-size:.55rem;letter-spacing:.06em;text-transform:uppercase} +.admin-sidebar-bottom{display:grid;gap:14px;margin-top:auto;padding:18px 12px 4px;border-top:1px solid rgba(255,255,255,.09)} +.admin-system-pill{display:flex;align-items:center;gap:9px;color:#c5cec6;font-size:.77rem}.admin-system-pill i{width:8px;height:8px;border-radius:50%;background:#37dd6e;box-shadow:0 0 0 5px rgba(55,221,110,.12)} +.admin-sidebar-bottom>a{display:flex;justify-content:space-between;color:#7f8a81;font-size:.76rem}.admin-sidebar-bottom>a:hover{color:#fff} +.admin-workspace{min-width:0} +.admin-topbar{position:sticky;top:0;z-index:15;display:flex;align-items:center;justify-content:space-between;height:79px;padding:0 38px;border-bottom:1px solid #e5e9e5;background:rgba(255,255,255,.94);backdrop-filter:blur(13px)} +.admin-topbar>div:first-of-type{display:grid;gap:1px}.admin-topbar>div:first-of-type span{color:var(--lw-muted);font-size:.7rem;letter-spacing:.08em;text-transform:uppercase}.admin-topbar>div:first-of-type strong{font-size:1.03rem} +.admin-user{display:flex;align-items:center;gap:11px}.admin-avatar{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:linear-gradient(135deg,var(--lw-green),#077832);color:#fff;font-weight:900;text-transform:uppercase}.admin-user>div{display:grid;gap:1px}.admin-user strong{font-size:.83rem}.admin-user small{color:var(--lw-muted);font-size:.68rem}.admin-user form{margin:0 0 0 8px}.admin-user button{width:36px;height:36px;border:1px solid var(--lw-line);border-radius:10px;background:#fff;color:#687069;cursor:pointer}.admin-user button:hover{border-color:#e1aaa5;color:#ae3025;background:#fff7f6} +.admin-mobile-menu{display:none;border:0;background:transparent;font-size:1.3rem} +.admin-content{padding:38px clamp(24px,3.3vw,56px) 70px} +.admin-view{display:none;max-width:1510px;margin:0 auto}.admin-view.is-active{display:block;animation:adminFade .2s ease}@keyframes adminFade{from{opacity:.25;transform:translateY(4px)}to{opacity:1;transform:none}} +.admin-page-heading{display:flex;justify-content:space-between;align-items:flex-end;gap:25px;margin-bottom:30px} +.admin-page-heading h1{margin:7px 0 6px;font-size:clamp(2rem,3vw,3.25rem);letter-spacing:-.055em;line-height:1}.admin-page-heading p{margin:0;color:var(--lw-muted);font-size:.98rem} +.admin-date{display:grid;gap:5px;padding:12px 16px;border:1px solid var(--lw-line);border-radius:12px;background:#fff;text-align:right}.admin-date span{color:var(--lw-muted);font-size:.65rem;text-transform:uppercase;letter-spacing:.08em}.admin-date strong{font-size:.82rem} +.admin-metric-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:22px} +.admin-metric{display:flex;align-items:center;gap:14px;min-height:115px;padding:20px;border:1px solid var(--lw-line);border-radius:17px;background:#fff;box-shadow:0 8px 25px rgba(15,25,16,.035)} +.metric-icon{display:grid;place-items:center;width:48px;height:48px;flex:0 0 48px;border-radius:15px;background:#edf1ed;color:#677168;font-size:1rem}.metric-icon.is-green{background:var(--lw-green-soft);color:var(--lw-green);box-shadow:inset 0 0 0 1px #d0f0d9} +.admin-metric>div{display:grid;gap:3px;min-width:0}.admin-metric small{color:var(--lw-muted);font-size:.68rem;text-transform:uppercase;letter-spacing:.05em}.admin-metric strong{font-size:1.05rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.admin-metric em{color:#8d948e;font-size:.69rem;font-style:normal} +.admin-dashboard-grid{display:grid;grid-template-columns:minmax(0,1.38fr) minmax(320px,.82fr);gap:22px} +.admin-card{border:1px solid var(--lw-line);border-radius:19px;background:#fff;box-shadow:0 11px 30px rgba(16,28,17,.045)} +.admin-card-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:22px 24px 15px}.admin-card-heading h2{margin:5px 0 0;font-size:1.18rem;letter-spacing:-.025em} +.admin-live-card{overflow:hidden;background:linear-gradient(135deg,#0b0f0b,#172017);color:#fff;border-color:#1a241b}.admin-live-card .admin-card-heading{border-bottom:1px solid rgba(255,255,255,.08)} +.admin-live-label{display:flex;align-items:center;gap:7px;padding:6px 10px;border-radius:20px;background:rgba(25,168,75,.16);color:#78e79a;font-size:.66rem;font-weight:850;text-transform:uppercase;letter-spacing:.08em}.admin-live-label i{width:7px;height:7px;border-radius:50%;background:#38e875;box-shadow:0 0 0 5px rgba(56,232,117,.12)} +.admin-live-body{display:flex;align-items:center;gap:19px;padding:25px}.admin-live-body>button{display:grid;place-items:center;width:64px;height:64px;flex:0 0 64px;border:0;border-radius:50%;background:var(--lw-green);color:#fff;font-size:1.2rem;cursor:pointer;box-shadow:0 12px 28px rgba(25,168,75,.26)}.admin-live-body>button.is-playing{background:#fff;color:var(--lw-green)} +.admin-live-body>div{display:grid;gap:4px;min-width:0}.admin-live-body small{color:#7e8c80;font-size:.68rem;text-transform:uppercase;letter-spacing:.06em}.admin-live-body strong{font-size:.85rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.admin-live-body span{color:#6de590;font-size:.74rem} +.admin-weather-overview{padding-bottom:18px}.admin-icon-button{width:36px;height:36px;border:1px solid var(--lw-line);border-radius:10px;background:#fff;color:var(--lw-green);font-size:1.1rem;cursor:pointer}.admin-icon-button.is-loading{animation:adminSpin .8s linear infinite}@keyframes adminSpin{to{transform:rotate(360deg)}} +.admin-weather-main{display:grid;grid-template-columns:62px 68px 1fr;align-items:center;gap:7px;padding:7px 24px 15px}.admin-weather-main>span{font-size:2.7rem}.admin-weather-main>strong{font-size:2.6rem;letter-spacing:-.07em}.admin-weather-main>div{display:grid}.admin-weather-main b{font-size:.85rem;text-transform:capitalize}.admin-weather-main small{margin-top:3px;color:var(--lw-muted);font-size:.72rem} +.admin-weather-facts{display:flex;justify-content:space-between;gap:10px;margin:0 24px;padding:13px 0;border-top:1px solid var(--lw-line);border-bottom:1px solid var(--lw-line);color:#697069;font-size:.7rem}.admin-source{display:block;margin:11px 24px 0;color:#9aa09b;font-size:.6rem}.admin-weather-error{margin:15px 24px;padding:18px;border-radius:12px;background:#fff5ec;color:#8b5013;font-size:.82rem} +.admin-activity-card,.admin-quick-card{min-height:315px} +.admin-progress-list{display:grid;gap:18px;padding:9px 24px 25px}.admin-progress-list>div{display:grid;grid-template-columns:64px 1fr auto;align-items:center;gap:14px}.admin-progress-list>div>span{position:relative;display:block;height:7px;border-radius:9px;background:#edf0ed;overflow:hidden}.admin-progress-list>div>span i{position:absolute;inset:0 auto 0 0;width:var(--progress);border-radius:inherit;background:linear-gradient(90deg,var(--lw-green),#54d679)}.admin-progress-list p{display:grid;gap:2px;margin:0}.admin-progress-list strong{font-size:.8rem}.admin-progress-list small{color:var(--lw-muted);font-size:.67rem}.admin-progress-list b{color:var(--lw-green-dark);font-size:.72rem} +.admin-quick-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:8px 22px 24px}.admin-quick-grid button,.admin-quick-grid a{display:grid;grid-template-columns:36px 1fr;grid-template-rows:auto auto;column-gap:11px;align-items:center;min-height:94px;padding:14px;border:1px solid var(--lw-line);border-radius:13px;background:#fbfcfb;text-align:left;cursor:pointer}.admin-quick-grid i{grid-row:1/3;display:grid;place-items:center;width:36px;height:36px;border-radius:11px;background:var(--lw-green-soft);color:var(--lw-green);font-style:normal;font-weight:900}.admin-quick-grid strong{font-size:.78rem}.admin-quick-grid span{color:var(--lw-muted);font-size:.63rem}.admin-quick-grid button:hover,.admin-quick-grid a:hover{border-color:#b9dfc3;background:#f7fff9} +.admin-empty-state{display:grid;justify-items:center;max-width:720px;margin:70px auto;padding:55px;text-align:center;border:1px dashed #bdc8be;border-radius:24px;background:#fff}.admin-empty-state>span{display:grid;place-items:center;width:70px;height:70px;border-radius:21px;background:var(--lw-green-soft);color:var(--lw-green);font-size:1.6rem}.admin-empty-state h2{margin:22px 0 8px;font-size:1.55rem}.admin-empty-state p{max-width:570px;margin:0;color:var(--lw-muted);line-height:1.65}.admin-empty-state button{margin-top:22px;padding:11px 17px;border:0;border-radius:10px;background:var(--lw-black);color:#fff;font-weight:750;cursor:pointer} +.admin-feature-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}.admin-feature-grid article{display:grid;align-content:start;min-height:260px;padding:27px;border:1px solid var(--lw-line);border-radius:19px;background:#fff}.admin-feature-grid i{display:grid;place-items:center;width:48px;height:48px;border-radius:14px;background:var(--lw-green-soft);color:var(--lw-green);font-size:1.2rem;font-style:normal}.admin-feature-grid h2{margin:22px 0 8px;font-size:1.08rem}.admin-feature-grid p{margin:0;color:var(--lw-muted);line-height:1.58;font-size:.87rem}.admin-feature-grid span{margin-top:auto;padding-top:23px;color:var(--lw-green-dark);font-size:.68rem;font-weight:850;text-transform:uppercase;letter-spacing:.07em} +.admin-settings-card{padding:25px}.admin-settings-card>.admin-card-heading{padding:0 0 19px}.admin-settings-card h2{margin:0 0 18px}.admin-settings-card dl{display:grid;gap:0;margin:0}.admin-settings-card dl>div{display:grid;grid-template-columns:minmax(140px,.55fr) 1fr;gap:20px;padding:13px 0;border-bottom:1px solid var(--lw-line)}.admin-settings-card dt{color:var(--lw-muted);font-size:.76rem}.admin-settings-card dd{margin:0;font-size:.77rem;font-weight:750;overflow-wrap:anywhere}.admin-settings-card>p{margin:20px 0 0;color:var(--lw-muted);line-height:1.55;font-size:.79rem}.admin-status-green{color:var(--lw-green);font-weight:850}.admin-settings-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px} +.admin-push-preview{display:grid;grid-template-columns:1fr .75fr;gap:0;overflow:hidden;min-height:430px;border-radius:24px;background:linear-gradient(135deg,#0a0e0a,#172317);color:#fff;box-shadow:var(--lw-shadow)}.admin-push-preview>div:first-child{display:flex;flex-direction:column;justify-content:center;padding:55px}.admin-push-preview>div:first-child>span{color:#79e79b;text-transform:uppercase;letter-spacing:.1em;font-size:.73rem;font-weight:850}.admin-push-preview h2{margin:14px 0 10px;font-size:2.5rem;letter-spacing:-.05em}.admin-push-preview p{max-width:520px;color:#c0cbc2;line-height:1.6}.admin-push-preview button{align-self:flex-start;margin-top:18px;padding:12px 18px;border:0;border-radius:11px;background:#3c443d;color:#89928a}.admin-phone-preview{align-self:center;justify-self:center;width:250px;height:320px;padding:28px 19px;border:8px solid #222922;border-radius:36px;background:#f6f8f6;color:#151915;box-shadow:0 35px 60px rgba(0,0,0,.35)}.admin-phone-preview>span{display:block;color:var(--lw-green);font-size:.68rem;font-weight:900;text-transform:uppercase}.admin-phone-preview strong{display:block;margin:80px 0 8px;font-size:1.05rem}.admin-phone-preview p{color:#687069;font-size:.78rem} + +@media (min-width:1500px){.admin-layout{grid-template-columns:290px minmax(0,1fr)}.admin-sidebar{padding-inline:22px}.admin-content{padding-top:46px}.admin-metric{min-height:128px}.admin-dashboard-grid{grid-template-columns:minmax(0,1.45fr) minmax(360px,.8fr)}} +@media (max-width:1120px){.admin-metric-grid{grid-template-columns:1fr 1fr}.admin-feature-grid,.admin-settings-grid{grid-template-columns:1fr 1fr}.admin-dashboard-grid{grid-template-columns:1fr}.admin-login-shell{grid-template-columns:.9fr 1.1fr}.admin-login-brand{padding-inline:4vw}.admin-login-message h1{font-size:4.2rem}.admin-login-card{padding:38px}} +@media (max-width:820px){.admin-login-shell{display:block}.admin-login-brand{min-height:320px;padding:27px 28px 35px}.admin-login-brand>img{width:220px}.admin-login-brand>p{font-size:.62rem}.admin-login-message{margin-top:70px}.admin-login-message h1{font-size:3rem}.admin-login-message p{display:none}.admin-login-panel{padding:25px 16px 40px}.admin-login-card{margin-top:-20px;padding:29px 24px;border-radius:22px;position:relative;z-index:4}.admin-layout{display:block}.admin-sidebar{position:fixed;left:-285px;width:265px;transition:.23s}.admin-sidebar.is-open{left:0;box-shadow:30px 0 70px rgba(0,0,0,.3)}.admin-topbar{height:70px;padding:0 18px}.admin-mobile-menu{display:block}.admin-topbar>div:first-of-type{display:none}.admin-content{padding:26px 17px 50px}.admin-page-heading{align-items:flex-start;flex-direction:column}.admin-date{text-align:left}.admin-metric-grid,.admin-feature-grid,.admin-settings-grid{grid-template-columns:1fr}.admin-push-preview{grid-template-columns:1fr}.admin-phone-preview{display:none}} +@media (max-width:520px){.admin-login-message h1{font-size:2.55rem}.admin-login-card h2{font-size:1.75rem}.admin-user>div{display:none}.admin-metric-grid{grid-template-columns:1fr}.admin-dashboard-grid{gap:15px}.admin-card-heading{padding-inline:18px}.admin-live-body{padding:20px 18px}.admin-weather-main{padding-inline:18px}.admin-weather-facts{margin-inline:18px}.admin-progress-list{padding-inline:18px}.admin-quick-grid{grid-template-columns:1fr;padding-inline:18px}.admin-feature-grid article{min-height:220px}.admin-settings-card dl>div{grid-template-columns:1fr;gap:5px}.admin-push-preview>div:first-child{padding:35px 25px}.admin-push-preview h2{font-size:2rem}} + +/* v11 – AzuraCast-Integration und externe Cover-Verwaltung */ +.admin-integration-badge{display:grid;grid-template-columns:10px auto;column-gap:9px;align-items:center;padding:12px 15px;border:1px solid var(--lw-line);border-radius:14px;background:#fff;box-shadow:0 8px 22px rgba(15,28,16,.04)} +.admin-integration-badge i{grid-row:1/3;width:9px;height:9px;border-radius:50%;background:var(--lw-green);box-shadow:0 0 0 6px rgba(25,168,75,.12)} +.admin-integration-badge span{color:var(--lw-muted);font-size:.62rem;text-transform:uppercase;letter-spacing:.08em}.admin-integration-badge strong{font-size:.74rem} +.admin-radio-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(310px,.72fr);gap:22px;align-items:start} +.admin-azuracast-card{overflow:hidden}.admin-integration-form{display:grid}.admin-form-section{padding:24px;border-top:1px solid var(--lw-line)} +.admin-switch-row{display:grid;grid-template-columns:1fr 48px;align-items:center;gap:20px;margin-bottom:22px;cursor:pointer}.admin-switch-row>span{display:grid;gap:4px}.admin-switch-row strong{font-size:.9rem}.admin-switch-row small{color:var(--lw-muted);font-size:.72rem;line-height:1.5}.admin-switch-row input{position:absolute;opacity:0;pointer-events:none}.admin-switch-row>i{position:relative;width:48px;height:27px;border-radius:18px;background:#cbd1cc;transition:.2s}.admin-switch-row>i:after{content:"";position:absolute;left:4px;top:4px;width:19px;height:19px;border-radius:50%;background:#fff;box-shadow:0 2px 6px rgba(0,0,0,.2);transition:.2s}.admin-switch-row input:checked+i{background:var(--lw-green)}.admin-switch-row input:checked+i:after{transform:translateX(21px)}.admin-switch-row input:focus-visible+i{outline:3px solid rgba(25,168,75,.25);outline-offset:3px} +.admin-field-grid{display:grid;grid-template-columns:1.4fr .8fr;gap:16px}.admin-field-grid-small{grid-template-columns:1fr 1fr;max-width:520px;margin-top:18px}.admin-field-wide{grid-column:1/-1}.admin-field{display:grid;gap:7px}.admin-field>span{font-size:.69rem;font-weight:820;text-transform:uppercase;letter-spacing:.055em;color:#4d564e}.admin-field input{width:100%;height:45px;border:1px solid #d9dfda;border-radius:11px;background:#fbfcfb;padding:0 13px;color:#121713;outline:none}.admin-field input:focus{border-color:var(--lw-green);box-shadow:0 0 0 3px rgba(25,168,75,.1);background:#fff}.admin-field small{color:var(--lw-muted);font-size:.64rem}.admin-field code{font-size:inherit} +.admin-check-row{display:flex;align-items:flex-start;gap:11px;margin-top:18px;padding:14px;border:1px solid #e1e6e2;border-radius:12px;background:#f9fbf9;cursor:pointer}.admin-check-row input{margin-top:3px;accent-color:var(--lw-green)}.admin-check-row span{display:grid;gap:3px}.admin-check-row strong{font-size:.77rem}.admin-check-row small{color:var(--lw-muted);font-size:.67rem;line-height:1.45} +.admin-endpoint-preview{display:grid;gap:6px;margin-top:16px;padding:13px 15px;border-radius:11px;background:#0e140f;color:#dce5dd}.admin-endpoint-preview span{color:#7f9182;font-size:.61rem;text-transform:uppercase;letter-spacing:.08em}.admin-endpoint-preview code{overflow-wrap:anywhere;color:#8be5a4;font-size:.72rem} +.admin-cover-settings{background:linear-gradient(180deg,#fbfcfb,#f6f9f6)}.admin-section-title{display:flex;justify-content:space-between;align-items:flex-start;gap:18px}.admin-section-title h3{margin:4px 0 0;font-size:1.12rem}.admin-cover-rule{padding:6px 9px;border-radius:20px;background:#eef7f0;color:#268245;font-size:.61rem;font-weight:850;text-transform:uppercase;letter-spacing:.055em}.admin-cover-settings>p{max-width:750px;margin:14px 0 18px;color:var(--lw-muted);font-size:.76rem;line-height:1.6} +.admin-provider-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.admin-provider-option{position:relative;cursor:pointer}.admin-provider-option>input{position:absolute;opacity:0}.admin-provider-option>span{display:grid;grid-template-columns:35px 1fr;grid-template-rows:auto auto;column-gap:11px;min-height:82px;padding:14px;border:1px solid #dbe1dc;border-radius:13px;background:#fff;transition:.18s}.admin-provider-option b{grid-row:1/3;display:grid;place-items:center;width:35px;height:35px;border-radius:11px;background:#edf2ee;color:#717a72;font-size:.72rem}.admin-provider-option strong{font-size:.78rem}.admin-provider-option small{color:var(--lw-muted);font-size:.64rem}.admin-provider-option input:checked+span{border-color:#9bd3aa;background:#f7fff9;box-shadow:0 0 0 3px rgba(25,168,75,.07)}.admin-provider-option input:checked+span b{background:var(--lw-green);color:#fff}.admin-provider-option input:focus-visible+span{outline:3px solid rgba(25,168,75,.22)} +.admin-form-actions{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:20px 24px;border-top:1px solid var(--lw-line);background:#fff}.admin-form-actions>p{margin:0;color:var(--lw-muted);font-size:.69rem;line-height:1.45}.admin-form-actions>p[data-type="success"]{color:#16823b}.admin-form-actions>p[data-type="error"]{color:#b6382b}.admin-form-actions>p[data-type="warning"]{color:#956100}.admin-form-actions>p[data-type="loading"]{color:#3f6a49}.admin-form-actions>div{display:flex;gap:9px;flex:0 0 auto}.admin-button-primary,.admin-button-secondary{height:43px;padding:0 16px;border-radius:10px;font-size:.72rem;font-weight:850;cursor:pointer}.admin-button-primary{border:1px solid var(--lw-green);background:var(--lw-green);color:#fff}.admin-button-secondary{border:1px solid #ccd4cd;background:#fff;color:#273029}.admin-button-primary:hover{filter:brightness(.94)}.admin-button-secondary:hover{border-color:#9cb2a1;background:#f8fbf8}.admin-integration-form.is-busy{opacity:.75;pointer-events:none}.admin-button-primary:disabled,.admin-button-secondary:disabled{cursor:wait} +.admin-now-preview{overflow:hidden;position:sticky;top:102px}.admin-now-visual{position:relative;min-height:292px;display:grid;place-items:center;overflow:hidden;background:radial-gradient(circle at 50% 40%,#2a392c,#101611 68%)}.admin-now-visual:after{content:"";position:absolute;inset:auto 0 0;height:45%;background:linear-gradient(transparent,rgba(0,0,0,.62))}.admin-now-visual>img{position:relative;z-index:2;width:190px;height:190px;object-fit:cover;border-radius:17px;box-shadow:0 24px 50px rgba(0,0,0,.46);border:1px solid rgba(255,255,255,.15)}.admin-now-live{position:absolute;z-index:4;left:20px;bottom:18px;padding:7px 10px;border-radius:7px;background:var(--lw-green);color:#fff;font-size:.65rem;font-weight:900;letter-spacing:.08em}.admin-now-signal{position:absolute;right:-55px;top:15px;width:210px;height:210px;opacity:.24}.admin-now-signal i{position:absolute;inset:50%;border:3px solid #8ede45;border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;transform:translate(-50%,-50%) rotate(45deg)}.admin-now-signal i:nth-child(1){width:75px;height:75px}.admin-now-signal i:nth-child(2){width:130px;height:130px}.admin-now-signal i:nth-child(3){width:190px;height:190px} +.admin-now-copy{padding:23px}.admin-now-copy h2{margin:7px 0 2px;font-size:1.45rem;letter-spacing:-.035em}.admin-now-copy>strong{display:block;color:var(--lw-green-dark);font-size:.98rem}.admin-now-copy>p{margin:13px 0 18px;color:var(--lw-muted);font-size:.75rem;line-height:1.5}.admin-now-copy dl{display:grid;margin:0}.admin-now-copy dl>div{display:grid;grid-template-columns:92px 1fr;gap:10px;padding:9px 0;border-top:1px solid var(--lw-line);font-size:.7rem}.admin-now-copy dt{color:var(--lw-muted)}.admin-now-copy dd{margin:0;font-weight:780;overflow-wrap:anywhere}.admin-now-status{display:flex;align-items:center;gap:9px;margin-top:16px;padding:11px 12px;border-radius:11px;background:#edf9f0;color:#1d7b39;font-size:.69rem;font-weight:800}.admin-now-status i{width:8px;height:8px;border-radius:50%;background:#27bd58;box-shadow:0 0 0 5px rgba(39,189,88,.12)}.admin-now-status.is-error{background:#fff1ef;color:#a43a2f}.admin-now-status.is-error i{background:#dc5144;box-shadow:0 0 0 5px rgba(220,81,68,.12)} +@media(max-width:1180px){.admin-radio-grid{grid-template-columns:1fr}.admin-now-preview{position:static;display:grid;grid-template-columns:310px 1fr}.admin-now-visual{min-height:100%}} +@media(max-width:700px){.admin-field-grid,.admin-field-grid-small,.admin-provider-grid{grid-template-columns:1fr}.admin-field-wide{grid-column:auto}.admin-form-actions{align-items:stretch;flex-direction:column}.admin-form-actions>div{display:grid;grid-template-columns:1fr 1fr}.admin-now-preview{display:block}.admin-section-title{flex-direction:column}.admin-now-visual{min-height:260px}} +@media(max-width:480px){.admin-form-section{padding:19px 17px}.admin-form-actions{padding:17px}.admin-form-actions>div{grid-template-columns:1fr}.admin-switch-row{grid-template-columns:1fr 48px}.admin-now-visual>img{width:165px;height:165px}} +.admin-navigation a{display:flex;align-items:center;gap:12px;border:0;background:transparent;color:#cbd1ca;padding:12px 14px;border-radius:8px;font:inherit;text-decoration:none}.admin-navigation a i{width:22px;text-align:center}.admin-navigation a b{margin-left:auto;font-size:9px;background:#6d9e00;color:#fff;padding:3px 6px;border-radius:4px}.admin-navigation a.is-active,.admin-navigation a:hover{background:#20261f;color:#fff}.admin-program-layout{display:grid;grid-template-columns:minmax(420px,.85fr) minmax(520px,1.15fr);gap:22px}.admin-program-form,.admin-program-list{padding:0}.admin-program-form form{padding:24px}.admin-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:17px}.admin-form-grid label{display:grid;gap:7px}.admin-form-grid label>span{font-size:11px;text-transform:uppercase;font-weight:900;color:#657065}.admin-form-grid .is-wide{grid-column:1/-1}.admin-form-grid input,.admin-form-grid select,.admin-form-grid textarea{width:100%;border:1px solid #d9ded7;border-radius:8px;padding:11px 12px;background:#fff;color:#171b17}.admin-form-grid textarea{resize:vertical}.admin-check{display:flex!important;grid-template-columns:20px 1fr!important;align-items:center}.admin-check input{width:18px;height:18px}.admin-check span{text-transform:none!important;font-size:13px!important}.admin-form-actions{margin:22px -24px -24px;padding:18px 24px;border-top:1px solid #e6e9e4}.admin-primary-button{border:0;background:linear-gradient(#8fc915,#73a900);color:#fff;border-radius:8px;padding:12px 18px;font-weight:900}.admin-program-items{display:grid}.admin-program-items article{display:grid;grid-template-columns:54px minmax(0,1fr) auto auto auto;align-items:center;gap:12px;padding:13px 18px;border-top:1px solid #eaede8}.admin-program-items article.is-live{background:#f0f8e5}.admin-program-items img{width:48px;height:48px;border-radius:50%;object-fit:cover;object-position:center 35%}.admin-program-items small,.admin-program-items strong,.admin-program-items span{display:block}.admin-program-items small{font-size:10px;color:#718071}.admin-program-items strong{font-size:14px;margin:2px 0}.admin-program-items span{font-size:11px;color:#697169}.admin-program-items article>b{background:#7db500;color:#fff;border-radius:5px;padding:5px 7px;font-size:9px;text-transform:uppercase}.admin-program-items article>a{color:#679700;font-weight:800;font-size:11px}.admin-program-items form button{border:0;background:#f4e7e7;color:#9d3030;border-radius:6px;padding:7px 9px;font-weight:800}.admin-alert{border-radius:8px;padding:13px 16px;margin-bottom:18px;font-weight:800}.admin-alert.is-success{background:#ebf7df;color:#4c7600}.admin-alert.is-error{background:#faeaea;color:#9c2d2d}@media(max-width:1100px){.admin-program-layout{grid-template-columns:1fr}.admin-program-items article{grid-template-columns:54px minmax(0,1fr) auto auto}}@media(max-width:700px){.admin-form-grid{grid-template-columns:1fr}.admin-form-grid .is-wide{grid-column:auto}.admin-program-items article{grid-template-columns:48px 1fr}.admin-program-items article>b,.admin-program-items article>a,.admin-program-items article>form{grid-column:2}} diff --git a/web/assets/admin-v35.css b/web/assets/admin-v35.css new file mode 100644 index 0000000..8a52608 --- /dev/null +++ b/web/assets/admin-v35.css @@ -0,0 +1,149 @@ +:root{ + --lw-green:#18a84b; + --lw-green-dark:#087b34; + --lw-green-soft:#e9f8ee; + --lw-black:#090b09; + --lw-panel:#121512; + --lw-text:#151915; + --lw-muted:#6d746e; + --lw-line:#e4e8e4; + --lw-bg:#f4f6f4; + --lw-white:#fff; + --lw-shadow:0 18px 55px rgba(11,18,12,.12); + font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; + color-scheme:light; +} +*{box-sizing:border-box} +html,body{margin:0;min-height:100%;background:var(--lw-bg);color:var(--lw-text)} +body{font-size:16px} +button,input{font:inherit} +button,a{ -webkit-tap-highlight-color:transparent} +a{color:inherit;text-decoration:none} +.admin-kicker{display:block;color:var(--lw-green);font-size:.72rem;font-weight:850;letter-spacing:.13em;text-transform:uppercase} + +/* Login */ +.admin-login-page{background:#0a0d0a;min-height:100vh;overflow-x:hidden} +.admin-login-shell{display:grid;grid-template-columns:minmax(420px,1.04fr) minmax(430px,.96fr);min-height:100vh} +.admin-login-brand{position:relative;display:flex;flex-direction:column;justify-content:flex-start;overflow:hidden;padding:42px 5.5vw 64px;color:#fff;background: + linear-gradient(135deg,rgba(5,9,5,.95),rgba(7,19,10,.82)), + url('/assets/hero-poster.jpg') center/cover no-repeat} +.admin-login-brand:after{content:"";position:absolute;inset:auto -8% -20% 16%;height:52%;background:radial-gradient(circle at center,rgba(25,168,75,.33),transparent 65%);filter:blur(10px)} +.admin-login-brand>img{position:relative;z-index:2;width:min(310px,64%);height:auto;filter:drop-shadow(0 8px 24px rgba(0,0,0,.26))} +.admin-login-brand>p{position:relative;z-index:2;margin:2px 0 0 7px;color:#dce7dd;font-size:.76rem;letter-spacing:.11em;text-transform:uppercase} +.admin-login-message{position:relative;z-index:2;margin-top:auto;max-width:670px} +.admin-login-message>span{display:inline-flex;align-items:center;gap:9px;color:#7fe59f;font-weight:800;letter-spacing:.08em;text-transform:uppercase;font-size:.78rem} +.admin-login-message>span:before{content:"";width:24px;height:3px;border-radius:9px;background:var(--lw-green)} +.admin-login-message h1{margin:18px 0 20px;font-size:clamp(3rem,5.2vw,6.4rem);line-height:.91;letter-spacing:-.065em} +.admin-login-message p{max-width:520px;margin:0;color:#d1d9d2;font-size:1.08rem;line-height:1.65} +.admin-radio-waves{position:absolute;right:-110px;top:13%;width:450px;height:450px;opacity:.33} +.admin-radio-waves i{position:absolute;inset:50%;border:3px solid var(--lw-green);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;transform:translate(-50%,-50%) rotate(45deg)} +.admin-radio-waves i:nth-child(1){width:170px;height:170px}.admin-radio-waves i:nth-child(2){width:285px;height:285px}.admin-radio-waves i:nth-child(3){width:405px;height:405px} +.admin-login-panel{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:48px;background: + radial-gradient(circle at 100% 0,rgba(25,168,75,.12),transparent 29%),#f5f7f5} +.admin-login-card{width:min(520px,100%);background:#fff;border:1px solid rgba(20,40,25,.08);border-radius:28px;padding:50px;box-shadow:var(--lw-shadow)} +.admin-login-card h2{margin:10px 0 8px;font-size:2.15rem;letter-spacing:-.04em} +.admin-login-intro{margin:0 0 30px;color:var(--lw-muted);line-height:1.55} +.admin-alert{display:grid;gap:5px;margin:0 0 20px;padding:14px 16px;border-radius:13px;font-size:.9rem;line-height:1.45} +.admin-alert-error{background:#fff0ef;color:#a62a20;border:1px solid #ffd1cd} +.admin-alert-config{background:#fff8e5;color:#775800;border:1px solid #f5dda1} +.admin-alert code{font-size:.77rem;background:rgba(255,255,255,.55);padding:2px 5px;border-radius:5px} +.admin-login-form{display:grid;gap:18px} +.admin-login-form label>span{display:block;margin:0 0 8px;font-size:.83rem;font-weight:800;color:#343a35} +.admin-input-wrap{display:flex;align-items:center;gap:12px;height:55px;padding:0 16px;border:1px solid #dce3dd;border-radius:13px;background:#fbfcfb;transition:.2s} +.admin-input-wrap:focus-within{border-color:var(--lw-green);box-shadow:0 0 0 4px rgba(25,168,75,.11);background:#fff} +.admin-input-wrap b{color:var(--lw-green);font-size:.7rem} +.admin-input-wrap input{width:100%;border:0;outline:0;background:transparent;font-size:1rem;color:var(--lw-text)} +.admin-primary-button{display:flex;align-items:center;justify-content:space-between;height:57px;margin-top:5px;padding:0 22px;border:0;border-radius:14px;background:linear-gradient(135deg,var(--lw-green),#0d8d3d);color:#fff;font-weight:850;box-shadow:0 12px 25px rgba(17,150,62,.25);cursor:pointer;transition:.2s} +.admin-primary-button:hover{transform:translateY(-2px);box-shadow:0 16px 30px rgba(17,150,62,.31)} +.admin-primary-button:disabled{cursor:not-allowed;opacity:.45;transform:none} +.admin-primary-button i{font-size:1.3rem;font-style:normal} +.admin-login-security{display:flex;gap:12px;align-items:flex-start;margin-top:27px;padding-top:24px;border-top:1px solid var(--lw-line)} +.admin-login-security>span{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--lw-green-soft);color:var(--lw-green);font-weight:900} +.admin-login-security p{display:grid;gap:2px;margin:0}.admin-login-security small{color:var(--lw-muted);line-height:1.45} +.admin-login-footer{margin:22px 0 0;color:#879089;font-size:.75rem;text-align:center} + +/* Dashboard shell */ +.admin-dashboard-page{min-height:100vh;background:var(--lw-bg)} +.admin-layout{display:grid;grid-template-columns:265px minmax(0,1fr);min-height:100vh} +.admin-sidebar{position:sticky;top:0;display:flex;flex-direction:column;height:100vh;padding:25px 18px;background:linear-gradient(180deg,#090c09,#101510);color:#fff;z-index:20} +.admin-sidebar-brand{display:grid;justify-items:start;gap:4px;padding:0 13px 27px;border-bottom:1px solid rgba(255,255,255,.09)} +.admin-sidebar-brand img{width:176px;max-height:65px;object-fit:contain;object-position:left center} +.admin-sidebar-brand span{color:#87e5a4;font-size:.68rem;font-weight:850;letter-spacing:.2em;text-transform:uppercase} +.admin-navigation{display:grid;gap:7px;margin-top:26px} +.admin-navigation button{display:grid;grid-template-columns:28px 1fr auto;align-items:center;gap:9px;min-height:48px;padding:0 13px;border:0;border-radius:12px;background:transparent;color:#aeb9b0;text-align:left;cursor:pointer;transition:.18s} +.admin-navigation button:hover{background:rgba(255,255,255,.055);color:#fff} +.admin-navigation button.is-active{background:linear-gradient(90deg,rgba(25,168,75,.24),rgba(25,168,75,.08));color:#fff;box-shadow:inset 3px 0 var(--lw-green)} +.admin-navigation i{font-style:normal;color:#64d989;font-size:1.05rem;text-align:center} +.admin-navigation span{font-size:.88rem;font-weight:730} +.admin-navigation b{padding:3px 6px;border-radius:6px;background:rgba(255,255,255,.09);color:#839087;font-size:.55rem;letter-spacing:.06em;text-transform:uppercase} +.admin-sidebar-bottom{display:grid;gap:14px;margin-top:auto;padding:18px 12px 4px;border-top:1px solid rgba(255,255,255,.09)} +.admin-system-pill{display:flex;align-items:center;gap:9px;color:#c5cec6;font-size:.77rem}.admin-system-pill i{width:8px;height:8px;border-radius:50%;background:#37dd6e;box-shadow:0 0 0 5px rgba(55,221,110,.12)} +.admin-sidebar-bottom>a{display:flex;justify-content:space-between;color:#7f8a81;font-size:.76rem}.admin-sidebar-bottom>a:hover{color:#fff} +.admin-workspace{min-width:0} +.admin-topbar{position:sticky;top:0;z-index:15;display:flex;align-items:center;justify-content:space-between;height:79px;padding:0 38px;border-bottom:1px solid #e5e9e5;background:rgba(255,255,255,.94);backdrop-filter:blur(13px)} +.admin-topbar>div:first-of-type{display:grid;gap:1px}.admin-topbar>div:first-of-type span{color:var(--lw-muted);font-size:.7rem;letter-spacing:.08em;text-transform:uppercase}.admin-topbar>div:first-of-type strong{font-size:1.03rem} +.admin-user{display:flex;align-items:center;gap:11px}.admin-avatar{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:linear-gradient(135deg,var(--lw-green),#077832);color:#fff;font-weight:900;text-transform:uppercase}.admin-user>div{display:grid;gap:1px}.admin-user strong{font-size:.83rem}.admin-user small{color:var(--lw-muted);font-size:.68rem}.admin-user form{margin:0 0 0 8px}.admin-user button{width:36px;height:36px;border:1px solid var(--lw-line);border-radius:10px;background:#fff;color:#687069;cursor:pointer}.admin-user button:hover{border-color:#e1aaa5;color:#ae3025;background:#fff7f6} +.admin-mobile-menu{display:none;border:0;background:transparent;font-size:1.3rem} +.admin-content{padding:38px clamp(24px,3.3vw,56px) 70px} +.admin-view{display:none;max-width:1510px;margin:0 auto}.admin-view.is-active{display:block;animation:adminFade .2s ease}@keyframes adminFade{from{opacity:.25;transform:translateY(4px)}to{opacity:1;transform:none}} +.admin-page-heading{display:flex;justify-content:space-between;align-items:flex-end;gap:25px;margin-bottom:30px} +.admin-page-heading h1{margin:7px 0 6px;font-size:clamp(2rem,3vw,3.25rem);letter-spacing:-.055em;line-height:1}.admin-page-heading p{margin:0;color:var(--lw-muted);font-size:.98rem} +.admin-date{display:grid;gap:5px;padding:12px 16px;border:1px solid var(--lw-line);border-radius:12px;background:#fff;text-align:right}.admin-date span{color:var(--lw-muted);font-size:.65rem;text-transform:uppercase;letter-spacing:.08em}.admin-date strong{font-size:.82rem} +.admin-metric-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:22px} +.admin-metric{display:flex;align-items:center;gap:14px;min-height:115px;padding:20px;border:1px solid var(--lw-line);border-radius:17px;background:#fff;box-shadow:0 8px 25px rgba(15,25,16,.035)} +.metric-icon{display:grid;place-items:center;width:48px;height:48px;flex:0 0 48px;border-radius:15px;background:#edf1ed;color:#677168;font-size:1rem}.metric-icon.is-green{background:var(--lw-green-soft);color:var(--lw-green);box-shadow:inset 0 0 0 1px #d0f0d9} +.admin-metric>div{display:grid;gap:3px;min-width:0}.admin-metric small{color:var(--lw-muted);font-size:.68rem;text-transform:uppercase;letter-spacing:.05em}.admin-metric strong{font-size:1.05rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.admin-metric em{color:#8d948e;font-size:.69rem;font-style:normal} +.admin-dashboard-grid{display:grid;grid-template-columns:minmax(0,1.38fr) minmax(320px,.82fr);gap:22px} +.admin-card{border:1px solid var(--lw-line);border-radius:19px;background:#fff;box-shadow:0 11px 30px rgba(16,28,17,.045)} +.admin-card-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:22px 24px 15px}.admin-card-heading h2{margin:5px 0 0;font-size:1.18rem;letter-spacing:-.025em} +.admin-live-card{overflow:hidden;background:linear-gradient(135deg,#0b0f0b,#172017);color:#fff;border-color:#1a241b}.admin-live-card .admin-card-heading{border-bottom:1px solid rgba(255,255,255,.08)} +.admin-live-label{display:flex;align-items:center;gap:7px;padding:6px 10px;border-radius:20px;background:rgba(25,168,75,.16);color:#78e79a;font-size:.66rem;font-weight:850;text-transform:uppercase;letter-spacing:.08em}.admin-live-label i{width:7px;height:7px;border-radius:50%;background:#38e875;box-shadow:0 0 0 5px rgba(56,232,117,.12)} +.admin-live-body{display:flex;align-items:center;gap:19px;padding:25px}.admin-live-body>button{display:grid;place-items:center;width:64px;height:64px;flex:0 0 64px;border:0;border-radius:50%;background:var(--lw-green);color:#fff;font-size:1.2rem;cursor:pointer;box-shadow:0 12px 28px rgba(25,168,75,.26)}.admin-live-body>button.is-playing{background:#fff;color:var(--lw-green)} +.admin-live-body>div{display:grid;gap:4px;min-width:0}.admin-live-body small{color:#7e8c80;font-size:.68rem;text-transform:uppercase;letter-spacing:.06em}.admin-live-body strong{font-size:.85rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.admin-live-body span{color:#6de590;font-size:.74rem} +.admin-weather-overview{padding-bottom:18px}.admin-icon-button{width:36px;height:36px;border:1px solid var(--lw-line);border-radius:10px;background:#fff;color:var(--lw-green);font-size:1.1rem;cursor:pointer}.admin-icon-button.is-loading{animation:adminSpin .8s linear infinite}@keyframes adminSpin{to{transform:rotate(360deg)}} +.admin-weather-main{display:grid;grid-template-columns:62px 68px 1fr;align-items:center;gap:7px;padding:7px 24px 15px}.admin-weather-main>span{font-size:2.7rem}.admin-weather-main>strong{font-size:2.6rem;letter-spacing:-.07em}.admin-weather-main>div{display:grid}.admin-weather-main b{font-size:.85rem;text-transform:capitalize}.admin-weather-main small{margin-top:3px;color:var(--lw-muted);font-size:.72rem} +.admin-weather-facts{display:flex;justify-content:space-between;gap:10px;margin:0 24px;padding:13px 0;border-top:1px solid var(--lw-line);border-bottom:1px solid var(--lw-line);color:#697069;font-size:.7rem}.admin-source{display:block;margin:11px 24px 0;color:#9aa09b;font-size:.6rem}.admin-weather-error{margin:15px 24px;padding:18px;border-radius:12px;background:#fff5ec;color:#8b5013;font-size:.82rem} +.admin-activity-card,.admin-quick-card{min-height:315px} +.admin-progress-list{display:grid;gap:18px;padding:9px 24px 25px}.admin-progress-list>div{display:grid;grid-template-columns:64px 1fr auto;align-items:center;gap:14px}.admin-progress-list>div>span{position:relative;display:block;height:7px;border-radius:9px;background:#edf0ed;overflow:hidden}.admin-progress-list>div>span i{position:absolute;inset:0 auto 0 0;width:var(--progress);border-radius:inherit;background:linear-gradient(90deg,var(--lw-green),#54d679)}.admin-progress-list p{display:grid;gap:2px;margin:0}.admin-progress-list strong{font-size:.8rem}.admin-progress-list small{color:var(--lw-muted);font-size:.67rem}.admin-progress-list b{color:var(--lw-green-dark);font-size:.72rem} +.admin-quick-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:8px 22px 24px}.admin-quick-grid button,.admin-quick-grid a{display:grid;grid-template-columns:36px 1fr;grid-template-rows:auto auto;column-gap:11px;align-items:center;min-height:94px;padding:14px;border:1px solid var(--lw-line);border-radius:13px;background:#fbfcfb;text-align:left;cursor:pointer}.admin-quick-grid i{grid-row:1/3;display:grid;place-items:center;width:36px;height:36px;border-radius:11px;background:var(--lw-green-soft);color:var(--lw-green);font-style:normal;font-weight:900}.admin-quick-grid strong{font-size:.78rem}.admin-quick-grid span{color:var(--lw-muted);font-size:.63rem}.admin-quick-grid button:hover,.admin-quick-grid a:hover{border-color:#b9dfc3;background:#f7fff9} +.admin-empty-state{display:grid;justify-items:center;max-width:720px;margin:70px auto;padding:55px;text-align:center;border:1px dashed #bdc8be;border-radius:24px;background:#fff}.admin-empty-state>span{display:grid;place-items:center;width:70px;height:70px;border-radius:21px;background:var(--lw-green-soft);color:var(--lw-green);font-size:1.6rem}.admin-empty-state h2{margin:22px 0 8px;font-size:1.55rem}.admin-empty-state p{max-width:570px;margin:0;color:var(--lw-muted);line-height:1.65}.admin-empty-state button{margin-top:22px;padding:11px 17px;border:0;border-radius:10px;background:var(--lw-black);color:#fff;font-weight:750;cursor:pointer} +.admin-feature-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}.admin-feature-grid article{display:grid;align-content:start;min-height:260px;padding:27px;border:1px solid var(--lw-line);border-radius:19px;background:#fff}.admin-feature-grid i{display:grid;place-items:center;width:48px;height:48px;border-radius:14px;background:var(--lw-green-soft);color:var(--lw-green);font-size:1.2rem;font-style:normal}.admin-feature-grid h2{margin:22px 0 8px;font-size:1.08rem}.admin-feature-grid p{margin:0;color:var(--lw-muted);line-height:1.58;font-size:.87rem}.admin-feature-grid span{margin-top:auto;padding-top:23px;color:var(--lw-green-dark);font-size:.68rem;font-weight:850;text-transform:uppercase;letter-spacing:.07em} +.admin-settings-card{padding:25px}.admin-settings-card>.admin-card-heading{padding:0 0 19px}.admin-settings-card h2{margin:0 0 18px}.admin-settings-card dl{display:grid;gap:0;margin:0}.admin-settings-card dl>div{display:grid;grid-template-columns:minmax(140px,.55fr) 1fr;gap:20px;padding:13px 0;border-bottom:1px solid var(--lw-line)}.admin-settings-card dt{color:var(--lw-muted);font-size:.76rem}.admin-settings-card dd{margin:0;font-size:.77rem;font-weight:750;overflow-wrap:anywhere}.admin-settings-card>p{margin:20px 0 0;color:var(--lw-muted);line-height:1.55;font-size:.79rem}.admin-status-green{color:var(--lw-green);font-weight:850}.admin-settings-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px} +.admin-push-preview{display:grid;grid-template-columns:1fr .75fr;gap:0;overflow:hidden;min-height:430px;border-radius:24px;background:linear-gradient(135deg,#0a0e0a,#172317);color:#fff;box-shadow:var(--lw-shadow)}.admin-push-preview>div:first-child{display:flex;flex-direction:column;justify-content:center;padding:55px}.admin-push-preview>div:first-child>span{color:#79e79b;text-transform:uppercase;letter-spacing:.1em;font-size:.73rem;font-weight:850}.admin-push-preview h2{margin:14px 0 10px;font-size:2.5rem;letter-spacing:-.05em}.admin-push-preview p{max-width:520px;color:#c0cbc2;line-height:1.6}.admin-push-preview button{align-self:flex-start;margin-top:18px;padding:12px 18px;border:0;border-radius:11px;background:#3c443d;color:#89928a}.admin-phone-preview{align-self:center;justify-self:center;width:250px;height:320px;padding:28px 19px;border:8px solid #222922;border-radius:36px;background:#f6f8f6;color:#151915;box-shadow:0 35px 60px rgba(0,0,0,.35)}.admin-phone-preview>span{display:block;color:var(--lw-green);font-size:.68rem;font-weight:900;text-transform:uppercase}.admin-phone-preview strong{display:block;margin:80px 0 8px;font-size:1.05rem}.admin-phone-preview p{color:#687069;font-size:.78rem} + +@media (min-width:1500px){.admin-layout{grid-template-columns:290px minmax(0,1fr)}.admin-sidebar{padding-inline:22px}.admin-content{padding-top:46px}.admin-metric{min-height:128px}.admin-dashboard-grid{grid-template-columns:minmax(0,1.45fr) minmax(360px,.8fr)}} +@media (max-width:1120px){.admin-metric-grid{grid-template-columns:1fr 1fr}.admin-feature-grid,.admin-settings-grid{grid-template-columns:1fr 1fr}.admin-dashboard-grid{grid-template-columns:1fr}.admin-login-shell{grid-template-columns:.9fr 1.1fr}.admin-login-brand{padding-inline:4vw}.admin-login-message h1{font-size:4.2rem}.admin-login-card{padding:38px}} +@media (max-width:820px){.admin-login-shell{display:block}.admin-login-brand{min-height:320px;padding:27px 28px 35px}.admin-login-brand>img{width:220px}.admin-login-brand>p{font-size:.62rem}.admin-login-message{margin-top:70px}.admin-login-message h1{font-size:3rem}.admin-login-message p{display:none}.admin-login-panel{padding:25px 16px 40px}.admin-login-card{margin-top:-20px;padding:29px 24px;border-radius:22px;position:relative;z-index:4}.admin-layout{display:block}.admin-sidebar{position:fixed;left:-285px;width:265px;transition:.23s}.admin-sidebar.is-open{left:0;box-shadow:30px 0 70px rgba(0,0,0,.3)}.admin-topbar{height:70px;padding:0 18px}.admin-mobile-menu{display:block}.admin-topbar>div:first-of-type{display:none}.admin-content{padding:26px 17px 50px}.admin-page-heading{align-items:flex-start;flex-direction:column}.admin-date{text-align:left}.admin-metric-grid,.admin-feature-grid,.admin-settings-grid{grid-template-columns:1fr}.admin-push-preview{grid-template-columns:1fr}.admin-phone-preview{display:none}} +@media (max-width:520px){.admin-login-message h1{font-size:2.55rem}.admin-login-card h2{font-size:1.75rem}.admin-user>div{display:none}.admin-metric-grid{grid-template-columns:1fr}.admin-dashboard-grid{gap:15px}.admin-card-heading{padding-inline:18px}.admin-live-body{padding:20px 18px}.admin-weather-main{padding-inline:18px}.admin-weather-facts{margin-inline:18px}.admin-progress-list{padding-inline:18px}.admin-quick-grid{grid-template-columns:1fr;padding-inline:18px}.admin-feature-grid article{min-height:220px}.admin-settings-card dl>div{grid-template-columns:1fr;gap:5px}.admin-push-preview>div:first-child{padding:35px 25px}.admin-push-preview h2{font-size:2rem}} + +/* v11 – AzuraCast-Integration und externe Cover-Verwaltung */ +.admin-integration-badge{display:grid;grid-template-columns:10px auto;column-gap:9px;align-items:center;padding:12px 15px;border:1px solid var(--lw-line);border-radius:14px;background:#fff;box-shadow:0 8px 22px rgba(15,28,16,.04)} +.admin-integration-badge i{grid-row:1/3;width:9px;height:9px;border-radius:50%;background:var(--lw-green);box-shadow:0 0 0 6px rgba(25,168,75,.12)} +.admin-integration-badge span{color:var(--lw-muted);font-size:.62rem;text-transform:uppercase;letter-spacing:.08em}.admin-integration-badge strong{font-size:.74rem} +.admin-radio-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(310px,.72fr);gap:22px;align-items:start} +.admin-azuracast-card{overflow:hidden}.admin-integration-form{display:grid}.admin-form-section{padding:24px;border-top:1px solid var(--lw-line)} +.admin-switch-row{display:grid;grid-template-columns:1fr 48px;align-items:center;gap:20px;margin-bottom:22px;cursor:pointer}.admin-switch-row>span{display:grid;gap:4px}.admin-switch-row strong{font-size:.9rem}.admin-switch-row small{color:var(--lw-muted);font-size:.72rem;line-height:1.5}.admin-switch-row input{position:absolute;opacity:0;pointer-events:none}.admin-switch-row>i{position:relative;width:48px;height:27px;border-radius:18px;background:#cbd1cc;transition:.2s}.admin-switch-row>i:after{content:"";position:absolute;left:4px;top:4px;width:19px;height:19px;border-radius:50%;background:#fff;box-shadow:0 2px 6px rgba(0,0,0,.2);transition:.2s}.admin-switch-row input:checked+i{background:var(--lw-green)}.admin-switch-row input:checked+i:after{transform:translateX(21px)}.admin-switch-row input:focus-visible+i{outline:3px solid rgba(25,168,75,.25);outline-offset:3px} +.admin-field-grid{display:grid;grid-template-columns:1.4fr .8fr;gap:16px}.admin-field-grid-small{grid-template-columns:1fr 1fr;max-width:520px;margin-top:18px}.admin-field-wide{grid-column:1/-1}.admin-field{display:grid;gap:7px}.admin-field>span{font-size:.69rem;font-weight:820;text-transform:uppercase;letter-spacing:.055em;color:#4d564e}.admin-field input{width:100%;height:45px;border:1px solid #d9dfda;border-radius:11px;background:#fbfcfb;padding:0 13px;color:#121713;outline:none}.admin-field input:focus{border-color:var(--lw-green);box-shadow:0 0 0 3px rgba(25,168,75,.1);background:#fff}.admin-field small{color:var(--lw-muted);font-size:.64rem}.admin-field code{font-size:inherit} +.admin-check-row{display:flex;align-items:flex-start;gap:11px;margin-top:18px;padding:14px;border:1px solid #e1e6e2;border-radius:12px;background:#f9fbf9;cursor:pointer}.admin-check-row input{margin-top:3px;accent-color:var(--lw-green)}.admin-check-row span{display:grid;gap:3px}.admin-check-row strong{font-size:.77rem}.admin-check-row small{color:var(--lw-muted);font-size:.67rem;line-height:1.45} +.admin-endpoint-preview{display:grid;gap:6px;margin-top:16px;padding:13px 15px;border-radius:11px;background:#0e140f;color:#dce5dd}.admin-endpoint-preview span{color:#7f9182;font-size:.61rem;text-transform:uppercase;letter-spacing:.08em}.admin-endpoint-preview code{overflow-wrap:anywhere;color:#8be5a4;font-size:.72rem} +.admin-cover-settings{background:linear-gradient(180deg,#fbfcfb,#f6f9f6)}.admin-section-title{display:flex;justify-content:space-between;align-items:flex-start;gap:18px}.admin-section-title h3{margin:4px 0 0;font-size:1.12rem}.admin-cover-rule{padding:6px 9px;border-radius:20px;background:#eef7f0;color:#268245;font-size:.61rem;font-weight:850;text-transform:uppercase;letter-spacing:.055em}.admin-cover-settings>p{max-width:750px;margin:14px 0 18px;color:var(--lw-muted);font-size:.76rem;line-height:1.6} +.admin-provider-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.admin-provider-option{position:relative;cursor:pointer}.admin-provider-option>input{position:absolute;opacity:0}.admin-provider-option>span{display:grid;grid-template-columns:35px 1fr;grid-template-rows:auto auto;column-gap:11px;min-height:82px;padding:14px;border:1px solid #dbe1dc;border-radius:13px;background:#fff;transition:.18s}.admin-provider-option b{grid-row:1/3;display:grid;place-items:center;width:35px;height:35px;border-radius:11px;background:#edf2ee;color:#717a72;font-size:.72rem}.admin-provider-option strong{font-size:.78rem}.admin-provider-option small{color:var(--lw-muted);font-size:.64rem}.admin-provider-option input:checked+span{border-color:#9bd3aa;background:#f7fff9;box-shadow:0 0 0 3px rgba(25,168,75,.07)}.admin-provider-option input:checked+span b{background:var(--lw-green);color:#fff}.admin-provider-option input:focus-visible+span{outline:3px solid rgba(25,168,75,.22)} +.admin-form-actions{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:20px 24px;border-top:1px solid var(--lw-line);background:#fff}.admin-form-actions>p{margin:0;color:var(--lw-muted);font-size:.69rem;line-height:1.45}.admin-form-actions>p[data-type="success"]{color:#16823b}.admin-form-actions>p[data-type="error"]{color:#b6382b}.admin-form-actions>p[data-type="warning"]{color:#956100}.admin-form-actions>p[data-type="loading"]{color:#3f6a49}.admin-form-actions>div{display:flex;gap:9px;flex:0 0 auto}.admin-button-primary,.admin-button-secondary{height:43px;padding:0 16px;border-radius:10px;font-size:.72rem;font-weight:850;cursor:pointer}.admin-button-primary{border:1px solid var(--lw-green);background:var(--lw-green);color:#fff}.admin-button-secondary{border:1px solid #ccd4cd;background:#fff;color:#273029}.admin-button-primary:hover{filter:brightness(.94)}.admin-button-secondary:hover{border-color:#9cb2a1;background:#f8fbf8}.admin-integration-form.is-busy{opacity:.75;pointer-events:none}.admin-button-primary:disabled,.admin-button-secondary:disabled{cursor:wait} +.admin-now-preview{overflow:hidden;position:sticky;top:102px}.admin-now-visual{position:relative;min-height:292px;display:grid;place-items:center;overflow:hidden;background:radial-gradient(circle at 50% 40%,#2a392c,#101611 68%)}.admin-now-visual:after{content:"";position:absolute;inset:auto 0 0;height:45%;background:linear-gradient(transparent,rgba(0,0,0,.62))}.admin-now-visual>img{position:relative;z-index:2;width:190px;height:190px;object-fit:cover;border-radius:17px;box-shadow:0 24px 50px rgba(0,0,0,.46);border:1px solid rgba(255,255,255,.15)}.admin-now-live{position:absolute;z-index:4;left:20px;bottom:18px;padding:7px 10px;border-radius:7px;background:var(--lw-green);color:#fff;font-size:.65rem;font-weight:900;letter-spacing:.08em}.admin-now-signal{position:absolute;right:-55px;top:15px;width:210px;height:210px;opacity:.24}.admin-now-signal i{position:absolute;inset:50%;border:3px solid #8ede45;border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;transform:translate(-50%,-50%) rotate(45deg)}.admin-now-signal i:nth-child(1){width:75px;height:75px}.admin-now-signal i:nth-child(2){width:130px;height:130px}.admin-now-signal i:nth-child(3){width:190px;height:190px} +.admin-now-copy{padding:23px}.admin-now-copy h2{margin:7px 0 2px;font-size:1.45rem;letter-spacing:-.035em}.admin-now-copy>strong{display:block;color:var(--lw-green-dark);font-size:.98rem}.admin-now-copy>p{margin:13px 0 18px;color:var(--lw-muted);font-size:.75rem;line-height:1.5}.admin-now-copy dl{display:grid;margin:0}.admin-now-copy dl>div{display:grid;grid-template-columns:92px 1fr;gap:10px;padding:9px 0;border-top:1px solid var(--lw-line);font-size:.7rem}.admin-now-copy dt{color:var(--lw-muted)}.admin-now-copy dd{margin:0;font-weight:780;overflow-wrap:anywhere}.admin-now-status{display:flex;align-items:center;gap:9px;margin-top:16px;padding:11px 12px;border-radius:11px;background:#edf9f0;color:#1d7b39;font-size:.69rem;font-weight:800}.admin-now-status i{width:8px;height:8px;border-radius:50%;background:#27bd58;box-shadow:0 0 0 5px rgba(39,189,88,.12)}.admin-now-status.is-error{background:#fff1ef;color:#a43a2f}.admin-now-status.is-error i{background:#dc5144;box-shadow:0 0 0 5px rgba(220,81,68,.12)} +@media(max-width:1180px){.admin-radio-grid{grid-template-columns:1fr}.admin-now-preview{position:static;display:grid;grid-template-columns:310px 1fr}.admin-now-visual{min-height:100%}} +@media(max-width:700px){.admin-field-grid,.admin-field-grid-small,.admin-provider-grid{grid-template-columns:1fr}.admin-field-wide{grid-column:auto}.admin-form-actions{align-items:stretch;flex-direction:column}.admin-form-actions>div{display:grid;grid-template-columns:1fr 1fr}.admin-now-preview{display:block}.admin-section-title{flex-direction:column}.admin-now-visual{min-height:260px}} +@media(max-width:480px){.admin-form-section{padding:19px 17px}.admin-form-actions{padding:17px}.admin-form-actions>div{grid-template-columns:1fr}.admin-switch-row{grid-template-columns:1fr 48px}.admin-now-visual>img{width:165px;height:165px}} +.admin-navigation a{display:flex;align-items:center;gap:12px;border:0;background:transparent;color:#cbd1ca;padding:12px 14px;border-radius:8px;font:inherit;text-decoration:none}.admin-navigation a i{width:22px;text-align:center}.admin-navigation a b{margin-left:auto;font-size:9px;background:#6d9e00;color:#fff;padding:3px 6px;border-radius:4px}.admin-navigation a.is-active,.admin-navigation a:hover{background:#20261f;color:#fff}.admin-program-layout{display:grid;grid-template-columns:minmax(420px,.85fr) minmax(520px,1.15fr);gap:22px}.admin-program-form,.admin-program-list{padding:0}.admin-program-form form{padding:24px}.admin-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:17px}.admin-form-grid label{display:grid;gap:7px}.admin-form-grid label>span{font-size:11px;text-transform:uppercase;font-weight:900;color:#657065}.admin-form-grid .is-wide{grid-column:1/-1}.admin-form-grid input,.admin-form-grid select,.admin-form-grid textarea{width:100%;border:1px solid #d9ded7;border-radius:8px;padding:11px 12px;background:#fff;color:#171b17}.admin-form-grid textarea{resize:vertical}.admin-check{display:flex!important;grid-template-columns:20px 1fr!important;align-items:center}.admin-check input{width:18px;height:18px}.admin-check span{text-transform:none!important;font-size:13px!important}.admin-form-actions{margin:22px -24px -24px;padding:18px 24px;border-top:1px solid #e6e9e4}.admin-primary-button{border:0;background:linear-gradient(#8fc915,#73a900);color:#fff;border-radius:8px;padding:12px 18px;font-weight:900}.admin-program-items{display:grid}.admin-program-items article{display:grid;grid-template-columns:54px minmax(0,1fr) auto auto auto;align-items:center;gap:12px;padding:13px 18px;border-top:1px solid #eaede8}.admin-program-items article.is-live{background:#f0f8e5}.admin-program-items img{width:48px;height:48px;border-radius:50%;object-fit:cover;object-position:center 35%}.admin-program-items small,.admin-program-items strong,.admin-program-items span{display:block}.admin-program-items small{font-size:10px;color:#718071}.admin-program-items strong{font-size:14px;margin:2px 0}.admin-program-items span{font-size:11px;color:#697169}.admin-program-items article>b{background:#7db500;color:#fff;border-radius:5px;padding:5px 7px;font-size:9px;text-transform:uppercase}.admin-program-items article>a{color:#679700;font-weight:800;font-size:11px}.admin-program-items form button{border:0;background:#f4e7e7;color:#9d3030;border-radius:6px;padding:7px 9px;font-weight:800}.admin-alert{border-radius:8px;padding:13px 16px;margin-bottom:18px;font-weight:800}.admin-alert.is-success{background:#ebf7df;color:#4c7600}.admin-alert.is-error{background:#faeaea;color:#9c2d2d}@media(max-width:1100px){.admin-program-layout{grid-template-columns:1fr}.admin-program-items article{grid-template-columns:54px minmax(0,1fr) auto auto}}@media(max-width:700px){.admin-form-grid{grid-template-columns:1fr}.admin-form-grid .is-wide{grid-column:auto}.admin-program-items article{grid-template-columns:48px 1fr}.admin-program-items article>b,.admin-program-items article>a,.admin-program-items article>form{grid-column:2}} +.ai-settings-grid,.ai-studio-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}.ai-provider-card{align-self:start}.admin-switch{display:flex;align-items:center;gap:8px;font-weight:800}.admin-switch input{width:20px;height:20px}.voice-settings{margin-top:24px}.voice-row{display:grid;grid-template-columns:1fr 1.4fr 1fr auto;gap:10px;margin-bottom:10px}.voice-row input{min-width:0}.voice-row button{border:0;border-radius:8px;background:#351818;color:#fff;font-size:22px;padding:0 14px}.admin-secondary-button{display:inline-flex;align-items:center;justify-content:center;border:1px solid #526052;background:#161b17;color:#eef5ec;border-radius:9px;padding:12px 16px;font-weight:800;text-decoration:none}.security-note{margin-top:22px}.security-note code{color:#b9ec6a}.integration-state{padding:7px 11px;border-radius:999px;background:#3a2424;color:#ffb1b1;font-size:12px;font-weight:900;text-transform:uppercase}.integration-state.is-on{background:#21351d;color:#b9ec6a}.ai-result,.ai-audio-result{margin-top:22px;padding-top:20px;border-top:1px solid rgba(255,255,255,.08)}.ai-result textarea{width:100%;margin-top:10px}.ai-audio-result{display:grid;gap:14px}.ai-audio-result audio{width:100%}@media(max-width:1000px){.ai-settings-grid,.ai-studio-grid{grid-template-columns:1fr}}@media(max-width:700px){.voice-row{grid-template-columns:1fr}.voice-row button{min-height:42px}} +.wish-admin-list{display:grid;gap:18px}.wish-admin-item blockquote{margin:16px 0;padding:16px 18px;border-left:4px solid #7eb72f;background:rgba(126,183,47,.08);border-radius:8px}.wish-admin-item form{margin-top:18px}.wish-admin-item .admin-primary-button{margin-top:14px} +.template-admin-grid{display:grid;grid-template-columns:340px minmax(0,1fr);gap:22px}.template-list{display:grid;gap:10px}.template-list-item{display:grid;grid-template-columns:1fr auto;gap:4px 12px;padding:15px;border:1px solid #dfe5dd;border-radius:12px;color:#263026;text-decoration:none}.template-list-item span{font-size:12px;color:#788078}.template-list-item b{grid-row:1/3;grid-column:2;align-self:center;color:#70a900}.template-list-item.is-active{border-color:#78b82a;background:#f2f8e9}.template-token-note{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:18px 0}.template-token-note strong{width:100%}.template-token-note code{background:#eef4e8;padding:6px 9px;border-radius:7px}.wish-toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.wish-toolbar div{display:flex;gap:14px;align-items:center}.wish-toolbar span{color:#6f776f}.wish-toolbar select{padding:8px 12px;border-radius:8px}.wish-actions{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-top:18px}.wish-actions select{padding:11px;border:1px solid #d8ded5;border-radius:8px}.admin-danger-button{border:0;border-radius:8px;padding:11px 16px;background:#9b2f2f;color:#fff;font-weight:800}.generated-preview{margin-top:16px;padding:16px;border-left:4px solid #78b82a;background:#f3f8ed;border-radius:9px}.generated-preview span{font-size:11px;text-transform:uppercase;font-weight:900;color:#689f18}.generated-preview p{margin:8px 0 0}.audio-result{margin-top:12px;padding:12px 15px;background:#edf4e8;border-radius:9px}.status-badge{display:inline-flex;padding:5px 10px;border-radius:999px;text-transform:uppercase;font-size:10px;font-weight:900}.status-pending{background:#fff3cc;color:#8d6800}.status-approved{background:#e8f5d9;color:#558800}.status-rejected{background:#fae1e1;color:#a12e2e}.status-archived{background:#ecefec;color:#626962}.admin-pagination{display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin-top:24px}.admin-pagination a{padding:9px 13px;border:1px solid #d8ded5;border-radius:8px;color:#394239;text-decoration:none}.admin-pagination a.is-active{background:#75b82a;color:#fff;border-color:#75b82a}@media(max-width:900px){.template-admin-grid{grid-template-columns:1fr}.wish-toolbar{align-items:flex-start;flex-direction:column}} +.admin-media-upload,.admin-media-library{margin-bottom:24px}.admin-dropzone{display:flex;min-height:220px;margin:0 24px 24px;border:2px dashed #b7c8ad;border-radius:22px;background:linear-gradient(145deg,#f7faf4,#eef5e8);align-items:center;justify-content:center;flex-direction:column;text-align:center;cursor:pointer;transition:.2s}.admin-dropzone.is-dragging{border-color:var(--lw-green);background:#eaf5df;transform:scale(1.005)}.admin-dropzone input{position:absolute;opacity:0;pointer-events:none}.admin-drop-icon{font-size:2.8rem;color:var(--lw-green)}.admin-dropzone strong{font-size:1.2rem;margin-top:8px}.admin-dropzone small,.admin-dropzone em{color:#687269;margin-top:5px}.admin-dropzone em{font-style:normal;font-weight:750}.admin-media-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px;padding:0 24px 25px}.admin-media-card{overflow:hidden;border:1px solid #dfe6db;border-radius:18px;background:#fff}.admin-media-preview{aspect-ratio:4/3;background:#e8ece6}.admin-media-preview img{width:100%;height:100%;object-fit:cover}.admin-media-info{padding:15px}.admin-media-info strong,.admin-media-info small,.admin-media-info p,.admin-media-info code{display:block}.admin-media-info small{margin-top:5px;color:#778078}.admin-media-info p{min-height:38px;color:#555f57}.admin-media-info code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:#f1f4ef;padding:7px;border-radius:7px}.admin-danger-button{margin-top:12px;border:0;background:#f8e7e7;color:#a22;padding:9px 12px;border-radius:9px;font-weight:800}.admin-media-picker{border:1px solid #dfe6db;border-radius:18px;padding:17px}.admin-media-picker legend{font-weight:850;padding:0 7px}.admin-media-picker-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:11px}.admin-media-choice{display:flex;position:relative;min-height:115px;border:2px solid transparent;border-radius:13px;overflow:hidden;background:#edf1eb;cursor:pointer;align-items:flex-end}.admin-media-choice input{position:absolute;top:9px;left:9px;z-index:2}.admin-media-choice img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.admin-media-choice span{position:relative;z-index:1;width:100%;padding:25px 8px 8px;background:linear-gradient(transparent,rgba(0,0,0,.75));color:#fff;font-size:.72rem;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.admin-media-choice:has(input:checked){border-color:var(--lw-green);box-shadow:0 0 0 3px rgba(110,166,0,.17)}.admin-media-choice.is-empty{align-items:center;justify-content:center;background:#f5f7f3}.admin-media-choice.is-empty span{width:auto;padding:0;background:none;color:#4b544c}.admin-inline-link{display:inline-block;margin-top:13px;color:var(--lw-green);font-weight:850}.admin-distribution{display:grid;gap:10px;padding:18px;border-radius:18px;background:#f2f6ee;border:1px solid #dfe8d9}.admin-distribution .admin-check{margin:0}.admin-distribution .admin-check span{display:flex;flex-direction:column}.admin-distribution .admin-check small{font-weight:500;color:#687269}.admin-editorial-thumb{width:72px;height:58px;border-radius:10px;object-fit:cover}.admin-program-items article:has(.admin-editorial-thumb){grid-template-columns:72px minmax(0,1fr) auto auto}.admin-form-grid label small{display:block;margin-top:5px;color:#778078;font-weight:500} +@media(max-width:1100px){.admin-media-grid,.admin-media-picker-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:650px){.admin-media-grid,.admin-media-picker-grid{grid-template-columns:1fr}.admin-program-items article:has(.admin-editorial-thumb){grid-template-columns:1fr}.admin-editorial-thumb{width:100%;height:150px}} + +/* v36: gruppierte Adminnavigation */ +.admin-navigation-v36{display:grid;gap:8px;padding:8px 12px}.admin-navigation-v36>a,.admin-navigation-v36 summary{display:flex;align-items:center;gap:11px;padding:11px 13px;border-radius:10px;color:#dce4dc;text-decoration:none;cursor:pointer;list-style:none;font-weight:800}.admin-navigation-v36 summary::-webkit-details-marker{display:none}.admin-navigation-v36 details{border:1px solid rgba(255,255,255,.05);border-radius:12px;background:rgba(255,255,255,.02)}.admin-navigation-v36 details[open]{background:rgba(117,184,42,.06);border-color:rgba(117,184,42,.17)}.admin-navigation-v36 summary b{margin-left:auto;transition:.2s}.admin-navigation-v36 details[open] summary b{transform:rotate(180deg)}.admin-navigation-v36 details>div{display:grid;padding:0 10px 10px 42px;gap:3px}.admin-navigation-v36 details>div a{padding:8px 10px;border-radius:8px;color:#aeb8ae;text-decoration:none;font-size:13px}.admin-navigation-v36 details>div a:hover,.admin-navigation-v36>a:hover{background:rgba(117,184,42,.13);color:#fff}.admin-nav-home{background:linear-gradient(135deg,rgba(117,184,42,.22),rgba(117,184,42,.08))}.admin-license-box{margin-top:24px}.admin-license-box textarea{width:100%;min-height:220px;resize:vertical;background:#0e120f;color:#cbd5cb;border:1px solid rgba(117,184,42,.28);border-radius:12px;padding:16px;font:12px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace}.settings-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:20px}.settings-tabs button{border:1px solid #dce3d8;background:#fff;border-radius:999px;padding:10px 15px;font-weight:850}.settings-tabs button.is-active{background:#75b82a;color:#fff;border-color:#75b82a}.settings-panel{display:none}.settings-panel.is-active{display:grid}.integration-note{padding:15px 17px;border-radius:12px;background:#f4f7f1;border-left:4px solid #75b82a;color:#4e594e} +.admin-status-dashboard{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}.status-dl{margin:12px 0 0;display:grid;gap:0}.status-dl div{display:flex;justify-content:space-between;gap:18px;padding:11px 0;border-bottom:1px solid rgba(255,255,255,.08)}.status-dl dt{color:#8e9990}.status-dl dd{margin:0;text-align:right;font-weight:750;max-width:65%;overflow-wrap:anywhere}.admin-form-grid select+small{display:block;margin-top:6px;color:#788178;font-size:12px}@media(max-width:1000px){.admin-status-dashboard{grid-template-columns:1fr}} + +.admin-event-pagination{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;margin:22px 0 4px}.admin-event-pagination>div{display:flex;gap:6px}.admin-event-pagination a,.admin-event-pagination span{padding:8px 12px;border-radius:999px;border:1px solid #d9ded7;text-decoration:none}.admin-event-pagination a.is-active{background:#76ad28;color:#fff;border-color:#76ad28}.admin-event-pagination a.is-disabled{pointer-events:none;opacity:.4} +.background-list{display:grid;gap:10px;margin:18px 0}.background-row,.import-action-card{display:flex;align-items:center;justify-content:space-between;gap:18px}.background-row{padding:12px 14px;border:1px solid var(--lw-line);border-radius:12px;background:#fafcf9}.background-row div{display:grid;gap:3px}.background-row small{color:var(--lw-muted)}.background-row form{margin:0}.background-upload{display:grid;grid-template-columns:1fr 1fr auto;align-items:end;gap:12px}.import-action-card{margin-top:18px}.import-action-card p{margin:4px 0 0;color:var(--lw-muted)}@media(max-width:760px){.background-upload{grid-template-columns:1fr}.import-action-card{align-items:flex-start;flex-direction:column}} diff --git a/web/assets/admin-v36.css b/web/assets/admin-v36.css new file mode 100644 index 0000000..11936eb --- /dev/null +++ b/web/assets/admin-v36.css @@ -0,0 +1,153 @@ +:root{ + --lw-green:#18a84b; + --lw-green-dark:#087b34; + --lw-green-soft:#e9f8ee; + --lw-black:#090b09; + --lw-panel:#121512; + --lw-text:#151915; + --lw-muted:#6d746e; + --lw-line:#e4e8e4; + --lw-bg:#f4f6f4; + --lw-white:#fff; + --lw-shadow:0 18px 55px rgba(11,18,12,.12); + font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; + color-scheme:light; +} +*{box-sizing:border-box} +html,body{margin:0;min-height:100%;background:var(--lw-bg);color:var(--lw-text)} +body{font-size:16px} +button,input{font:inherit} +button,a{ -webkit-tap-highlight-color:transparent} +a{color:inherit;text-decoration:none} +.admin-kicker{display:block;color:var(--lw-green);font-size:.72rem;font-weight:850;letter-spacing:.13em;text-transform:uppercase} + +/* Login */ +.admin-login-page{background:#0a0d0a;min-height:100vh;overflow-x:hidden} +.admin-login-shell{display:grid;grid-template-columns:minmax(420px,1.04fr) minmax(430px,.96fr);min-height:100vh} +.admin-login-brand{position:relative;display:flex;flex-direction:column;justify-content:flex-start;overflow:hidden;padding:42px 5.5vw 64px;color:#fff;background: + linear-gradient(135deg,rgba(5,9,5,.95),rgba(7,19,10,.82)), + url('/assets/hero-poster.jpg') center/cover no-repeat} +.admin-login-brand:after{content:"";position:absolute;inset:auto -8% -20% 16%;height:52%;background:radial-gradient(circle at center,rgba(25,168,75,.33),transparent 65%);filter:blur(10px)} +.admin-login-brand>img{position:relative;z-index:2;width:min(310px,64%);height:auto;filter:drop-shadow(0 8px 24px rgba(0,0,0,.26))} +.admin-login-brand>p{position:relative;z-index:2;margin:2px 0 0 7px;color:#dce7dd;font-size:.76rem;letter-spacing:.11em;text-transform:uppercase} +.admin-login-message{position:relative;z-index:2;margin-top:auto;max-width:670px} +.admin-login-message>span{display:inline-flex;align-items:center;gap:9px;color:#7fe59f;font-weight:800;letter-spacing:.08em;text-transform:uppercase;font-size:.78rem} +.admin-login-message>span:before{content:"";width:24px;height:3px;border-radius:9px;background:var(--lw-green)} +.admin-login-message h1{margin:18px 0 20px;font-size:clamp(3rem,5.2vw,6.4rem);line-height:.91;letter-spacing:-.065em} +.admin-login-message p{max-width:520px;margin:0;color:#d1d9d2;font-size:1.08rem;line-height:1.65} +.admin-radio-waves{position:absolute;right:-110px;top:13%;width:450px;height:450px;opacity:.33} +.admin-radio-waves i{position:absolute;inset:50%;border:3px solid var(--lw-green);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;transform:translate(-50%,-50%) rotate(45deg)} +.admin-radio-waves i:nth-child(1){width:170px;height:170px}.admin-radio-waves i:nth-child(2){width:285px;height:285px}.admin-radio-waves i:nth-child(3){width:405px;height:405px} +.admin-login-panel{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:48px;background: + radial-gradient(circle at 100% 0,rgba(25,168,75,.12),transparent 29%),#f5f7f5} +.admin-login-card{width:min(520px,100%);background:#fff;border:1px solid rgba(20,40,25,.08);border-radius:28px;padding:50px;box-shadow:var(--lw-shadow)} +.admin-login-card h2{margin:10px 0 8px;font-size:2.15rem;letter-spacing:-.04em} +.admin-login-intro{margin:0 0 30px;color:var(--lw-muted);line-height:1.55} +.admin-alert{display:grid;gap:5px;margin:0 0 20px;padding:14px 16px;border-radius:13px;font-size:.9rem;line-height:1.45} +.admin-alert-error{background:#fff0ef;color:#a62a20;border:1px solid #ffd1cd} +.admin-alert-config{background:#fff8e5;color:#775800;border:1px solid #f5dda1} +.admin-alert code{font-size:.77rem;background:rgba(255,255,255,.55);padding:2px 5px;border-radius:5px} +.admin-login-form{display:grid;gap:18px} +.admin-login-form label>span{display:block;margin:0 0 8px;font-size:.83rem;font-weight:800;color:#343a35} +.admin-input-wrap{display:flex;align-items:center;gap:12px;height:55px;padding:0 16px;border:1px solid #dce3dd;border-radius:13px;background:#fbfcfb;transition:.2s} +.admin-input-wrap:focus-within{border-color:var(--lw-green);box-shadow:0 0 0 4px rgba(25,168,75,.11);background:#fff} +.admin-input-wrap b{color:var(--lw-green);font-size:.7rem} +.admin-input-wrap input{width:100%;border:0;outline:0;background:transparent;font-size:1rem;color:var(--lw-text)} +.admin-primary-button{display:flex;align-items:center;justify-content:space-between;height:57px;margin-top:5px;padding:0 22px;border:0;border-radius:14px;background:linear-gradient(135deg,var(--lw-green),#0d8d3d);color:#fff;font-weight:850;box-shadow:0 12px 25px rgba(17,150,62,.25);cursor:pointer;transition:.2s} +.admin-primary-button:hover{transform:translateY(-2px);box-shadow:0 16px 30px rgba(17,150,62,.31)} +.admin-primary-button:disabled{cursor:not-allowed;opacity:.45;transform:none} +.admin-primary-button i{font-size:1.3rem;font-style:normal} +.admin-login-security{display:flex;gap:12px;align-items:flex-start;margin-top:27px;padding-top:24px;border-top:1px solid var(--lw-line)} +.admin-login-security>span{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--lw-green-soft);color:var(--lw-green);font-weight:900} +.admin-login-security p{display:grid;gap:2px;margin:0}.admin-login-security small{color:var(--lw-muted);line-height:1.45} +.admin-login-footer{margin:22px 0 0;color:#879089;font-size:.75rem;text-align:center} + +/* Dashboard shell */ +.admin-dashboard-page{min-height:100vh;background:var(--lw-bg)} +.admin-layout{display:grid;grid-template-columns:265px minmax(0,1fr);min-height:100vh} +.admin-sidebar{position:sticky;top:0;display:flex;flex-direction:column;height:100vh;padding:25px 18px;background:linear-gradient(180deg,#090c09,#101510);color:#fff;z-index:20} +.admin-sidebar-brand{display:grid;justify-items:start;gap:4px;padding:0 13px 27px;border-bottom:1px solid rgba(255,255,255,.09)} +.admin-sidebar-brand img{width:176px;max-height:65px;object-fit:contain;object-position:left center} +.admin-sidebar-brand span{color:#87e5a4;font-size:.68rem;font-weight:850;letter-spacing:.2em;text-transform:uppercase} +.admin-navigation{display:grid;gap:7px;margin-top:26px} +.admin-navigation button{display:grid;grid-template-columns:28px 1fr auto;align-items:center;gap:9px;min-height:48px;padding:0 13px;border:0;border-radius:12px;background:transparent;color:#aeb9b0;text-align:left;cursor:pointer;transition:.18s} +.admin-navigation button:hover{background:rgba(255,255,255,.055);color:#fff} +.admin-navigation button.is-active{background:linear-gradient(90deg,rgba(25,168,75,.24),rgba(25,168,75,.08));color:#fff;box-shadow:inset 3px 0 var(--lw-green)} +.admin-navigation i{font-style:normal;color:#64d989;font-size:1.05rem;text-align:center} +.admin-navigation span{font-size:.88rem;font-weight:730} +.admin-navigation b{padding:3px 6px;border-radius:6px;background:rgba(255,255,255,.09);color:#839087;font-size:.55rem;letter-spacing:.06em;text-transform:uppercase} +.admin-sidebar-bottom{display:grid;gap:14px;margin-top:auto;padding:18px 12px 4px;border-top:1px solid rgba(255,255,255,.09)} +.admin-system-pill{display:flex;align-items:center;gap:9px;color:#c5cec6;font-size:.77rem}.admin-system-pill i{width:8px;height:8px;border-radius:50%;background:#37dd6e;box-shadow:0 0 0 5px rgba(55,221,110,.12)} +.admin-sidebar-bottom>a{display:flex;justify-content:space-between;color:#7f8a81;font-size:.76rem}.admin-sidebar-bottom>a:hover{color:#fff} +.admin-workspace{min-width:0} +.admin-topbar{position:sticky;top:0;z-index:15;display:flex;align-items:center;justify-content:space-between;height:79px;padding:0 38px;border-bottom:1px solid #e5e9e5;background:rgba(255,255,255,.94);backdrop-filter:blur(13px)} +.admin-topbar>div:first-of-type{display:grid;gap:1px}.admin-topbar>div:first-of-type span{color:var(--lw-muted);font-size:.7rem;letter-spacing:.08em;text-transform:uppercase}.admin-topbar>div:first-of-type strong{font-size:1.03rem} +.admin-user{display:flex;align-items:center;gap:11px}.admin-avatar{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:linear-gradient(135deg,var(--lw-green),#077832);color:#fff;font-weight:900;text-transform:uppercase}.admin-user>div{display:grid;gap:1px}.admin-user strong{font-size:.83rem}.admin-user small{color:var(--lw-muted);font-size:.68rem}.admin-user form{margin:0 0 0 8px}.admin-user button{width:36px;height:36px;border:1px solid var(--lw-line);border-radius:10px;background:#fff;color:#687069;cursor:pointer}.admin-user button:hover{border-color:#e1aaa5;color:#ae3025;background:#fff7f6} +.admin-mobile-menu{display:none;border:0;background:transparent;font-size:1.3rem} +.admin-content{padding:38px clamp(24px,3.3vw,56px) 70px} +.admin-view{display:none;max-width:1510px;margin:0 auto}.admin-view.is-active{display:block;animation:adminFade .2s ease}@keyframes adminFade{from{opacity:.25;transform:translateY(4px)}to{opacity:1;transform:none}} +.admin-page-heading{display:flex;justify-content:space-between;align-items:flex-end;gap:25px;margin-bottom:30px} +.admin-page-heading h1{margin:7px 0 6px;font-size:clamp(2rem,3vw,3.25rem);letter-spacing:-.055em;line-height:1}.admin-page-heading p{margin:0;color:var(--lw-muted);font-size:.98rem} +.admin-date{display:grid;gap:5px;padding:12px 16px;border:1px solid var(--lw-line);border-radius:12px;background:#fff;text-align:right}.admin-date span{color:var(--lw-muted);font-size:.65rem;text-transform:uppercase;letter-spacing:.08em}.admin-date strong{font-size:.82rem} +.admin-metric-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:22px} +.admin-metric{display:flex;align-items:center;gap:14px;min-height:115px;padding:20px;border:1px solid var(--lw-line);border-radius:17px;background:#fff;box-shadow:0 8px 25px rgba(15,25,16,.035)} +.metric-icon{display:grid;place-items:center;width:48px;height:48px;flex:0 0 48px;border-radius:15px;background:#edf1ed;color:#677168;font-size:1rem}.metric-icon.is-green{background:var(--lw-green-soft);color:var(--lw-green);box-shadow:inset 0 0 0 1px #d0f0d9} +.admin-metric>div{display:grid;gap:3px;min-width:0}.admin-metric small{color:var(--lw-muted);font-size:.68rem;text-transform:uppercase;letter-spacing:.05em}.admin-metric strong{font-size:1.05rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.admin-metric em{color:#8d948e;font-size:.69rem;font-style:normal} +.admin-dashboard-grid{display:grid;grid-template-columns:minmax(0,1.38fr) minmax(320px,.82fr);gap:22px} +.admin-card{border:1px solid var(--lw-line);border-radius:19px;background:#fff;box-shadow:0 11px 30px rgba(16,28,17,.045)} +.admin-card-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:22px 24px 15px}.admin-card-heading h2{margin:5px 0 0;font-size:1.18rem;letter-spacing:-.025em} +.admin-live-card{overflow:hidden;background:linear-gradient(135deg,#0b0f0b,#172017);color:#fff;border-color:#1a241b}.admin-live-card .admin-card-heading{border-bottom:1px solid rgba(255,255,255,.08)} +.admin-live-label{display:flex;align-items:center;gap:7px;padding:6px 10px;border-radius:20px;background:rgba(25,168,75,.16);color:#78e79a;font-size:.66rem;font-weight:850;text-transform:uppercase;letter-spacing:.08em}.admin-live-label i{width:7px;height:7px;border-radius:50%;background:#38e875;box-shadow:0 0 0 5px rgba(56,232,117,.12)} +.admin-live-body{display:flex;align-items:center;gap:19px;padding:25px}.admin-live-body>button{display:grid;place-items:center;width:64px;height:64px;flex:0 0 64px;border:0;border-radius:50%;background:var(--lw-green);color:#fff;font-size:1.2rem;cursor:pointer;box-shadow:0 12px 28px rgba(25,168,75,.26)}.admin-live-body>button.is-playing{background:#fff;color:var(--lw-green)} +.admin-live-body>div{display:grid;gap:4px;min-width:0}.admin-live-body small{color:#7e8c80;font-size:.68rem;text-transform:uppercase;letter-spacing:.06em}.admin-live-body strong{font-size:.85rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.admin-live-body span{color:#6de590;font-size:.74rem} +.admin-weather-overview{padding-bottom:18px}.admin-icon-button{width:36px;height:36px;border:1px solid var(--lw-line);border-radius:10px;background:#fff;color:var(--lw-green);font-size:1.1rem;cursor:pointer}.admin-icon-button.is-loading{animation:adminSpin .8s linear infinite}@keyframes adminSpin{to{transform:rotate(360deg)}} +.admin-weather-main{display:grid;grid-template-columns:62px 68px 1fr;align-items:center;gap:7px;padding:7px 24px 15px}.admin-weather-main>span{font-size:2.7rem}.admin-weather-main>strong{font-size:2.6rem;letter-spacing:-.07em}.admin-weather-main>div{display:grid}.admin-weather-main b{font-size:.85rem;text-transform:capitalize}.admin-weather-main small{margin-top:3px;color:var(--lw-muted);font-size:.72rem} +.admin-weather-facts{display:flex;justify-content:space-between;gap:10px;margin:0 24px;padding:13px 0;border-top:1px solid var(--lw-line);border-bottom:1px solid var(--lw-line);color:#697069;font-size:.7rem}.admin-source{display:block;margin:11px 24px 0;color:#9aa09b;font-size:.6rem}.admin-weather-error{margin:15px 24px;padding:18px;border-radius:12px;background:#fff5ec;color:#8b5013;font-size:.82rem} +.admin-activity-card,.admin-quick-card{min-height:315px} +.admin-progress-list{display:grid;gap:18px;padding:9px 24px 25px}.admin-progress-list>div{display:grid;grid-template-columns:64px 1fr auto;align-items:center;gap:14px}.admin-progress-list>div>span{position:relative;display:block;height:7px;border-radius:9px;background:#edf0ed;overflow:hidden}.admin-progress-list>div>span i{position:absolute;inset:0 auto 0 0;width:var(--progress);border-radius:inherit;background:linear-gradient(90deg,var(--lw-green),#54d679)}.admin-progress-list p{display:grid;gap:2px;margin:0}.admin-progress-list strong{font-size:.8rem}.admin-progress-list small{color:var(--lw-muted);font-size:.67rem}.admin-progress-list b{color:var(--lw-green-dark);font-size:.72rem} +.admin-quick-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:8px 22px 24px}.admin-quick-grid button,.admin-quick-grid a{display:grid;grid-template-columns:36px 1fr;grid-template-rows:auto auto;column-gap:11px;align-items:center;min-height:94px;padding:14px;border:1px solid var(--lw-line);border-radius:13px;background:#fbfcfb;text-align:left;cursor:pointer}.admin-quick-grid i{grid-row:1/3;display:grid;place-items:center;width:36px;height:36px;border-radius:11px;background:var(--lw-green-soft);color:var(--lw-green);font-style:normal;font-weight:900}.admin-quick-grid strong{font-size:.78rem}.admin-quick-grid span{color:var(--lw-muted);font-size:.63rem}.admin-quick-grid button:hover,.admin-quick-grid a:hover{border-color:#b9dfc3;background:#f7fff9} +.admin-empty-state{display:grid;justify-items:center;max-width:720px;margin:70px auto;padding:55px;text-align:center;border:1px dashed #bdc8be;border-radius:24px;background:#fff}.admin-empty-state>span{display:grid;place-items:center;width:70px;height:70px;border-radius:21px;background:var(--lw-green-soft);color:var(--lw-green);font-size:1.6rem}.admin-empty-state h2{margin:22px 0 8px;font-size:1.55rem}.admin-empty-state p{max-width:570px;margin:0;color:var(--lw-muted);line-height:1.65}.admin-empty-state button{margin-top:22px;padding:11px 17px;border:0;border-radius:10px;background:var(--lw-black);color:#fff;font-weight:750;cursor:pointer} +.admin-feature-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}.admin-feature-grid article{display:grid;align-content:start;min-height:260px;padding:27px;border:1px solid var(--lw-line);border-radius:19px;background:#fff}.admin-feature-grid i{display:grid;place-items:center;width:48px;height:48px;border-radius:14px;background:var(--lw-green-soft);color:var(--lw-green);font-size:1.2rem;font-style:normal}.admin-feature-grid h2{margin:22px 0 8px;font-size:1.08rem}.admin-feature-grid p{margin:0;color:var(--lw-muted);line-height:1.58;font-size:.87rem}.admin-feature-grid span{margin-top:auto;padding-top:23px;color:var(--lw-green-dark);font-size:.68rem;font-weight:850;text-transform:uppercase;letter-spacing:.07em} +.admin-settings-card{padding:25px}.admin-settings-card>.admin-card-heading{padding:0 0 19px}.admin-settings-card h2{margin:0 0 18px}.admin-settings-card dl{display:grid;gap:0;margin:0}.admin-settings-card dl>div{display:grid;grid-template-columns:minmax(140px,.55fr) 1fr;gap:20px;padding:13px 0;border-bottom:1px solid var(--lw-line)}.admin-settings-card dt{color:var(--lw-muted);font-size:.76rem}.admin-settings-card dd{margin:0;font-size:.77rem;font-weight:750;overflow-wrap:anywhere}.admin-settings-card>p{margin:20px 0 0;color:var(--lw-muted);line-height:1.55;font-size:.79rem}.admin-status-green{color:var(--lw-green);font-weight:850}.admin-settings-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px} +.admin-push-preview{display:grid;grid-template-columns:1fr .75fr;gap:0;overflow:hidden;min-height:430px;border-radius:24px;background:linear-gradient(135deg,#0a0e0a,#172317);color:#fff;box-shadow:var(--lw-shadow)}.admin-push-preview>div:first-child{display:flex;flex-direction:column;justify-content:center;padding:55px}.admin-push-preview>div:first-child>span{color:#79e79b;text-transform:uppercase;letter-spacing:.1em;font-size:.73rem;font-weight:850}.admin-push-preview h2{margin:14px 0 10px;font-size:2.5rem;letter-spacing:-.05em}.admin-push-preview p{max-width:520px;color:#c0cbc2;line-height:1.6}.admin-push-preview button{align-self:flex-start;margin-top:18px;padding:12px 18px;border:0;border-radius:11px;background:#3c443d;color:#89928a}.admin-phone-preview{align-self:center;justify-self:center;width:250px;height:320px;padding:28px 19px;border:8px solid #222922;border-radius:36px;background:#f6f8f6;color:#151915;box-shadow:0 35px 60px rgba(0,0,0,.35)}.admin-phone-preview>span{display:block;color:var(--lw-green);font-size:.68rem;font-weight:900;text-transform:uppercase}.admin-phone-preview strong{display:block;margin:80px 0 8px;font-size:1.05rem}.admin-phone-preview p{color:#687069;font-size:.78rem} + +@media (min-width:1500px){.admin-layout{grid-template-columns:290px minmax(0,1fr)}.admin-sidebar{padding-inline:22px}.admin-content{padding-top:46px}.admin-metric{min-height:128px}.admin-dashboard-grid{grid-template-columns:minmax(0,1.45fr) minmax(360px,.8fr)}} +@media (max-width:1120px){.admin-metric-grid{grid-template-columns:1fr 1fr}.admin-feature-grid,.admin-settings-grid{grid-template-columns:1fr 1fr}.admin-dashboard-grid{grid-template-columns:1fr}.admin-login-shell{grid-template-columns:.9fr 1.1fr}.admin-login-brand{padding-inline:4vw}.admin-login-message h1{font-size:4.2rem}.admin-login-card{padding:38px}} +@media (max-width:820px){.admin-login-shell{display:block}.admin-login-brand{min-height:320px;padding:27px 28px 35px}.admin-login-brand>img{width:220px}.admin-login-brand>p{font-size:.62rem}.admin-login-message{margin-top:70px}.admin-login-message h1{font-size:3rem}.admin-login-message p{display:none}.admin-login-panel{padding:25px 16px 40px}.admin-login-card{margin-top:-20px;padding:29px 24px;border-radius:22px;position:relative;z-index:4}.admin-layout{display:block}.admin-sidebar{position:fixed;left:-285px;width:265px;transition:.23s}.admin-sidebar.is-open{left:0;box-shadow:30px 0 70px rgba(0,0,0,.3)}.admin-topbar{height:70px;padding:0 18px}.admin-mobile-menu{display:block}.admin-topbar>div:first-of-type{display:none}.admin-content{padding:26px 17px 50px}.admin-page-heading{align-items:flex-start;flex-direction:column}.admin-date{text-align:left}.admin-metric-grid,.admin-feature-grid,.admin-settings-grid{grid-template-columns:1fr}.admin-push-preview{grid-template-columns:1fr}.admin-phone-preview{display:none}} +@media (max-width:520px){.admin-login-message h1{font-size:2.55rem}.admin-login-card h2{font-size:1.75rem}.admin-user>div{display:none}.admin-metric-grid{grid-template-columns:1fr}.admin-dashboard-grid{gap:15px}.admin-card-heading{padding-inline:18px}.admin-live-body{padding:20px 18px}.admin-weather-main{padding-inline:18px}.admin-weather-facts{margin-inline:18px}.admin-progress-list{padding-inline:18px}.admin-quick-grid{grid-template-columns:1fr;padding-inline:18px}.admin-feature-grid article{min-height:220px}.admin-settings-card dl>div{grid-template-columns:1fr;gap:5px}.admin-push-preview>div:first-child{padding:35px 25px}.admin-push-preview h2{font-size:2rem}} + +/* v11 – AzuraCast-Integration und externe Cover-Verwaltung */ +.admin-integration-badge{display:grid;grid-template-columns:10px auto;column-gap:9px;align-items:center;padding:12px 15px;border:1px solid var(--lw-line);border-radius:14px;background:#fff;box-shadow:0 8px 22px rgba(15,28,16,.04)} +.admin-integration-badge i{grid-row:1/3;width:9px;height:9px;border-radius:50%;background:var(--lw-green);box-shadow:0 0 0 6px rgba(25,168,75,.12)} +.admin-integration-badge span{color:var(--lw-muted);font-size:.62rem;text-transform:uppercase;letter-spacing:.08em}.admin-integration-badge strong{font-size:.74rem} +.admin-radio-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(310px,.72fr);gap:22px;align-items:start} +.admin-azuracast-card{overflow:hidden}.admin-integration-form{display:grid}.admin-form-section{padding:24px;border-top:1px solid var(--lw-line)} +.admin-switch-row{display:grid;grid-template-columns:1fr 48px;align-items:center;gap:20px;margin-bottom:22px;cursor:pointer}.admin-switch-row>span{display:grid;gap:4px}.admin-switch-row strong{font-size:.9rem}.admin-switch-row small{color:var(--lw-muted);font-size:.72rem;line-height:1.5}.admin-switch-row input{position:absolute;opacity:0;pointer-events:none}.admin-switch-row>i{position:relative;width:48px;height:27px;border-radius:18px;background:#cbd1cc;transition:.2s}.admin-switch-row>i:after{content:"";position:absolute;left:4px;top:4px;width:19px;height:19px;border-radius:50%;background:#fff;box-shadow:0 2px 6px rgba(0,0,0,.2);transition:.2s}.admin-switch-row input:checked+i{background:var(--lw-green)}.admin-switch-row input:checked+i:after{transform:translateX(21px)}.admin-switch-row input:focus-visible+i{outline:3px solid rgba(25,168,75,.25);outline-offset:3px} +.admin-field-grid{display:grid;grid-template-columns:1.4fr .8fr;gap:16px}.admin-field-grid-small{grid-template-columns:1fr 1fr;max-width:520px;margin-top:18px}.admin-field-wide{grid-column:1/-1}.admin-field{display:grid;gap:7px}.admin-field>span{font-size:.69rem;font-weight:820;text-transform:uppercase;letter-spacing:.055em;color:#4d564e}.admin-field input{width:100%;height:45px;border:1px solid #d9dfda;border-radius:11px;background:#fbfcfb;padding:0 13px;color:#121713;outline:none}.admin-field input:focus{border-color:var(--lw-green);box-shadow:0 0 0 3px rgba(25,168,75,.1);background:#fff}.admin-field small{color:var(--lw-muted);font-size:.64rem}.admin-field code{font-size:inherit} +.admin-check-row{display:flex;align-items:flex-start;gap:11px;margin-top:18px;padding:14px;border:1px solid #e1e6e2;border-radius:12px;background:#f9fbf9;cursor:pointer}.admin-check-row input{margin-top:3px;accent-color:var(--lw-green)}.admin-check-row span{display:grid;gap:3px}.admin-check-row strong{font-size:.77rem}.admin-check-row small{color:var(--lw-muted);font-size:.67rem;line-height:1.45} +.admin-endpoint-preview{display:grid;gap:6px;margin-top:16px;padding:13px 15px;border-radius:11px;background:#0e140f;color:#dce5dd}.admin-endpoint-preview span{color:#7f9182;font-size:.61rem;text-transform:uppercase;letter-spacing:.08em}.admin-endpoint-preview code{overflow-wrap:anywhere;color:#8be5a4;font-size:.72rem} +.admin-cover-settings{background:linear-gradient(180deg,#fbfcfb,#f6f9f6)}.admin-section-title{display:flex;justify-content:space-between;align-items:flex-start;gap:18px}.admin-section-title h3{margin:4px 0 0;font-size:1.12rem}.admin-cover-rule{padding:6px 9px;border-radius:20px;background:#eef7f0;color:#268245;font-size:.61rem;font-weight:850;text-transform:uppercase;letter-spacing:.055em}.admin-cover-settings>p{max-width:750px;margin:14px 0 18px;color:var(--lw-muted);font-size:.76rem;line-height:1.6} +.admin-provider-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.admin-provider-option{position:relative;cursor:pointer}.admin-provider-option>input{position:absolute;opacity:0}.admin-provider-option>span{display:grid;grid-template-columns:35px 1fr;grid-template-rows:auto auto;column-gap:11px;min-height:82px;padding:14px;border:1px solid #dbe1dc;border-radius:13px;background:#fff;transition:.18s}.admin-provider-option b{grid-row:1/3;display:grid;place-items:center;width:35px;height:35px;border-radius:11px;background:#edf2ee;color:#717a72;font-size:.72rem}.admin-provider-option strong{font-size:.78rem}.admin-provider-option small{color:var(--lw-muted);font-size:.64rem}.admin-provider-option input:checked+span{border-color:#9bd3aa;background:#f7fff9;box-shadow:0 0 0 3px rgba(25,168,75,.07)}.admin-provider-option input:checked+span b{background:var(--lw-green);color:#fff}.admin-provider-option input:focus-visible+span{outline:3px solid rgba(25,168,75,.22)} +.admin-form-actions{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:20px 24px;border-top:1px solid var(--lw-line);background:#fff}.admin-form-actions>p{margin:0;color:var(--lw-muted);font-size:.69rem;line-height:1.45}.admin-form-actions>p[data-type="success"]{color:#16823b}.admin-form-actions>p[data-type="error"]{color:#b6382b}.admin-form-actions>p[data-type="warning"]{color:#956100}.admin-form-actions>p[data-type="loading"]{color:#3f6a49}.admin-form-actions>div{display:flex;gap:9px;flex:0 0 auto}.admin-button-primary,.admin-button-secondary{height:43px;padding:0 16px;border-radius:10px;font-size:.72rem;font-weight:850;cursor:pointer}.admin-button-primary{border:1px solid var(--lw-green);background:var(--lw-green);color:#fff}.admin-button-secondary{border:1px solid #ccd4cd;background:#fff;color:#273029}.admin-button-primary:hover{filter:brightness(.94)}.admin-button-secondary:hover{border-color:#9cb2a1;background:#f8fbf8}.admin-integration-form.is-busy{opacity:.75;pointer-events:none}.admin-button-primary:disabled,.admin-button-secondary:disabled{cursor:wait} +.admin-now-preview{overflow:hidden;position:sticky;top:102px}.admin-now-visual{position:relative;min-height:292px;display:grid;place-items:center;overflow:hidden;background:radial-gradient(circle at 50% 40%,#2a392c,#101611 68%)}.admin-now-visual:after{content:"";position:absolute;inset:auto 0 0;height:45%;background:linear-gradient(transparent,rgba(0,0,0,.62))}.admin-now-visual>img{position:relative;z-index:2;width:190px;height:190px;object-fit:cover;border-radius:17px;box-shadow:0 24px 50px rgba(0,0,0,.46);border:1px solid rgba(255,255,255,.15)}.admin-now-live{position:absolute;z-index:4;left:20px;bottom:18px;padding:7px 10px;border-radius:7px;background:var(--lw-green);color:#fff;font-size:.65rem;font-weight:900;letter-spacing:.08em}.admin-now-signal{position:absolute;right:-55px;top:15px;width:210px;height:210px;opacity:.24}.admin-now-signal i{position:absolute;inset:50%;border:3px solid #8ede45;border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;transform:translate(-50%,-50%) rotate(45deg)}.admin-now-signal i:nth-child(1){width:75px;height:75px}.admin-now-signal i:nth-child(2){width:130px;height:130px}.admin-now-signal i:nth-child(3){width:190px;height:190px} +.admin-now-copy{padding:23px}.admin-now-copy h2{margin:7px 0 2px;font-size:1.45rem;letter-spacing:-.035em}.admin-now-copy>strong{display:block;color:var(--lw-green-dark);font-size:.98rem}.admin-now-copy>p{margin:13px 0 18px;color:var(--lw-muted);font-size:.75rem;line-height:1.5}.admin-now-copy dl{display:grid;margin:0}.admin-now-copy dl>div{display:grid;grid-template-columns:92px 1fr;gap:10px;padding:9px 0;border-top:1px solid var(--lw-line);font-size:.7rem}.admin-now-copy dt{color:var(--lw-muted)}.admin-now-copy dd{margin:0;font-weight:780;overflow-wrap:anywhere}.admin-now-status{display:flex;align-items:center;gap:9px;margin-top:16px;padding:11px 12px;border-radius:11px;background:#edf9f0;color:#1d7b39;font-size:.69rem;font-weight:800}.admin-now-status i{width:8px;height:8px;border-radius:50%;background:#27bd58;box-shadow:0 0 0 5px rgba(39,189,88,.12)}.admin-now-status.is-error{background:#fff1ef;color:#a43a2f}.admin-now-status.is-error i{background:#dc5144;box-shadow:0 0 0 5px rgba(220,81,68,.12)} +@media(max-width:1180px){.admin-radio-grid{grid-template-columns:1fr}.admin-now-preview{position:static;display:grid;grid-template-columns:310px 1fr}.admin-now-visual{min-height:100%}} +@media(max-width:700px){.admin-field-grid,.admin-field-grid-small,.admin-provider-grid{grid-template-columns:1fr}.admin-field-wide{grid-column:auto}.admin-form-actions{align-items:stretch;flex-direction:column}.admin-form-actions>div{display:grid;grid-template-columns:1fr 1fr}.admin-now-preview{display:block}.admin-section-title{flex-direction:column}.admin-now-visual{min-height:260px}} +@media(max-width:480px){.admin-form-section{padding:19px 17px}.admin-form-actions{padding:17px}.admin-form-actions>div{grid-template-columns:1fr}.admin-switch-row{grid-template-columns:1fr 48px}.admin-now-visual>img{width:165px;height:165px}} +.admin-navigation a{display:flex;align-items:center;gap:12px;border:0;background:transparent;color:#cbd1ca;padding:12px 14px;border-radius:8px;font:inherit;text-decoration:none}.admin-navigation a i{width:22px;text-align:center}.admin-navigation a b{margin-left:auto;font-size:9px;background:#6d9e00;color:#fff;padding:3px 6px;border-radius:4px}.admin-navigation a.is-active,.admin-navigation a:hover{background:#20261f;color:#fff}.admin-program-layout{display:grid;grid-template-columns:minmax(420px,.85fr) minmax(520px,1.15fr);gap:22px}.admin-program-form,.admin-program-list{padding:0}.admin-program-form form{padding:24px}.admin-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:17px}.admin-form-grid label{display:grid;gap:7px}.admin-form-grid label>span{font-size:11px;text-transform:uppercase;font-weight:900;color:#657065}.admin-form-grid .is-wide{grid-column:1/-1}.admin-form-grid input,.admin-form-grid select,.admin-form-grid textarea{width:100%;border:1px solid #d9ded7;border-radius:8px;padding:11px 12px;background:#fff;color:#171b17}.admin-form-grid textarea{resize:vertical}.admin-check{display:flex!important;grid-template-columns:20px 1fr!important;align-items:center}.admin-check input{width:18px;height:18px}.admin-check span{text-transform:none!important;font-size:13px!important}.admin-form-actions{margin:22px -24px -24px;padding:18px 24px;border-top:1px solid #e6e9e4}.admin-primary-button{border:0;background:linear-gradient(#8fc915,#73a900);color:#fff;border-radius:8px;padding:12px 18px;font-weight:900}.admin-program-items{display:grid}.admin-program-items article{display:grid;grid-template-columns:54px minmax(0,1fr) auto auto auto;align-items:center;gap:12px;padding:13px 18px;border-top:1px solid #eaede8}.admin-program-items article.is-live{background:#f0f8e5}.admin-program-items img{width:48px;height:48px;border-radius:50%;object-fit:cover;object-position:center 35%}.admin-program-items small,.admin-program-items strong,.admin-program-items span{display:block}.admin-program-items small{font-size:10px;color:#718071}.admin-program-items strong{font-size:14px;margin:2px 0}.admin-program-items span{font-size:11px;color:#697169}.admin-program-items article>b{background:#7db500;color:#fff;border-radius:5px;padding:5px 7px;font-size:9px;text-transform:uppercase}.admin-program-items article>a{color:#679700;font-weight:800;font-size:11px}.admin-program-items form button{border:0;background:#f4e7e7;color:#9d3030;border-radius:6px;padding:7px 9px;font-weight:800}.admin-alert{border-radius:8px;padding:13px 16px;margin-bottom:18px;font-weight:800}.admin-alert.is-success{background:#ebf7df;color:#4c7600}.admin-alert.is-error{background:#faeaea;color:#9c2d2d}@media(max-width:1100px){.admin-program-layout{grid-template-columns:1fr}.admin-program-items article{grid-template-columns:54px minmax(0,1fr) auto auto}}@media(max-width:700px){.admin-form-grid{grid-template-columns:1fr}.admin-form-grid .is-wide{grid-column:auto}.admin-program-items article{grid-template-columns:48px 1fr}.admin-program-items article>b,.admin-program-items article>a,.admin-program-items article>form{grid-column:2}} +.ai-settings-grid,.ai-studio-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}.ai-provider-card{align-self:start}.admin-switch{display:flex;align-items:center;gap:8px;font-weight:800}.admin-switch input{width:20px;height:20px}.voice-settings{margin-top:24px}.voice-row{display:grid;grid-template-columns:1fr 1.4fr 1fr auto;gap:10px;margin-bottom:10px}.voice-row input{min-width:0}.voice-row button{border:0;border-radius:8px;background:#351818;color:#fff;font-size:22px;padding:0 14px}.admin-secondary-button{display:inline-flex;align-items:center;justify-content:center;border:1px solid #526052;background:#161b17;color:#eef5ec;border-radius:9px;padding:12px 16px;font-weight:800;text-decoration:none}.security-note{margin-top:22px}.security-note code{color:#b9ec6a}.integration-state{padding:7px 11px;border-radius:999px;background:#3a2424;color:#ffb1b1;font-size:12px;font-weight:900;text-transform:uppercase}.integration-state.is-on{background:#21351d;color:#b9ec6a}.ai-result,.ai-audio-result{margin-top:22px;padding-top:20px;border-top:1px solid rgba(255,255,255,.08)}.ai-result textarea{width:100%;margin-top:10px}.ai-audio-result{display:grid;gap:14px}.ai-audio-result audio{width:100%}@media(max-width:1000px){.ai-settings-grid,.ai-studio-grid{grid-template-columns:1fr}}@media(max-width:700px){.voice-row{grid-template-columns:1fr}.voice-row button{min-height:42px}} +.wish-admin-list{display:grid;gap:18px}.wish-admin-item blockquote{margin:16px 0;padding:16px 18px;border-left:4px solid #7eb72f;background:rgba(126,183,47,.08);border-radius:8px}.wish-admin-item form{margin-top:18px}.wish-admin-item .admin-primary-button{margin-top:14px} +.template-admin-grid{display:grid;grid-template-columns:340px minmax(0,1fr);gap:22px}.template-list{display:grid;gap:10px}.template-list-item{display:grid;grid-template-columns:1fr auto;gap:4px 12px;padding:15px;border:1px solid #dfe5dd;border-radius:12px;color:#263026;text-decoration:none}.template-list-item span{font-size:12px;color:#788078}.template-list-item b{grid-row:1/3;grid-column:2;align-self:center;color:#70a900}.template-list-item.is-active{border-color:#78b82a;background:#f2f8e9}.template-token-note{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:18px 0}.template-token-note strong{width:100%}.template-token-note code{background:#eef4e8;padding:6px 9px;border-radius:7px}.wish-toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.wish-toolbar div{display:flex;gap:14px;align-items:center}.wish-toolbar span{color:#6f776f}.wish-toolbar select{padding:8px 12px;border-radius:8px}.wish-actions{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-top:18px}.wish-actions select{padding:11px;border:1px solid #d8ded5;border-radius:8px}.admin-danger-button{border:0;border-radius:8px;padding:11px 16px;background:#9b2f2f;color:#fff;font-weight:800}.generated-preview{margin-top:16px;padding:16px;border-left:4px solid #78b82a;background:#f3f8ed;border-radius:9px}.generated-preview span{font-size:11px;text-transform:uppercase;font-weight:900;color:#689f18}.generated-preview p{margin:8px 0 0}.audio-result{margin-top:12px;padding:12px 15px;background:#edf4e8;border-radius:9px}.status-badge{display:inline-flex;padding:5px 10px;border-radius:999px;text-transform:uppercase;font-size:10px;font-weight:900}.status-pending{background:#fff3cc;color:#8d6800}.status-approved{background:#e8f5d9;color:#558800}.status-rejected{background:#fae1e1;color:#a12e2e}.status-archived{background:#ecefec;color:#626962}.admin-pagination{display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin-top:24px}.admin-pagination a{padding:9px 13px;border:1px solid #d8ded5;border-radius:8px;color:#394239;text-decoration:none}.admin-pagination a.is-active{background:#75b82a;color:#fff;border-color:#75b82a}@media(max-width:900px){.template-admin-grid{grid-template-columns:1fr}.wish-toolbar{align-items:flex-start;flex-direction:column}} +.admin-media-upload,.admin-media-library{margin-bottom:24px}.admin-dropzone{display:flex;min-height:220px;margin:0 24px 24px;border:2px dashed #b7c8ad;border-radius:22px;background:linear-gradient(145deg,#f7faf4,#eef5e8);align-items:center;justify-content:center;flex-direction:column;text-align:center;cursor:pointer;transition:.2s}.admin-dropzone.is-dragging{border-color:var(--lw-green);background:#eaf5df;transform:scale(1.005)}.admin-dropzone input{position:absolute;opacity:0;pointer-events:none}.admin-drop-icon{font-size:2.8rem;color:var(--lw-green)}.admin-dropzone strong{font-size:1.2rem;margin-top:8px}.admin-dropzone small,.admin-dropzone em{color:#687269;margin-top:5px}.admin-dropzone em{font-style:normal;font-weight:750}.admin-media-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px;padding:0 24px 25px}.admin-media-card{overflow:hidden;border:1px solid #dfe6db;border-radius:18px;background:#fff}.admin-media-preview{aspect-ratio:4/3;background:#e8ece6}.admin-media-preview img{width:100%;height:100%;object-fit:cover}.admin-media-info{padding:15px}.admin-media-info strong,.admin-media-info small,.admin-media-info p,.admin-media-info code{display:block}.admin-media-info small{margin-top:5px;color:#778078}.admin-media-info p{min-height:38px;color:#555f57}.admin-media-info code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:#f1f4ef;padding:7px;border-radius:7px}.admin-danger-button{margin-top:12px;border:0;background:#f8e7e7;color:#a22;padding:9px 12px;border-radius:9px;font-weight:800}.admin-media-picker{border:1px solid #dfe6db;border-radius:18px;padding:17px}.admin-media-picker legend{font-weight:850;padding:0 7px}.admin-media-picker-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:11px}.admin-media-choice{display:flex;position:relative;min-height:115px;border:2px solid transparent;border-radius:13px;overflow:hidden;background:#edf1eb;cursor:pointer;align-items:flex-end}.admin-media-choice input{position:absolute;top:9px;left:9px;z-index:2}.admin-media-choice img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.admin-media-choice span{position:relative;z-index:1;width:100%;padding:25px 8px 8px;background:linear-gradient(transparent,rgba(0,0,0,.75));color:#fff;font-size:.72rem;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.admin-media-choice:has(input:checked){border-color:var(--lw-green);box-shadow:0 0 0 3px rgba(110,166,0,.17)}.admin-media-choice.is-empty{align-items:center;justify-content:center;background:#f5f7f3}.admin-media-choice.is-empty span{width:auto;padding:0;background:none;color:#4b544c}.admin-inline-link{display:inline-block;margin-top:13px;color:var(--lw-green);font-weight:850}.admin-distribution{display:grid;gap:10px;padding:18px;border-radius:18px;background:#f2f6ee;border:1px solid #dfe8d9}.admin-distribution .admin-check{margin:0}.admin-distribution .admin-check span{display:flex;flex-direction:column}.admin-distribution .admin-check small{font-weight:500;color:#687269}.admin-editorial-thumb{width:72px;height:58px;border-radius:10px;object-fit:cover}.admin-program-items article:has(.admin-editorial-thumb){grid-template-columns:72px minmax(0,1fr) auto auto}.admin-form-grid label small{display:block;margin-top:5px;color:#778078;font-weight:500} +@media(max-width:1100px){.admin-media-grid,.admin-media-picker-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:650px){.admin-media-grid,.admin-media-picker-grid{grid-template-columns:1fr}.admin-program-items article:has(.admin-editorial-thumb){grid-template-columns:1fr}.admin-editorial-thumb{width:100%;height:150px}} + +/* v36: gruppierte Adminnavigation */ +.admin-navigation-v36{display:grid;gap:8px;padding:8px 12px}.admin-navigation-v36>a,.admin-navigation-v36 summary{display:flex;align-items:center;gap:11px;padding:11px 13px;border-radius:10px;color:#dce4dc;text-decoration:none;cursor:pointer;list-style:none;font-weight:800}.admin-navigation-v36 summary::-webkit-details-marker{display:none}.admin-navigation-v36 details{border:1px solid rgba(255,255,255,.05);border-radius:12px;background:rgba(255,255,255,.02)}.admin-navigation-v36 details[open]{background:rgba(117,184,42,.06);border-color:rgba(117,184,42,.17)}.admin-navigation-v36 summary b{margin-left:auto;transition:.2s}.admin-navigation-v36 details[open] summary b{transform:rotate(180deg)}.admin-navigation-v36 details>div{display:grid;padding:0 10px 10px 42px;gap:3px}.admin-navigation-v36 details>div a{padding:8px 10px;border-radius:8px;color:#aeb8ae;text-decoration:none;font-size:13px}.admin-navigation-v36 details>div a:hover,.admin-navigation-v36>a:hover{background:rgba(117,184,42,.13);color:#fff}.admin-nav-home{background:linear-gradient(135deg,rgba(117,184,42,.22),rgba(117,184,42,.08))}.admin-license-box{margin-top:24px}.admin-license-box textarea{width:100%;min-height:220px;resize:vertical;background:#0e120f;color:#cbd5cb;border:1px solid rgba(117,184,42,.28);border-radius:12px;padding:16px;font:12px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace}.settings-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:20px}.settings-tabs button{border:1px solid #dce3d8;background:#fff;border-radius:999px;padding:10px 15px;font-weight:850}.settings-tabs button.is-active{background:#75b82a;color:#fff;border-color:#75b82a}.settings-panel{display:none}.settings-panel.is-active{display:grid}.integration-note{padding:15px 17px;border-radius:12px;background:#f4f7f1;border-left:4px solid #75b82a;color:#4e594e} +.admin-status-dashboard{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}.status-dl{margin:12px 0 0;display:grid;gap:0}.status-dl div{display:flex;justify-content:space-between;gap:18px;padding:11px 0;border-bottom:1px solid rgba(255,255,255,.08)}.status-dl dt{color:#8e9990}.status-dl dd{margin:0;text-align:right;font-weight:750;max-width:65%;overflow-wrap:anywhere}.admin-form-grid select+small{display:block;margin-top:6px;color:#788178;font-size:12px}@media(max-width:1000px){.admin-status-dashboard{grid-template-columns:1fr}} + +.admin-event-pagination{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;margin:22px 0 4px}.admin-event-pagination>div{display:flex;gap:6px}.admin-event-pagination a,.admin-event-pagination span{padding:8px 12px;border-radius:999px;border:1px solid #d9ded7;text-decoration:none}.admin-event-pagination a.is-active{background:#76ad28;color:#fff;border-color:#76ad28}.admin-event-pagination a.is-disabled{pointer-events:none;opacity:.4} +.background-list{display:grid;gap:10px;margin:18px 0}.background-row,.import-action-card{display:flex;align-items:center;justify-content:space-between;gap:18px}.background-row{padding:12px 14px;border:1px solid var(--lw-line);border-radius:12px;background:#fafcf9}.background-row div{display:grid;gap:3px}.background-row small{color:var(--lw-muted)}.background-row form{margin:0}.background-upload{display:grid;grid-template-columns:1fr 1fr auto;align-items:end;gap:12px}.import-action-card{margin-top:18px}.import-action-card p{margin:4px 0 0;color:var(--lw-muted)}@media(max-width:760px){.background-upload{grid-template-columns:1fr}.import-action-card{align-items:flex-start;flex-direction:column}} + + +/* v37: zustandsabhaengige Admin-Seitennavigation */ +.admin-sidebar{overflow:hidden}.admin-navigation-v37{display:flex;flex:1;min-height:0;flex-direction:column;gap:9px;margin:18px -5px 0;padding:4px 7px 24px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(126,211,91,.35) transparent}.admin-navigation-v37::-webkit-scrollbar{width:6px}.admin-navigation-v37::-webkit-scrollbar-thumb{background:rgba(126,211,91,.3);border-radius:999px}.admin-navigation-v37>a,.admin-navigation-v37 summary{display:grid;grid-template-columns:34px minmax(0,1fr) 18px;align-items:center;gap:10px;min-height:54px;padding:9px 11px;border:1px solid transparent;border-radius:13px;color:#dce4dc;text-decoration:none;cursor:pointer;list-style:none;transition:background .18s,border-color .18s,color .18s,transform .18s}.admin-navigation-v37 summary::-webkit-details-marker{display:none}.admin-navigation-v37>a:hover,.admin-navigation-v37 summary:hover{background:rgba(255,255,255,.055);color:#fff}.admin-navigation-v37>a>i,.admin-navigation-v37 summary>i{display:grid;place-items:center;width:32px;height:32px;border-radius:10px;background:rgba(255,255,255,.06);color:#75d996;font-style:normal;font-size:1rem}.admin-navigation-v37>a>span,.admin-navigation-v37 summary>span{display:grid;gap:2px;min-width:0}.admin-navigation-v37>a strong,.admin-navigation-v37 summary strong{font-size:.82rem;line-height:1.2}.admin-navigation-v37>a small,.admin-navigation-v37 summary small{overflow:hidden;color:#7f8b81;font-size:.66rem;font-weight:600;line-height:1.25;text-overflow:ellipsis;white-space:nowrap}.admin-navigation-v37 summary>b{justify-self:end;color:#7e897f;font-size:.7rem;transition:transform .2s}.admin-navigation-v37 details{flex:0 0 auto;border:1px solid rgba(255,255,255,.045);border-radius:14px;background:rgba(255,255,255,.018);overflow:hidden}.admin-navigation-v37 details[open]{background:rgba(107,170,52,.065);border-color:rgba(118,192,55,.18)}.admin-navigation-v37 details[open] summary>b{transform:rotate(180deg)}.admin-navigation-v37 details.is-current>summary{color:#fff;background:linear-gradient(90deg,rgba(54,153,75,.18),rgba(54,153,75,.035))}.admin-navigation-v37 details.is-current>summary>i{background:rgba(84,190,91,.17);color:#8ee09d}.admin-navigation-v37 details>div{display:grid;gap:3px;padding:2px 9px 11px 52px}.admin-navigation-v37 details>div>a{position:relative;display:flex;align-items:center;min-height:34px;padding:7px 10px;border-radius:9px;color:#aeb8ae;text-decoration:none;font-size:.77rem;font-weight:690;line-height:1.25;transition:background .16s,color .16s,padding .16s}.admin-navigation-v37 details>div>a:hover{padding-left:13px;background:rgba(255,255,255,.055);color:#fff}.admin-navigation-v37 details>div>a[aria-current="page"]{padding-left:15px;background:linear-gradient(90deg,rgba(116,190,44,.28),rgba(116,190,44,.08));color:#fff;box-shadow:inset 3px 0 #80c93d}.admin-navigation-v37 details>div>a[aria-current="page"]:after{content:"";position:absolute;right:9px;width:6px;height:6px;border-radius:50%;background:#87da47;box-shadow:0 0 0 4px rgba(135,218,71,.12)}.admin-navigation-v37 .admin-nav-home[aria-current="page"]{background:linear-gradient(135deg,rgba(111,184,48,.3),rgba(111,184,48,.1));border-color:rgba(130,209,61,.28);color:#fff;box-shadow:inset 3px 0 #82cd3d}.admin-navigation-v37 .admin-nav-home[aria-current="page"]>i{background:rgba(129,205,61,.2);color:#a9ef78}.admin-navigation-v37 .admin-nav-subheading{display:block;margin:8px 8px 3px;color:#647068;font-size:.59rem;font-weight:900;letter-spacing:.12em;text-transform:uppercase}.admin-navigation-v37 [data-admin-external] span{margin-left:auto;color:#758078;font-size:.68rem}.admin-navigation-v37 a:focus-visible,.admin-navigation-v37 summary:focus-visible{outline:2px solid #8bd85a;outline-offset:2px}@media(max-width:820px){.admin-sidebar{overflow:hidden}.admin-navigation-v37{padding-bottom:45px}.admin-navigation-v37>a,.admin-navigation-v37 summary{min-height:52px}} diff --git a/web/assets/advertising-v1.css b/web/assets/advertising-v1.css new file mode 100644 index 0000000..21e21ba --- /dev/null +++ b/web/assets/advertising-v1.css @@ -0,0 +1 @@ +.advertising-page{background:#f3f6f1;color:#182019}.advertising-hero{position:relative;overflow:hidden;background:radial-gradient(circle at 82% 18%,rgba(131,189,37,.24),transparent 28%),linear-gradient(135deg,#111713 0%,#1d2b20 58%,#0e120f 100%);color:#fff}.advertising-hero::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(0,0,0,.05),rgba(0,0,0,.3));pointer-events:none}.advertising-signal{position:absolute;right:-80px;top:-80px;width:430px;height:430px}.advertising-signal i{position:absolute;inset:20%;border:1px solid rgba(139,205,47,.25);border-radius:50%}.advertising-signal i:nth-child(2){inset:8%}.advertising-signal i:nth-child(3){inset:-5%}.advertising-hero-inner{position:relative;z-index:1;display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:70px;align-items:center;padding-top:105px;padding-bottom:80px}.advertising-hero-inner>div>span,.advertising-kicker{color:#90cb3a;font-size:12px;font-weight:950;letter-spacing:.11em;text-transform:uppercase}.advertising-hero h1{max-width:780px;margin:12px 0 18px;font-size:clamp(42px,6vw,82px);line-height:.98;color:#fff}.advertising-hero p{max-width:730px;color:#d6dfd4;font-size:clamp(17px,2vw,21px);line-height:1.65}.advertising-hero-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:30px}.advertising-hero-actions a{padding:13px 20px;border-radius:999px;background:#86c229;color:#13200f;font-weight:900;text-decoration:none}.advertising-hero-actions a.is-outline{border:1px solid rgba(255,255,255,.32);background:rgba(255,255,255,.08);color:#fff}.advertising-hero aside{padding:30px;border:1px solid rgba(255,255,255,.16);border-radius:24px;background:rgba(8,13,9,.55);box-shadow:0 24px 70px rgba(0,0,0,.28);backdrop-filter:blur(14px)}.advertising-hero aside strong{color:#92cf3a;font-size:12px;text-transform:uppercase}.advertising-hero aside b{display:block;margin:10px 0 8px;font-size:27px}.advertising-hero aside p{font-size:14px}.advertising-hero aside ul{display:grid;gap:8px;padding:0;list-style:none;color:#e5ebe3}.advertising-hero aside li::before{content:"✓";margin-right:9px;color:#8dcc31}.advertising-success{display:flex;gap:18px;align-items:center;margin-top:28px;padding:20px 24px;border:1px solid #b7d98d;border-radius:18px;background:#eaf6db}.advertising-success>span{display:grid;place-items:center;width:46px;height:46px;border-radius:50%;background:#72ad20;color:#fff;font-size:22px;font-weight:900}.advertising-success h2{margin:0 0 4px}.advertising-success p{margin:0;color:#52624e}.advertising-intro{display:grid;grid-template-columns:minmax(0,1fr) minmax(420px,.8fr);gap:45px;align-items:end;padding-top:72px;padding-bottom:35px}.advertising-intro h2{max-width:700px;margin:9px 0 12px;font-size:clamp(30px,4vw,48px)}.advertising-intro p{max-width:680px;color:#667064;line-height:1.7}.advertising-facts{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.advertising-facts article{padding:18px;border:1px solid #dce5d8;border-radius:16px;background:#fff}.advertising-facts strong{display:block;color:#72aa22}.advertising-facts span{display:block;margin-top:5px;color:#6b7469;font-size:12px;line-height:1.45}.advertising-options{padding-bottom:80px}.advertising-form{display:grid;gap:34px}.advertising-option-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.advertising-option{position:relative;min-height:225px;padding:24px;border:2px solid transparent;border-radius:22px;background:#fff;box-shadow:0 12px 35px rgba(25,40,20,.07);cursor:pointer;transition:.2s ease}.advertising-option:hover{transform:translateY(-3px);border-color:#c9ddb4}.advertising-option:has(input:checked){border-color:#7bb52a;background:linear-gradient(145deg,#fff,#eff8e6)}.advertising-option input{position:absolute;opacity:0;pointer-events:none}.advertising-option-check{position:absolute;right:18px;top:18px;display:grid;place-items:center;width:27px;height:27px;border:1px solid #d4ddd0;border-radius:50%;color:transparent}.advertising-option:has(input:checked) .advertising-option-check{border-color:#78b126;background:#78b126;color:#fff}.advertising-option-icon{display:grid;place-items:center;width:48px;height:48px;border-radius:15px;background:#172019;color:#91ca3a;font-size:24px}.advertising-option small{display:block;margin-top:17px;color:#78ac2c;font-size:10px;font-weight:950;text-transform:uppercase;letter-spacing:.08em}.advertising-option strong{display:block;margin-top:5px;font-size:19px}.advertising-option p{color:#687266;font-size:13px;line-height:1.55}.advertising-option em{color:#5e8e1f;font-size:12px;font-style:normal;font-weight:900}.advertising-request-card{padding:clamp(24px,5vw,52px);border-radius:28px;background:#fff;box-shadow:0 20px 60px rgba(18,31,15,.1)}.advertising-request-head{max-width:760px}.advertising-request-head h2{margin:7px 0 9px;font-size:clamp(30px,4vw,46px)}.advertising-request-head p{color:#687267}.advertising-error{margin:22px 0;padding:14px 16px;border-radius:12px;background:#ffe8e5;color:#9a2e24;font-weight:800}.advertising-field-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:28px}.advertising-field-grid label{display:grid;gap:7px}.advertising-field-grid label>span{color:#384337;font-size:12px;font-weight:850}.advertising-field-grid input,.advertising-field-grid select,.advertising-field-grid textarea{width:100%;box-sizing:border-box;padding:12px 13px;border:1px solid #cfd9cb;border-radius:12px;background:#fbfcfa;font:inherit}.advertising-field-grid input:focus,.advertising-field-grid select:focus,.advertising-field-grid textarea:focus{outline:3px solid rgba(124,183,40,.18);border-color:#7bb52a}.advertising-field-grid .is-wide{grid-column:1/-1}.advertising-consent{grid-template-columns:auto 1fr!important;align-items:start}.advertising-consent input{width:auto;margin-top:3px}.advertising-submit{margin-top:22px;padding:15px 22px;border:0;border-radius:999px;background:#172019;color:#fff;font-size:15px;font-weight:950;cursor:pointer}.advertising-submit span{margin-left:14px;color:#91cf39}.advertising-direct{color:#737c71;font-size:12px}.advertising-direct a{color:#5e911b;font-weight:900}.advertising-honeypot{position:absolute!important;left:-9999px!important}.advertising-process{padding:70px 0;background:#172019;color:#fff}.advertising-process h2{margin:8px 0 28px;color:#fff}.advertising-steps{display:grid;grid-template-columns:repeat(4,1fr);gap:15px}.advertising-steps article{padding:22px;border:1px solid rgba(255,255,255,.12);border-radius:18px;background:rgba(255,255,255,.04)}.advertising-steps b{color:#91cf39;font-size:24px}.advertising-steps h3{margin:15px 0 7px}.advertising-steps p{margin:0;color:#cbd5c9;font-size:13px;line-height:1.55}@media(max-width:1000px){.advertising-hero-inner{grid-template-columns:1fr}.advertising-hero aside{max-width:560px}.advertising-intro{grid-template-columns:1fr}.advertising-option-grid{grid-template-columns:repeat(2,1fr)}.advertising-steps{grid-template-columns:repeat(2,1fr)}}@media(max-width:650px){.advertising-hero-inner{padding-top:80px;padding-bottom:55px}.advertising-option-grid,.advertising-facts,.advertising-field-grid,.advertising-steps{grid-template-columns:1fr}.advertising-field-grid .is-wide{grid-column:auto}.advertising-request-card{border-radius:20px}.advertising-success{align-items:flex-start}} diff --git a/web/assets/ai-image-watermark-v1.css b/web/assets/ai-image-watermark-v1.css new file mode 100644 index 0000000..62c991e --- /dev/null +++ b/web/assets/ai-image-watermark-v1.css @@ -0,0 +1,7 @@ +/* Landwelle v1.5.25 – gezielt aktivierbares, sichtbares KI-Wasserzeichen */ +.public-watermarked-image,.story-card .media{position:relative;overflow:hidden}.public-watermarked-image>img{display:block;width:100%}.public-image-watermark{position:absolute;right:12px;bottom:12px;z-index:5;display:inline-flex;max-width:calc(100% - 24px);align-items:center;padding:8px 12px;border:1px solid rgba(255,255,255,.78);border-radius:8px;color:#fff;background:rgba(10,16,11,.9);box-shadow:0 5px 16px rgba(0,0,0,.34);font-size:12px;font-weight:900;line-height:1.2;letter-spacing:.02em;text-shadow:0 1px 2px #000}.story-card .public-image-watermark{right:8px;bottom:8px;max-width:calc(100% - 16px);padding:6px 9px;font-size:10px}.public-watermarked-figure{overflow:hidden}.public-watermarked-figure .public-watermarked-image{border-radius:inherit} +@media(max-width:650px){.public-image-watermark{right:8px;bottom:8px;max-width:calc(100% - 16px);padding:6px 9px;font-size:10px}} +.program-entry-image{position:relative;display:block;overflow:hidden;border-radius:10px}.program-entry-image>img{display:block;width:100%;height:100%;object-fit:cover}.program-entry-image .public-image-watermark{right:4px;bottom:4px;max-width:calc(100% - 8px);padding:4px 5px;font-size:7px} +.mediathek-cover{position:relative;overflow:hidden}.mediathek-cover .public-image-watermark{right:8px;bottom:8px;max-width:calc(100% - 16px);padding:6px 8px;font-size:9px} +.mediathek-cover{position:relative;overflow:hidden}.mediathek-cover .public-image-watermark{right:8px;bottom:8px;max-width:calc(100% - 16px);padding:6px 8px;font-size:9px} +.program-ai-presenter{display:inline-flex;width:max-content;margin-top:5px;padding:4px 7px;border-radius:999px;color:#fff;background:#5b3d72;font-size:9px;font-weight:900} diff --git a/web/assets/aktuelles-hero-v2.png b/web/assets/aktuelles-hero-v2.png new file mode 100644 index 0000000..0b5676b Binary files /dev/null and b/web/assets/aktuelles-hero-v2.png differ diff --git a/web/assets/antje-weiss-v21.png b/web/assets/antje-weiss-v21.png new file mode 100644 index 0000000..4ea26a9 Binary files /dev/null and b/web/assets/antje-weiss-v21.png differ diff --git a/web/assets/app-v16.js b/web/assets/app-v16.js new file mode 100644 index 0000000..18fd84d --- /dev/null +++ b/web/assets/app-v16.js @@ -0,0 +1,881 @@ +(() => { + 'use strict'; + + const CONSENT_KEY = 'landwelle-consent-v1'; + const CONSENT_COOKIE = 'landwelle_consent'; + const CONSENT_VERSION = 1; + const CONSENT_DAYS = 180; + + const parseJSON = (value) => { + try { + return JSON.parse(value); + } catch (_) { + return null; + } + }; + + const readCookie = (name) => { + try { + const prefix = `${name}=`; + const part = document.cookie + .split(';') + .map((item) => item.trim()) + .find((item) => item.startsWith(prefix)); + + if (!part) return null; + return decodeURIComponent(part.slice(prefix.length)); + } catch (_) { + return null; + } + }; + + const isValidConsent = (value) => { + if (!value || typeof value !== 'object') return false; + if (value.version !== CONSENT_VERSION || value.necessary !== true) return false; + if (typeof value.analytics !== 'boolean' || typeof value.externalMedia !== 'boolean') return false; + if (!value.expiresAt || Date.parse(value.expiresAt) <= Date.now()) return false; + return true; + }; + + const readConsent = () => { + let stored = null; + + try { + stored = parseJSON(window.localStorage.getItem(CONSENT_KEY)); + } catch (_) { + stored = null; + } + + if (!isValidConsent(stored)) { + stored = parseJSON(readCookie(CONSENT_COOKIE)); + } + + return isValidConsent(stored) ? stored : null; + }; + + const persistConsent = ({ analytics, externalMedia }) => { + const decidedAt = new Date(); + const expiresAt = new Date(decidedAt.getTime() + CONSENT_DAYS * 24 * 60 * 60 * 1000); + const consent = { + version: CONSENT_VERSION, + necessary: true, + analytics: Boolean(analytics), + externalMedia: Boolean(externalMedia), + decidedAt: decidedAt.toISOString(), + expiresAt: expiresAt.toISOString() + }; + const serialized = JSON.stringify(consent); + + let savedLocally = false; + try { + window.localStorage.setItem(CONSENT_KEY, serialized); + savedLocally = window.localStorage.getItem(CONSENT_KEY) === serialized; + } catch (_) { + savedLocally = false; + } + + try { + const secure = window.location.protocol === 'https:' ? '; Secure' : ''; + document.cookie = `${CONSENT_COOKIE}=${encodeURIComponent(serialized)}; Path=/; Max-Age=${CONSENT_DAYS * 86400}; SameSite=Lax${secure}`; + } catch (_) { + // Besonders restriktive Browser können beide Speicherwege blockieren. + } + + return consent; + }; + + const applyConsent = (consent) => { + const effective = consent || { + version: CONSENT_VERSION, + necessary: true, + analytics: false, + externalMedia: false + }; + + document.documentElement.dataset.consentNecessary = 'true'; + document.documentElement.dataset.consentAnalytics = String(effective.analytics === true); + document.documentElement.dataset.consentExternalMedia = String(effective.externalMedia === true); + + document.dispatchEvent(new CustomEvent('landwelle:consent-changed', { + detail: { ...effective } + })); + }; + + const initConsent = () => { + const layer = document.getElementById('cookie-consent'); + if (!layer) return; + + const dialog = layer.querySelector('.consent-dialog'); + const closeButton = layer.querySelector('[data-consent-close]'); + const settingsButton = layer.querySelector('[data-consent-settings]'); + const settingsPanel = layer.querySelector('#consent-settings-panel'); + const analyticsInput = layer.querySelector('[data-consent-category="analytics"]'); + const externalInput = layer.querySelector('[data-consent-category="externalMedia"]'); + const essentialButton = layer.querySelector('[data-consent-essential]'); + const saveButton = layer.querySelector('[data-consent-save]'); + const allButton = layer.querySelector('[data-consent-all]'); + const status = layer.querySelector('.consent-status'); + const openButtons = Array.from(document.querySelectorAll('[data-consent-open]')); + const pageSiblings = Array.from(document.body.children).filter((element) => element !== layer); + let previouslyFocused = null; + let currentConsent = readConsent(); + + const setStatus = (message) => { + if (status) status.textContent = message; + }; + + const setSettingsOpen = (open) => { + if (!settingsButton || !settingsPanel) return; + settingsButton.setAttribute('aria-expanded', String(open)); + settingsPanel.hidden = !open; + }; + + const populateInputs = (consent) => { + if (analyticsInput) analyticsInput.checked = Boolean(consent && consent.analytics); + if (externalInput) externalInput.checked = Boolean(consent && consent.externalMedia); + }; + + const setPageInert = (inert) => { + pageSiblings.forEach((element) => { + try { + element.inert = inert; + } catch (_) { + if (inert) element.setAttribute('aria-hidden', 'true'); + else element.removeAttribute('aria-hidden'); + } + }); + }; + + const openDialog = ({ reopen = false } = {}) => { + currentConsent = readConsent(); + previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null; + populateInputs(currentConsent); + setSettingsOpen(reopen); + setStatus(''); + + if (closeButton) closeButton.hidden = !currentConsent; + layer.hidden = false; + layer.setAttribute('aria-hidden', 'false'); + document.documentElement.classList.add('consent-open'); + setPageInert(true); + + window.requestAnimationFrame(() => { + if (dialog) dialog.focus({ preventScroll: true }); + }); + }; + + const closeDialog = () => { + if (!readConsent()) return; + layer.hidden = true; + layer.setAttribute('aria-hidden', 'true'); + document.documentElement.classList.remove('consent-open'); + setPageInert(false); + + if (previouslyFocused && document.contains(previouslyFocused)) { + previouslyFocused.focus({ preventScroll: true }); + } + }; + + const saveChoice = (analytics, externalMedia) => { + currentConsent = persistConsent({ analytics, externalMedia }); + applyConsent(currentConsent); + populateInputs(currentConsent); + setStatus('Deine Auswahl wurde gespeichert.'); + window.setTimeout(closeDialog, 180); + }; + + settingsButton?.addEventListener('click', () => { + const open = settingsButton.getAttribute('aria-expanded') !== 'true'; + setSettingsOpen(open); + }); + + essentialButton?.addEventListener('click', () => saveChoice(false, false)); + allButton?.addEventListener('click', () => saveChoice(true, true)); + saveButton?.addEventListener('click', () => { + saveChoice(Boolean(analyticsInput?.checked), Boolean(externalInput?.checked)); + }); + closeButton?.addEventListener('click', closeDialog); + openButtons.forEach((button) => button.addEventListener('click', () => openDialog({ reopen: true }))); + + layer.addEventListener('keydown', (event) => { + if (event.key === 'Escape') { + if (readConsent()) closeDialog(); + return; + } + + if (event.key !== 'Tab' || !dialog) return; + + const focusable = Array.from(dialog.querySelectorAll( + 'button:not([disabled]):not([hidden]), input:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])' + )).filter((element) => element instanceof HTMLElement && element.offsetParent !== null); + + if (focusable.length === 0) { + event.preventDefault(); + dialog.focus(); + return; + } + + const first = focusable[0]; + const last = focusable[focusable.length - 1]; + + if (event.shiftKey && document.activeElement === first) { + event.preventDefault(); + last.focus(); + } else if (!event.shiftKey && document.activeElement === last) { + event.preventDefault(); + first.focus(); + } + }); + + window.landwelleConsent = Object.freeze({ + get: () => readConsent(), + has: (category) => { + const consent = readConsent(); + if (category === 'necessary') return true; + return Boolean(consent && consent[category] === true); + }, + open: () => openDialog({ reopen: true }) + }); + + applyConsent(currentConsent); + if (!currentConsent) openDialog(); + }; + + const initPlayer = () => { + const audio = document.getElementById('live-audio'); + const playerSurfaces = Array.from(document.querySelectorAll('.live-player')); + const statuses = Array.from(document.querySelectorAll('[data-player-message]')); + const playTriggers = Array.from(document.querySelectorAll('[data-play-trigger]')); + const openButtons = Array.from(document.querySelectorAll('[data-player-open]')); + const volumeInputs = Array.from(document.querySelectorAll('[data-volume]')); + const menuButton = document.querySelector('.menu-toggle'); + const nav = document.querySelector('.main-nav'); + const popupName = 'landwelleRadioPlayer'; + const playbackID = `portal-${Date.now()}-${Math.random().toString(16).slice(2)}`; + const playbackChannel = 'BroadcastChannel' in window + ? new BroadcastChannel('landwelle-radio-playback') + : null; + let popupWindow = null; + + const showStatus = (message) => { + statuses.forEach((element) => { element.textContent = message; }); + }; + + const setPlaying = (playing) => { + playerSurfaces.forEach((surface) => surface.classList.toggle('is-playing', playing)); + playTriggers.forEach((button) => { + button.setAttribute('aria-pressed', String(playing)); + button.setAttribute('aria-label', playing ? 'Livestream pausieren' : 'Livestream abspielen'); + }); + }; + + const announcePlayback = () => { + playbackChannel?.postMessage({ type: 'playing', source: playbackID }); + }; + + const toggleAudio = async () => { + if (!audio) { + showStatus('Der Audioplayer ist auf dieser Seite nicht verfügbar.'); + return; + } + + if (!audio.currentSrc && !audio.getAttribute('src')) { + showStatus('Der Livestream ist noch nicht konfiguriert.'); + return; + } + + try { + if (audio.paused) { + showStatus('Livestream wird verbunden …'); + await audio.play(); + showStatus('Landwelle läuft live.'); + } else { + audio.pause(); + showStatus('Livestream pausiert.'); + } + } catch (error) { + setPlaying(false); + showStatus('Der Livestream konnte gerade nicht gestartet werden.'); + console.error('Landwelle-Player:', error); + } + }; + + const closeMobileNav = () => { + if (!menuButton || !nav) return; + nav.classList.remove('is-open'); + menuButton.setAttribute('aria-expanded', 'false'); + }; + + const popupFeatures = () => { + const availableWidth = Math.max(420, window.screen?.availWidth || 1100); + const availableHeight = Math.max(560, window.screen?.availHeight || 820); + const width = Math.min(980, Math.max(420, availableWidth - 60)); + const height = Math.min(740, Math.max(560, availableHeight - 70)); + const left = Math.max(0, Math.round((window.screenX || 0) + ((window.outerWidth || availableWidth) - width) / 2)); + const top = Math.max(0, Math.round((window.screenY || 0) + ((window.outerHeight || availableHeight) - height) / 2)); + return `popup=yes,width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`; + }; + + const openPlayerWindow = () => { + closeMobileNav(); + const destination = new URL('/player?autoplay=1', window.location.href).href; + + try { + if (!popupWindow || popupWindow.closed) { + popupWindow = window.open('', popupName, popupFeatures()); + } + } catch (_) { + popupWindow = null; + } + + if (!popupWindow) { + showStatus('Der Browser hat das Popup blockiert. Der Player wird stattdessen in einem neuen Tab geöffnet.'); + return null; + } + + try { + const alreadyPlayer = popupWindow.location.origin === window.location.origin + && popupWindow.location.pathname === '/player'; + if (!alreadyPlayer) { + popupWindow.location.replace(destination); + } else { + popupWindow.landwelleStandalonePlayer?.play(); + } + } catch (_) { + popupWindow.location.href = destination; + } + + if (audio && !audio.paused) audio.pause(); + showStatus('Der Landwelle-Player wurde in einem eigenen Fenster geöffnet.'); + window.setTimeout(() => { + try { popupWindow?.focus(); } catch (_) { /* Browser entscheidet über Fokus. */ } + }, 60); + return popupWindow; + }; + + playTriggers.forEach((button) => button.addEventListener('click', toggleAudio)); + openButtons.forEach((link) => link.addEventListener('click', (event) => { + const popup = openPlayerWindow(); + if (popup) event.preventDefault(); + })); + + if (audio) { + let storedVolume = Number.NaN; + try { storedVolume = Number(window.localStorage.getItem('landwelle-player-volume')); } catch (_) { /* optional */ } + const initialVolume = Number.isFinite(storedVolume) + ? storedVolume + : Number(volumeInputs[0]?.value ?? 0.8); + audio.volume = Math.min(1, Math.max(0, Number.isFinite(initialVolume) ? initialVolume : 0.8)); + setPlaying(!audio.paused); + audio.addEventListener('play', () => { + setPlaying(true); + announcePlayback(); + }); + audio.addEventListener('pause', () => setPlaying(false)); + audio.addEventListener('ended', () => setPlaying(false)); + audio.addEventListener('waiting', () => showStatus('Livestream wird gepuffert …')); + audio.addEventListener('playing', () => showStatus('Landwelle läuft live.')); + audio.addEventListener('error', () => { + setPlaying(false); + showStatus('Der Stream ist momentan nicht erreichbar.'); + }); + } + + playbackChannel?.addEventListener('message', (event) => { + if (event.data?.type !== 'playing' || event.data?.source === playbackID) return; + if (audio && !audio.paused) { + audio.pause(); + showStatus('Die Wiedergabe läuft jetzt im eigenständigen Landwelle-Player.'); + } + }); + + volumeInputs.forEach((input) => { + input.value = String(audio?.volume ?? Number(input.value)); + input.addEventListener('input', () => { + const value = Number(input.value); + if (audio && Number.isFinite(value)) audio.volume = value; + try { window.localStorage.setItem('landwelle-player-volume', String(value)); } catch (_) { /* optional */ } + volumeInputs.forEach((other) => { + if (other !== input) other.value = input.value; + }); + }); + }); + + if (menuButton && nav) { + menuButton.addEventListener('click', () => { + const open = nav.classList.toggle('is-open'); + menuButton.setAttribute('aria-expanded', String(open)); + }); + + nav.querySelectorAll('a').forEach((link) => link.addEventListener('click', closeMobileNav)); + } + + window.addEventListener('pagehide', () => playbackChannel?.close(), { once: true }); + + window.landwellePlayer = Object.freeze({ + open: openPlayerWindow, + close: () => { + try { popupWindow?.close(); } catch (_) { /* Popup kann bereits geschlossen sein. */ } + }, + toggle: toggleAudio, + isPlaying: () => Boolean(audio && !audio.paused) + }); + }; + + const initNowPlaying = () => { + const artistFields = Array.from(document.querySelectorAll('[data-now-artist]')); + const titleFields = Array.from(document.querySelectorAll('[data-now-title]')); + const liveBadges = Array.from(document.querySelectorAll('[data-now-live-badge]')); + const listenerFields = Array.from(document.querySelectorAll('[data-now-listeners]')); + const coverImages = Array.from(document.querySelectorAll('[data-now-cover]')); + const surfaces = Array.from(document.querySelectorAll('.live-player')); + if (artistFields.length === 0 && titleFields.length === 0) return; + + let currentCover = coverImages[0]?.getAttribute('src') || ''; + let stopped = false; + let timer = 0; + let loading = false; + + const setAll = (elements, value, fallback = '–') => { + elements.forEach((element) => { element.textContent = String(value || fallback); }); + }; + + const normalizeCoverURL = (url) => { + if (!url) return ''; + try { + const parsed = new URL(url, window.location.origin); + if (parsed.pathname.startsWith('/api/v1/covers/') || parsed.pathname.startsWith('/assets/')) { + return `${parsed.pathname}${parsed.search}`; + } + } catch (_) { + // Relative Landwelle URLs are already suitable. + } + return url; + }; + + const updateCover = (url, artistName, titleName) => { + const displayURL = normalizeCoverURL(url); + if (!displayURL || displayURL === currentCover || coverImages.length === 0) return; + currentCover = displayURL; + const coverBoxes = coverImages + .map((image) => image.closest('.track-cover')) + .filter(Boolean); + coverBoxes.forEach((box) => box.classList.add('is-loading')); + const preload = new Image(); + preload.onload = () => { + coverImages.forEach((image) => { + image.src = displayURL; + image.alt = `Cover zu ${artistName || 'Landwelle'} – ${titleName || 'Livestream'}`; + }); + coverBoxes.forEach((box) => box.classList.remove('is-loading')); + }; + preload.onerror = () => coverBoxes.forEach((box) => box.classList.remove('is-loading')); + preload.src = displayURL; + }; + + const schedule = () => { + window.clearTimeout(timer); + timer = window.setTimeout(load, document.hidden ? 30000 : 15000); + }; + + const load = async () => { + if (stopped || loading) return; + loading = true; + try { + const response = await fetch('/api/v1/now', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const payload = await response.json(); + const now = payload?.data; + if (!now) throw new Error('Ungültige Now-Playing-Daten'); + + setAll(artistFields, now.artist, 'Landwelle Radio'); + setAll(titleFields, now.title, 'Live aus Niedersachsen'); + setAll(listenerFields, Number.isFinite(Number(now.listeners)) ? Number(now.listeners) : 0, '0'); + + liveBadges.forEach((badge) => { badge.textContent = now.live ? 'LIVE' : 'ON AIR'; }); + surfaces.forEach((surface) => surface.classList.toggle('is-stale', Boolean(now.stale))); + updateCover(now.cover_url, now.artist, now.title); + } catch (error) { + surfaces.forEach((surface) => surface.classList.add('is-stale')); + console.error('Landwelle Now Playing:', error); + } finally { + loading = false; + schedule(); + } + }; + + document.addEventListener('visibilitychange', () => { + if (!document.hidden) { + window.clearTimeout(timer); + load(); + } + }); + window.addEventListener('pagehide', () => { + stopped = true; + window.clearTimeout(timer); + }, { once: true }); + load(); + }; + + const initCurrentProgram = () => { + const programFields = Array.from(document.querySelectorAll('[data-current-program]')); + const presenterFields = Array.from(document.querySelectorAll('[data-current-program-presenter]')); + if (programFields.length === 0 && presenterFields.length === 0) return; + + let timer = 0; + let loading = false; + let stopped = false; + + const setAll = (elements, value) => elements.forEach((element) => { element.textContent = value; }); + const schedule = () => { + window.clearTimeout(timer); + timer = window.setTimeout(load, document.hidden ? 120000 : 60000); + }; + const render = (program) => { + if (!program) { + setAll(programFields, 'Landwelle Radio · rund um die Uhr'); + setAll(presenterFields, 'Sound & Infos aus Niedersachsen'); + return; + } + const time = program.start && program.end ? `${program.start}–${program.end} Uhr` : (program.time_label || 'jetzt live'); + setAll(programFields, `${program.show || 'Landwelle Radio'} · ${time}`); + const details = []; + if (program.presenter) details.push(`mit ${program.presenter}`); + if (program.program_type) details.push(program.program_type); + setAll(presenterFields, details.join(' · ') || 'Sound & Infos aus Niedersachsen'); + }; + const load = async () => { + if (stopped || loading) return; + loading = true; + try { + const response = await fetch('/api/v1/program/current', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const payload = await response.json(); + render(payload?.data || null); + } catch (error) { + render(null); + console.error('Landwelle-Programm:', error); + } finally { + loading = false; + schedule(); + } + }; + + document.addEventListener('visibilitychange', () => { + if (!document.hidden) { + window.clearTimeout(timer); + load(); + } + }); + window.addEventListener('pagehide', () => { + stopped = true; + window.clearTimeout(timer); + }, { once: true }); + load(); + }; + + const initWeather = () => { + const widget = document.querySelector('[data-weather-widget]'); + if (!widget) return; + + const setText = (selector, value) => { + const element = widget.querySelector(selector); + if (element) element.textContent = value; + }; + + const forecastElement = widget.querySelector('[data-weather-forecast]'); + widget.classList.add('is-loading'); + + fetch('/api/v1/weather', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }) + .then((response) => { + if (!response.ok) throw new Error(`HTTP ${response.status}`); + return response.json(); + }) + .then((payload) => { + const weather = payload && payload.data; + if (!weather || !weather.current) throw new Error('Ungültige Wetterdaten'); + + setText('[data-weather-location]', weather.location || 'Visselhövede'); + setText('[data-weather-icon]', weather.current.icon || '🌤️'); + setText('[data-weather-temperature]', `${Math.round(weather.current.temperature)}°`); + setText('[data-weather-description]', weather.current.description || 'wechselhaft'); + setText('[data-weather-apparent]', `Gefühlt ${Math.round(weather.current.apparent_temperature)}°`); + setText('[data-weather-wind]', `${weather.current.wind_direction || '–'} ${Math.round(weather.current.wind_speed)} km/h`); + setText('[data-weather-rain]', `Regen ${weather.current.rain_probability ?? 0} %`); + setText('[data-weather-uv]', `UV ${Number(weather.current.uv_index || 0).toFixed(1)}`); + + if (forecastElement) { + forecastElement.replaceChildren(); + (weather.forecast || []).slice(0, 4).forEach((day) => { + const item = document.createElement('span'); + const weekday = document.createTextNode(day.weekday || '–'); + const icon = document.createElement('small'); + icon.className = 'weather-forecast-icon'; + icon.textContent = day.icon || '🌤️'; + icon.title = day.description || ''; + const temperatures = document.createElement('b'); + temperatures.append(document.createTextNode(`${Math.round(day.temperature_max)}° `)); + const minimum = document.createElement('em'); + minimum.textContent = `${Math.round(day.temperature_min)}°`; + temperatures.append(minimum); + item.append(weekday, icon, temperatures); + forecastElement.append(item); + }); + } + + const fetchedAt = weather.fetched_at ? new Date(weather.fetched_at) : new Date(); + const label = Number.isNaN(fetchedAt.getTime()) + ? '' + : `Aktualisiert ${fetchedAt.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' })} Uhr${weather.stale ? ' · zwischengespeichert' : ''}`; + setText('[data-weather-updated]', label); + widget.classList.remove('is-error'); + }) + .catch((error) => { + widget.classList.add('is-error'); + setText('[data-weather-description]', 'Wetter derzeit nicht erreichbar'); + setText('[data-weather-apparent]', 'Bitte später erneut versuchen'); + setText('[data-weather-updated]', ''); + console.error('Landwelle-Wetter:', error); + }) + .finally(() => widget.classList.remove('is-loading')); + }; + + + const initTrafficSummary = () => { + const count = document.querySelector('[data-traffic-count]'); + const label = document.querySelector('[data-traffic-label]'); + if (!count) return; + fetch('/api/v1/traffic', { headers: { Accept: 'application/json' }, cache: 'no-store' }) + .then((response) => { + if (!response.ok) throw new Error(`HTTP ${response.status}`); + return response.json(); + }) + .then((payload) => { + const traffic = Array.isArray(payload?.data?.traffic) ? payload.data.traffic.length : 0; + const cameras = Array.isArray(payload?.data?.speed_cameras) ? payload.data.speed_cameras.length : 0; + count.textContent = String(traffic + cameras); + if (label) label.textContent = `${traffic} Verkehrs- und ${cameras} Blitzermeldungen`; + }) + .catch(() => { + count.textContent = '–'; + if (label) label.textContent = 'Live-Daten werden erneut geladen'; + }); + }; + + const init = () => { + initConsent(); + initPlayer(); + initNowPlaying(); + initCurrentProgram(); + initWeather(); + initTrafficSummary(); + }; + + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', init, { once: true }); + } else { + init(); + } +})(); + +// Radio dropdown navigation +(() => { + const dropdowns = document.querySelectorAll('[data-nav-dropdown]'); + dropdowns.forEach((dropdown) => { + const button = dropdown.querySelector('.nav-dropdown-toggle'); + if (!button) return; + const close = () => { + dropdown.classList.remove('is-open'); + button.setAttribute('aria-expanded', 'false'); + }; + button.addEventListener('click', (event) => { + event.stopPropagation(); + const willOpen = !dropdown.classList.contains('is-open'); + dropdowns.forEach((other) => { + other.classList.remove('is-open'); + const otherButton = other.querySelector('.nav-dropdown-toggle'); + if (otherButton) otherButton.setAttribute('aria-expanded', 'false'); + }); + if (willOpen) { + dropdown.classList.add('is-open'); + button.setAttribute('aria-expanded', 'true'); + } + }); + dropdown.addEventListener('keydown', (event) => { + if (event.key === 'Escape') { + close(); + button.focus(); + } + }); + document.addEventListener('click', (event) => { + if (!dropdown.contains(event.target)) close(); + }); + }); +})(); + +(() => { + const modal = document.querySelector('[data-auth-modal]'); + if (!modal) return; + const open = () => { modal.hidden = false; document.body.style.overflow = 'hidden'; modal.querySelector('input')?.focus(); }; + const close = () => { modal.hidden = true; document.body.style.overflow = ''; }; + document.querySelectorAll('[data-auth-open]').forEach((button) => button.addEventListener('click', open)); + modal.querySelectorAll('[data-auth-close]').forEach((button) => button.addEventListener('click', close)); + modal.querySelectorAll('[data-auth-tab]').forEach((button) => button.addEventListener('click', () => { + modal.querySelectorAll('[data-auth-tab]').forEach((b) => b.classList.toggle('is-active', b === button)); + modal.querySelectorAll('[data-auth-panel]').forEach((panel) => panel.classList.toggle('is-active', panel.dataset.authPanel === button.dataset.authTab)); + })); + document.addEventListener('keydown', (event) => { if (event.key === 'Escape' && !modal.hidden) close(); }); +})(); + +(() => { + const button = document.querySelector('.account-button'); + if (!button) return; + + fetch('/account/session', { credentials: 'same-origin', cache: 'no-store', headers: { Accept: 'application/json' } }) + .then((response) => response.ok ? response.json() : null) + .then((session) => { + if (!session?.authenticated || !session.user) return; + + const user = session.user; + const replacement = button.cloneNode(false); + replacement.className = 'account-button account-button-user'; + replacement.type = 'button'; + replacement.removeAttribute('data-auth-open'); + replacement.setAttribute('aria-expanded', 'false'); + replacement.setAttribute('aria-haspopup', 'menu'); + replacement.innerHTML = ``; + + const menu = document.createElement('div'); + menu.className = 'account-menu'; + menu.hidden = true; + menu.innerHTML = ` + + Forum öffnen + Neues Thema erstellen +
`; + + const wrap = document.createElement('div'); + wrap.className = 'account-dropdown'; + button.replaceWith(wrap); + wrap.append(replacement, menu); + + const close = () => { + menu.hidden = true; + wrap.classList.remove('is-open'); + replacement.setAttribute('aria-expanded', 'false'); + }; + replacement.addEventListener('click', (event) => { + event.stopPropagation(); + const opening = menu.hidden; + if (opening) { + menu.hidden = false; + wrap.classList.add('is-open'); + replacement.setAttribute('aria-expanded', 'true'); + } else close(); + }); + document.addEventListener('click', (event) => { if (!wrap.contains(event.target)) close(); }); + document.addEventListener('keydown', (event) => { + if (event.key === 'Escape' && !menu.hidden) { + close(); + replacement.focus(); + } + }); + }) + .catch(() => {}); + + function escapeAccountText(value) { + return String(value || '').replace(/[&<>"']/g, (character) => ({ + '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' + })[character]); + } +})(); + +(() => { + 'use strict'; + const VISITOR_KEY = 'landwelle-analytics-visitor-v1'; + const SESSION_KEY = 'landwelle-analytics-session-v1'; + const SESSION_TTL = 30 * 60 * 1000; + let sent = false; + + const uuid = () => { + if (window.crypto?.randomUUID) return window.crypto.randomUUID(); + if (window.crypto?.getRandomValues) { + const values = new Uint8Array(16); + window.crypto.getRandomValues(values); + return [...values].map((value) => value.toString(16).padStart(2, '0')).join(''); + } + return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`; + }; + const read = (key) => { + try { return JSON.parse(window.localStorage.getItem(key) || 'null'); } catch (_) { return null; } + }; + const write = (key, value) => { + try { window.localStorage.setItem(key, JSON.stringify(value)); } catch (_) {} + }; + const identity = () => { + let visitor = read(VISITOR_KEY); + if (!visitor?.id) { + visitor = { id: uuid(), createdAt: new Date().toISOString() }; + write(VISITOR_KEY, visitor); + } + let session = read(SESSION_KEY); + const now = Date.now(); + if (!session?.id || !session.lastSeen || now - Number(session.lastSeen) > SESSION_TTL) { + session = { id: uuid(), startedAt: now, lastSeen: now }; + } else { + session.lastSeen = now; + } + write(SESSION_KEY, session); + return { visitorID: visitor.id, sessionID: session.id }; + }; + const referrerHost = () => { + if (!document.referrer) return ''; + try { + const host = new URL(document.referrer).hostname.toLowerCase(); + return host === window.location.hostname.toLowerCase() ? '' : host; + } catch (_) { return ''; } + }; + const send = () => { + if (sent || window.location.pathname.startsWith('/admin')) return; + if (navigator.globalPrivacyControl === true || navigator.doNotTrack === '1') return; + if (!window.landwelleConsent?.has('analytics')) return; + sent = true; + const ids = identity(); + const payload = JSON.stringify({ + visitor_id: ids.visitorID, + session_id: ids.sessionID, + path: `${window.location.pathname}${window.location.search}`, + page_title: document.title || '', + referrer_host: referrerHost(), + consent: true + }); + if (navigator.sendBeacon) { + const blob = new Blob([payload], { type: 'application/json' }); + if (navigator.sendBeacon('/api/site-analytics/pageview', blob)) return; + } + fetch('/api/site-analytics/pageview', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: payload, + keepalive: true, + credentials: 'same-origin' + }).catch(() => {}); + }; + document.addEventListener('landwelle:consent-changed', (event) => { + if (event.detail?.analytics === true) send(); + }); + if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', send, { once: true }); + else send(); +})(); diff --git a/web/assets/app-v17.js b/web/assets/app-v17.js new file mode 100644 index 0000000..1da8be7 --- /dev/null +++ b/web/assets/app-v17.js @@ -0,0 +1,952 @@ +(() => { + 'use strict'; + + const CONSENT_KEY = 'landwelle-consent-v1'; + const CONSENT_COOKIE = 'landwelle_consent'; + const CONSENT_VERSION = 1; + const CONSENT_DAYS = 180; + + const parseJSON = (value) => { + try { + return JSON.parse(value); + } catch (_) { + return null; + } + }; + + const readCookie = (name) => { + try { + const prefix = `${name}=`; + const part = document.cookie + .split(';') + .map((item) => item.trim()) + .find((item) => item.startsWith(prefix)); + + if (!part) return null; + return decodeURIComponent(part.slice(prefix.length)); + } catch (_) { + return null; + } + }; + + const isValidConsent = (value) => { + if (!value || typeof value !== 'object') return false; + if (value.version !== CONSENT_VERSION || value.necessary !== true) return false; + if (typeof value.analytics !== 'boolean' || typeof value.externalMedia !== 'boolean') return false; + if (!value.expiresAt || Date.parse(value.expiresAt) <= Date.now()) return false; + return true; + }; + + const readConsent = () => { + let stored = null; + + try { + stored = parseJSON(window.localStorage.getItem(CONSENT_KEY)); + } catch (_) { + stored = null; + } + + if (!isValidConsent(stored)) { + stored = parseJSON(readCookie(CONSENT_COOKIE)); + } + + return isValidConsent(stored) ? stored : null; + }; + + const persistConsent = ({ analytics, externalMedia }) => { + const decidedAt = new Date(); + const expiresAt = new Date(decidedAt.getTime() + CONSENT_DAYS * 24 * 60 * 60 * 1000); + const consent = { + version: CONSENT_VERSION, + necessary: true, + analytics: Boolean(analytics), + externalMedia: Boolean(externalMedia), + decidedAt: decidedAt.toISOString(), + expiresAt: expiresAt.toISOString() + }; + const serialized = JSON.stringify(consent); + + let savedLocally = false; + try { + window.localStorage.setItem(CONSENT_KEY, serialized); + savedLocally = window.localStorage.getItem(CONSENT_KEY) === serialized; + } catch (_) { + savedLocally = false; + } + + try { + const secure = window.location.protocol === 'https:' ? '; Secure' : ''; + document.cookie = `${CONSENT_COOKIE}=${encodeURIComponent(serialized)}; Path=/; Max-Age=${CONSENT_DAYS * 86400}; SameSite=Lax${secure}`; + } catch (_) { + // Besonders restriktive Browser können beide Speicherwege blockieren. + } + + return consent; + }; + + const applyConsent = (consent) => { + const effective = consent || { + version: CONSENT_VERSION, + necessary: true, + analytics: false, + externalMedia: false + }; + + document.documentElement.dataset.consentNecessary = 'true'; + document.documentElement.dataset.consentAnalytics = String(effective.analytics === true); + document.documentElement.dataset.consentExternalMedia = String(effective.externalMedia === true); + + document.dispatchEvent(new CustomEvent('landwelle:consent-changed', { + detail: { ...effective } + })); + }; + + const initConsent = () => { + const layer = document.getElementById('cookie-consent'); + if (!layer) return; + + const dialog = layer.querySelector('.consent-dialog'); + const closeButton = layer.querySelector('[data-consent-close]'); + const settingsButton = layer.querySelector('[data-consent-settings]'); + const settingsPanel = layer.querySelector('#consent-settings-panel'); + const analyticsInput = layer.querySelector('[data-consent-category="analytics"]'); + const externalInput = layer.querySelector('[data-consent-category="externalMedia"]'); + const essentialButton = layer.querySelector('[data-consent-essential]'); + const saveButton = layer.querySelector('[data-consent-save]'); + const allButton = layer.querySelector('[data-consent-all]'); + const status = layer.querySelector('.consent-status'); + const openButtons = Array.from(document.querySelectorAll('[data-consent-open]')); + const pageSiblings = Array.from(document.body.children).filter((element) => element !== layer); + let previouslyFocused = null; + let currentConsent = readConsent(); + + const setStatus = (message) => { + if (status) status.textContent = message; + }; + + const setSettingsOpen = (open) => { + if (!settingsButton || !settingsPanel) return; + settingsButton.setAttribute('aria-expanded', String(open)); + settingsPanel.hidden = !open; + }; + + const populateInputs = (consent) => { + if (analyticsInput) analyticsInput.checked = Boolean(consent && consent.analytics); + if (externalInput) externalInput.checked = Boolean(consent && consent.externalMedia); + }; + + const setPageInert = (inert) => { + pageSiblings.forEach((element) => { + try { + element.inert = inert; + } catch (_) { + if (inert) element.setAttribute('aria-hidden', 'true'); + else element.removeAttribute('aria-hidden'); + } + }); + }; + + const openDialog = ({ reopen = false } = {}) => { + currentConsent = readConsent(); + previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null; + populateInputs(currentConsent); + setSettingsOpen(reopen); + setStatus(''); + + if (closeButton) closeButton.hidden = !currentConsent; + layer.hidden = false; + layer.setAttribute('aria-hidden', 'false'); + document.documentElement.classList.add('consent-open'); + setPageInert(true); + + window.requestAnimationFrame(() => { + if (dialog) dialog.focus({ preventScroll: true }); + }); + }; + + const closeDialog = () => { + if (!readConsent()) return; + layer.hidden = true; + layer.setAttribute('aria-hidden', 'true'); + document.documentElement.classList.remove('consent-open'); + setPageInert(false); + + if (previouslyFocused && document.contains(previouslyFocused)) { + previouslyFocused.focus({ preventScroll: true }); + } + }; + + const saveChoice = (analytics, externalMedia) => { + currentConsent = persistConsent({ analytics, externalMedia }); + applyConsent(currentConsent); + populateInputs(currentConsent); + setStatus('Deine Auswahl wurde gespeichert.'); + window.setTimeout(closeDialog, 180); + }; + + settingsButton?.addEventListener('click', () => { + const open = settingsButton.getAttribute('aria-expanded') !== 'true'; + setSettingsOpen(open); + }); + + essentialButton?.addEventListener('click', () => saveChoice(false, false)); + allButton?.addEventListener('click', () => saveChoice(true, true)); + saveButton?.addEventListener('click', () => { + saveChoice(Boolean(analyticsInput?.checked), Boolean(externalInput?.checked)); + }); + closeButton?.addEventListener('click', closeDialog); + openButtons.forEach((button) => button.addEventListener('click', () => openDialog({ reopen: true }))); + + layer.addEventListener('keydown', (event) => { + if (event.key === 'Escape') { + if (readConsent()) closeDialog(); + return; + } + + if (event.key !== 'Tab' || !dialog) return; + + const focusable = Array.from(dialog.querySelectorAll( + 'button:not([disabled]):not([hidden]), input:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])' + )).filter((element) => element instanceof HTMLElement && element.offsetParent !== null); + + if (focusable.length === 0) { + event.preventDefault(); + dialog.focus(); + return; + } + + const first = focusable[0]; + const last = focusable[focusable.length - 1]; + + if (event.shiftKey && document.activeElement === first) { + event.preventDefault(); + last.focus(); + } else if (!event.shiftKey && document.activeElement === last) { + event.preventDefault(); + first.focus(); + } + }); + + window.landwelleConsent = Object.freeze({ + get: () => readConsent(), + has: (category) => { + const consent = readConsent(); + if (category === 'necessary') return true; + return Boolean(consent && consent[category] === true); + }, + open: () => openDialog({ reopen: true }) + }); + + applyConsent(currentConsent); + if (!currentConsent) openDialog(); + }; + + const initPlayer = () => { + const audio = document.getElementById('live-audio'); + const playerSurfaces = Array.from(document.querySelectorAll('.live-player')); + const statuses = Array.from(document.querySelectorAll('[data-player-message]')); + const playTriggers = Array.from(document.querySelectorAll('[data-play-trigger]')); + const openButtons = Array.from(document.querySelectorAll('[data-player-open]')); + const volumeInputs = Array.from(document.querySelectorAll('[data-volume]')); + const menuButton = document.querySelector('.menu-toggle'); + const nav = document.querySelector('.main-nav'); + const popupName = 'landwelleRadioPlayer'; + const playbackID = `portal-${Date.now()}-${Math.random().toString(16).slice(2)}`; + const playbackChannel = 'BroadcastChannel' in window + ? new BroadcastChannel('landwelle-radio-playback') + : null; + let popupWindow = null; + const streamURL = audio?.dataset.streamSrc || ''; + const prerollURL = audio?.dataset.prerollSrc || ''; + let playbackPhase = 'idle'; + let prerollCompleted = !prerollURL; + let prerollTransitioning = false; + + const showStatus = (message) => { + statuses.forEach((element) => { element.textContent = message; }); + }; + + const setPlaying = (playing) => { + playerSurfaces.forEach((surface) => surface.classList.toggle('is-playing', playing)); + playTriggers.forEach((button) => { + button.setAttribute('aria-pressed', String(playing)); + button.setAttribute('aria-label', playing ? 'Livestream pausieren' : 'Livestream abspielen'); + }); + }; + + const announcePlayback = () => { + playbackChannel?.postMessage({ type: 'playing', source: playbackID }); + }; + + const setAudioSource = (source, phase) => { + if (!audio || !source) return; + playbackPhase = phase; + if (audio.getAttribute('src') === source) return; + audio.src = source; + audio.load(); + }; + + const startLiveStream = async () => { + if (!audio || !streamURL || prerollTransitioning) return; + prerollTransitioning = true; + prerollCompleted = true; + try { + setAudioSource(streamURL, 'stream'); + showStatus('Livestream wird verbunden …'); + await audio.play(); + } finally { + prerollTransitioning = false; + } + }; + + const startPlayback = async () => { + if (!audio) { + showStatus('Der Audioplayer ist auf dieser Seite nicht verfügbar.'); + return; + } + if (!streamURL) { + showStatus('Der Livestream ist noch nicht konfiguriert.'); + return; + } + + if (!prerollCompleted && prerollURL) { + if (playbackPhase !== 'preroll') { + setAudioSource(prerollURL, 'preroll'); + try { audio.currentTime = 0; } catch (_) { /* Browser lädt erst Metadaten. */ } + } + showStatus('KI-Transparenzhinweis wird vor dem Livestream abgespielt …'); + await audio.play(); + return; + } + + if (playbackPhase !== 'stream') setAudioSource(streamURL, 'stream'); + showStatus('Livestream wird verbunden …'); + await audio.play(); + }; + + const toggleAudio = async () => { + try { + if (!audio) { + showStatus('Der Audioplayer ist auf dieser Seite nicht verfügbar.'); + return; + } + if (audio.paused) { + await startPlayback(); + } else { + audio.pause(); + showStatus(playbackPhase === 'preroll' ? 'KI-Transparenzhinweis pausiert.' : 'Livestream pausiert.'); + } + } catch (error) { + setPlaying(false); + showStatus('Der Livestream konnte gerade nicht gestartet werden.'); + console.error('Landwelle-Player:', error); + } + }; + + const closeMobileNav = () => { + if (!menuButton || !nav) return; + nav.classList.remove('is-open'); + menuButton.setAttribute('aria-expanded', 'false'); + }; + + const popupFeatures = () => { + const availableWidth = Math.max(420, window.screen?.availWidth || 1100); + const availableHeight = Math.max(560, window.screen?.availHeight || 820); + const width = Math.min(980, Math.max(420, availableWidth - 60)); + const height = Math.min(740, Math.max(560, availableHeight - 70)); + const left = Math.max(0, Math.round((window.screenX || 0) + ((window.outerWidth || availableWidth) - width) / 2)); + const top = Math.max(0, Math.round((window.screenY || 0) + ((window.outerHeight || availableHeight) - height) / 2)); + return `popup=yes,width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`; + }; + + const openPlayerWindow = () => { + closeMobileNav(); + const destination = new URL('/player?autoplay=1', window.location.href).href; + + try { + if (!popupWindow || popupWindow.closed) { + popupWindow = window.open('', popupName, popupFeatures()); + } + } catch (_) { + popupWindow = null; + } + + if (!popupWindow) { + showStatus('Der Browser hat das Popup blockiert. Der Player wird stattdessen in einem neuen Tab geöffnet.'); + return null; + } + + try { + const alreadyPlayer = popupWindow.location.origin === window.location.origin + && popupWindow.location.pathname === '/player'; + if (!alreadyPlayer) { + popupWindow.location.replace(destination); + } else { + popupWindow.landwelleStandalonePlayer?.play(); + } + } catch (_) { + popupWindow.location.href = destination; + } + + if (audio && !audio.paused) audio.pause(); + showStatus('Der Landwelle-Player wurde in einem eigenen Fenster geöffnet.'); + window.setTimeout(() => { + try { popupWindow?.focus(); } catch (_) { /* Browser entscheidet über Fokus. */ } + }, 60); + return popupWindow; + }; + + playTriggers.forEach((button) => button.addEventListener('click', toggleAudio)); + openButtons.forEach((link) => link.addEventListener('click', (event) => { + const popup = openPlayerWindow(); + if (popup) event.preventDefault(); + })); + + if (audio) { + let storedVolume = Number.NaN; + try { storedVolume = Number(window.localStorage.getItem('landwelle-player-volume')); } catch (_) { /* optional */ } + const initialVolume = Number.isFinite(storedVolume) + ? storedVolume + : Number(volumeInputs[0]?.value ?? 0.8); + audio.volume = Math.min(1, Math.max(0, Number.isFinite(initialVolume) ? initialVolume : 0.8)); + setPlaying(!audio.paused); + audio.addEventListener('play', () => { + setPlaying(true); + announcePlayback(); + }); + audio.addEventListener('pause', () => setPlaying(false)); + audio.addEventListener('ended', () => { + if (playbackPhase === 'preroll' && !prerollCompleted) { + startLiveStream().catch((error) => { + setPlaying(false); + showStatus('Der Livestream konnte nach dem Hinweis nicht gestartet werden.'); + console.error('Landwelle-Player Pre-Roll:', error); + }); + return; + } + setPlaying(false); + }); + audio.addEventListener('waiting', () => showStatus( + playbackPhase === 'preroll' + ? 'KI-Transparenzhinweis wird geladen …' + : 'Livestream wird gepuffert …' + )); + audio.addEventListener('playing', () => showStatus( + playbackPhase === 'preroll' + ? 'KI-Transparenzhinweis läuft – danach startet Landwelle live.' + : 'Landwelle läuft live.' + )); + audio.addEventListener('error', () => { + if (playbackPhase === 'preroll' && !prerollCompleted) { + prerollCompleted = true; + showStatus('Der KI-Hinweis konnte nicht geladen werden. Landwelle startet direkt live …'); + startLiveStream().catch((error) => { + setPlaying(false); + showStatus('Der Stream ist momentan nicht erreichbar.'); + console.error('Landwelle-Player Pre-Roll-Fallback:', error); + }); + return; + } + setPlaying(false); + showStatus('Der Stream ist momentan nicht erreichbar.'); + }); + } + + playbackChannel?.addEventListener('message', (event) => { + if (event.data?.type !== 'playing' || event.data?.source === playbackID) return; + if (audio && !audio.paused) { + audio.pause(); + showStatus('Die Wiedergabe läuft jetzt im eigenständigen Landwelle-Player.'); + } + }); + + volumeInputs.forEach((input) => { + input.value = String(audio?.volume ?? Number(input.value)); + input.addEventListener('input', () => { + const value = Number(input.value); + if (audio && Number.isFinite(value)) audio.volume = value; + try { window.localStorage.setItem('landwelle-player-volume', String(value)); } catch (_) { /* optional */ } + volumeInputs.forEach((other) => { + if (other !== input) other.value = input.value; + }); + }); + }); + + if (menuButton && nav) { + menuButton.addEventListener('click', () => { + const open = nav.classList.toggle('is-open'); + menuButton.setAttribute('aria-expanded', String(open)); + }); + + nav.querySelectorAll('a').forEach((link) => link.addEventListener('click', closeMobileNav)); + } + + window.addEventListener('pagehide', () => playbackChannel?.close(), { once: true }); + + window.landwellePlayer = Object.freeze({ + open: openPlayerWindow, + close: () => { + try { popupWindow?.close(); } catch (_) { /* Popup kann bereits geschlossen sein. */ } + }, + toggle: toggleAudio, + isPlaying: () => Boolean(audio && !audio.paused) + }); + }; + + const initNowPlaying = () => { + const artistFields = Array.from(document.querySelectorAll('[data-now-artist]')); + const titleFields = Array.from(document.querySelectorAll('[data-now-title]')); + const liveBadges = Array.from(document.querySelectorAll('[data-now-live-badge]')); + const listenerFields = Array.from(document.querySelectorAll('[data-now-listeners]')); + const coverImages = Array.from(document.querySelectorAll('[data-now-cover]')); + const surfaces = Array.from(document.querySelectorAll('.live-player')); + if (artistFields.length === 0 && titleFields.length === 0) return; + + let currentCover = coverImages[0]?.getAttribute('src') || ''; + let stopped = false; + let timer = 0; + let loading = false; + + const setAll = (elements, value, fallback = '–') => { + elements.forEach((element) => { element.textContent = String(value || fallback); }); + }; + + const normalizeCoverURL = (url) => { + if (!url) return ''; + try { + const parsed = new URL(url, window.location.origin); + if (parsed.pathname.startsWith('/api/v1/covers/') || parsed.pathname.startsWith('/assets/')) { + return `${parsed.pathname}${parsed.search}`; + } + } catch (_) { + // Relative Landwelle URLs are already suitable. + } + return url; + }; + + const updateCover = (url, artistName, titleName) => { + const displayURL = normalizeCoverURL(url); + if (!displayURL || displayURL === currentCover || coverImages.length === 0) return; + currentCover = displayURL; + const coverBoxes = coverImages + .map((image) => image.closest('.track-cover')) + .filter(Boolean); + coverBoxes.forEach((box) => box.classList.add('is-loading')); + const preload = new Image(); + preload.onload = () => { + coverImages.forEach((image) => { + image.src = displayURL; + image.alt = `Cover zu ${artistName || 'Landwelle'} – ${titleName || 'Livestream'}`; + }); + coverBoxes.forEach((box) => box.classList.remove('is-loading')); + }; + preload.onerror = () => coverBoxes.forEach((box) => box.classList.remove('is-loading')); + preload.src = displayURL; + }; + + const schedule = () => { + window.clearTimeout(timer); + timer = window.setTimeout(load, document.hidden ? 30000 : 15000); + }; + + const load = async () => { + if (stopped || loading) return; + loading = true; + try { + const response = await fetch('/api/v1/now', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const payload = await response.json(); + const now = payload?.data; + if (!now) throw new Error('Ungültige Now-Playing-Daten'); + + setAll(artistFields, now.artist, 'Landwelle Radio'); + setAll(titleFields, now.title, 'Live aus Niedersachsen'); + setAll(listenerFields, Number.isFinite(Number(now.listeners)) ? Number(now.listeners) : 0, '0'); + + liveBadges.forEach((badge) => { badge.textContent = now.live ? 'LIVE' : 'ON AIR'; }); + surfaces.forEach((surface) => surface.classList.toggle('is-stale', Boolean(now.stale))); + updateCover(now.cover_url, now.artist, now.title); + } catch (error) { + surfaces.forEach((surface) => surface.classList.add('is-stale')); + console.error('Landwelle Now Playing:', error); + } finally { + loading = false; + schedule(); + } + }; + + document.addEventListener('visibilitychange', () => { + if (!document.hidden) { + window.clearTimeout(timer); + load(); + } + }); + window.addEventListener('pagehide', () => { + stopped = true; + window.clearTimeout(timer); + }, { once: true }); + load(); + }; + + const initCurrentProgram = () => { + const programFields = Array.from(document.querySelectorAll('[data-current-program]')); + const presenterFields = Array.from(document.querySelectorAll('[data-current-program-presenter]')); + if (programFields.length === 0 && presenterFields.length === 0) return; + + let timer = 0; + let loading = false; + let stopped = false; + + const setAll = (elements, value) => elements.forEach((element) => { element.textContent = value; }); + const schedule = () => { + window.clearTimeout(timer); + timer = window.setTimeout(load, document.hidden ? 120000 : 60000); + }; + const render = (program) => { + if (!program) { + setAll(programFields, 'Landwelle Radio · rund um die Uhr'); + setAll(presenterFields, 'Sound & Infos aus Niedersachsen'); + return; + } + const time = program.start && program.end ? `${program.start}–${program.end} Uhr` : (program.time_label || 'jetzt live'); + setAll(programFields, `${program.show || 'Landwelle Radio'} · ${time}`); + const details = []; + if (program.presenter) details.push(`mit ${program.presenter}`); + if (program.program_type) details.push(program.program_type); + setAll(presenterFields, details.join(' · ') || 'Sound & Infos aus Niedersachsen'); + }; + const load = async () => { + if (stopped || loading) return; + loading = true; + try { + const response = await fetch('/api/v1/program/current', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const payload = await response.json(); + render(payload?.data || null); + } catch (error) { + render(null); + console.error('Landwelle-Programm:', error); + } finally { + loading = false; + schedule(); + } + }; + + document.addEventListener('visibilitychange', () => { + if (!document.hidden) { + window.clearTimeout(timer); + load(); + } + }); + window.addEventListener('pagehide', () => { + stopped = true; + window.clearTimeout(timer); + }, { once: true }); + load(); + }; + + const initWeather = () => { + const widget = document.querySelector('[data-weather-widget]'); + if (!widget) return; + + const setText = (selector, value) => { + const element = widget.querySelector(selector); + if (element) element.textContent = value; + }; + + const forecastElement = widget.querySelector('[data-weather-forecast]'); + widget.classList.add('is-loading'); + + fetch('/api/v1/weather', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }) + .then((response) => { + if (!response.ok) throw new Error(`HTTP ${response.status}`); + return response.json(); + }) + .then((payload) => { + const weather = payload && payload.data; + if (!weather || !weather.current) throw new Error('Ungültige Wetterdaten'); + + setText('[data-weather-location]', weather.location || 'Visselhövede'); + setText('[data-weather-icon]', weather.current.icon || '🌤️'); + setText('[data-weather-temperature]', `${Math.round(weather.current.temperature)}°`); + setText('[data-weather-description]', weather.current.description || 'wechselhaft'); + setText('[data-weather-apparent]', `Gefühlt ${Math.round(weather.current.apparent_temperature)}°`); + setText('[data-weather-wind]', `${weather.current.wind_direction || '–'} ${Math.round(weather.current.wind_speed)} km/h`); + setText('[data-weather-rain]', `Regen ${weather.current.rain_probability ?? 0} %`); + setText('[data-weather-uv]', `UV ${Number(weather.current.uv_index || 0).toFixed(1)}`); + + if (forecastElement) { + forecastElement.replaceChildren(); + (weather.forecast || []).slice(0, 4).forEach((day) => { + const item = document.createElement('span'); + const weekday = document.createTextNode(day.weekday || '–'); + const icon = document.createElement('small'); + icon.className = 'weather-forecast-icon'; + icon.textContent = day.icon || '🌤️'; + icon.title = day.description || ''; + const temperatures = document.createElement('b'); + temperatures.append(document.createTextNode(`${Math.round(day.temperature_max)}° `)); + const minimum = document.createElement('em'); + minimum.textContent = `${Math.round(day.temperature_min)}°`; + temperatures.append(minimum); + item.append(weekday, icon, temperatures); + forecastElement.append(item); + }); + } + + const fetchedAt = weather.fetched_at ? new Date(weather.fetched_at) : new Date(); + const label = Number.isNaN(fetchedAt.getTime()) + ? '' + : `Aktualisiert ${fetchedAt.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' })} Uhr${weather.stale ? ' · zwischengespeichert' : ''}`; + setText('[data-weather-updated]', label); + widget.classList.remove('is-error'); + }) + .catch((error) => { + widget.classList.add('is-error'); + setText('[data-weather-description]', 'Wetter derzeit nicht erreichbar'); + setText('[data-weather-apparent]', 'Bitte später erneut versuchen'); + setText('[data-weather-updated]', ''); + console.error('Landwelle-Wetter:', error); + }) + .finally(() => widget.classList.remove('is-loading')); + }; + + + const initTrafficSummary = () => { + const count = document.querySelector('[data-traffic-count]'); + const label = document.querySelector('[data-traffic-label]'); + if (!count) return; + fetch('/api/v1/traffic', { headers: { Accept: 'application/json' }, cache: 'no-store' }) + .then((response) => { + if (!response.ok) throw new Error(`HTTP ${response.status}`); + return response.json(); + }) + .then((payload) => { + const traffic = Array.isArray(payload?.data?.traffic) ? payload.data.traffic.length : 0; + const cameras = Array.isArray(payload?.data?.speed_cameras) ? payload.data.speed_cameras.length : 0; + count.textContent = String(traffic + cameras); + if (label) label.textContent = `${traffic} Verkehrs- und ${cameras} Blitzermeldungen`; + }) + .catch(() => { + count.textContent = '–'; + if (label) label.textContent = 'Live-Daten werden erneut geladen'; + }); + }; + + const init = () => { + initConsent(); + initPlayer(); + initNowPlaying(); + initCurrentProgram(); + initWeather(); + initTrafficSummary(); + }; + + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', init, { once: true }); + } else { + init(); + } +})(); + +// Radio dropdown navigation +(() => { + const dropdowns = document.querySelectorAll('[data-nav-dropdown]'); + dropdowns.forEach((dropdown) => { + const button = dropdown.querySelector('.nav-dropdown-toggle'); + if (!button) return; + const close = () => { + dropdown.classList.remove('is-open'); + button.setAttribute('aria-expanded', 'false'); + }; + button.addEventListener('click', (event) => { + event.stopPropagation(); + const willOpen = !dropdown.classList.contains('is-open'); + dropdowns.forEach((other) => { + other.classList.remove('is-open'); + const otherButton = other.querySelector('.nav-dropdown-toggle'); + if (otherButton) otherButton.setAttribute('aria-expanded', 'false'); + }); + if (willOpen) { + dropdown.classList.add('is-open'); + button.setAttribute('aria-expanded', 'true'); + } + }); + dropdown.addEventListener('keydown', (event) => { + if (event.key === 'Escape') { + close(); + button.focus(); + } + }); + document.addEventListener('click', (event) => { + if (!dropdown.contains(event.target)) close(); + }); + }); +})(); + +(() => { + const modal = document.querySelector('[data-auth-modal]'); + if (!modal) return; + const open = () => { modal.hidden = false; document.body.style.overflow = 'hidden'; modal.querySelector('input')?.focus(); }; + const close = () => { modal.hidden = true; document.body.style.overflow = ''; }; + document.querySelectorAll('[data-auth-open]').forEach((button) => button.addEventListener('click', open)); + modal.querySelectorAll('[data-auth-close]').forEach((button) => button.addEventListener('click', close)); + modal.querySelectorAll('[data-auth-tab]').forEach((button) => button.addEventListener('click', () => { + modal.querySelectorAll('[data-auth-tab]').forEach((b) => b.classList.toggle('is-active', b === button)); + modal.querySelectorAll('[data-auth-panel]').forEach((panel) => panel.classList.toggle('is-active', panel.dataset.authPanel === button.dataset.authTab)); + })); + document.addEventListener('keydown', (event) => { if (event.key === 'Escape' && !modal.hidden) close(); }); +})(); + +(() => { + const button = document.querySelector('.account-button'); + if (!button) return; + + fetch('/account/session', { credentials: 'same-origin', cache: 'no-store', headers: { Accept: 'application/json' } }) + .then((response) => response.ok ? response.json() : null) + .then((session) => { + if (!session?.authenticated || !session.user) return; + + const user = session.user; + const replacement = button.cloneNode(false); + replacement.className = 'account-button account-button-user'; + replacement.type = 'button'; + replacement.removeAttribute('data-auth-open'); + replacement.setAttribute('aria-expanded', 'false'); + replacement.setAttribute('aria-haspopup', 'menu'); + replacement.innerHTML = ``; + + const menu = document.createElement('div'); + menu.className = 'account-menu'; + menu.hidden = true; + menu.innerHTML = ` + + Forum öffnen + Neues Thema erstellen +
`; + + const wrap = document.createElement('div'); + wrap.className = 'account-dropdown'; + button.replaceWith(wrap); + wrap.append(replacement, menu); + + const close = () => { + menu.hidden = true; + wrap.classList.remove('is-open'); + replacement.setAttribute('aria-expanded', 'false'); + }; + replacement.addEventListener('click', (event) => { + event.stopPropagation(); + const opening = menu.hidden; + if (opening) { + menu.hidden = false; + wrap.classList.add('is-open'); + replacement.setAttribute('aria-expanded', 'true'); + } else close(); + }); + document.addEventListener('click', (event) => { if (!wrap.contains(event.target)) close(); }); + document.addEventListener('keydown', (event) => { + if (event.key === 'Escape' && !menu.hidden) { + close(); + replacement.focus(); + } + }); + }) + .catch(() => {}); + + function escapeAccountText(value) { + return String(value || '').replace(/[&<>"']/g, (character) => ({ + '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' + })[character]); + } +})(); + +(() => { + 'use strict'; + const VISITOR_KEY = 'landwelle-analytics-visitor-v1'; + const SESSION_KEY = 'landwelle-analytics-session-v1'; + const SESSION_TTL = 30 * 60 * 1000; + let sent = false; + + const uuid = () => { + if (window.crypto?.randomUUID) return window.crypto.randomUUID(); + if (window.crypto?.getRandomValues) { + const values = new Uint8Array(16); + window.crypto.getRandomValues(values); + return [...values].map((value) => value.toString(16).padStart(2, '0')).join(''); + } + return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`; + }; + const read = (key) => { + try { return JSON.parse(window.localStorage.getItem(key) || 'null'); } catch (_) { return null; } + }; + const write = (key, value) => { + try { window.localStorage.setItem(key, JSON.stringify(value)); } catch (_) {} + }; + const identity = () => { + let visitor = read(VISITOR_KEY); + if (!visitor?.id) { + visitor = { id: uuid(), createdAt: new Date().toISOString() }; + write(VISITOR_KEY, visitor); + } + let session = read(SESSION_KEY); + const now = Date.now(); + if (!session?.id || !session.lastSeen || now - Number(session.lastSeen) > SESSION_TTL) { + session = { id: uuid(), startedAt: now, lastSeen: now }; + } else { + session.lastSeen = now; + } + write(SESSION_KEY, session); + return { visitorID: visitor.id, sessionID: session.id }; + }; + const referrerHost = () => { + if (!document.referrer) return ''; + try { + const host = new URL(document.referrer).hostname.toLowerCase(); + return host === window.location.hostname.toLowerCase() ? '' : host; + } catch (_) { return ''; } + }; + const send = () => { + if (sent || window.location.pathname.startsWith('/admin')) return; + if (navigator.globalPrivacyControl === true || navigator.doNotTrack === '1') return; + if (!window.landwelleConsent?.has('analytics')) return; + sent = true; + const ids = identity(); + const payload = JSON.stringify({ + visitor_id: ids.visitorID, + session_id: ids.sessionID, + path: `${window.location.pathname}${window.location.search}`, + page_title: document.title || '', + referrer_host: referrerHost(), + consent: true + }); + if (navigator.sendBeacon) { + const blob = new Blob([payload], { type: 'application/json' }); + if (navigator.sendBeacon('/api/site-analytics/pageview', blob)) return; + } + fetch('/api/site-analytics/pageview', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: payload, + keepalive: true, + credentials: 'same-origin' + }).catch(() => {}); + }; + document.addEventListener('landwelle:consent-changed', (event) => { + if (event.detail?.analytics === true) send(); + }); + if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', send, { once: true }); + else send(); +})(); diff --git a/web/assets/app-v18.js b/web/assets/app-v18.js new file mode 100644 index 0000000..d66a5ba --- /dev/null +++ b/web/assets/app-v18.js @@ -0,0 +1,963 @@ +(() => { + 'use strict'; + + const CONSENT_KEY = 'landwelle-consent-v1'; + const CONSENT_COOKIE = 'landwelle_consent'; + const CONSENT_VERSION = 1; + const CONSENT_DAYS = 180; + + const parseJSON = (value) => { + try { + return JSON.parse(value); + } catch (_) { + return null; + } + }; + + const readCookie = (name) => { + try { + const prefix = `${name}=`; + const part = document.cookie + .split(';') + .map((item) => item.trim()) + .find((item) => item.startsWith(prefix)); + + if (!part) return null; + return decodeURIComponent(part.slice(prefix.length)); + } catch (_) { + return null; + } + }; + + const isValidConsent = (value) => { + if (!value || typeof value !== 'object') return false; + if (value.version !== CONSENT_VERSION || value.necessary !== true) return false; + if (typeof value.analytics !== 'boolean' || typeof value.externalMedia !== 'boolean') return false; + if (!value.expiresAt || Date.parse(value.expiresAt) <= Date.now()) return false; + return true; + }; + + const readConsent = () => { + let stored = null; + + try { + stored = parseJSON(window.localStorage.getItem(CONSENT_KEY)); + } catch (_) { + stored = null; + } + + if (!isValidConsent(stored)) { + stored = parseJSON(readCookie(CONSENT_COOKIE)); + } + + return isValidConsent(stored) ? stored : null; + }; + + const persistConsent = ({ analytics, externalMedia }) => { + const decidedAt = new Date(); + const expiresAt = new Date(decidedAt.getTime() + CONSENT_DAYS * 24 * 60 * 60 * 1000); + const consent = { + version: CONSENT_VERSION, + necessary: true, + analytics: Boolean(analytics), + externalMedia: Boolean(externalMedia), + decidedAt: decidedAt.toISOString(), + expiresAt: expiresAt.toISOString() + }; + const serialized = JSON.stringify(consent); + + let savedLocally = false; + try { + window.localStorage.setItem(CONSENT_KEY, serialized); + savedLocally = window.localStorage.getItem(CONSENT_KEY) === serialized; + } catch (_) { + savedLocally = false; + } + + try { + const secure = window.location.protocol === 'https:' ? '; Secure' : ''; + document.cookie = `${CONSENT_COOKIE}=${encodeURIComponent(serialized)}; Path=/; Max-Age=${CONSENT_DAYS * 86400}; SameSite=Lax${secure}`; + } catch (_) { + // Besonders restriktive Browser können beide Speicherwege blockieren. + } + + return consent; + }; + + const applyConsent = (consent) => { + const effective = consent || { + version: CONSENT_VERSION, + necessary: true, + analytics: false, + externalMedia: false + }; + + document.documentElement.dataset.consentNecessary = 'true'; + document.documentElement.dataset.consentAnalytics = String(effective.analytics === true); + document.documentElement.dataset.consentExternalMedia = String(effective.externalMedia === true); + + document.dispatchEvent(new CustomEvent('landwelle:consent-changed', { + detail: { ...effective } + })); + }; + + const initConsent = () => { + const layer = document.getElementById('cookie-consent'); + if (!layer) return; + + const dialog = layer.querySelector('.consent-dialog'); + const closeButton = layer.querySelector('[data-consent-close]'); + const settingsButton = layer.querySelector('[data-consent-settings]'); + const settingsPanel = layer.querySelector('#consent-settings-panel'); + const analyticsInput = layer.querySelector('[data-consent-category="analytics"]'); + const externalInput = layer.querySelector('[data-consent-category="externalMedia"]'); + const essentialButton = layer.querySelector('[data-consent-essential]'); + const saveButton = layer.querySelector('[data-consent-save]'); + const allButton = layer.querySelector('[data-consent-all]'); + const status = layer.querySelector('.consent-status'); + const openButtons = Array.from(document.querySelectorAll('[data-consent-open]')); + const pageSiblings = Array.from(document.body.children).filter((element) => element !== layer); + let previouslyFocused = null; + let currentConsent = readConsent(); + + const setStatus = (message) => { + if (status) status.textContent = message; + }; + + const setSettingsOpen = (open) => { + if (!settingsButton || !settingsPanel) return; + settingsButton.setAttribute('aria-expanded', String(open)); + settingsPanel.hidden = !open; + }; + + const populateInputs = (consent) => { + if (analyticsInput) analyticsInput.checked = Boolean(consent && consent.analytics); + if (externalInput) externalInput.checked = Boolean(consent && consent.externalMedia); + }; + + const setPageInert = (inert) => { + pageSiblings.forEach((element) => { + try { + element.inert = inert; + } catch (_) { + if (inert) element.setAttribute('aria-hidden', 'true'); + else element.removeAttribute('aria-hidden'); + } + }); + }; + + const openDialog = ({ reopen = false } = {}) => { + currentConsent = readConsent(); + previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null; + populateInputs(currentConsent); + setSettingsOpen(reopen); + setStatus(''); + + if (closeButton) closeButton.hidden = !currentConsent; + layer.hidden = false; + layer.setAttribute('aria-hidden', 'false'); + document.documentElement.classList.add('consent-open'); + setPageInert(true); + + window.requestAnimationFrame(() => { + if (dialog) dialog.focus({ preventScroll: true }); + }); + }; + + const closeDialog = () => { + if (!readConsent()) return; + layer.hidden = true; + layer.setAttribute('aria-hidden', 'true'); + document.documentElement.classList.remove('consent-open'); + setPageInert(false); + + if (previouslyFocused && document.contains(previouslyFocused)) { + previouslyFocused.focus({ preventScroll: true }); + } + }; + + const saveChoice = (analytics, externalMedia) => { + currentConsent = persistConsent({ analytics, externalMedia }); + applyConsent(currentConsent); + populateInputs(currentConsent); + setStatus('Deine Auswahl wurde gespeichert.'); + window.setTimeout(closeDialog, 180); + }; + + settingsButton?.addEventListener('click', () => { + const open = settingsButton.getAttribute('aria-expanded') !== 'true'; + setSettingsOpen(open); + }); + + essentialButton?.addEventListener('click', () => saveChoice(false, false)); + allButton?.addEventListener('click', () => saveChoice(true, true)); + saveButton?.addEventListener('click', () => { + saveChoice(Boolean(analyticsInput?.checked), Boolean(externalInput?.checked)); + }); + closeButton?.addEventListener('click', closeDialog); + openButtons.forEach((button) => button.addEventListener('click', () => openDialog({ reopen: true }))); + + layer.addEventListener('keydown', (event) => { + if (event.key === 'Escape') { + if (readConsent()) closeDialog(); + return; + } + + if (event.key !== 'Tab' || !dialog) return; + + const focusable = Array.from(dialog.querySelectorAll( + 'button:not([disabled]):not([hidden]), input:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])' + )).filter((element) => element instanceof HTMLElement && element.offsetParent !== null); + + if (focusable.length === 0) { + event.preventDefault(); + dialog.focus(); + return; + } + + const first = focusable[0]; + const last = focusable[focusable.length - 1]; + + if (event.shiftKey && document.activeElement === first) { + event.preventDefault(); + last.focus(); + } else if (!event.shiftKey && document.activeElement === last) { + event.preventDefault(); + first.focus(); + } + }); + + window.landwelleConsent = Object.freeze({ + get: () => readConsent(), + has: (category) => { + const consent = readConsent(); + if (category === 'necessary') return true; + return Boolean(consent && consent[category] === true); + }, + open: () => openDialog({ reopen: true }) + }); + + applyConsent(currentConsent); + if (!currentConsent) openDialog(); + }; + + const initPlayer = () => { + const audio = document.getElementById('live-audio'); + const playerSurfaces = Array.from(document.querySelectorAll('.live-player')); + const statuses = Array.from(document.querySelectorAll('[data-player-message]')); + const playTriggers = Array.from(document.querySelectorAll('[data-play-trigger]')); + const openButtons = Array.from(document.querySelectorAll('[data-player-open]')); + const volumeInputs = Array.from(document.querySelectorAll('[data-volume]')); + const menuButton = document.querySelector('.menu-toggle'); + const nav = document.querySelector('.main-nav'); + const popupName = 'landwelleRadioPlayer'; + const playbackID = `portal-${Date.now()}-${Math.random().toString(16).slice(2)}`; + const playbackChannel = 'BroadcastChannel' in window + ? new BroadcastChannel('landwelle-radio-playback') + : null; + let popupWindow = null; + const streamURL = audio?.dataset.streamSrc || ''; + const prerollURL = audio?.dataset.prerollSrc || ''; + let playbackPhase = 'idle'; + let prerollCompleted = !prerollURL; + let prerollTransitioning = false; + + const showStatus = (message) => { + statuses.forEach((element) => { element.textContent = message; }); + }; + + const setPlaying = (playing) => { + playerSurfaces.forEach((surface) => surface.classList.toggle('is-playing', playing)); + playTriggers.forEach((button) => { + button.setAttribute('aria-pressed', String(playing)); + button.setAttribute('aria-label', playing ? 'Livestream pausieren' : 'Livestream abspielen'); + }); + }; + + const announcePlayback = () => { + playbackChannel?.postMessage({ type: 'playing', source: playbackID }); + }; + + const setAudioSource = (source, phase) => { + if (!audio || !source) return; + playbackPhase = phase; + if (audio.getAttribute('src') === source) return; + audio.src = source; + audio.load(); + }; + + const startLiveStream = async () => { + if (!audio || !streamURL || prerollTransitioning) return; + prerollTransitioning = true; + prerollCompleted = true; + try { + setAudioSource(streamURL, 'stream'); + showStatus('Livestream wird verbunden …'); + await audio.play(); + } finally { + prerollTransitioning = false; + } + }; + + const startPlayback = async () => { + if (!audio) { + showStatus('Der Audioplayer ist auf dieser Seite nicht verfügbar.'); + return; + } + if (!streamURL) { + showStatus('Der Livestream ist noch nicht konfiguriert.'); + return; + } + + if (!prerollCompleted && prerollURL) { + if (playbackPhase !== 'preroll') { + setAudioSource(prerollURL, 'preroll'); + try { audio.currentTime = 0; } catch (_) { /* Browser lädt erst Metadaten. */ } + } + showStatus('KI-Transparenzhinweis wird vor dem Livestream abgespielt …'); + await audio.play(); + return; + } + + if (playbackPhase !== 'stream') setAudioSource(streamURL, 'stream'); + showStatus('Livestream wird verbunden …'); + await audio.play(); + }; + + const toggleAudio = async () => { + try { + if (!audio) { + showStatus('Der Audioplayer ist auf dieser Seite nicht verfügbar.'); + return; + } + if (audio.paused) { + await startPlayback(); + } else { + audio.pause(); + showStatus(playbackPhase === 'preroll' ? 'KI-Transparenzhinweis pausiert.' : 'Livestream pausiert.'); + } + } catch (error) { + setPlaying(false); + showStatus('Der Livestream konnte gerade nicht gestartet werden.'); + console.error('Landwelle-Player:', error); + } + }; + + const closeMobileNav = () => { + if (!menuButton || !nav) return; + nav.classList.remove('is-open'); + menuButton.setAttribute('aria-expanded', 'false'); + }; + + const popupFeatures = () => { + const availableWidth = Math.max(420, window.screen?.availWidth || 1100); + const availableHeight = Math.max(560, window.screen?.availHeight || 820); + const width = Math.min(980, Math.max(420, availableWidth - 60)); + const height = Math.min(740, Math.max(560, availableHeight - 70)); + const left = Math.max(0, Math.round((window.screenX || 0) + ((window.outerWidth || availableWidth) - width) / 2)); + const top = Math.max(0, Math.round((window.screenY || 0) + ((window.outerHeight || availableHeight) - height) / 2)); + return `popup=yes,width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`; + }; + + const openPlayerWindow = () => { + closeMobileNav(); + const destination = new URL('/player?autoplay=1', window.location.href).href; + + try { + if (!popupWindow || popupWindow.closed) { + popupWindow = window.open('', popupName, popupFeatures()); + } + } catch (_) { + popupWindow = null; + } + + if (!popupWindow) { + showStatus('Der Browser hat das Popup blockiert. Der Player wird stattdessen in einem neuen Tab geöffnet.'); + return null; + } + + try { + const alreadyPlayer = popupWindow.location.origin === window.location.origin + && popupWindow.location.pathname === '/player'; + if (!alreadyPlayer) { + popupWindow.location.replace(destination); + } else { + popupWindow.landwelleStandalonePlayer?.play(); + } + } catch (_) { + popupWindow.location.href = destination; + } + + if (audio && !audio.paused) audio.pause(); + showStatus('Der Landwelle-Player wurde in einem eigenen Fenster geöffnet.'); + window.setTimeout(() => { + try { popupWindow?.focus(); } catch (_) { /* Browser entscheidet über Fokus. */ } + }, 60); + return popupWindow; + }; + + playTriggers.forEach((button) => button.addEventListener('click', toggleAudio)); + openButtons.forEach((link) => link.addEventListener('click', (event) => { + const popup = openPlayerWindow(); + if (popup) event.preventDefault(); + })); + + if (audio) { + let storedVolume = Number.NaN; + try { storedVolume = Number(window.localStorage.getItem('landwelle-player-volume')); } catch (_) { /* optional */ } + const initialVolume = Number.isFinite(storedVolume) + ? storedVolume + : Number(volumeInputs[0]?.value ?? 0.8); + audio.volume = Math.min(1, Math.max(0, Number.isFinite(initialVolume) ? initialVolume : 0.8)); + setPlaying(!audio.paused); + audio.addEventListener('play', () => { + setPlaying(true); + announcePlayback(); + }); + audio.addEventListener('pause', () => setPlaying(false)); + audio.addEventListener('ended', () => { + if (playbackPhase === 'preroll' && !prerollCompleted) { + startLiveStream().catch((error) => { + setPlaying(false); + showStatus('Der Livestream konnte nach dem Hinweis nicht gestartet werden.'); + console.error('Landwelle-Player Pre-Roll:', error); + }); + return; + } + setPlaying(false); + }); + audio.addEventListener('waiting', () => showStatus( + playbackPhase === 'preroll' + ? 'KI-Transparenzhinweis wird geladen …' + : 'Livestream wird gepuffert …' + )); + audio.addEventListener('playing', () => showStatus( + playbackPhase === 'preroll' + ? 'KI-Transparenzhinweis läuft – danach startet Landwelle live.' + : 'Landwelle läuft live.' + )); + audio.addEventListener('error', () => { + if (playbackPhase === 'preroll' && !prerollCompleted) { + prerollCompleted = true; + showStatus('Der KI-Hinweis konnte nicht geladen werden. Landwelle startet direkt live …'); + startLiveStream().catch((error) => { + setPlaying(false); + showStatus('Der Stream ist momentan nicht erreichbar.'); + console.error('Landwelle-Player Pre-Roll-Fallback:', error); + }); + return; + } + setPlaying(false); + showStatus('Der Stream ist momentan nicht erreichbar.'); + }); + } + + playbackChannel?.addEventListener('message', (event) => { + if (event.data?.type !== 'playing' || event.data?.source === playbackID) return; + if (audio && !audio.paused) { + audio.pause(); + showStatus('Die Wiedergabe läuft jetzt im eigenständigen Landwelle-Player.'); + } + }); + + volumeInputs.forEach((input) => { + input.value = String(audio?.volume ?? Number(input.value)); + input.addEventListener('input', () => { + const value = Number(input.value); + if (audio && Number.isFinite(value)) audio.volume = value; + try { window.localStorage.setItem('landwelle-player-volume', String(value)); } catch (_) { /* optional */ } + volumeInputs.forEach((other) => { + if (other !== input) other.value = input.value; + }); + }); + }); + + if (menuButton && nav) { + menuButton.addEventListener('click', () => { + const open = nav.classList.toggle('is-open'); + menuButton.setAttribute('aria-expanded', String(open)); + }); + + nav.querySelectorAll('a').forEach((link) => link.addEventListener('click', closeMobileNav)); + } + + window.addEventListener('pagehide', () => playbackChannel?.close(), { once: true }); + + window.landwellePlayer = Object.freeze({ + open: openPlayerWindow, + close: () => { + try { popupWindow?.close(); } catch (_) { /* Popup kann bereits geschlossen sein. */ } + }, + toggle: toggleAudio, + isPlaying: () => Boolean(audio && !audio.paused) + }); + }; + + const initNowPlaying = () => { + const artistFields = Array.from(document.querySelectorAll('[data-now-artist]')); + const titleFields = Array.from(document.querySelectorAll('[data-now-title]')); + const liveBadges = Array.from(document.querySelectorAll('[data-now-live-badge]')); + const listenerFields = Array.from(document.querySelectorAll('[data-now-listeners]')); + const coverImages = Array.from(document.querySelectorAll('[data-now-cover]')); + const surfaces = Array.from(document.querySelectorAll('.live-player')); + if (artistFields.length === 0 && titleFields.length === 0) return; + + let currentCover = coverImages[0]?.getAttribute('src') || ''; + let stopped = false; + let timer = 0; + let loading = false; + + const setAll = (elements, value, fallback = '–') => { + elements.forEach((element) => { element.textContent = String(value || fallback); }); + }; + + const normalizeCoverURL = (url) => { + if (!url) return ''; + try { + const parsed = new URL(url, window.location.origin); + if (parsed.pathname.startsWith('/api/v1/covers/') || parsed.pathname.startsWith('/assets/')) { + return `${parsed.pathname}${parsed.search}`; + } + } catch (_) { + // Relative Landwelle URLs are already suitable. + } + return url; + }; + + const updateCover = (url, artistName, titleName) => { + const displayURL = normalizeCoverURL(url); + if (!displayURL || displayURL === currentCover || coverImages.length === 0) return; + currentCover = displayURL; + const coverBoxes = coverImages + .map((image) => image.closest('.track-cover')) + .filter(Boolean); + coverBoxes.forEach((box) => box.classList.add('is-loading')); + const preload = new Image(); + preload.onload = () => { + coverImages.forEach((image) => { + image.src = displayURL; + image.alt = `Cover zu ${artistName || 'Landwelle'} – ${titleName || 'Livestream'}`; + }); + coverBoxes.forEach((box) => box.classList.remove('is-loading')); + }; + preload.onerror = () => coverBoxes.forEach((box) => box.classList.remove('is-loading')); + preload.src = displayURL; + }; + + const schedule = () => { + window.clearTimeout(timer); + timer = window.setTimeout(load, document.hidden ? 30000 : 15000); + }; + + const load = async () => { + if (stopped || loading) return; + loading = true; + try { + const response = await fetch('/api/v1/now', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const payload = await response.json(); + const now = payload?.data; + if (!now) throw new Error('Ungültige Now-Playing-Daten'); + + setAll(artistFields, now.artist, 'Landwelle Radio'); + setAll(titleFields, now.title, 'Live aus Niedersachsen'); + setAll(listenerFields, Number.isFinite(Number(now.listeners)) ? Number(now.listeners) : 0, '0'); + + liveBadges.forEach((badge) => { badge.textContent = now.live ? 'LIVE' : 'ON AIR'; }); + surfaces.forEach((surface) => surface.classList.toggle('is-stale', Boolean(now.stale))); + updateCover(now.cover_url, now.artist, now.title); + } catch (error) { + surfaces.forEach((surface) => surface.classList.add('is-stale')); + console.error('Landwelle Now Playing:', error); + } finally { + loading = false; + schedule(); + } + }; + + document.addEventListener('visibilitychange', () => { + if (!document.hidden) { + window.clearTimeout(timer); + load(); + } + }); + window.addEventListener('pagehide', () => { + stopped = true; + window.clearTimeout(timer); + }, { once: true }); + load(); + }; + + const initCurrentProgram = () => { + const programFields = Array.from(document.querySelectorAll('[data-current-program]')); + const presenterFields = Array.from(document.querySelectorAll('[data-current-program-presenter]')); + const presenterImages = Array.from(document.querySelectorAll('[data-current-program-image]')); + if (programFields.length === 0 && presenterFields.length === 0 && presenterImages.length === 0) return; + + let timer = 0; + let loading = false; + let stopped = false; + + const setAll = (elements, value) => elements.forEach((element) => { element.textContent = value; }); + const schedule = () => { + window.clearTimeout(timer); + timer = window.setTimeout(load, document.hidden ? 120000 : 60000); + }; + const render = (program) => { + if (!program) { + setAll(programFields, 'Landwelle Radio · rund um die Uhr'); + setAll(presenterFields, 'Sound & Infos aus Niedersachsen'); + presenterImages.forEach((image) => { + image.src = '/assets/landwelle-logo-trim.png'; + image.alt = 'Landwelle Radio'; + }); + return; + } + const time = program.start && program.end ? `${program.start}–${program.end} Uhr` : (program.time_label || 'jetzt live'); + setAll(programFields, `${program.show || 'Landwelle Radio'} · ${time}`); + const details = []; + if (program.presenter) details.push(`mit ${program.presenter}`); + if (program.program_type) details.push(program.program_type); + setAll(presenterFields, details.join(' · ') || 'Sound & Infos aus Niedersachsen'); + presenterImages.forEach((image) => { + const fallback = '/assets/landwelle-logo-trim.png'; + image.onerror = () => { image.onerror = null; image.src = fallback; }; + image.src = program.image_url || fallback; + image.alt = program.presenter ? `Moderator ${program.presenter}` : (program.show || 'Landwelle Radio'); + }); + }; + const load = async () => { + if (stopped || loading) return; + loading = true; + try { + const response = await fetch('/api/v1/program/current', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const payload = await response.json(); + render(payload?.data || null); + } catch (error) { + render(null); + console.error('Landwelle-Programm:', error); + } finally { + loading = false; + schedule(); + } + }; + + document.addEventListener('visibilitychange', () => { + if (!document.hidden) { + window.clearTimeout(timer); + load(); + } + }); + window.addEventListener('pagehide', () => { + stopped = true; + window.clearTimeout(timer); + }, { once: true }); + load(); + }; + + const initWeather = () => { + const widget = document.querySelector('[data-weather-widget]'); + if (!widget) return; + + const setText = (selector, value) => { + const element = widget.querySelector(selector); + if (element) element.textContent = value; + }; + + const forecastElement = widget.querySelector('[data-weather-forecast]'); + widget.classList.add('is-loading'); + + fetch('/api/v1/weather', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }) + .then((response) => { + if (!response.ok) throw new Error(`HTTP ${response.status}`); + return response.json(); + }) + .then((payload) => { + const weather = payload && payload.data; + if (!weather || !weather.current) throw new Error('Ungültige Wetterdaten'); + + setText('[data-weather-location]', weather.location || 'Visselhövede'); + setText('[data-weather-icon]', weather.current.icon || '🌤️'); + setText('[data-weather-temperature]', `${Math.round(weather.current.temperature)}°`); + setText('[data-weather-description]', weather.current.description || 'wechselhaft'); + setText('[data-weather-apparent]', `Gefühlt ${Math.round(weather.current.apparent_temperature)}°`); + setText('[data-weather-wind]', `${weather.current.wind_direction || '–'} ${Math.round(weather.current.wind_speed)} km/h`); + setText('[data-weather-rain]', `Regen ${weather.current.rain_probability ?? 0} %`); + setText('[data-weather-uv]', `UV ${Number(weather.current.uv_index || 0).toFixed(1)}`); + + if (forecastElement) { + forecastElement.replaceChildren(); + (weather.forecast || []).slice(0, 4).forEach((day) => { + const item = document.createElement('span'); + const weekday = document.createTextNode(day.weekday || '–'); + const icon = document.createElement('small'); + icon.className = 'weather-forecast-icon'; + icon.textContent = day.icon || '🌤️'; + icon.title = day.description || ''; + const temperatures = document.createElement('b'); + temperatures.append(document.createTextNode(`${Math.round(day.temperature_max)}° `)); + const minimum = document.createElement('em'); + minimum.textContent = `${Math.round(day.temperature_min)}°`; + temperatures.append(minimum); + item.append(weekday, icon, temperatures); + forecastElement.append(item); + }); + } + + const fetchedAt = weather.fetched_at ? new Date(weather.fetched_at) : new Date(); + const label = Number.isNaN(fetchedAt.getTime()) + ? '' + : `Aktualisiert ${fetchedAt.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' })} Uhr${weather.stale ? ' · zwischengespeichert' : ''}`; + setText('[data-weather-updated]', label); + widget.classList.remove('is-error'); + }) + .catch((error) => { + widget.classList.add('is-error'); + setText('[data-weather-description]', 'Wetter derzeit nicht erreichbar'); + setText('[data-weather-apparent]', 'Bitte später erneut versuchen'); + setText('[data-weather-updated]', ''); + console.error('Landwelle-Wetter:', error); + }) + .finally(() => widget.classList.remove('is-loading')); + }; + + + const initTrafficSummary = () => { + const count = document.querySelector('[data-traffic-count]'); + const label = document.querySelector('[data-traffic-label]'); + if (!count) return; + fetch('/api/v1/traffic', { headers: { Accept: 'application/json' }, cache: 'no-store' }) + .then((response) => { + if (!response.ok) throw new Error(`HTTP ${response.status}`); + return response.json(); + }) + .then((payload) => { + const traffic = Array.isArray(payload?.data?.traffic) ? payload.data.traffic.length : 0; + const cameras = Array.isArray(payload?.data?.speed_cameras) ? payload.data.speed_cameras.length : 0; + count.textContent = String(traffic + cameras); + if (label) label.textContent = `${traffic} Verkehrs- und ${cameras} Blitzermeldungen`; + }) + .catch(() => { + count.textContent = '–'; + if (label) label.textContent = 'Live-Daten werden erneut geladen'; + }); + }; + + const init = () => { + initConsent(); + initPlayer(); + initNowPlaying(); + initCurrentProgram(); + initWeather(); + initTrafficSummary(); + }; + + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', init, { once: true }); + } else { + init(); + } +})(); + +// Radio dropdown navigation +(() => { + const dropdowns = document.querySelectorAll('[data-nav-dropdown]'); + dropdowns.forEach((dropdown) => { + const button = dropdown.querySelector('.nav-dropdown-toggle'); + if (!button) return; + const close = () => { + dropdown.classList.remove('is-open'); + button.setAttribute('aria-expanded', 'false'); + }; + button.addEventListener('click', (event) => { + event.stopPropagation(); + const willOpen = !dropdown.classList.contains('is-open'); + dropdowns.forEach((other) => { + other.classList.remove('is-open'); + const otherButton = other.querySelector('.nav-dropdown-toggle'); + if (otherButton) otherButton.setAttribute('aria-expanded', 'false'); + }); + if (willOpen) { + dropdown.classList.add('is-open'); + button.setAttribute('aria-expanded', 'true'); + } + }); + dropdown.addEventListener('keydown', (event) => { + if (event.key === 'Escape') { + close(); + button.focus(); + } + }); + document.addEventListener('click', (event) => { + if (!dropdown.contains(event.target)) close(); + }); + }); +})(); + +(() => { + const modal = document.querySelector('[data-auth-modal]'); + if (!modal) return; + const open = () => { modal.hidden = false; document.body.style.overflow = 'hidden'; modal.querySelector('input')?.focus(); }; + const close = () => { modal.hidden = true; document.body.style.overflow = ''; }; + document.querySelectorAll('[data-auth-open]').forEach((button) => button.addEventListener('click', open)); + modal.querySelectorAll('[data-auth-close]').forEach((button) => button.addEventListener('click', close)); + modal.querySelectorAll('[data-auth-tab]').forEach((button) => button.addEventListener('click', () => { + modal.querySelectorAll('[data-auth-tab]').forEach((b) => b.classList.toggle('is-active', b === button)); + modal.querySelectorAll('[data-auth-panel]').forEach((panel) => panel.classList.toggle('is-active', panel.dataset.authPanel === button.dataset.authTab)); + })); + document.addEventListener('keydown', (event) => { if (event.key === 'Escape' && !modal.hidden) close(); }); +})(); + +(() => { + const button = document.querySelector('.account-button'); + if (!button) return; + + fetch('/account/session', { credentials: 'same-origin', cache: 'no-store', headers: { Accept: 'application/json' } }) + .then((response) => response.ok ? response.json() : null) + .then((session) => { + if (!session?.authenticated || !session.user) return; + + const user = session.user; + const replacement = button.cloneNode(false); + replacement.className = 'account-button account-button-user'; + replacement.type = 'button'; + replacement.removeAttribute('data-auth-open'); + replacement.setAttribute('aria-expanded', 'false'); + replacement.setAttribute('aria-haspopup', 'menu'); + replacement.innerHTML = ``; + + const menu = document.createElement('div'); + menu.className = 'account-menu'; + menu.hidden = true; + menu.innerHTML = ` + + Forum öffnen + Neues Thema erstellen +
`; + + const wrap = document.createElement('div'); + wrap.className = 'account-dropdown'; + button.replaceWith(wrap); + wrap.append(replacement, menu); + + const close = () => { + menu.hidden = true; + wrap.classList.remove('is-open'); + replacement.setAttribute('aria-expanded', 'false'); + }; + replacement.addEventListener('click', (event) => { + event.stopPropagation(); + const opening = menu.hidden; + if (opening) { + menu.hidden = false; + wrap.classList.add('is-open'); + replacement.setAttribute('aria-expanded', 'true'); + } else close(); + }); + document.addEventListener('click', (event) => { if (!wrap.contains(event.target)) close(); }); + document.addEventListener('keydown', (event) => { + if (event.key === 'Escape' && !menu.hidden) { + close(); + replacement.focus(); + } + }); + }) + .catch(() => {}); + + function escapeAccountText(value) { + return String(value || '').replace(/[&<>"']/g, (character) => ({ + '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' + })[character]); + } +})(); + +(() => { + 'use strict'; + const VISITOR_KEY = 'landwelle-analytics-visitor-v1'; + const SESSION_KEY = 'landwelle-analytics-session-v1'; + const SESSION_TTL = 30 * 60 * 1000; + let sent = false; + + const uuid = () => { + if (window.crypto?.randomUUID) return window.crypto.randomUUID(); + if (window.crypto?.getRandomValues) { + const values = new Uint8Array(16); + window.crypto.getRandomValues(values); + return [...values].map((value) => value.toString(16).padStart(2, '0')).join(''); + } + return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`; + }; + const read = (key) => { + try { return JSON.parse(window.localStorage.getItem(key) || 'null'); } catch (_) { return null; } + }; + const write = (key, value) => { + try { window.localStorage.setItem(key, JSON.stringify(value)); } catch (_) {} + }; + const identity = () => { + let visitor = read(VISITOR_KEY); + if (!visitor?.id) { + visitor = { id: uuid(), createdAt: new Date().toISOString() }; + write(VISITOR_KEY, visitor); + } + let session = read(SESSION_KEY); + const now = Date.now(); + if (!session?.id || !session.lastSeen || now - Number(session.lastSeen) > SESSION_TTL) { + session = { id: uuid(), startedAt: now, lastSeen: now }; + } else { + session.lastSeen = now; + } + write(SESSION_KEY, session); + return { visitorID: visitor.id, sessionID: session.id }; + }; + const referrerHost = () => { + if (!document.referrer) return ''; + try { + const host = new URL(document.referrer).hostname.toLowerCase(); + return host === window.location.hostname.toLowerCase() ? '' : host; + } catch (_) { return ''; } + }; + const send = () => { + if (sent || window.location.pathname.startsWith('/admin')) return; + if (navigator.globalPrivacyControl === true || navigator.doNotTrack === '1') return; + if (!window.landwelleConsent?.has('analytics')) return; + sent = true; + const ids = identity(); + const payload = JSON.stringify({ + visitor_id: ids.visitorID, + session_id: ids.sessionID, + path: `${window.location.pathname}${window.location.search}`, + page_title: document.title || '', + referrer_host: referrerHost(), + consent: true + }); + if (navigator.sendBeacon) { + const blob = new Blob([payload], { type: 'application/json' }); + if (navigator.sendBeacon('/api/site-analytics/pageview', blob)) return; + } + fetch('/api/site-analytics/pageview', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: payload, + keepalive: true, + credentials: 'same-origin' + }).catch(() => {}); + }; + document.addEventListener('landwelle:consent-changed', (event) => { + if (event.detail?.analytics === true) send(); + }); + if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', send, { once: true }); + else send(); +})(); diff --git a/web/assets/artist-current.jpg b/web/assets/artist-current.jpg new file mode 100644 index 0000000..73a6a11 Binary files /dev/null and b/web/assets/artist-current.jpg differ diff --git a/web/assets/artist-fallback-v1.png b/web/assets/artist-fallback-v1.png new file mode 100644 index 0000000..03a780f Binary files /dev/null and b/web/assets/artist-fallback-v1.png differ diff --git a/web/assets/ausflugstipps-hero-v1.png b/web/assets/ausflugstipps-hero-v1.png new file mode 100644 index 0000000..64d33d0 Binary files /dev/null and b/web/assets/ausflugstipps-hero-v1.png differ diff --git a/web/assets/ausflugstipps-v1.css b/web/assets/ausflugstipps-v1.css new file mode 100644 index 0000000..1ae5946 --- /dev/null +++ b/web/assets/ausflugstipps-v1.css @@ -0,0 +1,45 @@ + +.excursion-hero{ + position:relative; + isolation:isolate; + display:flex; + align-items:flex-end; + min-height:clamp(320px,40vw,520px); + padding:0; + overflow:hidden; + background:#20301d url("/assets/ausflugstipps-hero-v1.png") center 54%/cover no-repeat; +} +.excursion-hero::before{ + content:""; + position:absolute; + inset:0; + z-index:-1; + background: + linear-gradient(90deg,rgba(8,15,10,.76) 0%,rgba(8,15,10,.42) 38%,rgba(8,15,10,.12) 72%), + linear-gradient(0deg,rgba(8,15,10,.62) 0%,transparent 58%); +} +.excursion-hero::after{ + content:none; +} +.excursion-hero .page-shell{ + width:min(var(--page),calc(100% - 40px)); + margin-inline:auto; + padding-top:92px; + padding-bottom:56px; +} +.excursion-hero span, +.excursion-hero h1, +.excursion-hero p{ + text-shadow:0 2px 18px rgba(0,0,0,.48); +} +@media(max-width:650px){ + .excursion-hero{ + min-height:390px; + background-position:64% 50%; + } + .excursion-hero .page-shell{ + width:min(var(--page),calc(100% - 24px)); + padding-top:82px; + padding-bottom:42px; + } +} diff --git a/web/assets/charts-listener-hero-v1.png b/web/assets/charts-listener-hero-v1.png new file mode 100644 index 0000000..a5e30dd Binary files /dev/null and b/web/assets/charts-listener-hero-v1.png differ diff --git a/web/assets/charts-schlager-hero-v1.png b/web/assets/charts-schlager-hero-v1.png new file mode 100644 index 0000000..5d60e07 Binary files /dev/null and b/web/assets/charts-schlager-hero-v1.png differ diff --git a/web/assets/charts-v4.css b/web/assets/charts-v4.css new file mode 100644 index 0000000..0cb215a --- /dev/null +++ b/web/assets/charts-v4.css @@ -0,0 +1,10 @@ +.listener-charts-page{background:#f4f6f1}.charts-wish-hero{position:relative;isolation:isolate;min-height:clamp(310px,38vw,500px);display:flex;align-items:flex-end;overflow:hidden;background:#112018 url("/assets/charts-listener-hero-v1.png") center 54%/cover no-repeat}.charts-wish-hero::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(5,13,11,.82) 0%,rgba(5,13,11,.48) 38%,rgba(5,13,11,.10) 70%),linear-gradient(0deg,rgba(5,13,11,.72) 0%,transparent 54%)}.charts-wish-hero .page-shell{padding-top:92px;padding-bottom:54px}.charts-wish-hero span,.charts-wish-hero h1,.charts-wish-hero p{text-shadow:0 2px 18px rgba(0,0,0,.45)}.charts-wish-hero p{max-width:660px}.charts-intro-layout{align-items:start}.charts-intro-card{min-width:0}.charts-side-card{top:auto}.charts-podium{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;margin-top:26px}.chart-podium-card{position:relative;overflow:hidden;border:1px solid #dfe6dc;border-radius:18px;background:#fff;box-shadow:0 12px 28px rgba(20,35,18,.08)}.chart-podium-card>img{display:block;width:100%;aspect-ratio:1/1;object-fit:cover;background:#edf1eb}.chart-card-copy{padding:18px}.chart-card-copy>span,.chart-copy>span{color:#689d1f;font-size:11px;font-weight:900;letter-spacing:.06em;text-transform:uppercase}.chart-card-copy h3,.chart-copy h3{margin:4px 0 0;color:#162016}.chart-card-copy h3{font-size:20px}.chart-rank{display:grid;place-items:center;width:46px;height:46px;border-radius:50%;background:#7fb91c;color:#fff;font-size:20px;font-weight:900;box-shadow:0 8px 18px rgba(80,126,18,.25)}.chart-podium-card>.chart-rank{position:absolute;top:13px;left:13px;z-index:2}.chart-meta{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:13px 0}.chart-meta em{padding:5px 8px;border-radius:999px;background:#f0f4ed;color:#70796e;font-size:11px;font-style:normal}.trend{display:inline-flex;align-items:center;justify-content:center;min-width:38px;color:#657064;font-weight:900}.trend.is-up{color:#228b22}.trend.is-down{color:#c73d36}.trend.is-new{color:#6d9f25;font-size:11px}.vote-summary{display:flex;align-items:baseline;gap:7px}.vote-summary>b{color:#172018;font-size:22px}.vote-summary span{color:#7b8379;font-size:12px}.vote-badge{display:inline-flex;align-items:center;gap:6px;margin-top:10px;padding:7px 10px;border-radius:999px;background:#e8f5d8;color:#4f7f16;font-size:11px;font-weight:900}.chart-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:15px}.preview-button{border:0;border-radius:999px;padding:9px 13px;background:#101610;color:#fff;font-weight:800;cursor:pointer}.preview-button:hover{background:#253125}.preview-button:disabled{opacity:.35;cursor:not-allowed}.rating{display:flex;gap:4px}.rating button{width:30px;height:30px;border:1px solid #b9c7b4;border-radius:50%;background:#fff;color:#4c6e20;font-weight:850;cursor:pointer}.rating button:hover,.rating button.is-selected{background:#80bd19;color:#fff;border-color:#80bd19}.rating button:disabled{cursor:not-allowed}.rating.is-locked button:not(.is-selected){opacity:.4}.charts-wall{padding-top:42px}.charts-wall-head{margin-bottom:22px}.charts-list{overflow:hidden;border:1px solid #dfe5dc;border-radius:15px;background:#fff;box-shadow:0 8px 25px rgba(26,35,24,.05)}.chart-row{display:grid;grid-template-columns:50px 58px minmax(180px,1fr) 65px 65px 48px 100px 46px minmax(180px,auto);align-items:center;gap:13px;padding:12px 15px;border-bottom:1px solid #e7ebe5}.chart-row:last-child{border-bottom:0}.chart-row>img{width:54px;height:54px;border-radius:9px;object-fit:cover;background:#edf1eb}.chart-copy{min-width:0}.chart-copy h3{font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chart-stat{display:grid;text-align:center}.chart-stat small{color:#7c847a;font-size:10px}.chart-stat b{font-size:15px}.chart-vote-cell{display:grid;justify-items:end;gap:7px}.chart-vote-cell .vote-badge{margin:0}.preview-modal{position:relative;width:min(460px,calc(100% - 30px));padding:30px;border:0;border-radius:20px;background:#101610;color:#fff;box-shadow:0 25px 80px rgba(0,0,0,.5)}.preview-modal::backdrop{background:rgba(0,0,0,.75)}.preview-modal audio{width:100%;margin-top:18px}.preview-close{position:absolute;right:14px;top:12px;border:0;background:transparent;color:#fff;font-size:30px;cursor:pointer}.preview-modal>span{color:#9bd32b;font-size:11px;font-weight:900;text-transform:uppercase}.preview-modal h2{margin:8px 0 4px}.preview-modal p{margin:0;color:#cbd2ca} +@media(max-width:1100px){.charts-podium{grid-template-columns:1fr 1fr}.chart-podium-card:first-child{grid-column:1/-1;display:grid;grid-template-columns:minmax(220px,.8fr) 1.2fr}.chart-podium-card:first-child>img{height:100%;aspect-ratio:auto}.chart-row{grid-template-columns:46px 54px minmax(170px,1fr) 58px 58px 44px 92px 44px}.chart-vote-cell{grid-column:3/-1;grid-row:2;justify-items:start}.chart-row{align-items:center}.chart-row>.preview-button{grid-column:8;grid-row:1}.chart-row>.trend{grid-column:6}.chart-stat{display:grid}} +@media(max-width:850px){.charts-podium{grid-template-columns:1fr}.chart-podium-card:first-child{grid-column:auto;display:block}.chart-row{grid-template-columns:42px 50px minmax(0,1fr) 48px 42px}.chart-stat{display:none}.chart-row>.trend{grid-column:4}.chart-row>.vote-summary{grid-column:5}.chart-row>.preview-button{grid-column:4;grid-row:2;justify-self:start}.chart-vote-cell{grid-column:3/6}.charts-wall{padding-top:34px}} +@media(max-width:600px){.charts-intro-layout{width:min(100% - 24px,var(--page))}.charts-podium{gap:14px}.chart-card-copy{padding:16px}.chart-actions{align-items:flex-start;flex-direction:column}.chart-row{grid-template-columns:38px 48px minmax(0,1fr);gap:9px;padding:10px}.chart-row .chart-rank{width:36px;height:36px;font-size:16px}.chart-row>img{width:46px;height:46px}.chart-row>.trend{grid-column:1;grid-row:2}.chart-row>.vote-summary{grid-column:2;grid-row:2}.chart-row>.preview-button{grid-column:3;grid-row:2;justify-self:end}.chart-vote-cell{grid-column:1/4;grid-row:3;justify-items:start}.chart-vote-cell .rating{flex-wrap:wrap}.charts-wall .page-shell{width:min(100% - 20px,var(--page))}} + +.vote-badge[hidden]{display:none!important} + +@media(max-width:700px){.charts-wish-hero{min-height:360px;background-position:62% center}.charts-wish-hero::before{background:linear-gradient(90deg,rgba(5,13,11,.82),rgba(5,13,11,.38)),linear-gradient(0deg,rgba(5,13,11,.76),transparent 58%)}.charts-wish-hero .page-shell{padding-top:110px;padding-bottom:36px}.charts-wish-hero p{max-width:92%}} + +.charts-schlager-hero{position:relative;isolation:isolate;min-height:clamp(310px,38vw,500px);display:flex;align-items:flex-end;overflow:hidden;background:#2d160d url("/assets/charts-schlager-hero-v1.png") center 52%/cover no-repeat}.charts-schlager-hero::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(26,12,8,.72) 0%,rgba(26,12,8,.36) 42%,rgba(26,12,8,.10) 74%),linear-gradient(0deg,rgba(26,12,8,.64) 0%,transparent 56%)} diff --git a/web/assets/charts-v5.js b/web/assets/charts-v5.js new file mode 100644 index 0000000..af1b269 --- /dev/null +++ b/web/assets/charts-v5.js @@ -0,0 +1,121 @@ +(()=>{ + const body=document.body; + const chartKey=body?.dataset.chartKey||'listener'; + const voteAPI=body?.dataset.chartVoteApi||''; + const voteWindow=24*60*60*1000; + const storagePrefix=`landwelle_chart_vote_${chartKey}_`; + const previewModal=document.querySelector('[data-preview-modal]'); + const previewAudio=previewModal?.querySelector('[data-preview-audio]'); + const previewAudioWrap=previewModal?.querySelector('[data-preview-audio-wrap]'); + const previewVideoWrap=previewModal?.querySelector('[data-preview-video-wrap]'); + const previewVideo=previewModal?.querySelector('[data-preview-video]'); + const infoModal=document.querySelector('[data-song-info-modal]'); + + document.querySelector('[data-chart-year-select]')?.addEventListener('change',event=>{ + const form=event.currentTarget.form; + if(!form)return; + if(typeof form.requestSubmit==='function')form.requestSubmit(); + else form.submit(); + }); + + function youtubeID(raw){ + try{ + if(/^[A-Za-z0-9_-]{11}$/.test(raw||''))return raw; + const url=new URL(raw,location.origin); + const host=url.hostname.replace(/^www\./,'').toLowerCase(); + if(host==='youtu.be')return url.pathname.split('/').filter(Boolean)[0]||''; + if(['youtube.com','m.youtube.com','music.youtube.com','youtube-nocookie.com'].includes(host)){ + const direct=url.searchParams.get('v'); + if(direct)return direct; + const parts=url.pathname.split('/').filter(Boolean); + if(['embed','shorts','live'].includes(parts[0]))return parts[1]||''; + } + }catch{} + return ''; + } + + function stopPreview(){ + if(previewAudio){previewAudio.pause();previewAudio.removeAttribute('src');previewAudio.load();} + if(previewVideo)previewVideo.removeAttribute('src'); + } + + document.querySelectorAll('[data-preview]').forEach(button=>button.addEventListener('click',()=>{ + if(!previewModal)return; + stopPreview(); + const source=button.dataset.preview||''; + const videoID=youtubeID(source); + previewModal.querySelector('[data-preview-title]').textContent=button.dataset.title||''; + previewModal.querySelector('[data-preview-artist]').textContent=button.dataset.artist||''; + const cover=previewModal.querySelector('[data-preview-cover]'); + const coverEmpty=previewModal.querySelector('[data-preview-cover-empty]'); + if(button.dataset.cover){cover.src=button.dataset.cover;cover.hidden=false;coverEmpty.hidden=true;}else{cover.removeAttribute('src');cover.hidden=true;coverEmpty.hidden=false;} + if(videoID&&previewVideo){ + previewAudioWrap.hidden=true;previewVideoWrap.hidden=false; + previewVideo.src=`https://www.youtube-nocookie.com/embed/${encodeURIComponent(videoID)}?autoplay=1&rel=0&modestbranding=1`; + }else if(previewAudio){ + previewVideoWrap.hidden=true;previewAudioWrap.hidden=false; + previewAudio.src=source; + } + previewModal.showModal(); + if(!videoID&&previewAudio)previewAudio.play().catch(()=>{}); + })); + previewModal?.querySelector('[data-modal-close]')?.addEventListener('click',()=>previewModal.close()); + previewModal?.addEventListener('close',stopPreview); + previewModal?.addEventListener('cancel',stopPreview); + previewModal?.addEventListener('click',event=>{if(event.target===previewModal)previewModal.close();}); + + const timers=new WeakMap(); + function countdown(ms){const s=Math.max(0,Math.ceil(ms/1000));return `${String(Math.floor(s/3600)).padStart(2,'0')}:${String(Math.floor((s%3600)/60)).padStart(2,'0')}:${String(s%60).padStart(2,'0')}`;} + function unlock(group){ + const timer=timers.get(group);if(timer)clearInterval(timer);timers.delete(group); + group.classList.remove('is-locked');group.querySelectorAll('button').forEach(b=>{b.disabled=false;b.classList.remove('is-selected')}); + const badge=group.closest('[data-chart-entry]')?.querySelector('[data-vote-badge]');if(badge){badge.hidden=true;badge.textContent='✓ Du hast gevotet';} + try{localStorage.removeItem(storagePrefix+group.dataset.entry)}catch{} + } + function lock(group,rating,expiresAt,prefix){ + group.classList.add('is-locked');group.querySelectorAll('button').forEach(b=>{b.disabled=true;b.classList.toggle('is-selected',Number(b.dataset.rating)<=rating)}); + const badge=group.closest('[data-chart-entry]')?.querySelector('[data-vote-badge]'); + const update=()=>{const remaining=expiresAt-Date.now();if(remaining<=0){unlock(group);return;}if(badge){badge.hidden=false;badge.textContent=`${prefix} ${countdown(remaining)}`;}}; + update();const old=timers.get(group);if(old)clearInterval(old);timers.set(group,setInterval(update,1000)); + try{localStorage.setItem(storagePrefix+group.dataset.entry,JSON.stringify({rating,expiresAt}))}catch{} + } + document.querySelectorAll('.chart-rating[data-entry]').forEach(group=>{ + try{const saved=JSON.parse(localStorage.getItem(storagePrefix+group.dataset.entry)||'null');if(saved?.expiresAt>Date.now())lock(group,Number(saved.rating)||0,Number(saved.expiresAt),'✓ Gevotet · erneut in');}catch{} + group.querySelectorAll('[data-rating]').forEach(button=>button.addEventListener('click',async()=>{ + if(group.classList.contains('is-locked')||!voteAPI)return; + const rating=Number(button.dataset.rating),entryID=Number(group.dataset.entry); + group.querySelectorAll('button').forEach(b=>b.disabled=true); + try{ + const response=await fetch(voteAPI,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({entry_id:entryID,rating})}); + const payload=await response.json().catch(()=>({})); + if(!response.ok&&response.status!==429)throw new Error(payload.message||payload.error?.message||'Voting fehlgeschlagen'); + const next=Date.parse(payload.next_vote_at||''); + const expiresAt=Number.isFinite(next)?next:Date.now()+(Number(payload.retry_after_seconds)||86400)*1000; + lock(group,rating,expiresAt,response.status===429?'✓ Bereits gevotet · erneut in':'✓ Gevotet · erneut in'); + if(response.ok){const value=group.closest('[data-chart-entry]')?.querySelector('[data-vote-points]');if(value&&payload.vote_points!==undefined)value.textContent=String(payload.vote_points);} + }catch(error){group.querySelectorAll('button').forEach(b=>b.disabled=false);alert(error.message||'Deine Stimme konnte nicht gespeichert werden.');} + })); + }); + + function closeInfo(){infoModal?.close();} + infoModal?.querySelector('[data-info-close]')?.addEventListener('click',closeInfo); + infoModal?.addEventListener('click',event=>{if(event.target===infoModal)closeInfo();}); + document.querySelectorAll('[data-song-info]').forEach(button=>button.addEventListener('click',async()=>{ + if(button.disabled||!infoModal)return; + const loading=infoModal.querySelector('[data-info-loading]'),content=infoModal.querySelector('[data-info-content]'),error=infoModal.querySelector('[data-info-error]'); + infoModal.querySelector('[data-info-title]').textContent=button.dataset.title||''; + infoModal.querySelector('[data-info-artist]').textContent=button.dataset.artist||''; + loading.hidden=false;content.hidden=true;error.hidden=true;infoModal.showModal(); + try{ + const response=await fetch(`/api/charts/jahrescharts/info?year=${encodeURIComponent(button.dataset.year||'')}&position=${encodeURIComponent(button.dataset.position||'')}`,{headers:{Accept:'application/json'}}); + const payload=await response.json().catch(()=>({}));if(!response.ok)throw new Error(payload.message||payload.error?.message||'Titelinformationen konnten nicht geladen werden.'); + const data=payload.data||{}; + infoModal.querySelector('[data-info-artist-text]').textContent=data.artist_info||'Keine Künstlerinfo vorhanden.'; + infoModal.querySelector('[data-info-song-text]').textContent=data.song_info||'Keine Titelinfo vorhanden.'; + infoModal.querySelector('[data-info-year]').textContent=data.release_year||'–'; + infoModal.querySelector('[data-info-genre]').textContent=data.genre||'–'; + infoModal.querySelector('[data-info-dance]').textContent=data.dance_styles||'–'; + loading.hidden=true;content.hidden=false; + }catch(err){loading.hidden=true;error.hidden=false;error.textContent=err.message;} + })); +})(); diff --git a/web/assets/charts-v7.css b/web/assets/charts-v7.css new file mode 100644 index 0000000..37cb7f7 --- /dev/null +++ b/web/assets/charts-v7.css @@ -0,0 +1,31 @@ +.charts-page{background:#f3f6ef;color:#1c261b}.charts-hero{position:relative;isolation:isolate;min-height:410px;display:flex;align-items:flex-end;overflow:hidden;background:#182517}.charts-hero:before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(8,17,10,.9),rgba(8,17,10,.58) 48%,rgba(8,17,10,.2)),linear-gradient(0deg,rgba(8,17,10,.78),transparent 65%)}.charts-wish-hero{background-image:url('/assets/charts-listener-hero-v1.png');background-position:center 54%;background-size:cover}.charts-schlager-hero,.charts-annual-hero{background-image:url('/assets/charts-schlager-hero-v1.png');background-position:center 50%;background-size:cover}.charts-docx-hero{background-image:linear-gradient(120deg,#0a1812,#1f4929 55%,#628d21)}.charts-hero-inner{padding-top:120px;padding-bottom:56px;color:#fff}.charts-kicker,.charts-section-heading span{display:block;color:#91ca2a;font-size:.75rem;font-weight:900;letter-spacing:.16em;text-transform:uppercase}.charts-hero h1{max-width:900px;margin:10px 0 12px;font-size:clamp(2.8rem,7vw,5.6rem);line-height:.96}.charts-hero p{max-width:720px;margin:0;color:#e2eadf;font-size:clamp(1rem,2vw,1.22rem);line-height:1.7}.charts-release-note{display:inline-flex;margin-top:22px;padding:10px 14px;border:1px solid rgba(255,255,255,.18);border-radius:999px;background:rgba(0,0,0,.26);font-size:.86rem}.chart-year-picker{display:flex;gap:12px;align-items:center;width:max-content;margin-top:22px;padding:10px 12px;border-radius:14px;background:rgba(0,0,0,.38);border:1px solid rgba(255,255,255,.16)}.chart-year-picker label{font-weight:850}.chart-year-picker select{min-width:220px;border:0;border-radius:9px;padding:9px;background:#fff;color:#1a2819;font-weight:750}.charts-overview,.charts-ranking-section .page-shell,.charts-new-section .page-shell{padding-top:54px;padding-bottom:54px}.charts-section-heading{display:flex;justify-content:space-between;gap:24px;align-items:end;margin-bottom:26px}.charts-section-heading h2{margin:7px 0;font-size:clamp(1.8rem,4vw,3rem)}.charts-section-heading p{max-width:760px;margin:0;color:#667063}.charts-section-heading.compact{margin-bottom:20px}.charts-section-heading.compact h2{font-size:clamp(1.65rem,3vw,2.3rem)}.charts-section-heading>b,.charts-updated{padding:9px 12px;border:1px solid #d7e0d2;border-radius:999px;background:#fff;color:#597052;font-size:.82rem;white-space:nowrap}.charts-podium{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}.chart-podium-card{overflow:hidden;border:1px solid #d7e2d1;border-radius:24px;background:#fff;box-shadow:0 18px 45px rgba(35,57,29,.09)}.chart-podium-card.position-1{border-color:#8fbd3b;box-shadow:0 20px 54px rgba(92,139,29,.18)}.chart-podium-media{position:relative;aspect-ratio:16/10;max-height:255px;overflow:hidden;background:#e7eee2}.chart-podium-media img{width:100%;height:100%;object-fit:cover}.chart-position-badge{position:absolute;top:16px;left:16px;display:grid;place-items:center;width:58px;height:58px;border-radius:18px;background:linear-gradient(145deg,#96d126,#5f9416);color:#fff;font-size:1.7rem;box-shadow:0 12px 25px rgba(61,100,12,.28)}.chart-podium-copy{padding:22px}.chart-artist,.chart-row-title span,.chart-new-card>div>span{color:#668f20;font-size:.75rem;font-weight:900;letter-spacing:.06em;text-transform:uppercase}.chart-podium-copy h3,.chart-row-title h3,.chart-new-card h3{margin:5px 0 0}.chart-podium-copy h3{font-size:1.45rem}.chart-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:18px 0}.chart-facts>div{padding:10px;border-radius:13px;background:#f3f6f0}.chart-facts small,.chart-row-stat small{display:block;color:#7a8477;font-size:.67rem;text-transform:uppercase}.chart-facts strong{display:block;margin-top:2px}.chart-trend{display:inline-flex;align-items:center;justify-content:center;min-width:38px;font-weight:950}.chart-trend.is-up{color:#1f9b47}.chart-trend.is-down{color:#cc4038}.chart-trend.is-new{color:#6b9d1c;font-size:.74rem}.chart-card-actions,.chart-row-actions{display:flex;flex-wrap:wrap;gap:8px}.chart-preview-button,.chart-info-button{border:0;border-radius:999px;padding:9px 13px;background:#152015;color:#fff;font-weight:850;cursor:pointer}.chart-preview-button:hover{background:#2c3d29}.chart-info-button{background:#eaf4da;color:#527b16}.chart-info-button.has-info:hover{background:#dbeec2}.chart-info-button:disabled{opacity:.45;cursor:not-allowed}.chart-preview-missing{display:inline-flex;padding:9px 12px;border-radius:999px;background:#edf0eb;color:#8a9187;font-size:.75rem}.chart-vote-panel{margin-top:16px;padding:13px;border-radius:15px;background:#19251a;color:#fff}.chart-vote-panel>span{display:block;margin-bottom:8px;color:#d8e4d3;font-size:.75rem}.chart-vote-panel.compact{background:transparent;color:#1c261b;padding:12px 0 0}.chart-rating{display:flex;flex-wrap:wrap;gap:6px}.chart-rating button{width:35px;height:35px;border:1px solid #a9ba9f;border-radius:50%;background:#fff;color:#527a19;font-weight:900;cursor:pointer}.chart-rating button:hover,.chart-rating button.is-selected{border-color:#78ad1f;background:#78ad1f;color:#fff}.chart-rating.is-locked button:not(.is-selected){opacity:.4}.chart-vote-panel em,.chart-row-vote em{display:block;margin-top:8px;color:#a9d96d;font-size:.72rem;font-style:normal}.charts-ranking-section{background:#e9eee5}.charts-ranking-list{overflow:hidden;border:1px solid #d5dfcf;border-radius:20px;background:#fff;box-shadow:0 12px 34px rgba(33,51,29,.06)}.chart-ranking-row{display:grid;grid-template-columns:54px 64px minmax(180px,1fr) 88px 80px 90px 50px minmax(170px,.9fr) minmax(190px,auto);gap:12px;align-items:center;padding:12px 16px;border-bottom:1px solid #e5eae2}.chart-ranking-row:last-child{border-bottom:0}.chart-row-position{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:#eef5e6;color:#4e7c15;font-size:1.1rem}.chart-ranking-row>img{width:58px;height:58px;border-radius:11px;object-fit:cover;background:#e8ede5}.chart-row-title{min-width:0}.chart-row-title h3{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem}.chart-row-stat{text-align:center}.chart-row-stat strong{font-size:.9rem}.chart-row-vote{display:grid;justify-items:end}.charts-new-section{background:#f8faf6}.charts-new-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.chart-new-card{display:grid;grid-template-columns:112px minmax(0,1fr);gap:16px;padding:14px;border:1px solid #d9e1d4;border-radius:18px;background:#fff}.chart-new-media{position:relative}.chart-new-media img{width:112px;height:112px;border-radius:13px;object-fit:cover}.chart-new-media b{position:absolute;left:7px;top:7px;display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:#6fa517;color:#fff}.charts-empty{padding:42px;border:1px dashed #cbd7c4;border-radius:20px;background:#fff;text-align:center}.charts-empty>span{font-size:2rem;color:#74a91b}.chart-media-modal,.chart-info-modal{position:relative;width:min(590px,calc(100% - 26px));border:0;border-radius:24px;padding:28px;background:#172117;color:#fff;box-shadow:0 30px 90px rgba(0,0,0,.55)}.chart-media-modal::backdrop,.chart-info-modal::backdrop{background:rgba(0,0,0,.78)}.chart-modal-close{position:absolute;right:15px;top:12px;border:0;background:transparent;color:#fff;font-size:2rem;cursor:pointer}.chart-media-modal>span,.chart-info-modal>span{color:#9bd239;font-size:.72rem;font-weight:900;text-transform:uppercase}.chart-media-modal h2,.chart-info-modal h2{margin:8px 0 4px}.chart-media-modal p,.chart-info-artist{margin:0 0 16px;color:#cbd6c8}.chart-modal-cover{float:left;width:110px;height:110px;margin:0 18px 14px 0;border-radius:17px;overflow:hidden;background:#2b382a;display:grid;place-items:center}.chart-modal-cover img{width:100%;height:100%;object-fit:cover}.chart-modal-cover span{font-size:2rem}.chart-media-modal audio{width:100%;margin-top:15px}.chart-video-wrap{clear:both;aspect-ratio:16/9;margin-top:18px}.chart-video-wrap iframe{width:100%;height:100%;border:0;border-radius:14px}.chart-info-modal section{padding:14px 0;border-top:1px solid rgba(255,255,255,.1)}.chart-info-modal section h3{margin:0 0 7px;color:#9bd239}.chart-info-modal section p{margin:0;line-height:1.65;color:#edf3eb}.chart-info-modal dl{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}.chart-info-modal dl div{padding:11px;border-radius:12px;background:rgba(255,255,255,.07)}.chart-info-modal dt{color:#9da99a;font-size:.68rem;text-transform:uppercase}.chart-info-modal dd{margin:5px 0 0;font-weight:800}.chart-info-error{padding:13px;border-radius:12px;background:#5f2323;color:#fff}.chart-info-loading{padding:18px 0;color:#cad5c7} +@media(max-width:1150px){.charts-podium{grid-template-columns:1fr 1fr}.chart-podium-card.position-1{grid-column:1/-1;display:grid;grid-template-columns:minmax(280px,.8fr) 1.2fr}.chart-ranking-row{grid-template-columns:48px 58px minmax(180px,1fr) 75px 75px 48px minmax(150px,1fr)}.chart-ranking-row .chart-row-stat:nth-of-type(3){display:none}.chart-row-vote{grid-column:3/-1;justify-items:start}.charts-new-grid{grid-template-columns:1fr 1fr}} +@media(max-width:800px){.charts-podium{grid-template-columns:1fr}.chart-podium-card.position-1{grid-column:auto;display:block}.charts-section-heading{align-items:flex-start;flex-direction:column}.chart-ranking-row{grid-template-columns:42px 52px minmax(0,1fr) 44px}.chart-ranking-row .chart-row-stat,.chart-ranking-row>.chart-trend{display:none}.chart-row-actions{grid-column:3/5}.chart-row-vote{grid-column:1/5}.charts-new-grid{grid-template-columns:1fr}.chart-info-modal dl{grid-template-columns:1fr}} +@media(max-width:520px){.charts-hero-inner{padding-top:110px;padding-bottom:38px}.charts-hero{min-height:360px}.chart-year-picker{width:100%;align-items:stretch;flex-direction:column}.chart-year-picker select{min-width:0}.charts-overview,.charts-ranking-section .page-shell,.charts-new-section .page-shell{padding-top:38px;padding-bottom:38px}.chart-new-card{grid-template-columns:88px minmax(0,1fr)}.chart-new-media img{width:88px;height:88px}.chart-facts{grid-template-columns:1fr 1fr}} + +/* v1.5.11 – eigenständige Landwelle-Chartwelten und klarer Voting-Zustand */ +.charts-guide-card{display:flex;align-items:center;justify-content:space-between;gap:24px;margin:0 0 28px;padding:20px 22px;border:1px solid #d4dfce;border-radius:20px;background:linear-gradient(135deg,#fff,#f2f7ed);box-shadow:0 14px 36px rgba(31,53,25,.07)} +.charts-guide-card>div{max-width:760px}.charts-guide-card span,.charts-archive-note>span{display:block;color:#6d9f23;font-size:.72rem;font-weight:950;letter-spacing:.12em;text-transform:uppercase}.charts-guide-card h3{margin:5px 0 6px;font-size:1.35rem}.charts-guide-card p,.charts-archive-note p{margin:0;color:#637061;line-height:1.6}.charts-vote-mark,.charts-archive-seal{display:grid;place-items:center;flex:0 0 88px;width:88px;height:88px;border-radius:50%;background:#182318;color:#a9db55;text-align:center;font-size:1.25rem;line-height:1.05;box-shadow:inset 0 0 0 5px rgba(255,255,255,.08)}.charts-vote-mark small{font-size:.58rem;letter-spacing:.08em;text-transform:uppercase}.charts-archive-note{margin:-8px 0 28px;padding:18px 20px 18px 72px;border:1px solid #cbbd96;border-radius:8px;background:linear-gradient(90deg,rgba(116,82,36,.12),rgba(255,252,240,.92));position:relative}.charts-archive-note:before{content:'♫';position:absolute;left:22px;top:50%;transform:translateY(-50%);font-size:2rem;color:#8a642c} +.chart-vote-countdown{display:block!important;margin-top:0!important;padding:13px 15px;border:1px solid #39543b;border-radius:14px;background:#203422;color:#fff!important;font-style:normal;box-shadow:0 8px 20px rgba(21,43,23,.16)}.chart-vote-countdown[hidden]{display:none!important}.chart-vote-countdown strong,.chart-vote-countdown span{display:block}.chart-vote-countdown strong{font-size:.86rem}.chart-vote-countdown span{margin-top:4px;color:#e3ede0;font-size:.72rem}.chart-vote-countdown b{display:inline-block;min-width:74px;margin-left:4px;color:#c8ef8d;font-size:.92rem;font-variant-numeric:tabular-nums;letter-spacing:.04em}.chart-row-vote .chart-vote-countdown{min-width:185px;text-align:left;background:#203422}.chart-new-card .chart-vote-countdown{margin-top:10px!important}.chart-rating[hidden]{display:none!important}.is-vote-locked .chart-vote-panel>span{display:none}.is-vote-locked .chart-vote-panel{padding:0;background:transparent}.is-vote-locked.chart-ranking-row{background:linear-gradient(90deg,#fff,#f4f8f0)} + +/* Zuhörer-Charts: norddeutsch, warm und radio-nah */ +.chart-theme-listener .charts-ranking-section{background:linear-gradient(180deg,#e6eee0,#edf2e9)}.chart-theme-listener .chart-position-badge,.chart-theme-listener .chart-new-media b{background:linear-gradient(145deg,#96d126,#4f7d16)}.chart-theme-listener .charts-guide-card{border-left:6px solid #79b72a} + +/* docX: dunkler, kantiger und alternativer */ +.chart-theme-dockx .charts-page{background:#0d1110}.chart-theme-dockx .charts-docx-hero{background-image:radial-gradient(circle at 78% 30%,rgba(85,246,169,.2),transparent 30%),linear-gradient(120deg,#080b0a,#16241f 56%,#2c4d3f)}.chart-theme-dockx .charts-overview,.chart-theme-dockx .charts-new-section .page-shell{color:#edf5f0}.chart-theme-dockx .charts-section-heading p{color:#aebdb4}.chart-theme-dockx .charts-updated,.chart-theme-dockx .charts-section-heading>b{background:#151b18;border-color:#314139;color:#b7d7c5}.chart-theme-dockx .charts-guide-card{background:linear-gradient(135deg,#131a17,#202d27);border-color:#335244;color:#edf5f0}.chart-theme-dockx .charts-guide-card p{color:#b7c8bf}.chart-theme-dockx .charts-guide-card span,.chart-theme-dockx .chart-artist,.chart-theme-dockx .chart-row-title span,.chart-theme-dockx .chart-new-card>div>span{color:#75e0a5}.chart-theme-dockx .chart-podium-card,.chart-theme-dockx .chart-new-card{background:#151b18;border-color:#2d3b34;color:#f4faf6}.chart-theme-dockx .chart-facts>div{background:#202923}.chart-theme-dockx .chart-facts small{color:#9dac9f}.chart-theme-dockx .charts-ranking-section{background:#101512}.chart-theme-dockx .charts-ranking-list{background:#171d19;border-color:#2e3932}.chart-theme-dockx .chart-ranking-row{border-color:#2a332d;color:#eef5f0}.chart-theme-dockx .chart-row-position{background:#26342d;color:#73dfa4}.chart-theme-dockx .chart-row-stat small{color:#98a79d}.chart-theme-dockx .charts-new-section{background:#0d1110}.chart-theme-dockx .chart-preview-button{background:#74e0a5;color:#07110c}.chart-theme-dockx .chart-rating button{background:#0e1511;border-color:#4b6a5a;color:#7be5aa}.chart-theme-dockx .chart-rating button:hover{background:#65d799;color:#08110d}.chart-theme-dockx .chart-vote-panel{background:#0a0f0c} + +/* Schlager: Bühne, Licht und warme Goldtöne */ +.chart-theme-schlager .charts-schlager-hero{background-position:center 44%}.chart-theme-schlager .charts-kicker,.chart-theme-schlager .charts-section-heading span,.chart-theme-schlager .chart-artist,.chart-theme-schlager .chart-row-title span,.chart-theme-schlager .chart-new-card>div>span{color:#bd791e}.chart-theme-schlager .charts-guide-card{border-left:6px solid #c28628;background:linear-gradient(135deg,#fffaf2,#f9ead4)}.chart-theme-schlager .chart-position-badge,.chart-theme-schlager .chart-new-media b{background:linear-gradient(145deg,#d7a343,#8d4f18)}.chart-theme-schlager .chart-podium-card.position-1{border-color:#d2a352;box-shadow:0 20px 54px rgba(151,91,25,.18)}.chart-theme-schlager .charts-ranking-section{background:linear-gradient(180deg,#f5eadc,#f8f2e9)}.chart-theme-schlager .chart-row-position{background:#f7e7d1;color:#965c1d}.chart-theme-schlager .chart-preview-button{background:#6f2e27}.chart-theme-schlager .chart-rating button{color:#9d601b}.chart-theme-schlager .chart-rating button:hover{background:#bd791e;border-color:#bd791e} + +/* Jahrescharts: vergilbtes Musikarchiv mit Jahrzehnte-Charakter */ +.chart-theme-archive{background:#e8ddc5}.chart-theme-archive .charts-page{font-family:Georgia,'Times New Roman',serif;background:radial-gradient(circle at 20% 20%,rgba(255,255,255,.5),transparent 34%),repeating-linear-gradient(0deg,rgba(82,55,22,.025) 0,rgba(82,55,22,.025) 1px,transparent 1px,transparent 5px),#e9dfca}.chart-theme-archive .charts-annual-hero{background-image:linear-gradient(90deg,rgba(30,19,9,.88),rgba(45,27,11,.48)),url('/assets/charts-schlager-hero-v1.png');filter:sepia(.45)}.chart-theme-archive .charts-hero h1{font-family:Georgia,'Times New Roman',serif;letter-spacing:-.04em}.chart-theme-archive .charts-kicker{color:#e6bd72}.chart-theme-archive .chart-year-picker{border-radius:4px;background:rgba(54,34,14,.74);border-color:rgba(255,236,199,.35)}.chart-theme-archive .chart-year-picker select{border-radius:2px;background:#f2e4c8;font-family:Georgia,'Times New Roman',serif}.chart-theme-archive .charts-guide-card{border-radius:5px;border:1px solid #bca77e;background:linear-gradient(135deg,#f8efd9,#e9d8b8);box-shadow:0 10px 20px rgba(74,48,20,.1)}.chart-theme-archive .charts-archive-seal{border-radius:50%;background:#7b2f22;color:#f4dfb0;font-family:Georgia,'Times New Roman',serif;transform:rotate(-6deg);box-shadow:inset 0 0 0 4px #d7b97a,0 4px 12px rgba(63,32,16,.25)}.chart-theme-archive .charts-section-heading span,.chart-theme-archive .chart-artist,.chart-theme-archive .chart-row-title span{color:#85572a}.chart-theme-archive .chart-podium-card,.chart-theme-archive .charts-ranking-list{border-radius:5px;border-color:#bda982;background:#f8efd9;box-shadow:0 10px 25px rgba(70,44,17,.12)}.chart-theme-archive .chart-podium-card.position-1{border-color:#8e6f3e}.chart-theme-archive .chart-position-badge{border-radius:50%;background:#7c4d26;color:#f6e6c5}.chart-theme-archive .chart-facts>div{border-radius:3px;background:#eadcc1}.chart-theme-archive .charts-ranking-section{background:rgba(123,91,47,.12);border-top:1px solid #c4ae84;border-bottom:1px solid #c4ae84}.chart-theme-archive .chart-ranking-row{border-color:#d8c7a7}.chart-theme-archive .chart-row-position{border-radius:50%;background:#e3d2b1;color:#6e4825}.chart-theme-archive .chart-preview-button{border-radius:4px;background:#52351e}.chart-theme-archive .chart-info-button{border-radius:4px;background:#e0c99f;color:#65451f}.chart-theme-archive .charts-updated,.chart-theme-archive .charts-section-heading>b{border-radius:3px;background:#f6ead1;border-color:#cbb58b;color:#6f5434} + +@media(max-width:700px){.charts-guide-card{align-items:flex-start}.charts-vote-mark,.charts-archive-seal{flex-basis:68px;width:68px;height:68px;font-size:1rem}.charts-archive-note{padding-left:54px}.charts-archive-note:before{left:16px}.chart-row-vote .chart-vote-countdown{width:100%;min-width:0}} + +/* v1.5.11 – kompaktere Top 3 und klarer Voting-Countdown */ +.chart-podium-card.position-1{grid-template-columns:minmax(250px,.68fr) 1.32fr} +.chart-theme-dockx .chart-vote-countdown{border-color:#4d7c65;background:#17271f}.chart-theme-dockx .chart-vote-countdown b{color:#86edb3} +.chart-theme-schlager .chart-vote-countdown{border-color:#9e6b2f;background:#5a3923}.chart-theme-schlager .chart-vote-countdown b{color:#ffe09b} +.chart-theme-archive .chart-vote-countdown{border-color:#876b43;border-radius:4px;background:#503b27}.chart-theme-archive .chart-vote-countdown b{color:#f4dca8} +@media(max-width:920px){.chart-podium-media{max-height:230px}.chart-podium-card.position-1{grid-template-columns:1fr}} +@media(max-width:700px){.chart-podium-media{aspect-ratio:16/9;max-height:210px}} diff --git a/web/assets/charts-v7.js b/web/assets/charts-v7.js new file mode 100644 index 0000000..76cc154 --- /dev/null +++ b/web/assets/charts-v7.js @@ -0,0 +1,178 @@ +(()=>{ + const body=document.body; + const voteAPI=body?.dataset.chartVoteApi||''; + const voteStatusAPI=body?.dataset.chartVoteStatusApi||''; + const previewModal=document.querySelector('[data-preview-modal]'); + const previewAudio=previewModal?.querySelector('[data-preview-audio]'); + const previewAudioWrap=previewModal?.querySelector('[data-preview-audio-wrap]'); + const previewVideoWrap=previewModal?.querySelector('[data-preview-video-wrap]'); + const previewVideo=previewModal?.querySelector('[data-preview-video]'); + const infoModal=document.querySelector('[data-song-info-modal]'); + + document.querySelector('[data-chart-year-select]')?.addEventListener('change',event=>{ + const form=event.currentTarget.form; + if(!form)return; + if(typeof form.requestSubmit==='function')form.requestSubmit(); + else form.submit(); + }); + + function youtubeID(raw){ + try{ + if(/^[A-Za-z0-9_-]{11}$/.test(raw||''))return raw; + const url=new URL(raw,location.origin); + const host=url.hostname.replace(/^www\./,'').toLowerCase(); + if(host==='youtu.be')return url.pathname.split('/').filter(Boolean)[0]||''; + if(['youtube.com','m.youtube.com','music.youtube.com','youtube-nocookie.com'].includes(host)){ + const direct=url.searchParams.get('v'); + if(direct)return direct; + const parts=url.pathname.split('/').filter(Boolean); + if(['embed','shorts','live'].includes(parts[0]))return parts[1]||''; + } + }catch{} + return ''; + } + + function stopPreview(){ + if(previewAudio){previewAudio.pause();previewAudio.removeAttribute('src');previewAudio.load();} + if(previewVideo)previewVideo.removeAttribute('src'); + } + + document.querySelectorAll('[data-preview]').forEach(button=>button.addEventListener('click',()=>{ + if(!previewModal)return; + stopPreview(); + const source=button.dataset.preview||''; + const videoID=youtubeID(source); + previewModal.querySelector('[data-preview-title]').textContent=button.dataset.title||''; + previewModal.querySelector('[data-preview-artist]').textContent=button.dataset.artist||''; + const cover=previewModal.querySelector('[data-preview-cover]'); + const coverEmpty=previewModal.querySelector('[data-preview-cover-empty]'); + if(button.dataset.cover){cover.src=button.dataset.cover;cover.hidden=false;coverEmpty.hidden=true;}else{cover.removeAttribute('src');cover.hidden=true;coverEmpty.hidden=false;} + if(videoID&&previewVideo){ + previewAudioWrap.hidden=true;previewVideoWrap.hidden=false; + previewVideo.src=`https://www.youtube-nocookie.com/embed/${encodeURIComponent(videoID)}?autoplay=1&rel=0&modestbranding=1`; + }else if(previewAudio){ + previewVideoWrap.hidden=true;previewAudioWrap.hidden=false; + previewAudio.src=source; + } + previewModal.showModal(); + if(!videoID&&previewAudio)previewAudio.play().catch(()=>{}); + })); + previewModal?.querySelector('[data-modal-close]')?.addEventListener('click',()=>previewModal.close()); + previewModal?.addEventListener('close',stopPreview); + previewModal?.addEventListener('cancel',stopPreview); + previewModal?.addEventListener('click',event=>{if(event.target===previewModal)previewModal.close();}); + + const timers=new WeakMap(); + function countdown(ms){ + const seconds=Math.max(0,Math.ceil(ms/1000)); + const hours=Math.floor(seconds/3600); + const minutes=Math.floor((seconds%3600)/60); + const rest=seconds%60; + return `${String(hours).padStart(2,'0')}:${String(minutes).padStart(2,'0')}:${String(rest).padStart(2,'0')}`; + } + function cardFor(group){return group.closest('[data-chart-entry]');} + function unlock(group){ + const timer=timers.get(group); + if(timer)clearInterval(timer); + timers.delete(group); + group.classList.remove('is-locked'); + group.hidden=false; + group.querySelectorAll('button').forEach(button=>{button.disabled=false;button.classList.remove('is-selected');}); + const card=cardFor(group); + card?.classList.remove('is-vote-locked'); + const badge=card?.querySelector('[data-vote-badge]'); + if(badge){badge.hidden=true;badge.textContent='';} + } + function lock(group,rating,expiresAt,label='Danke, deine Stimme zählt!'){ + const card=cardFor(group); + const badge=card?.querySelector('[data-vote-badge]'); + group.classList.add('is-locked'); + group.querySelectorAll('button').forEach(button=>{button.disabled=true;button.classList.toggle('is-selected',Number(button.dataset.rating)<=rating);}); + group.hidden=true; + card?.classList.add('is-vote-locked'); + const update=()=>{ + const remaining=expiresAt-Date.now(); + if(remaining<=0){unlock(group);return;} + if(badge){ + badge.hidden=false; + badge.innerHTML=`${label}Wieder abstimmen in ${countdown(remaining)}`; + } + }; + update(); + const old=timers.get(group); + if(old)clearInterval(old); + timers.set(group,setInterval(update,1000)); + } + + const voteGroups=[...document.querySelectorAll('.chart-rating[data-entry]')]; + async function loadVoteStatus(){ + if(!voteStatusAPI||voteGroups.length===0)return; + try{ + const response=await fetch(voteStatusAPI,{headers:{Accept:'application/json'},cache:'no-store'}); + const payload=await response.json().catch(()=>({})); + if(!response.ok)throw new Error('Voting-Status nicht verfügbar'); + const byEntry=new Map((payload.votes||[]).map(item=>[Number(item.entry_id),item])); + voteGroups.forEach(group=>{ + const item=byEntry.get(Number(group.dataset.entry)); + if(!item){unlock(group);return;} + const parsed=Date.parse(item.next_vote_at||''); + const expiresAt=Number.isFinite(parsed)?parsed:Date.now()+(Number(item.retry_after_seconds)||0)*1000; + if(expiresAt>Date.now())lock(group,Number(item.rating)||0,expiresAt); + else unlock(group); + }); + }catch{ + // Ohne bestätigten Serverstatus bleiben die Voting-Schaltflächen sichtbar. + voteGroups.forEach(unlock); + } + } + + voteGroups.forEach(group=>{ + group.querySelectorAll('[data-rating]').forEach(button=>button.addEventListener('click',async()=>{ + if(group.classList.contains('is-locked')||!voteAPI)return; + const rating=Number(button.dataset.rating); + const entryID=Number(group.dataset.entry); + group.querySelectorAll('button').forEach(item=>item.disabled=true); + try{ + const response=await fetch(voteAPI,{method:'POST',headers:{'Content-Type':'application/json','Accept':'application/json'},body:JSON.stringify({entry_id:entryID,rating})}); + const payload=await response.json().catch(()=>({})); + if(!response.ok&&response.status!==429)throw new Error(payload.message||payload.error?.message||'Voting fehlgeschlagen'); + const next=Date.parse(payload.next_vote_at||''); + const expiresAt=Number.isFinite(next)?next:Date.now()+(Number(payload.retry_after_seconds)||86400)*1000; + lock(group,rating,expiresAt,response.status===429?'Du hast diesen Titel heute schon bewertet':'Danke, deine Stimme zählt!'); + if(response.ok){ + const value=cardFor(group)?.querySelector('[data-vote-points]'); + if(value&&payload.vote_points!==undefined)value.textContent=String(payload.vote_points); + } + }catch(error){ + group.querySelectorAll('button').forEach(item=>item.disabled=false); + alert(error.message||'Deine Stimme konnte gerade nicht gespeichert werden. Bitte versuche es später noch einmal.'); + } + })); + }); + loadVoteStatus(); + + function closeInfo(){infoModal?.close();} + infoModal?.querySelector('[data-info-close]')?.addEventListener('click',closeInfo); + infoModal?.addEventListener('click',event=>{if(event.target===infoModal)closeInfo();}); + document.querySelectorAll('[data-song-info]').forEach(button=>button.addEventListener('click',async()=>{ + if(button.disabled||!infoModal)return; + const loading=infoModal.querySelector('[data-info-loading]'); + const content=infoModal.querySelector('[data-info-content]'); + const error=infoModal.querySelector('[data-info-error]'); + infoModal.querySelector('[data-info-title]').textContent=button.dataset.title||''; + infoModal.querySelector('[data-info-artist]').textContent=button.dataset.artist||''; + loading.hidden=false;content.hidden=true;error.hidden=true;infoModal.showModal(); + try{ + const response=await fetch(`/api/charts/jahrescharts/info?year=${encodeURIComponent(button.dataset.year||'')}&position=${encodeURIComponent(button.dataset.position||'')}`,{headers:{Accept:'application/json'}}); + const payload=await response.json().catch(()=>({})); + if(!response.ok)throw new Error(payload.message||payload.error?.message||'Titelinformationen konnten nicht geladen werden.'); + const data=payload.data||{}; + infoModal.querySelector('[data-info-artist-text]').textContent=data.artist_info||'Keine Künstlerinfo vorhanden.'; + infoModal.querySelector('[data-info-song-text]').textContent=data.song_info||'Keine Titelinfo vorhanden.'; + infoModal.querySelector('[data-info-year]').textContent=data.release_year||'–'; + infoModal.querySelector('[data-info-genre]').textContent=data.genre||'–'; + infoModal.querySelector('[data-info-dance]').textContent=data.dance_styles||'–'; + loading.hidden=true;content.hidden=false; + }catch(err){loading.hidden=true;error.hidden=false;error.textContent=err.message;} + })); +})(); diff --git a/web/assets/charts-v8.css b/web/assets/charts-v8.css new file mode 100644 index 0000000..0a75269 --- /dev/null +++ b/web/assets/charts-v8.css @@ -0,0 +1,33 @@ +.charts-page{background:#f3f6ef;color:#1c261b}.charts-hero{position:relative;isolation:isolate;min-height:410px;display:flex;align-items:flex-end;overflow:hidden;background:#182517}.charts-hero:before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(8,17,10,.9),rgba(8,17,10,.58) 48%,rgba(8,17,10,.2)),linear-gradient(0deg,rgba(8,17,10,.78),transparent 65%)}.charts-wish-hero{background-image:url('/assets/charts-listener-hero-v1.png');background-position:center 54%;background-size:cover}.charts-schlager-hero,.charts-annual-hero{background-image:url('/assets/charts-schlager-hero-v1.png');background-position:center 50%;background-size:cover}.charts-docx-hero{background-image:linear-gradient(120deg,#0a1812,#1f4929 55%,#628d21)}.charts-hero-inner{padding-top:120px;padding-bottom:56px;color:#fff}.charts-kicker,.charts-section-heading span{display:block;color:#91ca2a;font-size:.75rem;font-weight:900;letter-spacing:.16em;text-transform:uppercase}.charts-hero h1{max-width:900px;margin:10px 0 12px;font-size:clamp(2.8rem,7vw,5.6rem);line-height:.96}.charts-hero p{max-width:720px;margin:0;color:#e2eadf;font-size:clamp(1rem,2vw,1.22rem);line-height:1.7}.charts-release-note{display:inline-flex;margin-top:22px;padding:10px 14px;border:1px solid rgba(255,255,255,.18);border-radius:999px;background:rgba(0,0,0,.26);font-size:.86rem}.chart-year-picker{display:flex;gap:12px;align-items:center;width:max-content;margin-top:22px;padding:10px 12px;border-radius:14px;background:rgba(0,0,0,.38);border:1px solid rgba(255,255,255,.16)}.chart-year-picker label{font-weight:850}.chart-year-picker select{min-width:220px;border:0;border-radius:9px;padding:9px;background:#fff;color:#1a2819;font-weight:750}.charts-overview,.charts-ranking-section .page-shell,.charts-new-section .page-shell{padding-top:54px;padding-bottom:54px}.charts-section-heading{display:flex;justify-content:space-between;gap:24px;align-items:end;margin-bottom:26px}.charts-section-heading h2{margin:7px 0;font-size:clamp(1.8rem,4vw,3rem)}.charts-section-heading p{max-width:760px;margin:0;color:#667063}.charts-section-heading.compact{margin-bottom:20px}.charts-section-heading.compact h2{font-size:clamp(1.65rem,3vw,2.3rem)}.charts-section-heading>b,.charts-updated{padding:9px 12px;border:1px solid #d7e0d2;border-radius:999px;background:#fff;color:#597052;font-size:.82rem;white-space:nowrap}.charts-podium{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}.chart-podium-card{overflow:hidden;border:1px solid #d7e2d1;border-radius:24px;background:#fff;box-shadow:0 18px 45px rgba(35,57,29,.09)}.chart-podium-card.position-1{border-color:#8fbd3b;box-shadow:0 20px 54px rgba(92,139,29,.18)}.chart-podium-media{position:relative;aspect-ratio:16/10;max-height:255px;overflow:hidden;background:#e7eee2}.chart-podium-media img{width:100%;height:100%;object-fit:cover}.chart-position-badge{position:absolute;top:16px;left:16px;display:grid;place-items:center;width:58px;height:58px;border-radius:18px;background:linear-gradient(145deg,#96d126,#5f9416);color:#fff;font-size:1.7rem;box-shadow:0 12px 25px rgba(61,100,12,.28)}.chart-podium-copy{padding:22px}.chart-artist,.chart-row-title span,.chart-new-card>div>span{color:#668f20;font-size:.75rem;font-weight:900;letter-spacing:.06em;text-transform:uppercase}.chart-podium-copy h3,.chart-row-title h3,.chart-new-card h3{margin:5px 0 0}.chart-podium-copy h3{font-size:1.45rem}.chart-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:18px 0}.chart-facts>div{padding:10px;border-radius:13px;background:#f3f6f0}.chart-facts small,.chart-row-stat small{display:block;color:#7a8477;font-size:.67rem;text-transform:uppercase}.chart-facts strong{display:block;margin-top:2px}.chart-trend{display:inline-flex;align-items:center;justify-content:center;min-width:38px;font-weight:950}.chart-trend.is-up{color:#1f9b47}.chart-trend.is-down{color:#cc4038}.chart-trend.is-new{color:#6b9d1c;font-size:.74rem}.chart-card-actions,.chart-row-actions{display:flex;flex-wrap:wrap;gap:8px}.chart-preview-button,.chart-info-button{border:0;border-radius:999px;padding:9px 13px;background:#152015;color:#fff;font-weight:850;cursor:pointer}.chart-preview-button:hover{background:#2c3d29}.chart-info-button{background:#eaf4da;color:#527b16}.chart-info-button.has-info:hover{background:#dbeec2}.chart-info-button:disabled{opacity:.45;cursor:not-allowed}.chart-preview-missing{display:inline-flex;padding:9px 12px;border-radius:999px;background:#edf0eb;color:#8a9187;font-size:.75rem}.chart-vote-panel{margin-top:16px;padding:13px;border-radius:15px;background:#19251a;color:#fff}.chart-vote-panel>span{display:block;margin-bottom:8px;color:#d8e4d3;font-size:.75rem}.chart-vote-panel.compact{background:transparent;color:#1c261b;padding:12px 0 0}.chart-rating{display:flex;flex-wrap:wrap;gap:6px}.chart-rating button{width:35px;height:35px;border:1px solid #a9ba9f;border-radius:50%;background:#fff;color:#527a19;font-weight:900;cursor:pointer}.chart-rating button:hover,.chart-rating button.is-selected{border-color:#78ad1f;background:#78ad1f;color:#fff}.chart-rating.is-locked button:not(.is-selected){opacity:.4}.chart-vote-panel em,.chart-row-vote em{display:block;margin-top:8px;color:#a9d96d;font-size:.72rem;font-style:normal}.charts-ranking-section{background:#e9eee5}.charts-ranking-list{overflow:hidden;border:1px solid #d5dfcf;border-radius:20px;background:#fff;box-shadow:0 12px 34px rgba(33,51,29,.06)}.chart-ranking-row{display:grid;grid-template-columns:54px 64px minmax(180px,1fr) 88px 80px 90px 50px minmax(170px,.9fr) minmax(190px,auto);gap:12px;align-items:center;padding:12px 16px;border-bottom:1px solid #e5eae2}.chart-ranking-row:last-child{border-bottom:0}.chart-row-position{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:#eef5e6;color:#4e7c15;font-size:1.1rem}.chart-ranking-row>img{width:58px;height:58px;border-radius:11px;object-fit:cover;background:#e8ede5}.chart-row-title{min-width:0}.chart-row-title h3{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem}.chart-row-stat{text-align:center}.chart-row-stat strong{font-size:.9rem}.chart-row-vote{display:grid;justify-items:end}.charts-new-section{background:#f8faf6}.charts-new-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.chart-new-card{display:grid;grid-template-columns:112px minmax(0,1fr);gap:16px;padding:14px;border:1px solid #d9e1d4;border-radius:18px;background:#fff}.chart-new-media{position:relative}.chart-new-media img{width:112px;height:112px;border-radius:13px;object-fit:cover}.chart-new-media b{position:absolute;left:7px;top:7px;display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:#6fa517;color:#fff}.charts-empty{padding:42px;border:1px dashed #cbd7c4;border-radius:20px;background:#fff;text-align:center}.charts-empty>span{font-size:2rem;color:#74a91b}.chart-media-modal,.chart-info-modal{position:relative;width:min(590px,calc(100% - 26px));border:0;border-radius:24px;padding:28px;background:#172117;color:#fff;box-shadow:0 30px 90px rgba(0,0,0,.55)}.chart-media-modal::backdrop,.chart-info-modal::backdrop{background:rgba(0,0,0,.78)}.chart-modal-close{position:absolute;right:15px;top:12px;border:0;background:transparent;color:#fff;font-size:2rem;cursor:pointer}.chart-media-modal>span,.chart-info-modal>span{color:#9bd239;font-size:.72rem;font-weight:900;text-transform:uppercase}.chart-media-modal h2,.chart-info-modal h2{margin:8px 0 4px}.chart-media-modal p,.chart-info-artist{margin:0 0 16px;color:#cbd6c8}.chart-modal-cover{float:left;width:110px;height:110px;margin:0 18px 14px 0;border-radius:17px;overflow:hidden;background:#2b382a;display:grid;place-items:center}.chart-modal-cover img{width:100%;height:100%;object-fit:cover}.chart-modal-cover span{font-size:2rem}.chart-media-modal audio{width:100%;margin-top:15px}.chart-video-wrap{clear:both;aspect-ratio:16/9;margin-top:18px}.chart-video-wrap iframe{width:100%;height:100%;border:0;border-radius:14px}.chart-info-modal section{padding:14px 0;border-top:1px solid rgba(255,255,255,.1)}.chart-info-modal section h3{margin:0 0 7px;color:#9bd239}.chart-info-modal section p{margin:0;line-height:1.65;color:#edf3eb}.chart-info-modal dl{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}.chart-info-modal dl div{padding:11px;border-radius:12px;background:rgba(255,255,255,.07)}.chart-info-modal dt{color:#9da99a;font-size:.68rem;text-transform:uppercase}.chart-info-modal dd{margin:5px 0 0;font-weight:800}.chart-info-error{padding:13px;border-radius:12px;background:#5f2323;color:#fff}.chart-info-loading{padding:18px 0;color:#cad5c7} +@media(max-width:1150px){.charts-podium{grid-template-columns:1fr 1fr}.chart-podium-card.position-1{grid-column:1/-1;display:grid;grid-template-columns:minmax(280px,.8fr) 1.2fr}.chart-ranking-row{grid-template-columns:48px 58px minmax(180px,1fr) 75px 75px 48px minmax(150px,1fr)}.chart-ranking-row .chart-row-stat:nth-of-type(3){display:none}.chart-row-vote{grid-column:3/-1;justify-items:start}.charts-new-grid{grid-template-columns:1fr 1fr}} +@media(max-width:800px){.charts-podium{grid-template-columns:1fr}.chart-podium-card.position-1{grid-column:auto;display:block}.charts-section-heading{align-items:flex-start;flex-direction:column}.chart-ranking-row{grid-template-columns:42px 52px minmax(0,1fr) 44px}.chart-ranking-row .chart-row-stat,.chart-ranking-row>.chart-trend{display:none}.chart-row-actions{grid-column:3/5}.chart-row-vote{grid-column:1/5}.charts-new-grid{grid-template-columns:1fr}.chart-info-modal dl{grid-template-columns:1fr}} +@media(max-width:520px){.charts-hero-inner{padding-top:110px;padding-bottom:38px}.charts-hero{min-height:360px}.chart-year-picker{width:100%;align-items:stretch;flex-direction:column}.chart-year-picker select{min-width:0}.charts-overview,.charts-ranking-section .page-shell,.charts-new-section .page-shell{padding-top:38px;padding-bottom:38px}.chart-new-card{grid-template-columns:88px minmax(0,1fr)}.chart-new-media img{width:88px;height:88px}.chart-facts{grid-template-columns:1fr 1fr}} + +/* v1.5.11 – eigenständige Landwelle-Chartwelten und klarer Voting-Zustand */ +.charts-guide-card{display:flex;align-items:center;justify-content:space-between;gap:24px;margin:0 0 28px;padding:20px 22px;border:1px solid #d4dfce;border-radius:20px;background:linear-gradient(135deg,#fff,#f2f7ed);box-shadow:0 14px 36px rgba(31,53,25,.07)} +.charts-guide-card>div{max-width:760px}.charts-guide-card span,.charts-archive-note>span{display:block;color:#6d9f23;font-size:.72rem;font-weight:950;letter-spacing:.12em;text-transform:uppercase}.charts-guide-card h3{margin:5px 0 6px;font-size:1.35rem}.charts-guide-card p,.charts-archive-note p{margin:0;color:#637061;line-height:1.6}.charts-vote-mark,.charts-archive-seal{display:grid;place-items:center;flex:0 0 88px;width:88px;height:88px;border-radius:50%;background:#182318;color:#a9db55;text-align:center;font-size:1.25rem;line-height:1.05;box-shadow:inset 0 0 0 5px rgba(255,255,255,.08)}.charts-vote-mark small{font-size:.58rem;letter-spacing:.08em;text-transform:uppercase}.charts-archive-note{margin:-8px 0 28px;padding:18px 20px 18px 72px;border:1px solid #cbbd96;border-radius:8px;background:linear-gradient(90deg,rgba(116,82,36,.12),rgba(255,252,240,.92));position:relative}.charts-archive-note:before{content:'♫';position:absolute;left:22px;top:50%;transform:translateY(-50%);font-size:2rem;color:#8a642c} +.chart-vote-countdown{display:block!important;margin-top:0!important;padding:13px 15px;border:1px solid #39543b;border-radius:14px;background:#203422;color:#fff!important;font-style:normal;box-shadow:0 8px 20px rgba(21,43,23,.16)}.chart-vote-countdown[hidden]{display:none!important}.chart-vote-countdown strong,.chart-vote-countdown span{display:block}.chart-vote-countdown strong{font-size:.86rem}.chart-vote-countdown span{margin-top:4px;color:#e3ede0;font-size:.72rem}.chart-vote-countdown b{display:inline-block;min-width:74px;margin-left:4px;color:#c8ef8d;font-size:.92rem;font-variant-numeric:tabular-nums;letter-spacing:.04em}.chart-row-vote .chart-vote-countdown{min-width:185px;text-align:left;background:#203422}.chart-new-card .chart-vote-countdown{margin-top:10px!important}.chart-rating[hidden]{display:none!important}.is-vote-locked .chart-vote-panel>span{display:none}.is-vote-locked .chart-vote-panel{padding:0;background:transparent}.is-vote-locked.chart-ranking-row{background:linear-gradient(90deg,#fff,#f4f8f0)} + +/* Zuhörer-Charts: norddeutsch, warm und radio-nah */ +.chart-theme-listener .charts-ranking-section{background:linear-gradient(180deg,#e6eee0,#edf2e9)}.chart-theme-listener .chart-position-badge,.chart-theme-listener .chart-new-media b{background:linear-gradient(145deg,#96d126,#4f7d16)}.chart-theme-listener .charts-guide-card{border-left:6px solid #79b72a} + +/* docX: dunkler, kantiger und alternativer */ +.chart-theme-dockx .charts-page{background:#0d1110}.chart-theme-dockx .charts-docx-hero{background-image:radial-gradient(circle at 78% 30%,rgba(85,246,169,.2),transparent 30%),linear-gradient(120deg,#080b0a,#16241f 56%,#2c4d3f)}.chart-theme-dockx .charts-overview,.chart-theme-dockx .charts-new-section .page-shell{color:#edf5f0}.chart-theme-dockx .charts-section-heading p{color:#aebdb4}.chart-theme-dockx .charts-updated,.chart-theme-dockx .charts-section-heading>b{background:#151b18;border-color:#314139;color:#b7d7c5}.chart-theme-dockx .charts-guide-card{background:linear-gradient(135deg,#131a17,#202d27);border-color:#335244;color:#edf5f0}.chart-theme-dockx .charts-guide-card p{color:#b7c8bf}.chart-theme-dockx .charts-guide-card span,.chart-theme-dockx .chart-artist,.chart-theme-dockx .chart-row-title span,.chart-theme-dockx .chart-new-card>div>span{color:#75e0a5}.chart-theme-dockx .chart-podium-card,.chart-theme-dockx .chart-new-card{background:#151b18;border-color:#2d3b34;color:#f4faf6}.chart-theme-dockx .chart-facts>div{background:#202923}.chart-theme-dockx .chart-facts small{color:#9dac9f}.chart-theme-dockx .charts-ranking-section{background:#101512}.chart-theme-dockx .charts-ranking-list{background:#171d19;border-color:#2e3932}.chart-theme-dockx .chart-ranking-row{border-color:#2a332d;color:#eef5f0}.chart-theme-dockx .chart-row-position{background:#26342d;color:#73dfa4}.chart-theme-dockx .chart-row-stat small{color:#98a79d}.chart-theme-dockx .charts-new-section{background:#0d1110}.chart-theme-dockx .chart-preview-button{background:#74e0a5;color:#07110c}.chart-theme-dockx .chart-rating button{background:#0e1511;border-color:#4b6a5a;color:#7be5aa}.chart-theme-dockx .chart-rating button:hover{background:#65d799;color:#08110d}.chart-theme-dockx .chart-vote-panel{background:#0a0f0c} + +/* Schlager: Bühne, Licht und warme Goldtöne */ +.chart-theme-schlager .charts-schlager-hero{background-position:center 44%}.chart-theme-schlager .charts-kicker,.chart-theme-schlager .charts-section-heading span,.chart-theme-schlager .chart-artist,.chart-theme-schlager .chart-row-title span,.chart-theme-schlager .chart-new-card>div>span{color:#bd791e}.chart-theme-schlager .charts-guide-card{border-left:6px solid #c28628;background:linear-gradient(135deg,#fffaf2,#f9ead4)}.chart-theme-schlager .chart-position-badge,.chart-theme-schlager .chart-new-media b{background:linear-gradient(145deg,#d7a343,#8d4f18)}.chart-theme-schlager .chart-podium-card.position-1{border-color:#d2a352;box-shadow:0 20px 54px rgba(151,91,25,.18)}.chart-theme-schlager .charts-ranking-section{background:linear-gradient(180deg,#f5eadc,#f8f2e9)}.chart-theme-schlager .chart-row-position{background:#f7e7d1;color:#965c1d}.chart-theme-schlager .chart-preview-button{background:#6f2e27}.chart-theme-schlager .chart-rating button{color:#9d601b}.chart-theme-schlager .chart-rating button:hover{background:#bd791e;border-color:#bd791e} + +/* Jahrescharts: vergilbtes Musikarchiv mit Jahrzehnte-Charakter */ +.chart-theme-archive{background:#e8ddc5}.chart-theme-archive .charts-page{font-family:Georgia,'Times New Roman',serif;background:radial-gradient(circle at 20% 20%,rgba(255,255,255,.5),transparent 34%),repeating-linear-gradient(0deg,rgba(82,55,22,.025) 0,rgba(82,55,22,.025) 1px,transparent 1px,transparent 5px),#e9dfca}.chart-theme-archive .charts-annual-hero{background-image:linear-gradient(90deg,rgba(30,19,9,.88),rgba(45,27,11,.48)),url('/assets/charts-schlager-hero-v1.png');filter:sepia(.45)}.chart-theme-archive .charts-hero h1{font-family:Georgia,'Times New Roman',serif;letter-spacing:-.04em}.chart-theme-archive .charts-kicker{color:#e6bd72}.chart-theme-archive .chart-year-picker{border-radius:4px;background:rgba(54,34,14,.74);border-color:rgba(255,236,199,.35)}.chart-theme-archive .chart-year-picker select{border-radius:2px;background:#f2e4c8;font-family:Georgia,'Times New Roman',serif}.chart-theme-archive .charts-guide-card{border-radius:5px;border:1px solid #bca77e;background:linear-gradient(135deg,#f8efd9,#e9d8b8);box-shadow:0 10px 20px rgba(74,48,20,.1)}.chart-theme-archive .charts-archive-seal{border-radius:50%;background:#7b2f22;color:#f4dfb0;font-family:Georgia,'Times New Roman',serif;transform:rotate(-6deg);box-shadow:inset 0 0 0 4px #d7b97a,0 4px 12px rgba(63,32,16,.25)}.chart-theme-archive .charts-section-heading span,.chart-theme-archive .chart-artist,.chart-theme-archive .chart-row-title span{color:#85572a}.chart-theme-archive .chart-podium-card,.chart-theme-archive .charts-ranking-list{border-radius:5px;border-color:#bda982;background:#f8efd9;box-shadow:0 10px 25px rgba(70,44,17,.12)}.chart-theme-archive .chart-podium-card.position-1{border-color:#8e6f3e}.chart-theme-archive .chart-position-badge{border-radius:50%;background:#7c4d26;color:#f6e6c5}.chart-theme-archive .chart-facts>div{border-radius:3px;background:#eadcc1}.chart-theme-archive .charts-ranking-section{background:rgba(123,91,47,.12);border-top:1px solid #c4ae84;border-bottom:1px solid #c4ae84}.chart-theme-archive .chart-ranking-row{border-color:#d8c7a7}.chart-theme-archive .chart-row-position{border-radius:50%;background:#e3d2b1;color:#6e4825}.chart-theme-archive .chart-preview-button{border-radius:4px;background:#52351e}.chart-theme-archive .chart-info-button{border-radius:4px;background:#e0c99f;color:#65451f}.chart-theme-archive .charts-updated,.chart-theme-archive .charts-section-heading>b{border-radius:3px;background:#f6ead1;border-color:#cbb58b;color:#6f5434} + +@media(max-width:700px){.charts-guide-card{align-items:flex-start}.charts-vote-mark,.charts-archive-seal{flex-basis:68px;width:68px;height:68px;font-size:1rem}.charts-archive-note{padding-left:54px}.charts-archive-note:before{left:16px}.chart-row-vote .chart-vote-countdown{width:100%;min-width:0}} + +/* v1.5.11 – kompaktere Top 3 und klarer Voting-Countdown */ +.chart-podium-card.position-1{grid-template-columns:minmax(250px,.68fr) 1.32fr} +.chart-theme-dockx .chart-vote-countdown{border-color:#4d7c65;background:#17271f}.chart-theme-dockx .chart-vote-countdown b{color:#86edb3} +.chart-theme-schlager .chart-vote-countdown{border-color:#9e6b2f;background:#5a3923}.chart-theme-schlager .chart-vote-countdown b{color:#ffe09b} +.chart-theme-archive .chart-vote-countdown{border-color:#876b43;border-radius:4px;background:#503b27}.chart-theme-archive .chart-vote-countdown b{color:#f4dca8} +@media(max-width:920px){.chart-podium-media{max-height:230px}.chart-podium-card.position-1{grid-template-columns:1fr}} +@media(max-width:700px){.chart-podium-media{aspect-ratio:16/9;max-height:210px}} +/* v1.5.24 – KI-Transparenz in den Jahrescharts */ +.chart-ai-disclosure{margin:14px 0;padding:12px;border:1px solid rgba(190,164,224,.42);border-radius:13px;background:rgba(112,80,156,.2)}.chart-ai-disclosure strong{display:block;color:#d9c1f5;font-size:.8rem}.chart-ai-disclosure p{margin:5px 0;color:#eef0ec;font-size:.78rem;line-height:1.5}.chart-ai-disclosure a{color:#caa8ef;font-size:.75rem;font-weight:850;text-decoration:none} diff --git a/web/assets/content-v15.js b/web/assets/content-v15.js new file mode 100644 index 0000000..f99a846 --- /dev/null +++ b/web/assets/content-v15.js @@ -0,0 +1,14 @@ +(() => { + 'use strict'; + const buttons = Array.from(document.querySelectorAll('[data-filter]')); + const cards = Array.from(document.querySelectorAll('[data-filter-card]')); + if (!buttons.length || !cards.length) return; + buttons.forEach((button) => button.addEventListener('click', () => { + const value = button.dataset.filter || 'alle'; + buttons.forEach((item) => item.classList.toggle('is-active', item === button)); + cards.forEach((card) => { + const values = `${card.dataset.category || ''} ${card.dataset.region || ''}`.toLowerCase(); + card.hidden = value !== 'alle' && !values.includes(value.toLowerCase()); + }); + })); +})(); diff --git a/web/assets/directory-v1.css b/web/assets/directory-v1.css new file mode 100644 index 0000000..1251e43 --- /dev/null +++ b/web/assets/directory-v1.css @@ -0,0 +1,2 @@ +.directory-page{background:#f3f6f1}.directory-hero{position:relative;overflow:hidden;background:linear-gradient(135deg,#132017,#253f27 60%,#101612);color:#fff}.directory-hero::after{content:"";position:absolute;right:-120px;top:-150px;width:560px;height:560px;border:1px solid rgba(139,203,45,.2);border-radius:50%;box-shadow:0 0 0 70px rgba(139,203,45,.05),0 0 0 145px rgba(139,203,45,.03)}.directory-hero-inner{position:relative;z-index:1;display:grid;grid-template-columns:minmax(0,1fr) 420px;gap:65px;align-items:center;padding-top:105px;padding-bottom:75px}.directory-hero span,.directory-heading>div>span,.directory-side section>span{color:#91cc3a;font-size:11px;font-weight:950;text-transform:uppercase;letter-spacing:.09em}.directory-hero h1{margin:10px 0 17px;color:#fff;font-size:clamp(42px,6vw,76px);line-height:1}.directory-hero p{max-width:720px;color:#d5dfd3;font-size:18px;line-height:1.65}.directory-hero-actions{display:flex;flex-wrap:wrap;gap:11px;margin-top:26px}.directory-hero-actions a,.directory-hero-actions button{padding:12px 18px;border:0;border-radius:999px;background:#87c42b;color:#14210f;font-weight:900;text-decoration:none;cursor:pointer}.directory-hero-actions button{border:1px solid rgba(255,255,255,.25);background:rgba(255,255,255,.08);color:#fff}.directory-search-hero{padding:25px;border:1px solid rgba(255,255,255,.16);border-radius:24px;background:rgba(8,14,10,.55);box-shadow:0 25px 80px rgba(0,0,0,.28);backdrop-filter:blur(14px)}.directory-search-hero label>span{display:block;margin-bottom:9px;color:#fff;font-size:13px;text-transform:none}.directory-search-hero label>div{display:flex;align-items:center;gap:10px;padding:0 14px;border-radius:14px;background:#fff}.directory-search-hero svg{width:22px;fill:none;stroke:#5f6b5d;stroke-width:2}.directory-search-hero input{width:100%;border:0;padding:15px 0;font:inherit;outline:none}.directory-search-hero small{display:block;margin-top:11px;color:#bfcbbd}.directory-success{display:flex;gap:18px;align-items:center;margin-top:28px;padding:20px 24px;border:1px solid #b8da8e;border-radius:18px;background:#eaf6db}.directory-success>span{display:grid;place-items:center;width:45px;height:45px;border-radius:50%;background:#73ad21;color:#fff;font-size:21px;font-weight:900}.directory-success h2{margin:0 0 4px}.directory-success p{margin:0;color:#52634e}.directory-layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:25px;align-items:start;padding-top:48px;padding-bottom:75px}.directory-main,.directory-side section{border:1px solid #dce5d8;border-radius:23px;background:#fff;box-shadow:0 13px 38px rgba(22,37,18,.07)}.directory-main{padding:30px}.directory-heading{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}.directory-heading h2{margin:6px 0 8px}.directory-heading p{margin:0;color:#687267}.directory-heading button,.directory-side button,.directory-empty button{border:0;border-radius:999px;padding:11px 17px;background:#82bd28;color:#14200f;font-weight:900;cursor:pointer}.directory-categories{display:flex;gap:8px;overflow:auto;padding:24px 0 19px}.directory-categories a{white-space:nowrap;padding:8px 12px;border-radius:999px;background:#eef2eb;color:#576154;font-size:12px;font-weight:850;text-decoration:none}.directory-categories a.is-active{background:#172019;color:#fff}.directory-results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.directory-card{padding:20px;border:1px solid #e0e7dd;border-radius:17px;background:linear-gradient(145deg,#fff,#fbfcfa)}.directory-card-top{display:flex;justify-content:space-between;align-items:center}.directory-card-top span{color:#72a922;font-size:10px;font-weight:950;text-transform:uppercase}.directory-card-top b{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:#172019;color:#90ca37;font-size:18px}.directory-card h3{margin:12px 0 8px}.directory-card>p{display:-webkit-box;overflow:hidden;-webkit-line-clamp:4;-webkit-box-orient:vertical;min-height:82px;color:#667064;font-size:13px;line-height:1.55}.directory-card dl{display:grid;gap:7px;margin:15px 0}.directory-card dl div{display:grid;grid-template-columns:58px 1fr;gap:8px;font-size:11px}.directory-card dt{color:#879084}.directory-card dd{margin:0;color:#394438;font-weight:750}.directory-card-actions{display:flex;flex-wrap:wrap;gap:7px}.directory-card-actions a{padding:7px 10px;border-radius:999px;background:#edf3e8;color:#56861a;font-size:10px;font-weight:900;text-decoration:none}.directory-empty,.directory-live-empty{text-align:center;padding:60px 20px;grid-column:1/-1}.directory-empty>span,.directory-live-empty>span{font-size:42px}.directory-empty p,.directory-live-empty p{color:#6d766b}.directory-side{position:sticky;top:90px;display:grid;gap:16px}.directory-side section{padding:25px}.directory-side h2{margin:8px 0 10px}.directory-side p{color:#697267;line-height:1.6}.directory-side ul{display:grid;gap:8px;padding:0;list-style:none}.directory-side li::before{content:"✓";margin-right:8px;color:#74ad22;font-weight:900}.directory-side button{width:100%;margin-top:10px}.directory-side .directory-note{background:#172019;color:#fff}.directory-side .directory-note p{color:#cad4c8}.directory-pagination{display:flex;justify-content:space-between;gap:16px;align-items:center;margin-top:28px;padding-top:22px;border-top:1px solid #e2e8df}.directory-pagination>span{color:#6f786d;font-size:12px}.directory-pagination>div{display:flex;gap:6px;align-items:center}.directory-pagination a{display:grid;place-items:center;min-width:36px;height:36px;padding:0 10px;border-radius:999px;background:#eef2eb;color:#455143;font-size:11px;font-weight:900;text-decoration:none}.directory-pagination a.is-active{background:#172019;color:#fff}.directory-pagination i{font-style:normal;color:#899186}.directory-modal[hidden]{display:none!important}.directory-modal{position:fixed;inset:0;z-index:10000;display:grid;place-items:center;padding:20px}.directory-modal-backdrop{position:absolute;inset:0;background:rgba(4,9,6,.8);backdrop-filter:blur(5px)}.directory-dialog{position:relative;z-index:1;width:min(880px,100%);max-height:92vh;overflow:auto;padding:32px;border-radius:23px;background:#fff;box-shadow:0 28px 90px rgba(0,0,0,.45)}.directory-close{position:absolute;right:15px;top:11px;border:0;background:transparent;font-size:32px;cursor:pointer}.directory-dialog header>span{color:#73aa22;font-size:11px;font-weight:950;text-transform:uppercase}.directory-dialog h2{margin:6px 0}.directory-dialog header p{color:#697267}.directory-form-error{margin:16px 0;padding:13px 15px;border-radius:11px;background:#ffe8e5;color:#962d23;font-weight:800}.directory-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:22px}.directory-form label{display:grid;gap:6px}.directory-form label>span{font-size:12px;font-weight:850;color:#394438}.directory-form input,.directory-form select,.directory-form textarea{width:100%;box-sizing:border-box;padding:11px 12px;border:1px solid #cfd8cc;border-radius:11px;background:#fbfcfa;font:inherit}.directory-form .is-wide{grid-column:1/-1}.directory-consent{grid-template-columns:auto 1fr!important;align-items:start}.directory-consent input{width:auto;margin-top:3px}.directory-submit{border:0;border-radius:12px;padding:14px;background:#76b022;color:#fff;font-weight:950;cursor:pointer}.directory-honeypot{position:absolute!important;left:-9999px!important}.has-directory-modal{overflow:hidden}@media(max-width:950px){.directory-hero-inner,.directory-layout{grid-template-columns:1fr}.directory-search-hero{max-width:650px}.directory-side{position:static}}@media(max-width:680px){.directory-results,.directory-form{grid-template-columns:1fr}.directory-form .is-wide{grid-column:auto}.directory-main{padding:20px}.directory-heading{flex-direction:column}.directory-heading button{width:100%}.directory-pagination{flex-direction:column}.directory-dialog{padding:26px 18px}} +.directory-card-actions button{padding:7px 10px;border:0;border-radius:999px;background:#172019;color:#fff;font-size:10px;font-weight:900;cursor:pointer}.directory-detail-description{white-space:pre-wrap;color:#566253;line-height:1.7}.directory-detail-list{display:grid;gap:10px;margin:22px 0}.directory-detail-list>div{display:grid;grid-template-columns:90px 1fr;gap:12px;padding:10px 0;border-bottom:1px solid #edf1eb}.directory-detail-list dt{color:#7b8778}.directory-detail-list dd{margin:0;font-weight:750}.directory-detail-actions{margin-top:18px}.directory-partnership{padding:14px;border:1px solid #cfe2b8;border-radius:12px;background:#f4faed}.directory-admin-partnership>span:last-child{display:flex;gap:9px;align-items:center;font-size:13px;text-transform:none;color:#33402f}.directory-admin-partnership input{width:auto} diff --git a/web/assets/directory-v1.js b/web/assets/directory-v1.js new file mode 100644 index 0000000..c8f4ef3 --- /dev/null +++ b/web/assets/directory-v1.js @@ -0,0 +1,23 @@ +(()=>{'use strict'; +const modal=document.querySelector('[data-directory-modal]'); +const open=()=>{if(!modal)return;modal.hidden=false;document.body.classList.add('has-directory-modal');modal.querySelector('input:not([type="hidden"])')?.focus()}; +const close=()=>{if(!modal)return;modal.hidden=true;document.body.classList.remove('has-directory-modal')}; +document.querySelectorAll('[data-directory-open]').forEach((button)=>button.addEventListener('click',open)); +document.querySelectorAll('[data-directory-close]').forEach((button)=>button.addEventListener('click',close)); +if(document.querySelector('.directory-form-error'))open(); +const detailModal=document.querySelector('[data-directory-detail-modal]'); +const detailText=(selector,value,rowSelector)=>{const node=detailModal?.querySelector(selector);if(node)node.textContent=value||'';const row=rowSelector?detailModal?.querySelector(rowSelector):null;if(row)row.hidden=!String(value||'').trim()}; +const openDetail=(button)=>{if(!detailModal)return;const d=button.dataset;detailText('[data-directory-detail-category]',d.category);detailText('[data-directory-detail-name]',d.name);detailText('[data-directory-detail-description]',d.description);detailText('[data-directory-detail-location]',d.location,'[data-directory-detail-location-row]');detailText('[data-directory-detail-address]',d.address,'[data-directory-detail-address-row]');detailText('[data-directory-detail-hours]',d.openingHours,'[data-directory-detail-hours-row]');const actions=detailModal.querySelector('[data-directory-detail-actions]');if(actions){actions.innerHTML='';if(d.website){const a=document.createElement('a');a.href=d.website;a.target='_blank';a.rel='noopener noreferrer';a.textContent='Webseite öffnen';actions.append(a)}if(d.phone){const a=document.createElement('a');a.href='tel:'+d.phone;a.textContent='Anrufen';actions.append(a)}if(d.email){const a=document.createElement('a');a.href='mailto:'+d.email;a.textContent='E-Mail';actions.append(a)}}detailModal.hidden=false;document.body.classList.add('has-directory-modal');detailModal.querySelector('[data-directory-detail-close]')?.focus()}; +const closeDetail=()=>{if(!detailModal)return;detailModal.hidden=true;document.body.classList.remove('has-directory-modal')}; +document.addEventListener('click',(event)=>{const button=event.target.closest('[data-directory-detail]');if(button)openDetail(button);if(event.target.closest('[data-directory-detail-close]'))closeDetail()}); +document.addEventListener('keydown',(event)=>{if(event.key!=='Escape')return;if(detailModal&&!detailModal.hidden)closeDetail();else if(modal&&!modal.hidden)close()}); +const search=document.querySelector('[data-directory-search]');const grid=document.querySelector('[data-directory-grid]');const empty=document.querySelector('[data-directory-empty]');const status=document.querySelector('[data-directory-status]');const pagination=document.querySelector('[data-directory-pagination]'); +if(!search||!grid)return; +let timer=0;let controller=null;let category=new URLSearchParams(location.search).get('kategorie')||''; +const esc=(value)=>String(value??'').replace(/[&<>'"]/g,(char)=>({'&':'&','<':'<','>':'>',"'":''','"':'"'}[char])); +const attr=(value)=>esc(value).replace(/`/g,'`'); +const card=(item)=>{const links=[];if(item.website)links.push(`Webseite öffnen`);if(item.phone)links.push(`Anrufen`);if(item.email)links.push(`E-Mail`);links.unshift(``);return `
${esc(item.category)}${esc((item.name||'?').slice(0,1))}

${esc(item.name)}

${esc(item.description)}

Ort
${esc([item.postal_code,item.city].filter(Boolean).join(' '))}
${item.address?`
Adresse
${esc(item.address)}
`:''}${item.opening_hours?`
Zeiten
${esc(item.opening_hours)}
`:''}
${links.join('')}
`}; +const run=async()=>{const q=search.value.trim();if(!q){location.href=category?`/branchenbuch?kategorie=${encodeURIComponent(category)}#eintraege`:'/branchenbuch#eintraege';return}controller?.abort();controller=new AbortController();status.textContent='Suche läuft …';try{const response=await fetch(`/api/directory/search?q=${encodeURIComponent(q)}&category=${encodeURIComponent(category)}`,{headers:{Accept:'application/json'},signal:controller.signal});if(!response.ok)throw new Error('Suche nicht verfügbar');const payload=await response.json();const items=Array.isArray(payload.data)?payload.data:[];grid.innerHTML=items.map(card).join('');empty.hidden=items.length!==0;pagination?.setAttribute('hidden','');status.textContent=`${items.length} passende Einträge`;history.replaceState(null,'',`/branchenbuch?suche=${encodeURIComponent(q)}${category?`&kategorie=${encodeURIComponent(category)}`:''}#eintraege`)}catch(error){if(error.name!=='AbortError')status.textContent='Die Suche ist gerade nicht verfügbar.'}}; +search.addEventListener('input',()=>{clearTimeout(timer);timer=setTimeout(run,280)}); +document.querySelectorAll('[data-directory-category]').forEach((link)=>link.addEventListener('click',(event)=>{if(!search.value.trim())return;event.preventDefault();category=link.dataset.directoryCategory||'';document.querySelectorAll('[data-directory-category]').forEach((item)=>item.classList.toggle('is-active',item===link));run()})); +})(); diff --git a/web/assets/directory-v2.css b/web/assets/directory-v2.css new file mode 100644 index 0000000..536797d --- /dev/null +++ b/web/assets/directory-v2.css @@ -0,0 +1,2 @@ +.directory-page{background:#f3f6f1}.directory-hero{position:relative;overflow:hidden;background:linear-gradient(135deg,#132017,#253f27 60%,#101612);color:#fff}.directory-hero::after{content:"";position:absolute;right:-120px;top:-150px;width:560px;height:560px;border:1px solid rgba(139,203,45,.2);border-radius:50%;box-shadow:0 0 0 70px rgba(139,203,45,.05),0 0 0 145px rgba(139,203,45,.03)}.directory-hero-inner{position:relative;z-index:1;display:grid;grid-template-columns:minmax(0,1fr) 420px;gap:65px;align-items:center;padding-top:105px;padding-bottom:75px}.directory-hero span,.directory-heading>div>span,.directory-side section>span{color:#91cc3a;font-size:11px;font-weight:950;text-transform:uppercase;letter-spacing:.09em}.directory-hero h1{margin:10px 0 17px;color:#fff;font-size:clamp(42px,6vw,76px);line-height:1}.directory-hero p{max-width:720px;color:#d5dfd3;font-size:18px;line-height:1.65}.directory-hero-actions{display:flex;flex-wrap:wrap;gap:11px;margin-top:26px}.directory-hero-actions a,.directory-hero-actions button{padding:12px 18px;border:0;border-radius:999px;background:#87c42b;color:#14210f;font-weight:900;text-decoration:none;cursor:pointer}.directory-hero-actions button{border:1px solid rgba(255,255,255,.25);background:rgba(255,255,255,.08);color:#fff}.directory-search-hero{padding:25px;border:1px solid rgba(255,255,255,.16);border-radius:24px;background:rgba(8,14,10,.55);box-shadow:0 25px 80px rgba(0,0,0,.28);backdrop-filter:blur(14px)}.directory-search-hero label>span{display:block;margin-bottom:9px;color:#fff;font-size:13px;text-transform:none}.directory-search-hero label>div{display:flex;align-items:center;gap:10px;padding:0 14px;border-radius:14px;background:#fff}.directory-search-hero svg{width:22px;fill:none;stroke:#5f6b5d;stroke-width:2}.directory-search-hero input{width:100%;border:0;padding:15px 0;font:inherit;outline:none}.directory-search-hero small{display:block;margin-top:11px;color:#bfcbbd}.directory-success{display:flex;gap:18px;align-items:center;margin-top:28px;padding:20px 24px;border:1px solid #b8da8e;border-radius:18px;background:#eaf6db}.directory-success>span{display:grid;place-items:center;width:45px;height:45px;border-radius:50%;background:#73ad21;color:#fff;font-size:21px;font-weight:900}.directory-success h2{margin:0 0 4px}.directory-success p{margin:0;color:#52634e}.directory-layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:25px;align-items:start;padding-top:48px;padding-bottom:75px}.directory-main,.directory-side section{border:1px solid #dce5d8;border-radius:23px;background:#fff;box-shadow:0 13px 38px rgba(22,37,18,.07)}.directory-main{padding:30px}.directory-heading{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}.directory-heading h2{margin:6px 0 8px}.directory-heading p{margin:0;color:#687267}.directory-heading button,.directory-side button,.directory-empty button{border:0;border-radius:999px;padding:11px 17px;background:#82bd28;color:#14200f;font-weight:900;cursor:pointer}.directory-categories{display:flex;gap:8px;overflow:auto;padding:24px 0 19px}.directory-categories a{white-space:nowrap;padding:8px 12px;border-radius:999px;background:#eef2eb;color:#576154;font-size:12px;font-weight:850;text-decoration:none}.directory-categories a.is-active{background:#172019;color:#fff}.directory-results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.directory-card{padding:20px;border:1px solid #e0e7dd;border-radius:17px;background:linear-gradient(145deg,#fff,#fbfcfa)}.directory-card-top{display:flex;justify-content:space-between;align-items:center}.directory-card-top span{color:#72a922;font-size:10px;font-weight:950;text-transform:uppercase}.directory-card-top b{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:#172019;color:#90ca37;font-size:18px}.directory-card h3{margin:12px 0 8px}.directory-card>p{display:-webkit-box;overflow:hidden;-webkit-line-clamp:4;-webkit-box-orient:vertical;min-height:82px;color:#667064;font-size:13px;line-height:1.55}.directory-card dl{display:grid;gap:7px;margin:15px 0}.directory-card dl div{display:grid;grid-template-columns:58px 1fr;gap:8px;font-size:11px}.directory-card dt{color:#879084}.directory-card dd{margin:0;color:#394438;font-weight:750}.directory-card-actions{display:flex;flex-wrap:wrap;gap:7px}.directory-card-actions a{padding:7px 10px;border-radius:999px;background:#edf3e8;color:#56861a;font-size:10px;font-weight:900;text-decoration:none}.directory-empty,.directory-live-empty{text-align:center;padding:60px 20px;grid-column:1/-1}.directory-empty>span,.directory-live-empty>span{font-size:42px}.directory-empty p,.directory-live-empty p{color:#6d766b}.directory-side{position:sticky;top:90px;display:grid;gap:16px}.directory-side section{padding:25px}.directory-side h2{margin:8px 0 10px}.directory-side p{color:#697267;line-height:1.6}.directory-side ul{display:grid;gap:8px;padding:0;list-style:none}.directory-side li::before{content:"✓";margin-right:8px;color:#74ad22;font-weight:900}.directory-side button{width:100%;margin-top:10px}.directory-side .directory-note{background:#172019;color:#fff}.directory-side .directory-note p{color:#cad4c8}.directory-pagination{display:flex;justify-content:space-between;gap:16px;align-items:center;margin-top:28px;padding-top:22px;border-top:1px solid #e2e8df}.directory-pagination>span{color:#6f786d;font-size:12px}.directory-pagination>div{display:flex;gap:6px;align-items:center}.directory-pagination a{display:grid;place-items:center;min-width:36px;height:36px;padding:0 10px;border-radius:999px;background:#eef2eb;color:#455143;font-size:11px;font-weight:900;text-decoration:none}.directory-pagination a.is-active{background:#172019;color:#fff}.directory-pagination i{font-style:normal;color:#899186}.directory-modal[hidden]{display:none!important}.directory-modal{position:fixed;inset:0;z-index:10000;display:grid;place-items:center;padding:20px}.directory-modal-backdrop{position:absolute;inset:0;background:rgba(4,9,6,.8);backdrop-filter:blur(5px)}.directory-dialog{position:relative;z-index:1;width:min(880px,100%);max-height:92vh;overflow:auto;padding:32px;border-radius:23px;background:#fff;box-shadow:0 28px 90px rgba(0,0,0,.45)}.directory-close{position:absolute;right:15px;top:11px;border:0;background:transparent;font-size:32px;cursor:pointer}.directory-dialog header>span{color:#73aa22;font-size:11px;font-weight:950;text-transform:uppercase}.directory-dialog h2{margin:6px 0}.directory-dialog header p{color:#697267}.directory-form-error{margin:16px 0;padding:13px 15px;border-radius:11px;background:#ffe8e5;color:#962d23;font-weight:800}.directory-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:22px}.directory-form label{display:grid;gap:6px}.directory-form label>span{font-size:12px;font-weight:850;color:#394438}.directory-form input,.directory-form select,.directory-form textarea{width:100%;box-sizing:border-box;padding:11px 12px;border:1px solid #cfd8cc;border-radius:11px;background:#fbfcfa;font:inherit}.directory-form .is-wide{grid-column:1/-1}.directory-consent{grid-template-columns:auto 1fr!important;align-items:start}.directory-consent input{width:auto;margin-top:3px}.directory-submit{border:0;border-radius:12px;padding:14px;background:#76b022;color:#fff;font-weight:950;cursor:pointer}.directory-honeypot{position:absolute!important;left:-9999px!important}.has-directory-modal{overflow:hidden}@media(max-width:950px){.directory-hero-inner,.directory-layout{grid-template-columns:1fr}.directory-search-hero{max-width:650px}.directory-side{position:static}}@media(max-width:680px){.directory-results,.directory-form{grid-template-columns:1fr}.directory-form .is-wide{grid-column:auto}.directory-main{padding:20px}.directory-heading{flex-direction:column}.directory-heading button{width:100%}.directory-pagination{flex-direction:column}.directory-dialog{padding:26px 18px}} +.directory-text-button,.directory-description-button{display:block;width:100%;padding:0;border:0;background:transparent;color:inherit;text-align:left;font:inherit;cursor:pointer}.directory-text-button{font-weight:inherit}.directory-text-button:hover,.directory-description-button:hover{text-decoration:underline;text-decoration-color:#83bd2b;text-underline-offset:3px}.directory-description-button{display:-webkit-box;overflow:hidden;-webkit-line-clamp:4;-webkit-box-orient:vertical;min-height:82px;color:#667064;font-size:13px;line-height:1.55}.directory-card>p{min-height:auto}.directory-card-actions button.directory-more-button{padding:7px 10px;border:0;border-radius:999px;background:#172019;color:#fff;font-size:10px;font-weight:900;cursor:pointer}.directory-partnership-choice{grid-template-columns:auto 1fr!important;align-items:start;padding:14px;border:1px solid #cfe2b5;border-radius:12px;background:#f4faec}.directory-partnership-choice input{width:auto;margin-top:4px}.directory-partnership-choice span{display:grid;gap:3px}.directory-partnership-choice small{color:#687267;font-weight:500}.directory-partnership-info{display:grid;gap:4px;padding:14px 16px;border-left:4px solid #78b524;border-radius:10px;background:#edf7df;color:#405237}.directory-partnership-info[hidden]{display:none!important}.directory-partnership-success{margin-top:8px!important;color:#405237!important}.directory-detail-dialog{width:min(720px,100%)}.directory-detail-description{white-space:pre-line;color:#4f5a4d;font-size:15px;line-height:1.7}.directory-detail-facts{display:grid;gap:10px;margin:22px 0}.directory-detail-facts div{display:grid;grid-template-columns:minmax(120px,180px) 1fr;gap:12px;padding:10px 0;border-bottom:1px solid #edf0eb}.directory-detail-facts dt{color:#788274;font-size:12px;font-weight:800}.directory-detail-facts dd{margin:0;color:#2e382d;font-weight:700}.directory-detail-facts [hidden]{display:none!important}.directory-detail-actions{display:flex;gap:8px;flex-wrap:wrap}.directory-detail-actions a{padding:10px 13px;border-radius:999px;background:#edf3e8;color:#56861a;font-size:12px;font-weight:900;text-decoration:none}.directory-detail-actions a[hidden]{display:none!important}@media(max-width:560px){.directory-detail-facts div{grid-template-columns:1fr;gap:4px}} diff --git a/web/assets/directory-v2.js b/web/assets/directory-v2.js new file mode 100644 index 0000000..3d25979 --- /dev/null +++ b/web/assets/directory-v2.js @@ -0,0 +1,30 @@ +(()=>{ +const modal=document.querySelector('[data-directory-modal]'); +const open=()=>{if(!modal)return;modal.hidden=false;document.body.classList.add('has-directory-modal');modal.querySelector('input:not([type="hidden"])')?.focus()}; +const close=()=>{if(!modal)return;modal.hidden=true;document.body.classList.remove('has-directory-modal')}; +document.querySelectorAll('[data-directory-open]').forEach((button)=>button.addEventListener('click',open)); +document.querySelectorAll('[data-directory-close]').forEach((button)=>button.addEventListener('click',close)); +if(document.querySelector('.directory-form-error'))open(); +const partnership=document.querySelector('[data-directory-partnership]'); +const partnershipInfo=document.querySelector('[data-directory-partnership-info]'); +const syncPartnership=()=>{if(partnershipInfo)partnershipInfo.hidden=!partnership?.checked}; +partnership?.addEventListener('change',syncPartnership);syncPartnership(); + +const detailModal=document.querySelector('[data-directory-detail-modal]'); +const detail=(selector)=>detailModal?.querySelector(selector); +const setOptionalRow=(rowSelector,valueSelector,value)=>{const row=detail(rowSelector);const target=detail(valueSelector);if(!row||!target)return;const text=(value||'').trim();row.hidden=!text;target.textContent=text}; +const setAction=(selector,value,prefix='')=>{const link=detail(selector);if(!link)return;const text=(value||'').trim();link.hidden=!text;if(text)link.href=prefix+text}; +const openDetail=(entry)=>{if(!detailModal||!entry)return;detail('[data-directory-detail-category]').textContent=entry.dataset.category||'Branchenbuch';detail('[data-directory-detail-name]').textContent=entry.dataset.name||'';detail('[data-directory-detail-description]').textContent=entry.dataset.description||'';const place=[entry.dataset.postalCode,entry.dataset.city].filter(Boolean).join(' ');setOptionalRow('[data-directory-detail-place-row]','[data-directory-detail-place]',place);setOptionalRow('[data-directory-detail-address-row]','[data-directory-detail-address]',entry.dataset.address);setOptionalRow('[data-directory-detail-hours-row]','[data-directory-detail-hours]',entry.dataset.openingHours);setAction('[data-directory-detail-website]',entry.dataset.website);setAction('[data-directory-detail-phone]',entry.dataset.phone,'tel:');setAction('[data-directory-detail-email]',entry.dataset.email,'mailto:');detailModal.hidden=false;document.body.classList.add('has-directory-modal');detail('[data-directory-detail-name]')?.focus?.()}; +const closeDetail=()=>{if(!detailModal)return;detailModal.hidden=true;document.body.classList.remove('has-directory-modal')}; +document.addEventListener('click',(event)=>{const trigger=event.target.closest('[data-directory-detail]');if(trigger){event.preventDefault();openDetail(trigger.closest('[data-directory-entry]'));}}); +document.querySelectorAll('[data-directory-detail-close]').forEach((button)=>button.addEventListener('click',closeDetail)); +document.addEventListener('keydown',(event)=>{if(event.key==='Escape'){if(detailModal&&!detailModal.hidden)closeDetail();else if(modal&&!modal.hidden)close();}}); + +const search=document.querySelector('[data-directory-search]');const grid=document.querySelector('[data-directory-grid]');const empty=document.querySelector('[data-directory-empty]');const status=document.querySelector('[data-directory-status]');const pagination=document.querySelector('[data-directory-pagination]'); +if(!search||!grid)return;let controller;let category=new URLSearchParams(location.search).get('kategorie')||''; +const esc=(value)=>String(value??'').replace(/[&<>"']/g,(char)=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[char])); +const card=(item)=>{const links=[];if(item.website)links.push(`Webseite öffnen`);if(item.phone)links.push(`Anrufen`);if(item.email)links.push(`E-Mail`);const attrs=`data-directory-entry data-name="${esc(item.name)}" data-category="${esc(item.category)}" data-description="${esc(item.description)}" data-postal-code="${esc(item.postal_code)}" data-city="${esc(item.city)}" data-address="${esc(item.address)}" data-opening-hours="${esc(item.opening_hours)}" data-phone="${esc(item.phone)}" data-email="${esc(item.email)}" data-website="${esc(item.website)}"`;return `
${esc(item.category)}${esc((item.name||'?').slice(0,1))}

Ort
${esc([item.postal_code,item.city].filter(Boolean).join(' '))}
${item.address?`
Adresse
${esc(item.address)}
`:''}${item.opening_hours?`
Zeiten
${esc(item.opening_hours)}
`:''}
${links.join('')}
`}; +const run=async()=>{const q=search.value.trim();if(!q){location.href=category?`/branchenbuch?kategorie=${encodeURIComponent(category)}#eintraege`:'/branchenbuch#eintraege';return}controller?.abort();controller=new AbortController();status.textContent='Suche läuft …';try{const response=await fetch(`/api/directory/search?q=${encodeURIComponent(q)}&category=${encodeURIComponent(category)}`,{headers:{Accept:'application/json'},signal:controller.signal});if(!response.ok)throw new Error('Suche nicht verfügbar');const payload=await response.json();const items=Array.isArray(payload.data)?payload.data:[];grid.innerHTML=items.map(card).join('');empty.hidden=items.length!==0;pagination?.setAttribute('hidden','');status.textContent=`${items.length} passende Einträge`;history.replaceState(null,'',`/branchenbuch?suche=${encodeURIComponent(q)}${category?`&kategorie=${encodeURIComponent(category)}`:''}#eintraege`)}catch(error){if(error.name!=='AbortError')status.textContent='Die Suche ist gerade nicht verfügbar.'}}; +let timer;search.addEventListener('input',()=>{clearTimeout(timer);timer=setTimeout(run,280)}); +document.querySelectorAll('[data-directory-category]').forEach((link)=>link.addEventListener('click',(event)=>{if(!search.value.trim())return;event.preventDefault();category=link.dataset.directoryCategory||'';document.querySelectorAll('[data-directory-category]').forEach((item)=>item.classList.toggle('is-active',item===link));run()})); +})(); diff --git a/web/assets/downloads-v25.css b/web/assets/downloads-v25.css new file mode 100644 index 0000000..125c80b --- /dev/null +++ b/web/assets/downloads-v25.css @@ -0,0 +1 @@ +.download-heading-row{display:flex;align-items:flex-start;justify-content:space-between;gap:20px}.download-heading-row h2{margin-top:4px}.download-kicker{font-size:.75rem;font-weight:900;letter-spacing:.12em;text-transform:uppercase;color:#139a45}.download-soon-pill{padding:8px 12px;border-radius:999px;background:#152018;color:#51d97d;font-size:.72rem;font-weight:900;text-transform:uppercase;white-space:nowrap}.download-card{display:flex;flex-direction:column}.download-card small{display:block;margin-top:10px;color:#707771;font-size:.78rem}.download-card.is-coming-soon{opacity:.9}.download-disabled{display:inline-flex;justify-content:center;align-items:center;min-height:45px;margin-top:auto;border-radius:12px;background:#e8ece9;color:#68706a;font-weight:900;text-transform:uppercase;letter-spacing:.06em;cursor:not-allowed}@media(max-width:650px){.download-heading-row{display:block}.download-soon-pill{display:inline-flex;margin-bottom:8px}} diff --git a/web/assets/downloads-v26.css b/web/assets/downloads-v26.css new file mode 100644 index 0000000..3426d16 --- /dev/null +++ b/web/assets/downloads-v26.css @@ -0,0 +1,5 @@ +.downloads-page{background:#f3f5f1;color:#172018}.downloads-hero{position:relative;overflow:hidden;background:radial-gradient(circle at 75% 40%,rgba(123,190,42,.2),transparent 32%),linear-gradient(125deg,#080b09 0%,#111913 52%,#17261a 100%);color:#fff}.downloads-hero:before{content:"";position:absolute;inset:0;background-image:linear-gradient(rgba(255,255,255,.025) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.025) 1px,transparent 1px);background-size:42px 42px;mask-image:linear-gradient(to right,transparent,#000)}.downloads-hero-grid{position:relative;min-height:540px;display:grid;grid-template-columns:minmax(0,1.05fr) minmax(390px,.95fr);align-items:center;gap:64px;padding-top:72px;padding-bottom:72px}.downloads-hero-copy{position:relative;z-index:2}.downloads-eyebrow,.downloads-section-head span,.downloads-web-cta>div>span{display:inline-flex;color:#9bd54c;font-size:12px;font-weight:900;letter-spacing:.13em;text-transform:uppercase}.downloads-hero h1{max-width:760px;margin:14px 0 20px;font-size:clamp(48px,6vw,82px);line-height:.96;letter-spacing:-.055em}.downloads-hero-copy>p{max-width:650px;margin:0;color:#c9d3cb;font-size:18px;line-height:1.7}.downloads-hero-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:30px}.downloads-hero-actions a{display:inline-flex;align-items:center;justify-content:center;min-height:50px;padding:0 20px;border-radius:999px;font-weight:850;text-decoration:none}.downloads-primary-action{background:#7fbc28;color:#fff;box-shadow:0 12px 30px rgba(103,169,25,.28)}.downloads-primary-action:hover{background:#92cf3b;color:#fff}.downloads-secondary-action{border:1px solid rgba(255,255,255,.22);background:rgba(255,255,255,.06);color:#fff}.downloads-secondary-action:hover{background:rgba(255,255,255,.12);color:#fff}.downloads-trust-row{display:flex;flex-wrap:wrap;gap:18px;margin-top:26px;color:#aeb8b0;font-size:13px;font-weight:700}.downloads-device-stage{position:relative;min-height:390px;display:grid;place-items:center}.downloads-glow{position:absolute;width:360px;height:360px;border-radius:50%;background:rgba(126,193,43,.2);filter:blur(65px)}.downloads-app-window{position:relative;z-index:2;width:min(100%,500px);overflow:hidden;border:1px solid rgba(255,255,255,.17);border-radius:25px;background:linear-gradient(150deg,rgba(35,46,37,.96),rgba(8,12,9,.98));box-shadow:0 35px 90px rgba(0,0,0,.46);transform:perspective(1000px) rotateY(-7deg) rotateX(2deg)}.downloads-window-bar{height:48px;display:flex;align-items:center;gap:7px;padding:0 16px;border-bottom:1px solid rgba(255,255,255,.08);color:#8f9b92;font-size:12px}.downloads-window-bar i{width:9px;height:9px;border-radius:50%;background:#58625a}.downloads-window-bar span{margin-left:auto}.downloads-window-content{display:grid;justify-items:center;padding:48px 38px 42px;text-align:center}.downloads-window-content>img{width:210px;filter:drop-shadow(0 10px 24px rgba(0,0,0,.25))}.downloads-window-content>span{margin-top:28px;color:#92cd43;font-size:11px;font-weight:900;letter-spacing:.12em;text-transform:uppercase}.downloads-window-content>strong{margin-top:8px;font-size:21px}.downloads-player-line{width:100%;display:grid;grid-template-columns:48px 1fr auto;align-items:center;gap:14px;margin-top:28px}.downloads-player-line button{width:48px;height:48px;border:0;border-radius:50%;background:#7fbc28;color:#fff;font-size:18px}.downloads-player-line div{height:5px;overflow:hidden;border-radius:999px;background:#39413b}.downloads-player-line div i{display:block;width:62%;height:100%;background:#8dcc3c}.downloads-player-line b{color:#a4dd58;font-size:11px}.downloads-platform-badges{position:absolute;z-index:3;right:0;bottom:22px;display:flex;gap:8px}.downloads-platform-badges span{display:grid;place-items:center;width:54px;height:54px;border:1px solid rgba(255,255,255,.16);border-radius:15px;background:rgba(10,15,11,.85);box-shadow:0 12px 30px rgba(0,0,0,.28);color:#a7dc5c;font-size:12px;font-weight:900}.downloads-main{padding:72px 0 86px}.downloads-section-head{display:flex;justify-content:space-between;align-items:end;gap:50px;margin-bottom:30px}.downloads-section-head h2{margin:7px 0 0;font-size:clamp(34px,4vw,52px);letter-spacing:-.035em}.downloads-section-head p{max-width:570px;margin:0;color:#626b63;line-height:1.7}.downloads-platform-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}.downloads-platform-card{position:relative;display:flex;flex-direction:column;min-height:490px;padding:28px;border:1px solid #dce4d9;border-radius:22px;background:#fff;box-shadow:0 14px 40px rgba(23,40,23,.065);transition:transform .22s,border-color .22s,box-shadow .22s}.downloads-platform-card:hover{transform:translateY(-5px);border-color:#a7c987;box-shadow:0 22px 55px rgba(23,40,23,.11)}.downloads-platform-card.is-coming-soon{background:linear-gradient(145deg,#fff,#f7f9f5)}.downloads-platform-top{display:flex;justify-content:space-between;align-items:center}.downloads-platform-icon{display:grid;place-items:center;width:62px;height:62px;border-radius:18px;background:#111713;color:#a2d751;font-size:15px;font-weight:950;letter-spacing:.04em}.downloads-status{padding:7px 10px;border-radius:999px;background:#edf0ec;color:#697169;font-size:11px;font-weight:900;text-transform:uppercase}.downloads-status.is-ready{background:#e9f6dc;color:#568c19}.downloads-platform-card h3{margin:24px 0 10px;font-size:27px}.downloads-platform-card>p{margin:0;color:#667067;line-height:1.65}.downloads-platform-card ul{display:grid;gap:9px;margin:22px 0 26px;padding:0;list-style:none}.downloads-platform-card li{position:relative;padding-left:23px;color:#414a42;font-size:14px}.downloads-platform-card li:before{content:"✓";position:absolute;left:0;color:#70ad25;font-weight:950}.downloads-card-action{display:flex;align-items:center;justify-content:space-between;min-height:51px;margin-top:auto;padding:0 16px;border-radius:12px;background:#72ad28;color:#fff;font-weight:850;text-decoration:none}.downloads-card-action:hover{background:#5f9820;color:#fff}.downloads-card-action b{font-size:21px}.downloads-card-action.is-disabled{background:#e8ece7;color:#777f78;cursor:not-allowed}.downloads-platform-card small{display:block;margin-top:11px;color:#838a84;font-size:12px}.downloads-feature-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-top:30px}.downloads-feature-grid article{display:grid;grid-template-columns:auto 1fr;gap:16px;padding:22px;border:1px solid #dfe6dc;border-radius:17px;background:#f9fbf8}.downloads-feature-grid article>span{display:grid;place-items:center;width:42px;height:42px;border-radius:12px;background:#e9f3df;color:#5d9820;font-size:12px;font-weight:950}.downloads-feature-grid h3{margin:1px 0 6px;font-size:17px}.downloads-feature-grid p{margin:0;color:#687168;font-size:14px;line-height:1.55}.downloads-web-cta{display:flex;align-items:center;justify-content:space-between;gap:40px;margin-top:36px;padding:38px 42px;border-radius:24px;background:linear-gradient(120deg,#101611,#1b281c);color:#fff;box-shadow:0 20px 55px rgba(16,27,17,.16)}.downloads-web-cta h2{margin:8px 0 7px;font-size:32px}.downloads-web-cta p{max-width:680px;margin:0;color:#b9c3bb}.downloads-web-actions{display:grid;gap:10px;min-width:245px}.downloads-web-actions a{display:flex;justify-content:center;align-items:center;min-height:48px;padding:0 17px;border-radius:11px;background:#7dbb2a;color:#fff;font-weight:850;text-decoration:none}.downloads-web-actions a+ a{border:1px solid rgba(255,255,255,.15);background:rgba(255,255,255,.06)}.downloads-web-actions a:hover{color:#fff;filter:brightness(1.08)} +@media(max-width:1050px){.downloads-hero-grid{grid-template-columns:1fr;gap:28px;padding-top:60px}.downloads-device-stage{min-height:330px}.downloads-platform-grid,.downloads-feature-grid{grid-template-columns:1fr}.downloads-platform-card{min-height:0}.downloads-section-head,.downloads-web-cta{align-items:flex-start;flex-direction:column}.downloads-web-actions{width:100%;min-width:0}} +@media(max-width:700px){.downloads-hero-grid{padding-top:44px;padding-bottom:50px}.downloads-hero h1{font-size:48px}.downloads-device-stage{min-height:270px}.downloads-app-window{transform:none}.downloads-window-content{padding:34px 20px}.downloads-window-content>img{width:170px}.downloads-platform-badges{right:8px;bottom:0}.downloads-platform-badges span{width:46px;height:46px}.downloads-main{padding:48px 0 58px}.downloads-section-head h2{font-size:36px}.downloads-platform-card{padding:22px}.downloads-web-cta{padding:28px 23px}.downloads-trust-row{display:grid;gap:9px}} + +.downloads-wallpaper-preview{width:100%;aspect-ratio:16/9;object-fit:cover;border-radius:16px;margin:0 0 16px} diff --git a/web/assets/editorial-story-v2.css b/web/assets/editorial-story-v2.css new file mode 100644 index 0000000..0c6987f --- /dev/null +++ b/web/assets/editorial-story-v2.css @@ -0,0 +1,3 @@ +.editorial-story-page{background:#f3f5f0}.editorial-story-hero{position:relative;min-height:470px;display:flex;align-items:flex-end;background-image:linear-gradient(90deg,rgba(9,18,10,.92),rgba(9,18,10,.45)),var(--story-image,linear-gradient(135deg,#182a18,#50752a));background-size:cover;background-position:center;color:#fff}.editorial-story-hero .page-shell{padding-top:140px;padding-bottom:60px}.editorial-story-hero span{color:#a8df55;font-size:12px;font-weight:900;letter-spacing:.13em;text-transform:uppercase}.editorial-story-hero h1{max-width:920px;margin:10px 0 14px;font-size:clamp(2.7rem,7vw,5.4rem);line-height:.98}.editorial-story-hero p{max-width:760px;color:#e2ebe0;font-size:1.15rem;line-height:1.65}.editorial-story-hero b{display:inline-flex;margin-top:14px;padding:8px 12px;border:1px solid rgba(255,255,255,.24);border-radius:999px;background:rgba(0,0,0,.25)}.editorial-story-article{max-width:920px;padding-top:30px;padding-bottom:70px}.editorial-story-article nav{display:flex;gap:8px;margin-bottom:22px;color:#6e786d;font-size:13px}.editorial-story-article nav a{color:#679d24}.editorial-story-article>img{width:100%;max-height:520px;object-fit:cover;border-radius:20px;box-shadow:0 18px 45px rgba(30,49,25,.13)}.editorial-story-meta{display:flex;gap:10px;flex-wrap:wrap;margin:20px 0}.editorial-story-meta span{padding:7px 10px;border-radius:999px;background:#e5eddf;color:#53624f;font-size:12px}.editorial-story-body{white-space:pre-wrap;font-size:1.05rem;line-height:1.85;color:#2e392d}.editorial-story-article aside{margin-top:38px;padding:24px;border-left:6px solid #79b82d;border-radius:16px;background:#172117;color:#fff}.editorial-story-article aside strong{font-size:1.35rem}.editorial-story-article aside p{color:#cbd6c9}.editorial-story-article aside a{color:#afe464;font-weight:850;text-decoration:none}@media(max-width:700px){.editorial-story-hero{min-height:390px}.editorial-story-hero .page-shell{padding-top:110px;padding-bottom:40px}.editorial-story-article>img{border-radius:12px}} +/* v1.5.24 – KI-Transparenz */ +.story-ai-first-label{display:flex;align-items:flex-start;gap:10px;width:min(680px,100%);margin:12px 0 18px;padding:11px 13px;border:1px solid rgba(255,255,255,.28);border-radius:13px;background:rgba(8,15,9,.72);backdrop-filter:blur(7px)}.story-ai-first-label b{display:inline-flex!important;margin:0!important;padding:5px 8px!important;border:0!important;border-radius:999px!important;background:#a8df55!important;color:#173017!important;font-size:.7rem;white-space:nowrap}.story-ai-first-label small{color:#f4f7f2;line-height:1.45}.story-location{display:inline-flex!important}.editorial-story-article>figure{margin:0}.editorial-story-article>figure>img{width:100%;max-height:520px;object-fit:cover;border-radius:20px;box-shadow:0 18px 45px rgba(30,49,25,.13)}.editorial-story-article>figure figcaption{margin-top:8px;padding:10px 12px;border-radius:10px;background:#e9eef2;color:#40515e;font-size:.8rem;line-height:1.5}.editorial-story-meta .is-ai{background:#ede7ff;color:#5c3d85;font-weight:800}.editorial-ai-disclosure{display:flex;align-items:center;justify-content:space-between;gap:18px;margin:20px 0 28px;padding:18px;border:1px solid #d8cee9;border-left:6px solid #70509c;border-radius:15px;background:#f7f3fc;color:#332a3d}.editorial-ai-disclosure>div{display:flex;align-items:flex-start;gap:13px}.editorial-ai-disclosure>div>span{display:grid;place-items:center;flex:0 0 38px;width:38px;height:38px;border-radius:12px;background:#70509c;color:#fff;font-size:1.15rem}.editorial-ai-disclosure strong{display:block}.editorial-ai-disclosure p{margin:4px 0;color:#5d5366;line-height:1.55}.editorial-ai-disclosure small{color:#706677}.editorial-ai-disclosure>a{flex:0 0 auto;color:#5b3783;font-weight:850;text-decoration:none}.editorial-story-contact{margin-top:38px!important;padding:24px!important;border-left:6px solid #79b82d!important;border-radius:16px!important;background:#172117!important;color:#fff!important}.editorial-story-contact p{color:#cbd6c9!important}.editorial-story-contact a{color:#afe464!important}@media(max-width:700px){.story-ai-first-label{flex-direction:column}.editorial-story-article>figure>img{border-radius:12px}.editorial-ai-disclosure{align-items:flex-start;flex-direction:column}.editorial-ai-disclosure>a{flex:auto}} diff --git a/web/assets/empfangen-hero-v2.png b/web/assets/empfangen-hero-v2.png new file mode 100644 index 0000000..373cbd1 Binary files /dev/null and b/web/assets/empfangen-hero-v2.png differ diff --git a/web/assets/empfangen-v1.css b/web/assets/empfangen-v1.css new file mode 100644 index 0000000..9a2bb53 --- /dev/null +++ b/web/assets/empfangen-v1.css @@ -0,0 +1 @@ +.reception-page{background:#f4f6f2}.reception-hero{position:relative;isolation:isolate;overflow:hidden;min-height:clamp(320px,40vw,520px);display:flex;align-items:flex-end;background:#142019 url("/assets/empfangen-hero-v2.png") center 52%/cover no-repeat}.reception-hero::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(10,18,14,.76) 0%,rgba(10,18,14,.38) 38%,rgba(10,18,14,.12) 70%),linear-gradient(0deg,rgba(10,18,14,.60) 0%,transparent 56%)}.reception-hero::after{content:"";position:absolute;width:560px;height:560px;right:-120px;top:-220px;border-radius:50%;background:radial-gradient(circle,rgba(255,209,120,.14),transparent 70%)}.reception-hero .page-shell{position:relative;z-index:1;padding-top:92px;padding-bottom:56px}.reception-hero span,.reception-hero h1,.reception-hero p{text-shadow:0 2px 18px rgba(0,0,0,.45)}.reception-hero p{max-width:760px}.reception-availability{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:24px}.reception-availability>b,.reception-availability>span{padding:8px 12px;border:1px solid rgba(255,255,255,.18);border-radius:999px;background:rgba(255,255,255,.09);color:#fff;font-size:12px;font-weight:800;backdrop-filter:blur(8px)}.reception-availability>b{background:#81bc22;border-color:#81bc22;color:#10200e}.reception-availability i{display:inline-block;width:8px;height:8px;margin-right:5px;border-radius:50%;background:#fff;box-shadow:0 0 0 5px rgba(255,255,255,.18)}.reception-card-head,.service-title-row{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.reception-kicker{display:block;margin-bottom:6px;color:#78ae27;font-size:11px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.service-status{display:inline-flex;flex:0 0 auto;align-items:center;padding:6px 9px;border-radius:999px;font-size:10px;font-weight:900;text-transform:uppercase}.service-status.is-live{background:#e4f4ce;color:#4b7915}.service-status.is-planned{background:#ecefea;color:#687066}.service-count{padding:7px 10px;border-radius:999px;background:#f0f4ed;color:#5f695d;font-size:11px;font-weight:800}.reception-note{margin-top:16px!important;padding:13px 15px;border-radius:12px;background:#f3f6f0;font-size:13px}.reception-service-list .service-item{transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease}.reception-service-list .service-item:hover{transform:translateY(-2px);box-shadow:0 10px 24px rgba(20,35,18,.08)}.reception-service-list .service-item.is-available{border-color:#cee2af;background:linear-gradient(135deg,#fbfdf8,#f3f8ed)}.service-title-row h3{margin-top:0}.reception-direct-card{display:flex;align-items:center;justify-content:space-between;gap:24px;background:linear-gradient(135deg,#142019,#263d25);color:#fff}.reception-direct-card h2{color:#fff}.reception-direct-card p{max-width:650px;color:#d2dbd1}.reception-primary-action{flex:0 0 auto;padding:13px 18px;border-radius:999px;background:#83be22;color:#10200e!important;font-weight:900;text-decoration:none}.reception-side span{color:#7fb72a;font-size:11px;font-weight:900;text-transform:uppercase}.reception-side h2{margin:8px 0 10px;font-size:24px}.reception-side ul{display:grid;gap:9px;margin:18px 0;padding:0;list-style:none}.reception-side li{position:relative;padding-left:22px;color:#505c50;font-size:14px}.reception-side li::before{content:"✓";position:absolute;left:0;color:#75aa25;font-weight:900}@media(max-width:760px){.reception-card-head,.service-title-row,.reception-direct-card{align-items:flex-start;flex-direction:column}.service-title-row{gap:6px}.reception-primary-action{width:100%;text-align:center}.reception-availability{gap:7px}.reception-availability>b,.reception-availability>span{font-size:10px}.reception-hero{background-position:68% 50%}.reception-hero .page-shell{padding-top:82px;padding-bottom:44px}} \ No newline at end of file diff --git a/web/assets/error-v28.css b/web/assets/error-v28.css new file mode 100644 index 0000000..3b4bf7e --- /dev/null +++ b/web/assets/error-v28.css @@ -0,0 +1 @@ +.error-page{min-height:68vh;background:#f4f5f3}.error-hero{position:relative;overflow:hidden;padding:clamp(4.5rem,9vw,8rem) 0;background:radial-gradient(circle at 78% 20%,rgba(31,182,83,.19),transparent 28%),linear-gradient(135deg,#0b0d0b 0%,#121713 58%,#17231a 100%);color:#fff}.error-hero:before,.error-hero:after{content:"";position:absolute;border:1px solid rgba(47,207,102,.15);border-radius:50%;pointer-events:none}.error-hero:before{width:520px;height:520px;right:-180px;top:-230px}.error-hero:after{width:360px;height:360px;right:-80px;top:-150px}.error-shell{position:relative;z-index:1;display:grid;grid-template-columns:minmax(0,1.35fr) minmax(280px,.65fr);gap:clamp(2rem,5vw,5rem);align-items:center}.error-copy{max-width:760px}.error-kicker{display:inline-flex;align-items:center;gap:.55rem;padding:.45rem .8rem;border:1px solid rgba(71,221,119,.36);border-radius:999px;background:rgba(30,166,73,.13);color:#8ef0ae;font-size:.78rem;font-weight:800;letter-spacing:.14em;text-transform:uppercase}.error-kicker:before{content:"";width:.48rem;height:.48rem;border-radius:50%;background:#23c45a;box-shadow:0 0 18px rgba(35,196,90,.9)}.error-code{margin:.5rem 0 -1rem;font-size:clamp(7rem,17vw,12rem);line-height:1;font-weight:900;letter-spacing:-.085em;color:transparent;-webkit-text-stroke:2px rgba(108,241,149,.55);text-shadow:0 0 48px rgba(34,193,84,.11)}.error-copy h1{max-width:690px;margin:0;font-size:clamp(2.2rem,5vw,4.6rem);line-height:1.02;letter-spacing:-.045em}.error-copy p{max-width:650px;margin:1.35rem 0 0;color:#cbd2cc;font-size:clamp(1rem,1.6vw,1.2rem);line-height:1.7}.error-actions{display:flex;flex-wrap:wrap;gap:.85rem;margin-top:2rem}.error-primary,.error-secondary{display:inline-flex;align-items:center;justify-content:center;min-height:50px;padding:.8rem 1.3rem;border-radius:12px;font-weight:800;text-decoration:none;transition:transform .2s ease,background .2s ease,border-color .2s ease}.error-primary{background:#20ae51;color:#fff;box-shadow:0 14px 34px rgba(31,174,81,.25)}.error-primary:hover{background:#28bd5d;transform:translateY(-2px)}.error-secondary{border:1px solid rgba(255,255,255,.22);background:rgba(255,255,255,.06);color:#fff}.error-secondary:hover{border-color:#35ca68;background:rgba(53,202,104,.1);transform:translateY(-2px)}.error-card{display:flex;flex-direction:column;padding:1.6rem;border:1px solid rgba(255,255,255,.12);border-radius:22px;background:rgba(255,255,255,.07);box-shadow:0 30px 70px rgba(0,0,0,.28);backdrop-filter:blur(18px)}.error-card img{width:168px;max-width:72%;margin-bottom:1.4rem}.error-card strong{margin-bottom:.55rem;font-size:1.15rem}.error-card a{display:flex;justify-content:space-between;gap:1rem;padding:.9rem 0;border-bottom:1px solid rgba(255,255,255,.1);color:#e9eeea;text-decoration:none;font-weight:650}.error-card a:last-child{border-bottom:0}.error-card a span{color:#49d978}.error-card a:hover{color:#76e69a}@media(max-width:820px){.error-shell{grid-template-columns:1fr}.error-card{max-width:560px}.error-code{margin-bottom:-.5rem}}@media(max-width:540px){.error-hero{padding:3.5rem 0}.error-code{font-size:7rem}.error-actions{flex-direction:column}.error-primary,.error-secondary{width:100%}} diff --git a/web/assets/event-concert-v14.jpg b/web/assets/event-concert-v14.jpg new file mode 100644 index 0000000..60650ab Binary files /dev/null and b/web/assets/event-concert-v14.jpg differ diff --git a/web/assets/event-market-v14.jpg b/web/assets/event-market-v14.jpg new file mode 100644 index 0000000..f96ba41 Binary files /dev/null and b/web/assets/event-market-v14.jpg differ diff --git a/web/assets/event-schuetzen-v14.jpg b/web/assets/event-schuetzen-v14.jpg new file mode 100644 index 0000000..4593632 Binary files /dev/null and b/web/assets/event-schuetzen-v14.jpg differ diff --git a/web/assets/events-hero-v2.png b/web/assets/events-hero-v2.png new file mode 100644 index 0000000..6453753 Binary files /dev/null and b/web/assets/events-hero-v2.png differ diff --git a/web/assets/events-v1.css b/web/assets/events-v1.css new file mode 100644 index 0000000..e79bb02 --- /dev/null +++ b/web/assets/events-v1.css @@ -0,0 +1,3 @@ +.events-page{background:#f4f6f2}.events-hero{position:relative;isolation:isolate;overflow:hidden;min-height:clamp(320px,39vw,500px);display:flex;align-items:flex-end;background:#2c2217 url("/assets/events-hero-v2.png") center 52%/cover no-repeat}.events-hero::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(17,13,9,.72) 0%,rgba(17,13,9,.38) 38%,rgba(17,13,9,.12) 72%),linear-gradient(0deg,rgba(17,13,9,.55) 0%,transparent 58%)}.events-hero::after{content:"";position:absolute;right:-120px;top:-160px;width:520px;height:520px;border-radius:50%;background:radial-gradient(circle,rgba(255,214,150,.16),transparent 70%)}.events-hero .page-shell{position:relative;z-index:1;padding-top:100px;padding-bottom:55px}.events-hero span,.events-hero h1,.events-hero p{text-shadow:0 2px 18px rgba(0,0,0,.45)}.events-hero p{max-width:760px}.events-hero-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:24px}.events-hero-actions button,.events-hero-actions a,.events-heading button,.events-side-card button,.events-empty button{border:0;border-radius:999px;padding:12px 18px;background:#83bd25;color:#10200e;font-weight:900;text-decoration:none;cursor:pointer}.events-hero-actions a{background:rgba(255,255,255,.12);color:#fff;border:1px solid rgba(255,255,255,.25)}.events-success{margin-top:26px;padding:15px 18px;border-radius:13px;background:#e3f3ce;color:#426c12;font-weight:800}.events-layout{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:26px;align-items:start;padding-top:44px;padding-bottom:70px}.events-main-card,.events-side-card{border:1px solid #dde5da;border-radius:22px;background:#fff;box-shadow:0 12px 35px rgba(20,34,18,.07)}.events-main-card{padding:30px}.events-heading{display:flex;justify-content:space-between;gap:22px;align-items:flex-start}.events-heading span,.events-side-card>span,.event-copy>span{color:#73a923;font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.07em}.events-heading h2{margin:5px 0 8px}.events-heading p{margin:0;color:#687167}.events-filters{display:flex;gap:8px;overflow:auto;padding:24px 0 18px}.events-filters a{white-space:nowrap;padding:8px 12px;border-radius:999px;background:#eef2eb;color:#566054;text-decoration:none;font-size:12px;font-weight:800}.events-filters a.is-active{background:#172019;color:#fff}.events-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.event-calendar-card{overflow:hidden;border:1px solid #e0e6dd;border-radius:17px;background:#fff}.event-image{position:relative}.event-image img{display:block;width:100%;height:190px;object-fit:cover;background:#edf1eb}.event-date{position:absolute;left:13px;top:13px;display:grid;place-items:center;width:58px;height:62px;border-radius:13px;background:#fff;color:#172019;box-shadow:0 8px 22px rgba(0,0,0,.18)}.event-date b{font-size:23px;line-height:1}.event-date span{font-size:10px;font-weight:900;color:#75aa24}.event-copy{padding:18px}.event-copy h3{margin:5px 0 9px}.event-copy p{white-space:pre-line;display:-webkit-box;overflow:hidden;-webkit-line-clamp:3;-webkit-box-orient:vertical;color:#687068;font-size:14px}.event-copy dl{display:grid;gap:8px;margin:15px 0}.event-copy dl div{display:grid;grid-template-columns:48px 1fr;gap:8px;font-size:12px}.event-copy dt{color:#899087}.event-copy dd{margin:0;color:#344035;font-weight:700}.event-source{margin-bottom:12px;color:#7b8379;font-size:11px}.event-copy>a{color:#5f941a;font-weight:900;text-decoration:none}.event-card-actions{display:flex;flex-wrap:wrap;gap:9px;align-items:center}.event-card-actions a{padding:8px 11px;border-radius:999px;background:#eef3e9;color:#4f7f18;font-size:11px;font-weight:900;text-decoration:none}.event-card-actions .event-google-action{background:#172019;color:#fff}.events-side-column{position:sticky;top:90px;display:grid;gap:18px}.events-side-card{padding:27px}.events-side-card img{width:130px}.events-side-card h2{margin:8px 0 10px}.events-side-card p{color:#687167}.events-side-card ul{display:grid;gap:9px;padding:0;list-style:none}.events-side-card li::before{content:"✓";margin-right:8px;color:#76ab24;font-weight:900}.events-side-card button{width:100%;margin-top:12px}.calendar-subscribe-card{background:linear-gradient(145deg,#172019,#294027);color:#fff}.calendar-subscribe-card h2{color:#fff}.calendar-subscribe-card p,.calendar-subscribe-card small{color:#d4ddd2}.calendar-subscribe-card small{display:block;margin-top:13px;font-size:11px}.calendar-subscribe-button,.calendar-download-link{display:block;text-align:center;border-radius:999px;padding:12px 15px;font-weight:900;text-decoration:none}.calendar-subscribe-button{margin-top:18px;background:#83bd25;color:#10200e}.calendar-download-link{margin-top:9px;border:1px solid rgba(255,255,255,.24);color:#fff}.events-empty{text-align:center;padding:70px 20px}.events-empty>span{font-size:46px}.events-empty p{color:#707970}.event-modal[hidden]{display:none!important}.event-modal{position:fixed;inset:0;z-index:10000;display:grid;place-items:center;padding:20px}.event-modal-backdrop{position:absolute;inset:0;background:rgba(5,10,7,.78);backdrop-filter:blur(5px)}.event-dialog{position:relative;z-index:1;width:min(900px,100%);max-height:92vh;overflow:auto;border-radius:23px;background:#fff;padding:32px;box-shadow:0 25px 90px rgba(0,0,0,.45)}.event-close{position:absolute;right:15px;top:12px;border:0;background:transparent;font-size:32px;cursor:pointer}.event-dialog-head span{color:#75aa24;font-size:11px;font-weight:900;text-transform:uppercase}.event-dialog-head h2{margin:6px 0}.event-dialog-head p{color:#697168}.event-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:15px;margin-top:24px}.event-form label{display:grid;gap:6px}.event-form label>span{font-size:12px;font-weight:850;color:#384238}.event-form input,.event-form select,.event-form textarea{width:100%;box-sizing:border-box;border:1px solid #cfd8cc;border-radius:11px;padding:11px 12px;background:#fbfcfa;font:inherit}.event-form .is-wide{grid-column:1/-1}.event-upload{align-content:start}.event-upload small{color:#7a8278}.event-consent{grid-template-columns:auto 1fr!important;align-items:start}.event-consent input{width:auto;margin-top:3px}.event-submit{border:0;border-radius:12px;padding:14px;background:#78b224;color:#fff;font-weight:900;cursor:pointer}.has-event-modal{overflow:hidden}@media(max-width:950px){.events-layout{grid-template-columns:1fr}.events-side-column{position:static}.events-grid{grid-template-columns:1fr}}@media(max-width:650px){.events-main-card{padding:20px}.events-heading{flex-direction:column}.events-heading button{width:100%}.event-form{grid-template-columns:1fr}.event-form .is-wide{grid-column:auto}.event-dialog{padding:25px 18px}.events-hero{background-position:62% 50%}.events-hero .page-shell{padding-top:80px;padding-bottom:44px}} + +.events-pagination{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-top:28px;padding-top:22px;border-top:1px solid #e3e8e0}.events-pagination-status{color:#707970;font-size:12px;font-weight:750;white-space:nowrap}.events-pagination-links{display:flex;align-items:center;justify-content:flex-end;gap:7px}.events-pagination-links a{display:inline-flex;align-items:center;justify-content:center;min-width:38px;height:38px;padding:0 11px;border-radius:999px;background:#eef2eb;color:#465244;font-size:12px;font-weight:900;text-decoration:none}.events-pagination-links a:hover{background:#dfe9d6}.events-pagination-links a.is-active{background:#172019;color:#fff;pointer-events:none}.events-pagination-links a.is-direction{padding:0 15px;background:#83bd25;color:#10200e}.events-pagination-ellipsis{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:38px;color:#879084;font-weight:900}@media(max-width:650px){.events-pagination{align-items:stretch;flex-direction:column}.events-pagination-status{text-align:center;white-space:normal}.events-pagination-links{justify-content:center;gap:5px}.events-pagination-links a{min-width:34px;height:34px;padding:0 9px}.events-pagination-links a.is-direction{flex:0 1 auto;padding:0 12px}.events-pagination-ellipsis{height:34px;min-width:18px}} diff --git a/web/assets/events-v1.js b/web/assets/events-v1.js new file mode 100644 index 0000000..dd0c2e8 --- /dev/null +++ b/web/assets/events-v1.js @@ -0,0 +1 @@ +(()=>{const modal=document.querySelector('[data-event-modal]');if(!modal)return;const open=()=>{modal.hidden=false;document.body.classList.add('has-event-modal');modal.querySelector('input')?.focus()};const close=()=>{modal.hidden=true;document.body.classList.remove('has-event-modal')};document.querySelectorAll('[data-event-open]').forEach(b=>b.addEventListener('click',open));document.querySelectorAll('[data-event-close]').forEach(b=>b.addEventListener('click',close));document.addEventListener('keydown',e=>{if(e.key==='Escape'&&!modal.hidden)close()});})(); diff --git a/web/assets/events-v2.css b/web/assets/events-v2.css new file mode 100644 index 0000000..71b4062 --- /dev/null +++ b/web/assets/events-v2.css @@ -0,0 +1,4 @@ +.events-page{background:#f4f6f2}.events-hero{position:relative;isolation:isolate;overflow:hidden;min-height:clamp(320px,39vw,500px);display:flex;align-items:flex-end;background:#2c2217 url("/assets/events-hero-v2.png") center 52%/cover no-repeat}.events-hero::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(17,13,9,.72) 0%,rgba(17,13,9,.38) 38%,rgba(17,13,9,.12) 72%),linear-gradient(0deg,rgba(17,13,9,.55) 0%,transparent 58%)}.events-hero::after{content:"";position:absolute;right:-120px;top:-160px;width:520px;height:520px;border-radius:50%;background:radial-gradient(circle,rgba(255,214,150,.16),transparent 70%)}.events-hero .page-shell{position:relative;z-index:1;padding-top:100px;padding-bottom:55px}.events-hero span,.events-hero h1,.events-hero p{text-shadow:0 2px 18px rgba(0,0,0,.45)}.events-hero p{max-width:760px}.events-hero-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:24px}.events-hero-actions button,.events-hero-actions a,.events-heading button,.events-side-card button,.events-empty button{border:0;border-radius:999px;padding:12px 18px;background:#83bd25;color:#10200e;font-weight:900;text-decoration:none;cursor:pointer}.events-hero-actions a{background:rgba(255,255,255,.12);color:#fff;border:1px solid rgba(255,255,255,.25)}.events-success{margin-top:26px;padding:15px 18px;border-radius:13px;background:#e3f3ce;color:#426c12;font-weight:800}.events-layout{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:26px;align-items:start;padding-top:44px;padding-bottom:70px}.events-main-card,.events-side-card{border:1px solid #dde5da;border-radius:22px;background:#fff;box-shadow:0 12px 35px rgba(20,34,18,.07)}.events-main-card{padding:30px}.events-heading{display:flex;justify-content:space-between;gap:22px;align-items:flex-start}.events-heading span,.events-side-card>span,.event-copy>span{color:#73a923;font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.07em}.events-heading h2{margin:5px 0 8px}.events-heading p{margin:0;color:#687167}.events-filters{display:flex;gap:8px;overflow:auto;padding:24px 0 18px}.events-filters a{white-space:nowrap;padding:8px 12px;border-radius:999px;background:#eef2eb;color:#566054;text-decoration:none;font-size:12px;font-weight:800}.events-filters a.is-active{background:#172019;color:#fff}.events-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.event-calendar-card{overflow:hidden;border:1px solid #e0e6dd;border-radius:17px;background:#fff}.event-image{position:relative}.event-image img{display:block;width:100%;height:190px;object-fit:cover;background:#edf1eb}.event-date{position:absolute;left:13px;top:13px;display:grid;place-items:center;width:58px;height:62px;border-radius:13px;background:#fff;color:#172019;box-shadow:0 8px 22px rgba(0,0,0,.18)}.event-date b{font-size:23px;line-height:1}.event-date span{font-size:10px;font-weight:900;color:#75aa24}.event-copy{padding:18px}.event-copy h3{margin:5px 0 9px}.event-copy p{white-space:pre-line;display:-webkit-box;overflow:hidden;-webkit-line-clamp:3;-webkit-box-orient:vertical;color:#687068;font-size:14px}.event-copy dl{display:grid;gap:8px;margin:15px 0}.event-copy dl div{display:grid;grid-template-columns:48px 1fr;gap:8px;font-size:12px}.event-copy dt{color:#899087}.event-copy dd{margin:0;color:#344035;font-weight:700}.event-source{margin-bottom:12px;color:#7b8379;font-size:11px}.event-copy>a{color:#5f941a;font-weight:900;text-decoration:none}.event-card-actions{display:flex;flex-wrap:wrap;gap:9px;align-items:center}.event-card-actions a{padding:8px 11px;border-radius:999px;background:#eef3e9;color:#4f7f18;font-size:11px;font-weight:900;text-decoration:none}.event-card-actions .event-google-action{background:#172019;color:#fff}.events-side-column{position:sticky;top:90px;display:grid;gap:18px}.events-side-card{padding:27px}.events-side-card img{width:130px}.events-side-card h2{margin:8px 0 10px}.events-side-card p{color:#687167}.events-side-card ul{display:grid;gap:9px;padding:0;list-style:none}.events-side-card li::before{content:"✓";margin-right:8px;color:#76ab24;font-weight:900}.events-side-card button{width:100%;margin-top:12px}.calendar-subscribe-card{background:linear-gradient(145deg,#172019,#294027);color:#fff}.calendar-subscribe-card h2{color:#fff}.calendar-subscribe-card p,.calendar-subscribe-card small{color:#d4ddd2}.calendar-subscribe-card small{display:block;margin-top:13px;font-size:11px}.calendar-subscribe-button,.calendar-download-link{display:block;text-align:center;border-radius:999px;padding:12px 15px;font-weight:900;text-decoration:none}.calendar-subscribe-button{margin-top:18px;background:#83bd25;color:#10200e}.calendar-download-link{margin-top:9px;border:1px solid rgba(255,255,255,.24);color:#fff}.events-empty{text-align:center;padding:70px 20px}.events-empty>span{font-size:46px}.events-empty p{color:#707970}.event-modal[hidden]{display:none!important}.event-modal{position:fixed;inset:0;z-index:10000;display:grid;place-items:center;padding:20px}.event-modal-backdrop{position:absolute;inset:0;background:rgba(5,10,7,.78);backdrop-filter:blur(5px)}.event-dialog{position:relative;z-index:1;width:min(900px,100%);max-height:92vh;overflow:auto;border-radius:23px;background:#fff;padding:32px;box-shadow:0 25px 90px rgba(0,0,0,.45)}.event-close{position:absolute;right:15px;top:12px;border:0;background:transparent;font-size:32px;cursor:pointer}.event-dialog-head span{color:#75aa24;font-size:11px;font-weight:900;text-transform:uppercase}.event-dialog-head h2{margin:6px 0}.event-dialog-head p{color:#697168}.event-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:15px;margin-top:24px}.event-form label{display:grid;gap:6px}.event-form label>span{font-size:12px;font-weight:850;color:#384238}.event-form input,.event-form select,.event-form textarea{width:100%;box-sizing:border-box;border:1px solid #cfd8cc;border-radius:11px;padding:11px 12px;background:#fbfcfa;font:inherit}.event-form .is-wide{grid-column:1/-1}.event-upload{align-content:start}.event-upload small{color:#7a8278}.event-consent{grid-template-columns:auto 1fr!important;align-items:start}.event-consent input{width:auto;margin-top:3px}.event-submit{border:0;border-radius:12px;padding:14px;background:#78b224;color:#fff;font-weight:900;cursor:pointer}.has-event-modal{overflow:hidden}@media(max-width:950px){.events-layout{grid-template-columns:1fr}.events-side-column{position:static}.events-grid{grid-template-columns:1fr}}@media(max-width:650px){.events-main-card{padding:20px}.events-heading{flex-direction:column}.events-heading button{width:100%}.event-form{grid-template-columns:1fr}.event-form .is-wide{grid-column:auto}.event-dialog{padding:25px 18px}.events-hero{background-position:62% 50%}.events-hero .page-shell{padding-top:80px;padding-bottom:44px}} + +.events-pagination{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-top:28px;padding-top:22px;border-top:1px solid #e3e8e0}.events-pagination-status{color:#707970;font-size:12px;font-weight:750;white-space:nowrap}.events-pagination-links{display:flex;align-items:center;justify-content:flex-end;gap:7px}.events-pagination-links a{display:inline-flex;align-items:center;justify-content:center;min-width:38px;height:38px;padding:0 11px;border-radius:999px;background:#eef2eb;color:#465244;font-size:12px;font-weight:900;text-decoration:none}.events-pagination-links a:hover{background:#dfe9d6}.events-pagination-links a.is-active{background:#172019;color:#fff;pointer-events:none}.events-pagination-links a.is-direction{padding:0 15px;background:#83bd25;color:#10200e}.events-pagination-ellipsis{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:38px;color:#879084;font-weight:900}@media(max-width:650px){.events-pagination{align-items:stretch;flex-direction:column}.events-pagination-status{text-align:center;white-space:normal}.events-pagination-links{justify-content:center;gap:5px}.events-pagination-links a{min-width:34px;height:34px;padding:0 9px}.events-pagination-links a.is-direction{flex:0 1 auto;padding:0 12px}.events-pagination-ellipsis{height:34px;min-width:18px}} +.events-live-search{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:15px;align-items:end;margin:0 0 22px;padding:17px;border:1px solid #e0e7dd;border-radius:15px;background:#f7faf5}.events-live-search label{display:grid;gap:6px}.events-live-search label>span{font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.06em;color:#65951f}.events-live-search input{width:100%;padding:12px 14px;border:1px solid #cfd9cc;border-radius:12px;background:#fff;font:inherit}.events-search-status{min-width:170px;padding-bottom:11px;color:#6b756c;font-size:12px;font-weight:750;text-align:right}.event-calendar-card{cursor:pointer;transition:transform .18s ease,box-shadow .18s ease}.event-calendar-card:hover{transform:translateY(-3px);box-shadow:0 15px 35px rgba(28,43,23,.12)}.event-card-actions button{padding:8px 11px;border:0;border-radius:999px;background:#80bb27;color:#14200f;font-size:11px;font-weight:900;cursor:pointer}.event-detail-modal[hidden]{display:none!important}.event-detail-modal{position:fixed;inset:0;z-index:10020;display:grid;place-items:center;padding:20px}.event-detail-backdrop{position:absolute;inset:0;background:rgba(5,10,7,.82);backdrop-filter:blur(6px)}.event-detail-dialog{position:relative;z-index:1;display:grid;grid-template-columns:minmax(280px,42%) minmax(0,1fr);width:min(980px,100%);max-height:92vh;overflow:auto;border-radius:24px;background:#fff;box-shadow:0 30px 100px rgba(0,0,0,.5)}.event-detail-close{position:absolute;right:14px;top:12px;z-index:3;width:42px;height:42px;border:0;border-radius:50%;background:rgba(15,24,17,.88);color:#fff;font-size:28px;cursor:pointer}.event-detail-media{position:relative;min-height:430px;background:#e9eee6}.event-detail-media img{width:100%;height:100%;min-height:430px;object-fit:cover}.event-detail-media span{position:absolute;left:18px;bottom:18px;padding:8px 11px;border-radius:999px;background:#82bd27;color:#13200f;font-size:11px;font-weight:900;text-transform:uppercase}.event-detail-content{padding:36px;overflow-wrap:anywhere}.event-detail-kicker{color:#70a823;font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.06em}.event-detail-content h2{margin:7px 50px 8px 0;font-size:clamp(27px,3vw,42px);line-height:1.05}.event-detail-date{margin:0 0 20px;color:#548419;font-weight:900}.event-detail-content dl{display:grid;gap:8px;padding:15px 0;margin:0;border-top:1px solid #e5ebe3;border-bottom:1px solid #e5ebe3}.event-detail-content dl div{display:grid;grid-template-columns:100px 1fr;gap:12px}.event-detail-content dt{color:#7a847a}.event-detail-content dd{margin:0;font-weight:800}.event-detail-description{white-space:pre-line;margin:22px 0;color:#39443a;line-height:1.65}.event-detail-source{color:#758076;font-size:12px}.event-detail-actions{display:flex;flex-wrap:wrap;gap:9px;margin-top:22px}.event-detail-actions a{padding:10px 13px;border-radius:999px;background:#172019;color:#fff;text-decoration:none;font-size:12px;font-weight:900}.event-detail-actions a:nth-child(n+2){background:#eaf1e5;color:#517f1b}.event-detail-error{padding:12px;border-radius:10px;background:#fde7e5;color:#a03129;font-weight:800}.has-event-detail-modal{overflow:hidden}.events-grid.is-loading{opacity:.5;pointer-events:none}.events-search-empty{grid-column:1/-1;padding:55px 20px;text-align:center;border:1px dashed #ccd7c9;border-radius:16px;color:#667166}.events-search-empty strong{display:block;margin-bottom:7px;color:#273228;font-size:20px}@media(max-width:760px){.events-live-search{grid-template-columns:1fr}.events-search-status{text-align:left;padding:0}.event-detail-dialog{grid-template-columns:1fr}.event-detail-media,.event-detail-media img{min-height:230px;max-height:300px}.event-detail-content{padding:25px 20px}.event-detail-content h2{margin-right:40px}.event-detail-content dl div{grid-template-columns:80px 1fr}} diff --git a/web/assets/events-v2.js b/web/assets/events-v2.js new file mode 100644 index 0000000..0845779 --- /dev/null +++ b/web/assets/events-v2.js @@ -0,0 +1,56 @@ +(()=>{ + const body=document.body; + const submission=document.querySelector('[data-event-modal]'); + const detail=document.querySelector('[data-event-detail-modal]'); + const grid=document.querySelector('[data-events-grid]'); + const pagination=document.querySelector('[data-events-pagination]'); + const search=document.querySelector('[data-event-search]'); + const searchStatus=document.querySelector('[data-event-search-status]'); + const escapeText=value=>String(value??''); + const openSubmission=()=>{if(!submission)return;submission.hidden=false;body.classList.add('has-event-modal');submission.querySelector('input')?.focus()}; + const closeSubmission=()=>{if(!submission)return;submission.hidden=true;body.classList.remove('has-event-modal')}; + document.querySelectorAll('[data-event-open]').forEach(button=>button.addEventListener('click',openSubmission)); + document.querySelectorAll('[data-event-close]').forEach(button=>button.addEventListener('click',closeSubmission)); + + const detailFields={ + image:detail?.querySelector('[data-event-detail-image]'),category:detail?.querySelector('[data-event-detail-category]'),title:detail?.querySelector('[data-event-detail-title]'),date:detail?.querySelector('[data-event-detail-date]'),place:detail?.querySelector('[data-event-detail-place]'),organizer:detail?.querySelector('[data-event-detail-organizer]'),organizerRow:detail?.querySelector('[data-event-detail-organizer-row]'),description:detail?.querySelector('[data-event-detail-description]'),source:detail?.querySelector('[data-event-detail-source]'),calendar:detail?.querySelector('[data-event-detail-calendar]'),website:detail?.querySelector('[data-event-detail-website]'),sourceLink:detail?.querySelector('[data-event-detail-source-link]'),error:detail?.querySelector('[data-event-detail-error]') + }; + const closeDetail=()=>{if(!detail)return;detail.hidden=true;body.classList.remove('has-event-detail-modal')}; + const setLink=(node,url)=>{if(!node)return;if(url){node.href=url;node.hidden=false}else{node.removeAttribute('href');node.hidden=true}}; + const renderDetail=item=>{ + detailFields.image.src=item.image_url||'/assets/event-market-v14.jpg';detailFields.image.alt=item.title||''; + detailFields.category.textContent=escapeText(item.category||'Veranstaltung');detailFields.title.textContent=escapeText(item.title||'Veranstaltung');detailFields.date.textContent=escapeText(item.date_label||''); + const place=[item.venue,[item.postal_code,item.city].filter(Boolean).join(' ')].filter(Boolean).join(', ');detailFields.place.textContent=escapeText(place||'Niedersachsen'); + detailFields.organizer.textContent=escapeText(item.organizer||'');detailFields.organizerRow.hidden=!item.organizer; + detailFields.description.textContent=escapeText(item.description||'Weitere Informationen sind derzeit nicht hinterlegt.'); + detailFields.source.textContent=item.source_name?`Quelle: ${item.source_name}`:''; + setLink(detailFields.calendar,item.google_calendar_url);setLink(detailFields.website,item.website);setLink(detailFields.sourceLink,item.source_url); + detailFields.error.hidden=true; + }; + const openDetail=async id=>{ + if(!detail||!id)return;detail.hidden=false;body.classList.add('has-event-detail-modal');detailFields.title.textContent='Veranstaltung wird geladen …';detailFields.description.textContent='';detailFields.error.hidden=true; + try{const response=await fetch(`/api/events/${encodeURIComponent(id)}`,{headers:{Accept:'application/json'}});const payload=await response.json();if(!response.ok)throw new Error(payload?.error?.message||'Die Veranstaltung konnte nicht geladen werden.');renderDetail(payload.data||{});}catch(error){detailFields.error.textContent=error.message;detailFields.error.hidden=false;detailFields.title.textContent='Veranstaltung nicht verfügbar';} + }; + document.querySelectorAll('[data-event-detail-close]').forEach(button=>button.addEventListener('click',closeDetail)); + document.addEventListener('click',event=>{const trigger=event.target.closest('[data-event-detail-id]');if(!trigger||trigger.closest('[data-event-detail-modal]'))return;if(event.target.closest('a,button')&&!event.target.closest('.event-detail-action'))return;event.preventDefault();openDetail(trigger.dataset.eventDetailId);}); + + const createCard=item=>{ + const article=document.createElement('article');article.className='event-calendar-card';article.dataset.eventDetailId=item.id;article.id=`event-${item.id}`; + const image=document.createElement('div');image.className='event-image';const img=document.createElement('img');img.src=item.image_url||'/assets/event-market-v14.jpg';img.alt=item.title||'';img.loading='lazy';image.appendChild(img);const date=document.createElement('div');date.className='event-date';date.innerHTML=`${escapeText(item.day||'')}${escapeText(item.month||'')}`;image.appendChild(date); + const copy=document.createElement('div');copy.className='event-copy';const category=document.createElement('span');category.textContent=item.category||'';const title=document.createElement('h3');title.textContent=item.title||'';const description=document.createElement('p');description.textContent=item.description||'';const dl=document.createElement('dl');dl.innerHTML=`
Wann
Wo
`;dl.querySelectorAll('dd')[0].textContent=item.date_label||'';dl.querySelectorAll('dd')[1].textContent=[item.venue,[item.postal_code,item.city].filter(Boolean).join(' ')].filter(Boolean).join(', ');const source=document.createElement('div');source.className='event-source';source.textContent=item.source_name==='Landwelle Einsendung'?'Von Landwelle geprüft':item.source_name?`Quelle: ${item.source_name}`:''; + const actions=document.createElement('div');actions.className='event-card-actions';const detailButton=document.createElement('button');detailButton.type='button';detailButton.className='event-detail-action';detailButton.dataset.eventDetailId=item.id;detailButton.textContent='Details ansehen';actions.appendChild(detailButton);if(item.google_calendar_url){const cal=document.createElement('a');cal.className='event-google-action';cal.href=item.google_calendar_url;cal.target='_blank';cal.rel='noopener noreferrer';cal.textContent='In Google Kalender +';actions.appendChild(cal)}if(item.website){const web=document.createElement('a');web.href=item.website;web.target='_blank';web.rel='noopener noreferrer';web.textContent='Mehr erfahren →';actions.appendChild(web)} + copy.append(category,title,description,dl,source,actions);article.append(image,copy);return article; + }; + const initialGridHTML=grid?.innerHTML||''; + let searchTimer=0,searchController=null; + const runSearch=async()=>{ + if(!search||!grid)return;const query=search.value.trim();const category=search.dataset.eventCategory||''; + if(query.length<2){searchController?.abort();grid.innerHTML=initialGridHTML;searchStatus.textContent='Tippe mindestens zwei Zeichen ein.';pagination&&(pagination.hidden=false);return;} + searchController?.abort();searchController=new AbortController();grid.classList.add('is-loading');searchStatus.textContent='Suche läuft …';pagination&&(pagination.hidden=true); + try{const params=new URLSearchParams({q:query});if(category)params.set('category',category);const response=await fetch(`/api/events/search?${params}`,{headers:{Accept:'application/json'},signal:searchController.signal});const payload=await response.json();if(!response.ok)throw new Error(payload?.error?.message||'Suche fehlgeschlagen.');const items=Array.isArray(payload.data)?payload.data:[];grid.replaceChildren();if(!items.length){const empty=document.createElement('div');empty.className='events-search-empty';empty.innerHTML='Keine passende Veranstaltung gefundenVersuche einen anderen Suchbegriff oder eine andere Kategorie.';grid.appendChild(empty)}else{items.forEach(item=>grid.appendChild(createCard(item)))}searchStatus.textContent=`${items.length} Treffer für „${query}“`;} + catch(error){if(error.name!=='AbortError')searchStatus.textContent=error.message;} + finally{grid.classList.remove('is-loading')} + }; + search?.addEventListener('input',()=>{clearTimeout(searchTimer);const value=search.value.trim();if(value.length<2){searchController?.abort();if(grid)grid.innerHTML=initialGridHTML;if(searchStatus)searchStatus.textContent='Tippe mindestens zwei Zeichen ein.';if(pagination)pagination.hidden=false;return}searchTimer=setTimeout(runSearch,280)}); + document.addEventListener('keydown',event=>{if(event.key!=='Escape')return;if(detail&&!detail.hidden)closeDetail();else if(submission&&!submission.hidden)closeSubmission()}); +})(); diff --git a/web/assets/forum-hero-landwelle.png b/web/assets/forum-hero-landwelle.png new file mode 100644 index 0000000..1ec53ff Binary files /dev/null and b/web/assets/forum-hero-landwelle.png differ diff --git a/web/assets/forum-v1.css b/web/assets/forum-v1.css new file mode 100644 index 0000000..8eb7cbf --- /dev/null +++ b/web/assets/forum-v1.css @@ -0,0 +1,2 @@ +.forum-page{background:#f3f5f1;min-height:70vh}.forum-hero{background:linear-gradient(130deg,#0a0d0b,#172016);padding:70px 0;color:#fff}.forum-shell{padding-top:38px;padding-bottom:70px}.forum-toolbar{display:flex;justify-content:space-between;align-items:center;gap:20px;background:#fff;border:1px solid #dfe5dc;border-radius:18px;padding:22px 26px;margin-bottom:24px;box-shadow:0 8px 24px rgba(20,30,20,.07)}.forum-toolbar div{display:flex;flex-direction:column}.forum-toolbar span{color:#687068}.forum-primary{border:0;border-radius:999px;background:#74b82a;color:#fff;padding:13px 21px;font-weight:850;text-decoration:none;cursor:pointer}.forum-category-list,.forum-topic-list{display:grid;gap:13px}.forum-category,.forum-topic-row{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:18px;background:#fff;border:1px solid #dfe5dc;border-radius:16px;padding:21px 24px;color:#172016;text-decoration:none;box-shadow:0 4px 16px rgba(20,30,20,.05);transition:.2s}.forum-category:hover,.forum-topic-row:hover{transform:translateY(-2px);border-color:#9ccb5e}.forum-icon{width:54px;height:54px;border-radius:15px;display:grid;place-items:center;background:#eef6e5;font-size:27px}.forum-category h2,.forum-topic-row h3{margin:0 0 6px}.forum-category p{margin:0 0 7px;color:#596159}.forum-category small,.forum-topic-row small{color:#7b837b}.forum-latest{margin-top:36px}.forum-topic-row{grid-template-columns:1fr auto}.forum-topic-row span{color:#6d9f25;font-size:12px;text-transform:uppercase;font-weight:850}.forum-topic-row em{background:#eef6e5;color:#61941f;border-radius:999px;padding:7px 11px;font-style:normal;font-size:12px}.forum-empty,.forum-alert{background:#fff;border:1px dashed #cbd3c8;border-radius:15px;padding:25px;color:#616961}.forum-alert{border-style:solid;border-color:#e0b45a;background:#fff8e8}.forum-breadcrumb{display:flex;gap:9px;margin-bottom:20px}.forum-breadcrumb a{color:#659c21}.forum-topic-shell{max-width:980px}.forum-post,.forum-reply,.forum-form-card,.forum-login-callout{background:#fff;border:1px solid #dfe5dc;border-radius:18px;padding:26px;margin-bottom:18px;box-shadow:0 5px 18px rgba(20,30,20,.05)}.forum-post header{display:flex;justify-content:space-between;gap:20px;border-bottom:1px solid #edf0eb;padding-bottom:14px;margin-bottom:20px}.forum-post h1{font-size:34px;margin:5px 0}.forum-post header span{color:#6d9f25;font-weight:800;text-transform:uppercase;font-size:12px}.forum-post-body{white-space:pre-wrap;line-height:1.75}.forum-reply textarea,.forum-form-card textarea,.forum-form-card input,.forum-form-card select{width:100%;border:1px solid #cad2c7;border-radius:10px;padding:12px;font:inherit}.forum-form-card form,.forum-reply{display:grid;gap:16px}.forum-form-card label{display:grid;gap:7px}.account-button{border:1px solid rgba(255,255,255,.28);background:transparent;color:#fff;border-radius:999px;padding:11px 16px;font-weight:800;cursor:pointer;white-space:nowrap}.auth-modal[hidden]{display:none}.auth-modal{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px}.auth-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.72);backdrop-filter:blur(7px)}.auth-dialog{position:relative;width:min(100%,480px);background:#101511;color:#fff;border:1px solid rgba(151,216,75,.28);border-radius:24px;padding:28px;box-shadow:0 30px 90px rgba(0,0,0,.45)}.auth-dialog>img{width:180px}.auth-dialog h2{font-size:30px;margin:18px 0 6px}.auth-dialog>p{color:#b7c0b9}.auth-close{position:absolute;right:18px;top:15px;border:0;background:transparent;color:#fff;font-size:30px;cursor:pointer}.auth-tabs{display:grid;grid-template-columns:1fr 1fr;background:#080b09;padding:5px;border-radius:12px;margin:22px 0}.auth-tabs button{border:0;background:transparent;color:#aab3ac;padding:10px;border-radius:9px;font-weight:800}.auth-tabs button.is-active{background:#74b82a;color:#fff}.auth-form{display:none;gap:14px}.auth-form.is-active{display:grid}.auth-form label{display:grid;gap:6px}.auth-form input{width:100%;border:1px solid #3c463e;background:#090c0a;color:#fff;border-radius:10px;padding:12px}.auth-form button{border:0;border-radius:10px;background:#74b82a;color:#fff;padding:13px;font-weight:850}.auth-consent{grid-template-columns:auto 1fr!important;align-items:start}.auth-consent input{width:auto}.auth-consent a{color:#9bd34e}@media(max-width:900px){.account-button{font-size:0;width:43px;height:40px;padding:0}.account-button:after{content:'👤';font-size:17px}.forum-toolbar{align-items:flex-start;flex-direction:column}.forum-category{grid-template-columns:auto 1fr}.forum-category>b{display:none}} +.forum-actions{display:flex;align-items:center;gap:9px}.forum-actions form{margin:0}.forum-secondary{border:1px solid #ccd4c9;background:#fff;color:#364036;border-radius:999px;padding:12px 17px;font-weight:800;cursor:pointer} diff --git a/web/assets/forum-v2.css b/web/assets/forum-v2.css new file mode 100644 index 0000000..16db042 --- /dev/null +++ b/web/assets/forum-v2.css @@ -0,0 +1,8 @@ +.forum-page{background:#f3f5f1;min-height:70vh}.forum-hero{background:linear-gradient(130deg,#0a0d0b,#172016);padding:54px 0;color:#fff}.forum-hero h1{font-size:clamp(38px,5vw,62px);margin:.18em 0}.forum-hero p{max-width:720px;margin:0;color:#d5ddd7}.forum-hero-small{padding:38px 0}.forum-hero-small h1{font-size:clamp(30px,4vw,48px)} +.forum-layout{display:grid;grid-template-columns:minmax(0,1fr) 310px;gap:24px;padding-top:30px;padding-bottom:64px}.forum-main-column{min-width:0}.forum-toolbar{display:flex;justify-content:space-between;align-items:center;gap:18px;background:#fff;border:1px solid #dfe5dc;border-radius:12px;padding:16px 18px;margin-bottom:18px;box-shadow:0 4px 14px rgba(20,30,20,.05)}.forum-toolbar>div:first-child{display:grid;gap:3px}.forum-toolbar span{color:#687068;font-size:13px}.forum-actions{display:flex;align-items:center;gap:8px}.forum-actions form{margin:0}.forum-primary,.forum-secondary{display:inline-flex;align-items:center;justify-content:center;border-radius:7px;padding:10px 14px;font-weight:800;text-decoration:none;cursor:pointer;font:inherit}.forum-primary{border:0;background:#74b82a;color:#fff}.forum-primary:hover{background:#669f27}.forum-secondary{border:1px solid #ccd4c9;background:#fff;color:#364036}.forum-alert,.forum-empty{background:#fff;border:1px solid #e0b45a;border-radius:9px;padding:15px 17px;color:#616961;margin-bottom:16px}.forum-empty{border-style:dashed;border-color:#cbd3c8;margin:0} +.forum-board{background:#fff;border:1px solid #d9dfd6;border-radius:10px;overflow:hidden;box-shadow:0 4px 16px rgba(20,30,20,.05)}.forum-latest{margin-top:22px}.forum-board-title,.forum-topic-title-row{display:grid;grid-template-columns:minmax(0,1fr) 82px 82px 190px;align-items:center;background:#111611;color:#fff;min-height:46px}.forum-board-title h2,.forum-topic-title-row h2{font-size:16px;margin:0;padding:0 16px}.forum-board-title>span,.forum-topic-title-row>span{text-align:center;font-size:11px;font-weight:850;text-transform:uppercase;letter-spacing:.06em;color:#b9c4bc}.forum-board-body{display:grid}.forum-category-row{display:grid;grid-template-columns:46px minmax(0,1fr) 82px 82px 190px;align-items:center;gap:10px;color:#202720;text-decoration:none;border-top:1px solid #e5e9e2;min-height:82px;padding:10px 0}.forum-category-row:first-child{border-top:0}.forum-category-row:hover,.forum-topic-table-row:hover{background:#f7faf4}.forum-status-icon{width:34px;height:34px;border-radius:8px;display:grid;place-items:center;background:#eef6e5;color:#6b9e2a;font-size:18px;margin-left:12px}.forum-category-copy{padding:0 4px}.forum-category-copy strong,.forum-topic-copy strong{display:block;font-size:15px;color:#1e281d}.forum-category-copy p{margin:3px 0;color:#616961;font-size:13px;line-height:1.35}.forum-category-copy small{color:#78904e;font-size:11px}.forum-number{text-align:center;font-variant-numeric:tabular-nums;font-weight:800;color:#4c554d;font-size:13px}.forum-last-post{padding:0 14px;min-width:0}.forum-last-post strong,.forum-last-post small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.forum-last-post strong{font-size:12px;color:#333d34}.forum-last-post small{font-size:11px;color:#7a837b;margin-top:3px}.forum-topic-table-row{display:grid;grid-template-columns:minmax(0,1fr) 82px 82px 190px;align-items:center;color:#202720;text-decoration:none;border-top:1px solid #e5e9e2;min-height:72px}.forum-topic-table-row:first-child{border-top:0}.forum-topic-copy{padding:10px 16px}.forum-topic-copy>span{display:block;color:#6b9f28;font-size:10px;text-transform:uppercase;font-weight:850;letter-spacing:.05em;margin-bottom:2px}.forum-topic-copy small{display:block;color:#7b837b;font-size:11px;margin-top:3px} +.forum-side-card{align-self:start;position:sticky;top:92px;background:linear-gradient(145deg,#121812,#202b1e);color:#fff;border-radius:12px;padding:23px;box-shadow:0 10px 28px rgba(13,20,13,.18)}.forum-side-card>img{width:150px;max-width:80%;height:auto}.forum-side-card>span{display:block;color:#9fd750;font-size:11px;text-transform:uppercase;font-weight:900;letter-spacing:.1em;margin-top:18px}.forum-side-card h2{font-size:22px;line-height:1.18;margin:7px 0 11px}.forum-side-card p{font-size:14px;color:#c5cec7;line-height:1.55}.forum-side-card>a,.forum-side-card>button{display:inline-flex;border:0;background:transparent;color:#9fd750;font-weight:850;padding:5px 0;text-decoration:none;cursor:pointer}.forum-side-rules{border-top:1px solid rgba(255,255,255,.1);margin-top:20px;padding-top:16px}.forum-side-rules strong,.forum-side-rules small{display:block}.forum-side-rules small{color:#aeb8b0;line-height:1.45;margin-top:5px} +.forum-topic-shell{max-width:1120px;padding-top:24px;padding-bottom:64px}.forum-breadcrumb{display:flex;align-items:center;gap:7px;margin-bottom:14px;font-size:13px;overflow:hidden;white-space:nowrap}.forum-breadcrumb a{color:#659c21;text-decoration:none}.forum-breadcrumb strong{overflow:hidden;text-overflow:ellipsis}.forum-post{display:grid;grid-template-columns:160px minmax(0,1fr);background:#fff;border:1px solid #dce2d9;border-radius:10px;margin-bottom:12px;overflow:hidden;box-shadow:0 3px 12px rgba(20,30,20,.04)}.forum-author-panel{background:#f5f7f3;border-right:1px solid #e2e6df;padding:18px 14px;text-align:center}.forum-avatar{width:54px;height:54px;margin:0 auto 9px;border-radius:50%;display:grid;place-items:center;background:#1a2119;color:#9fd750;font-size:22px;font-weight:900}.forum-author-panel strong,.forum-author-panel span{display:block}.forum-author-panel strong{font-size:14px}.forum-author-panel span{font-size:11px;color:#7a837b;margin-top:4px}.forum-post-content{padding:0 18px 20px}.forum-post-content header{display:flex;justify-content:space-between;gap:20px;border-bottom:1px solid #e8ebe6;padding:11px 0;color:#7a837b;font-size:11px}.forum-post-content header span{color:#6a9e27;font-weight:800;text-transform:uppercase}.forum-post-content h2{font-size:20px;margin:16px 0 10px}.forum-post-body{white-space:pre-wrap;line-height:1.65;font-size:14px;color:#343c35}.forum-reply,.forum-form-card,.forum-login-callout{background:#fff;border:1px solid #dce2d9;border-radius:10px;padding:20px;margin-top:18px;box-shadow:0 3px 12px rgba(20,30,20,.04)}.forum-reply{display:grid;gap:13px}.forum-form-title>span{color:#6b9f28;font-size:11px;text-transform:uppercase;font-weight:850;letter-spacing:.08em}.forum-form-title h2{margin:4px 0 4px;font-size:22px}.forum-form-title p{margin:0;color:#6b746c;font-size:14px}.forum-reply textarea,.forum-form-card textarea,.forum-form-card input,.forum-form-card select{width:100%;border:1px solid #cbd3c8;border-radius:7px;padding:11px 12px;font:inherit;background:#fff}.forum-form-card form{display:grid;gap:15px;margin-top:18px}.forum-form-card label{display:grid;gap:6px}.forum-form-card label>span{font-size:13px;font-weight:800}.forum-form-actions{display:flex;justify-content:flex-end;gap:9px}.forum-login-callout{display:flex;justify-content:space-between;align-items:center;gap:18px}.forum-login-callout p{margin:4px 0 0;color:#687068;font-size:13px}.forum-new-layout{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:24px;padding-top:30px;padding-bottom:64px}.forum-new-side{position:static} +.account-button{border:1px solid rgba(255,255,255,.28);background:transparent;color:#fff;border-radius:999px;padding:11px 16px;font-weight:800;cursor:pointer;white-space:nowrap}.auth-modal[hidden]{display:none}.auth-modal{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px}.auth-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.72);backdrop-filter:blur(7px)}.auth-dialog{position:relative;width:min(100%,480px);background:#101511;color:#fff;border:1px solid rgba(151,216,75,.28);border-radius:24px;padding:28px;box-shadow:0 30px 90px rgba(0,0,0,.45)}.auth-dialog>img{width:180px}.auth-dialog h2{font-size:30px;margin:18px 0 6px}.auth-dialog>p{color:#b7c0b9}.auth-close{position:absolute;right:18px;top:15px;border:0;background:transparent;color:#fff;font-size:30px;cursor:pointer}.auth-tabs{display:grid;grid-template-columns:1fr 1fr;background:#080b09;padding:5px;border-radius:12px;margin:22px 0}.auth-tabs button{border:0;background:transparent;color:#aab3ac;padding:10px;border-radius:9px;font-weight:800}.auth-tabs button.is-active{background:#74b82a;color:#fff}.auth-form{display:none;gap:14px}.auth-form.is-active{display:grid}.auth-form label{display:grid;gap:6px}.auth-form input{width:100%;border:1px solid #3c463e;background:#090c0a;color:#fff;border-radius:10px;padding:12px}.auth-form button{border:0;border-radius:10px;background:#74b82a;color:#fff;padding:13px;font-weight:850}.auth-consent{grid-template-columns:auto 1fr!important;align-items:start}.auth-consent input{width:auto}.auth-consent a{color:#9bd34e} +@media(max-width:1000px){.forum-layout,.forum-new-layout{grid-template-columns:1fr}.forum-side-card{position:static}.forum-board-title,.forum-topic-title-row{grid-template-columns:minmax(0,1fr) 70px 70px}.forum-board-title>span:last-child,.forum-topic-title-row>span:last-child{display:none}.forum-category-row{grid-template-columns:42px minmax(0,1fr) 70px 70px}.forum-topic-table-row{grid-template-columns:minmax(0,1fr) 70px 70px}.forum-last-post{display:none}} +@media(max-width:700px){.forum-hero{padding:42px 0}.forum-layout,.forum-new-layout{padding-top:20px}.forum-toolbar{align-items:flex-start;flex-direction:column}.forum-actions{width:100%;flex-wrap:wrap}.forum-board-title,.forum-topic-title-row{grid-template-columns:minmax(0,1fr) 58px}.forum-board-title>span:nth-of-type(2),.forum-topic-title-row>span:nth-of-type(2){display:none}.forum-category-row{grid-template-columns:38px minmax(0,1fr) 58px}.forum-category-row>.forum-number:nth-of-type(2){display:none}.forum-topic-table-row{grid-template-columns:minmax(0,1fr) 58px}.forum-topic-table-row>.forum-number:nth-of-type(2){display:none}.forum-status-icon{margin-left:8px;width:30px;height:30px}.forum-category-copy p{font-size:12px}.forum-post{grid-template-columns:1fr}.forum-author-panel{display:flex;align-items:center;gap:10px;text-align:left;border-right:0;border-bottom:1px solid #e2e6df;padding:10px 14px}.forum-avatar{width:38px;height:38px;margin:0;font-size:17px}.forum-author-panel span{margin:0}.forum-login-callout{align-items:flex-start;flex-direction:column}.forum-form-actions{justify-content:stretch;flex-direction:column-reverse}.forum-form-actions>*{width:100%}.account-button{font-size:0;width:43px;height:40px;padding:0}.account-button:after{content:'👤';font-size:17px}} diff --git a/web/assets/forum-v5.css b/web/assets/forum-v5.css new file mode 100644 index 0000000..f622ef9 --- /dev/null +++ b/web/assets/forum-v5.css @@ -0,0 +1,19 @@ +.forum-page{background:#f3f5f1;min-height:70vh}.forum-hero{position:relative;isolation:isolate;min-height:300px;display:flex;align-items:center;padding:54px 0;color:#fff;background-image:linear-gradient(90deg,rgba(7,10,8,.96) 0%,rgba(7,10,8,.88) 34%,rgba(7,10,8,.48) 62%,rgba(7,10,8,.12) 100%),url("/assets/forum-hero-landwelle.png");background-size:cover;background-position:center right;border-bottom:1px solid rgba(116,184,42,.28);box-shadow:inset 0 -38px 70px rgba(0,0,0,.2)}.forum-hero:after{content:"";position:absolute;z-index:-1;inset:auto 0 0;height:4px;background:linear-gradient(90deg,#74b82a,rgba(116,184,42,.35),transparent 72%)}.forum-hero .page-shell{width:min(var(--page),calc(100% - 40px));margin-inline:auto;position:relative;z-index:2}.forum-hero .page-shell>span{display:inline-flex;border:1px solid rgba(152,216,75,.35);background:rgba(8,12,9,.56);backdrop-filter:blur(5px);border-radius:999px;padding:7px 12px;color:#a9df62;font-size:11px;font-weight:900;letter-spacing:.1em;text-transform:uppercase}.forum-hero h1{font-size:clamp(38px,5vw,62px);margin:.18em 0;text-shadow:0 3px 24px rgba(0,0,0,.44)}.forum-hero p{max-width:660px;margin:0;color:#e1e8e2;font-size:clamp(15px,1.25vw,19px);line-height:1.55;text-shadow:0 2px 18px rgba(0,0,0,.5)}.forum-hero-small{min-height:220px;padding:38px 0;background-position:center right}.forum-hero-small h1{font-size:clamp(30px,4vw,48px)} +.forum-layout{display:grid;grid-template-columns:minmax(0,1fr) 310px;gap:24px;padding-top:30px;padding-bottom:64px}.forum-main-column{min-width:0}.forum-toolbar{display:flex;justify-content:space-between;align-items:center;gap:18px;background:#fff;border:1px solid #dfe5dc;border-radius:12px;padding:16px 18px;margin-bottom:18px;box-shadow:0 4px 14px rgba(20,30,20,.05)}.forum-toolbar>div:first-child{display:grid;gap:3px}.forum-toolbar span{color:#687068;font-size:13px}.forum-actions{display:flex;align-items:center;gap:8px}.forum-actions form{margin:0}.forum-primary,.forum-secondary{display:inline-flex;align-items:center;justify-content:center;border-radius:7px;padding:10px 14px;font-weight:800;text-decoration:none;cursor:pointer;font:inherit}.forum-primary{border:0;background:#74b82a;color:#fff}.forum-primary:hover{background:#669f27}.forum-secondary{border:1px solid #ccd4c9;background:#fff;color:#364036}.forum-alert,.forum-empty{background:#fff;border:1px solid #e0b45a;border-radius:9px;padding:15px 17px;color:#616961;margin-bottom:16px}.forum-empty{border-style:dashed;border-color:#cbd3c8;margin:0} +.forum-board{background:#fff;border:1px solid #d9dfd6;border-radius:10px;overflow:hidden;box-shadow:0 4px 16px rgba(20,30,20,.05)}.forum-latest{margin-top:22px}.forum-board-title,.forum-topic-title-row{display:grid;grid-template-columns:minmax(0,1fr) 82px 82px 190px;align-items:center;background:#111611;color:#fff;min-height:46px}.forum-board-title h2,.forum-topic-title-row h2{font-size:16px;margin:0;padding:0 16px}.forum-board-title>span,.forum-topic-title-row>span{text-align:center;font-size:11px;font-weight:850;text-transform:uppercase;letter-spacing:.06em;color:#b9c4bc}.forum-board-body{display:grid}.forum-category-row{display:grid;grid-template-columns:46px minmax(0,1fr) 82px 82px 190px;align-items:center;gap:10px;color:#202720;text-decoration:none;border-top:1px solid #e5e9e2;min-height:82px;padding:10px 0}.forum-category-row:first-child{border-top:0}.forum-category-row:hover,.forum-topic-table-row:hover{background:#f7faf4}.forum-status-icon{width:34px;height:34px;border-radius:8px;display:grid;place-items:center;background:#eef6e5;color:#6b9e2a;font-size:18px;margin-left:12px}.forum-category-copy{padding:0 4px}.forum-category-copy strong,.forum-topic-copy strong{display:block;font-size:15px;color:#1e281d}.forum-category-copy p{margin:3px 0;color:#616961;font-size:13px;line-height:1.35}.forum-category-copy small{color:#78904e;font-size:11px}.forum-number{text-align:center;font-variant-numeric:tabular-nums;font-weight:800;color:#4c554d;font-size:13px}.forum-last-post{padding:0 14px;min-width:0}.forum-last-post strong,.forum-last-post small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.forum-last-post strong{font-size:12px;color:#333d34}.forum-last-post small{font-size:11px;color:#7a837b;margin-top:3px}.forum-topic-table-row{display:grid;grid-template-columns:minmax(0,1fr) 82px 82px 190px;align-items:center;color:#202720;text-decoration:none;border-top:1px solid #e5e9e2;min-height:72px}.forum-topic-table-row:first-child{border-top:0}.forum-topic-copy{padding:10px 16px}.forum-topic-copy>span{display:block;color:#6b9f28;font-size:10px;text-transform:uppercase;font-weight:850;letter-spacing:.05em;margin-bottom:2px}.forum-topic-copy small{display:block;color:#7b837b;font-size:11px;margin-top:3px} +.forum-side-card{align-self:start;position:sticky;top:92px;background:linear-gradient(145deg,#121812,#202b1e);color:#fff;border-radius:12px;padding:23px;box-shadow:0 10px 28px rgba(13,20,13,.18)}.forum-side-card>img{width:150px;max-width:80%;height:auto}.forum-side-card>span{display:block;color:#9fd750;font-size:11px;text-transform:uppercase;font-weight:900;letter-spacing:.1em;margin-top:18px}.forum-side-card h2{font-size:22px;line-height:1.18;margin:7px 0 11px}.forum-side-card p{font-size:14px;color:#c5cec7;line-height:1.55}.forum-side-card>a,.forum-side-card>button{display:inline-flex;border:0;background:transparent;color:#9fd750;font-weight:850;padding:5px 0;text-decoration:none;cursor:pointer}.forum-side-rules{border-top:1px solid rgba(255,255,255,.1);margin-top:20px;padding-top:16px}.forum-side-rules strong,.forum-side-rules small{display:block}.forum-side-rules small{color:#aeb8b0;line-height:1.45;margin-top:5px} +.forum-topic-shell{max-width:1120px;padding-top:24px;padding-bottom:64px}.forum-breadcrumb{display:flex;align-items:center;gap:7px;margin-bottom:14px;font-size:13px;overflow:hidden;white-space:nowrap}.forum-breadcrumb a{color:#659c21;text-decoration:none}.forum-breadcrumb strong{overflow:hidden;text-overflow:ellipsis}.forum-post{display:grid;grid-template-columns:160px minmax(0,1fr);background:#fff;border:1px solid #dce2d9;border-radius:10px;margin-bottom:12px;overflow:hidden;box-shadow:0 3px 12px rgba(20,30,20,.04)}.forum-author-panel{background:#f5f7f3;border-right:1px solid #e2e6df;padding:18px 14px;text-align:center}.forum-avatar{width:54px;height:54px;margin:0 auto 9px;border-radius:50%;display:grid;place-items:center;background:#1a2119;color:#9fd750;font-size:22px;font-weight:900}.forum-author-panel strong,.forum-author-panel span{display:block}.forum-author-panel strong{font-size:14px}.forum-author-panel span{font-size:11px;color:#7a837b;margin-top:4px}.forum-post-content{padding:0 18px 20px}.forum-post-content header{display:flex;justify-content:space-between;gap:20px;border-bottom:1px solid #e8ebe6;padding:11px 0;color:#7a837b;font-size:11px}.forum-post-content header span{color:#6a9e27;font-weight:800;text-transform:uppercase}.forum-post-content h2{font-size:20px;margin:16px 0 10px}.forum-post-body{white-space:pre-wrap;line-height:1.65;font-size:14px;color:#343c35}.forum-reply,.forum-form-card,.forum-login-callout{background:#fff;border:1px solid #dce2d9;border-radius:10px;padding:20px;margin-top:18px;box-shadow:0 3px 12px rgba(20,30,20,.04)}.forum-reply{display:grid;gap:13px}.forum-form-title>span{color:#6b9f28;font-size:11px;text-transform:uppercase;font-weight:850;letter-spacing:.08em}.forum-form-title h2{margin:4px 0 4px;font-size:22px}.forum-form-title p{margin:0;color:#6b746c;font-size:14px}.forum-reply textarea,.forum-form-card textarea,.forum-form-card input,.forum-form-card select{width:100%;border:1px solid #cbd3c8;border-radius:7px;padding:11px 12px;font:inherit;background:#fff}.forum-form-card form{display:grid;gap:15px;margin-top:18px}.forum-form-card label{display:grid;gap:6px}.forum-form-card label>span{font-size:13px;font-weight:800}.forum-form-actions{display:flex;justify-content:flex-end;gap:9px}.forum-login-callout{display:flex;justify-content:space-between;align-items:center;gap:18px}.forum-login-callout p{margin:4px 0 0;color:#687068;font-size:13px}.forum-new-layout{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:24px;padding-top:30px;padding-bottom:64px}.forum-new-side{position:static} +.account-button{border:1px solid rgba(255,255,255,.28);background:transparent;color:#fff;border-radius:999px;padding:11px 16px;font-weight:800;cursor:pointer;white-space:nowrap}.auth-modal[hidden]{display:none}.auth-modal{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px}.auth-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.72);backdrop-filter:blur(7px)}.auth-dialog{position:relative;width:min(100%,480px);background:#101511;color:#fff;border:1px solid rgba(151,216,75,.28);border-radius:24px;padding:28px;box-shadow:0 30px 90px rgba(0,0,0,.45)}.auth-dialog>img{width:180px}.auth-dialog h2{font-size:30px;margin:18px 0 6px}.auth-dialog>p{color:#b7c0b9}.auth-close{position:absolute;right:18px;top:15px;border:0;background:transparent;color:#fff;font-size:30px;cursor:pointer}.auth-tabs{display:grid;grid-template-columns:1fr 1fr;background:#080b09;padding:5px;border-radius:12px;margin:22px 0}.auth-tabs button{border:0;background:transparent;color:#aab3ac;padding:10px;border-radius:9px;font-weight:800}.auth-tabs button.is-active{background:#74b82a;color:#fff}.auth-form{display:none;gap:14px}.auth-form.is-active{display:grid}.auth-form label{display:grid;gap:6px}.auth-form input{width:100%;border:1px solid #3c463e;background:#090c0a;color:#fff;border-radius:10px;padding:12px}.auth-form button{border:0;border-radius:10px;background:#74b82a;color:#fff;padding:13px;font-weight:850}.auth-consent{grid-template-columns:auto 1fr!important;align-items:start}.auth-consent input{width:auto}.auth-consent a{color:#9bd34e} +@media(max-width:1000px){.forum-layout,.forum-new-layout{grid-template-columns:1fr}.forum-side-card{position:static}.forum-board-title,.forum-topic-title-row{grid-template-columns:minmax(0,1fr) 70px 70px}.forum-board-title>span:last-child,.forum-topic-title-row>span:last-child{display:none}.forum-category-row{grid-template-columns:42px minmax(0,1fr) 70px 70px}.forum-topic-table-row{grid-template-columns:minmax(0,1fr) 70px 70px}.forum-last-post{display:none}} +@media(max-width:700px){.forum-hero{min-height:250px;padding:42px 0;background-position:64% center}.forum-hero p{max-width:86%}.forum-layout,.forum-new-layout{padding-top:20px}.forum-toolbar{align-items:flex-start;flex-direction:column}.forum-actions{width:100%;flex-wrap:wrap}.forum-board-title,.forum-topic-title-row{grid-template-columns:minmax(0,1fr) 58px}.forum-board-title>span:nth-of-type(2),.forum-topic-title-row>span:nth-of-type(2){display:none}.forum-category-row{grid-template-columns:38px minmax(0,1fr) 58px}.forum-category-row>.forum-number:nth-of-type(2){display:none}.forum-topic-table-row{grid-template-columns:minmax(0,1fr) 58px}.forum-topic-table-row>.forum-number:nth-of-type(2){display:none}.forum-status-icon{margin-left:8px;width:30px;height:30px}.forum-category-copy p{font-size:12px}.forum-post{grid-template-columns:1fr}.forum-author-panel{display:flex;align-items:center;gap:10px;text-align:left;border-right:0;border-bottom:1px solid #e2e6df;padding:10px 14px}.forum-avatar{width:38px;height:38px;margin:0;font-size:17px}.forum-author-panel span{margin:0}.forum-login-callout{align-items:flex-start;flex-direction:column}.forum-form-actions{justify-content:stretch;flex-direction:column-reverse}.forum-form-actions>*{width:100%}.account-button{font-size:0;width:43px;height:40px;padding:0}.account-button:after{content:'👤';font-size:17px}} +.forum-alert-success{border-color:#8fc64a;background:#f2fae9;color:#365d16} +.account-dropdown{position:relative;flex:0 0 auto}.account-button-user{display:inline-flex;align-items:center;gap:9px;padding:7px 13px 7px 8px}.account-avatar{width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:#79b92d;color:#fff;font-size:13px;font-weight:900}.account-name{max-width:130px;overflow:hidden;text-overflow:ellipsis}.account-caret{font-size:13px;color:#a8d866}.account-menu{position:absolute;z-index:200;right:0;top:calc(100% + 10px);width:230px;padding:8px;background:#101511;border:1px solid rgba(151,216,75,.28);border-radius:14px;box-shadow:0 20px 55px rgba(0,0,0,.38);color:#fff}.account-menu[hidden]{display:none}.account-menu-head{display:grid;gap:2px;padding:10px 11px 12px;border-bottom:1px solid rgba(255,255,255,.09);margin-bottom:5px}.account-menu-head strong{font-size:14px}.account-menu-head span{font-size:12px;color:#9da79f}.account-menu a,.account-menu form button{display:block;width:100%;padding:10px 11px;border:0;border-radius:9px;background:transparent;color:#eef4ea;text-align:left;font:inherit;font-size:13px;font-weight:700;text-decoration:none;cursor:pointer}.account-menu a:hover,.account-menu form button:hover{background:rgba(121,185,45,.15);color:#a8dc57}.account-menu form{margin:4px 0 0;padding-top:4px;border-top:1px solid rgba(255,255,255,.08)} +@media(max-width:700px){.account-button-user{width:auto;min-width:43px;padding:5px}.account-button-user:after{content:none}.account-name,.account-caret{display:none}.account-menu{position:fixed;right:16px;top:76px}} + +/* Landwelle Forum v5 – MyBB-inspirierte Hierarchie, Lesestatus und Profilinformationen */ +.forum-hero-category{background-position:center 56%}.forum-row-heading{display:flex;align-items:center;gap:8px;min-width:0}.forum-row-heading>strong,.forum-row-heading>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.forum-row-heading mark{flex:0 0 auto;border-radius:999px;background:#78b82b;color:#fff;padding:3px 8px;font-size:9px;font-weight:900;letter-spacing:.06em;text-transform:uppercase}.forum-category-row.has-new-content,.forum-topic-table-row.has-new-content{background:linear-gradient(90deg,rgba(121,185,45,.12),rgba(255,255,255,.98) 36%);box-shadow:inset 4px 0 0 #78b82b}.forum-category-row.has-new-content .forum-status-icon{background:#78b82b;color:#fff;box-shadow:0 0 0 5px rgba(121,185,45,.12)} +.forum-topic-table-row{grid-template-columns:42px minmax(0,1fr) 82px 82px 190px}.forum-topic-state{display:grid;place-items:center;height:100%;font-size:17px;color:#728071}.forum-topic-table-row.has-new-content .forum-topic-state{color:#6da927}.forum-topic-copy{padding-left:4px}.forum-topic-copy .forum-row-heading>span{display:block;color:#6b9f28;font-size:10px;text-transform:uppercase;font-weight:850;letter-spacing:.05em}.forum-topic-copy>span{display:none}.forum-side-stats{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:18px 0}.forum-side-stats span{display:grid;gap:3px;border:1px solid rgba(255,255,255,.1);border-radius:9px;padding:10px;color:#bfc8c0;font-size:11px}.forum-side-stats strong{font-size:21px;color:#a4da55} +.forum-author-panel{padding:18px 13px}.forum-user-rank{color:#47731d!important;font-weight:900;text-transform:uppercase;letter-spacing:.06em}.forum-user-stars{margin:6px 0 13px;color:#daa51d;letter-spacing:2px;font-size:13px}.forum-user-stats{display:grid;gap:5px;margin:0;text-align:left}.forum-user-stats div{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;border-top:1px solid #e1e6df;padding-top:5px}.forum-user-stats dt,.forum-user-stats dd{margin:0;font-size:10px;line-height:1.25}.forum-user-stats dt{color:#737d74}.forum-user-stats dd{font-weight:850;color:#303a31;text-align:right}.forum-post-body{white-space:normal}.forum-post-body blockquote{margin:16px 0;padding:12px 15px;border-left:4px solid #77b52d;background:#f3f7ef;border-radius:0 8px 8px 0;color:#465047}.forum-post-body pre{overflow:auto;margin:16px 0;padding:13px;border-radius:8px;background:#151b16;color:#e4f1dc;white-space:pre-wrap}.forum-post-body ul{padding-left:22px}.forum-post-body a{color:#598f20;font-weight:750}.forum-bbcode-warning{display:inline-block;border:1px solid #dbb46e;background:#fff8e7;color:#77551d;border-radius:6px;padding:4px 7px;font-size:12px}.forum-emoticon{font-size:1.2em;vertical-align:-.08em}.forum-post-footer{display:flex;align-items:center;justify-content:flex-end;gap:12px;border-top:1px solid #e6eae4;margin-top:20px;padding-top:12px;color:#6e786f;font-size:11px}.forum-post-footer form{margin:0}.forum-post-footer button{border:1px solid #9bc869;border-radius:999px;background:#f3faeb;color:#48761c;padding:7px 11px;font:inherit;font-weight:850;cursor:pointer}.forum-post-footer button:hover{background:#78b82b;color:#fff}.forum-thanked{color:#54871f;font-weight:850} +.forum-bb-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:5px;border:1px solid #cbd3c8;border-bottom:0;border-radius:8px 8px 0 0;background:#f4f7f1;padding:7px}.forum-bb-toolbar button{min-width:32px;height:30px;border:1px solid #c9d1c6;border-radius:5px;background:#fff;color:#303a31;padding:0 8px;font:inherit;font-size:12px;font-weight:800;cursor:pointer}.forum-bb-toolbar button:hover,.forum-bb-toolbar button:focus-visible{border-color:#76b42e;background:#eff8e6}.forum-editor textarea[data-forum-editor]{border-radius:0 0 7px 7px!important}.forum-editor-help{display:block;color:#687269;font-size:11px;line-height:1.45}.forum-alert-success{border-color:#8fc64a;background:#f2fae9;color:#365d16} +@media(max-width:1000px){.forum-topic-table-row{grid-template-columns:38px minmax(0,1fr) 70px 70px}.forum-topic-table-row .forum-last-post{display:none}} +@media(max-width:700px){.forum-topic-table-row{grid-template-columns:30px minmax(0,1fr) 55px}.forum-topic-table-row>.forum-number:nth-of-type(2){display:none}.forum-topic-state{font-size:14px}.forum-post .forum-author-panel{display:grid;grid-template-columns:42px minmax(0,1fr) auto;grid-template-areas:'avatar name rank' 'avatar stars stars';align-items:center;text-align:left}.forum-author-panel .forum-avatar{grid-area:avatar}.forum-author-panel>strong{grid-area:name}.forum-user-rank{grid-area:rank;text-align:right}.forum-user-stars{grid-area:stars;margin:2px 0}.forum-user-stats{display:none}.forum-post-footer{justify-content:space-between}.forum-bb-toolbar{overflow-x:auto;flex-wrap:nowrap}.forum-row-heading mark{font-size:8px}} diff --git a/web/assets/forum-v5.js b/web/assets/forum-v5.js new file mode 100644 index 0000000..74476a2 --- /dev/null +++ b/web/assets/forum-v5.js @@ -0,0 +1,40 @@ +(() => { + 'use strict'; + + const insertAroundSelection = (textarea, open, close, fallback = '') => { + const start = textarea.selectionStart ?? textarea.value.length; + const end = textarea.selectionEnd ?? start; + const selected = textarea.value.slice(start, end) || fallback; + const replacement = `${open}${selected}${close}`; + textarea.setRangeText(replacement, start, end, 'end'); + textarea.focus(); + }; + + const insertText = (textarea, value) => { + const start = textarea.selectionStart ?? textarea.value.length; + const end = textarea.selectionEnd ?? start; + textarea.setRangeText(value, start, end, 'end'); + textarea.focus(); + }; + + document.querySelectorAll('.forum-editor').forEach((editor) => { + const textarea = editor.querySelector('[data-forum-editor]'); + if (!textarea) return; + + editor.querySelectorAll('[data-bbcode]').forEach((button) => { + button.addEventListener('click', () => { + const code = button.dataset.bbcode; + if (code === 'url') { + insertAroundSelection(textarea, '[url=https://]', '[/url]', 'Linktext'); + return; + } + const fallback = code === 'quote' ? 'Zitat' : code === 'code' ? 'Code' : 'Text'; + insertAroundSelection(textarea, `[${code}]`, `[/${code}]`, fallback); + }); + }); + + editor.querySelectorAll('[data-emoticon]').forEach((button) => { + button.addEventListener('click', () => insertText(textarea, ` ${button.dataset.emoticon} `)); + }); + }); +})(); diff --git a/web/assets/hero-poster.jpg b/web/assets/hero-poster.jpg new file mode 100644 index 0000000..305b5d9 Binary files /dev/null and b/web/assets/hero-poster.jpg differ diff --git a/web/assets/home-v5.css b/web/assets/home-v5.css new file mode 100644 index 0000000..12f7d5a --- /dev/null +++ b/web/assets/home-v5.css @@ -0,0 +1,30 @@ +.hero-inner-no-logo{display:flex;flex-direction:column;justify-content:center;padding-top:0;padding-bottom:34px}.hero-inner-no-logo h1{max-width:650px}.hero-inner-no-logo .hero-actions{margin-top:4px}@media(max-width:700px){.hero-inner-no-logo{padding-top:0;padding-bottom:24px}.hero-inner-no-logo h1{max-width:390px}} +@media(max-width:700px){.compact-grid.story-grid article:last-child{display:block!important}.story-grid{grid-template-columns:1fr}.story-grid .story-card{display:block!important}.story-grid .story-card .media{height:170px}.story-grid .story-card .card-copy{min-height:0;padding:12px}.story-grid .story-card .card-copy h3{font-size:15px}.story-grid .story-card .card-copy p,.story-grid .story-card .card-copy time{font-size:11px}} + +/* Vorübergehender Startseitenbereich: Landwelle App Beta-Test, bewusst direkt vor dem Footer. */ +.app-beta-section{position:relative;padding:52px 0 56px;background:#f1f5ec;border-top:1px solid #dfe8d8} +.app-beta-card{position:relative;display:grid;grid-template-columns:112px minmax(0,1fr) 280px;gap:30px;align-items:center;overflow:hidden;padding:30px 34px;border:1px solid rgba(151,204,42,.38);border-radius:22px;background:linear-gradient(112deg,#0d120e 0%,#172218 58%,#20351b 100%);color:#fff;box-shadow:0 18px 45px rgba(21,35,19,.16)} +.app-beta-card::before{content:"";position:absolute;inset:0;background:radial-gradient(circle at 88% 10%,rgba(154,211,45,.2),transparent 29%),linear-gradient(90deg,rgba(255,255,255,.02) 1px,transparent 1px);background-size:auto,32px 32px;pointer-events:none} +.app-beta-mark,.app-beta-copy,.app-beta-actions{position:relative;z-index:1} +.app-beta-mark{display:grid;place-items:center;width:104px;height:104px;border:1px solid rgba(255,255,255,.12);border-radius:22px;background:rgba(255,255,255,.055);box-shadow:inset 0 1px rgba(255,255,255,.06)} +.app-beta-mark img{width:78px;filter:drop-shadow(0 5px 10px rgba(0,0,0,.35))} +.app-beta-mark span{position:absolute;right:-7px;bottom:-7px;display:grid;place-items:center;width:36px;height:36px;border:4px solid #162218;border-radius:50%;background:#9bd32c;color:#14200f;font-size:20px;font-weight:950} +.app-beta-copy{max-width:720px} +.app-beta-kicker{display:inline-flex;align-items:center;gap:9px;margin-bottom:8px;color:#afe33f;font-size:10px;font-weight:950;letter-spacing:.12em;text-transform:uppercase} +.app-beta-kicker i{width:8px;height:8px;border-radius:50%;background:#9bd326;box-shadow:0 0 0 5px rgba(155,211,38,.12)} +.app-beta-copy h2{margin:0;color:#fff;font-size:clamp(25px,2.4vw,36px);line-height:1.08;letter-spacing:-.035em} +.app-beta-copy p{max-width:690px;margin:11px 0 0;color:#d3ddd0;font-size:14px;line-height:1.55} +.app-beta-benefits{display:flex;flex-wrap:wrap;gap:8px 18px;margin:15px 0 0;padding:0;list-style:none;color:#dce8d8;font-size:11px;font-weight:750} +.app-beta-benefits li{display:flex;align-items:center;gap:7px}.app-beta-benefits li::before{content:"✓";color:#a9df38;font-weight:950} +.app-beta-actions{display:flex;flex-direction:column;align-items:stretch;gap:10px} +.app-beta-button{display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:50px;padding:0 18px;border:1px solid #a8dd38;border-radius:10px;background:#92ca24;color:#11190e;font-size:14px;font-weight:950;box-shadow:0 10px 26px rgba(83,130,8,.25);transition:transform .18s ease,filter .18s ease} +.app-beta-button:hover{transform:translateY(-2px);filter:brightness(1.06)} +.app-beta-button:focus-visible{outline:3px solid #fff;outline-offset:4px} +.app-beta-button svg{width:20px;fill:currentColor}.app-beta-button>span{font-size:19px} +.app-beta-actions small{color:#acb9aa;font-size:10px;line-height:1.5;text-align:center;overflow-wrap:anywhere} +@media(max-width:980px){.app-beta-card{grid-template-columns:88px minmax(0,1fr);gap:22px;padding:27px}.app-beta-mark{width:82px;height:82px;border-radius:18px}.app-beta-mark img{width:62px}.app-beta-mark span{width:31px;height:31px;font-size:17px}.app-beta-actions{grid-column:1/-1;display:grid;grid-template-columns:minmax(220px,310px) 1fr;align-items:center}.app-beta-actions small{text-align:left}} +@media(max-width:680px){.app-beta-section{padding:34px 0 38px}.app-beta-card{grid-template-columns:1fr;padding:24px 20px;border-radius:17px}.app-beta-mark{display:none}.app-beta-copy h2{font-size:27px}.app-beta-copy p{font-size:13px}.app-beta-benefits{display:grid;grid-template-columns:1fr 1fr;gap:8px 12px}.app-beta-actions{grid-column:auto;display:flex}.app-beta-button{width:100%}.app-beta-actions small{text-align:center}} +@media(max-width:430px){.app-beta-benefits{grid-template-columns:1fr}} +@media(prefers-reduced-motion:reduce){.app-beta-button{transition:none}} +/* v1.5.24 – KI-Kennzeichnung regionaler Inhalte */ +.story-card .media{position:relative}.story-media-ai{position:absolute;right:9px;bottom:9px;padding:5px 8px;border-radius:999px;background:rgba(20,26,23,.88);color:#fff;font-size:.65rem;font-weight:900;text-transform:uppercase}.story-ai-label{display:inline-flex;width:max-content;margin-bottom:6px;padding:4px 7px;border-radius:999px;background:#eee7fa;color:#5d3b83;font-size:.64rem;font-weight:900;letter-spacing:.04em;text-transform:uppercase}.story-ai-review{display:block;margin:8px 0 2px;color:#6c6274;font-size:.66rem;line-height:1.35} diff --git a/web/assets/homepage-events-v1.css b/web/assets/homepage-events-v1.css new file mode 100644 index 0000000..7feb5bf --- /dev/null +++ b/web/assets/homepage-events-v1.css @@ -0,0 +1 @@ +.home-event-card{cursor:pointer;outline:none}.home-event-card:focus-visible{box-shadow:0 0 0 4px rgba(126,183,35,.28),0 14px 35px rgba(26,42,22,.14)}.home-event-card .media{display:block}.home-event-more{display:inline-flex;margin-top:12px;color:#5f941a;font-size:.78rem;font-weight:900}.home-event-card:hover .home-event-more{text-decoration:underline}.home-event-modal[hidden]{display:none!important}.home-event-modal{position:fixed;inset:0;z-index:10040;display:grid;place-items:center;padding:20px}.home-event-backdrop{position:absolute;inset:0;background:rgba(5,10,7,.82);backdrop-filter:blur(6px)}.home-event-dialog{position:relative;z-index:1;display:grid;grid-template-columns:minmax(280px,42%) minmax(0,1fr);width:min(980px,100%);max-height:92vh;overflow:auto;border-radius:24px;background:#fff;box-shadow:0 30px 100px rgba(0,0,0,.5)}.home-event-close{position:absolute;right:14px;top:12px;z-index:3;width:42px;height:42px;border:0;border-radius:50%;background:rgba(15,24,17,.88);color:#fff;font-size:28px;cursor:pointer}.home-event-media{position:relative;min-height:430px;background:#e9eee6}.home-event-media img{width:100%;height:100%;min-height:430px;object-fit:cover}.home-event-media span{position:absolute;left:18px;bottom:18px;padding:8px 11px;border-radius:999px;background:#82bd27;color:#13200f;font-size:11px;font-weight:900;text-transform:uppercase}.home-event-content{padding:36px;overflow-wrap:anywhere}.home-event-kicker{color:#70a823;font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.06em}.home-event-content h2{margin:7px 50px 8px 0;font-size:clamp(27px,3vw,42px);line-height:1.05}.home-event-date{margin:0 0 20px;color:#548419;font-weight:900}.home-event-content dl{display:grid;gap:8px;padding:15px 0;margin:0;border-top:1px solid #e5ebe3;border-bottom:1px solid #e5ebe3}.home-event-content dl div{display:grid;grid-template-columns:100px 1fr;gap:12px}.home-event-content dt{color:#7a847a}.home-event-content dd{margin:0;font-weight:800}.home-event-description{white-space:pre-line;margin:22px 0;color:#39443a;line-height:1.65}.home-event-source{color:#758076;font-size:12px}.home-event-actions{display:flex;flex-wrap:wrap;gap:9px;margin-top:22px}.home-event-actions a{padding:10px 13px;border-radius:999px;background:#172019;color:#fff;text-decoration:none;font-size:12px;font-weight:900}.home-event-actions a:nth-child(n+2){background:#eaf1e5;color:#517f1b}.home-event-error{padding:12px;border-radius:10px;background:#fde7e5;color:#a03129;font-weight:800}.has-home-event-modal{overflow:hidden}@media(max-width:760px){.home-event-dialog{grid-template-columns:1fr}.home-event-media,.home-event-media img{min-height:230px;max-height:300px}.home-event-content{padding:25px 20px}.home-event-content h2{margin-right:40px}.home-event-content dl div{grid-template-columns:80px 1fr}} diff --git a/web/assets/homepage-events-v1.js b/web/assets/homepage-events-v1.js new file mode 100644 index 0000000..813d4f6 --- /dev/null +++ b/web/assets/homepage-events-v1.js @@ -0,0 +1,28 @@ +(()=>{ + const modal=document.querySelector('[data-home-event-modal]'); + if(!modal)return; + const body=document.body; + const fields={ + image:modal.querySelector('[data-home-event-image]'),category:modal.querySelector('[data-home-event-category]'),title:modal.querySelector('[data-home-event-title]'),date:modal.querySelector('[data-home-event-date]'),place:modal.querySelector('[data-home-event-place]'),organizer:modal.querySelector('[data-home-event-organizer]'),organizerRow:modal.querySelector('[data-home-event-organizer-row]'),description:modal.querySelector('[data-home-event-description]'),source:modal.querySelector('[data-home-event-source]'),calendar:modal.querySelector('[data-home-event-calendar]'),website:modal.querySelector('[data-home-event-website]'),sourceLink:modal.querySelector('[data-home-event-source-link]'),error:modal.querySelector('[data-home-event-error]') + }; + let controller=null,lastTrigger=null; + const setLink=(node,url)=>{if(!node)return;if(url){node.href=url;node.hidden=false}else{node.removeAttribute('href');node.hidden=true}}; + const close=()=>{controller?.abort();controller=null;modal.hidden=true;body.classList.remove('has-home-event-modal');lastTrigger?.focus?.();lastTrigger=null}; + const render=item=>{ + fields.image.src=item.image_url||'/assets/event-market-v14.jpg';fields.image.alt=item.title||''; + fields.category.textContent=item.category||'Veranstaltung';fields.title.textContent=item.title||'Veranstaltung';fields.date.textContent=item.date_label||''; + fields.place.textContent=[item.venue,[item.postal_code,item.city].filter(Boolean).join(' ')].filter(Boolean).join(', ')||'Niedersachsen'; + fields.organizer.textContent=item.organizer||'';fields.organizerRow.hidden=!item.organizer; + fields.description.textContent=item.description||'Weitere Informationen sind derzeit nicht hinterlegt.'; + fields.source.textContent=item.source_name?`Quelle: ${item.source_name}`:''; + setLink(fields.calendar,item.google_calendar_url);setLink(fields.website,item.website);setLink(fields.sourceLink,item.source_url);fields.error.hidden=true; + }; + const open=async(trigger)=>{ + const id=trigger?.dataset.homeEventId;if(!id)return;lastTrigger=trigger;modal.hidden=false;body.classList.add('has-home-event-modal');fields.title.textContent='Veranstaltung wird geladen …';fields.description.textContent='';fields.error.hidden=true;modal.querySelector('[data-home-event-close]')?.focus(); + controller?.abort();controller=new AbortController(); + try{const response=await fetch(`/api/events/${encodeURIComponent(id)}`,{headers:{Accept:'application/json'},signal:controller.signal});const payload=await response.json().catch(()=>({}));if(!response.ok)throw new Error(payload?.error?.message||'Die Veranstaltung konnte nicht geladen werden.');render(payload.data||{});}catch(error){if(error.name==='AbortError')return;fields.error.textContent=error.message||'Die Veranstaltung konnte nicht geladen werden.';fields.error.hidden=false;fields.title.textContent='Veranstaltung nicht verfügbar';} + }; + document.addEventListener('click',event=>{const card=event.target.closest('[data-home-event-id]');if(!card||event.target.closest('.home-event-modal'))return;event.preventDefault();open(card)}); + document.addEventListener('keydown',event=>{if(event.key==='Escape'&&!modal.hidden){close();return}if((event.key==='Enter'||event.key===' ')&&event.target.matches('[data-home-event-id]')){event.preventDefault();open(event.target)}}); + modal.querySelectorAll('[data-home-event-close]').forEach(node=>node.addEventListener('click',close)); +})(); diff --git a/web/assets/host-jan-v14.jpg b/web/assets/host-jan-v14.jpg new file mode 100644 index 0000000..c5f79cc Binary files /dev/null and b/web/assets/host-jan-v14.jpg differ diff --git a/web/assets/jens-bramsche-v16.png b/web/assets/jens-bramsche-v16.png new file mode 100644 index 0000000..ab8887d Binary files /dev/null and b/web/assets/jens-bramsche-v16.png differ diff --git a/web/assets/jobs-v2.css b/web/assets/jobs-v2.css new file mode 100644 index 0000000..fa25f58 --- /dev/null +++ b/web/assets/jobs-v2.css @@ -0,0 +1 @@ +.jobs-page{background:#f4f6f2;min-height:70vh}.jobs-hero{padding:88px 0 78px;background:linear-gradient(115deg,rgba(4,14,7,.94),rgba(9,47,20,.8)),url('/assets/hero-poster.jpg') center/cover;color:#fff}.jobs-hero span,.jobs-heading span{color:#8fd64f;font-size:.75rem;font-weight:900;letter-spacing:.13em;text-transform:uppercase}.jobs-hero h1{margin:12px 0;font-size:clamp(2.7rem,6vw,5.8rem);line-height:.95}.jobs-hero p{max-width:720px;margin:0;color:#dce7dc;font-size:1.1rem}.jobs-shell{padding-top:34px;padding-bottom:70px}.jobs-search{display:grid;gap:16px;margin-top:-72px;padding:24px;border:1px solid #dce5d8;border-radius:22px;background:#fff;box-shadow:0 22px 60px rgba(16,39,19,.14)}.jobs-search>div{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}.jobs-search>div:nth-child(2){grid-template-columns:repeat(4,minmax(0,1fr))}.jobs-search label span{display:block;margin-bottom:7px;color:#58645b;font-size:.78rem;font-weight:850}.jobs-search input,.jobs-search select{width:100%;height:48px;padding:0 13px;border:1px solid #d8e1d5;border-radius:11px;background:#f9fbf8}.jobs-search button,.job-card button{border:0;border-radius:12px;background:#177c3a;color:#fff;font-weight:900;cursor:pointer}.jobs-search button{height:52px}.jobs-heading{display:flex;justify-content:space-between;align-items:end;margin:42px 0 18px}.jobs-heading h2{margin:6px 0 0;font-size:2rem}.jobs-heading p{margin:0;color:#687368}.jobs-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:17px}.job-card{display:flex;flex-direction:column;min-height:255px;padding:20px;border:1px solid #dfe6dc;border-radius:18px;background:#fff;box-shadow:0 10px 30px rgba(27,46,29,.06)}.job-card-top,.job-meta{display:flex;justify-content:space-between;gap:10px;color:#6c766e;font-size:.75rem}.job-card-top span{color:#177c3a;font-weight:900}.job-card h3{margin:18px 0 8px;font-size:1.25rem;line-height:1.25}.job-employer{margin:0;color:#4e5850}.job-meta{margin-top:auto;padding:18px 0 14px;border-top:1px solid #eef1ec}.job-card button{height:42px}.jobs-pagination{display:flex;align-items:center;justify-content:space-between;margin:28px 0}.jobs-pagination a{padding:10px 15px;border-radius:999px;background:#fff;border:1px solid #dce4da;font-weight:850}.jobs-alert,.jobs-empty{margin:28px 0;padding:22px;border-radius:16px;background:#fff;border:1px solid #ead9b4}.jobs-alert p,.jobs-empty p{margin-bottom:0}.jobs-source{margin-top:30px;color:#758077;font-size:.78rem}.job-modal[hidden]{display:none}.job-modal{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px}.job-modal-backdrop{position:absolute;inset:0;background:rgba(3,8,4,.76);backdrop-filter:blur(6px)}.job-modal>section{position:relative;width:min(820px,100%);max-height:88vh;overflow:auto;padding:30px;border-radius:22px;background:#fff;box-shadow:0 30px 90px rgba(0,0,0,.4)}.job-modal-close{position:absolute;right:15px;top:12px;width:38px;height:38px;border:0;border-radius:50%;font-size:1.7rem}.job-detail h2{padding-right:40px}.job-detail-description{white-space:pre-line;line-height:1.65}.job-detail-meta{display:flex;gap:8px;flex-wrap:wrap}.job-detail-meta span{padding:7px 10px;border-radius:999px;background:#edf5e9;font-size:.8rem}.job-apply{display:inline-flex;margin-top:18px;padding:12px 18px;border-radius:12px;background:#177c3a;color:#fff;font-weight:900}@media(max-width:980px){.jobs-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.jobs-search>div:nth-child(2){grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:650px){.jobs-search>div,.jobs-search>div:nth-child(2),.jobs-grid{grid-template-columns:1fr}.jobs-hero{padding-top:65px}.jobs-search{margin-top:-45px}.jobs-heading{align-items:flex-start;flex-direction:column;gap:7px}} diff --git a/web/assets/jobs-v2.js b/web/assets/jobs-v2.js new file mode 100644 index 0000000..24b4f1b --- /dev/null +++ b/web/assets/jobs-v2.js @@ -0,0 +1 @@ +(()=>{const modal=document.querySelector('[data-job-modal]'),detail=document.querySelector('[data-job-detail]');if(!modal||!detail)return;const close=()=>{modal.hidden=true;detail.innerHTML='';document.body.style.overflow=''};document.querySelectorAll('[data-job-close]').forEach(x=>x.addEventListener('click',close));document.addEventListener('keydown',e=>{if(e.key==='Escape'&&!modal.hidden)close()});document.querySelectorAll('[data-job-ref]').forEach(btn=>btn.addEventListener('click',async()=>{modal.hidden=false;document.body.style.overflow='hidden';detail.innerHTML='

Stellendetails werden geladen …

';try{const r=await fetch('/api/jobs/details?ref='+encodeURIComponent(btn.dataset.jobRef),{headers:{Accept:'application/json'}});const p=await r.json();if(!r.ok)throw new Error(p?.error?.message||'Stellendetails konnten nicht geladen werden.');const j=p.data||{};const loc=(j.arbeitsorte||[]).map(x=>[x.plz,x.ort].filter(Boolean).join(' ')).filter(Boolean).join(', ');detail.innerHTML=`
Stellenangebot

${esc(j.stellenangebotsTitel||'Stellenangebot')}

${esc(j.arbeitgeber||'')}${loc?' · '+esc(loc):''}

${j.angebotsart?`${esc(j.angebotsart)}`:''}${j.aktuelleVeroeffentlichungsdatum?`Veröffentlicht ${esc(j.aktuelleVeroeffentlichungsdatum)}`:''}${j.eintrittsdatum?`Start ${esc(j.eintrittsdatum)}`:''}
${esc(j.stellenangebotsBeschreibung||'Keine ausführliche Beschreibung vorhanden.')}
${j.externeUrl?`Zum Stellenangebot`:''}
`}catch(e){detail.innerHTML=`

Nicht erreichbar

${esc(e.message)}

`}}));function esc(v){return String(v??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]))}function attr(v){try{const u=new URL(v);return ['http:','https:'].includes(u.protocol)?esc(u.href):'#'}catch{return'#'}}})(); diff --git a/web/assets/joerg-weiss-v20.png b/web/assets/joerg-weiss-v20.png new file mode 100644 index 0000000..7723e26 Binary files /dev/null and b/web/assets/joerg-weiss-v20.png differ diff --git a/web/assets/landwelle-hero.mp4 b/web/assets/landwelle-hero.mp4 new file mode 100644 index 0000000..d933eb8 Binary files /dev/null and b/web/assets/landwelle-hero.mp4 differ diff --git a/web/assets/landwelle-ki-transparenz-preroll-v1.mp3 b/web/assets/landwelle-ki-transparenz-preroll-v1.mp3 new file mode 100644 index 0000000..df90cd1 Binary files /dev/null and b/web/assets/landwelle-ki-transparenz-preroll-v1.mp3 differ diff --git a/web/assets/landwelle-logo-trim.png b/web/assets/landwelle-logo-trim.png new file mode 100644 index 0000000..9deb571 Binary files /dev/null and b/web/assets/landwelle-logo-trim.png differ diff --git a/web/assets/landwelle-logo.png b/web/assets/landwelle-logo.png new file mode 100644 index 0000000..6b92930 Binary files /dev/null and b/web/assets/landwelle-logo.png differ diff --git a/web/assets/landwelle-vor-ort-v1.css b/web/assets/landwelle-vor-ort-v1.css new file mode 100644 index 0000000..fd0f863 --- /dev/null +++ b/web/assets/landwelle-vor-ort-v1.css @@ -0,0 +1 @@ +.vorort-page{min-height:70vh;background:#f3f5f0;color:#1d291d}.vorort-hero{padding:150px 0 72px;background:linear-gradient(120deg,rgba(10,24,11,.95),rgba(36,70,25,.82)),url('/assets/hero-poster.jpg') center/cover;color:#fff}.vorort-hero span,.vorort-section-head span{display:block;color:#9dd84a;font-size:.75rem;font-weight:900;letter-spacing:.13em;text-transform:uppercase}.vorort-hero h1{margin:9px 0 16px;font-size:clamp(3rem,7vw,5.6rem);line-height:.96}.vorort-hero p{max-width:800px;margin:0;color:#e0e9dd;font-size:1.16rem;line-height:1.7}.vorort-content{padding-top:62px;padding-bottom:84px}.vorort-section-head{display:flex;align-items:end;justify-content:space-between;gap:30px;margin-bottom:28px}.vorort-section-head h2{margin:7px 0 0;font-size:clamp(2rem,4vw,3.2rem)}.vorort-section-head p{max-width:480px;margin:0;color:#667064}.vorort-categories{display:flex;flex-wrap:wrap;gap:9px;margin:-4px 0 30px}.vorort-categories a{display:inline-flex;align-items:center;min-height:38px;padding:0 15px;border:1px solid #d6dfd2;border-radius:999px;background:#fff;color:#4f604c;font-size:.82rem;font-weight:800;text-decoration:none;transition:.18s ease}.vorort-categories a:hover{border-color:#9abb7c;color:#507e22;transform:translateY(-1px)}.vorort-categories a.is-active{border-color:#679d24;background:#679d24;color:#fff;box-shadow:0 8px 20px rgba(103,157,36,.18)}.vorort-card-category{display:inline-flex;align-self:flex-start;margin-bottom:9px;padding:5px 8px;border-radius:999px;background:#edf4e7;color:#5e8d2d;font-size:.68rem;font-weight:900;letter-spacing:.04em;text-transform:uppercase}.vorort-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}.vorort-card{overflow:hidden;border:1px solid #dce4d8;border-radius:22px;background:#fff;box-shadow:0 14px 42px rgba(28,51,22,.08);transition:transform .18s ease,box-shadow .18s ease}.vorort-card:hover{transform:translateY(-4px);box-shadow:0 22px 52px rgba(28,51,22,.14)}.vorort-card-link{display:flex;height:100%;flex-direction:column;color:inherit;text-decoration:none}.vorort-card-media{position:relative;aspect-ratio:16/10;overflow:hidden;background:#152416}.vorort-card-media>img{width:100%;height:100%;object-fit:cover;transition:transform .25s ease}.vorort-card:hover .vorort-card-media>img{transform:scale(1.025)}.vorort-card-placeholder{display:grid;height:100%;place-items:center;background:linear-gradient(135deg,#162716,#466d27)}.vorort-card-placeholder img{width:min(180px,55%);filter:drop-shadow(0 10px 28px rgba(0,0,0,.24))}.vorort-card-copy{display:flex;flex:1;flex-direction:column;padding:21px}.vorort-card-meta{display:flex;justify-content:space-between;gap:10px;color:#70806c;font-size:.75rem;font-weight:750}.vorort-card h3{margin:10px 0 9px;font-size:1.32rem;line-height:1.2}.vorort-card p{display:-webkit-box;overflow:hidden;margin:0 0 18px;color:#5b6859;line-height:1.62;-webkit-box-orient:vertical;-webkit-line-clamp:4}.vorort-card-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:auto;padding-top:12px;border-top:1px solid #edf1ea}.vorort-card-footer strong{color:#679d24;font-size:.86rem}.vorort-card-footer small{padding:5px 7px;border-radius:999px;background:#eee7f8;color:#65478a;font-size:.68rem;font-weight:850}.vorort-empty{padding:65px 25px;border:1px dashed #cbd7c6;border-radius:22px;text-align:center;background:#fff}.vorort-empty img{width:170px}.vorort-empty h2{margin:18px 0 8px}.vorort-empty p{margin:0;color:#687466}@media(max-width:980px){.vorort-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:680px){.vorort-hero{padding:120px 0 55px}.vorort-section-head{align-items:flex-start;flex-direction:column}.vorort-grid{grid-template-columns:1fr}.vorort-card-meta{align-items:flex-start;flex-direction:column}.vorort-content{padding-top:42px;padding-bottom:60px}} diff --git a/web/assets/landwelle-vor-ort-v2.css b/web/assets/landwelle-vor-ort-v2.css new file mode 100644 index 0000000..fd0f863 --- /dev/null +++ b/web/assets/landwelle-vor-ort-v2.css @@ -0,0 +1 @@ +.vorort-page{min-height:70vh;background:#f3f5f0;color:#1d291d}.vorort-hero{padding:150px 0 72px;background:linear-gradient(120deg,rgba(10,24,11,.95),rgba(36,70,25,.82)),url('/assets/hero-poster.jpg') center/cover;color:#fff}.vorort-hero span,.vorort-section-head span{display:block;color:#9dd84a;font-size:.75rem;font-weight:900;letter-spacing:.13em;text-transform:uppercase}.vorort-hero h1{margin:9px 0 16px;font-size:clamp(3rem,7vw,5.6rem);line-height:.96}.vorort-hero p{max-width:800px;margin:0;color:#e0e9dd;font-size:1.16rem;line-height:1.7}.vorort-content{padding-top:62px;padding-bottom:84px}.vorort-section-head{display:flex;align-items:end;justify-content:space-between;gap:30px;margin-bottom:28px}.vorort-section-head h2{margin:7px 0 0;font-size:clamp(2rem,4vw,3.2rem)}.vorort-section-head p{max-width:480px;margin:0;color:#667064}.vorort-categories{display:flex;flex-wrap:wrap;gap:9px;margin:-4px 0 30px}.vorort-categories a{display:inline-flex;align-items:center;min-height:38px;padding:0 15px;border:1px solid #d6dfd2;border-radius:999px;background:#fff;color:#4f604c;font-size:.82rem;font-weight:800;text-decoration:none;transition:.18s ease}.vorort-categories a:hover{border-color:#9abb7c;color:#507e22;transform:translateY(-1px)}.vorort-categories a.is-active{border-color:#679d24;background:#679d24;color:#fff;box-shadow:0 8px 20px rgba(103,157,36,.18)}.vorort-card-category{display:inline-flex;align-self:flex-start;margin-bottom:9px;padding:5px 8px;border-radius:999px;background:#edf4e7;color:#5e8d2d;font-size:.68rem;font-weight:900;letter-spacing:.04em;text-transform:uppercase}.vorort-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}.vorort-card{overflow:hidden;border:1px solid #dce4d8;border-radius:22px;background:#fff;box-shadow:0 14px 42px rgba(28,51,22,.08);transition:transform .18s ease,box-shadow .18s ease}.vorort-card:hover{transform:translateY(-4px);box-shadow:0 22px 52px rgba(28,51,22,.14)}.vorort-card-link{display:flex;height:100%;flex-direction:column;color:inherit;text-decoration:none}.vorort-card-media{position:relative;aspect-ratio:16/10;overflow:hidden;background:#152416}.vorort-card-media>img{width:100%;height:100%;object-fit:cover;transition:transform .25s ease}.vorort-card:hover .vorort-card-media>img{transform:scale(1.025)}.vorort-card-placeholder{display:grid;height:100%;place-items:center;background:linear-gradient(135deg,#162716,#466d27)}.vorort-card-placeholder img{width:min(180px,55%);filter:drop-shadow(0 10px 28px rgba(0,0,0,.24))}.vorort-card-copy{display:flex;flex:1;flex-direction:column;padding:21px}.vorort-card-meta{display:flex;justify-content:space-between;gap:10px;color:#70806c;font-size:.75rem;font-weight:750}.vorort-card h3{margin:10px 0 9px;font-size:1.32rem;line-height:1.2}.vorort-card p{display:-webkit-box;overflow:hidden;margin:0 0 18px;color:#5b6859;line-height:1.62;-webkit-box-orient:vertical;-webkit-line-clamp:4}.vorort-card-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:auto;padding-top:12px;border-top:1px solid #edf1ea}.vorort-card-footer strong{color:#679d24;font-size:.86rem}.vorort-card-footer small{padding:5px 7px;border-radius:999px;background:#eee7f8;color:#65478a;font-size:.68rem;font-weight:850}.vorort-empty{padding:65px 25px;border:1px dashed #cbd7c6;border-radius:22px;text-align:center;background:#fff}.vorort-empty img{width:170px}.vorort-empty h2{margin:18px 0 8px}.vorort-empty p{margin:0;color:#687466}@media(max-width:980px){.vorort-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:680px){.vorort-hero{padding:120px 0 55px}.vorort-section-head{align-items:flex-start;flex-direction:column}.vorort-grid{grid-template-columns:1fr}.vorort-card-meta{align-items:flex-start;flex-direction:column}.vorort-content{padding-top:42px;padding-bottom:60px}} diff --git a/web/assets/landwelle-zuhause-sendestation-v1.png b/web/assets/landwelle-zuhause-sendestation-v1.png new file mode 100644 index 0000000..1e17760 Binary files /dev/null and b/web/assets/landwelle-zuhause-sendestation-v1.png differ diff --git a/web/assets/landwelle-zuhause-v1.css b/web/assets/landwelle-zuhause-v1.css new file mode 100644 index 0000000..906faa1 --- /dev/null +++ b/web/assets/landwelle-zuhause-v1.css @@ -0,0 +1,4 @@ +.lw-home-world{background:#f6f8f4;color:#172019;overflow:hidden}.lw-world-hero{position:relative;min-height:650px;color:#fff;background:radial-gradient(circle at 78% 24%,rgba(130,190,15,.22),transparent 26%),radial-gradient(circle at 22% 82%,rgba(65,108,31,.32),transparent 35%),linear-gradient(135deg,#07100b 0%,#0d1b11 45%,#08110c 100%);display:flex;align-items:center}.lw-world-stars{position:absolute;inset:0;opacity:.48;background-image:radial-gradient(circle at 15% 20%,rgba(255,255,255,.75) 0 1px,transparent 1.5px),radial-gradient(circle at 70% 12%,rgba(255,255,255,.5) 0 1px,transparent 1.5px),radial-gradient(circle at 89% 65%,rgba(255,255,255,.35) 0 1px,transparent 1.5px),radial-gradient(circle at 38% 72%,rgba(145,203,21,.45) 0 1px,transparent 1.5px);background-size:140px 140px,190px 190px,230px 230px,260px 260px}.lw-world-hero:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:120px;background:linear-gradient(to top,#f6f8f4,transparent)}.lw-world-hero-grid{position:relative;z-index:2;display:grid;grid-template-columns:minmax(0,.9fr) minmax(480px,1.1fr);gap:70px;align-items:center;padding:84px 0 130px}.lw-world-status{display:inline-flex;align-items:center;gap:9px;padding:8px 12px;border:1px solid rgba(167,220,52,.35);border-radius:999px;background:rgba(126,181,9,.08);font-size:11px;font-weight:850;letter-spacing:.08em;text-transform:uppercase;color:#dff3b7}.lw-world-status i{width:8px;height:8px;border-radius:50%;background:#97d31c;box-shadow:0 0 0 5px rgba(151,211,28,.11),0 0 18px rgba(151,211,28,.65)}.lw-world-kicker{margin:28px 0 12px;color:#9fd12f;font-weight:850;text-transform:uppercase;letter-spacing:.14em;font-size:12px}.lw-world-hero h1{margin:0;font-size:clamp(48px,5.2vw,76px);line-height:.98;letter-spacing:-.055em;font-weight:760}.lw-world-hero h1 strong{display:inline-block;color:#9fd12f;font-weight:900}.lw-world-lead{max-width:670px;margin:25px 0 0;color:#d7ded8;font-size:18px;line-height:1.65}.lw-world-hero-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:31px}.lw-world-button{min-height:46px;padding:0 20px;border-radius:7px;display:inline-flex;align-items:center;justify-content:center;font-size:13px;font-weight:850;transition:transform .2s ease,box-shadow .2s ease,background .2s ease}.lw-world-button:hover{transform:translateY(-1px)}.lw-world-button.is-primary{color:#fff;background:linear-gradient(180deg,#95ce1d,#74aa03);box-shadow:0 8px 26px rgba(112,163,3,.22)}.lw-world-button.is-secondary{color:#eef3ed;border:1px solid rgba(255,255,255,.24);background:rgba(255,255,255,.05)}.lw-world-hero-meta{display:flex;gap:22px;flex-wrap:wrap;margin-top:32px;color:#9ca7a0;font-size:10px;text-transform:uppercase;letter-spacing:.06em}.lw-world-hero-meta span{display:flex;gap:6px;align-items:center}.lw-world-hero-meta b{color:#eff4ef;font-size:10px}.lw-world-hero-visual{position:relative}.lw-world-placeholder{position:relative;display:flex;flex-direction:column;justify-content:flex-end;overflow:hidden;border:1px solid rgba(255,255,255,.11);background:linear-gradient(145deg,rgba(111,151,65,.16),rgba(10,23,15,.8)),radial-gradient(circle at 70% 25%,rgba(159,209,47,.22),transparent 34%);color:#fff}.lw-world-placeholder:before{content:"";position:absolute;inset:0;background:linear-gradient(125deg,transparent 0 36%,rgba(255,255,255,.025) 36% 37%,transparent 37% 63%,rgba(255,255,255,.02) 63% 64%,transparent 64%),linear-gradient(0deg,rgba(0,0,0,.42),transparent 60%)}.lw-world-placeholder:after{content:"";position:absolute;left:7%;right:7%;bottom:18%;height:1px;background:linear-gradient(90deg,transparent,rgba(159,209,47,.56),transparent)}.lw-world-placeholder>*{position:relative;z-index:1}.lw-world-placeholder>span{text-transform:uppercase;letter-spacing:.16em;font-size:10px;font-weight:850;color:#9fd12f}.lw-world-placeholder>strong{font-size:26px;letter-spacing:-.03em;margin-top:7px}.lw-world-placeholder>small{color:#bcc5be;font-size:11px;margin-top:5px}.lw-world-placeholder.is-hero{min-height:455px;border-radius:18px;padding:32px;box-shadow:0 28px 70px rgba(0,0,0,.32);transform:perspective(1000px) rotateY(-5deg) rotateX(1deg)}.lw-world-floating-card{position:absolute;right:-18px;bottom:38px;width:220px;padding:16px 18px;border:1px solid rgba(255,255,255,.13);border-radius:12px;background:rgba(8,16,11,.88);backdrop-filter:blur(10px);box-shadow:0 18px 35px rgba(0,0,0,.3)}.lw-world-floating-card span,.lw-world-floating-card small{display:block;color:#91b45a;font-size:9px;text-transform:uppercase;letter-spacing:.12em;font-weight:800}.lw-world-floating-card strong{display:block;margin:4px 0 6px;font-size:16px}.lw-world-intro{padding:96px 0 105px}.lw-world-heading{max-width:780px;margin:0 auto 48px;text-align:center}.lw-world-heading.is-left{text-align:left;margin-left:0}.lw-world-heading>span,.lw-world-section-label{display:block;color:#72a808;text-transform:uppercase;letter-spacing:.14em;font-size:10px;font-weight:900}.lw-world-heading h2,.lw-world-showcase-copy h2,.lw-world-party-copy h2{margin:9px 0 14px;font-size:clamp(31px,4vw,47px);line-height:1.06;letter-spacing:-.045em}.lw-world-heading p,.lw-world-showcase-copy p,.lw-world-party-copy p{margin:0;color:#5c675f;font-size:15px;line-height:1.75}.lw-world-feature-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px}.lw-world-feature{min-height:230px;padding:25px 24px;border:1px solid #dfe6dc;border-radius:13px;background:#fff;box-shadow:0 12px 28px rgba(37,55,39,.06);transition:transform .2s ease,box-shadow .2s ease}.lw-world-feature:hover{transform:translateY(-4px);box-shadow:0 18px 38px rgba(37,55,39,.09)}.lw-world-feature-icon{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;background:#edf6df;color:#6fa307;font-size:21px;font-weight:900}.lw-world-feature h3{margin:20px 0 9px;font-size:18px}.lw-world-feature p{margin:0;color:#687269;font-size:12.5px;line-height:1.65}.lw-world-showcase{padding:92px 0;background:#0b130e;color:#fff}.lw-world-showcase-grid,.lw-world-party-grid{display:grid;grid-template-columns:1.15fr .85fr;gap:66px;align-items:center}.lw-world-placeholder.is-wide{min-height:430px;border-radius:14px;padding:28px}.lw-world-photo-card{position:relative;overflow:hidden;border-radius:14px;min-height:430px;background:#09110d;border:1px solid rgba(255,255,255,.11);box-shadow:0 22px 52px rgba(0,0,0,.28)}.lw-world-photo-card img{display:block;width:100%;height:100%;min-height:430px;object-fit:cover}.lw-world-photo-card:after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(5,10,7,.08) 0%,rgba(5,10,7,.18) 38%,rgba(5,10,7,.82) 100%)}.lw-world-photo-card figcaption{position:absolute;left:0;right:0;bottom:0;z-index:2;padding:24px 26px;color:#fff}.lw-world-photo-card figcaption span{text-transform:uppercase;letter-spacing:.16em;font-size:10px;font-weight:850;color:#9fd12f}.lw-world-photo-card figcaption strong{display:block;font-size:26px;letter-spacing:-.03em;margin-top:7px}.lw-world-photo-card figcaption small{display:block;color:#d8e0da;font-size:11px;margin-top:5px}.lw-world-showcase-copy p{color:#b9c2bc;margin-top:15px}.lw-world-note{display:flex;gap:13px;align-items:flex-start;margin-top:24px;padding:14px 16px;border-left:3px solid #8cc315;background:rgba(255,255,255,.045);border-radius:0 8px 8px 0}.lw-world-note b{white-space:nowrap;color:#a7da39;font-size:11px;text-transform:uppercase}.lw-world-note span{color:#b9c2bc;font-size:11px;line-height:1.5}.lw-world-party{padding:98px 0;background:linear-gradient(135deg,#f1f5ed,#fafbf9)}.lw-world-party-grid{grid-template-columns:.82fr 1.18fr}.lw-world-party-copy p{margin-top:15px}.lw-world-party-badge{display:inline-block;margin-top:23px;padding:8px 11px;border-radius:999px;background:#e7f1da;color:#608f02;font-size:9px;font-weight:900;text-transform:uppercase;letter-spacing:.1em}.lw-world-placeholder.is-party{min-height:410px;padding:28px;border-color:#cfd8ca;border-radius:15px;background:linear-gradient(145deg,#17241b,#0e1811),radial-gradient(circle,#90c919,transparent)}.lw-world-gallery{padding:92px 0 105px;background:#fff}.lw-world-slider{position:relative;margin-top:26px}.lw-world-slides{position:relative;min-height:510px}.lw-world-slide{position:absolute;inset:0;opacity:0;visibility:hidden;transform:translateX(12px);transition:opacity .45s ease,transform .45s ease,visibility .45s}.lw-world-slide.is-active{opacity:1;visibility:visible;transform:none}.lw-world-placeholder.is-slide{min-height:455px;border-radius:15px;padding:30px;background:linear-gradient(145deg,#17251a,#09120c),radial-gradient(circle at 72% 32%,rgba(147,202,29,.35),transparent 28%)}.lw-world-slide-caption{position:absolute;left:28px;bottom:24px;z-index:4;padding:13px 16px;border-radius:9px;background:rgba(7,13,9,.76);backdrop-filter:blur(8px);color:#fff}.lw-world-slide-caption b,.lw-world-slide-caption span{display:block}.lw-world-slide-caption b{font-size:14px}.lw-world-slide-caption span{margin-top:3px;color:#c9d0cb;font-size:10px}.lw-world-slider-button{position:absolute;z-index:6;top:42%;width:44px;height:44px;border:1px solid rgba(255,255,255,.2);border-radius:50%;background:rgba(7,13,9,.7);color:#fff;font-size:28px;line-height:1;display:grid;place-items:center;box-shadow:0 6px 18px rgba(0,0,0,.18)}.lw-world-slider-button.is-prev{left:18px}.lw-world-slider-button.is-next{right:18px}.lw-world-slider-dots{display:flex;justify-content:center;gap:7px;margin-top:19px}.lw-world-slider-dots button{width:8px;height:8px;padding:0;border:0;border-radius:50%;background:#cbd2c8}.lw-world-slider-dots button.is-active{width:24px;border-radius:999px;background:#7eb40d}.lw-world-access{padding:102px 0;background:linear-gradient(180deg,#eef3e9,#f8faf6)}.lw-world-steps{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.lw-world-steps article{position:relative;display:grid;grid-template-columns:52px 1fr;gap:17px;min-height:220px;padding:25px 23px;background:#fff;border:1px solid #dbe3d7;border-radius:13px}.lw-world-steps article>span{width:50px;height:50px;border-radius:50%;display:grid;place-items:center;background:#0e1711;color:#9bd225;font-size:18px;font-weight:900;box-shadow:0 0 0 6px #edf4e6}.lw-world-steps small{display:block;color:#76a90c;text-transform:uppercase;letter-spacing:.12em;font-size:9px;font-weight:900}.lw-world-steps h3{margin:5px 0 10px;font-size:17px}.lw-world-steps p{margin:0;color:#69736b;font-size:12px;line-height:1.65}.lw-world-access-callout{margin-top:36px;padding:29px 32px;border-radius:14px;background:#0d1710;color:#fff;display:flex;align-items:center;justify-content:space-between;gap:30px}.lw-world-access-callout span{display:block;color:#96cb27;text-transform:uppercase;letter-spacing:.12em;font-size:9px;font-weight:900}.lw-world-access-callout h3{margin:6px 0 7px;font-size:24px}.lw-world-access-callout p{max-width:730px;margin:0;color:#bac4bc;font-size:12px;line-height:1.6} +@media(max-width:1050px){.lw-world-hero-grid{grid-template-columns:1fr 1fr;gap:36px}.lw-world-feature-grid{grid-template-columns:1fr 1fr}.lw-world-showcase-grid,.lw-world-party-grid{gap:35px}.lw-world-steps{grid-template-columns:1fr}.lw-world-steps article{min-height:0}.lw-world-floating-card{right:12px}} +@media(max-width:760px){.lw-world-hero{min-height:auto}.lw-world-hero-grid{grid-template-columns:1fr;padding:66px 0 105px}.lw-world-hero-visual{order:-1}.lw-world-placeholder.is-hero{min-height:310px;transform:none}.lw-world-floating-card{right:12px;bottom:18px;width:190px}.lw-world-hero h1{font-size:46px}.lw-world-lead{font-size:15px}.lw-world-intro,.lw-world-gallery,.lw-world-access,.lw-world-party{padding:70px 0}.lw-world-feature-grid,.lw-world-showcase-grid,.lw-world-party-grid{grid-template-columns:1fr}.lw-world-party-copy{order:2}.lw-world-placeholder.is-wide,.lw-world-placeholder.is-party,.lw-world-photo-card{min-height:310px}.lw-world-slides{min-height:390px}.lw-world-placeholder.is-slide{min-height:360px}.lw-world-slider-button{top:40%}.lw-world-access-callout{align-items:flex-start;flex-direction:column}.lw-world-heading{margin-bottom:34px}} +@media(max-width:480px){.lw-world-hero h1{font-size:39px}.lw-world-hero-meta{gap:12px}.lw-world-feature-grid{grid-template-columns:1fr}.lw-world-placeholder.is-hero{min-height:260px;padding:21px}.lw-world-photo-card img{min-height:260px}.lw-world-placeholder>strong{font-size:21px}.lw-world-placeholder.is-slide{min-height:315px;padding:20px}.lw-world-slides{min-height:345px}.lw-world-slide-caption{left:16px;right:16px;bottom:16px}.lw-world-slider-button{width:38px;height:38px}.lw-world-slider-button.is-prev{left:9px}.lw-world-slider-button.is-next{right:9px}.lw-world-access-callout{padding:23px}.lw-world-steps article{grid-template-columns:45px 1fr;padding:21px 18px}.lw-world-steps article>span{width:42px;height:42px}} diff --git a/web/assets/landwelle-zuhause-v1.js b/web/assets/landwelle-zuhause-v1.js new file mode 100644 index 0000000..e85b6f9 --- /dev/null +++ b/web/assets/landwelle-zuhause-v1.js @@ -0,0 +1,39 @@ +(() => { + const root = document.querySelector('[data-world-slider]'); + if (!root) return; + const slides = Array.from(root.querySelectorAll('[data-world-slide]')); + const dots = Array.from(root.querySelectorAll('[data-world-dot]')); + const prev = root.querySelector('[data-world-prev]'); + const next = root.querySelector('[data-world-next]'); + if (!slides.length) return; + + let current = 0; + let timer = 0; + + const show = (index, restart = true) => { + current = (index + slides.length) % slides.length; + slides.forEach((slide, i) => slide.classList.toggle('is-active', i === current)); + dots.forEach((dot, i) => { + const active = i === current; + dot.classList.toggle('is-active', active); + if (active) dot.setAttribute('aria-current', 'true'); + else dot.removeAttribute('aria-current'); + }); + if (restart) start(); + }; + + const start = () => { + window.clearInterval(timer); + if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return; + timer = window.setInterval(() => show(current + 1, false), 6500); + }; + + prev?.addEventListener('click', () => show(current - 1)); + next?.addEventListener('click', () => show(current + 1)); + dots.forEach((dot) => dot.addEventListener('click', () => show(Number(dot.dataset.worldDot || 0)))); + root.addEventListener('mouseenter', () => window.clearInterval(timer)); + root.addEventListener('mouseleave', start); + root.addEventListener('focusin', () => window.clearInterval(timer)); + root.addEventListener('focusout', start); + start(); +})(); diff --git a/web/assets/leisure-heidepark-v15.svg b/web/assets/leisure-heidepark-v15.svg new file mode 100644 index 0000000..e2780e3 --- /dev/null +++ b/web/assets/leisure-heidepark-v15.svg @@ -0,0 +1,9 @@ + + + + + + + + FREIZEIT & ABENTEUER + diff --git a/web/assets/leisure-rastiland-v15.svg b/web/assets/leisure-rastiland-v15.svg new file mode 100644 index 0000000..eece93f --- /dev/null +++ b/web/assets/leisure-rastiland-v15.svg @@ -0,0 +1,8 @@ + + + + + + + FAMILIENZEIT IN NIEDERSACHSEN + diff --git a/web/assets/leisure-serengeti-v15.svg b/web/assets/leisure-serengeti-v15.svg new file mode 100644 index 0000000..73eec6c --- /dev/null +++ b/web/assets/leisure-serengeti-v15.svg @@ -0,0 +1,8 @@ + + + + + + + SAFARI & FREIZEITSPASS + diff --git a/web/assets/livestudio-v31.css b/web/assets/livestudio-v31.css new file mode 100644 index 0000000..3a65c20 --- /dev/null +++ b/web/assets/livestudio-v31.css @@ -0,0 +1,113 @@ +:root{ + color-scheme:dark; + --green:#74b82a; + --green2:#98d84b; + --green3:#d5f6a9; + --bg:#070909; + --bg2:#0f1512; + --panel:#111514; + --line:rgba(151,216,75,.22); + --line2:rgba(255,255,255,.06); + --text:#f7faf5; + --muted:#aeb8b1; + --shadow:0 18px 55px rgba(0,0,0,.28); + --ticker-duration:48s; +} +body.is-night{ + --bg:#030404; + --bg2:#0b0e0c; + --panel:#0c100f; + --line:rgba(151,216,75,.16); + --shadow:0 18px 65px rgba(0,0,0,.38); +} +*{box-sizing:border-box} +html,body{margin:0;min-height:100%;background:var(--bg);font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--text)} +body{ + overflow-x:hidden; + background: + radial-gradient(circle at 14% 10%,rgba(116,184,42,.18),transparent 22%), + radial-gradient(circle at 88% 8%,rgba(152,216,75,.12),transparent 28%), + linear-gradient(150deg,var(--bg) 0%,var(--bg2) 48%,#080a09 100%); + transition:background .6s ease,color .3s ease; +} +.studio{min-height:100vh;padding:clamp(18px,2vw,34px);display:flex;flex-direction:column;gap:clamp(18px,1.6vw,26px)} +.studio-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px} +.brand-block{display:flex;align-items:center;gap:18px} +.studio-logo{width:clamp(190px,18vw,310px);height:auto;filter:drop-shadow(0 10px 24px rgba(0,0,0,.22))} +.label-row{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:8px} +.pill,.chip,.panel-badge{ + display:inline-flex;align-items:center;justify-content:center; + padding:8px 14px;border-radius:999px;border:1px solid var(--line); + background:rgba(255,255,255,.04);font-weight:700;letter-spacing:.02em +} +.pill{font-size:clamp(12px,.92vw,15px);text-transform:uppercase;color:var(--green3)} +.pill-soft,.chip{color:#d4ded7} +.brand-subline{margin:0;color:var(--muted);font-size:clamp(14px,1vw,18px)} +.studio-status{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:clamp(14px,1.1vw,21px);padding:12px 16px;border-radius:999px;background:rgba(255,255,255,.03);border:1px solid var(--line2)} +.studio-status span{width:14px;height:14px;border-radius:50%;background:#e6a629;box-shadow:0 0 22px currentColor} +.studio-status.online span{background:var(--green2)} +.studio-status.offline span{background:#e45353} +.hero-grid{display:grid;grid-template-columns:1.45fr .88fr;gap:clamp(14px,1.4vw,22px)} +.info-grid{display:grid;grid-template-columns:.7fr .9fr 1.15fr .9fr;gap:clamp(14px,1.4vw,22px)} +.traffic-board{display:grid;grid-template-columns:1fr 1fr;gap:clamp(14px,1.4vw,22px)} +.card,.ticker-card{ + background:linear-gradient(145deg,rgba(21,27,24,.96),rgba(12,16,14,.96)); + border:1px solid var(--line);border-radius:28px;padding:clamp(20px,2vw,30px); + box-shadow:var(--shadow);min-width:0;position:relative;overflow:hidden +} +.card::before,.ticker-card::before{ + content:"";position:absolute;inset:0 auto auto 0;width:100%;height:1px; + background:linear-gradient(90deg,rgba(152,216,75,.35),rgba(152,216,75,0)) +} +.eyebrow{text-transform:uppercase;letter-spacing:.13em;color:var(--green2);font-size:clamp(12px,.9vw,17px);font-weight:800} +.card h1,.card h2{margin:.45em 0 .22em;line-height:1.08} +.card h1{font-size:clamp(30px,3vw,58px)} +.card h2,.panel-head h2{font-size:clamp(22px,1.7vw,30px);margin:.2em 0 0} +.muted{color:var(--muted);font-size:clamp(15px,1.05vw,22px);margin:.25em 0} +.presenter{font-size:clamp(17px,1.35vw,28px);font-weight:700;margin:.75em 0 0} +.separator{height:1px;background:rgba(255,255,255,.08);margin:20px 0} +.time-cluster{display:grid;grid-template-columns:minmax(260px,390px) 1fr;gap:clamp(24px,2vw,34px);align-items:center} +.analog-shell{display:flex;justify-content:center} +.analog-clock{width:min(29vw,360px);aspect-ratio:1;border-radius:50%;position:relative;background:radial-gradient(circle at 50% 50%,rgba(152,216,75,.10) 0,rgba(152,216,75,.02) 45%,transparent 46%),linear-gradient(145deg,#1a221e,#0e1311);border:1px solid rgba(152,216,75,.26);box-shadow:inset 0 0 0 12px rgba(255,255,255,.02),inset 0 0 70px rgba(116,184,42,.07),0 20px 45px rgba(0,0,0,.28)} +.clock-number,.tick{position:absolute;left:50%;top:50%;transform-origin:center center}.tick{width:2px;height:11px;background:rgba(255,255,255,.16);margin-left:-1px;margin-top:-50%;transform-origin:50% calc(100% + 42%)}.tick.major{height:18px;width:4px;margin-left:-2px;background:rgba(152,216,75,.72)} +.clock-number{width:28px;height:28px;margin:-14px 0 0 -14px;display:flex;align-items:center;justify-content:center;font-weight:800;color:#dce9d8;font-size:clamp(12px,.95vw,18px)} +.analog-center{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:112px;height:112px;border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center;background:radial-gradient(circle,#1d251f,#101512);border:1px solid rgba(255,255,255,.06);z-index:4;text-align:center} +.analog-brand{font-size:13px;color:var(--muted);text-transform:uppercase;letter-spacing:.12em}.analog-center strong{margin-top:6px;font-size:22px;color:var(--green3)} +.hand{position:absolute;left:50%;top:50%;transform-origin:50% calc(100% - 10px);transform:translate(-50%,-100%) rotate(0deg);border-radius:999px;z-index:3} +.hand.hour{width:9px;height:92px;background:linear-gradient(180deg,var(--green3),#4c6d19)} +.hand.minute{width:6px;height:128px;background:linear-gradient(180deg,#fff,#9ca5a0)} +.hand.second{width:2px;height:142px;background:#e45353;box-shadow:0 0 10px rgba(228,83,83,.4)} +.analog-clock::after{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-9px 0 0 -9px;border-radius:50%;background:var(--green2);box-shadow:0 0 0 5px rgba(7,9,9,.9);z-index:5} +.digital-shell{min-width:0} +.clock{font-size:clamp(84px,11vw,184px);font-weight:800;line-height:.85;letter-spacing:-.055em;font-variant-numeric:tabular-nums;text-shadow:0 0 55px rgba(116,184,42,.18)} +.date-line{margin-top:clamp(18px,1.5vw,28px);display:flex;flex-wrap:wrap;gap:12px 26px;font-size:clamp(20px,1.7vw,34px);font-weight:600;color:#d9e2dc}.date-line span:last-child{color:var(--green2)} +.time-meta{margin-top:20px;display:flex;gap:10px;flex-wrap:wrap} +.hero-side{display:flex;flex-direction:column;justify-content:flex-start} +.ampel-block{display:grid;grid-template-columns:1fr auto;align-items:center;gap:18px} +.ampel-head{display:flex;flex-direction:column;gap:6px}.ampel-head strong{font-size:clamp(22px,1.8vw,34px)} +.ampel{display:flex;gap:12px;padding:10px 14px;border-radius:999px;background:rgba(255,255,255,.03);border:1px solid var(--line2)} +.lamp{width:24px;height:24px;border-radius:50%;display:block;opacity:.25;filter:saturate(.7);box-shadow:inset 0 0 0 1px rgba(255,255,255,.12)} +.lamp.red{background:#d53535}.lamp.yellow{background:#d6b62b}.lamp.green{background:#69bb29}.lamp.active{opacity:1;box-shadow:0 0 20px currentColor, inset 0 0 0 1px rgba(255,255,255,.18)} +.countdown-box{margin-top:16px;padding:18px 20px;border-radius:22px;background:rgba(255,255,255,.03);border:1px solid var(--line2)} +#countdown{display:block;font-size:clamp(38px,4.2vw,72px);line-height:1.02;margin:.18em 0;font-variant-numeric:tabular-nums;color:var(--green3)} +.listeners-card{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center}.metric{font-size:clamp(70px,7vw,126px);line-height:1;color:var(--green2);font-variant-numeric:tabular-nums;margin:.12em 0} +.track-card{display:grid;grid-template-columns:minmax(120px,34%) 1fr;gap:clamp(18px,2vw,30px);align-items:center}.track-card img{width:100%;aspect-ratio:1;border-radius:20px;object-fit:cover;background:#202522;box-shadow:0 10px 30px rgba(0,0,0,.24)} +.weather-main{display:flex;align-items:center;gap:18px;margin:16px 0}.weather-main span{font-size:clamp(50px,5vw,88px)}.weather-main strong{font-size:clamp(54px,6vw,104px);line-height:1} +.system-card dl{margin:16px 0 0}.system-card dl div{display:flex;justify-content:space-between;gap:18px;padding:11px 0;border-bottom:1px solid rgba(255,255,255,.08)}dt{color:var(--muted)}dd{margin:0;text-align:right;font-weight:700} +.ticker-card{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:18px;padding:16px 22px} +.ticker-label{font-size:clamp(13px,.95vw,16px);font-weight:900;text-transform:uppercase;letter-spacing:.14em;color:var(--green3)} +.ticker-window{overflow:hidden;position:relative;mask-image:linear-gradient(90deg,transparent 0,#000 4%,#000 96%,transparent 100%)} +.ticker-track{display:flex;gap:48px;white-space:nowrap;min-width:max-content;animation:ticker var(--ticker-duration) linear infinite;font-size:clamp(15px,1.08vw,22px);color:#eaf1e6} +.ticker-track span::before{content:"•";color:var(--green2);margin-right:12px} +@keyframes ticker{0%{transform:translateX(0)}100%{transform:translateX(-50%)}} +.panel-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;margin-bottom:14px}.panel-badge{color:var(--green3);min-width:52px} +.monitor-list{display:grid;gap:11px}.monitor-item{display:grid;grid-template-columns:auto 1fr;gap:12px 16px;padding:14px 16px;border-radius:18px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.06)} +.monitor-item strong{font-size:clamp(14px,1.05vw,18px)}.monitor-item p{margin:4px 0 0;color:var(--muted);font-size:clamp(13px,.95vw,16px)}.monitor-meta{grid-column:2;color:#c9d2cc;font-size:clamp(12px,.88vw,14px)} +.item-tag{display:inline-flex;align-items:center;justify-content:center;min-width:64px;height:28px;padding:0 12px;border-radius:999px;background:rgba(116,184,42,.16);color:var(--green3);font-weight:800;font-size:12px;text-transform:uppercase;letter-spacing:.08em} +.item-tag.camera{background:rgba(230,166,41,.18);color:#f1cf8c} +.monitor-empty{padding:20px;border-radius:18px;background:rgba(255,255,255,.03);border:1px dashed rgba(255,255,255,.14);color:var(--muted)} +footer{text-align:center;color:#758079;font-size:clamp(12px,.9vw,17px);padding:2px 0} +@media(max-width:1400px){.hero-grid{grid-template-columns:1fr}.info-grid{grid-template-columns:1fr 1fr}.time-cluster{grid-template-columns:minmax(240px,330px) 1fr}.analog-clock{width:min(34vw,320px)}} +@media(max-width:1100px){.traffic-board,.info-grid{grid-template-columns:1fr 1fr}.track-card{grid-column:span 2}} +@media(max-width:900px){.studio-head{flex-direction:column;align-items:flex-start}.brand-block{flex-direction:column;align-items:flex-start}.time-cluster{grid-template-columns:1fr}.analog-shell{order:1}.digital-shell{order:2}.info-grid,.traffic-board{grid-template-columns:1fr}.track-card{grid-column:auto}.clock{font-size:18vw}.track-card{grid-template-columns:100px 1fr}.ticker-card{grid-template-columns:1fr;gap:10px}} +@media(max-width:700px){.studio{padding:16px}.studio-logo{width:170px}.clock{font-size:21vw}.card,.ticker-card{border-radius:20px;padding:18px}.analog-clock{width:min(72vw,320px)}.date-line{font-size:18px;gap:10px 18px}.time-meta{gap:8px}.ampel-block{grid-template-columns:1fr}.ampel{width:max-content}.panel-head{flex-direction:column;align-items:flex-start}} diff --git a/web/assets/livestudio-v31.js b/web/assets/livestudio-v31.js new file mode 100644 index 0000000..e4acfce --- /dev/null +++ b/web/assets/livestudio-v31.js @@ -0,0 +1,295 @@ +(() => { + const $ = (id) => document.getElementById(id); + const zone = 'Europe/Berlin'; + const state = { studio: null, traffic: null }; + + function getBerlinParts(now = new Date()) { + const fmt = new Intl.DateTimeFormat('en-GB', { + timeZone: zone, + weekday: 'long', + year: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: false, + }); + const parts = Object.fromEntries(fmt.formatToParts(now).filter(p => p.type !== 'literal').map(p => [p.type, p.value])); + return { + weekdayLong: new Intl.DateTimeFormat('de-DE', { timeZone: zone, weekday: 'long' }).format(now), + dateLong: new Intl.DateTimeFormat('de-DE', { timeZone: zone, day: '2-digit', month: 'long', year: 'numeric' }).format(now), + year: Number(parts.year), month: Number(parts.month), day: Number(parts.day), + hour: Number(parts.hour), minute: Number(parts.minute), second: Number(parts.second), + }; + } + + function isoWeek(date) { + const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())); + d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7)); + const y = new Date(Date.UTC(d.getUTCFullYear(), 0, 1)); + return Math.ceil((((d - y) / 86400000) + 1) / 7); + } + + function buildAnalogFace() { + const clock = $('analogClock'); + if (!clock || clock.dataset.ready === '1') return; + [12,1,2,3,4,5,6,7,8,9,10,11].forEach((n, idx) => { + const el = document.createElement('div'); + el.className = 'clock-number'; + const angle = ((idx * 30) - 90) * Math.PI / 180; + const radius = 39; + el.style.left = `${50 + Math.cos(angle) * radius}%`; + el.style.top = `${50 + Math.sin(angle) * radius}%`; + el.textContent = String(n); + clock.appendChild(el); + }); + clock.dataset.ready = '1'; + } + + function applyNightMode(hour) { + const night = hour >= 20 || hour < 6; + document.body.classList.toggle('is-night', night); + $('nightModeText').textContent = night ? 'Nachtmodus aktiv' : 'Tagesmodus'; + $('nightModePill').textContent = night ? 'Nachtmodus' : 'Automatik aktiv'; + } + + function updateClock() { + const p = getBerlinParts(); + $('clock').textContent = `${String(p.hour).padStart(2, '0')}:${String(p.minute).padStart(2, '0')}:${String(p.second).padStart(2, '0')}`; + $('weekday').textContent = p.weekdayLong; + $('date').textContent = p.dateLong; + const weekNum = String(isoWeek(new Date(p.year, p.month - 1, p.day))).padStart(2, '0'); + $('week').textContent = `KW ${weekNum}`; + $('analogWeek').textContent = `KW ${weekNum}`; + const hourAngle = ((p.hour % 12) + (p.minute / 60) + (p.second / 3600)) * 30; + const minuteAngle = (p.minute + p.second / 60) * 6; + const secondAngle = p.second * 6; + $('hourHand').style.transform = `translate(-50%, -100%) rotate(${hourAngle}deg)`; + $('minuteHand').style.transform = `translate(-50%, -100%) rotate(${minuteAngle}deg)`; + $('secondHand').style.transform = `translate(-50%, -100%) rotate(${secondAngle}deg)`; + applyNightMode(p.hour); + updateCountdown(); + } + + function parseLocalTimeToDate(timeStr) { + if (!timeStr || !/^\d{2}:\d{2}$/.test(timeStr)) return null; + const p = getBerlinParts(); + const [h, m] = timeStr.split(':').map(Number); + const candidate = new Date(p.year, p.month - 1, p.day, h, m, 0); + return candidate; + } + + function formatDiff(ms) { + if (ms <= 0) return '00:00:00'; + const total = Math.floor(ms / 1000); + const hh = Math.floor(total / 3600); + const mm = Math.floor((total % 3600) / 60); + const ss = total % 60; + return `${String(hh).padStart(2, '0')}:${String(mm).padStart(2, '0')}:${String(ss).padStart(2, '0')}`; + } + + function updateCountdown() { + const d = state.studio; + if (!d) return; + const now = new Date(); + let target = null; + let label = 'Countdown'; + let hint = 'Nächste Studiomarke wird berechnet'; + + if (d.program?.current?.end) { + target = parseLocalTimeToDate(d.program.current.end); + label = 'Bis zur nächsten Sendung'; + hint = d.program.next?.show ? `Danach: ${d.program.next.show}` : 'Danach folgt das nächste Programmelement'; + if (target && target < now && d.program.next?.start) { + target = parseLocalTimeToDate(d.program.next.start); + if (target && target < now) target.setDate(target.getDate() + 1); + } + } else if (d.program?.next?.start) { + target = parseLocalTimeToDate(d.program.next.start); + label = 'Bis zum Sendestart'; + hint = d.program.next?.show ? `Nächster Start: ${d.program.next.show}` : 'Nächste Sendung'; + if (target && target < now) target.setDate(target.getDate() + 1); + } else { + target = new Date(now); + target.setHours(now.getHours() + 1, 0, 0, 0); + label = 'Bis zur vollen Stunde'; + hint = 'Fallback ohne Programmdaten'; + } + + $('countdownLabel').textContent = label; + $('countdownHint').textContent = hint; + $('countdown').textContent = target ? formatDiff(target.getTime() - now.getTime()) : '--:--:--'; + } + + function setAmpel(status) { + ['lampRed', 'lampYellow', 'lampGreen'].forEach(id => $(id).classList.remove('active')); + if (status === 'onair') { + $('lampRed').classList.add('active'); + $('ampelLabel').textContent = 'On Air'; + } else if (status === 'standby') { + $('lampYellow').classList.add('active'); + $('ampelLabel').textContent = 'Standby'; + } else { + $('lampGreen').classList.add('active'); + $('ampelLabel').textContent = 'Bereit'; + } + } + + function renderTicker() { + const items = []; + const d = state.studio; + const t = state.traffic; + if (d) { + items.push(`Jetzt: ${d.program?.current?.show || d.now_playing?.show || 'Landwelle Radio'}`); + if (d.program?.current?.presenter) items.push(`Moderator: ${d.program.current.presenter}`); + if (d.program?.next?.show) items.push(`Als Nächstes: ${d.program.next.show} ab ${d.program.next.start} Uhr`); + if (Number.isFinite(d.now_playing?.listeners)) items.push(`${d.now_playing.listeners} Zuhörer live verbunden`); + if (d.now_playing?.title) items.push(`Aktueller Titel: ${d.now_playing.title}${d.now_playing.artist ? ' · ' + d.now_playing.artist : ''}`); + if (d.weather?.description) items.push(`Wetter ${d.weather.location}: ${Math.round(d.weather.temperature)}° · ${d.weather.description}`); + } + if (t) { + if (Array.isArray(t.traffic) && t.traffic.length) items.push(`Verkehr: ${t.traffic.length} aktuelle Meldungen in Niedersachsen`); + if (Array.isArray(t.speed_cameras) && t.speed_cameras.length) items.push(`Blitzer: ${t.speed_cameras.length} gemeldete Kontrollen`); + if (Array.isArray(t.traffic) && t.traffic[0]) items.push(`Hinweis: ${t.traffic[0].road} · ${t.traffic[0].title}`); + } + if (!items.length) items.push('Landwelle Livestudio · Daten werden geladen'); + const track = $('tickerTrack'); + const sequence = items.concat(items); + track.innerHTML = sequence.map(item => `${escapeHTML(item)}`).join(''); + const duration = Math.max(32, items.join(' ').length * 0.22); + document.documentElement.style.setProperty('--ticker-duration', `${duration}s`); + } + + function escapeHTML(str) { + return String(str).replace(/[&<>"']/g, c => ({ '&':'&','<':'<','>':'>','"':'"',"'":''' }[c])); + } + + function formatTime(ts) { + if (!ts) return 'ohne Zeit'; + try { + return new Intl.DateTimeFormat('de-DE', { timeZone: zone, hour: '2-digit', minute: '2-digit' }).format(new Date(ts)); + } catch { + return 'ohne Zeit'; + } + } + + function trimText(text, max = 120) { + const t = String(text || '').trim(); + return t.length > max ? `${t.slice(0, max - 1)}…` : t; + } + + function weatherIconFor(weather) { + const icon = String(weather?.icon || '').trim().toLowerCase(); + const desc = String(weather?.description || '').trim().toLowerCase(); + const combined = `${icon} ${desc}`; + const entries = [ + [['clear-day', 'sunny', 'sonnig', 'heiter'], '☀'], + [['clear-night', 'night-clear', 'klar'], '☾'], + [['partly-cloudy-day', 'partly cloudy', 'teilweise bewölkt', 'leicht bewölkt', 'wolkig'], '⛅'], + [['partly-cloudy-night'], '☁'], + [['cloudy', 'overcast', 'bewölkt', 'bedeckt'], '☁'], + [['fog', 'mist', 'nebel', 'dunst'], '🌫'], + [['drizzle', 'niesel', 'nieselregen'], '🌦'], + [['rain', 'regen', 'schauer', 'showers'], '🌧'], + [['thunderstorm', 'gewitter', 'storm'], '⛈'], + [['snow', 'schnee', 'sleet', 'hail', 'hagel'], '❄'], + [['wind', 'windig'], '🍃'], + ]; + for (const [patterns, symbol] of entries) { + if (patterns.some(pattern => combined.includes(pattern))) return symbol; + } + return '☁'; + } + + function renderTrafficList(rootId, items, camera = false) { + const root = $(rootId); + if (!Array.isArray(items) || !items.length) { + root.innerHTML = `
${camera ? 'Aktuell liegen keine Blitzermeldungen vor.' : 'Aktuell liegen keine Verkehrsmeldungen vor.'}
`; + return; + } + const top = items.slice(0, 4); + root.innerHTML = top.map(item => { + const heading = camera ? (item.title || 'Blitzermeldung') : `${item.road || 'Straße'} · ${item.title || item.kind || 'Meldung'}`; + const details = camera ? (item.description || item.region || 'Gemeldete Kontrolle') : (item.description || item.direction || item.kind || 'Verkehrsmeldung'); + const meta = camera + ? `${item.region || 'Niedersachsen'} · ${formatTime(item.published_at)}` + : `${item.kind || 'Verkehr'} · ${formatTime(item.updated_at)}`; + return `
${camera ? 'Blitzer' : (item.road || 'Verkehr')}
${escapeHTML(trimText(heading, 92))}

${escapeHTML(trimText(details, 140))}

${escapeHTML(meta)}
`; + }).join(''); + } + + async function refreshStudio() { + try { + const res = await fetch('/api/v1/livestudio', { cache: 'no-store', headers: { Accept: 'application/json' } }); + if (!res.ok) throw new Error('HTTP ' + res.status); + const body = await res.json(); + const d = body.data; + state.studio = d; + $('show').textContent = d.program.current?.show || d.now_playing.show || 'Landwelle Radio'; + $('showTime').textContent = d.program.current ? `${d.program.current.start} – ${d.program.current.end} Uhr` : 'Durchgehend die beste Musik'; + $('presenter').textContent = d.program.current?.presenter ? `Mit ${d.program.current.presenter}` : ''; + $('listeners').textContent = Number.isFinite(d.now_playing.listeners) ? d.now_playing.listeners : '–'; + $('title').textContent = d.now_playing.title || 'Landwelle Radio'; + $('artist').textContent = d.now_playing.artist || 'Niedersachsen hört Landwelle'; + if (d.now_playing.cover_url) $('cover').src = d.now_playing.cover_url; + $('streamStatus').textContent = d.now_playing.online ? 'Stream online' : 'Stream derzeit nicht erreichbar'; + $('statusWrap').className = 'studio-status ' + (d.now_playing.online ? 'online' : 'offline'); + $('source').textContent = d.now_playing.source === 'azuracast' ? 'AzuraCast live' : 'Zwischenspeicher'; + $('updated').textContent = new Intl.DateTimeFormat('de-DE', { timeZone: zone, hour:'2-digit', minute:'2-digit', second:'2-digit' }).format(new Date(d.generated_at)); + $('health').textContent = d.now_playing.online ? 'live' : 'offline'; + if (d.weather) { + $('temperature').textContent = `${Math.round(d.weather.temperature)}°`; + $('weatherText').textContent = d.weather.description || 'Wetter'; + $('weatherMeta').textContent = `${d.weather.location} · Wind ${Math.round(d.weather.wind_speed)} km/h`; + $('weatherIcon').textContent = weatherIconFor(d.weather); + } + $('nextShow').textContent = d.program.next?.show || 'Weitere Musik nonstop'; + $('nextTime').textContent = d.program.next ? `${d.program.next.start} – ${d.program.next.end} Uhr${d.program.next.presenter ? ' · ' + d.program.next.presenter : ''}` : 'Landwelle begleitet euch weiter durch den Tag'; + if (d.now_playing.online && d.program.current) { + setAmpel('onair'); + } else if (d.now_playing.online) { + setAmpel('standby'); + } else { + setAmpel('ready'); + } + updateCountdown(); + renderTicker(); + } catch (e) { + $('streamStatus').textContent = 'Datenverbindung unterbrochen'; + $('statusWrap').className = 'studio-status offline'; + $('health').textContent = 'gestört'; + setAmpel('ready'); + } + } + + async function refreshTraffic() { + try { + const res = await fetch('/api/v1/traffic', { cache: 'no-store', headers: { Accept: 'application/json' } }); + if (!res.ok) throw new Error('HTTP ' + res.status); + const body = await res.json(); + const d = body.data || {}; + state.traffic = d; + const traffic = Array.isArray(d.traffic) ? d.traffic : []; + const cameras = Array.isArray(d.speed_cameras) ? d.speed_cameras : []; + $('trafficCount').textContent = String(traffic.length); + $('cameraCount').textContent = String(cameras.length); + renderTrafficList('trafficList', traffic, false); + renderTrafficList('cameraList', cameras, true); + renderTicker(); + } catch (e) { + $('trafficCount').textContent = '–'; + $('cameraCount').textContent = '–'; + $('trafficList').innerHTML = '
Verkehrsdaten sind momentan nicht erreichbar.
'; + $('cameraList').innerHTML = '
Blitzerdaten sind momentan nicht erreichbar.
'; + } + } + + buildAnalogFace(); + updateClock(); + setInterval(updateClock, 1000); + refreshStudio(); + refreshTraffic(); + setInterval(refreshStudio, 15000); + setInterval(refreshTraffic, 180000); +})(); diff --git a/web/assets/mediathek-hero-landwelle-v1.webp b/web/assets/mediathek-hero-landwelle-v1.webp new file mode 100644 index 0000000..4f02be4 Binary files /dev/null and b/web/assets/mediathek-hero-landwelle-v1.webp differ diff --git a/web/assets/mediathek-v1.js b/web/assets/mediathek-v1.js new file mode 100644 index 0000000..f81709b --- /dev/null +++ b/web/assets/mediathek-v1.js @@ -0,0 +1,15 @@ +(() => { + 'use strict'; + const buttons = [...document.querySelectorAll('[data-media-filter]')]; + const cards = [...document.querySelectorAll('[data-media-kind]')]; + if (!buttons.length || !cards.length) return; + buttons.forEach((button) => button.addEventListener('click', () => { + const filter = button.dataset.mediaFilter || 'all'; + buttons.forEach((item) => item.classList.toggle('is-active', item === button)); + cards.forEach((card) => { + const visible = filter === 'all' || card.dataset.mediaKind === filter; + card.hidden = !visible; + if (!visible) card.querySelector('audio')?.pause(); + }); + })); +})(); diff --git a/web/assets/mediathek-v4.css b/web/assets/mediathek-v4.css new file mode 100644 index 0000000..ef2214e --- /dev/null +++ b/web/assets/mediathek-v4.css @@ -0,0 +1,278 @@ +.mediathek-page { + background: #f1f5ed; + color: #1c271b; +} + +.mediathek-hero { + position: relative; + isolation: isolate; + min-height: clamp(420px, 43vw, 570px); + display: flex; + align-items: flex-end; + overflow: hidden; + padding: 145px 0 70px; + background: #16231a; + color: #fff; +} + +.mediathek-hero-image { + position: absolute; + inset: 0; + z-index: -3; + width: 100%; + height: 100%; + object-fit: cover; + object-position: center 52%; +} + +.mediathek-hero-shade { + position: absolute; + inset: 0; + z-index: -2; + background: + linear-gradient(90deg, rgba(8, 18, 11, .89) 0%, rgba(8, 18, 11, .72) 28%, rgba(8, 18, 11, .32) 54%, rgba(8, 18, 11, .08) 77%), + linear-gradient(0deg, rgba(8, 18, 11, .66) 0%, rgba(8, 18, 11, .08) 58%, rgba(8, 18, 11, .14) 100%); +} + +.mediathek-hero::after { + content: ""; + position: absolute; + right: 0; + bottom: 0; + left: 0; + z-index: -1; + height: 5px; + background: linear-gradient(90deg, #8fc63e, #d8b765 52%, #f0ddae); +} + +.mediathek-hero .page-shell { + position: relative; + z-index: 1; + flex: 0 1 auto; +} + +.mediathek-hero .page-shell > * { + max-width: 720px; +} + +.mediathek-hero span, +.mediathek-content header span { + color: #b7e56f; + font-size: .74rem; + font-weight: 900; + letter-spacing: .14em; + text-transform: uppercase; +} + +.mediathek-hero h1 { + margin: 8px 0 12px; + font-size: clamp(3rem, 7vw, 5.6rem); + line-height: .98; + text-shadow: 0 3px 24px rgba(0, 0, 0, .34); +} + +.mediathek-hero p { + max-width: 680px; + margin: 0; + color: #edf3ea; + font-size: 1.15rem; + line-height: 1.7; + text-shadow: 0 2px 15px rgba(0, 0, 0, .35); +} + +.mediathek-content { + padding-top: 50px; + padding-bottom: 64px; +} + +.mediathek-content > header { + display: flex; + align-items: end; + justify-content: space-between; + gap: 24px; + margin-bottom: 26px; +} + +.mediathek-content h2 { + margin: 6px 0 0; + font-size: clamp(2rem, 4vw, 3rem); +} + +.mediathek-filters { + display: flex; + gap: 7px; + flex-wrap: wrap; +} + +.mediathek-filters button { + border: 1px solid #d2ddce; + border-radius: 999px; + padding: 9px 13px; + background: #fff; + color: #334331; + font-weight: 800; + cursor: pointer; +} + +.mediathek-filters button.is-active { + border-color: #77b72c; + background: #77b72c; + color: #10200d; +} + +.mediathek-grid { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 18px; +} + +.mediathek-card { + display: grid; + grid-template-columns: 190px minmax(0, 1fr); + overflow: hidden; + border: 1px solid #d8e2d4; + border-radius: 21px; + background: #fff; + box-shadow: 0 14px 35px rgba(34, 55, 29, .07); +} + +.mediathek-card[hidden] { + display: none; +} + +.mediathek-card.is-featured { + grid-column: 1 / -1; + grid-template-columns: 280px minmax(0, 1fr); + border-color: #82ba37; +} + +.mediathek-cover { + position: relative; + min-height: 220px; + background: #18261a; +} + +.mediathek-cover img { + width: 100%; + height: 100%; + object-fit: cover; +} + +.mediathek-cover span { + position: absolute; + top: 12px; + left: 12px; + padding: 6px 9px; + border-radius: 999px; + background: rgba(13, 24, 14, .86); + color: #b9eb78; + font-size: .65rem; + font-weight: 900; + text-transform: uppercase; +} + +.mediathek-copy { + padding: 22px; +} + +.mediathek-copy small { + color: #71806f; +} + +.mediathek-copy h3 { + margin: 6px 0 4px; + font-size: 1.35rem; +} + +.mediathek-copy > strong { + display: block; + color: #5f8e23; +} + +.mediathek-copy p { + color: #5b685a; + line-height: 1.65; +} + +.mediathek-copy audio { + width: 100%; + margin-top: 8px; +} + +.mediathek-empty { + padding: 55px 24px; + border: 1px dashed #c5d3bf; + border-radius: 22px; + background: #fff; + text-align: center; +} + +.mediathek-empty > span { + font-size: 2.5rem; + color: #78b72b; +} + +.mediathek-empty a { + color: #568b17; + font-weight: 900; + text-decoration: none; +} + +@media (max-width: 900px) { + .mediathek-grid { + grid-template-columns: 1fr; + } + + .mediathek-card.is-featured { + grid-column: auto; + grid-template-columns: 190px minmax(0, 1fr); + } +} + +@media (max-width: 650px) { + .mediathek-hero { + min-height: 390px; + padding: 115px 0 48px; + } + + .mediathek-hero-image { + object-position: 60% center; + } + + .mediathek-hero-shade { + background: + linear-gradient(90deg, rgba(8, 18, 11, .91) 0%, rgba(8, 18, 11, .72) 54%, rgba(8, 18, 11, .25) 100%), + linear-gradient(0deg, rgba(8, 18, 11, .74) 0%, rgba(8, 18, 11, .06) 68%); + } + + .mediathek-hero h1 { + font-size: clamp(2.65rem, 14vw, 4rem); + } + + .mediathek-hero p { + max-width: 92%; + font-size: 1rem; + line-height: 1.6; + } + + .mediathek-content > header { + align-items: flex-start; + flex-direction: column; + } + + .mediathek-card, + .mediathek-card.is-featured { + grid-template-columns: 1fr; + } + + .mediathek-cover { + min-height: 210px; + } + + .mediathek-copy { + padding: 19px; + } +} +/* v1.5.24 – sichtbare KI-Audiohinweise */ +.mediathek-ai-disclosure{margin:14px 0 10px;padding:13px;border:1px solid #d9cee9;border-radius:13px;background:#f7f3fc}.mediathek-ai-disclosure>span{display:inline-flex;padding:5px 8px;border-radius:999px;background:#70509c;color:#fff;font-size:.68rem;font-weight:900;text-transform:uppercase}.mediathek-ai-disclosure p{margin:8px 0 4px;color:#4f4657;font-size:.86rem;line-height:1.5}.mediathek-ai-disclosure small{display:block;color:#74697c;font-size:.72rem}.mediathek-ai-disclosure a{display:inline-flex;margin-top:8px;color:#603e86;font-size:.75rem;font-weight:850;text-decoration:none} +.mediathek-hero-ai{display:inline-flex!important;width:max-content;margin:9px 0 2px;padding:5px 8px;border:1px solid rgba(255,255,255,.28);border-radius:999px;background:rgba(12,18,13,.58);color:#fff!important;font-size:.68rem!important;font-weight:800;letter-spacing:0!important;text-transform:none!important} diff --git a/web/assets/mitmachen-hero-v1.png b/web/assets/mitmachen-hero-v1.png new file mode 100644 index 0000000..398133e Binary files /dev/null and b/web/assets/mitmachen-hero-v1.png differ diff --git a/web/assets/mitmachen-v1.css b/web/assets/mitmachen-v1.css new file mode 100644 index 0000000..20d4aef --- /dev/null +++ b/web/assets/mitmachen-v1.css @@ -0,0 +1,45 @@ + +.wish-page .wish-hero{ + position:relative; + isolation:isolate; + min-height:clamp(340px,42vw,540px); + display:flex; + align-items:flex-end; + overflow:hidden; + background:#142019 url("/assets/mitmachen-hero-v1.png") center 52%/cover no-repeat; +} +.wish-page .wish-hero::before{ + content:""; + position:absolute; + inset:0; + z-index:-1; + background: + linear-gradient(90deg,rgba(7,13,10,.78) 0%,rgba(7,13,10,.44) 38%,rgba(7,13,10,.12) 72%), + linear-gradient(0deg,rgba(7,13,10,.66) 0%,transparent 58%); +} +.wish-page .wish-hero .page-shell{ + padding-top:96px; + padding-bottom:72px; +} +.wish-page .wish-hero span, +.wish-page .wish-hero h1, +.wish-page .wish-hero p{ + text-shadow:0 2px 18px rgba(0,0,0,.52); +} +.wish-page .wish-hero p{max-width:720px} +@media(max-width:760px){ + .wish-page .wish-hero{ + min-height:390px; + background-position:66% 50%; + } + .wish-page .wish-hero::before{ + background: + linear-gradient(90deg,rgba(7,13,10,.82),rgba(7,13,10,.34)), + linear-gradient(0deg,rgba(7,13,10,.74),transparent 60%); + } + .wish-page .wish-hero .page-shell{ + padding-top:110px; + padding-bottom:58px; + } + .wish-page .wish-hero p{max-width:92%} +} diff --git a/web/assets/mobile-app-v1.css b/web/assets/mobile-app-v1.css new file mode 100644 index 0000000..e9867d9 --- /dev/null +++ b/web/assets/mobile-app-v1.css @@ -0,0 +1 @@ +.mobile-product-page{background:#f4f6f2;color:#172018}.mobile-product-hero{position:relative;overflow:hidden;background:radial-gradient(circle at 76% 20%,rgba(139,202,47,.18),transparent 32%),linear-gradient(135deg,#08110d 0%,#102018 48%,#173320 100%);color:#fff}.mobile-product-hero::after{content:"";position:absolute;inset:auto -10% -45% 35%;height:520px;background:radial-gradient(ellipse,rgba(129,188,34,.18),transparent 68%);pointer-events:none}.mobile-hero-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(420px,.95fr);align-items:center;gap:64px;min-height:620px;padding-top:95px;padding-bottom:70px}.mobile-hero-copy{position:relative;z-index:2}.mobile-eyebrow,.section-kicker{display:block;margin-bottom:12px;color:#93cd36;font-size:12px;font-weight:900;letter-spacing:.12em;text-transform:uppercase}.mobile-hero-copy h1{max-width:650px;margin:0;color:#fff;font-size:clamp(48px,6.2vw,84px);line-height:.96;letter-spacing:-.055em}.mobile-hero-copy h1 strong{color:#97d135}.mobile-hero-copy>p{max-width:650px;margin:24px 0 0;color:#d7e0d8;font-size:19px;line-height:1.65}.mobile-status-row{display:flex;flex-wrap:wrap;gap:9px;margin-top:26px}.mobile-status-row span{padding:8px 12px;border:1px solid rgba(255,255,255,.15);border-radius:999px;background:rgba(255,255,255,.07);font-size:11px;font-weight:850}.mobile-status-row .is-active{background:#91ca31;color:#10200e;border-color:#91ca31}.mobile-status-row i{display:inline-block;width:7px;height:7px;margin-right:6px;border-radius:50%;background:#fff}.mobile-hero-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:30px}.mobile-hero-actions a,.mobile-install-actions a{display:inline-flex;align-items:center;justify-content:center;min-height:48px;padding:0 19px;border-radius:999px;font-weight:900;text-decoration:none}.mobile-primary-action{background:#91ca31;color:#11200f}.mobile-secondary-action{border:1px solid rgba(255,255,255,.22);background:rgba(255,255,255,.07);color:#fff}.phone-stage{position:relative;z-index:2;height:520px}.phone{position:absolute;width:250px;height:500px;padding:9px;border:1px solid rgba(255,255,255,.24);border-radius:42px;background:linear-gradient(145deg,#202620,#050706);box-shadow:0 35px 70px rgba(0,0,0,.42)}.phone-front{right:35px;top:5px;z-index:3;transform:rotate(3deg)}.phone-back{left:25px;top:30px;z-index:2;transform:rotate(-8deg) scale(.93);opacity:.92}.phone-screen{position:relative;height:100%;overflow:hidden;border-radius:34px;background:linear-gradient(180deg,#0b1711,#13271b);padding:28px 18px 18px}.phone-notch{position:absolute;z-index:5;top:10px;left:50%;width:90px;height:22px;border-radius:0 0 14px 14px;background:#030504;transform:translateX(-50%)}.phone-top{display:flex;align-items:center;justify-content:space-between}.phone-top img{width:92px;height:auto}.phone-top span{padding:4px 7px;border-radius:999px;background:#8bc62a;color:#10200e;font-size:9px;font-weight:900}.phone-now-label{display:block;margin-top:28px;color:#94ca39;font-size:10px;font-weight:900;text-transform:uppercase}.phone-cover{display:grid;place-items:center;width:155px;height:155px;margin:16px auto;border-radius:22px;background:linear-gradient(135deg,#45673b,#96c950);box-shadow:0 18px 35px rgba(0,0,0,.32)}.phone-cover span{font-size:56px}.player-screen h3{margin:16px 0 3px;color:#fff;text-align:center}.player-screen>p{margin:0;color:#aeb9b0;font-size:11px;text-align:center}.phone-progress{height:4px;margin:21px 0;border-radius:999px;background:#314238}.phone-progress i{display:block;width:58%;height:100%;border-radius:inherit;background:#94ce35}.phone-controls{display:flex;align-items:center;justify-content:center;gap:28px}.phone-controls b{display:grid;place-items:center;width:48px;height:48px;border-radius:50%;background:#94ce35;color:#11200f}.phone-controls span{color:#c9d2ca}.phone-program{display:grid;gap:3px;margin-top:22px;padding:12px;border-radius:14px;background:rgba(255,255,255,.07)}.phone-program span{color:#93ca36;font-size:9px}.phone-program b{font-size:11px}.phone-tabs{display:flex;gap:5px;margin:24px 0 14px;padding:4px;border-radius:999px;background:#1a2c20}.phone-tabs>*{flex:1;padding:6px;border-radius:999px;text-align:center;font-size:9px}.phone-tabs b{background:#8fc92f;color:#11200f}.phone-tabs span{color:#aeb9b0}.phone-chart-list{display:grid;gap:8px;padding:0;list-style:none}.phone-chart-list li{display:grid;grid-template-columns:24px 1fr auto;align-items:center;gap:8px;padding:10px;border-radius:12px;background:rgba(255,255,255,.06)}.phone-chart-list em{color:#94cc35;font-style:normal;font-weight:900}.phone-chart-list div{display:grid;gap:2px}.phone-chart-list b{font-size:10px}.phone-chart-list span{color:#9fa9a0;font-size:8px}.phone-chart-list strong{color:#94cc35;font-size:8px}.phone-glow{position:absolute;right:10px;bottom:5px;width:410px;height:180px;border-radius:50%;background:rgba(133,197,37,.2);filter:blur(50px)}.mobile-availability-section,.mobile-features-section,.mobile-roadmap-section,.mobile-install-section{padding:76px 0}.mobile-availability-section{background:#fff}.mobile-availability-grid{display:grid;grid-template-columns:minmax(0,.9fr) minmax(480px,1.1fr);align-items:center;gap:60px}.mobile-availability-grid h2,.mobile-section-head h2,.mobile-roadmap-grid h2,.mobile-install-card h2{margin:0;font-size:clamp(32px,4vw,50px);line-height:1.05;letter-spacing:-.035em}.mobile-availability-grid p,.mobile-section-head p,.mobile-roadmap-grid>div>p,.mobile-install-card p{color:#667067;line-height:1.7}.platform-status-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.platform-status-card{display:grid;gap:7px;padding:24px;border:1px solid #dce4da;border-radius:18px;background:#f8faf7}.platform-status-card span{color:#768076;font-size:11px;font-weight:900}.platform-status-card strong{font-size:17px}.platform-status-card small{color:#7d857b}.platform-status-card.is-ready{border-color:#c9e29f;background:#f2f8e8}.platform-status-card.is-ready strong{color:#57851b}.mobile-section-head{max-width:760px;margin-bottom:32px}.mobile-feature-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:17px}.mobile-feature-grid article{padding:26px;border:1px solid #dce3da;border-radius:19px;background:#fff;box-shadow:0 10px 26px rgba(20,35,18,.045);transition:transform .2s ease,box-shadow .2s ease}.mobile-feature-grid article:hover{transform:translateY(-4px);box-shadow:0 18px 35px rgba(20,35,18,.09)}.mobile-feature-grid i{display:grid;place-items:center;width:45px;height:45px;border-radius:14px;background:#eaf5d8;color:#63951f;font-size:20px;font-style:normal;font-weight:900}.mobile-feature-grid h3{margin:18px 0 8px;font-size:20px}.mobile-feature-grid p{margin:0;color:#70786e;line-height:1.6}.mobile-roadmap-section{background:#101b15;color:#fff}.mobile-roadmap-grid{display:grid;grid-template-columns:minmax(0,.8fr) minmax(500px,1.2fr);gap:70px}.mobile-roadmap-grid h2{color:#fff}.mobile-roadmap-grid>div>p{color:#c1cac2}.mobile-roadmap{display:grid;gap:0;margin:0;padding:0;list-style:none}.mobile-roadmap li{position:relative;display:grid;grid-template-columns:54px 1fr;gap:16px;padding:0 0 30px}.mobile-roadmap li:not(:last-child)::after{content:"";position:absolute;left:26px;top:44px;bottom:4px;width:2px;background:#344338}.mobile-roadmap li>span{display:grid;place-items:center;width:54px;height:54px;border:1px solid #415047;border-radius:50%;color:#aab4ab;font-weight:900}.mobile-roadmap b{display:block;margin:5px 0 5px;font-size:18px}.mobile-roadmap p{margin:0;color:#aeb8af}.mobile-roadmap .is-done>span,.mobile-roadmap .is-current>span{border-color:#8fc92e;background:#8fc92e;color:#13200f}.mobile-roadmap .is-current b{color:#9bd43c}.mobile-install-section{padding-top:54px}.mobile-install-card{display:flex;align-items:center;justify-content:space-between;gap:50px;padding:42px;border-radius:24px;background:linear-gradient(135deg,#eaf4dc,#f9fbf7);border:1px solid #d7e4c9}.mobile-install-card>div:first-child{max-width:760px}.mobile-install-actions{display:grid;gap:10px;min-width:220px}.mobile-install-actions a:first-child{background:#172219;color:#fff}.mobile-install-actions a:last-child{border:1px solid #bdcbb9;color:#263127;background:#fff}@media(max-width:1050px){.mobile-hero-grid{grid-template-columns:1fr;min-height:auto}.phone-stage{width:min(620px,100%);margin:0 auto}.mobile-availability-grid,.mobile-roadmap-grid{grid-template-columns:1fr}.mobile-availability-grid{gap:34px}.mobile-feature-grid{grid-template-columns:repeat(2,1fr)}}@media(max-width:720px){.mobile-hero-grid{padding-top:76px;padding-bottom:38px;gap:35px}.mobile-hero-copy h1{font-size:52px}.mobile-hero-copy>p{font-size:16px}.phone-stage{height:400px}.phone{width:190px;height:380px;border-radius:33px}.phone-screen{padding:24px 13px 13px;border-radius:27px}.phone-front{right:12px}.phone-back{left:4px}.phone-cover{width:112px;height:112px}.phone-program{display:none}.phone-chart-list li:nth-child(4){display:none}.mobile-availability-section,.mobile-features-section,.mobile-roadmap-section,.mobile-install-section{padding:54px 0}.platform-status-grid,.mobile-feature-grid{grid-template-columns:1fr}.mobile-install-card{align-items:flex-start;flex-direction:column;padding:28px}.mobile-install-actions{width:100%;min-width:0}.mobile-roadmap-grid{gap:36px}} diff --git a/web/assets/news-landwirtschaft-v14.jpg b/web/assets/news-landwirtschaft-v14.jpg new file mode 100644 index 0000000..bf32756 Binary files /dev/null and b/web/assets/news-landwirtschaft-v14.jpg differ diff --git a/web/assets/news-region-v14.jpg b/web/assets/news-region-v14.jpg new file mode 100644 index 0000000..2f64697 Binary files /dev/null and b/web/assets/news-region-v14.jpg differ diff --git a/web/assets/news-region.jpg b/web/assets/news-region.jpg new file mode 100644 index 0000000..2a4cfc9 Binary files /dev/null and b/web/assets/news-region.jpg differ diff --git a/web/assets/news-v2.css b/web/assets/news-v2.css new file mode 100644 index 0000000..53d4660 --- /dev/null +++ b/web/assets/news-v2.css @@ -0,0 +1 @@ +.news-page,.news-article-page{background:#f4f6f2;color:#182019}.news-hero{position:relative;isolation:isolate;overflow:hidden;min-height:clamp(320px,40vw,520px);display:flex;align-items:flex-end;background:#102018 url("/assets/aktuelles-hero-v2.png") center 52%/cover no-repeat;color:#fff}.news-hero::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(5,13,11,.82) 0%,rgba(5,13,11,.48) 42%,rgba(5,13,11,.12) 72%),linear-gradient(0deg,rgba(5,13,11,.72) 0%,transparent 58%)}.news-hero .page-shell{padding-top:92px;padding-bottom:54px}.news-hero span,.news-hero h1,.news-hero p{text-shadow:0 2px 18px rgba(0,0,0,.5)}.news-hero p{max-width:760px}.news-intro-layout{align-items:start}.news-main-card{min-width:0}.news-lead-story{position:relative;min-height:500px;margin-top:26px;overflow:hidden;border-radius:20px;background:#152019;box-shadow:0 16px 38px rgba(20,35,18,.13)}.news-lead-story>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.news-lead-overlay{position:absolute;inset:0;background:linear-gradient(0deg,rgba(5,10,7,.94) 0%,rgba(5,10,7,.22) 70%,transparent)}.news-lead-copy{position:absolute;left:0;right:0;bottom:0;padding:30px;color:#fff}.news-lead-copy h3{max-width:760px;margin:12px 0;font-size:clamp(28px,4vw,46px);line-height:1.06}.news-lead-copy p{max-width:720px;margin:0;color:#d8dfd9;line-height:1.6}.news-lead-copy>a{display:inline-flex;margin-top:15px;padding:10px 15px;border-radius:999px;background:#85bf24;color:#10200e;font-weight:900;text-decoration:none}.news-meta{display:flex;flex-wrap:wrap;align-items:center;gap:8px;color:#7a847b;font-size:11px;font-weight:800}.news-meta span,.news-meta b{padding:5px 8px;border-radius:999px;background:#eaf4dc;color:#507b1d;text-transform:uppercase}.news-lead-copy .news-meta{color:#d2dad3}.news-lead-copy .news-meta span,.news-lead-copy .news-meta b{background:rgba(139,198,40,.22);color:#c3ed7e}.news-top-section{margin-top:34px}.news-section-heading span{color:#78aa29;font-size:11px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.news-section-heading h2{margin:6px 0 18px;font-size:28px}.news-top-list{display:grid;gap:14px}.news-top-item{display:grid;grid-template-columns:140px minmax(0,1fr);gap:16px;padding:14px;border:1px solid #dfe6dc;border-radius:16px;background:#fff;box-shadow:0 8px 22px rgba(20,35,18,.05)}.news-top-item>img{width:140px;height:125px;border-radius:11px;object-fit:cover}.news-top-item h3{margin:8px 0 5px;font-size:19px;line-height:1.2}.news-top-item p{display:-webkit-box;overflow:hidden;margin:0;color:#687168;font-size:13px;line-height:1.5;-webkit-box-orient:vertical;-webkit-line-clamp:2}.news-top-item a,.news-entry a{display:inline-block;margin-top:8px;color:#5b8d1c;font-weight:900;text-decoration:none}.news-side-card ul{display:grid;gap:9px;margin:18px 0;padding:0;list-style:none}.news-side-card li{position:relative;padding-left:22px;color:#d8e0d9;font-size:14px}.news-side-card li::before{content:"✓";position:absolute;left:0;color:#96cf35;font-weight:900}.news-wall{padding-top:42px}.news-wall-head{margin-bottom:22px}.news-list{display:grid;gap:14px}.news-entry{display:grid;grid-template-columns:180px minmax(0,1fr);gap:20px;padding:15px;border:1px solid #dfe5dc;border-radius:16px;background:#fff;box-shadow:0 8px 25px rgba(26,35,24,.05)}.news-entry>img{width:180px;height:145px;border-radius:11px;object-fit:cover}.news-entry-main{min-width:0}.news-entry-main header{display:flex;align-items:flex-start;justify-content:space-between;gap:15px}.news-entry-main small{color:#899188;font-size:11px}.news-entry h3{margin:10px 0 7px;font-size:22px;line-height:1.2}.news-entry p{display:-webkit-box;overflow:hidden;margin:0;color:#667066;line-height:1.55;-webkit-box-orient:vertical;-webkit-line-clamp:2}.news-tip-card{display:flex;align-items:center;justify-content:space-between;gap:35px;margin-top:52px;margin-bottom:60px;padding:34px 38px;border-radius:22px;background:linear-gradient(130deg,#122018,#263e25);color:#fff}.news-tip-card span{color:#96cf35;font-size:11px;font-weight:900;text-transform:uppercase}.news-tip-card h2{margin:6px 0 8px;font-size:30px}.news-tip-card p{max-width:760px;margin:0;color:#ccd7cd}.news-tip-card>a{flex:0 0 auto;padding:12px 17px;border-radius:999px;background:#85bf24;color:#10200e;font-weight:900;text-decoration:none}.news-article-header{max-width:980px;padding-top:95px;padding-bottom:32px}.news-back{display:inline-block;margin-bottom:30px;color:#5c8d1e;font-weight:900;text-decoration:none}.news-article-header h1{margin:18px 0 16px;font-size:clamp(38px,6vw,68px);line-height:1.02}.news-article-header>p{max-width:850px;color:#657066;font-size:20px;line-height:1.6}.news-article-layout{display:grid;grid-template-columns:minmax(0,1fr) 310px;align-items:start;gap:36px;padding-bottom:70px}.news-article-body{overflow:hidden;border-radius:22px;background:#fff;box-shadow:0 14px 35px rgba(20,35,18,.08)}.news-article-image{display:block;width:100%;max-height:560px;object-fit:cover}.news-article-text{padding:38px;font-size:18px;line-height:1.85;white-space:pre-wrap}.news-article-side{position:sticky;top:110px;padding:28px;border-radius:20px;background:#162219;color:#fff}.news-article-side img{width:145px}.news-article-side span{display:block;margin-top:22px;color:#96cf35;font-size:11px;font-weight:900;text-transform:uppercase}.news-article-side h2{font-size:25px}.news-article-side p{color:#ced7cf;line-height:1.6}.news-article-side a{color:#a8db4d;font-weight:900;text-decoration:none}@media(max-width:980px){.news-entry{grid-template-columns:145px minmax(0,1fr)}.news-entry>img{width:145px}.news-tip-card,.news-entry-main header{align-items:flex-start;flex-direction:column}.news-article-layout{grid-template-columns:1fr}.news-article-side{position:static}}@media(max-width:700px){.news-hero{background-position:64% 50%}.news-hero .page-shell{padding-top:82px;padding-bottom:44px}.news-lead-story{min-height:480px}.news-lead-copy{padding:22px}.news-top-item,.news-entry{grid-template-columns:95px minmax(0,1fr)}.news-top-item>img,.news-entry>img{width:95px;height:110px}.news-entry h3{font-size:18px}.news-entry p{font-size:13px}.news-tip-card{margin-inline:15px;padding:27px}.news-article-header{padding-top:70px}.news-article-text{padding:24px;font-size:16px}} \ No newline at end of file diff --git a/web/assets/news-v3.css b/web/assets/news-v3.css new file mode 100644 index 0000000..daeead3 --- /dev/null +++ b/web/assets/news-v3.css @@ -0,0 +1,16 @@ +.news-page,.news-article-page{background:#f4f6f2;color:#182019}.news-hero{position:relative;isolation:isolate;overflow:hidden;min-height:clamp(320px,40vw,520px);display:flex;align-items:flex-end;background:#102018 url("/assets/aktuelles-hero-v2.png") center 52%/cover no-repeat;color:#fff}.news-hero::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(5,13,11,.82) 0%,rgba(5,13,11,.48) 42%,rgba(5,13,11,.12) 72%),linear-gradient(0deg,rgba(5,13,11,.72) 0%,transparent 58%)}.news-hero .page-shell{padding-top:92px;padding-bottom:54px}.news-hero span,.news-hero h1,.news-hero p{text-shadow:0 2px 18px rgba(0,0,0,.5)}.news-hero p{max-width:760px}.news-intro-layout{align-items:start}.news-main-card{min-width:0}.news-lead-story{position:relative;min-height:500px;margin-top:26px;overflow:hidden;border-radius:20px;background:#152019;box-shadow:0 16px 38px rgba(20,35,18,.13)}.news-lead-story>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.news-lead-overlay{position:absolute;inset:0;background:linear-gradient(0deg,rgba(5,10,7,.94) 0%,rgba(5,10,7,.22) 70%,transparent)}.news-lead-copy{position:absolute;left:0;right:0;bottom:0;padding:30px;color:#fff}.news-lead-copy h3{max-width:760px;margin:12px 0;font-size:clamp(28px,4vw,46px);line-height:1.06}.news-lead-copy p{max-width:720px;margin:0;color:#d8dfd9;line-height:1.6}.news-lead-copy>a{display:inline-flex;margin-top:15px;padding:10px 15px;border-radius:999px;background:#85bf24;color:#10200e;font-weight:900;text-decoration:none}.news-meta{display:flex;flex-wrap:wrap;align-items:center;gap:8px;color:#7a847b;font-size:11px;font-weight:800}.news-meta span,.news-meta b{padding:5px 8px;border-radius:999px;background:#eaf4dc;color:#507b1d;text-transform:uppercase}.news-lead-copy .news-meta{color:#d2dad3}.news-lead-copy .news-meta span,.news-lead-copy .news-meta b{background:rgba(139,198,40,.22);color:#c3ed7e}.news-top-section{margin-top:34px}.news-section-heading span{color:#78aa29;font-size:11px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.news-section-heading h2{margin:6px 0 18px;font-size:28px}.news-top-list{display:grid;gap:14px}.news-top-item{display:grid;grid-template-columns:140px minmax(0,1fr);gap:16px;padding:14px;border:1px solid #dfe6dc;border-radius:16px;background:#fff;box-shadow:0 8px 22px rgba(20,35,18,.05)}.news-top-item>img{width:140px;height:125px;border-radius:11px;object-fit:cover}.news-top-item h3{margin:8px 0 5px;font-size:19px;line-height:1.2}.news-top-item p{display:-webkit-box;overflow:hidden;margin:0;color:#687168;font-size:13px;line-height:1.5;-webkit-box-orient:vertical;-webkit-line-clamp:2}.news-top-item a,.news-entry a{display:inline-block;margin-top:8px;color:#5b8d1c;font-weight:900;text-decoration:none}.news-side-card ul{display:grid;gap:9px;margin:18px 0;padding:0;list-style:none}.news-side-card li{position:relative;padding-left:22px;color:#d8e0d9;font-size:14px}.news-side-card li::before{content:"✓";position:absolute;left:0;color:#96cf35;font-weight:900}.news-wall{padding-top:42px}.news-wall-head{margin-bottom:22px}.news-list{display:grid;gap:14px}.news-entry{display:grid;grid-template-columns:180px minmax(0,1fr);gap:20px;padding:15px;border:1px solid #dfe5dc;border-radius:16px;background:#fff;box-shadow:0 8px 25px rgba(26,35,24,.05)}.news-entry>img{width:180px;height:145px;border-radius:11px;object-fit:cover}.news-entry-main{min-width:0}.news-entry-main header{display:flex;align-items:flex-start;justify-content:space-between;gap:15px}.news-entry-main small{color:#899188;font-size:11px}.news-entry h3{margin:10px 0 7px;font-size:22px;line-height:1.2}.news-entry p{display:-webkit-box;overflow:hidden;margin:0;color:#667066;line-height:1.55;-webkit-box-orient:vertical;-webkit-line-clamp:2}.news-tip-card{display:flex;align-items:center;justify-content:space-between;gap:35px;margin-top:52px;margin-bottom:60px;padding:34px 38px;border-radius:22px;background:linear-gradient(130deg,#122018,#263e25);color:#fff}.news-tip-card span{color:#96cf35;font-size:11px;font-weight:900;text-transform:uppercase}.news-tip-card h2{margin:6px 0 8px;font-size:30px}.news-tip-card p{max-width:760px;margin:0;color:#ccd7cd}.news-tip-card>a{flex:0 0 auto;padding:12px 17px;border-radius:999px;background:#85bf24;color:#10200e;font-weight:900;text-decoration:none}.news-article-header{max-width:980px;padding-top:95px;padding-bottom:32px}.news-back{display:inline-block;margin-bottom:30px;color:#5c8d1e;font-weight:900;text-decoration:none}.news-article-header h1{margin:18px 0 16px;font-size:clamp(38px,6vw,68px);line-height:1.02}.news-article-header>p{max-width:850px;color:#657066;font-size:20px;line-height:1.6}.news-article-layout{display:grid;grid-template-columns:minmax(0,1fr) 310px;align-items:start;gap:36px;padding-bottom:70px}.news-article-body{overflow:hidden;border-radius:22px;background:#fff;box-shadow:0 14px 35px rgba(20,35,18,.08)}.news-article-image{display:block;width:100%;max-height:560px;object-fit:cover}.news-article-text{padding:38px;font-size:18px;line-height:1.85;white-space:pre-wrap}.news-article-side{position:sticky;top:110px;padding:28px;border-radius:20px;background:#162219;color:#fff}.news-article-side img{width:145px}.news-article-side span{display:block;margin-top:22px;color:#96cf35;font-size:11px;font-weight:900;text-transform:uppercase}.news-article-side h2{font-size:25px}.news-article-side p{color:#ced7cf;line-height:1.6}.news-article-side a{color:#a8db4d;font-weight:900;text-decoration:none}@media(max-width:980px){.news-entry{grid-template-columns:145px minmax(0,1fr)}.news-entry>img{width:145px}.news-tip-card,.news-entry-main header{align-items:flex-start;flex-direction:column}.news-article-layout{grid-template-columns:1fr}.news-article-side{position:static}}@media(max-width:700px){.news-hero{background-position:64% 50%}.news-hero .page-shell{padding-top:82px;padding-bottom:44px}.news-lead-story{min-height:480px}.news-lead-copy{padding:22px}.news-top-item,.news-entry{grid-template-columns:95px minmax(0,1fr)}.news-top-item>img,.news-entry>img{width:95px;height:110px}.news-entry h3{font-size:18px}.news-entry p{font-size:13px}.news-tip-card{margin-inline:15px;padding:27px}.news-article-header{padding-top:70px}.news-article-text{padding:24px;font-size:16px}} + +.news-pagination{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-top:28px;padding:18px 20px;border:1px solid #dce5d8;border-radius:16px;background:#fff;box-shadow:0 8px 24px rgba(20,35,18,.05)} +.news-pagination-summary{color:#687268;font-size:13px;font-weight:800} +.news-pagination-links{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:7px} +.news-pagination-links a,.news-pagination-page{display:inline-flex;align-items:center;justify-content:center;min-width:38px;height:38px;padding:0 11px;border:1px solid #d8e2d4;border-radius:10px;background:#f8faf7;color:#365b1d;font-size:13px;font-weight:900;text-decoration:none;transition:transform .15s ease,border-color .15s ease,background .15s ease} +.news-pagination-links a:hover{transform:translateY(-1px);border-color:#89ba3b;background:#f0f7e6} +.news-pagination-page.is-active{border-color:#78aa29;background:#78aa29;color:#fff} +.news-pagination-direction{min-width:auto!important;padding:0 14px!important} +.news-pagination-gap{display:inline-flex;align-items:center;justify-content:center;width:28px;color:#7d877d;font-weight:900} +.news-world-wall{padding-top:54px;padding-bottom:10px;background:linear-gradient(180deg,#edf2ea 0%,#f4f6f2 100%)} +.news-world-head span{color:#536d94} +.news-world-entry{border-left:4px solid #617da4} +.news-world-entry .news-meta span{background:#e8eef6;color:#486488} +.news-world-entry a{color:#486b99} +@media(max-width:700px){.news-pagination{align-items:flex-start;flex-direction:column}.news-pagination-links{justify-content:flex-start;width:100%}.news-pagination-direction{flex:1}.news-world-wall{padding-top:38px}} diff --git a/web/assets/news-verkehr-v14.jpg b/web/assets/news-verkehr-v14.jpg new file mode 100644 index 0000000..f1f889d Binary files /dev/null and b/web/assets/news-verkehr-v14.jpg differ diff --git a/web/assets/news-village.jpg b/web/assets/news-village.jpg new file mode 100644 index 0000000..16444da Binary files /dev/null and b/web/assets/news-village.jpg differ diff --git a/web/assets/ontour-v2.css b/web/assets/ontour-v2.css new file mode 100644 index 0000000..d653630 --- /dev/null +++ b/web/assets/ontour-v2.css @@ -0,0 +1,4 @@ +.ontour-page{background:#0e120f;color:#f5f7f4}.ontour-hero{position:relative;overflow:hidden;min-height:650px;display:flex;align-items:center;background:radial-gradient(circle at 70% 25%,rgba(139,207,45,.19),transparent 30%),linear-gradient(115deg,#080b09 0%,#172019 55%,#0c100d 100%)}.ontour-hero::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(0,0,0,.18),transparent 58%),repeating-linear-gradient(115deg,transparent 0 70px,rgba(255,255,255,.015) 70px 72px)}.ontour-road{position:absolute;right:-12%;bottom:-38%;width:75%;height:90%;border:2px solid rgba(143,204,53,.12);border-radius:50%;transform:rotate(-16deg);box-shadow:0 0 0 70px rgba(143,204,53,.025),0 0 0 140px rgba(143,204,53,.018)}.ontour-hero-inner{position:relative;z-index:1;display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:70px;align-items:center;padding-top:105px;padding-bottom:80px}.ontour-hero span,.ontour-videos header span,.ontour-story article>span,.ontour-cta span{color:#95d13f;font-size:11px;font-weight:950;text-transform:uppercase;letter-spacing:.12em}.ontour-hero h1{margin:12px 0 20px;font-size:clamp(54px,9vw,112px);line-height:.88;color:#fff}.ontour-hero h1 em{display:block;color:#92cf3b;font-style:normal}.ontour-hero p{max-width:760px;color:#cad4c8;font-size:19px;line-height:1.7}.ontour-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:28px}.ontour-actions a{padding:13px 20px;border-radius:999px;background:#8dcc34;color:#111c0e;font-weight:950;text-decoration:none}.ontour-actions a.is-youtube{border:1px solid rgba(255,255,255,.23);background:rgba(255,255,255,.07);color:#fff}.ontour-hero aside{padding:28px;border:1px solid rgba(255,255,255,.14);border-radius:25px;background:rgba(7,11,8,.55);box-shadow:0 28px 80px rgba(0,0,0,.38);backdrop-filter:blur(12px)}.ontour-hero aside img{width:190px}.ontour-hero aside strong{display:block;margin:18px 0 8px;font-size:24px}.ontour-hero aside p{font-size:14px}.ontour-marquee{overflow:hidden;border-top:1px solid rgba(255,255,255,.08);border-bottom:1px solid rgba(255,255,255,.08);background:#151b16}.ontour-marquee div{display:flex;justify-content:center;gap:22px;padding:15px;white-space:nowrap;color:#cbd4c9;font-size:12px;font-weight:850;text-transform:uppercase}.ontour-marquee i{color:#8aca34}.ontour-notice{margin-top:28px;padding:18px 22px;border:1px solid #6e7e6a;border-radius:16px;background:#182019}.ontour-notice strong{color:#91cc3a}.ontour-notice p{color:#cad3c8}.ontour-notice a{color:#9bd94a;font-weight:900}.ontour-feature{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(320px,.8fr);gap:50px;align-items:center;padding-top:80px;padding-bottom:80px}.ontour-feature-visual button{position:relative;display:block;width:100%;padding:0;border:0;border-radius:25px;overflow:hidden;background:#000;cursor:pointer;box-shadow:0 30px 80px rgba(0,0,0,.45)}.ontour-feature-visual img{display:block;width:100%;aspect-ratio:16/9;object-fit:cover;opacity:.84}.ontour-feature-visual button::after{content:"";position:absolute;inset:0;background:linear-gradient(0deg,rgba(0,0,0,.58),transparent 55%)}.ontour-play{position:absolute;z-index:2;left:50%;top:50%;display:grid;place-items:center;width:78px;height:78px;border-radius:50%;transform:translate(-50%,-50%);background:#8fd139;color:#15200f;font-size:29px;box-shadow:0 0 0 12px rgba(143,209,57,.18)}.ontour-feature-visual small{position:absolute;z-index:2;left:22px;bottom:19px;color:#fff;font-weight:900;text-transform:uppercase}.ontour-feature-copy>span{color:#8ecb39;font-size:11px;font-weight:900;text-transform:uppercase}.ontour-feature-copy h2{margin:10px 0 15px;color:#fff;font-size:clamp(30px,4vw,52px);line-height:1.05}.ontour-feature-copy p{color:#bdc8bb;line-height:1.7}.ontour-feature-copy>div{display:flex;flex-wrap:wrap;gap:10px;margin-top:24px}.ontour-feature-copy button,.ontour-feature-copy a{padding:11px 16px;border:0;border-radius:999px;background:#8bca34;color:#14200f;font-weight:900;text-decoration:none;cursor:pointer}.ontour-feature-copy a{border:1px solid #49554a;background:transparent;color:#fff}.ontour-story{padding:78px 0;background:#f3f6f1;color:#182019}.ontour-story-grid{display:grid;grid-template-columns:minmax(0,.75fr) minmax(0,1.25fr);gap:60px;align-items:start}.ontour-story h2{margin:9px 0 16px;font-size:clamp(32px,4vw,52px)}.ontour-story article>p{color:#667064;line-height:1.75}.ontour-story-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.ontour-story-cards article{min-height:190px;padding:22px;border:1px solid #dce4d8;border-radius:20px;background:#fff;box-shadow:0 12px 34px rgba(20,36,16,.06)}.ontour-story-cards b{color:#7bb42c;font-size:25px}.ontour-story-cards strong{display:block;margin:25px 0 8px}.ontour-story-cards p{font-size:13px!important}.ontour-videos{padding-top:80px;padding-bottom:85px}.ontour-videos header{display:flex;justify-content:space-between;gap:30px;align-items:end;margin-bottom:28px}.ontour-videos h2{margin:7px 0 9px;color:#fff;font-size:clamp(32px,4vw,48px)}.ontour-videos header p{margin:0;color:#aeb9ac}.ontour-videos header>a{color:#93d13c;font-weight:900;text-decoration:none}.ontour-video-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.ontour-video-grid article{overflow:hidden;border:1px solid #2c352e;border-radius:20px;background:#171d18}.ontour-video-thumb{position:relative;display:block;width:100%;padding:0;border:0;background:#000;cursor:pointer}.ontour-video-thumb img{display:block;width:100%;aspect-ratio:16/9;object-fit:cover;opacity:.86}.ontour-video-thumb span{position:absolute;left:50%;top:50%;display:grid;place-items:center;width:52px;height:52px;border-radius:50%;transform:translate(-50%,-50%);background:#90ce3b;color:#12200d;font-size:19px}.ontour-video-grid article>div{padding:18px}.ontour-video-grid small{color:#86bd35;font-size:10px;font-weight:900}.ontour-video-grid h3{margin:7px 0 9px;color:#fff}.ontour-video-grid p{display:-webkit-box;overflow:hidden;-webkit-line-clamp:3;-webkit-box-orient:vertical;min-height:60px;color:#aeb8ac;font-size:12px;line-height:1.55}.ontour-video-grid article>div>button{padding:8px 12px;border:0;border-radius:999px;background:#28332a;color:#9ddc48;font-size:11px;font-weight:900;cursor:pointer}.ontour-empty{text-align:center;padding:70px 20px;border:1px solid #2d372f;border-radius:22px;background:#171d18}.ontour-empty>span{font-size:42px;color:#8dcc37}.ontour-empty p{color:#aeb8ad}.ontour-empty a{color:#93d13e;font-weight:900}.ontour-cta{padding:65px 0;background:linear-gradient(135deg,#7fba2c,#9bd94b);color:#14200f}.ontour-cta .page-shell{display:flex;justify-content:space-between;gap:40px;align-items:center}.ontour-cta span{color:#254312}.ontour-cta h2{margin:8px 0;font-size:clamp(32px,4vw,52px)}.ontour-cta p{max-width:760px}.ontour-cta .page-shell>div:last-child{display:flex;gap:10px;flex-wrap:wrap}.ontour-cta a{padding:12px 17px;border-radius:999px;background:#142018;color:#fff;font-weight:900;text-decoration:none}.ontour-cta a.is-secondary{border:1px solid rgba(20,32,24,.32);background:transparent;color:#142018}.ontour-modal[hidden]{display:none!important}.ontour-modal{position:fixed;inset:0;z-index:10000;display:grid;place-items:center;padding:20px}.ontour-modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.86);backdrop-filter:blur(6px)}.ontour-dialog{position:relative;z-index:1;width:min(1050px,100%);padding:22px;border:1px solid #39443b;border-radius:22px;background:#111612;color:#fff;box-shadow:0 30px 100px rgba(0,0,0,.7)}.ontour-dialog>button{position:absolute;right:12px;top:7px;z-index:2;border:0;background:transparent;color:#fff;font-size:34px;cursor:pointer}.ontour-dialog h2{margin:0 45px 16px 0;color:#fff}.ontour-player{aspect-ratio:16/9;border-radius:15px;overflow:hidden;background:#050706}.ontour-player iframe{width:100%;height:100%;border:0}.ontour-consent-message{padding:45px;text-align:center}.ontour-consent-message p{color:#c4cec2}.ontour-consent-message button{padding:11px 16px;border:0;border-radius:999px;background:#8dcb37;color:#14200f;font-weight:900;cursor:pointer}.has-ontour-modal{overflow:hidden}@media(max-width:950px){.ontour-hero-inner,.ontour-feature,.ontour-story-grid{grid-template-columns:1fr}.ontour-video-grid{grid-template-columns:repeat(2,1fr)}.ontour-cta .page-shell{align-items:flex-start;flex-direction:column}}@media(max-width:680px){.ontour-hero{min-height:auto}.ontour-hero-inner{padding-top:90px;padding-bottom:60px}.ontour-story-cards,.ontour-video-grid{grid-template-columns:1fr}.ontour-videos header{align-items:flex-start;flex-direction:column}.ontour-marquee div{justify-content:flex-start}.ontour-dialog{padding:16px}.ontour-consent-message{padding:30px 10px}} + +.ontour-player.is-loading{position:relative}.ontour-player.is-loading::before{content:"Video wird geladen …";position:absolute;inset:0;z-index:0;display:grid;place-items:center;color:#d4ddd2;font-weight:800;background:radial-gradient(circle at center,#182019,#050706 70%)}.ontour-player iframe{position:relative;z-index:1}.ontour-player-error{height:100%;display:grid;place-content:center;gap:10px;padding:32px;text-align:center;background:#0b0f0c}.ontour-player-error strong{font-size:1.2rem}.ontour-player-error p{margin:0;color:#bdc8bb}.ontour-player-error a{justify-self:center;margin-top:6px;padding:10px 15px;border-radius:999px;background:#8dcc37;color:#14200f;font-weight:900;text-decoration:none} +.ontour-player.is-loading iframe{opacity:0}.ontour-player iframe{transition:opacity .18s ease} diff --git a/web/assets/ontour-v2.js b/web/assets/ontour-v2.js new file mode 100644 index 0000000..db99adc --- /dev/null +++ b/web/assets/ontour-v2.js @@ -0,0 +1,9 @@ +(()=>{'use strict';const modal=document.querySelector('[data-ontour-modal]');if(!modal)return;const player=modal.querySelector('[data-ontour-player]');const title=modal.querySelector('[data-ontour-title]');const consent=modal.querySelector('[data-ontour-consent]');let activeId='';let loadTimer=0; +const allowed=()=>document.documentElement.dataset.consentExternalMedia==='true'; +const youtubeURL=()=>activeId?`https://www.youtube.com/watch?v=${encodeURIComponent(activeId)}`:'https://www.youtube.com/@landwelle'; +const clearPlayer=()=>{window.clearTimeout(loadTimer);player.classList.remove('is-loading','has-error');player.innerHTML=''}; +const showError=()=>{if(!activeId||modal.hidden)return;player.classList.remove('is-loading');player.classList.add('has-error');player.innerHTML=`
Das Video konnte nicht eingebettet werden.

Du kannst es direkt auf YouTube öffnen.

Video auf YouTube ansehen
`}; +const render=()=>{if(!activeId)return;clearPlayer();if(!allowed()){player.hidden=true;consent.hidden=false;return}consent.hidden=true;player.hidden=false;player.classList.add('is-loading');const frame=document.createElement('iframe');frame.src=`https://www.youtube-nocookie.com/embed/${encodeURIComponent(activeId)}?autoplay=1&rel=0&playsinline=1`;frame.title=title.textContent||'Landwelle OnTour Video';frame.allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share';frame.allowFullscreen=true;frame.referrerPolicy='strict-origin-when-cross-origin';frame.loading='eager';frame.addEventListener('load',()=>{window.clearTimeout(loadTimer);player.classList.remove('is-loading')},{once:true});frame.addEventListener('error',showError,{once:true});player.append(frame);loadTimer=window.setTimeout(showError,12000)}; +const open=(button)=>{activeId=button.dataset.youtubeVideo||'';title.textContent=button.dataset.youtubeTitle||'Landwelle OnTour';modal.hidden=false;document.body.classList.add('has-ontour-modal');render()}; +const close=()=>{modal.hidden=true;clearPlayer();activeId='';document.body.classList.remove('has-ontour-modal')}; +document.querySelectorAll('[data-youtube-video]').forEach((button)=>button.addEventListener('click',()=>open(button)));document.querySelectorAll('[data-ontour-close]').forEach((button)=>button.addEventListener('click',close));document.addEventListener('keydown',(event)=>{if(event.key==='Escape'&&!modal.hidden)close()});document.addEventListener('landwelle:consent-changed',()=>{if(!modal.hidden)render()});})(); diff --git a/web/assets/player-v15.css b/web/assets/player-v15.css new file mode 100644 index 0000000..1fb3c98 --- /dev/null +++ b/web/assets/player-v15.css @@ -0,0 +1,374 @@ +:root { + color-scheme: dark; + --green: #8bc616; + --green-light: #b6e956; + --ink: #080b09; + --panel: #111611; + --muted: #a3aaa4; +} +* { box-sizing: border-box; } +html, body { min-height: 100%; } +body { + margin: 0; + color: #fff; + background: + radial-gradient(circle at 78% 13%, rgba(131, 194, 8, .2), transparent 31%), + radial-gradient(circle at 10% 92%, rgba(104, 157, 0, .13), transparent 34%), + linear-gradient(135deg, #060806, #101510 57%, #070907); + font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; + line-height: 1.35; + overflow-x: hidden; +} +a { color: inherit; text-decoration: none; } +button, input { font: inherit; } +button { cursor: pointer; } +img { display: block; max-width: 100%; } + +.popup-player { + position: relative; + min-height: 100dvh; + display: flex; + flex-direction: column; + isolation: isolate; + overflow: hidden; +} +.popup-player::before { + content: ""; + position: absolute; + inset: 0; + z-index: -2; + pointer-events: none; + background: + repeating-linear-gradient(90deg, transparent 0 57px, rgba(255,255,255,.013) 58px 59px), + linear-gradient(90deg, transparent 47%, rgba(255,255,255,.025) 47.2%, transparent 47.4%); +} +.popup-player::after { + content: ""; + position: fixed; + left: 0; + right: 0; + bottom: 0; + z-index: 20; + height: 6px; + background: linear-gradient(90deg, #3a5c00, #a4df2b 38%, #76ad04 72%, #213500); + box-shadow: 0 -3px 20px rgba(140, 204, 18, .21); +} +.popup-player.is-stale .popup-kicker::after { + content: " · zwischengespeichert"; + color: #f1bd5d; + font-size: .72em; + letter-spacing: 0; + text-transform: none; +} + +.popup-topbar { + min-height: 89px; + display: flex; + align-items: center; + justify-content: space-between; + gap: 22px; + padding: 9px 24px 8px 28px; + border-bottom: 1px solid rgba(255,255,255,.085); + background: rgba(5, 8, 6, .56); + backdrop-filter: blur(10px); +} +.popup-brand { display: block; width: 198px; border-radius: 8px; } +.popup-brand img { + width: 100%; + max-height: 72px; + object-fit: contain; + filter: drop-shadow(0 3px 8px rgba(0,0,0,.55)); +} +.popup-top-actions { display: flex; align-items: center; gap: 14px; } +.popup-live { + display: inline-flex; + align-items: center; + gap: 8px; + padding: 8px 13px; + border: 1px solid rgba(149, 213, 26, .46); + border-radius: 999px; + color: #caf57a; + background: rgba(126, 187, 7, .09); + font-size: 11px; + font-weight: 900; + letter-spacing: .12em; +} +.popup-live i { + width: 8px; + height: 8px; + border-radius: 50%; + background: #9bdd1d; + box-shadow: 0 0 0 5px rgba(149, 213, 26, .11), 0 0 18px #8bc814; + animation: livePulse 1.5s ease-in-out infinite; +} +@keyframes livePulse { 50% { opacity: .45; transform: scale(.82); } } +.popup-close { + width: 43px; + height: 43px; + display: grid; + place-items: center; + padding: 0 0 3px; + border: 1px solid rgba(255,255,255,.18); + border-radius: 50%; + color: #fff; + background: rgba(255,255,255,.07); + font-size: 29px; + font-weight: 300; + line-height: 1; + transition: background .15s ease, border-color .15s ease, transform .15s ease; +} +.popup-close:hover { border-color: rgba(166,219,52,.65); background: rgba(126,189,0,.18); transform: rotate(3deg); } + +.popup-layout { + flex: 1; + min-height: 0; + display: grid; + grid-template-columns: minmax(340px, .88fr) minmax(0, 1.12fr); +} +.popup-visual { + position: relative; + min-height: 500px; + display: grid; + place-items: center; + padding: 42px 25px 38px; + overflow: hidden; + border-right: 1px solid rgba(255,255,255,.075); + background: + radial-gradient(circle at 50% 47%, rgba(129, 193, 6, .23), transparent 41%), + linear-gradient(150deg, rgba(255,255,255,.035), transparent 52%); +} +.popup-cover { + position: relative; + z-index: 3; + width: min(310px, 78%); + aspect-ratio: 1; + padding: 8px; + border: 1px solid rgba(182,229,78,.4); + border-radius: 22px; + background: linear-gradient(145deg, rgba(255,255,255,.13), rgba(255,255,255,.025)); + box-shadow: 0 28px 49px rgba(0,0,0,.5), 0 0 48px rgba(112,169,0,.17); + transform: rotate(-1.35deg); +} +.popup-cover::after { + content: ""; + position: absolute; + inset: 8px; + border-radius: 14px; + box-shadow: inset 0 0 0 1px rgba(255,255,255,.13); + pointer-events: none; +} +.popup-cover img { + width: 100%; + height: 100%; + border-radius: 14px; + object-fit: cover; + transition: opacity .2s ease, transform .25s ease; +} +.popup-cover.is-loading img { opacity: .38; transform: scale(.97); } +.popup-provider { + position: absolute; + z-index: 5; + left: 50%; + bottom: 25px; + transform: translateX(-50%); + color: #a6ada7; + font-size: 10px; + white-space: nowrap; +} +.popup-provider:hover { color: #bce66b; text-decoration: underline; } +.popup-rings { position: absolute; inset: 0; z-index: 1; opacity: .52; transform: rotate(-8deg); } +.popup-rings i { + position: absolute; + left: 50%; + top: 50%; + border: 4px solid rgba(145,205,23,.55); + border-left-color: transparent; + border-bottom-color: transparent; + border-radius: 50%; + transform: translate(-50%, -50%) rotate(-45deg); +} +.popup-rings i:nth-child(1) { width: 330px; height: 330px; } +.popup-rings i:nth-child(2) { width: 445px; height: 445px; opacity: .55; } +.popup-rings i:nth-child(3) { width: 570px; height: 570px; opacity: .25; } + +.popup-content { + min-width: 0; + display: flex; + flex-direction: column; + justify-content: center; + padding: 43px 48px 37px; +} +.popup-kicker { + color: #98d121; + font-size: 12px; + font-weight: 900; + letter-spacing: .11em; + text-transform: uppercase; +} +.popup-content h1 { + max-width: 520px; + margin: 8px 0 5px; + font-size: clamp(35px, 5vw, 52px); + line-height: .99; + letter-spacing: -.046em; + text-wrap: balance; +} +.popup-showline { margin: 0; color: #bac1bb; font-size: 14px; } +.popup-track { margin-top: 32px; padding-left: 17px; border-left: 4px solid #82bd0a; } +.popup-track small { + display: block; + color: #8c948d; + font-size: 10px; + font-weight: 850; + letter-spacing: .09em; + text-transform: uppercase; +} +.popup-track strong, +.popup-track > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.popup-track strong { margin-top: 4px; font-size: 26px; line-height: 1.1; } +.popup-track > span { margin-top: 3px; color: #e1e5e1; font-size: 17px; } + +.popup-wave { + height: 43px; + display: flex; + align-items: center; + gap: 5px; + margin: 25px 0 21px; + overflow: hidden; +} +.popup-wave i { + width: 3px; + height: 13px; + border-radius: 3px; + background: linear-gradient(#a8e52d, #5c8e00); + box-shadow: 0 0 7px rgba(143,204,22,.42); + animation: playerWave .72s ease-in-out infinite alternate; +} +.popup-wave i:nth-child(2n) { height: 24px; animation-delay: -.2s; } +.popup-wave i:nth-child(3n) { height: 35px; animation-delay: -.43s; } +.popup-wave i:nth-child(4n) { height: 19px; animation-delay: -.61s; } +.popup-wave i:nth-child(5n) { height: 40px; animation-delay: -.3s; } +.popup-player:not(.is-playing) .popup-wave i { animation-play-state: paused; transform: scaleY(.35); opacity: .42; } +@keyframes playerWave { to { transform: scaleY(.35); opacity: .45; } } + +.popup-controls { + display: grid; + grid-template-columns: 75px minmax(0, 1fr) 142px; + align-items: center; + gap: 18px; + padding: 17px 19px; + border: 1px solid rgba(255,255,255,.1); + border-radius: 16px; + background: rgba(255,255,255,.046); + box-shadow: inset 0 1px rgba(255,255,255,.025); +} +.popup-play { + width: 70px; + height: 70px; + display: grid; + place-items: center; + padding: 0; + border: 0; + border-radius: 50%; + color: #fff; + background: radial-gradient(circle at 35% 27%, #b6ea43, #7bb402 67%, #5f9000); + box-shadow: 0 0 0 7px rgba(130,191,9,.09), 0 10px 25px rgba(0,0,0,.38); + transition: transform .15s ease, box-shadow .15s ease; +} +.popup-play:hover { transform: scale(1.045); box-shadow: 0 0 0 9px rgba(130,191,9,.11), 0 12px 29px rgba(0,0,0,.42); } +.popup-play svg { width: 29px; fill: currentColor; } +.popup-play .icon-pause { display: none; } +.popup-player.is-playing .popup-play .icon-play { display: none; } +.popup-player.is-playing .popup-play .icon-pause { display: block; } +.popup-controlcopy { min-width: 0; } +.popup-controlcopy strong { display: block; font-size: 15px; } +.popup-controlcopy span { display: block; margin-top: 3px; color: #9ea59f; font-size: 11px; } +.popup-volume { display: flex; align-items: center; gap: 9px; } +.popup-volume svg { width: 23px; flex: 0 0 auto; fill: #fff; } +.popup-volume input { width: 105px; accent-color: #85c00d; } +.popup-footer { + display: flex; + align-items: center; + justify-content: space-between; + gap: 20px; + margin-top: 18px; + color: #929a93; + font-size: 11px; +} +.popup-footer span b { color: #c7ef78; } +.popup-footer a { color: #e7eae6; font-weight: 750; } +.popup-footer a b { margin-left: 5px; color: #96cc26; font-size: 16px; } +.popup-footer a:hover { color: #bde66c; } +.popup-independent { + min-height: 40px; + display: flex; + align-items: center; + justify-content: center; + gap: 8px; + padding: 9px 22px 13px; + border-top: 1px solid rgba(255,255,255,.055); + color: #858d86; + background: rgba(4,7,5,.54); + font-size: 10px; + text-align: center; +} +.popup-independent span { color: #99cf2c; font-size: 15px; } + +button:focus-visible, a:focus-visible, input:focus-visible { + outline: 3px solid rgba(185,233,83,.75); + outline-offset: 3px; +} + +@media (max-width: 760px) { + .popup-topbar { min-height: 74px; padding: 7px 14px 6px 18px; } + .popup-brand { width: 164px; } + .popup-live { display: none; } + .popup-close { width: 40px; height: 40px; } + .popup-layout { grid-template-columns: 1fr; } + .popup-visual { min-height: 270px; padding: 27px 20px 19px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.07); } + .popup-cover { width: 210px; border-radius: 18px; } + .popup-provider { bottom: 10px; } + .popup-rings i:nth-child(1) { width: 235px; height: 235px; } + .popup-rings i:nth-child(2) { width: 325px; height: 325px; } + .popup-rings i:nth-child(3) { width: 415px; height: 415px; } + .popup-content { justify-content: flex-start; padding: 28px 28px 29px; } + .popup-content h1 { font-size: 39px; } + .popup-track { margin-top: 24px; } + .popup-wave { margin-block: 19px 17px; } +} + +@media (max-width: 520px) { + .popup-topbar { min-height: 67px; padding-left: 14px; } + .popup-brand { width: 143px; } + .popup-close { width: 38px; height: 38px; font-size: 27px; } + .popup-visual { min-height: 225px; padding: 20px 15px 14px; } + .popup-cover { width: 172px; padding: 6px; } + .popup-cover::after { inset: 6px; } + .popup-provider { font-size: 8px; bottom: 6px; } + .popup-content { padding: 21px 17px 20px; } + .popup-kicker { font-size: 10px; } + .popup-content h1 { margin-top: 6px; font-size: 31px; } + .popup-showline { font-size: 12px; } + .popup-track { margin-top: 17px; padding-left: 12px; border-left-width: 3px; } + .popup-track strong { font-size: 21px; } + .popup-track > span { font-size: 15px; } + .popup-wave { height: 31px; gap: 4px; margin: 14px 0 13px; } + .popup-controls { grid-template-columns: 61px minmax(0,1fr); gap: 13px; padding: 13px; } + .popup-play { width: 58px; height: 58px; } + .popup-play svg { width: 24px; } + .popup-controlcopy strong { font-size: 13px; } + .popup-controlcopy span { font-size: 9px; } + .popup-volume { grid-column: 1 / -1; padding-left: 3px; } + .popup-volume input { width: calc(100% - 32px); } + .popup-footer { margin-top: 13px; font-size: 10px; } + .popup-independent { padding-inline: 13px; font-size: 9px; } +} + +@media (prefers-reduced-motion: reduce) { + .popup-close, .popup-play, .popup-cover img { transition: none; } + .popup-live i, .popup-wave i { animation: none; } +} + +/* v15 – aktuelle Sendung aus dem Landwelle-Programmplan, ohne technische Cover-/AzuraCast-Hinweise. */ +.popup-showline { margin-top: 8px; } +.popup-cover img { object-position: center center; } diff --git a/web/assets/player-v15.js b/web/assets/player-v15.js new file mode 100644 index 0000000..e68266a --- /dev/null +++ b/web/assets/player-v15.js @@ -0,0 +1,311 @@ +(() => { + 'use strict'; + + const root = document.querySelector('[data-player-window]'); + const audio = document.getElementById('standalone-audio'); + const playButton = document.querySelector('[data-play-trigger]'); + const volumeInput = document.querySelector('[data-volume]'); + const statusField = document.querySelector('[data-player-message]'); + const actionLabel = document.querySelector('[data-player-action-label]'); + const closeButton = document.querySelector('[data-window-close]'); + const artistField = document.querySelector('[data-now-artist]'); + const titleField = document.querySelector('[data-now-title]'); + const currentProgramField = document.querySelector('[data-current-program]'); + const currentProgramPresenter = document.querySelector('[data-current-program-presenter]'); + const listenerField = document.querySelector('[data-now-listeners]'); + const liveBadge = document.querySelector('[data-now-live-badge]'); + const coverImage = document.querySelector('[data-now-cover]'); + const coverBox = coverImage?.closest('.popup-cover'); + const playbackID = `popup-${Date.now()}-${Math.random().toString(16).slice(2)}`; + const playbackChannel = 'BroadcastChannel' in window + ? new BroadcastChannel('landwelle-radio-playback') + : null; + let currentCover = coverImage?.getAttribute('src') || ''; + let currentNow = null; + let refreshTimer = 0; + let programTimer = 0; + let loadingNow = false; + let loadingProgram = false; + let currentProgramTitle = 'Landwelle Radio'; + let closingFallback = 0; + + const setStatus = (message) => { + if (statusField) statusField.textContent = message; + }; + + const setPlaying = (playing) => { + root?.classList.toggle('is-playing', playing); + playButton?.setAttribute('aria-pressed', String(playing)); + playButton?.setAttribute('aria-label', playing ? 'Livestream pausieren' : 'Livestream abspielen'); + if (actionLabel) actionLabel.textContent = playing ? 'Landwelle läuft live' : 'Livestream starten'; + }; + + const announcePlayback = () => { + playbackChannel?.postMessage({ type: 'playing', source: playbackID }); + }; + + const readStoredVolume = () => { + try { + const value = Number(window.localStorage.getItem('landwelle-player-volume')); + return Number.isFinite(value) ? Math.min(1, Math.max(0, value)) : 0.8; + } catch (_) { + return 0.8; + } + }; + + const storeVolume = (value) => { + try { window.localStorage.setItem('landwelle-player-volume', String(value)); } catch (_) { /* optional */ } + }; + + const toggleAudio = async () => { + if (!audio) { + setStatus('Der Livestream ist in diesem Fenster nicht verfügbar.'); + return; + } + if (!audio.currentSrc && !audio.getAttribute('src')) { + setStatus('Der Livestream ist noch nicht konfiguriert.'); + return; + } + + try { + if (audio.paused) { + setStatus('Livestream wird verbunden …'); + await audio.play(); + } else { + audio.pause(); + setStatus('Livestream pausiert.'); + } + } catch (error) { + setPlaying(false); + setStatus('Bitte klicke auf Play, um Landwelle zu starten.'); + console.error('Landwelle Popup-Player:', error); + } + }; + + const normalizeCoverURL = (url) => { + if (!url) return ''; + try { + const parsed = new URL(url, window.location.origin); + if (parsed.origin === window.location.origin) return `${parsed.pathname}${parsed.search}`; + return parsed.href; + } catch (_) { + return url; + } + }; + + const updateCover = (url, artist, title) => { + const displayURL = normalizeCoverURL(url); + if (!displayURL || displayURL === currentCover || !coverImage) return; + currentCover = displayURL; + coverBox?.classList.add('is-loading'); + const preload = new Image(); + preload.onload = () => { + coverImage.src = displayURL; + coverImage.alt = `Cover zu ${artist || 'Landwelle'} – ${title || 'Livestream'}`; + coverBox?.classList.remove('is-loading'); + updateMediaSession(currentNow); + }; + preload.onerror = () => coverBox?.classList.remove('is-loading'); + preload.src = displayURL; + }; + + const updateMediaSession = (now) => { + if (!now || !('mediaSession' in navigator) || typeof MediaMetadata === 'undefined') return; + const artwork = currentCover ? [{ src: new URL(currentCover, window.location.href).href }] : []; + try { + navigator.mediaSession.metadata = new MediaMetadata({ + title: now.title || 'Landwelle Live', + artist: now.artist || 'Landwelle Radio', + album: currentProgramTitle || now.album || 'Sound & Infos aus Niedersachsen', + artwork + }); + } catch (_) { + // Einige Browser akzeptieren nicht jedes Artwork-Format. + } + }; + + const renderNow = (now) => { + currentNow = now; + const artist = now.artist || 'Landwelle Radio'; + const title = now.title || 'Live aus Niedersachsen'; + if (artistField) artistField.textContent = artist; + if (titleField) titleField.textContent = title; + if (listenerField) listenerField.textContent = String(Number.isFinite(Number(now.listeners)) ? Number(now.listeners) : 0); + if (liveBadge) liveBadge.textContent = now.live ? 'LIVE' : 'ON AIR'; + root?.classList.toggle('is-stale', Boolean(now.stale)); + + + document.title = `${artist} – ${title} | Landwelle`; + updateCover(now.cover_url, artist, title); + updateMediaSession(now); + }; + + const scheduleNow = () => { + window.clearTimeout(refreshTimer); + refreshTimer = window.setTimeout(loadNow, document.hidden ? 30000 : 15000); + }; + + const loadNow = async () => { + if (loadingNow) return; + loadingNow = true; + try { + const response = await fetch('/api/v1/now', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const payload = await response.json(); + if (!payload?.data) throw new Error('Ungültige Now-Playing-Daten'); + renderNow(payload.data); + } catch (error) { + root?.classList.add('is-stale'); + console.error('Landwelle Now Playing:', error); + } finally { + loadingNow = false; + scheduleNow(); + } + }; + + const renderProgram = (program) => { + if (!program) { + currentProgramTitle = 'Landwelle Radio · rund um die Uhr'; + if (currentProgramField) currentProgramField.textContent = currentProgramTitle; + if (currentProgramPresenter) currentProgramPresenter.textContent = 'Sound & Infos aus Niedersachsen'; + return; + } + const time = program.start && program.end ? `${program.start}–${program.end} Uhr` : (program.time_label || 'jetzt live'); + currentProgramTitle = `${program.show || 'Landwelle Radio'} · ${time}`; + if (currentProgramField) currentProgramField.textContent = currentProgramTitle; + const details = []; + if (program.presenter) details.push(`mit ${program.presenter}`); + if (program.program_type) details.push(program.program_type); + if (currentProgramPresenter) currentProgramPresenter.textContent = details.join(' · ') || 'Sound & Infos aus Niedersachsen'; + updateMediaSession(currentNow); + }; + + const scheduleProgram = () => { + window.clearTimeout(programTimer); + programTimer = window.setTimeout(loadProgram, document.hidden ? 120000 : 60000); + }; + + const loadProgram = async () => { + if (loadingProgram) return; + loadingProgram = true; + try { + const response = await fetch('/api/v1/program/current', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const payload = await response.json(); + renderProgram(payload?.data || null); + } catch (error) { + renderProgram(null); + console.error('Landwelle-Programm:', error); + } finally { + loadingProgram = false; + scheduleProgram(); + } + }; + + const tryAutoplay = async () => { + if (new URLSearchParams(window.location.search).get('autoplay') !== '1') return; + try { + setStatus('Livestream wird verbunden …'); + await audio?.play(); + } catch (_) { + setPlaying(false); + setStatus('Der Player ist bereit. Bitte einmal auf Play klicken.'); + } + }; + + const closeWindow = () => { + window.clearTimeout(closingFallback); + window.close(); + closingFallback = window.setTimeout(() => { + if (window.closed) return; + if (window.history.length > 1) window.history.back(); + else window.location.assign('/'); + }, 180); + }; + + if (audio) { + audio.volume = readStoredVolume(); + if (volumeInput) volumeInput.value = String(audio.volume); + setPlaying(!audio.paused); + audio.addEventListener('play', () => { + setPlaying(true); + setStatus('Landwelle läuft live.'); + announcePlayback(); + if ('mediaSession' in navigator) navigator.mediaSession.playbackState = 'playing'; + }); + audio.addEventListener('pause', () => { + setPlaying(false); + if ('mediaSession' in navigator) navigator.mediaSession.playbackState = 'paused'; + }); + audio.addEventListener('waiting', () => setStatus('Livestream wird gepuffert …')); + audio.addEventListener('playing', () => setStatus('Landwelle läuft live.')); + audio.addEventListener('error', () => { + setPlaying(false); + setStatus('Der Stream ist momentan nicht erreichbar.'); + }); + } + + playButton?.addEventListener('click', toggleAudio); + volumeInput?.addEventListener('input', () => { + const value = Number(volumeInput.value); + if (!audio || !Number.isFinite(value)) return; + audio.volume = value; + storeVolume(value); + }); + closeButton?.addEventListener('click', closeWindow); + + playbackChannel?.addEventListener('message', (event) => { + if (event.data?.type !== 'playing' || event.data?.source === playbackID) return; + if (audio && !audio.paused) { + audio.pause(); + setStatus('Die Wiedergabe läuft jetzt in einem anderen Landwelle-Player.'); + } + }); + + if ('mediaSession' in navigator) { + try { + navigator.mediaSession.setActionHandler('play', () => audio?.play()); + navigator.mediaSession.setActionHandler('pause', () => audio?.pause()); + navigator.mediaSession.setActionHandler('stop', () => { + audio?.pause(); + if (audio) audio.currentTime = 0; + }); + } catch (_) { + // Nicht alle Browser unterstützen sämtliche Media-Session-Aktionen. + } + } + + document.addEventListener('visibilitychange', () => { + if (!document.hidden) { + window.clearTimeout(refreshTimer); + window.clearTimeout(programTimer); + loadNow(); + loadProgram(); + } + }); + window.addEventListener('pagehide', () => { + window.clearTimeout(refreshTimer); + window.clearTimeout(programTimer); + playbackChannel?.close(); + }, { once: true }); + + window.landwelleStandalonePlayer = Object.freeze({ + play: async () => { + if (!audio || !audio.paused) return; + try { await audio.play(); } catch (_) { setStatus('Bitte klicke auf Play, um Landwelle zu starten.'); } + }, + pause: () => audio?.pause(), + toggle: toggleAudio, + isPlaying: () => Boolean(audio && !audio.paused) + }); + + loadNow(); + loadProgram(); + window.setTimeout(tryAutoplay, 120); +})(); diff --git a/web/assets/player-v16.js b/web/assets/player-v16.js new file mode 100644 index 0000000..b720d36 --- /dev/null +++ b/web/assets/player-v16.js @@ -0,0 +1,389 @@ +(() => { + 'use strict'; + + const root = document.querySelector('[data-player-window]'); + const audio = document.getElementById('standalone-audio'); + const playButton = document.querySelector('[data-play-trigger]'); + const volumeInput = document.querySelector('[data-volume]'); + const statusField = document.querySelector('[data-player-message]'); + const actionLabel = document.querySelector('[data-player-action-label]'); + const closeButton = document.querySelector('[data-window-close]'); + const artistField = document.querySelector('[data-now-artist]'); + const titleField = document.querySelector('[data-now-title]'); + const currentProgramField = document.querySelector('[data-current-program]'); + const currentProgramPresenter = document.querySelector('[data-current-program-presenter]'); + const listenerField = document.querySelector('[data-now-listeners]'); + const liveBadge = document.querySelector('[data-now-live-badge]'); + const coverImage = document.querySelector('[data-now-cover]'); + const coverBox = coverImage?.closest('.popup-cover'); + const playbackID = `popup-${Date.now()}-${Math.random().toString(16).slice(2)}`; + const playbackChannel = 'BroadcastChannel' in window + ? new BroadcastChannel('landwelle-radio-playback') + : null; + let currentCover = coverImage?.getAttribute('src') || ''; + let currentNow = null; + let refreshTimer = 0; + let programTimer = 0; + let loadingNow = false; + let loadingProgram = false; + let currentProgramTitle = 'Landwelle Radio'; + let closingFallback = 0; + const streamURL = audio?.dataset.streamSrc || ''; + const prerollURL = audio?.dataset.prerollSrc || ''; + let playbackPhase = 'idle'; + let prerollCompleted = !prerollURL; + let prerollTransitioning = false; + + const setStatus = (message) => { + if (statusField) statusField.textContent = message; + }; + + const setPlaying = (playing) => { + root?.classList.toggle('is-playing', playing); + playButton?.setAttribute('aria-pressed', String(playing)); + playButton?.setAttribute('aria-label', playing ? 'Wiedergabe pausieren' : 'Livestream abspielen'); + if (actionLabel) { + actionLabel.textContent = playing + ? (playbackPhase === 'preroll' ? 'KI-Hinweis vor dem Livestream' : 'Landwelle läuft live') + : 'Livestream starten'; + } + }; + + const announcePlayback = () => { + playbackChannel?.postMessage({ type: 'playing', source: playbackID }); + }; + + const readStoredVolume = () => { + try { + const value = Number(window.localStorage.getItem('landwelle-player-volume')); + return Number.isFinite(value) ? Math.min(1, Math.max(0, value)) : 0.8; + } catch (_) { + return 0.8; + } + }; + + const storeVolume = (value) => { + try { window.localStorage.setItem('landwelle-player-volume', String(value)); } catch (_) { /* optional */ } + }; + + const setAudioSource = (source, phase) => { + if (!audio || !source) return; + playbackPhase = phase; + if (audio.getAttribute('src') === source) return; + audio.src = source; + audio.load(); + }; + + const startLiveStream = async () => { + if (!audio || !streamURL || prerollTransitioning) return; + prerollTransitioning = true; + prerollCompleted = true; + try { + setAudioSource(streamURL, 'stream'); + setStatus('Livestream wird verbunden …'); + await audio.play(); + } finally { + prerollTransitioning = false; + } + }; + + const startPlayback = async () => { + if (!audio) { + setStatus('Der Livestream ist in diesem Fenster nicht verfügbar.'); + return; + } + if (!streamURL) { + setStatus('Der Livestream ist noch nicht konfiguriert.'); + return; + } + + if (!prerollCompleted && prerollURL) { + if (playbackPhase !== 'preroll') { + setAudioSource(prerollURL, 'preroll'); + try { audio.currentTime = 0; } catch (_) { /* Browser lädt erst Metadaten. */ } + } + setStatus('KI-Transparenzhinweis wird vor dem Livestream abgespielt …'); + await audio.play(); + return; + } + + if (playbackPhase !== 'stream') setAudioSource(streamURL, 'stream'); + setStatus('Livestream wird verbunden …'); + await audio.play(); + }; + + const toggleAudio = async () => { + try { + if (!audio) { + setStatus('Der Livestream ist in diesem Fenster nicht verfügbar.'); + return; + } + if (audio.paused) { + await startPlayback(); + } else { + audio.pause(); + setStatus(playbackPhase === 'preroll' ? 'KI-Transparenzhinweis pausiert.' : 'Livestream pausiert.'); + } + } catch (error) { + setPlaying(false); + setStatus('Bitte klicke auf Play, um Landwelle zu starten.'); + console.error('Landwelle Popup-Player:', error); + } + }; + + const normalizeCoverURL = (url) => { + if (!url) return ''; + try { + const parsed = new URL(url, window.location.origin); + if (parsed.origin === window.location.origin) return `${parsed.pathname}${parsed.search}`; + return parsed.href; + } catch (_) { + return url; + } + }; + + const updateCover = (url, artist, title) => { + const displayURL = normalizeCoverURL(url); + if (!displayURL || displayURL === currentCover || !coverImage) return; + currentCover = displayURL; + coverBox?.classList.add('is-loading'); + const preload = new Image(); + preload.onload = () => { + coverImage.src = displayURL; + coverImage.alt = `Cover zu ${artist || 'Landwelle'} – ${title || 'Livestream'}`; + coverBox?.classList.remove('is-loading'); + updateMediaSession(currentNow); + }; + preload.onerror = () => coverBox?.classList.remove('is-loading'); + preload.src = displayURL; + }; + + const updateMediaSession = (now) => { + if (!now || !('mediaSession' in navigator) || typeof MediaMetadata === 'undefined') return; + const artwork = currentCover ? [{ src: new URL(currentCover, window.location.href).href }] : []; + try { + navigator.mediaSession.metadata = new MediaMetadata({ + title: now.title || 'Landwelle Live', + artist: now.artist || 'Landwelle Radio', + album: currentProgramTitle || now.album || 'Sound & Infos aus Niedersachsen', + artwork + }); + } catch (_) { + // Einige Browser akzeptieren nicht jedes Artwork-Format. + } + }; + + const renderNow = (now) => { + currentNow = now; + const artist = now.artist || 'Landwelle Radio'; + const title = now.title || 'Live aus Niedersachsen'; + if (artistField) artistField.textContent = artist; + if (titleField) titleField.textContent = title; + if (listenerField) listenerField.textContent = String(Number.isFinite(Number(now.listeners)) ? Number(now.listeners) : 0); + if (liveBadge) liveBadge.textContent = now.live ? 'LIVE' : 'ON AIR'; + root?.classList.toggle('is-stale', Boolean(now.stale)); + + + document.title = `${artist} – ${title} | Landwelle`; + updateCover(now.cover_url, artist, title); + updateMediaSession(now); + }; + + const scheduleNow = () => { + window.clearTimeout(refreshTimer); + refreshTimer = window.setTimeout(loadNow, document.hidden ? 30000 : 15000); + }; + + const loadNow = async () => { + if (loadingNow) return; + loadingNow = true; + try { + const response = await fetch('/api/v1/now', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const payload = await response.json(); + if (!payload?.data) throw new Error('Ungültige Now-Playing-Daten'); + renderNow(payload.data); + } catch (error) { + root?.classList.add('is-stale'); + console.error('Landwelle Now Playing:', error); + } finally { + loadingNow = false; + scheduleNow(); + } + }; + + const renderProgram = (program) => { + if (!program) { + currentProgramTitle = 'Landwelle Radio · rund um die Uhr'; + if (currentProgramField) currentProgramField.textContent = currentProgramTitle; + if (currentProgramPresenter) currentProgramPresenter.textContent = 'Sound & Infos aus Niedersachsen'; + return; + } + const time = program.start && program.end ? `${program.start}–${program.end} Uhr` : (program.time_label || 'jetzt live'); + currentProgramTitle = `${program.show || 'Landwelle Radio'} · ${time}`; + if (currentProgramField) currentProgramField.textContent = currentProgramTitle; + const details = []; + if (program.presenter) details.push(`mit ${program.presenter}`); + if (program.program_type) details.push(program.program_type); + if (currentProgramPresenter) currentProgramPresenter.textContent = details.join(' · ') || 'Sound & Infos aus Niedersachsen'; + updateMediaSession(currentNow); + }; + + const scheduleProgram = () => { + window.clearTimeout(programTimer); + programTimer = window.setTimeout(loadProgram, document.hidden ? 120000 : 60000); + }; + + const loadProgram = async () => { + if (loadingProgram) return; + loadingProgram = true; + try { + const response = await fetch('/api/v1/program/current', { + headers: { Accept: 'application/json' }, + cache: 'no-store' + }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const payload = await response.json(); + renderProgram(payload?.data || null); + } catch (error) { + renderProgram(null); + console.error('Landwelle-Programm:', error); + } finally { + loadingProgram = false; + scheduleProgram(); + } + }; + + const tryAutoplay = async () => { + if (new URLSearchParams(window.location.search).get('autoplay') !== '1') return; + try { + await startPlayback(); + } catch (_) { + setPlaying(false); + setStatus('Der Player ist bereit. Bitte einmal auf Play klicken.'); + } + }; + + const closeWindow = () => { + window.clearTimeout(closingFallback); + window.close(); + closingFallback = window.setTimeout(() => { + if (window.closed) return; + if (window.history.length > 1) window.history.back(); + else window.location.assign('/'); + }, 180); + }; + + if (audio) { + audio.volume = readStoredVolume(); + if (volumeInput) volumeInput.value = String(audio.volume); + setPlaying(!audio.paused); + audio.addEventListener('play', () => { + setPlaying(true); + setStatus(playbackPhase === 'preroll' + ? 'KI-Transparenzhinweis läuft – danach startet Landwelle live.' + : 'Landwelle läuft live.'); + announcePlayback(); + if ('mediaSession' in navigator) navigator.mediaSession.playbackState = 'playing'; + }); + audio.addEventListener('pause', () => { + setPlaying(false); + if ('mediaSession' in navigator) navigator.mediaSession.playbackState = 'paused'; + }); + audio.addEventListener('ended', () => { + if (playbackPhase === 'preroll' && !prerollCompleted) { + startLiveStream().catch((error) => { + setPlaying(false); + setStatus('Der Livestream konnte nach dem Hinweis nicht gestartet werden.'); + console.error('Landwelle Popup-Player Pre-Roll:', error); + }); + } + }); + audio.addEventListener('waiting', () => setStatus( + playbackPhase === 'preroll' + ? 'KI-Transparenzhinweis wird geladen …' + : 'Livestream wird gepuffert …' + )); + audio.addEventListener('playing', () => { + setPlaying(true); + setStatus(playbackPhase === 'preroll' + ? 'KI-Transparenzhinweis läuft – danach startet Landwelle live.' + : 'Landwelle läuft live.'); + }); + audio.addEventListener('error', () => { + if (playbackPhase === 'preroll' && !prerollCompleted) { + prerollCompleted = true; + setStatus('Der KI-Hinweis konnte nicht geladen werden. Landwelle startet direkt live …'); + startLiveStream().catch((error) => { + setPlaying(false); + setStatus('Der Stream ist momentan nicht erreichbar.'); + console.error('Landwelle Popup-Player Pre-Roll-Fallback:', error); + }); + return; + } + setPlaying(false); + setStatus('Der Stream ist momentan nicht erreichbar.'); + }); + } + + playButton?.addEventListener('click', toggleAudio); + volumeInput?.addEventListener('input', () => { + const value = Number(volumeInput.value); + if (!audio || !Number.isFinite(value)) return; + audio.volume = value; + storeVolume(value); + }); + closeButton?.addEventListener('click', closeWindow); + + playbackChannel?.addEventListener('message', (event) => { + if (event.data?.type !== 'playing' || event.data?.source === playbackID) return; + if (audio && !audio.paused) { + audio.pause(); + setStatus('Die Wiedergabe läuft jetzt in einem anderen Landwelle-Player.'); + } + }); + + if ('mediaSession' in navigator) { + try { + navigator.mediaSession.setActionHandler('play', () => { startPlayback().catch(() => {}); }); + navigator.mediaSession.setActionHandler('pause', () => audio?.pause()); + navigator.mediaSession.setActionHandler('stop', () => { + audio?.pause(); + if (audio) audio.currentTime = 0; + }); + } catch (_) { + // Nicht alle Browser unterstützen sämtliche Media-Session-Aktionen. + } + } + + document.addEventListener('visibilitychange', () => { + if (!document.hidden) { + window.clearTimeout(refreshTimer); + window.clearTimeout(programTimer); + loadNow(); + loadProgram(); + } + }); + window.addEventListener('pagehide', () => { + window.clearTimeout(refreshTimer); + window.clearTimeout(programTimer); + playbackChannel?.close(); + }, { once: true }); + + window.landwelleStandalonePlayer = Object.freeze({ + play: async () => { + if (!audio || !audio.paused) return; + try { await startPlayback(); } catch (_) { setStatus('Bitte klicke auf Play, um Landwelle zu starten.'); } + }, + pause: () => audio?.pause(), + toggle: toggleAudio, + isPlaying: () => Boolean(audio && !audio.paused) + }); + + loadNow(); + loadProgram(); + window.setTimeout(tryAutoplay, 120); +})(); diff --git a/web/assets/playlist-hero-landwelle-v3.png b/web/assets/playlist-hero-landwelle-v3.png new file mode 100644 index 0000000..df0abef Binary files /dev/null and b/web/assets/playlist-hero-landwelle-v3.png differ diff --git a/web/assets/presenter-abend-v14.svg b/web/assets/presenter-abend-v14.svg new file mode 100644 index 0000000..d1d9147 --- /dev/null +++ b/web/assets/presenter-abend-v14.svg @@ -0,0 +1 @@ +♫ diff --git a/web/assets/presenter-anna-v14.svg b/web/assets/presenter-anna-v14.svg new file mode 100644 index 0000000..89ac0de --- /dev/null +++ b/web/assets/presenter-anna-v14.svg @@ -0,0 +1 @@ +AL diff --git a/web/assets/presenter-jan-v14.svg b/web/assets/presenter-jan-v14.svg new file mode 100644 index 0000000..5564f2b --- /dev/null +++ b/web/assets/presenter-jan-v14.svg @@ -0,0 +1 @@ +JG diff --git a/web/assets/presenter-tom-v14.svg b/web/assets/presenter-tom-v14.svg new file mode 100644 index 0000000..cafb7fe --- /dev/null +++ b/web/assets/presenter-tom-v14.svg @@ -0,0 +1 @@ +TW diff --git a/web/assets/program-hero-v2.png b/web/assets/program-hero-v2.png new file mode 100644 index 0000000..c361ad0 Binary files /dev/null and b/web/assets/program-hero-v2.png differ diff --git a/web/assets/program-v1.css b/web/assets/program-v1.css new file mode 100644 index 0000000..effbd50 --- /dev/null +++ b/web/assets/program-v1.css @@ -0,0 +1 @@ +.program-week-page{background:#f4f6f2}.program-week-hero{position:relative;isolation:isolate;overflow:hidden;min-height:clamp(320px,40vw,520px);display:flex;align-items:flex-end;background:#101813 url("/assets/program-hero-v2.png") center 52%/cover no-repeat}.program-week-hero::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(8,14,11,.80) 0%,rgba(8,14,11,.48) 38%,rgba(8,14,11,.12) 72%),linear-gradient(0deg,rgba(8,14,11,.66) 0%,transparent 58%)}.program-week-hero::after{content:"";position:absolute;inset:auto -8% -75% auto;width:520px;height:520px;border-radius:50%;background:radial-gradient(circle,rgba(167,220,57,.16),transparent 68%)}.program-week-hero .page-shell{position:relative;z-index:1;padding-top:94px;padding-bottom:58px}.program-week-hero span,.program-week-hero h1,.program-week-hero p{text-shadow:0 2px 18px rgba(0,0,0,.52)}.program-week-hero p{max-width:760px}.program-overview{align-items:start}.program-main-card{min-width:0}.program-card-head{display:flex;justify-content:space-between;align-items:flex-start;gap:22px}.program-updated{flex:0 0 auto;padding:8px 11px;border-radius:999px;background:#eef3ea;color:#64705f;font-size:11px;font-weight:800}.program-day-tabs{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:7px;margin:25px 0 20px}.program-day-tabs button{min-width:0;border:1px solid #dce2d9;border-radius:12px;background:#f8faf7;color:#354033;padding:11px 5px;font-weight:850;cursor:pointer}.program-day-tabs button small{display:block;margin-top:2px;color:inherit;font-size:8px;text-transform:uppercase}.program-day-tabs button.is-active{border-color:#79b51e;background:#79b51e;color:#11200d;box-shadow:0 7px 18px rgba(88,135,20,.2)}.program-day-panel[hidden]{display:none}.program-day-panel>header{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:12px}.program-day-panel>header span{color:#75aa25;font-size:10px;font-weight:900;text-transform:uppercase;letter-spacing:.08em}.program-day-panel>header h3{margin:3px 0 0;font-size:25px}.program-day-panel>header>b{padding:7px 10px;border-radius:999px;background:#edf2e9;color:#65705f;font-size:10px;text-transform:uppercase}.program-compact-list{display:grid;gap:8px;max-height:520px;overflow:auto;padding-right:5px;scrollbar-width:thin}.program-compact-entry{display:grid;grid-template-columns:105px 52px minmax(0,1fr) auto;align-items:center;gap:14px;padding:11px 13px;border:1px solid #e1e6de;border-radius:12px;background:#fff}.program-compact-entry.is-live{border-color:#9bc94c;background:linear-gradient(90deg,#eff8e4,#fff)}.program-compact-entry time{font-size:12px;font-weight:900;color:#303a2f}.program-compact-entry img{width:48px;height:48px;border-radius:50%;object-fit:cover;border:2px solid #e3e8df}.program-entry-copy{min-width:0}.program-entry-copy>span{display:block;color:#76a928;font-size:9px;font-weight:900;text-transform:uppercase}.program-entry-copy h4{margin:2px 0;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.program-entry-copy strong{display:block;font-size:11px}.program-entry-copy p{margin:3px 0 0;color:#657065;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.program-live-badge{padding:7px 9px;border-radius:999px;background:#74ad20;color:#fff;font-size:9px;text-transform:uppercase;white-space:nowrap}.program-side-card{position:sticky;top:96px}.program-side-card>p strong{color:#79af27}.program-side-note{display:grid;gap:3px;margin-top:18px;padding-top:16px;border-top:1px solid rgba(255,255,255,.15)}.program-side-note b{font-size:12px}.program-side-note span{font-size:11px;color:#d4ddd1}.program-info-wall{padding-top:34px;padding-bottom:54px}.program-benefits{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.program-benefits article{display:flex;gap:13px;align-items:flex-start;padding:17px;border:1px solid #dfe5dc;border-radius:14px;background:#fff}.program-benefits article>b{display:grid;place-items:center;width:38px;height:38px;flex:0 0 auto;border-radius:11px;background:#eaf4db;color:#6ea51d;font-size:20px}.program-benefits h3{margin:0 0 4px;font-size:16px}.program-benefits p{margin:0;color:#657065;font-size:12px;line-height:1.5}.program-empty{text-align:center;padding:48px 18px;border:1px dashed #d7ddd3;border-radius:14px;background:#f8faf7}.program-empty>span{font-size:30px;color:#79af27}.program-empty h4{margin:7px 0}.program-empty p{margin:0;color:#697269}@media(max-width:900px){.program-day-tabs{grid-template-columns:repeat(4,minmax(0,1fr))}.program-side-card{position:static}.program-benefits{grid-template-columns:1fr}.program-compact-list{max-height:none}}@media(max-width:650px){.program-week-hero{background-position:62% 50%;min-height:350px}.program-week-hero .page-shell{padding-top:82px;padding-bottom:44px}.program-card-head{display:block}.program-updated{display:inline-block;margin-top:10px}.program-day-tabs{display:flex;overflow-x:auto;padding-bottom:4px;scrollbar-width:thin}.program-day-tabs button{flex:0 0 92px}.program-compact-entry{grid-template-columns:78px 43px minmax(0,1fr);gap:9px}.program-compact-entry img{width:40px;height:40px}.program-live-badge{grid-column:3;width:max-content}.program-entry-copy p{display:none}.program-day-panel>header h3{font-size:21px}} diff --git a/web/assets/program-v1.js b/web/assets/program-v1.js new file mode 100644 index 0000000..c033ea5 --- /dev/null +++ b/web/assets/program-v1.js @@ -0,0 +1,19 @@ +(()=>{ + const tabs=[...document.querySelectorAll('[data-program-day]')]; + const panels=[...document.querySelectorAll('[data-program-panel]')]; + if(!tabs.length||!panels.length)return; + const activate=id=>{ + tabs.forEach(tab=>{ + const active=tab.dataset.programDay===id; + tab.classList.toggle('is-active',active); + tab.setAttribute('aria-selected',String(active)); + }); + panels.forEach(panel=>{ + const active=panel.dataset.programPanel===id; + panel.hidden=!active; + panel.classList.toggle('is-active',active); + }); + }; + tabs.forEach(tab=>tab.addEventListener('click',()=>activate(tab.dataset.programDay))); + if(!tabs.some(tab=>tab.classList.contains('is-active')))activate(tabs[0].dataset.programDay); +})(); diff --git a/web/assets/site-content-v2.css b/web/assets/site-content-v2.css new file mode 100644 index 0000000..7f2ab69 --- /dev/null +++ b/web/assets/site-content-v2.css @@ -0,0 +1,2 @@ +.site-content-page{background:#f3f6ef;color:#1d281d}.site-content-hero{min-height:340px;display:flex;align-items:flex-end;padding:125px 0 58px;background:radial-gradient(circle at 82% 22%,rgba(143,205,56,.26),transparent 28%),linear-gradient(135deg,#101c13,#253b20);color:#fff}.site-content-hero span,.site-content-block>span{color:#9bd64a;font-size:.75rem;font-weight:900;letter-spacing:.14em;text-transform:uppercase}.site-content-hero h1{margin:8px 0 12px;font-size:clamp(2.7rem,6vw,5rem);line-height:1}.site-content-hero p{max-width:760px;margin:0;color:#dce6da;font-size:1.12rem;line-height:1.7}.site-content-layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:28px;padding-top:52px;padding-bottom:62px}.site-content-main{display:grid;gap:16px}.site-content-block{padding:28px;border:1px solid #dce4d8;border-radius:20px;background:#fff;box-shadow:0 12px 32px rgba(34,55,29,.06)}.site-content-block h2{margin:0 0 10px;font-size:1.55rem}.site-content-block p,.contact-card-grid p{margin:0;color:#586458;line-height:1.75;white-space:pre-line}.site-content-block a,.site-content-side a,.faq-item a,.faq-help a,.contact-card-grid a{display:inline-flex;margin-top:17px;color:#568a18;font-weight:900;text-decoration:none}.site-content-side{position:sticky;top:92px;align-self:start;padding:28px;border-radius:22px;background:#142017;color:#fff}.site-content-side img{width:180px;max-width:100%;margin-bottom:24px}.site-content-side span{display:block;color:#9dd84a;font-size:.72rem;font-weight:900;text-transform:uppercase;letter-spacing:.1em}.site-content-side strong{display:block;margin:8px 0;font-size:1.18rem}.site-content-side p{color:#c8d2c7;line-height:1.6}.site-content-side a{color:#b4e66f}.site-content-empty{padding:38px;border:1px dashed #bdcbb7;border-radius:20px;background:#fff;text-align:center}.faq-layout{display:grid;grid-template-columns:minmax(0,1fr) 310px;gap:28px;padding-top:52px;padding-bottom:62px}.faq-list{display:grid;gap:12px}.faq-item{overflow:hidden;border:1px solid #dce4d8;border-radius:16px;background:#fff}.faq-item summary{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:20px 22px;cursor:pointer;font-size:1.05rem;font-weight:850}.faq-item summary::-webkit-details-marker{display:none}.faq-item summary b{display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:#edf5e5;color:#5c8b20;font-size:1.3rem}.faq-item[open] summary b{transform:rotate(45deg)}.faq-item>div{padding:0 22px 22px}.faq-item p{margin:0;color:#5c685c;line-height:1.7;white-space:pre-line}.faq-help{align-self:start;padding:27px;border-radius:22px;background:linear-gradient(145deg,#1a2a1d,#0f1711);color:#fff}.faq-help span{color:#9bd64a;font-size:.72rem;font-weight:900;text-transform:uppercase}.faq-help h2{margin:8px 0}.faq-help p{color:#cbd5ca}.faq-help a{color:#b6e873}.contact-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(360px,.75fr);gap:24px;padding-top:52px;padding-bottom:64px}.contact-card-grid{display:grid;grid-template-columns:1fr 1fr;gap:15px}.contact-card-grid article{padding:24px;border:1px solid #dce4d8;border-radius:18px;background:#fff}.contact-card-grid span,.contact-form-card>span{color:#629323;font-size:.7rem;font-weight:900;text-transform:uppercase;letter-spacing:.1em}.contact-card-grid h2{margin:6px 0 10px;font-size:1.25rem}.contact-form-card{padding:28px;border-radius:22px;background:#152218;color:#fff;box-shadow:0 20px 55px rgba(20,38,20,.18)}.contact-form-card h2{margin:7px 0}.contact-form-card>p{color:#c8d3c7}.contact-form-card form{display:grid;gap:13px;margin-top:20px}.contact-form-card label>span{display:block;margin-bottom:6px;color:#e8eee7;font-size:.82rem;font-weight:750}.contact-form-card input,.contact-form-card select,.contact-form-card textarea{width:100%;border:1px solid #425347;border-radius:10px;padding:11px 12px;background:#fff;color:#182119;font:inherit}.contact-form-card textarea{resize:vertical}.contact-privacy{display:flex;gap:10px;align-items:flex-start}.contact-privacy input{width:auto;margin-top:4px}.contact-privacy span{margin:0!important;color:#cdd7cd!important;font-size:.74rem!important;font-weight:500!important;line-height:1.5}.contact-privacy a{color:#b6e873}.contact-form-card button{border:0;border-radius:999px;padding:12px 18px;background:#8acb35;color:#10200d;font-weight:900;cursor:pointer}.contact-honeypot{position:absolute;left:-10000px}.contact-alert{padding:12px;border-radius:10px}.contact-alert.is-error{background:#6e2f2c}.contact-alert.is-success{background:#2f6637}@media(max-width:900px){.site-content-layout,.faq-layout,.contact-layout{grid-template-columns:1fr}.site-content-side{position:relative;top:auto}.contact-card-grid{grid-template-columns:1fr 1fr}}@media(max-width:620px){.site-content-hero{min-height:290px;padding:105px 0 42px}.site-content-layout,.faq-layout,.contact-layout{padding-top:34px;padding-bottom:42px}.contact-card-grid{grid-template-columns:1fr}.site-content-block,.contact-form-card{padding:21px}} +.site-content-body p,.faq-item-body p,.contact-block-body p{margin:0;color:#586458;line-height:1.75}.site-content-body p+p,.faq-item-body p+p,.contact-block-body p+p{margin-top:1.05em} diff --git a/web/assets/story-land.jpg b/web/assets/story-land.jpg new file mode 100644 index 0000000..68df119 Binary files /dev/null and b/web/assets/story-land.jpg differ diff --git a/web/assets/story-muehle.jpg b/web/assets/story-muehle.jpg new file mode 100644 index 0000000..a0b5333 Binary files /dev/null and b/web/assets/story-muehle.jpg differ diff --git a/web/assets/story-team-new.jpg b/web/assets/story-team-new.jpg new file mode 100644 index 0000000..451c667 Binary files /dev/null and b/web/assets/story-team-new.jpg differ diff --git a/web/assets/story-treffen.jpg b/web/assets/story-treffen.jpg new file mode 100644 index 0000000..fed9b7c Binary files /dev/null and b/web/assets/story-treffen.jpg differ diff --git a/web/assets/styles-v22.css b/web/assets/styles-v22.css new file mode 100644 index 0000000..1944d85 --- /dev/null +++ b/web/assets/styles-v22.css @@ -0,0 +1,1307 @@ +:root { + --green: #7fbd00; + --green-dark: #5f9200; + --ink: #101211; + --muted: #727872; + --line: #e3e6e1; + --paper: #ffffff; + --soft: #f4f5f2; + --page: 1270px; + --sidebar: 250px; + --gap: 30px; + --shadow: 0 3px 12px rgba(20, 24, 20, .12); +} +* { box-sizing: border-box; } +html { scroll-behavior: smooth; } +body { margin: 0; color: var(--ink); background: #fff; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.35; } +a { color: inherit; text-decoration: none; } +button, input { font: inherit; } +button { cursor: pointer; } +img { display: block; max-width: 100%; } +.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; } +.page-shell { width: min(var(--page), calc(100% - 40px)); margin-inline: auto; } +.page-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--sidebar); gap: var(--gap); } + +.site-header { height: 72px; background: linear-gradient(90deg, #070908, #111411); color: white; position: relative; z-index: 20; border-bottom: 1px solid rgba(255,255,255,.07); } +.header-inner { height: 100%; display: flex; align-items: center; gap: 26px; } +.brand { width: 158px; height: 62px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; } +.brand img { width: 154px; filter: drop-shadow(0 1px 1px #000); } +.main-nav { display: flex; align-items: center; gap: 31px; margin-left: 8px; flex: 1; } +.main-nav a { color: #f2f4f1; font-weight: 650; font-size: 13px; white-space: nowrap; } +.main-nav a:hover { color: #a6db34; } +.chevron { color: #b9beb9; font-size: 15px; margin-left: 3px; } +.listen-button { border: 0; border-radius: 6px; padding: 12px 19px; color: #fff; background: linear-gradient(#91cb15, #76ac00); box-shadow: inset 0 1px 0 rgba(255,255,255,.26); font-weight: 800; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; } +.listen-button svg { width: 15px; fill: currentColor; } +.search-button { border: 0; background: transparent; color: #fff; width: 38px; height: 38px; padding: 7px; } +.search-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; } +.menu-toggle { display: none; } + +.hero { height: 345px; position: relative; overflow: hidden; color: #fff; background: #2d3629; } +.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 50%; } +.hero-overlay { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6,8,7,.74) 0%, rgba(8,10,8,.48) 45%, rgba(10,12,10,.12) 76%, rgba(8,10,8,.26) 100%), linear-gradient(0deg, rgba(0,0,0,.38), transparent 53%); } +.hero-inner { position: relative; z-index: 2; height: 100%; padding-top: 21px; } +.hero-logo { width: 300px; height: 145px; object-fit: contain; object-position: left center; margin-left: -9px; margin-bottom: -3px; filter: drop-shadow(0 3px 7px rgba(0,0,0,.54)); } +.hero h1 { margin: 0; font-size: clamp(32px, 3.05vw, 42px); line-height: 1.03; letter-spacing: -.035em; font-weight: 860; text-shadow: 0 2px 8px rgba(0,0,0,.55); } +.hero p { margin: 5px 0 13px; font-size: 22px; line-height: 1.2; text-shadow: 0 2px 6px rgba(0,0,0,.7); } +.hero-actions { display: flex; gap: 18px; } +.button { height: 42px; border-radius: 6px; padding: 0 23px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 800; font-size: 13px; } +.button svg { width: 15px; fill: currentColor; } +.button-green { color: white; border: 1px solid #8dc613; background: linear-gradient(#91cb15, #73aa00); box-shadow: 0 3px 10px rgba(0,0,0,.16); } +.button-outline { border: 1px solid rgba(255,255,255,.85); color: #fff; background: rgba(8,10,8,.25); min-width: 218px; } +.button-outline span { font-size: 18px; margin-left: auto; } +.signal-rings { position: absolute; right: 14.5%; top: 35px; width: 280px; height: 270px; opacity: .46; transform: rotate(-5deg); } +.signal-rings i { position: absolute; left: 0; bottom: 0; border: 5px solid rgba(164,214,50,.9); border-left-color: transparent; border-bottom-color: transparent; border-radius: 50%; transform: rotate(-45deg); } +.signal-rings i:nth-child(1){ width: 125px; height:125px; left:70px; bottom:55px; } +.signal-rings i:nth-child(2){ width: 205px; height:205px; left:30px; bottom:15px; } +.signal-rings i:nth-child(3){ width: 285px; height:285px; left:-10px; bottom:-25px; } + +.player-stage { position: relative; z-index: 8; margin-top: -35px; } +.live-player { min-height: 96px; background: linear-gradient(90deg, #0b0d0c, #121512 60%, #080a09); color: #fff; border-radius: 10px; box-shadow: 0 5px 13px rgba(0,0,0,.25); padding: 13px 20px 13px 16px; display: grid; grid-template-columns: 62px 178px minmax(70px, 1fr) 68px 54px 150px 115px; align-items: center; gap: 12px; overflow: hidden; } +.host-avatar { width: 58px; height: 58px; border-radius: 50%; border: 2px solid #90c919; position: relative; overflow: visible; } +.host-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; } +.host-avatar span { position: absolute; right: -4px; bottom: -7px; background: var(--green); color: white; border: 2px solid #101210; border-radius: 5px; font-weight: 900; font-size: 9px; padding: 2px 5px; } +.now-show small, .track-info small { display: block; color: #91c91b; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .02em; } +.now-show strong, .track-info strong { display: block; font-size: 14px; margin-top: 1px; } +.now-show span, .track-info span { display: block; color: #f3f3f3; font-size: 10.5px; margin-top: 2px; line-height: 1.35; } +.waveform { height: 45px; display: flex; align-items: center; justify-content: flex-end; gap: 3px; opacity: .62; overflow: hidden; } +.waveform i { width: 2px; height: 12px; background: #77b800; box-shadow: 0 0 5px rgba(125,189,0,.4); animation: pulse 1.3s ease-in-out infinite alternate; } +.waveform i:nth-child(2n){height:24px;animation-delay:-.7s}.waveform i:nth-child(3n){height:34px;animation-delay:-.25s}.waveform i:nth-child(5n){height:17px;animation-delay:-1s} +@keyframes pulse { to { transform: scaleY(.45); opacity:.45; } } +.player-button { border: 0; width: 58px; height: 58px; border-radius: 50%; color: white; background: radial-gradient(circle at 35% 28%, #a9e02e, #77ad00 70%); display: grid; place-items: center; box-shadow: 0 0 0 5px rgba(121,179,0,.07), 0 4px 13px rgba(0,0,0,.32); } +.player-button svg { width: 24px; fill: currentColor; } +.icon-pause { display:none; }.live-player.is-playing .icon-play{display:none}.live-player.is-playing .icon-pause{display:block} +.track-cover { width: 48px; height: 54px; border-radius: 3px; overflow: hidden; } +.track-cover img { width:100%;height:100%;object-fit:cover; } +.volume { display:flex; align-items:center; gap:8px; } +.volume svg { width:21px; fill:#fff; flex:0 0 auto; } +.volume input { width: 82px; accent-color: var(--green); } +.player-message { margin: 4px 8px 0; height: 0; overflow: visible; color: #777; font-size: 11px; } + +.portal { padding-top: 20px; padding-bottom: 22px; align-items: start; } +.portal-main { min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 20px 25px; } +.portal-section { min-width: 0; } +.section-heading { height: 25px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; } +.section-heading h2 { margin: 0; text-transform: uppercase; font-size: 13px; line-height: 1.2; letter-spacing: .01em; font-weight: 900; } +.section-heading a { color: #383d39; font-size: 10px; white-space: nowrap; } +.compact-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; } +.portal-card { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; box-shadow: 0 2px 6px rgba(22,26,22,.09); } +.portal-card .media { display:block; height: 86px; overflow:hidden; position:relative; background:#dde3d8; } +.portal-card .media img { width:100%;height:100%;object-fit:cover;transition:transform .25s ease; } +.portal-card:hover .media img { transform:scale(1.03); } +.card-copy { padding: 8px 8px 9px; min-height: 82px; } +.card-copy .category { color: #79ae00; font-size: 8px; text-transform: uppercase; font-weight: 900; } +.card-copy h3 { margin: 3px 0 5px; font-size: 11px; line-height: 1.18; font-weight: 820; } +.card-copy p, .card-copy time, .card-copy .place { margin:0; color:#666c66; font-size:8.5px; line-height:1.3; } +.card-copy .place { display:block; margin-top:4px; } +.event-media { height: 78px !important; } +.event-date { position:absolute; left:8px; bottom:0; width:40px; min-height:42px; background:rgba(255,255,255,.96); text-align:center; border-radius:4px 4px 0 0; padding-top:2px; color:#171917; box-shadow:0 1px 4px rgba(0,0,0,.16); } +.event-date b { display:block; color:#70aa00; font-size:19px; line-height:20px; } +.event-date small { font-size:8px; font-weight:900; } +.event-card .card-copy { min-height:90px; } +.story-card .media { height: 82px; } +.story-card .card-copy { min-height: 65px; } +.story-card .card-copy h3 { font-size: 11.5px; } + +.schedule-card { border:1px solid var(--line); border-radius:6px; overflow:hidden; box-shadow:0 2px 6px rgba(22,26,22,.09); background:#fff; } +.schedule-row { min-height: 35px; display:grid; grid-template-columns:95px minmax(0,1fr) 30px auto; align-items:center; gap:9px; padding:3px 8px 3px 10px; border-bottom:1px solid #eceeea; position:relative; } +.schedule-row:last-child { border-bottom:0; } +.schedule-row.is-live { background:linear-gradient(90deg,#ecf7dc,#e7f2dc); } +.schedule-row time { font-size:9px; } +.schedule-info strong { display:block; font-size:10px; } +.schedule-info span { display:block; font-size:8px; color:#5e645e; } +.presenter { width:28px;height:28px;border-radius:50%;object-fit:cover;border:1px solid #dfe3dc; } +.live-badge { background:#7eb700;color:#fff;border-radius:4px;padding:3px 7px;text-transform:uppercase;font-size:7px;font-weight:900;white-space:nowrap; } + +.sidebar { margin-top: -215px; position: relative; z-index: 9; display:flex; flex-direction:column; gap:12px; } +.side-card { background:#fff;border:1px solid var(--line);border-radius:7px;box-shadow:var(--shadow);padding:14px; } +.side-title { display:block;color:#75ad00;text-transform:uppercase;font-size:10px;font-weight:900;letter-spacing:.01em; } +.weather-card { min-height: 214px; padding:14px 15px 12px; } +.weather-main { display:grid;grid-template-columns:58px 55px 1fr;align-items:center;margin-top:7px; } +.weather-icon { width:52px;height:42px;position:relative;display:block; } +.weather-icon:before { content:"";position:absolute;left:17px;top:1px;width:23px;height:23px;border-radius:50%;background:#ffb900;box-shadow:-18px 7px 0 -8px #ffb900,18px 7px 0 -8px #ffb900,0 -18px 0 -9px #ffb900; } +.weather-icon:after { content:"";position:absolute;left:5px;bottom:1px;width:46px;height:22px;border-radius:16px;background:linear-gradient(#e7e9f2,#cdd1e0);box-shadow:18px 5px 0 -7px #d7dae6; } +.weather-main > strong { font-size:34px;font-weight:520;letter-spacing:-.05em; } +.weather-main div b { display:block;font-size:10px; }.weather-main div small{display:block;color:#666;font-size:9px;margin-top:2px;} +.weather-facts { display:flex;justify-content:space-between;border-top:1px solid #eff0ed;border-bottom:1px solid #eff0ed;padding:9px 1px;margin:8px 0;color:#626862;font-size:8.5px; } +.forecast { display:grid;grid-template-columns:repeat(4,1fr);text-align:center; } +.forecast span { font-size:8px;border-right:1px solid #efefed; }.forecast span:last-child{border-right:0}.forecast small{display:block;font-size:18px;margin:2px 0}.forecast b{display:block;font-size:9px}.forecast em{font-style:normal;color:#8b908b;font-weight:500} +.weather-card > a,.tip-card > a,.traffic-card > a { display:block;text-align:center;color:#6fa500;font-weight:750;font-size:8.5px;margin-top:7px; } +.tip-card { padding:13px 12px 10px; } +.tip-visual { display:block;height:78px;margin-top:6px;border-radius:5px;overflow:hidden;position:relative; } +.tip-visual img{width:100%;height:100%;object-fit:cover}.tip-visual:after{content:"";position:absolute;inset:0;background:linear-gradient(0deg,rgba(0,0,0,.65),transparent 70%)}.tip-visual strong{position:absolute;z-index:2;left:10px;bottom:8px;color:white;font-size:10px;line-height:1.2} +.tip-card > a { text-align:left; } +.traffic-card { display:grid;grid-template-columns:1fr auto;gap:4px 10px;align-items:center;min-height:84px; } +.traffic-card small{display:block;color:#666;font-size:8.5px;margin-top:5px}.traffic-count{width:26px;height:26px;border:1px solid #80b700;border-radius:50%;display:grid;place-items:center;color:#75aa00;font-weight:800}.traffic-card>a{grid-column:1/-1;text-align:left;margin:2px 0 0} +.app-card { min-height: 153px; border-radius:7px;overflow:hidden;position:relative;color:#fff;padding:14px 13px;background:linear-gradient(135deg,#75ab00,#426b00);box-shadow:var(--shadow); } +.app-copy { width:62%;position:relative;z-index:2 }.app-copy>span{display:block;text-transform:uppercase;font-weight:900;font-size:12px}.app-copy>strong{display:block;font-size:9px;margin:2px 0 7px}.app-copy ul{padding:0;margin:0 0 9px;list-style:none;font-size:8.5px;line-height:1.55}.app-copy li:before{content:"◉";margin-right:5px}.store-buttons{display:flex;gap:5px}.store-buttons b{background:#050505;border:1px solid rgba(255,255,255,.55);padding:4px 6px;border-radius:4px;font-size:7px;white-space:nowrap}.phone{position:absolute;right:-5px;bottom:-18px;width:92px;height:160px;border-radius:18px;background:#0b0c0b;border:5px solid #111;transform:rotate(8deg);box-shadow:0 6px 18px rgba(0,0,0,.35)}.phone:before{content:"";position:absolute;top:3px;left:28px;width:28px;height:5px;border-radius:8px;background:#252725}.phone-screen{position:absolute;inset:8px 4px 4px;border-radius:10px;background:radial-gradient(circle at 50% 30%,#28341d,#050706 70%);display:grid;place-items:center;overflow:hidden}.phone-screen img{width:76px;filter:drop-shadow(0 2px 2px #000)} + +.site-footer { background:linear-gradient(90deg,#080a09,#111412);color:#e8ebe7;padding:18px 0 16px; } +.footer-grid { display:grid;grid-template-columns:220px repeat(4,1fr) 155px;gap:28px;align-items:start; } +.footer-brand { height:90px;display:flex;align-items:center }.footer-brand img{width:170px}.footer-grid>div:not(.footer-brand):not(.footer-domain){display:flex;flex-direction:column}.footer-grid strong{font-size:9px;text-transform:uppercase;margin-bottom:4px}.footer-grid a{font-size:9px;color:#d4d8d3;line-height:1.55}.footer-domain b{font-size:17px;font-weight:500}.socials{display:flex;gap:9px;margin-top:12px}.socials span{width:25px;height:25px;border:1px solid #6e746e;border-radius:50%;display:grid;place-items:center;font-size:11px} + +@media (max-width: 1120px) { + :root{--sidebar:230px;--gap:22px}.main-nav{gap:18px}.brand{width:145px}.listen-button{padding-inline:13px}.live-player{grid-template-columns:56px 165px 1fr 60px 48px 125px}.volume{display:none}.portal-main{gap:18px}.footer-grid{grid-template-columns:190px repeat(4,1fr);}.footer-domain{display:none} +} +@media (max-width: 900px) { + .site-header{height:68px}.header-inner{gap:12px}.menu-toggle{display:flex;margin-left:auto;width:42px;height:42px;border:0;background:transparent;flex-direction:column;justify-content:center;gap:5px;padding:9px}.menu-toggle span:not(.sr-only){display:block;height:2px;background:#fff;border-radius:2px}.main-nav{position:absolute;left:0;right:0;top:68px;background:#0b0d0c;display:none;flex-direction:column;align-items:flex-start;padding:18px 22px 24px;gap:15px}.main-nav.is-open{display:flex}.listen-button{margin-left:0}.search-button{display:none}.hero{height:370px}.page-layout{grid-template-columns:1fr}.player-stage{margin-top:-35px}.sidebar{margin-top:0;display:grid;grid-template-columns:1fr 1fr}.portal-main{grid-template-columns:1fr}.footer-grid{grid-template-columns:170px repeat(2,1fr)}.footer-grid>div:nth-child(4),.footer-grid>div:nth-child(5){display:none!important} +} +@media (max-width: 650px) { + .page-shell{width:min(100% - 24px,var(--page))}.brand{width:132px}.brand img{width:132px}.listen-button{font-size:0;width:43px;height:40px;padding:0;justify-content:center}.listen-button svg{width:18px}.hero{height:440px}.hero-inner{padding-top:38px}.hero-logo{width:250px;height:135px}.hero h1{font-size:34px;max-width:390px}.hero p{font-size:18px}.hero-actions{flex-direction:column;align-items:stretch;max-width:300px;gap:10px}.signal-rings{right:-85px;top:75px;opacity:.25}.live-player{grid-template-columns:50px 1fr 56px;padding:13px;min-height:88px}.host-avatar{width:48px;height:48px}.waveform,.track-cover,.track-info,.volume{display:none}.now-show span{font-size:9px}.player-button{width:52px;height:52px}.compact-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.compact-grid article:last-child{display:none}.portal-card .media{height:105px}.sidebar{grid-template-columns:1fr}.section-heading h2{font-size:12px}.section-heading a{display:none}.footer-grid{grid-template-columns:1fr 1fr;gap:18px}.footer-brand{grid-column:1/-1;height:70px}.footer-brand img{width:155px}.footer-grid>div:nth-child(3){display:none!important} +} +@media (prefers-reduced-motion: reduce){html{scroll-behavior:auto}.waveform i{animation:none}*{transition:none!important}} + +/* + * v8 – komfortable Standarddarstellung + * + * Die Desktop-Ansicht ist bewusst etwa so groß und gut lesbar wie die + * bisherige Seite bei ca. 125–130 % Browser-Zoom. Dabei wird nicht die + * komplette Seite technisch gezoomt; Typografie, Abstände, Karten und + * Bedienelemente wurden nativ vergrößert. So bleiben Responsive Layout, + * Schärfe und Bedienbarkeit erhalten. + */ +@media (min-width: 1500px) { + :root { + --page: 1540px; + --sidebar: 305px; + --gap: 36px; + --shadow: 0 4px 16px rgba(20, 24, 20, .13); + } + + body { font-size: 16px; line-height: 1.42; } + .page-shell { width: min(var(--page), calc(100% - 52px)); } + + .site-header { height: 86px; } + .header-inner { gap: 30px; } + .brand { width: 190px; height: 76px; } + .brand img { width: 186px; } + .main-nav { gap: 34px; margin-left: 10px; } + .main-nav a { font-size: 15px; } + .chevron { font-size: 17px; } + .listen-button { border-radius: 7px; padding: 14px 22px; gap: 10px; font-size: 15px; } + .listen-button svg { width: 17px; } + .search-button { width: 44px; height: 44px; padding: 8px; } + .search-button svg { width: 25px; } + + .hero { height: 420px; } + .hero-inner { padding-top: 27px; } + .hero-logo { width: 365px; height: 174px; margin-left: -11px; margin-bottom: -4px; } + .hero h1 { font-size: clamp(40px, 3.1vw, 52px); } + .hero p { margin: 7px 0 18px; font-size: 27px; } + .hero-actions { gap: 21px; } + .button { height: 51px; border-radius: 7px; padding: 0 28px; gap: 11px; font-size: 15px; } + .button svg { width: 17px; } + .button-outline { min-width: 265px; } + .button-outline span { font-size: 22px; } + .signal-rings { right: 14%; top: 43px; width: 338px; height: 326px; } + .signal-rings i { border-width: 6px; } + .signal-rings i:nth-child(1) { width: 151px; height: 151px; left: 85px; bottom: 67px; } + .signal-rings i:nth-child(2) { width: 248px; height: 248px; left: 36px; bottom: 18px; } + .signal-rings i:nth-child(3) { width: 345px; height: 345px; left: -12px; bottom: -30px; } + + .player-stage { margin-top: -43px; } + .live-player { + min-height: 118px; + border-radius: 12px; + padding: 16px 24px 16px 20px; + grid-template-columns: 76px 220px minmax(90px, 1fr) 82px 66px 185px 142px; + gap: 15px; + } + .host-avatar { width: 70px; height: 70px; border-width: 3px; } + .host-avatar span { right: -5px; bottom: -8px; border-radius: 6px; font-size: 11px; padding: 3px 6px; } + .now-show small, .track-info small { font-size: 12px; } + .now-show strong, .track-info strong { font-size: 17px; margin-top: 2px; } + .now-show span, .track-info span { font-size: 13px; margin-top: 3px; } + .waveform { height: 55px; gap: 4px; } + .waveform i { width: 3px; height: 15px; } + .waveform i:nth-child(2n) { height: 29px; } + .waveform i:nth-child(3n) { height: 41px; } + .waveform i:nth-child(5n) { height: 21px; } + .player-button { width: 70px; height: 70px; } + .player-button svg { width: 29px; } + .track-cover { width: 59px; height: 66px; border-radius: 4px; } + .volume { gap: 10px; } + .volume svg { width: 25px; } + .volume input { width: 100px; } + .player-message { margin: 5px 10px 0; font-size: 13px; } + + .portal { padding-top: 28px; padding-bottom: 31px; } + .portal-main { gap: 29px 31px; } + .section-heading { height: 33px; gap: 12px; } + .section-heading h2 { font-size: 16px; } + .section-heading a { font-size: 12px; } + .compact-grid { gap: 13px; } + .portal-card { border-radius: 8px; box-shadow: 0 3px 9px rgba(22,26,22,.1); } + .portal-card .media { height: 108px; } + .card-copy { padding: 11px 11px 12px; min-height: 104px; } + .card-copy .category { font-size: 10px; } + .card-copy h3 { margin: 4px 0 7px; font-size: 14px; line-height: 1.24; } + .card-copy p, .card-copy time, .card-copy .place { font-size: 10.5px; line-height: 1.38; } + .card-copy .place { margin-top: 5px; } + .event-media { height: 99px !important; } + .event-date { left: 10px; width: 49px; min-height: 52px; border-radius: 5px 5px 0 0; padding-top: 3px; } + .event-date b { font-size: 23px; line-height: 25px; } + .event-date small { font-size: 10px; } + .event-card .card-copy { min-height: 112px; } + .story-card .media { height: 103px; } + .story-card .card-copy { min-height: 82px; } + .story-card .card-copy h3 { font-size: 14.5px; } + + .schedule-card { border-radius: 8px; box-shadow: 0 3px 9px rgba(22,26,22,.1); } + .schedule-row { min-height: 45px; grid-template-columns: 118px minmax(0,1fr) 38px auto; gap: 11px; padding: 4px 10px 4px 13px; } + .schedule-row time { font-size: 11px; } + .schedule-info strong { font-size: 12.5px; } + .schedule-info span { font-size: 10px; } + .presenter { width: 35px; height: 35px; } + .live-badge { border-radius: 5px; padding: 4px 9px; font-size: 9px; } + + .sidebar { margin-top: -262px; gap: 15px; } + .side-card { border-radius: 9px; padding: 17px; } + .side-title { font-size: 12px; } + .weather-card { min-height: 263px; padding: 17px 18px 15px; } + .weather-main { grid-template-columns: 70px 67px 1fr; margin-top: 9px; } + .weather-icon { width: 63px; height: 51px; } + .weather-icon:before { left: 21px; top: 1px; width: 28px; height: 28px; box-shadow: -22px 9px 0 -10px #ffb900, 22px 9px 0 -10px #ffb900, 0 -22px 0 -11px #ffb900; } + .weather-icon:after { left: 6px; bottom: 1px; width: 56px; height: 27px; border-radius: 19px; box-shadow: 22px 6px 0 -9px #d7dae6; } + .weather-main > strong { font-size: 42px; } + .weather-main div b { font-size: 12px; } + .weather-main div small { font-size: 11px; margin-top: 3px; } + .weather-facts { padding: 11px 1px; margin: 10px 0; font-size: 10.5px; } + .forecast span { font-size: 10px; } + .forecast small { font-size: 22px; margin: 3px 0; } + .forecast b { font-size: 11px; } + .weather-card > a, .tip-card > a, .traffic-card > a { font-size: 10.5px; margin-top: 9px; } + .tip-card { padding: 16px 15px 12px; } + .tip-visual { height: 98px; margin-top: 8px; border-radius: 6px; } + .tip-visual strong { left: 12px; bottom: 10px; font-size: 12.5px; } + .traffic-card { gap: 5px 12px; min-height: 104px; } + .traffic-card small { font-size: 10.5px; margin-top: 6px; } + .traffic-count { width: 32px; height: 32px; } + .app-card { min-height: 188px; border-radius: 9px; padding: 17px 16px; } + .app-copy > span { font-size: 15px; } + .app-copy > strong { font-size: 11px; margin: 3px 0 9px; } + .app-copy ul { margin-bottom: 11px; font-size: 10.5px; } + .store-buttons { gap: 6px; } + .store-buttons b { padding: 5px 8px; border-radius: 5px; font-size: 8.5px; } + .phone { right: -6px; bottom: -22px; width: 112px; height: 195px; border-radius: 22px; border-width: 6px; } + .phone:before { top: 4px; left: 34px; width: 34px; height: 6px; } + .phone-screen { inset: 10px 5px 5px; border-radius: 12px; } + .phone-screen img { width: 93px; } + + .site-footer { padding: 24px 0 21px; } + .footer-grid { grid-template-columns: 270px repeat(4,1fr) 190px; gap: 34px; } + .footer-brand { height: 110px; } + .footer-brand img { width: 208px; } + .footer-grid strong { font-size: 11px; margin-bottom: 6px; } + .footer-grid a { font-size: 11px; line-height: 1.65; } + .footer-domain b { font-size: 21px; } + .socials { gap: 11px; margin-top: 15px; } + .socials span { width: 31px; height: 31px; font-size: 13px; } +} + +/* Mittlere Desktop- und Tablet-Breite: ebenfalls besser lesbar, aber kompakter. */ +@media (min-width: 901px) and (max-width: 1499px) { + :root { --sidebar: 255px; --gap: 24px; } + body { font-size: 15px; } + .site-header { height: 76px; } + .brand { width: 158px; height: 66px; } + .brand img { width: 154px; } + .main-nav { gap: 15px; } + .main-nav a { font-size: 13.5px; } + .listen-button { padding: 12px 14px; font-size: 13px; } + .hero { height: 385px; } + .hero-logo { width: 325px; height: 158px; } + .hero h1 { font-size: clamp(35px, 4vw, 45px); } + .hero p { font-size: 23px; } + .live-player { min-height: 105px; grid-template-columns: 64px 180px 1fr 65px 52px 140px; padding: 14px 18px; } + .host-avatar { width: 60px; height: 60px; } + .now-show small, .track-info small { font-size: 10.5px; } + .now-show strong, .track-info strong { font-size: 15px; } + .now-show span, .track-info span { font-size: 11px; } + .player-button { width: 60px; height: 60px; } + .track-cover { width: 50px; height: 58px; } + .volume { display: none; } + .section-heading h2 { font-size: 14px; } + .section-heading a { font-size: 11px; } + .portal-card .media { height: 96px; } + .card-copy { min-height: 92px; padding: 9px 9px 10px; } + .card-copy .category { font-size: 9px; } + .card-copy h3 { font-size: 12.5px; } + .card-copy p, .card-copy time, .card-copy .place { font-size: 9.5px; } + .event-media { height: 87px !important; } + .story-card .media { height: 91px; } + .schedule-row { min-height: 40px; } + .schedule-row time { font-size: 10px; } + .schedule-info strong { font-size: 11px; } + .schedule-info span { font-size: 9px; } + .sidebar { margin-top: -230px; } + .side-title { font-size: 11px; } + .weather-main > strong { font-size: 37px; } + .weather-main div b { font-size: 11px; } + .weather-main div small, .weather-facts, .traffic-card small { font-size: 9.5px; } + .app-copy > span { font-size: 13px; } + .app-copy > strong { font-size: 10px; } + .app-copy ul { font-size: 9.5px; } +} + +/* Auf kleinen Bildschirmen bleibt das Layout responsiv, die Schrift ist jedoch nicht unnötig klein. */ +@media (max-width: 900px) { + body { font-size: 15px; } + .main-nav a { font-size: 15px; } + .section-heading h2 { font-size: 14px; } + .section-heading a { font-size: 11px; } + .card-copy .category { font-size: 9.5px; } + .card-copy h3 { font-size: 13px; } + .card-copy p, .card-copy time, .card-copy .place { font-size: 10px; } + .schedule-row time { font-size: 10px; } + .schedule-info strong { font-size: 11px; } + .schedule-info span { font-size: 9px; } + .side-title { font-size: 11px; } + .footer-grid strong, .footer-grid a { font-size: 10px; } +} + +/* + * v9 – eigener Landwelle Cookie-Consent + * + * Der Dialog blockiert beim ersten Besuch die Bedienung, bis eine echte + * Entscheidung getroffen wurde. Ablehnen und Akzeptieren sind direkt + * erreichbar. Spätere optionale Dienste können auf das JavaScript-Ereignis + * `landwelle:consent-changed` reagieren. + */ +.footer-consent-button { + appearance: none; + border: 0; + border-bottom: 1px solid transparent; + padding: 0; + margin: 0; + color: #d4d8d3; + background: transparent; + font-size: inherit; + line-height: 1.65; + text-align: left; +} +.footer-consent-button:hover, +.footer-consent-button:focus-visible { + color: #a8d73e; + border-bottom-color: currentColor; +} + +html.consent-open, +html.consent-open body { + overflow: hidden; +} + +.consent-layer[hidden] { display: none; } +.consent-layer { + position: fixed; + inset: 0; + z-index: 1000; + display: grid; + place-items: center; + padding: 24px; + background: + radial-gradient(circle at 80% 15%, rgba(127, 189, 0, .18), transparent 33%), + rgba(3, 5, 4, .82); + -webkit-backdrop-filter: blur(8px); + backdrop-filter: blur(8px); +} + +.consent-dialog { + position: relative; + width: min(1080px, 100%); + max-height: min(780px, calc(100vh - 48px)); + display: grid; + grid-template-columns: 340px minmax(0, 1fr); + overflow: hidden; + border: 1px solid rgba(255, 255, 255, .13); + border-radius: 18px; + background: #fff; + box-shadow: 0 28px 80px rgba(0, 0, 0, .48), 0 0 0 1px rgba(127, 189, 0, .08); + outline: none; +} + +.consent-brand-panel { + position: relative; + min-height: 100%; + overflow: hidden; + display: flex; + flex-direction: column; + justify-content: flex-end; + padding: 34px 30px; + color: #fff; + background: + linear-gradient(155deg, rgba(127, 189, 0, .96), rgba(77, 122, 0, .92) 43%, rgba(8, 11, 9, .96) 43.5%, #050706 100%); +} +.consent-brand-panel:after { + content: ""; + position: absolute; + inset: 0; + background: linear-gradient(180deg, transparent 48%, rgba(0, 0, 0, .35)); + pointer-events: none; +} +.consent-brand-panel img { + position: relative; + z-index: 2; + width: 255px; + margin: 0 0 25px -5px; + filter: drop-shadow(0 5px 12px rgba(0, 0, 0, .45)); +} +.consent-brand-panel > span { + position: relative; + z-index: 2; + max-width: 245px; + color: rgba(255, 255, 255, .9); + font-size: 17px; + font-weight: 750; + line-height: 1.3; +} +.consent-signal { + position: absolute; + z-index: 1; + right: -55px; + top: 48px; + width: 285px; + height: 285px; + opacity: .35; + transform: rotate(-8deg); +} +.consent-signal i { + position: absolute; + right: 0; + bottom: 0; + border: 5px solid rgba(255, 255, 255, .95); + border-left-color: transparent; + border-bottom-color: transparent; + border-radius: 50%; + transform: rotate(-45deg); +} +.consent-signal i:nth-child(1) { width: 100px; height: 100px; right: 91px; bottom: 91px; } +.consent-signal i:nth-child(2) { width: 190px; height: 190px; right: 46px; bottom: 46px; } +.consent-signal i:nth-child(3) { width: 280px; height: 280px; } + +.consent-content { + min-width: 0; + overflow: auto; + padding: 38px 42px 30px; + scrollbar-width: thin; + scrollbar-color: #9acb2b #eef1eb; +} +.consent-kicker { + display: block; + margin-bottom: 7px; + color: #70a900; + font-size: 12px; + font-weight: 900; + letter-spacing: .08em; + text-transform: uppercase; +} +.consent-content h2 { + margin: 0; + color: #111411; + font-size: clamp(28px, 3vw, 40px); + line-height: 1.05; + letter-spacing: -.035em; +} +.consent-content > p { + margin: 14px 0 0; + color: #545b54; + font-size: 15px; + line-height: 1.55; +} + +.consent-current { + display: grid; + grid-template-columns: 38px 1fr; + align-items: center; + gap: 12px; + margin-top: 22px; + padding: 13px 15px; + border: 1px solid #dce8c5; + border-radius: 10px; + background: linear-gradient(90deg, #f3f9e9, #fbfcf8); +} +.consent-current-icon { + width: 36px; + height: 36px; + display: grid; + place-items: center; + border-radius: 50%; + color: #fff; + background: linear-gradient(#92cb18, #71a900); + font-size: 18px; + font-weight: 900; + box-shadow: 0 4px 10px rgba(112, 169, 0, .24); +} +.consent-current strong, +.consent-current small { display: block; } +.consent-current strong { color: #202520; font-size: 13px; } +.consent-current small { margin-top: 2px; color: #626962; font-size: 11px; line-height: 1.4; } + +.consent-settings-toggle { + width: 100%; + min-height: 48px; + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 17px; + padding: 0 15px; + border: 1px solid #dfe4dc; + border-radius: 9px; + color: #242824; + background: #f7f8f5; + font-weight: 800; + text-align: left; +} +.consent-settings-toggle:hover { background: #f0f4eb; border-color: #c9d6bc; } +.consent-settings-toggle:focus-visible, +.consent-action:focus-visible, +.consent-close:focus-visible, +.consent-switch input:focus-visible + span { + outline: 3px solid rgba(127, 189, 0, .38); + outline-offset: 3px; +} +.consent-toggle-arrow { + color: #6ea400; + font-size: 22px; + line-height: 1; + transition: transform .2s ease; +} +.consent-settings-toggle[aria-expanded="true"] .consent-toggle-arrow { transform: rotate(180deg); } + +.consent-settings[hidden] { display: none; } +.consent-settings { + margin-top: 9px; + overflow: hidden; + border: 1px solid #e2e6df; + border-radius: 10px; + background: #fff; +} +.consent-category { + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + align-items: center; + gap: 22px; + padding: 15px; + border-bottom: 1px solid #edf0eb; +} +.consent-category:last-child { border-bottom: 0; } +.consent-category strong { display: block; color: #1a1e1a; font-size: 13px; } +.consent-category p { margin: 3px 0 0; color: #697069; font-size: 11px; line-height: 1.45; } + +.consent-switch { + position: relative; + display: block; + width: 48px; + height: 27px; + flex: 0 0 auto; +} +.consent-switch input { + position: absolute; + width: 1px; + height: 1px; + opacity: 0; +} +.consent-switch span { + position: absolute; + inset: 0; + border: 1px solid #bdc4bb; + border-radius: 999px; + background: #dfe3dc; + transition: background .18s ease, border-color .18s ease; + cursor: pointer; +} +.consent-switch span:after { + content: ""; + position: absolute; + left: 3px; + top: 3px; + width: 19px; + height: 19px; + border-radius: 50%; + background: #fff; + box-shadow: 0 2px 5px rgba(0, 0, 0, .2); + transition: transform .18s ease; +} +.consent-switch input:checked + span { + border-color: #72aa00; + background: linear-gradient(#90c919, #73a900); +} +.consent-switch input:checked + span:after { transform: translateX(21px); } +.consent-switch-locked span { opacity: .72; cursor: default; } + +.consent-actions { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 10px; + margin-top: 20px; +} +.consent-action { + min-height: 48px; + border-radius: 8px; + padding: 9px 12px; + font-size: 12px; + font-weight: 850; + line-height: 1.25; +} +.consent-action-essential { + border: 1px solid #202420; + color: #fff; + background: #151815; +} +.consent-action-essential:hover { background: #292d29; } +.consent-action-save { + border: 1px solid #bfc6bb; + color: #262b26; + background: #fff; +} +.consent-action-save:hover { background: #f4f6f2; } +.consent-action-all { + border: 1px solid #75ad00; + color: #fff; + background: linear-gradient(#92cb18, #73a900); + box-shadow: inset 0 1px rgba(255, 255, 255, .26), 0 4px 12px rgba(111, 166, 0, .2); +} +.consent-action-all:hover { background: linear-gradient(#9bd520, #7ab400); } +.consent-note { + margin-top: 13px !important; + color: #767d76 !important; + font-size: 11px !important; + line-height: 1.45 !important; + text-align: center; +} +.consent-status { + min-height: 17px; + margin-top: 4px !important; + color: #5e8d00 !important; + font-size: 11px !important; + font-weight: 750; + text-align: center; +} +.consent-close { + position: absolute; + z-index: 8; + right: 13px; + top: 12px; + width: 38px; + height: 38px; + display: grid; + place-items: center; + border: 1px solid #dce0d9; + border-radius: 50%; + color: #333833; + background: rgba(255, 255, 255, .94); + font-size: 25px; + line-height: 1; + box-shadow: 0 3px 10px rgba(0, 0, 0, .1); +} +.consent-close[hidden] { display: none; } +.consent-close:hover { color: #fff; background: #111411; border-color: #111411; } + +@media (min-width: 1500px) { + .footer-consent-button { font-size: 11px; } + .consent-dialog { width: min(1160px, 100%); grid-template-columns: 370px minmax(0, 1fr); } + .consent-content { padding: 43px 48px 34px; } + .consent-content > p { font-size: 16px; } + .consent-category strong { font-size: 14px; } + .consent-category p, .consent-current small, .consent-note { font-size: 12px !important; } + .consent-action { min-height: 53px; font-size: 13px; } +} + +@media (max-width: 820px) { + .consent-layer { padding: 14px; align-items: end; } + .consent-dialog { + width: 100%; + max-height: calc(100vh - 28px); + grid-template-columns: 1fr; + border-radius: 16px; + } + .consent-brand-panel { + min-height: 125px; + justify-content: center; + padding: 20px 24px; + } + .consent-brand-panel img { width: 205px; margin: 0; } + .consent-brand-panel > span { display: none; } + .consent-signal { right: -70px; top: -70px; transform: scale(.7) rotate(-8deg); } + .consent-content { padding: 25px 25px 22px; } + .consent-content h2 { padding-right: 24px; font-size: 29px; } + .consent-content > p { font-size: 14px; } + .consent-close { color: #fff; border-color: rgba(255,255,255,.35); background: rgba(0,0,0,.35); } +} + +@media (max-width: 560px) { + .consent-layer { padding: 0; } + .consent-dialog { + max-height: 100vh; + min-height: 100dvh; + border: 0; + border-radius: 0; + } + .consent-brand-panel { min-height: 104px; padding: 14px 19px; } + .consent-brand-panel img { width: 175px; } + .consent-content { padding: 20px 18px 18px; } + .consent-kicker { font-size: 10px; } + .consent-content h2 { font-size: 26px; } + .consent-content > p { margin-top: 10px; font-size: 13px; line-height: 1.45; } + .consent-current { grid-template-columns: 32px 1fr; gap: 9px; margin-top: 15px; padding: 10px 11px; } + .consent-current-icon { width: 30px; height: 30px; font-size: 15px; } + .consent-current strong { font-size: 12px; } + .consent-current small { font-size: 10px; } + .consent-settings-toggle { min-height: 43px; margin-top: 12px; font-size: 12px; } + .consent-category { gap: 13px; padding: 12px; } + .consent-category strong { font-size: 12px; } + .consent-category p { font-size: 10px; } + .consent-actions { grid-template-columns: 1fr; gap: 8px; margin-top: 14px; } + .consent-action { min-height: 44px; } + .consent-action-all { order: -1; } + .consent-note { margin-top: 10px !important; font-size: 10px !important; } +} + +@media (prefers-reduced-motion: reduce) { + .consent-toggle-arrow, + .consent-switch span, + .consent-switch span:after { transition: none; } +} + +/* v10: Live-Wetter Visselhövede */ +.weather-live-icon{display:grid;place-items:center;width:58px;height:52px;font-size:34px;line-height:1;filter:drop-shadow(0 4px 7px rgba(0,0,0,.1))} +.weather-card.is-loading [data-weather-description]{color:#7b837c} +.weather-card.is-error{border-color:#f0c9a9} +.weather-card.is-error [data-weather-description]{color:#a45b1f} +.weather-updated{display:block;margin-top:5px;text-align:center;color:#8d948e;font-size:7.5px} +.weather-skeleton{display:block;width:75%;height:42px;margin:5px auto;border-radius:7px;background:linear-gradient(90deg,#eef1ee 25%,#f8faf8 45%,#eef1ee 65%);background-size:220% 100%;animation:weatherShimmer 1.4s infinite} +@keyframes weatherShimmer{to{background-position:-220% 0}} +.forecast span small.weather-forecast-icon{font-size:21px;line-height:1.2} +@media (min-width:1500px){.weather-live-icon{width:70px;height:61px;font-size:42px}.weather-updated{font-size:9px}.forecast span small.weather-forecast-icon{font-size:25px}} + +/* v11 – dynamische AzuraCast-Titeldaten und externe Cover */ +.track-info small em, +.track-info small a { + display: inline-block; + margin-left: 5px; + color: #8d958e; + font-size: .72em; + font-style: normal; + font-weight: 700; + letter-spacing: 0; + text-transform: none; +} +.track-info small a:hover { color: #b9e55d; text-decoration: underline; } +.track-cover img { transition: opacity .2s ease, transform .25s ease; } +.track-cover.is-loading img { opacity: .45; transform: scale(.96); } +.live-player.is-stale .track-info small::after { + content: " · zwischengespeichert"; + color: #f1bd5d; + font-size: .75em; + text-transform: none; +} + + +/* v13 – der große Liveplayer öffnet als eigenständiges Browserfenster unter /player. */ +.footer-player-button { + width: max-content; + margin: 0; + padding: 0; + border: 0; + color: #d4d8d3; + background: transparent; + font-size: 9px; + line-height: 1.55; + text-align: left; +} +.footer-player-button:hover { color: #a6db34; } +[data-player-open]:focus-visible { + outline: 3px solid rgba(183, 232, 78, .72); + outline-offset: 3px; +} +@media (min-width: 1500px) { + .footer-player-button { font-size: 11px; } +} + +/* v14 – Bildkorrekturen, Unterseiten, Verkehr und Programm */ +.host-avatar img{object-position:50% 46%;transform:scale(1.04);transform-origin:center;border-radius:50%} +.portal-card .media img{object-position:center center} +.news-card .media{background:#dfe5db} +.news-card .media img{object-position:center 52%} +.footer-consent-button{border:0;background:transparent;color:#d4d8d3;padding:0;text-align:left;font-size:9px;line-height:1.55} +.footer-domain{display:flex;flex-direction:column;gap:4px}.footer-domain>a{font-size:9px;color:#d4d8d3} + +.subpage-main{min-height:65vh;background:linear-gradient(#f7f8f5,#fff 420px)} +.subpage-hero{position:relative;overflow:hidden;color:#fff;padding:76px 0 70px;background:linear-gradient(110deg,rgba(4,8,5,.96),rgba(29,47,17,.9)),url('/assets/hero-poster.jpg') center/cover} +.subpage-hero:after{content:"";position:absolute;right:8%;top:-55px;width:300px;height:300px;border:7px solid rgba(132,195,15,.28);border-radius:50%;box-shadow:0 0 0 45px rgba(132,195,15,.08),0 0 0 95px rgba(132,195,15,.05)} +.subpage-hero .page-shell{position:relative;z-index:2}.subpage-hero span{display:block;color:#a3d52f;text-transform:uppercase;font-size:13px;font-weight:900;letter-spacing:.08em}.subpage-hero h1{margin:8px 0 10px;font-size:clamp(38px,5vw,65px);line-height:1;letter-spacing:-.04em}.subpage-hero p{max-width:760px;margin:0;color:#f0f3ed;font-size:19px;line-height:1.5} +.content-page-grid{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:46px;padding-top:48px;padding-bottom:58px;align-items:start}.content-page-body{display:grid;gap:18px}.content-block{background:#fff;border:1px solid var(--line);border-radius:12px;padding:27px 30px;box-shadow:0 3px 14px rgba(20,24,20,.08)}.content-block h2{margin:0 0 9px;font-size:23px}.content-block p{margin:0;color:#535b53;font-size:16px;line-height:1.65}.content-block ul{margin:16px 0 0;padding-left:20px;color:#535b53}.content-cta{display:inline-flex;margin-top:20px;padding:11px 16px;border-radius:7px;background:var(--green);color:#fff;font-weight:800}.content-side{position:sticky;top:24px;background:linear-gradient(145deg,#0b0e0b,#182015);color:#fff;border-radius:13px;padding:26px;box-shadow:0 10px 30px rgba(0,0,0,.16)}.content-side img{width:210px;margin:0 auto 18px}.content-side strong{font-size:19px}.content-side p{color:#cfd6cc;line-height:1.55}.content-side a{display:inline-flex;color:#a5dc31;font-weight:800}.content-updated{color:#858b85;font-size:12px} + +.excursion-section,.program-page,.traffic-page{padding-top:42px;padding-bottom:64px}.filter-bar{display:flex;flex-wrap:wrap;gap:9px;margin-bottom:27px}.filter-bar button,.traffic-tabs button{border:1px solid #d9ded6;background:#fff;border-radius:999px;padding:10px 17px;font-weight:800;color:#394039}.filter-bar button.is-active,.traffic-tabs button.is-active{background:var(--green);border-color:var(--green);color:#fff}.excursion-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}.excursion-card{background:#fff;border:1px solid var(--line);border-radius:12px;overflow:hidden;box-shadow:0 4px 16px rgba(20,24,20,.09)}.excursion-card.is-featured{grid-column:span 1}.excursion-image{height:210px;display:block;position:relative;overflow:hidden}.excursion-image img{width:100%;height:100%;object-fit:cover;transition:transform .25s ease}.excursion-card:hover .excursion-image img{transform:scale(1.035)}.excursion-image span{position:absolute;left:14px;top:14px;background:rgba(10,13,10,.86);color:#a8dc39;border-radius:999px;padding:7px 11px;font-size:11px;font-weight:900;text-transform:uppercase}.excursion-card>div{padding:20px}.excursion-card small{color:#6d756d;font-weight:700}.excursion-card h2{margin:7px 0 9px;font-size:22px}.excursion-card p{margin:0 0 17px;color:#555d55;line-height:1.55}.excursion-card>div>a{color:#6b9f00;font-weight:850}.source-note{margin-top:28px;background:#eff6e6;border-left:4px solid var(--green);padding:16px 18px;border-radius:7px;color:#4c5549} + +.traffic-toolbar{display:flex;justify-content:space-between;gap:20px;align-items:center;margin-bottom:10px}.traffic-tabs{display:flex;gap:8px}.traffic-toolbar>div:last-child{display:flex;align-items:center;gap:13px;color:#616861}.traffic-toolbar [data-traffic-refresh]{border:0;border-radius:7px;background:#101411;color:#fff;padding:10px 14px;font-weight:800}.traffic-toolbar [data-traffic-refresh].is-loading{opacity:.6}.traffic-status{margin:0 0 18px;color:#737a73}.traffic-list{display:grid;gap:11px}.traffic-item{display:grid;grid-template-columns:130px minmax(0,1fr) auto;align-items:center;gap:18px;background:#fff;border:1px solid var(--line);border-radius:10px;padding:18px 20px;box-shadow:0 2px 9px rgba(20,24,20,.07)}.traffic-kind{display:inline-flex;justify-content:center;border-radius:999px;background:#eef5e4;color:#659800;padding:8px 11px;font-size:11px;font-weight:900;text-transform:uppercase}.traffic-item.is-camera .traffic-kind{background:#fff1e1;color:#c36a00}.traffic-item h3{margin:0 0 5px;font-size:17px}.traffic-item p{margin:0;color:#5a625a}.traffic-item small{display:block;margin-top:7px;color:#858b85}.traffic-item>a{color:#689d00;font-weight:850;white-space:nowrap}.traffic-empty{background:#fff;border:1px dashed #cbd2c8;border-radius:11px;padding:35px;text-align:center}.traffic-empty strong,.traffic-empty span{display:block}.traffic-empty span{margin-top:6px;color:#747b74}.traffic-disclaimer{margin:22px 0 0;padding:15px 17px;background:#f3f5f1;border-radius:8px;color:#646b64;font-size:13px}.traffic-disclaimer a{color:#659800;font-weight:800} + +.program-day{margin-bottom:34px}.program-day>h2{font-size:25px;margin:0 0 14px}.program-list{display:grid;gap:10px}.program-entry{display:grid;grid-template-columns:125px 64px minmax(0,1fr) auto;gap:18px;align-items:center;background:#fff;border:1px solid var(--line);border-radius:11px;padding:14px 18px;box-shadow:0 2px 10px rgba(20,24,20,.07)}.program-entry.is-live{border-color:#a6d34a;background:linear-gradient(90deg,#f2fae7,#fff)}.program-entry time{font-size:14px;font-weight:850}.program-entry img{width:58px;height:58px;border-radius:50%;object-fit:cover;object-position:center 35%;border:2px solid #e0e5dd}.program-entry span{color:#72a700;text-transform:uppercase;font-size:10px;font-weight:900}.program-entry h3{margin:3px 0 2px;font-size:19px}.program-entry strong{font-size:13px}.program-entry p{margin:5px 0 0;color:#626a62}.program-entry>b{background:var(--green);color:#fff;border-radius:6px;padding:7px 10px;text-transform:uppercase;font-size:10px} + +@media(min-width:1500px){.footer-consent-button,.footer-domain>a{font-size:11px}.excursion-image{height:245px}.excursion-card h2{font-size:25px}.content-page-grid{grid-template-columns:minmax(0,1fr) 380px}.traffic-item{padding:21px 24px}.traffic-item h3{font-size:20px}} +@media(max-width:900px){.content-page-grid{grid-template-columns:1fr}.content-side{position:static}.excursion-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.traffic-toolbar{align-items:flex-start;flex-direction:column}.traffic-item{grid-template-columns:105px minmax(0,1fr)}.traffic-item>a{grid-column:2}.program-entry{grid-template-columns:95px 54px minmax(0,1fr)}.program-entry>b{grid-column:3;width:max-content}} +@media(max-width:650px){.subpage-hero{padding:54px 0}.subpage-hero h1{font-size:38px}.subpage-hero p{font-size:16px}.content-page-grid{gap:24px;padding-top:28px}.content-block{padding:21px}.excursion-grid{grid-template-columns:1fr}.excursion-image{height:200px}.traffic-tabs{width:100%}.traffic-tabs button{flex:1}.traffic-toolbar>div:last-child{align-items:flex-start;flex-direction:column}.traffic-item{grid-template-columns:1fr;gap:9px;padding:16px}.traffic-item>a{grid-column:auto}.traffic-kind{width:max-content}.program-entry{grid-template-columns:64px minmax(0,1fr);gap:12px}.program-entry time{grid-column:1/-1}.program-entry img{width:54px;height:54px}.program-entry>b{grid-column:2}} + +/* + * v15 – neuer Hero, präzise Bildausschnitte, Hörerwünsche und Social-Footer + */ +.hero-video { + object-position: center center; +} + +/* Das Moderatorfoto bleibt exakt im runden Ausschnitt; der LIVE-Badge darf + weiterhin außerhalb des Kreises sitzen. */ +.host-avatar img { + display: block; + object-position: 50% 50%; + transform: none; + clip-path: circle(49% at 50% 50%); +} + +/* Überschrift und Karten bekommen voneinander unabhängige Layoutbereiche. + Damit können weder Überschriften noch Bilder optisch ineinander rutschen. */ +.portal-section { + display: flex; + min-width: 0; + flex-direction: column; +} +.section-heading { + position: relative; + z-index: 2; + height: auto; + min-height: 29px; + margin-bottom: 7px; + align-items: center; +} +.compact-grid { + position: relative; + z-index: 1; + min-width: 0; +} +.portal-card .media { + isolation: isolate; +} +.portal-card .media img { + display: block; + object-position: 50% 50%; + transform: none; +} +.portal-card:hover .media img { + transform: scale(1.015); +} +.news-card .media img { + object-position: 50% 50%; +} + +/* Social-Kanäle und Copyright */ +.footer-socials { + display: flex; + align-items: center; + gap: 9px; + margin-top: 12px; +} +.footer-socials a { + width: 34px; + height: 34px; + display: grid; + place-items: center; + border: 1px solid rgba(255,255,255,.28); + border-radius: 50%; + color: #fff; + background: rgba(255,255,255,.045); + transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease; +} +.footer-socials a:hover, +.footer-socials a:focus-visible { + color: #a8db36; + border-color: #83bd0c; + background: rgba(127,189,0,.12); + transform: translateY(-2px); +} +.footer-socials svg { + width: 19px; + height: 19px; + fill: currentColor; +} +.footer-bottom { + display: flex; + align-items: center; + justify-content: space-between; + gap: 20px; + margin-top: 18px; + padding-top: 14px; + border-top: 1px solid rgba(255,255,255,.11); + color: #969d96; + font-size: 10px; +} +.footer-bottom span:last-child { + color: #7fbd00; + font-weight: 750; +} + +/* Hörerwünsche & Grüße */ +.wish-page { + background: #f4f6f1; +} +.wish-hero { + min-height: 335px; + display: flex; + align-items: center; + background: + linear-gradient(90deg, rgba(5,8,6,.9), rgba(8,12,9,.63) 55%, rgba(8,12,9,.32)), + url('/assets/hero-poster.jpg') center 57% / cover no-repeat; +} +.wish-hero .page-shell { + padding-bottom: 42px; +} +.wish-hero span { + color: #a4d934; +} +.wish-layout { + position: relative; + z-index: 3; + display: grid; + grid-template-columns: minmax(0, 1.75fr) minmax(280px, .75fr); + gap: 28px; + margin-top: -52px; + padding-bottom: 42px; + align-items: start; +} +.wish-form-card, +.wish-side-card { + border: 1px solid #dde2d9; + border-radius: 16px; + background: #fff; + box-shadow: 0 15px 38px rgba(20,29,18,.13); +} +.wish-form-card { + padding: 30px 34px 34px; +} +.wish-form-head { + padding-bottom: 21px; + border-bottom: 1px solid #e7eae4; +} +.wish-kicker { + display: block; + color: #70a900; + font-size: 11px; + font-weight: 900; + letter-spacing: .09em; + text-transform: uppercase; +} +.wish-form-head h2 { + margin: 5px 0 8px; + font-size: 31px; + line-height: 1.05; + letter-spacing: -.035em; +} +.wish-form-head p { + max-width: 740px; + margin: 0; + color: #626a62; + font-size: 14px; + line-height: 1.55; +} +.wish-alert { + margin-top: 20px; + padding: 13px 15px; + border-radius: 9px; + font-size: 13px; + line-height: 1.45; +} +.wish-alert b { display: block; margin-bottom: 2px; } +.wish-alert-success { border: 1px solid #cde3a4; color: #335200; background: #f1f9e6; } +.wish-alert-error { border: 1px solid #efc0bc; color: #7f241b; background: #fff0ee; } +.wish-form { margin-top: 23px; } +.wish-form-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 17px 19px; +} +.wish-form label > span, +.wish-message > span { + display: block; + margin-bottom: 7px; + color: #2e342e; + font-size: 12px; + font-weight: 820; +} +.wish-form input[type="text"], +.wish-form textarea { + width: 100%; + border: 1px solid #d5dbd1; + border-radius: 8px; + color: #171b17; + background: #fbfcfa; + outline: 0; + transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; +} +.wish-form input[type="text"] { + height: 48px; + padding: 0 13px; +} +.wish-form textarea { + min-height: 132px; + resize: vertical; + padding: 12px 13px; + font: inherit; + line-height: 1.45; +} +.wish-form input:focus, +.wish-form textarea:focus { + border-color: #7eb800; + background: #fff; + box-shadow: 0 0 0 4px rgba(127,189,0,.12); +} +.wish-form input::placeholder, +.wish-form textarea::placeholder { color: #9aa09a; } +.wish-message { display: block; margin-top: 18px; } +.wish-message small { + display: block; + margin-top: 7px; + color: #7a817a; + font-size: 10px; +} +.wish-consent { + display: grid; + grid-template-columns: 19px minmax(0,1fr); + gap: 9px; + align-items: start; + margin-top: 18px; + color: #555d55; + font-size: 11px; + line-height: 1.45; +} +.wish-consent input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: #78b000; } +.wish-consent > span { margin: 0 !important; font-size: inherit !important; font-weight: 500 !important; } +.wish-honeypot { + position: absolute !important; + width: 1px; + height: 1px; + overflow: hidden; + clip-path: inset(100%); +} +.wish-submit { + min-height: 49px; + display: inline-flex; + align-items: center; + justify-content: center; + gap: 10px; + margin-top: 21px; + padding: 0 22px; + border: 0; + border-radius: 8px; + color: #fff; + background: linear-gradient(#91cc17,#70a700); + box-shadow: 0 7px 16px rgba(92,143,0,.24), inset 0 1px rgba(255,255,255,.25); + font-weight: 850; +} +.wish-submit:hover { filter: brightness(1.05); } +.wish-submit:focus-visible { outline: 3px solid rgba(127,189,0,.36); outline-offset: 3px; } +.wish-submit svg { width: 20px; fill: currentColor; } +.wish-side-card { + position: sticky; + top: 24px; + overflow: hidden; + padding: 27px 26px 29px; + color: #fff; + background: + radial-gradient(circle at 80% 10%, rgba(146,207,22,.26), transparent 32%), + linear-gradient(145deg,#101511,#050706 70%); +} +.wish-side-card:after { + content: ""; + position: absolute; + right: -72px; + bottom: -82px; + width: 230px; + height: 230px; + border: 34px solid rgba(127,189,0,.12); + border-radius: 50%; +} +.wish-side-card img { width: 215px; margin: 0 0 20px -7px; position: relative; z-index: 1; } +.wish-side-card > span { color: #9ed32f; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; } +.wish-side-card h2 { position: relative; z-index: 1; margin: 7px 0 12px; font-size: 27px; line-height: 1.08; letter-spacing: -.03em; } +.wish-side-card p { position: relative; z-index: 1; margin: 0; color: #c7cdc7; font-size: 13px; line-height: 1.55; } +.wish-side-card a { position: relative; z-index: 1; display: inline-flex; margin-top: 22px; color: #a8db36; font-weight: 820; } +.wish-wall { + padding: 45px 0 58px; + border-top: 1px solid #e2e7de; + background: #fff; +} +.wish-wall-head { + display: flex; + align-items: end; + justify-content: space-between; + gap: 24px; + margin-bottom: 22px; +} +.wish-wall-head span { color: #72a900; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; } +.wish-wall-head h2 { margin: 4px 0 0; font-size: 28px; letter-spacing: -.03em; } +.wish-wall-head > p { margin: 0; color: #727972; font-size: 12px; } +.wish-list { display: grid; gap: 11px; } +.wish-entry { + display: grid; + grid-template-columns: 50px minmax(0,1fr); + gap: 15px; + padding: 17px 20px; + border: 1px solid #e0e5dc; + border-radius: 11px; + background: linear-gradient(90deg,#fbfdf8,#fff); + box-shadow: 0 3px 11px rgba(25,32,23,.055); +} +.wish-entry-icon { + width: 48px; + height: 48px; + display: grid; + place-items: center; + border-radius: 50%; + color: #fff; + background: linear-gradient(145deg,#93ce1a,#699f00); + font-size: 21px; + font-weight: 900; + box-shadow: 0 5px 12px rgba(101,151,0,.2); +} +.wish-entry-main { min-width: 0; } +.wish-entry header { display: flex; align-items: start; justify-content: space-between; gap: 18px; } +.wish-entry header strong { display: inline; font-size: 14px; } +.wish-entry header div span { margin-left: 6px; color: #6b726b; font-size: 11px; } +.wish-entry time { color: #838983; font-size: 10px; white-space: nowrap; } +.wish-song { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 0; color: #303630; font-size: 12px; font-weight: 750; } +.wish-song span { padding: 2px 6px; border-radius: 4px; color: #608f00; background: #edf6dd; font-size: 9px; font-weight: 900; text-transform: uppercase; } +.wish-text { margin: 7px 0 0; color: #565d56; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; } +.wish-empty { padding: 45px 20px; border: 1px dashed #cfd8c8; border-radius: 12px; text-align: center; background: #f9fbf7; } +.wish-empty span { color: #7fbd00; font-size: 36px; } +.wish-empty h3 { margin: 7px 0 4px; font-size: 19px; } +.wish-empty p { margin: 0; color: #737a73; } +.wish-pagination { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 24px; } +.wish-pagination a, +.wish-pagination > span { + min-width: 38px; + height: 38px; + display: grid; + place-items: center; + border: 1px solid #d9ded5; + border-radius: 7px; + color: #3d443d; + background: #fff; + font-size: 12px; + font-weight: 800; +} +.wish-pagination a:hover { border-color: #8cbe23; color: #5c8d00; } +.wish-pagination .is-current { color: #fff; border-color: #76ae00; background: #78b000; } +.wish-pagination .is-disabled { color: #b6bbb6; background: #f2f4f0; } +.wish-page-arrow { font-size: 17px !important; } + +@media (min-width:1500px) { + .section-heading { min-height: 35px; margin-bottom: 9px; } + .footer-socials a { width: 39px; height: 39px; } + .footer-socials svg { width: 22px; height: 22px; } + .footer-bottom { font-size: 12px; } + .wish-hero { min-height: 395px; } + .wish-form-card { padding: 38px 43px 42px; } + .wish-form-head h2 { font-size: 38px; } + .wish-form-head p { font-size: 16px; } + .wish-form label > span, .wish-message > span { font-size: 14px; } + .wish-form input[type="text"] { height: 55px; font-size: 15px; } + .wish-form textarea { min-height: 150px; font-size: 15px; } + .wish-side-card { padding: 34px 31px 36px; } + .wish-side-card h2 { font-size: 33px; } + .wish-side-card p { font-size: 15px; } + .wish-wall-head h2 { font-size: 34px; } + .wish-entry { padding: 21px 25px; } + .wish-entry header strong { font-size: 16px; } + .wish-entry header div span, .wish-song { font-size: 13px; } + .wish-text { font-size: 15px; } +} + +@media (max-width: 900px) { + .section-heading { min-height: 30px; margin-bottom: 7px; } + .footer-bottom { flex-direction: column; align-items: flex-start; gap: 5px; } + .wish-hero { min-height: 310px; } + .wish-layout { grid-template-columns: 1fr; margin-top: -42px; } + .wish-side-card { position: relative; top: auto; } +} + +@media (max-width: 650px) { + .wish-hero { min-height: 340px; } + .wish-hero .page-shell { padding-bottom: 55px; } + .wish-layout { width: min(100% - 24px,var(--page)); gap: 16px; } + .wish-form-card { padding: 23px 19px 25px; border-radius: 12px; } + .wish-form-head h2 { font-size: 27px; } + .wish-form-grid { grid-template-columns: 1fr; gap: 14px; } + .wish-submit { width: 100%; } + .wish-side-card { padding: 24px 21px 27px; } + .wish-wall { padding: 37px 0 45px; } + .wish-wall-head { align-items: start; flex-direction: column; gap: 6px; } + .wish-wall-head h2 { font-size: 25px; } + .wish-entry { grid-template-columns: 40px minmax(0,1fr); gap: 11px; padding: 14px; } + .wish-entry-icon { width: 40px; height: 40px; font-size: 18px; } + .wish-entry header { flex-direction: column; gap: 3px; } + .wish-entry header div span { display: block; margin: 1px 0 0; } + .wish-pagination { flex-wrap: wrap; } +} + +/* Team page */ +.team-page{background:linear-gradient(180deg,#0b0e0b 0,#111711 460px,#f4f6f1 460px,#f4f6f1 100%)} +.team-hero{padding:48px 0 60px;color:#fff;background:radial-gradient(circle at 84% 4%,rgba(125,190,0,.2),transparent 32%),linear-gradient(145deg,#101510,#050705)} +.team-hero-inner{display:grid;gap:26px}.team-hero-copy{max-width:760px}.team-kicker,.team-section-head>span,.team-modal-kicker{color:#9bd32b;font-size:12px;font-weight:900;letter-spacing:.1em;text-transform:uppercase}.team-hero h1{margin:8px 0 12px;font-size:clamp(42px,6vw,76px);line-height:.96;letter-spacing:-.05em}.team-hero-copy p{max-width:660px;margin:0;color:#ccd3cc;font-size:clamp(17px,2vw,22px);line-height:1.5}.team-group-photo{overflow:hidden;width:min(100%,980px);margin:0 auto;border:1px solid rgba(151,211,42,.35);border-radius:28px;background:#101410;box-shadow:0 28px 70px rgba(0,0,0,.42),0 0 0 7px rgba(119,177,0,.08)}.team-group-photo img{display:block;width:100%;height:clamp(300px,36vw,460px);object-fit:cover;object-position:center 42%}.team-group-photo figcaption{padding:13px 18px;color:#aeb7ae;background:#0c100c;font-size:12px} +.team-members{padding-top:66px;padding-bottom:86px}.team-section-head{max-width:680px;margin-bottom:32px}.team-section-head h2{margin:7px 0 9px;color:#151a15;font-size:clamp(30px,4vw,46px);letter-spacing:-.04em}.team-section-head p{margin:0;color:#687068}.team-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,280px));gap:26px}.team-card{display:flex;flex-direction:column;align-items:center;padding:29px 22px 24px;border:1px solid #dce3d8;border-radius:22px;color:#171c17;background:linear-gradient(180deg,#fff,#f8faf6);box-shadow:0 12px 30px rgba(28,39,24,.08);cursor:pointer;transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease}.team-card:hover{transform:translateY(-5px);border-color:#8fc429;box-shadow:0 18px 38px rgba(65,99,17,.16)}.team-card:focus-visible{outline:3px solid rgba(126,189,0,.4);outline-offset:4px}.team-avatar{width:164px;height:164px;padding:6px;border-radius:50%;background:linear-gradient(145deg,#b8eb4b,#6da400);box-shadow:0 12px 26px rgba(93,144,0,.25)}.team-avatar img,.team-modal-avatar img{width:100%;height:100%;display:block;object-fit:cover;border-radius:50%;background:#dfe5dc}.team-card-name{margin-top:19px;font-size:21px;font-weight:900}.team-card-role{margin-top:4px;color:#679600;font-size:13px;font-weight:800}.team-card-more{margin-top:17px;color:#4c554c;font-size:12px;font-weight:800}.team-card-more b{color:#75aa00;font-size:16px} +.team-modal[hidden]{display:none}.team-modal{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px}.team-modal-backdrop{position:absolute;inset:0;background:rgba(3,6,3,.78);backdrop-filter:blur(8px)}.team-modal-dialog{position:relative;width:min(620px,100%);max-height:calc(100vh - 40px);overflow:auto;padding:34px;border:1px solid rgba(151,211,42,.38);border-radius:26px;color:#eef3ed;background:radial-gradient(circle at 90% 0,rgba(139,204,15,.2),transparent 34%),linear-gradient(145deg,#151b15,#080b08);box-shadow:0 35px 90px rgba(0,0,0,.55);outline:0}.team-modal-close{position:absolute;top:16px;right:17px;width:40px;height:40px;border:1px solid rgba(255,255,255,.14);border-radius:50%;color:#fff;background:rgba(255,255,255,.06);font-size:27px;line-height:1;cursor:pointer}.team-modal-profile{display:flex;align-items:center;gap:22px;padding-right:44px}.team-modal-avatar{width:128px;height:128px;flex:0 0 auto;padding:5px;border-radius:50%;background:linear-gradient(145deg,#b8eb4b,#6da400)}.team-modal-profile h2{margin:5px 0 3px;font-size:34px;letter-spacing:-.04em}.team-modal-profile p{margin:0;color:#a9d64c;font-weight:800}.team-modal-bio{margin:27px 0 24px;color:#ccd3cc;line-height:1.65}.team-facts{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:0}.team-facts div{padding:15px;border:1px solid rgba(255,255,255,.09);border-radius:13px;background:rgba(255,255,255,.04)}.team-facts dt{color:#8ea08e;font-size:10px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.team-facts dd{margin:6px 0 0;color:#fff;font-size:13px;font-weight:800}.team-modal-open{overflow:hidden} +@media(max-width:650px){.team-page{background:#f4f6f1}.team-hero{padding:34px 0 42px}.team-group-photo{border-radius:18px}.team-group-photo img{height:260px;min-height:0;object-position:center 42%;}.team-members{padding-top:46px;padding-bottom:60px}.team-grid{grid-template-columns:1fr}.team-card{width:100%}.team-modal-dialog{padding:27px 20px 23px;border-radius:20px}.team-modal-profile{align-items:flex-start;flex-direction:column;gap:14px}.team-modal-avatar{width:112px;height:112px}.team-modal-profile h2{font-size:29px}.team-facts{grid-template-columns:1fr}} + +/* Teamseite v18 – Aufbau analog zu /ueber-landwelle */ +.team-page-v18{background:#f4f6f1}.team-content-grid{align-items:start}.team-intro-card>p,.team-members-block>p{max-width:760px}.team-group-photo-v18{overflow:hidden;margin:24px 0 0;border:1px solid var(--line);border-radius:12px;background:#111;box-shadow:0 3px 14px rgba(20,24,20,.1)}.team-group-photo-v18 img{display:block;width:100%;height:auto;max-height:430px;object-fit:cover;object-position:center 42%}.team-group-photo-v18 figcaption{padding:11px 15px;color:#657065;background:#f7f9f5;border-top:1px solid var(--line);font-size:12px}.team-section-kicker{display:block;margin-bottom:6px;color:#699b00;font-size:12px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.team-grid-v18{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:24px}.team-card-v18{display:flex;align-items:center;gap:17px;width:100%;padding:17px;border:1px solid #dce3d8;border-radius:12px;color:#171c17;text-align:left;background:#f9fbf7;cursor:pointer;transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease}.team-card-v18:hover{transform:translateY(-2px);border-color:#8fc429;box-shadow:0 9px 22px rgba(54,78,32,.12)}.team-card-v18:focus-visible{outline:3px solid rgba(126,189,0,.35);outline-offset:3px}.team-avatar-v18{width:92px;height:92px;flex:0 0 auto;padding:4px;border-radius:50%;background:linear-gradient(145deg,#b8eb4b,#6da400);box-shadow:0 7px 17px rgba(93,144,0,.2)}.team-avatar-v18 img{display:block;width:100%;height:100%;object-fit:cover;border-radius:50%;background:#dfe5dc}.team-card-copy{display:flex;min-width:0;flex-direction:column}.team-card-copy strong{font-size:18px}.team-card-copy small{margin-top:3px;color:#699b00;font-size:12px;font-weight:800}.team-card-copy em{margin-top:12px;color:#535b53;font-size:11px;font-style:normal;font-weight:800}.team-card-copy em b{color:#75aa00;font-size:15px}.team-side-v18 p{margin-bottom:18px} +@media(max-width:1100px){.team-grid-v18{grid-template-columns:1fr}} +@media(max-width:650px){.team-group-photo-v18{margin-top:18px}.team-group-photo-v18 img{max-height:300px}.team-card-v18{padding:14px}.team-avatar-v18{width:78px;height:78px}.team-card-copy strong{font-size:17px}} + +/* Radio-Dropdown und Radio-Service-Seiten v22 */ +.nav-dropdown{position:relative;display:flex;align-items:center;height:72px} +.nav-dropdown-toggle{appearance:none;border:0;background:transparent;color:#f2f4f1;font:inherit;font-weight:650;font-size:13px;cursor:pointer;padding:10px 16px 10px 0;position:relative;white-space:nowrap} +.nav-dropdown-toggle::after{content:"";position:absolute;right:0;top:50%;width:6px;height:6px;border-right:2px solid #9fd33b;border-bottom:2px solid #9fd33b;transform:translateY(-70%) rotate(45deg);transition:transform .2s ease} +.nav-dropdown.is-open .nav-dropdown-toggle::after{transform:translateY(-20%) rotate(225deg)} +.nav-dropdown-menu{position:absolute;top:calc(100% - 8px);left:-18px;min-width:220px;padding:10px;background:#111512;border:1px solid rgba(159,211,59,.28);border-radius:14px;box-shadow:0 18px 48px rgba(0,0,0,.35);opacity:0;visibility:hidden;transform:translateY(-6px);transition:.18s ease;z-index:50} +.nav-dropdown:hover .nav-dropdown-menu,.nav-dropdown:focus-within .nav-dropdown-menu,.nav-dropdown.is-open .nav-dropdown-menu{opacity:1;visibility:visible;transform:translateY(0)} +.main-nav .nav-dropdown-menu a{display:flex;align-items:center;gap:10px;padding:11px 12px;border-radius:9px;font-size:14px;color:#f3f6f2} +.main-nav .nav-dropdown-menu a:hover{background:rgba(159,211,59,.11);color:#b7e74a} +.main-nav .nav-dropdown-menu a::before{content:"";width:7px;height:7px;border-radius:50%;background:#80bd22;box-shadow:0 0 0 4px rgba(128,189,34,.12)} +.radio-service-main{background:#f4f6f2;padding:52px 0 72px} +.radio-service-grid{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:28px;align-items:start} +.radio-service-stack{display:grid;gap:22px} +.radio-card{background:#fff;border:1px solid #dfe5dc;border-radius:20px;padding:28px;box-shadow:0 12px 34px rgba(18,33,19,.07)} +.radio-card h2{margin:0 0 10px;font-size:25px;color:#182019}.radio-card p{margin:0;color:#59635a;line-height:1.72} +.download-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-top:24px} +.download-card{display:flex;flex-direction:column;min-height:260px;padding:24px;border-radius:17px;background:linear-gradient(145deg,#f7faf5,#edf3e9);border:1px solid #dce7d5} +.download-card .platform-icon{width:54px;height:54px;display:grid;place-items:center;border-radius:15px;background:#121713;color:#a5d83d;font-weight:800;font-size:19px;margin-bottom:18px} +.download-card h3{margin:0 0 8px;font-size:20px;color:#182019}.download-card p{font-size:14px;line-height:1.6;flex:1} +.download-card a,.radio-action{display:inline-flex;justify-content:center;align-items:center;gap:8px;margin-top:20px;padding:12px 16px;border-radius:10px;background:#69ae20;color:#fff;font-weight:750;box-shadow:0 8px 20px rgba(88,154,25,.22)} +.download-card a:hover,.radio-action:hover{background:#579719;color:#fff} +.service-list{display:grid;gap:14px;margin-top:22px}.service-item{display:grid;grid-template-columns:52px 1fr;gap:16px;align-items:start;padding:18px;border-radius:15px;background:#f6f8f4;border:1px solid #e1e7dd} +.service-item i{display:grid;place-items:center;width:48px;height:48px;border-radius:50%;background:#162019;color:#a5d83d;font-style:normal;font-weight:800}.service-item h3{margin:2px 0 5px;font-size:18px}.service-item p{font-size:14px;line-height:1.6} +.alexa-quote{margin-top:18px;padding:20px 22px;border-left:5px solid #78b82a;border-radius:0 14px 14px 0;background:#121713;color:#fff;font-size:20px;font-weight:750} +.radio-side{position:sticky;top:96px;padding:26px;border-radius:20px;background:linear-gradient(150deg,#101510,#1d271c);color:#fff;box-shadow:0 18px 38px rgba(13,24,13,.2)}.radio-side img{width:180px;max-width:100%;margin-bottom:20px}.radio-side strong{display:block;font-size:22px;margin-bottom:10px}.radio-side p{color:#ccd4ca;line-height:1.65}.radio-side a{display:inline-flex;margin-top:16px;color:#b2e345;font-weight:750} +.app-feature-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px;margin-top:22px}.app-feature{padding:18px;border-radius:14px;background:#f6f8f4;border:1px solid #e1e7dd}.app-feature strong{display:block;color:#1a241a;margin-bottom:5px}.app-feature span{font-size:14px;color:#647064;line-height:1.5} +.availability{display:flex;gap:12px;flex-wrap:wrap;margin-top:20px}.availability span{padding:9px 12px;border-radius:999px;background:#e9f4dc;color:#3d6e10;font-weight:700;font-size:13px}.availability .planned{background:#eef0ed;color:#687068} +@media(max-width:980px){.radio-service-grid{grid-template-columns:1fr}.radio-side{position:static}.download-grid{grid-template-columns:1fr}.nav-dropdown{height:auto;display:block;width:100%}.nav-dropdown-toggle{width:100%;text-align:left;font-size:15px;padding:0 22px 0 0}.nav-dropdown-menu{position:static;min-width:0;width:100%;margin-top:10px;padding:6px 0 0 14px;background:transparent;border:0;box-shadow:none;display:none;opacity:1;visibility:visible;transform:none}.nav-dropdown.is-open .nav-dropdown-menu{display:block}.nav-dropdown:hover .nav-dropdown-menu:not(:focus-within){display:none}.nav-dropdown.is-open:hover .nav-dropdown-menu{display:block}.main-nav .nav-dropdown-menu a{padding:8px 10px}} +@media(max-width:620px){.radio-service-main{padding-top:30px}.radio-card{padding:21px}.app-feature-grid{grid-template-columns:1fr}.alexa-quote{font-size:17px}.service-item{grid-template-columns:42px 1fr;padding:15px}.service-item i{width:40px;height:40px}} +/* v41 legal pages */ +.content-page-body .content-block p{white-space:pre-line} +.content-page-body .content-block h2{scroll-margin-top:110px} +.content-page-body .content-block{line-height:1.72} +.content-page-body .content-block a{overflow-wrap:anywhere} +.forum-page{background:#f3f5f1;min-height:70vh}.forum-hero{background:linear-gradient(130deg,#0a0d0b,#172016);padding:70px 0;color:#fff}.forum-shell{padding-top:38px;padding-bottom:70px}.forum-toolbar{display:flex;justify-content:space-between;align-items:center;gap:20px;background:#fff;border:1px solid #dfe5dc;border-radius:18px;padding:22px 26px;margin-bottom:24px;box-shadow:0 8px 24px rgba(20,30,20,.07)}.forum-toolbar div{display:flex;flex-direction:column}.forum-toolbar span{color:#687068}.forum-primary{border:0;border-radius:999px;background:#74b82a;color:#fff;padding:13px 21px;font-weight:850;text-decoration:none;cursor:pointer}.forum-category-list,.forum-topic-list{display:grid;gap:13px}.forum-category,.forum-topic-row{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:18px;background:#fff;border:1px solid #dfe5dc;border-radius:16px;padding:21px 24px;color:#172016;text-decoration:none;box-shadow:0 4px 16px rgba(20,30,20,.05);transition:.2s}.forum-category:hover,.forum-topic-row:hover{transform:translateY(-2px);border-color:#9ccb5e}.forum-icon{width:54px;height:54px;border-radius:15px;display:grid;place-items:center;background:#eef6e5;font-size:27px}.forum-category h2,.forum-topic-row h3{margin:0 0 6px}.forum-category p{margin:0 0 7px;color:#596159}.forum-category small,.forum-topic-row small{color:#7b837b}.forum-latest{margin-top:36px}.forum-topic-row{grid-template-columns:1fr auto}.forum-topic-row span{color:#6d9f25;font-size:12px;text-transform:uppercase;font-weight:850}.forum-topic-row em{background:#eef6e5;color:#61941f;border-radius:999px;padding:7px 11px;font-style:normal;font-size:12px}.forum-empty,.forum-alert{background:#fff;border:1px dashed #cbd3c8;border-radius:15px;padding:25px;color:#616961}.forum-alert{border-style:solid;border-color:#e0b45a;background:#fff8e8}.forum-breadcrumb{display:flex;gap:9px;margin-bottom:20px}.forum-breadcrumb a{color:#659c21}.forum-topic-shell{max-width:980px}.forum-post,.forum-reply,.forum-form-card,.forum-login-callout{background:#fff;border:1px solid #dfe5dc;border-radius:18px;padding:26px;margin-bottom:18px;box-shadow:0 5px 18px rgba(20,30,20,.05)}.forum-post header{display:flex;justify-content:space-between;gap:20px;border-bottom:1px solid #edf0eb;padding-bottom:14px;margin-bottom:20px}.forum-post h1{font-size:34px;margin:5px 0}.forum-post header span{color:#6d9f25;font-weight:800;text-transform:uppercase;font-size:12px}.forum-post-body{white-space:pre-wrap;line-height:1.75}.forum-reply textarea,.forum-form-card textarea,.forum-form-card input,.forum-form-card select{width:100%;border:1px solid #cad2c7;border-radius:10px;padding:12px;font:inherit}.forum-form-card form,.forum-reply{display:grid;gap:16px}.forum-form-card label{display:grid;gap:7px}.account-button{border:1px solid rgba(255,255,255,.28);background:transparent;color:#fff;border-radius:999px;padding:11px 16px;font-weight:800;cursor:pointer;white-space:nowrap}.auth-modal[hidden]{display:none}.auth-modal{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px}.auth-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.72);backdrop-filter:blur(7px)}.auth-dialog{position:relative;width:min(100%,480px);background:#101511;color:#fff;border:1px solid rgba(151,216,75,.28);border-radius:24px;padding:28px;box-shadow:0 30px 90px rgba(0,0,0,.45)}.auth-dialog>img{width:180px}.auth-dialog h2{font-size:30px;margin:18px 0 6px}.auth-dialog>p{color:#b7c0b9}.auth-close{position:absolute;right:18px;top:15px;border:0;background:transparent;color:#fff;font-size:30px;cursor:pointer}.auth-tabs{display:grid;grid-template-columns:1fr 1fr;background:#080b09;padding:5px;border-radius:12px;margin:22px 0}.auth-tabs button{border:0;background:transparent;color:#aab3ac;padding:10px;border-radius:9px;font-weight:800}.auth-tabs button.is-active{background:#74b82a;color:#fff}.auth-form{display:none;gap:14px}.auth-form.is-active{display:grid}.auth-form label{display:grid;gap:6px}.auth-form input{width:100%;border:1px solid #3c463e;background:#090c0a;color:#fff;border-radius:10px;padding:12px}.auth-form button{border:0;border-radius:10px;background:#74b82a;color:#fff;padding:13px;font-weight:850}.auth-consent{grid-template-columns:auto 1fr!important;align-items:start}.auth-consent input{width:auto}.auth-consent a{color:#9bd34e}@media(max-width:900px){.account-button{font-size:0;width:43px;height:40px;padding:0}.account-button:after{content:'👤';font-size:17px}.forum-toolbar{align-items:flex-start;flex-direction:column}.forum-category{grid-template-columns:auto 1fr}.forum-category>b{display:none}} +.forum-actions{display:flex;align-items:center;gap:9px}.forum-actions form{margin:0}.forum-secondary{border:1px solid #ccd4c9;background:#fff;color:#364036;border-radius:999px;padding:12px 17px;font-weight:800;cursor:pointer} +.account-dropdown{position:relative;flex:0 0 auto}.account-button-user{display:inline-flex;align-items:center;gap:9px;padding:7px 13px 7px 8px}.account-avatar{width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:#79b92d;color:#fff;font-size:13px;font-weight:900}.account-name{max-width:130px;overflow:hidden;text-overflow:ellipsis}.account-caret{font-size:13px;color:#a8d866}.account-menu{position:absolute;z-index:200;right:0;top:calc(100% + 10px);width:230px;padding:8px;background:#101511;border:1px solid rgba(151,216,75,.28);border-radius:14px;box-shadow:0 20px 55px rgba(0,0,0,.38);color:#fff}.account-menu[hidden]{display:none}.account-menu-head{display:grid;gap:2px;padding:10px 11px 12px;border-bottom:1px solid rgba(255,255,255,.09);margin-bottom:5px}.account-menu-head strong{font-size:14px}.account-menu-head span{font-size:12px;color:#9da79f}.account-menu a,.account-menu form button{display:block;width:100%;padding:10px 11px;border:0;border-radius:9px;background:transparent;color:#eef4ea;text-align:left;font:inherit;font-size:13px;font-weight:700;text-decoration:none;cursor:pointer}.account-menu a:hover,.account-menu form button:hover{background:rgba(121,185,45,.15);color:#a8dc57}.account-menu form{margin:4px 0 0;padding-top:4px;border-top:1px solid rgba(255,255,255,.08)} +@media(max-width:700px){.account-button-user{width:auto;min-width:43px;padding:5px}.account-button-user:after{content:none}.account-name,.account-caret{display:none}.account-menu{position:fixed;right:16px;top:76px}} + +/* Playlist v1.1.5 */ +.playlist-hero{background:linear-gradient(90deg,rgba(5,9,6,.96),rgba(5,9,6,.72)),radial-gradient(circle at 78% 40%,rgba(132,207,36,.24),transparent 36%);} +.playlist-page{padding-top:44px;padding-bottom:70px}.playlist-heading{display:flex;align-items:end;justify-content:space-between;gap:24px;margin-bottom:22px}.playlist-heading h2{margin:.2rem 0 0}.playlist-heading>strong{color:#73b91f;font-size:.95rem}.playlist-list{border:1px solid #dfe5dc;border-radius:16px;overflow:hidden;background:#fff}.playlist-entry{display:grid;grid-template-columns:92px 72px minmax(0,1fr) auto;align-items:center;gap:18px;padding:14px 18px;border-bottom:1px solid #e5e9e2}.playlist-entry:last-child{border-bottom:0}.playlist-entry time{display:flex;flex-direction:column}.playlist-entry time strong{font-size:1.15rem;color:#152014}.playlist-entry time span{font-size:.75rem;color:#778074}.playlist-entry img{width:64px;height:64px;border-radius:10px;object-fit:cover;background:#edf1eb}.playlist-entry div{min-width:0}.playlist-entry div>span{display:block;color:#658f25;font-size:.82rem;font-weight:800;text-transform:uppercase;letter-spacing:.05em}.playlist-entry h3{margin:3px 0 1px;font-size:1.08rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.playlist-entry small{color:#7d857b}.playlist-entry>a{border:1px solid #76ba25;border-radius:999px;padding:8px 13px;color:#4c7e12;font-weight:800;text-decoration:none}.playlist-entry>a:hover{background:#76ba25;color:#fff}.playlist-pagination{display:flex;justify-content:space-between;align-items:center;margin-top:24px;gap:20px}.playlist-pagination div{display:flex;gap:10px}.playlist-pagination a{background:#102014;color:#fff;border-radius:9px;padding:10px 14px;text-decoration:none}@media(max-width:700px){.playlist-heading{align-items:flex-start;flex-direction:column}.playlist-entry{grid-template-columns:62px 54px minmax(0,1fr);gap:11px;padding:12px}.playlist-entry img{width:50px;height:50px}.playlist-entry>a{grid-column:3;justify-self:start;padding:6px 10px}.playlist-pagination{align-items:flex-start;flex-direction:column}} + +/* Playlist v1.1.8 */ +.playlist-view{background:#f4f6f1}.playlist-hero{min-height:355px;display:flex;align-items:center;background:linear-gradient(90deg,rgba(5,9,6,.96),rgba(5,9,6,.68)),radial-gradient(circle at 78% 40%,rgba(132,207,36,.26),transparent 36%)} +.playlist-layout{position:relative;z-index:2;display:grid;grid-template-columns:minmax(0,1.65fr) minmax(290px,.75fr);gap:24px;margin-top:-54px;padding-bottom:45px} +.playlist-search-card,.playlist-side-card{border-radius:16px;box-shadow:0 13px 36px rgba(24,34,22,.11)}.playlist-search-card{padding:34px 38px 38px;border:1px solid #e1e6dd;background:#fff}.playlist-search-head h2{margin:5px 0 9px;font-size:34px;letter-spacing:-.035em}.playlist-search-head p{max-width:700px;margin:0;color:#697169;line-height:1.55} +.playlist-search-form{display:grid;gap:18px;margin-top:25px}.playlist-search-form label{display:grid;gap:7px}.playlist-search-form label>span{color:#323a32;font-size:13px;font-weight:800}.playlist-search-form input{width:100%;height:50px;padding:0 14px;border:1px solid #ccd4c8;border-radius:8px;background:#fbfcfa;color:#182018;font:inherit}.playlist-search-form input:focus{outline:3px solid rgba(127,189,0,.2);border-color:#78ad17}.playlist-filter-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:13px}.playlist-search-actions{display:flex;align-items:center;gap:18px}.playlist-search-actions .wish-submit{margin:0}.playlist-search-actions>a{color:#648f20;font-size:13px;font-weight:800}.playlist-side-card{position:relative;top:auto} +.playlist-results{padding:43px 0 65px;border-top:1px solid #e0e5dc;background:#fff}.playlist-results-head{margin-bottom:24px}.playlist-days{display:grid;gap:28px}.playlist-day{display:grid;gap:10px}.playlist-day-head{display:flex;align-items:end;justify-content:space-between;gap:20px;padding:0 4px}.playlist-day-head span{color:#6d9f25;font-size:11px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.playlist-day-head h3{margin:2px 0 0;font-size:23px;letter-spacing:-.025em}.playlist-day-head>strong{color:#7b8379;font-size:12px}.playlist-list{border:1px solid #dfe5dc;border-radius:13px;overflow:hidden;background:#fff;box-shadow:0 4px 14px rgba(26,35,24,.045)}.playlist-entry{display:grid;grid-template-columns:76px 64px minmax(0,1fr) auto;align-items:center;gap:16px;padding:13px 17px;border-bottom:1px solid #e6eae3}.playlist-entry:last-child{border-bottom:0}.playlist-entry time{display:flex;flex-direction:column}.playlist-entry time strong{color:#162016;font-size:18px}.playlist-entry time span{color:#838a81;font-size:10px;text-transform:uppercase}.playlist-entry img{width:58px;height:58px;border-radius:9px;object-fit:cover;background:#edf1eb}.playlist-entry-copy{min-width:0}.playlist-entry-copy>span{display:block;color:#658f25;font-size:11px;font-weight:900;letter-spacing:.05em;text-transform:uppercase}.playlist-entry-copy h3{margin:3px 0 1px;font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.playlist-entry-copy small{display:block;color:#7d857b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.playlist-entry>a{padding:8px 13px;border:1px solid #76ba25;border-radius:999px;color:#4c7e12;font-size:12px;font-weight:850;text-decoration:none}.playlist-entry>a:hover{color:#fff;background:#76ba25}.playlist-results .wish-empty a{display:inline-flex;margin-top:14px;color:#5f8f18;font-weight:850} +@media(max-width:900px){.playlist-layout{grid-template-columns:1fr;margin-top:-40px}.playlist-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}} +@media(max-width:650px){.playlist-hero{min-height:330px}.playlist-layout{width:min(100% - 24px,var(--page));gap:16px}.playlist-search-card{padding:23px 19px 26px}.playlist-search-head h2{font-size:27px}.playlist-filter-grid{grid-template-columns:1fr 1fr}.playlist-search-actions{align-items:stretch;flex-direction:column}.playlist-search-actions .wish-submit{width:100%}.playlist-entry{grid-template-columns:52px 50px minmax(0,1fr);gap:10px;padding:11px}.playlist-entry img{width:46px;height:46px}.playlist-entry>a{grid-column:3;justify-self:start;padding:6px 10px}.playlist-day-head{align-items:start;flex-direction:column;gap:3px}.playlist-results-head{align-items:start}.playlist-filter-grid label>span{font-size:12px}} diff --git a/web/assets/styles-v25.css b/web/assets/styles-v25.css new file mode 100644 index 0000000..663f936 --- /dev/null +++ b/web/assets/styles-v25.css @@ -0,0 +1,1319 @@ +:root { + --green: #7fbd00; + --green-dark: #5f9200; + --ink: #101211; + --muted: #727872; + --line: #e3e6e1; + --paper: #ffffff; + --soft: #f4f5f2; + --page: 1270px; + --sidebar: 250px; + --gap: 30px; + --shadow: 0 3px 12px rgba(20, 24, 20, .12); +} +* { box-sizing: border-box; } +html { scroll-behavior: smooth; } +body { margin: 0; color: var(--ink); background: #fff; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.35; } +a { color: inherit; text-decoration: none; } +button, input { font: inherit; } +button { cursor: pointer; } +img { display: block; max-width: 100%; } +.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; } +.page-shell { width: min(var(--page), calc(100% - 40px)); margin-inline: auto; } +.page-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--sidebar); gap: var(--gap); } + +.site-header { height: 72px; background: linear-gradient(90deg, #070908, #111411); color: white; position: relative; z-index: 20; border-bottom: 1px solid rgba(255,255,255,.07); } +.header-inner { height: 100%; display: flex; align-items: center; gap: 26px; } +.brand { width: 158px; height: 62px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; } +.brand img { width: 154px; filter: drop-shadow(0 1px 1px #000); } +.main-nav { display: flex; align-items: center; gap: 31px; margin-left: 8px; flex: 1; } +.main-nav a { color: #f2f4f1; font-weight: 650; font-size: 13px; white-space: nowrap; } +.main-nav a:hover { color: #a6db34; } +.chevron { color: #b9beb9; font-size: 15px; margin-left: 3px; } +.listen-button { border: 0; border-radius: 6px; padding: 12px 19px; color: #fff; background: linear-gradient(#91cb15, #76ac00); box-shadow: inset 0 1px 0 rgba(255,255,255,.26); font-weight: 800; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; } +.listen-button svg { width: 15px; fill: currentColor; } +.search-button { border: 0; background: transparent; color: #fff; width: 38px; height: 38px; padding: 7px; } +.search-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; } +.menu-toggle { display: none; } + +.hero { height: 345px; position: relative; overflow: hidden; color: #fff; background: #2d3629; } +.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 50%; } +.hero-overlay { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6,8,7,.74) 0%, rgba(8,10,8,.48) 45%, rgba(10,12,10,.12) 76%, rgba(8,10,8,.26) 100%), linear-gradient(0deg, rgba(0,0,0,.38), transparent 53%); } +.hero-inner { position: relative; z-index: 2; height: 100%; padding-top: 21px; } +.hero-logo { width: 300px; height: 145px; object-fit: contain; object-position: left center; margin-left: -9px; margin-bottom: -3px; filter: drop-shadow(0 3px 7px rgba(0,0,0,.54)); } +.hero h1 { margin: 0; font-size: clamp(32px, 3.05vw, 42px); line-height: 1.03; letter-spacing: -.035em; font-weight: 860; text-shadow: 0 2px 8px rgba(0,0,0,.55); } +.hero p { margin: 5px 0 13px; font-size: 22px; line-height: 1.2; text-shadow: 0 2px 6px rgba(0,0,0,.7); } +.hero-actions { display: flex; gap: 18px; } +.button { height: 42px; border-radius: 6px; padding: 0 23px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 800; font-size: 13px; } +.button svg { width: 15px; fill: currentColor; } +.button-green { color: white; border: 1px solid #8dc613; background: linear-gradient(#91cb15, #73aa00); box-shadow: 0 3px 10px rgba(0,0,0,.16); } +.button-outline { border: 1px solid rgba(255,255,255,.85); color: #fff; background: rgba(8,10,8,.25); min-width: 218px; } +.button-outline span { font-size: 18px; margin-left: auto; } +.signal-rings { position: absolute; right: 14.5%; top: 35px; width: 280px; height: 270px; opacity: .46; transform: rotate(-5deg); } +.signal-rings i { position: absolute; left: 0; bottom: 0; border: 5px solid rgba(164,214,50,.9); border-left-color: transparent; border-bottom-color: transparent; border-radius: 50%; transform: rotate(-45deg); } +.signal-rings i:nth-child(1){ width: 125px; height:125px; left:70px; bottom:55px; } +.signal-rings i:nth-child(2){ width: 205px; height:205px; left:30px; bottom:15px; } +.signal-rings i:nth-child(3){ width: 285px; height:285px; left:-10px; bottom:-25px; } + +.player-stage { position: relative; z-index: 8; margin-top: -35px; } +.live-player { min-height: 96px; background: linear-gradient(90deg, #0b0d0c, #121512 60%, #080a09); color: #fff; border-radius: 10px; box-shadow: 0 5px 13px rgba(0,0,0,.25); padding: 13px 20px 13px 16px; display: grid; grid-template-columns: 62px 178px minmax(70px, 1fr) 68px 54px 150px 115px; align-items: center; gap: 12px; overflow: hidden; } +.host-avatar { width: 58px; height: 58px; border-radius: 50%; border: 2px solid #90c919; position: relative; overflow: visible; } +.host-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; } +.host-avatar span { position: absolute; right: -4px; bottom: -7px; background: var(--green); color: white; border: 2px solid #101210; border-radius: 5px; font-weight: 900; font-size: 9px; padding: 2px 5px; } +.now-show small, .track-info small { display: block; color: #91c91b; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .02em; } +.now-show strong, .track-info strong { display: block; font-size: 14px; margin-top: 1px; } +.now-show span, .track-info span { display: block; color: #f3f3f3; font-size: 10.5px; margin-top: 2px; line-height: 1.35; } +.waveform { height: 45px; display: flex; align-items: center; justify-content: flex-end; gap: 3px; opacity: .62; overflow: hidden; } +.waveform i { width: 2px; height: 12px; background: #77b800; box-shadow: 0 0 5px rgba(125,189,0,.4); animation: pulse 1.3s ease-in-out infinite alternate; } +.waveform i:nth-child(2n){height:24px;animation-delay:-.7s}.waveform i:nth-child(3n){height:34px;animation-delay:-.25s}.waveform i:nth-child(5n){height:17px;animation-delay:-1s} +@keyframes pulse { to { transform: scaleY(.45); opacity:.45; } } +.player-button { border: 0; width: 58px; height: 58px; border-radius: 50%; color: white; background: radial-gradient(circle at 35% 28%, #a9e02e, #77ad00 70%); display: grid; place-items: center; box-shadow: 0 0 0 5px rgba(121,179,0,.07), 0 4px 13px rgba(0,0,0,.32); } +.player-button svg { width: 24px; fill: currentColor; } +.icon-pause { display:none; }.live-player.is-playing .icon-play{display:none}.live-player.is-playing .icon-pause{display:block} +.track-cover { width: 48px; height: 54px; border-radius: 3px; overflow: hidden; } +.track-cover img { width:100%;height:100%;object-fit:cover; } +.volume { display:flex; align-items:center; gap:8px; } +.volume svg { width:21px; fill:#fff; flex:0 0 auto; } +.volume input { width: 82px; accent-color: var(--green); } +.player-message { margin: 4px 8px 0; height: 0; overflow: visible; color: #777; font-size: 11px; } + +.portal { padding-top: 20px; padding-bottom: 22px; align-items: start; } +.portal-main { min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 20px 25px; } +.portal-section { min-width: 0; } +.section-heading { height: 25px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; } +.section-heading h2 { margin: 0; text-transform: uppercase; font-size: 13px; line-height: 1.2; letter-spacing: .01em; font-weight: 900; } +.section-heading a { color: #383d39; font-size: 10px; white-space: nowrap; } +.compact-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; } +.portal-card { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; box-shadow: 0 2px 6px rgba(22,26,22,.09); } +.portal-card .media { display:block; height: 86px; overflow:hidden; position:relative; background:#dde3d8; } +.portal-card .media img { width:100%;height:100%;object-fit:cover;transition:transform .25s ease; } +.portal-card:hover .media img { transform:scale(1.03); } +.card-copy { padding: 8px 8px 9px; min-height: 82px; } +.card-copy .category { color: #79ae00; font-size: 8px; text-transform: uppercase; font-weight: 900; } +.card-copy h3 { margin: 3px 0 5px; font-size: 11px; line-height: 1.18; font-weight: 820; } +.card-copy p, .card-copy time, .card-copy .place { margin:0; color:#666c66; font-size:8.5px; line-height:1.3; } +.card-copy .place { display:block; margin-top:4px; } +.event-media { height: 78px !important; } +.event-date { position:absolute; left:8px; bottom:0; width:40px; min-height:42px; background:rgba(255,255,255,.96); text-align:center; border-radius:4px 4px 0 0; padding-top:2px; color:#171917; box-shadow:0 1px 4px rgba(0,0,0,.16); } +.event-date b { display:block; color:#70aa00; font-size:19px; line-height:20px; } +.event-date small { font-size:8px; font-weight:900; } +.event-card .card-copy { min-height:90px; } +.story-card .media { height: 82px; } +.story-card .card-copy { min-height: 65px; } +.story-card .card-copy h3 { font-size: 11.5px; } + +.schedule-card { border:1px solid var(--line); border-radius:6px; overflow:hidden; box-shadow:0 2px 6px rgba(22,26,22,.09); background:#fff; } +.schedule-row { min-height: 35px; display:grid; grid-template-columns:95px minmax(0,1fr) 30px auto; align-items:center; gap:9px; padding:3px 8px 3px 10px; border-bottom:1px solid #eceeea; position:relative; } +.schedule-row:last-child { border-bottom:0; } +.schedule-row.is-live { background:linear-gradient(90deg,#ecf7dc,#e7f2dc); } +.schedule-row time { font-size:9px; } +.schedule-info strong { display:block; font-size:10px; } +.schedule-info span { display:block; font-size:8px; color:#5e645e; } +.presenter { width:28px;height:28px;border-radius:50%;object-fit:cover;border:1px solid #dfe3dc; } +.live-badge { background:#7eb700;color:#fff;border-radius:4px;padding:3px 7px;text-transform:uppercase;font-size:7px;font-weight:900;white-space:nowrap; } + +.sidebar { margin-top: -215px; position: relative; z-index: 9; display:flex; flex-direction:column; gap:12px; } +.side-card { background:#fff;border:1px solid var(--line);border-radius:7px;box-shadow:var(--shadow);padding:14px; } +.side-title { display:block;color:#75ad00;text-transform:uppercase;font-size:10px;font-weight:900;letter-spacing:.01em; } +.weather-card { min-height: 214px; padding:14px 15px 12px; } +.weather-main { display:grid;grid-template-columns:58px 55px 1fr;align-items:center;margin-top:7px; } +.weather-icon { width:52px;height:42px;position:relative;display:block; } +.weather-icon:before { content:"";position:absolute;left:17px;top:1px;width:23px;height:23px;border-radius:50%;background:#ffb900;box-shadow:-18px 7px 0 -8px #ffb900,18px 7px 0 -8px #ffb900,0 -18px 0 -9px #ffb900; } +.weather-icon:after { content:"";position:absolute;left:5px;bottom:1px;width:46px;height:22px;border-radius:16px;background:linear-gradient(#e7e9f2,#cdd1e0);box-shadow:18px 5px 0 -7px #d7dae6; } +.weather-main > strong { font-size:34px;font-weight:520;letter-spacing:-.05em; } +.weather-main div b { display:block;font-size:10px; }.weather-main div small{display:block;color:#666;font-size:9px;margin-top:2px;} +.weather-facts { display:flex;justify-content:space-between;border-top:1px solid #eff0ed;border-bottom:1px solid #eff0ed;padding:9px 1px;margin:8px 0;color:#626862;font-size:8.5px; } +.forecast { display:grid;grid-template-columns:repeat(4,1fr);text-align:center; } +.forecast span { font-size:8px;border-right:1px solid #efefed; }.forecast span:last-child{border-right:0}.forecast small{display:block;font-size:18px;margin:2px 0}.forecast b{display:block;font-size:9px}.forecast em{font-style:normal;color:#8b908b;font-weight:500} +.weather-card > a,.tip-card > a,.traffic-card > a { display:block;text-align:center;color:#6fa500;font-weight:750;font-size:8.5px;margin-top:7px; } +.tip-card { padding:13px 12px 10px; } +.tip-visual { display:block;height:78px;margin-top:6px;border-radius:5px;overflow:hidden;position:relative; } +.tip-visual img{width:100%;height:100%;object-fit:cover}.tip-visual:after{content:"";position:absolute;inset:0;background:linear-gradient(0deg,rgba(0,0,0,.65),transparent 70%)}.tip-visual strong{position:absolute;z-index:2;left:10px;bottom:8px;color:white;font-size:10px;line-height:1.2} +.tip-card > a { text-align:left; } +.traffic-card { display:grid;grid-template-columns:1fr auto;gap:4px 10px;align-items:center;min-height:84px; } +.traffic-card small{display:block;color:#666;font-size:8.5px;margin-top:5px}.traffic-count{width:26px;height:26px;border:1px solid #80b700;border-radius:50%;display:grid;place-items:center;color:#75aa00;font-weight:800}.traffic-card>a{grid-column:1/-1;text-align:left;margin:2px 0 0} +.app-card { min-height: 153px; border-radius:7px;overflow:hidden;position:relative;color:#fff;padding:14px 13px;background:linear-gradient(135deg,#75ab00,#426b00);box-shadow:var(--shadow); } +.app-copy { width:62%;position:relative;z-index:2 }.app-copy>span{display:block;text-transform:uppercase;font-weight:900;font-size:12px}.app-copy>strong{display:block;font-size:9px;margin:2px 0 7px}.app-copy ul{padding:0;margin:0 0 9px;list-style:none;font-size:8.5px;line-height:1.55}.app-copy li:before{content:"◉";margin-right:5px}.store-buttons{display:flex;gap:5px}.store-buttons b{background:#050505;border:1px solid rgba(255,255,255,.55);padding:4px 6px;border-radius:4px;font-size:7px;white-space:nowrap}.phone{position:absolute;right:-5px;bottom:-18px;width:92px;height:160px;border-radius:18px;background:#0b0c0b;border:5px solid #111;transform:rotate(8deg);box-shadow:0 6px 18px rgba(0,0,0,.35)}.phone:before{content:"";position:absolute;top:3px;left:28px;width:28px;height:5px;border-radius:8px;background:#252725}.phone-screen{position:absolute;inset:8px 4px 4px;border-radius:10px;background:radial-gradient(circle at 50% 30%,#28341d,#050706 70%);display:grid;place-items:center;overflow:hidden}.phone-screen img{width:76px;filter:drop-shadow(0 2px 2px #000)} + +.site-footer { background:linear-gradient(90deg,#080a09,#111412);color:#e8ebe7;padding:18px 0 16px; } +.footer-grid { display:grid;grid-template-columns:220px repeat(4,1fr) 155px;gap:28px;align-items:start; } +.footer-brand { height:90px;display:flex;align-items:center }.footer-brand img{width:170px}.footer-grid>div:not(.footer-brand):not(.footer-domain){display:flex;flex-direction:column}.footer-grid strong{font-size:9px;text-transform:uppercase;margin-bottom:4px}.footer-grid a{font-size:9px;color:#d4d8d3;line-height:1.55}.footer-domain b{font-size:17px;font-weight:500}.socials{display:flex;gap:9px;margin-top:12px}.socials span{width:25px;height:25px;border:1px solid #6e746e;border-radius:50%;display:grid;place-items:center;font-size:11px} + +@media (max-width: 1120px) { + :root{--sidebar:230px;--gap:22px}.main-nav{gap:18px}.brand{width:145px}.listen-button{padding-inline:13px}.live-player{grid-template-columns:56px 165px 1fr 60px 48px 125px}.volume{display:none}.portal-main{gap:18px}.footer-grid{grid-template-columns:190px repeat(4,1fr);}.footer-domain{display:none} +} +@media (max-width: 900px) { + .site-header{height:68px}.header-inner{gap:12px}.menu-toggle{display:flex;margin-left:auto;width:42px;height:42px;border:0;background:transparent;flex-direction:column;justify-content:center;gap:5px;padding:9px}.menu-toggle span:not(.sr-only){display:block;height:2px;background:#fff;border-radius:2px}.main-nav{position:absolute;left:0;right:0;top:68px;background:#0b0d0c;display:none;flex-direction:column;align-items:flex-start;padding:18px 22px 24px;gap:15px}.main-nav.is-open{display:flex}.listen-button{margin-left:0}.search-button{display:none}.hero{height:370px}.page-layout{grid-template-columns:1fr}.player-stage{margin-top:-35px}.sidebar{margin-top:0;display:grid;grid-template-columns:1fr 1fr}.portal-main{grid-template-columns:1fr}.footer-grid{grid-template-columns:170px repeat(2,1fr)}.footer-grid>div:nth-child(4),.footer-grid>div:nth-child(5){display:none!important} +} +@media (max-width: 650px) { + .page-shell{width:min(100% - 24px,var(--page))}.brand{width:132px}.brand img{width:132px}.listen-button{font-size:0;width:43px;height:40px;padding:0;justify-content:center}.listen-button svg{width:18px}.hero{height:440px}.hero-inner{padding-top:38px}.hero-logo{width:250px;height:135px}.hero h1{font-size:34px;max-width:390px}.hero p{font-size:18px}.hero-actions{flex-direction:column;align-items:stretch;max-width:300px;gap:10px}.signal-rings{right:-85px;top:75px;opacity:.25}.live-player{grid-template-columns:50px 1fr 56px;padding:13px;min-height:88px}.host-avatar{width:48px;height:48px}.waveform,.track-cover,.track-info,.volume{display:none}.now-show span{font-size:9px}.player-button{width:52px;height:52px}.compact-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.compact-grid article:last-child{display:none}.portal-card .media{height:105px}.sidebar{grid-template-columns:1fr}.section-heading h2{font-size:12px}.section-heading a{display:none}.footer-grid{grid-template-columns:1fr 1fr;gap:18px}.footer-brand{grid-column:1/-1;height:70px}.footer-brand img{width:155px}.footer-grid>div:nth-child(3){display:none!important} +} +@media (prefers-reduced-motion: reduce){html{scroll-behavior:auto}.waveform i{animation:none}*{transition:none!important}} + +/* + * v8 – komfortable Standarddarstellung + * + * Die Desktop-Ansicht ist bewusst etwa so groß und gut lesbar wie die + * bisherige Seite bei ca. 125–130 % Browser-Zoom. Dabei wird nicht die + * komplette Seite technisch gezoomt; Typografie, Abstände, Karten und + * Bedienelemente wurden nativ vergrößert. So bleiben Responsive Layout, + * Schärfe und Bedienbarkeit erhalten. + */ +@media (min-width: 1500px) { + :root { + --page: 1540px; + --sidebar: 305px; + --gap: 36px; + --shadow: 0 4px 16px rgba(20, 24, 20, .13); + } + + body { font-size: 16px; line-height: 1.42; } + .page-shell { width: min(var(--page), calc(100% - 52px)); } + + .site-header { height: 86px; } + .header-inner { gap: 30px; } + .brand { width: 190px; height: 76px; } + .brand img { width: 186px; } + .main-nav { gap: 34px; margin-left: 10px; } + .main-nav a { font-size: 15px; } + .chevron { font-size: 17px; } + .listen-button { border-radius: 7px; padding: 14px 22px; gap: 10px; font-size: 15px; } + .listen-button svg { width: 17px; } + .search-button { width: 44px; height: 44px; padding: 8px; } + .search-button svg { width: 25px; } + + .hero { height: 420px; } + .hero-inner { padding-top: 27px; } + .hero-logo { width: 365px; height: 174px; margin-left: -11px; margin-bottom: -4px; } + .hero h1 { font-size: clamp(40px, 3.1vw, 52px); } + .hero p { margin: 7px 0 18px; font-size: 27px; } + .hero-actions { gap: 21px; } + .button { height: 51px; border-radius: 7px; padding: 0 28px; gap: 11px; font-size: 15px; } + .button svg { width: 17px; } + .button-outline { min-width: 265px; } + .button-outline span { font-size: 22px; } + .signal-rings { right: 14%; top: 43px; width: 338px; height: 326px; } + .signal-rings i { border-width: 6px; } + .signal-rings i:nth-child(1) { width: 151px; height: 151px; left: 85px; bottom: 67px; } + .signal-rings i:nth-child(2) { width: 248px; height: 248px; left: 36px; bottom: 18px; } + .signal-rings i:nth-child(3) { width: 345px; height: 345px; left: -12px; bottom: -30px; } + + .player-stage { margin-top: -43px; } + .live-player { + min-height: 118px; + border-radius: 12px; + padding: 16px 24px 16px 20px; + grid-template-columns: 76px 220px minmax(90px, 1fr) 82px 66px 185px 142px; + gap: 15px; + } + .host-avatar { width: 70px; height: 70px; border-width: 3px; } + .host-avatar span { right: -5px; bottom: -8px; border-radius: 6px; font-size: 11px; padding: 3px 6px; } + .now-show small, .track-info small { font-size: 12px; } + .now-show strong, .track-info strong { font-size: 17px; margin-top: 2px; } + .now-show span, .track-info span { font-size: 13px; margin-top: 3px; } + .waveform { height: 55px; gap: 4px; } + .waveform i { width: 3px; height: 15px; } + .waveform i:nth-child(2n) { height: 29px; } + .waveform i:nth-child(3n) { height: 41px; } + .waveform i:nth-child(5n) { height: 21px; } + .player-button { width: 70px; height: 70px; } + .player-button svg { width: 29px; } + .track-cover { width: 59px; height: 66px; border-radius: 4px; } + .volume { gap: 10px; } + .volume svg { width: 25px; } + .volume input { width: 100px; } + .player-message { margin: 5px 10px 0; font-size: 13px; } + + .portal { padding-top: 28px; padding-bottom: 31px; } + .portal-main { gap: 29px 31px; } + .section-heading { height: 33px; gap: 12px; } + .section-heading h2 { font-size: 16px; } + .section-heading a { font-size: 12px; } + .compact-grid { gap: 13px; } + .portal-card { border-radius: 8px; box-shadow: 0 3px 9px rgba(22,26,22,.1); } + .portal-card .media { height: 108px; } + .card-copy { padding: 11px 11px 12px; min-height: 104px; } + .card-copy .category { font-size: 10px; } + .card-copy h3 { margin: 4px 0 7px; font-size: 14px; line-height: 1.24; } + .card-copy p, .card-copy time, .card-copy .place { font-size: 10.5px; line-height: 1.38; } + .card-copy .place { margin-top: 5px; } + .event-media { height: 99px !important; } + .event-date { left: 10px; width: 49px; min-height: 52px; border-radius: 5px 5px 0 0; padding-top: 3px; } + .event-date b { font-size: 23px; line-height: 25px; } + .event-date small { font-size: 10px; } + .event-card .card-copy { min-height: 112px; } + .story-card .media { height: 103px; } + .story-card .card-copy { min-height: 82px; } + .story-card .card-copy h3 { font-size: 14.5px; } + + .schedule-card { border-radius: 8px; box-shadow: 0 3px 9px rgba(22,26,22,.1); } + .schedule-row { min-height: 45px; grid-template-columns: 118px minmax(0,1fr) 38px auto; gap: 11px; padding: 4px 10px 4px 13px; } + .schedule-row time { font-size: 11px; } + .schedule-info strong { font-size: 12.5px; } + .schedule-info span { font-size: 10px; } + .presenter { width: 35px; height: 35px; } + .live-badge { border-radius: 5px; padding: 4px 9px; font-size: 9px; } + + .sidebar { margin-top: -262px; gap: 15px; } + .side-card { border-radius: 9px; padding: 17px; } + .side-title { font-size: 12px; } + .weather-card { min-height: 263px; padding: 17px 18px 15px; } + .weather-main { grid-template-columns: 70px 67px 1fr; margin-top: 9px; } + .weather-icon { width: 63px; height: 51px; } + .weather-icon:before { left: 21px; top: 1px; width: 28px; height: 28px; box-shadow: -22px 9px 0 -10px #ffb900, 22px 9px 0 -10px #ffb900, 0 -22px 0 -11px #ffb900; } + .weather-icon:after { left: 6px; bottom: 1px; width: 56px; height: 27px; border-radius: 19px; box-shadow: 22px 6px 0 -9px #d7dae6; } + .weather-main > strong { font-size: 42px; } + .weather-main div b { font-size: 12px; } + .weather-main div small { font-size: 11px; margin-top: 3px; } + .weather-facts { padding: 11px 1px; margin: 10px 0; font-size: 10.5px; } + .forecast span { font-size: 10px; } + .forecast small { font-size: 22px; margin: 3px 0; } + .forecast b { font-size: 11px; } + .weather-card > a, .tip-card > a, .traffic-card > a { font-size: 10.5px; margin-top: 9px; } + .tip-card { padding: 16px 15px 12px; } + .tip-visual { height: 98px; margin-top: 8px; border-radius: 6px; } + .tip-visual strong { left: 12px; bottom: 10px; font-size: 12.5px; } + .traffic-card { gap: 5px 12px; min-height: 104px; } + .traffic-card small { font-size: 10.5px; margin-top: 6px; } + .traffic-count { width: 32px; height: 32px; } + .app-card { min-height: 188px; border-radius: 9px; padding: 17px 16px; } + .app-copy > span { font-size: 15px; } + .app-copy > strong { font-size: 11px; margin: 3px 0 9px; } + .app-copy ul { margin-bottom: 11px; font-size: 10.5px; } + .store-buttons { gap: 6px; } + .store-buttons b { padding: 5px 8px; border-radius: 5px; font-size: 8.5px; } + .phone { right: -6px; bottom: -22px; width: 112px; height: 195px; border-radius: 22px; border-width: 6px; } + .phone:before { top: 4px; left: 34px; width: 34px; height: 6px; } + .phone-screen { inset: 10px 5px 5px; border-radius: 12px; } + .phone-screen img { width: 93px; } + + .site-footer { padding: 24px 0 21px; } + .footer-grid { grid-template-columns: 270px repeat(4,1fr) 190px; gap: 34px; } + .footer-brand { height: 110px; } + .footer-brand img { width: 208px; } + .footer-grid strong { font-size: 11px; margin-bottom: 6px; } + .footer-grid a { font-size: 11px; line-height: 1.65; } + .footer-domain b { font-size: 21px; } + .socials { gap: 11px; margin-top: 15px; } + .socials span { width: 31px; height: 31px; font-size: 13px; } +} + +/* Mittlere Desktop- und Tablet-Breite: ebenfalls besser lesbar, aber kompakter. */ +@media (min-width: 901px) and (max-width: 1499px) { + :root { --sidebar: 255px; --gap: 24px; } + body { font-size: 15px; } + .site-header { height: 76px; } + .brand { width: 158px; height: 66px; } + .brand img { width: 154px; } + .main-nav { gap: 15px; } + .main-nav a { font-size: 13.5px; } + .listen-button { padding: 12px 14px; font-size: 13px; } + .hero { height: 385px; } + .hero-logo { width: 325px; height: 158px; } + .hero h1 { font-size: clamp(35px, 4vw, 45px); } + .hero p { font-size: 23px; } + .live-player { min-height: 105px; grid-template-columns: 64px 180px 1fr 65px 52px 140px; padding: 14px 18px; } + .host-avatar { width: 60px; height: 60px; } + .now-show small, .track-info small { font-size: 10.5px; } + .now-show strong, .track-info strong { font-size: 15px; } + .now-show span, .track-info span { font-size: 11px; } + .player-button { width: 60px; height: 60px; } + .track-cover { width: 50px; height: 58px; } + .volume { display: none; } + .section-heading h2 { font-size: 14px; } + .section-heading a { font-size: 11px; } + .portal-card .media { height: 96px; } + .card-copy { min-height: 92px; padding: 9px 9px 10px; } + .card-copy .category { font-size: 9px; } + .card-copy h3 { font-size: 12.5px; } + .card-copy p, .card-copy time, .card-copy .place { font-size: 9.5px; } + .event-media { height: 87px !important; } + .story-card .media { height: 91px; } + .schedule-row { min-height: 40px; } + .schedule-row time { font-size: 10px; } + .schedule-info strong { font-size: 11px; } + .schedule-info span { font-size: 9px; } + .sidebar { margin-top: -230px; } + .side-title { font-size: 11px; } + .weather-main > strong { font-size: 37px; } + .weather-main div b { font-size: 11px; } + .weather-main div small, .weather-facts, .traffic-card small { font-size: 9.5px; } + .app-copy > span { font-size: 13px; } + .app-copy > strong { font-size: 10px; } + .app-copy ul { font-size: 9.5px; } +} + +/* Auf kleinen Bildschirmen bleibt das Layout responsiv, die Schrift ist jedoch nicht unnötig klein. */ +@media (max-width: 900px) { + body { font-size: 15px; } + .main-nav a { font-size: 15px; } + .section-heading h2 { font-size: 14px; } + .section-heading a { font-size: 11px; } + .card-copy .category { font-size: 9.5px; } + .card-copy h3 { font-size: 13px; } + .card-copy p, .card-copy time, .card-copy .place { font-size: 10px; } + .schedule-row time { font-size: 10px; } + .schedule-info strong { font-size: 11px; } + .schedule-info span { font-size: 9px; } + .side-title { font-size: 11px; } + .footer-grid strong, .footer-grid a { font-size: 10px; } +} + +/* + * v9 – eigener Landwelle Cookie-Consent + * + * Der Dialog blockiert beim ersten Besuch die Bedienung, bis eine echte + * Entscheidung getroffen wurde. Ablehnen und Akzeptieren sind direkt + * erreichbar. Spätere optionale Dienste können auf das JavaScript-Ereignis + * `landwelle:consent-changed` reagieren. + */ +.footer-consent-button { + appearance: none; + border: 0; + border-bottom: 1px solid transparent; + padding: 0; + margin: 0; + color: #d4d8d3; + background: transparent; + font-size: inherit; + line-height: 1.65; + text-align: left; +} +.footer-consent-button:hover, +.footer-consent-button:focus-visible { + color: #a8d73e; + border-bottom-color: currentColor; +} + +html.consent-open, +html.consent-open body { + overflow: hidden; +} + +.consent-layer[hidden] { display: none; } +.consent-layer { + position: fixed; + inset: 0; + z-index: 1000; + display: grid; + place-items: center; + padding: 24px; + background: + radial-gradient(circle at 80% 15%, rgba(127, 189, 0, .18), transparent 33%), + rgba(3, 5, 4, .82); + -webkit-backdrop-filter: blur(8px); + backdrop-filter: blur(8px); +} + +.consent-dialog { + position: relative; + width: min(1080px, 100%); + max-height: min(780px, calc(100vh - 48px)); + display: grid; + grid-template-columns: 340px minmax(0, 1fr); + overflow: hidden; + border: 1px solid rgba(255, 255, 255, .13); + border-radius: 18px; + background: #fff; + box-shadow: 0 28px 80px rgba(0, 0, 0, .48), 0 0 0 1px rgba(127, 189, 0, .08); + outline: none; +} + +.consent-brand-panel { + position: relative; + min-height: 100%; + overflow: hidden; + display: flex; + flex-direction: column; + justify-content: flex-end; + padding: 34px 30px; + color: #fff; + background: + linear-gradient(155deg, rgba(127, 189, 0, .96), rgba(77, 122, 0, .92) 43%, rgba(8, 11, 9, .96) 43.5%, #050706 100%); +} +.consent-brand-panel:after { + content: ""; + position: absolute; + inset: 0; + background: linear-gradient(180deg, transparent 48%, rgba(0, 0, 0, .35)); + pointer-events: none; +} +.consent-brand-panel img { + position: relative; + z-index: 2; + width: 255px; + margin: 0 0 25px -5px; + filter: drop-shadow(0 5px 12px rgba(0, 0, 0, .45)); +} +.consent-brand-panel > span { + position: relative; + z-index: 2; + max-width: 245px; + color: rgba(255, 255, 255, .9); + font-size: 17px; + font-weight: 750; + line-height: 1.3; +} +.consent-signal { + position: absolute; + z-index: 1; + right: -55px; + top: 48px; + width: 285px; + height: 285px; + opacity: .35; + transform: rotate(-8deg); +} +.consent-signal i { + position: absolute; + right: 0; + bottom: 0; + border: 5px solid rgba(255, 255, 255, .95); + border-left-color: transparent; + border-bottom-color: transparent; + border-radius: 50%; + transform: rotate(-45deg); +} +.consent-signal i:nth-child(1) { width: 100px; height: 100px; right: 91px; bottom: 91px; } +.consent-signal i:nth-child(2) { width: 190px; height: 190px; right: 46px; bottom: 46px; } +.consent-signal i:nth-child(3) { width: 280px; height: 280px; } + +.consent-content { + min-width: 0; + overflow: auto; + padding: 38px 42px 30px; + scrollbar-width: thin; + scrollbar-color: #9acb2b #eef1eb; +} +.consent-kicker { + display: block; + margin-bottom: 7px; + color: #70a900; + font-size: 12px; + font-weight: 900; + letter-spacing: .08em; + text-transform: uppercase; +} +.consent-content h2 { + margin: 0; + color: #111411; + font-size: clamp(28px, 3vw, 40px); + line-height: 1.05; + letter-spacing: -.035em; +} +.consent-content > p { + margin: 14px 0 0; + color: #545b54; + font-size: 15px; + line-height: 1.55; +} + +.consent-current { + display: grid; + grid-template-columns: 38px 1fr; + align-items: center; + gap: 12px; + margin-top: 22px; + padding: 13px 15px; + border: 1px solid #dce8c5; + border-radius: 10px; + background: linear-gradient(90deg, #f3f9e9, #fbfcf8); +} +.consent-current-icon { + width: 36px; + height: 36px; + display: grid; + place-items: center; + border-radius: 50%; + color: #fff; + background: linear-gradient(#92cb18, #71a900); + font-size: 18px; + font-weight: 900; + box-shadow: 0 4px 10px rgba(112, 169, 0, .24); +} +.consent-current strong, +.consent-current small { display: block; } +.consent-current strong { color: #202520; font-size: 13px; } +.consent-current small { margin-top: 2px; color: #626962; font-size: 11px; line-height: 1.4; } + +.consent-settings-toggle { + width: 100%; + min-height: 48px; + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 17px; + padding: 0 15px; + border: 1px solid #dfe4dc; + border-radius: 9px; + color: #242824; + background: #f7f8f5; + font-weight: 800; + text-align: left; +} +.consent-settings-toggle:hover { background: #f0f4eb; border-color: #c9d6bc; } +.consent-settings-toggle:focus-visible, +.consent-action:focus-visible, +.consent-close:focus-visible, +.consent-switch input:focus-visible + span { + outline: 3px solid rgba(127, 189, 0, .38); + outline-offset: 3px; +} +.consent-toggle-arrow { + color: #6ea400; + font-size: 22px; + line-height: 1; + transition: transform .2s ease; +} +.consent-settings-toggle[aria-expanded="true"] .consent-toggle-arrow { transform: rotate(180deg); } + +.consent-settings[hidden] { display: none; } +.consent-settings { + margin-top: 9px; + overflow: hidden; + border: 1px solid #e2e6df; + border-radius: 10px; + background: #fff; +} +.consent-category { + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + align-items: center; + gap: 22px; + padding: 15px; + border-bottom: 1px solid #edf0eb; +} +.consent-category:last-child { border-bottom: 0; } +.consent-category strong { display: block; color: #1a1e1a; font-size: 13px; } +.consent-category p { margin: 3px 0 0; color: #697069; font-size: 11px; line-height: 1.45; } + +.consent-switch { + position: relative; + display: block; + width: 48px; + height: 27px; + flex: 0 0 auto; +} +.consent-switch input { + position: absolute; + width: 1px; + height: 1px; + opacity: 0; +} +.consent-switch span { + position: absolute; + inset: 0; + border: 1px solid #bdc4bb; + border-radius: 999px; + background: #dfe3dc; + transition: background .18s ease, border-color .18s ease; + cursor: pointer; +} +.consent-switch span:after { + content: ""; + position: absolute; + left: 3px; + top: 3px; + width: 19px; + height: 19px; + border-radius: 50%; + background: #fff; + box-shadow: 0 2px 5px rgba(0, 0, 0, .2); + transition: transform .18s ease; +} +.consent-switch input:checked + span { + border-color: #72aa00; + background: linear-gradient(#90c919, #73a900); +} +.consent-switch input:checked + span:after { transform: translateX(21px); } +.consent-switch-locked span { opacity: .72; cursor: default; } + +.consent-actions { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 10px; + margin-top: 20px; +} +.consent-action { + min-height: 48px; + border-radius: 8px; + padding: 9px 12px; + font-size: 12px; + font-weight: 850; + line-height: 1.25; +} +.consent-action-essential { + border: 1px solid #202420; + color: #fff; + background: #151815; +} +.consent-action-essential:hover { background: #292d29; } +.consent-action-save { + border: 1px solid #bfc6bb; + color: #262b26; + background: #fff; +} +.consent-action-save:hover { background: #f4f6f2; } +.consent-action-all { + border: 1px solid #75ad00; + color: #fff; + background: linear-gradient(#92cb18, #73a900); + box-shadow: inset 0 1px rgba(255, 255, 255, .26), 0 4px 12px rgba(111, 166, 0, .2); +} +.consent-action-all:hover { background: linear-gradient(#9bd520, #7ab400); } +.consent-note { + margin-top: 13px !important; + color: #767d76 !important; + font-size: 11px !important; + line-height: 1.45 !important; + text-align: center; +} +.consent-status { + min-height: 17px; + margin-top: 4px !important; + color: #5e8d00 !important; + font-size: 11px !important; + font-weight: 750; + text-align: center; +} +.consent-close { + position: absolute; + z-index: 8; + right: 13px; + top: 12px; + width: 38px; + height: 38px; + display: grid; + place-items: center; + border: 1px solid #dce0d9; + border-radius: 50%; + color: #333833; + background: rgba(255, 255, 255, .94); + font-size: 25px; + line-height: 1; + box-shadow: 0 3px 10px rgba(0, 0, 0, .1); +} +.consent-close[hidden] { display: none; } +.consent-close:hover { color: #fff; background: #111411; border-color: #111411; } + +@media (min-width: 1500px) { + .footer-consent-button { font-size: 11px; } + .consent-dialog { width: min(1160px, 100%); grid-template-columns: 370px minmax(0, 1fr); } + .consent-content { padding: 43px 48px 34px; } + .consent-content > p { font-size: 16px; } + .consent-category strong { font-size: 14px; } + .consent-category p, .consent-current small, .consent-note { font-size: 12px !important; } + .consent-action { min-height: 53px; font-size: 13px; } +} + +@media (max-width: 820px) { + .consent-layer { padding: 14px; align-items: end; } + .consent-dialog { + width: 100%; + max-height: calc(100vh - 28px); + grid-template-columns: 1fr; + border-radius: 16px; + } + .consent-brand-panel { + min-height: 125px; + justify-content: center; + padding: 20px 24px; + } + .consent-brand-panel img { width: 205px; margin: 0; } + .consent-brand-panel > span { display: none; } + .consent-signal { right: -70px; top: -70px; transform: scale(.7) rotate(-8deg); } + .consent-content { padding: 25px 25px 22px; } + .consent-content h2 { padding-right: 24px; font-size: 29px; } + .consent-content > p { font-size: 14px; } + .consent-close { color: #fff; border-color: rgba(255,255,255,.35); background: rgba(0,0,0,.35); } +} + +@media (max-width: 560px) { + .consent-layer { padding: 0; } + .consent-dialog { + max-height: 100vh; + min-height: 100dvh; + border: 0; + border-radius: 0; + } + .consent-brand-panel { min-height: 104px; padding: 14px 19px; } + .consent-brand-panel img { width: 175px; } + .consent-content { padding: 20px 18px 18px; } + .consent-kicker { font-size: 10px; } + .consent-content h2 { font-size: 26px; } + .consent-content > p { margin-top: 10px; font-size: 13px; line-height: 1.45; } + .consent-current { grid-template-columns: 32px 1fr; gap: 9px; margin-top: 15px; padding: 10px 11px; } + .consent-current-icon { width: 30px; height: 30px; font-size: 15px; } + .consent-current strong { font-size: 12px; } + .consent-current small { font-size: 10px; } + .consent-settings-toggle { min-height: 43px; margin-top: 12px; font-size: 12px; } + .consent-category { gap: 13px; padding: 12px; } + .consent-category strong { font-size: 12px; } + .consent-category p { font-size: 10px; } + .consent-actions { grid-template-columns: 1fr; gap: 8px; margin-top: 14px; } + .consent-action { min-height: 44px; } + .consent-action-all { order: -1; } + .consent-note { margin-top: 10px !important; font-size: 10px !important; } +} + +@media (prefers-reduced-motion: reduce) { + .consent-toggle-arrow, + .consent-switch span, + .consent-switch span:after { transition: none; } +} + +/* v10: Live-Wetter Visselhövede */ +.weather-live-icon{display:grid;place-items:center;width:58px;height:52px;font-size:34px;line-height:1;filter:drop-shadow(0 4px 7px rgba(0,0,0,.1))} +.weather-card.is-loading [data-weather-description]{color:#7b837c} +.weather-card.is-error{border-color:#f0c9a9} +.weather-card.is-error [data-weather-description]{color:#a45b1f} +.weather-updated{display:block;margin-top:5px;text-align:center;color:#8d948e;font-size:7.5px} +.weather-skeleton{display:block;width:75%;height:42px;margin:5px auto;border-radius:7px;background:linear-gradient(90deg,#eef1ee 25%,#f8faf8 45%,#eef1ee 65%);background-size:220% 100%;animation:weatherShimmer 1.4s infinite} +@keyframes weatherShimmer{to{background-position:-220% 0}} +.forecast span small.weather-forecast-icon{font-size:21px;line-height:1.2} +@media (min-width:1500px){.weather-live-icon{width:70px;height:61px;font-size:42px}.weather-updated{font-size:9px}.forecast span small.weather-forecast-icon{font-size:25px}} + +/* v11 – dynamische AzuraCast-Titeldaten und externe Cover */ +.track-info small em, +.track-info small a { + display: inline-block; + margin-left: 5px; + color: #8d958e; + font-size: .72em; + font-style: normal; + font-weight: 700; + letter-spacing: 0; + text-transform: none; +} +.track-info small a:hover { color: #b9e55d; text-decoration: underline; } +.track-cover img { transition: opacity .2s ease, transform .25s ease; } +.track-cover.is-loading img { opacity: .45; transform: scale(.96); } +.live-player.is-stale .track-info small::after { + content: " · zwischengespeichert"; + color: #f1bd5d; + font-size: .75em; + text-transform: none; +} + + +/* v13 – der große Liveplayer öffnet als eigenständiges Browserfenster unter /player. */ +.footer-player-button { + width: max-content; + margin: 0; + padding: 0; + border: 0; + color: #d4d8d3; + background: transparent; + font-size: 9px; + line-height: 1.55; + text-align: left; +} +.footer-player-button:hover { color: #a6db34; } +[data-player-open]:focus-visible { + outline: 3px solid rgba(183, 232, 78, .72); + outline-offset: 3px; +} +@media (min-width: 1500px) { + .footer-player-button { font-size: 11px; } +} + +/* v14 – Bildkorrekturen, Unterseiten, Verkehr und Programm */ +.host-avatar img{object-position:50% 46%;transform:scale(1.04);transform-origin:center;border-radius:50%} +.portal-card .media img{object-position:center center} +.news-card .media{background:#dfe5db} +.news-card .media img{object-position:center 52%} +.footer-consent-button{border:0;background:transparent;color:#d4d8d3;padding:0;text-align:left;font-size:9px;line-height:1.55} +.footer-domain{display:flex;flex-direction:column;gap:4px}.footer-domain>a{font-size:9px;color:#d4d8d3} + +.subpage-main{min-height:65vh;background:linear-gradient(#f7f8f5,#fff 420px)} +.subpage-hero{position:relative;overflow:hidden;color:#fff;padding:76px 0 70px;background:linear-gradient(110deg,rgba(4,8,5,.96),rgba(29,47,17,.9)),url('/assets/hero-poster.jpg') center/cover} +.subpage-hero:after{content:"";position:absolute;right:8%;top:-55px;width:300px;height:300px;border:7px solid rgba(132,195,15,.28);border-radius:50%;box-shadow:0 0 0 45px rgba(132,195,15,.08),0 0 0 95px rgba(132,195,15,.05)} +.subpage-hero .page-shell{position:relative;z-index:2}.subpage-hero span{display:block;color:#a3d52f;text-transform:uppercase;font-size:13px;font-weight:900;letter-spacing:.08em}.subpage-hero h1{margin:8px 0 10px;font-size:clamp(38px,5vw,65px);line-height:1;letter-spacing:-.04em}.subpage-hero p{max-width:760px;margin:0;color:#f0f3ed;font-size:19px;line-height:1.5} +.content-page-grid{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:46px;padding-top:48px;padding-bottom:58px;align-items:start}.content-page-body{display:grid;gap:18px}.content-block{background:#fff;border:1px solid var(--line);border-radius:12px;padding:27px 30px;box-shadow:0 3px 14px rgba(20,24,20,.08)}.content-block h2{margin:0 0 9px;font-size:23px}.content-block p{margin:0;color:#535b53;font-size:16px;line-height:1.65}.content-block ul{margin:16px 0 0;padding-left:20px;color:#535b53}.content-cta{display:inline-flex;margin-top:20px;padding:11px 16px;border-radius:7px;background:var(--green);color:#fff;font-weight:800}.content-side{position:sticky;top:24px;background:linear-gradient(145deg,#0b0e0b,#182015);color:#fff;border-radius:13px;padding:26px;box-shadow:0 10px 30px rgba(0,0,0,.16)}.content-side img{width:210px;margin:0 auto 18px}.content-side strong{font-size:19px}.content-side p{color:#cfd6cc;line-height:1.55}.content-side a{display:inline-flex;color:#a5dc31;font-weight:800}.content-updated{color:#858b85;font-size:12px} + +.excursion-section,.program-page,.traffic-page{padding-top:42px;padding-bottom:64px}.filter-bar{display:flex;flex-wrap:wrap;gap:9px;margin-bottom:27px}.filter-bar button,.traffic-tabs button{border:1px solid #d9ded6;background:#fff;border-radius:999px;padding:10px 17px;font-weight:800;color:#394039}.filter-bar button.is-active,.traffic-tabs button.is-active{background:var(--green);border-color:var(--green);color:#fff}.excursion-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}.excursion-card{background:#fff;border:1px solid var(--line);border-radius:12px;overflow:hidden;box-shadow:0 4px 16px rgba(20,24,20,.09)}.excursion-card.is-featured{grid-column:span 1}.excursion-image{height:210px;display:block;position:relative;overflow:hidden}.excursion-image img{width:100%;height:100%;object-fit:cover;transition:transform .25s ease}.excursion-card:hover .excursion-image img{transform:scale(1.035)}.excursion-image span{position:absolute;left:14px;top:14px;background:rgba(10,13,10,.86);color:#a8dc39;border-radius:999px;padding:7px 11px;font-size:11px;font-weight:900;text-transform:uppercase}.excursion-card>div{padding:20px}.excursion-card small{color:#6d756d;font-weight:700}.excursion-card h2{margin:7px 0 9px;font-size:22px}.excursion-card p{margin:0 0 17px;color:#555d55;line-height:1.55}.excursion-card>div>a{color:#6b9f00;font-weight:850}.source-note{margin-top:28px;background:#eff6e6;border-left:4px solid var(--green);padding:16px 18px;border-radius:7px;color:#4c5549} + +.traffic-toolbar{display:flex;justify-content:space-between;gap:20px;align-items:center;margin-bottom:10px}.traffic-tabs{display:flex;gap:8px}.traffic-toolbar>div:last-child{display:flex;align-items:center;gap:13px;color:#616861}.traffic-toolbar [data-traffic-refresh]{border:0;border-radius:7px;background:#101411;color:#fff;padding:10px 14px;font-weight:800}.traffic-toolbar [data-traffic-refresh].is-loading{opacity:.6}.traffic-status{margin:0 0 18px;color:#737a73}.traffic-list{display:grid;gap:11px}.traffic-item{display:grid;grid-template-columns:130px minmax(0,1fr) auto;align-items:center;gap:18px;background:#fff;border:1px solid var(--line);border-radius:10px;padding:18px 20px;box-shadow:0 2px 9px rgba(20,24,20,.07)}.traffic-kind{display:inline-flex;justify-content:center;border-radius:999px;background:#eef5e4;color:#659800;padding:8px 11px;font-size:11px;font-weight:900;text-transform:uppercase}.traffic-item.is-camera .traffic-kind{background:#fff1e1;color:#c36a00}.traffic-item h3{margin:0 0 5px;font-size:17px}.traffic-item p{margin:0;color:#5a625a}.traffic-item small{display:block;margin-top:7px;color:#858b85}.traffic-item>a{color:#689d00;font-weight:850;white-space:nowrap}.traffic-empty{background:#fff;border:1px dashed #cbd2c8;border-radius:11px;padding:35px;text-align:center}.traffic-empty strong,.traffic-empty span{display:block}.traffic-empty span{margin-top:6px;color:#747b74}.traffic-disclaimer{margin:22px 0 0;padding:15px 17px;background:#f3f5f1;border-radius:8px;color:#646b64;font-size:13px}.traffic-disclaimer a{color:#659800;font-weight:800} + +.program-day{margin-bottom:34px}.program-day>h2{font-size:25px;margin:0 0 14px}.program-list{display:grid;gap:10px}.program-entry{display:grid;grid-template-columns:125px 64px minmax(0,1fr) auto;gap:18px;align-items:center;background:#fff;border:1px solid var(--line);border-radius:11px;padding:14px 18px;box-shadow:0 2px 10px rgba(20,24,20,.07)}.program-entry.is-live{border-color:#a6d34a;background:linear-gradient(90deg,#f2fae7,#fff)}.program-entry time{font-size:14px;font-weight:850}.program-entry img{width:58px;height:58px;border-radius:50%;object-fit:cover;object-position:center 35%;border:2px solid #e0e5dd}.program-entry span{color:#72a700;text-transform:uppercase;font-size:10px;font-weight:900}.program-entry h3{margin:3px 0 2px;font-size:19px}.program-entry strong{font-size:13px}.program-entry p{margin:5px 0 0;color:#626a62}.program-entry>b{background:var(--green);color:#fff;border-radius:6px;padding:7px 10px;text-transform:uppercase;font-size:10px} + +@media(min-width:1500px){.footer-consent-button,.footer-domain>a{font-size:11px}.excursion-image{height:245px}.excursion-card h2{font-size:25px}.content-page-grid{grid-template-columns:minmax(0,1fr) 380px}.traffic-item{padding:21px 24px}.traffic-item h3{font-size:20px}} +@media(max-width:900px){.content-page-grid{grid-template-columns:1fr}.content-side{position:static}.excursion-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.traffic-toolbar{align-items:flex-start;flex-direction:column}.traffic-item{grid-template-columns:105px minmax(0,1fr)}.traffic-item>a{grid-column:2}.program-entry{grid-template-columns:95px 54px minmax(0,1fr)}.program-entry>b{grid-column:3;width:max-content}} +@media(max-width:650px){.subpage-hero{padding:54px 0}.subpage-hero h1{font-size:38px}.subpage-hero p{font-size:16px}.content-page-grid{gap:24px;padding-top:28px}.content-block{padding:21px}.excursion-grid{grid-template-columns:1fr}.excursion-image{height:200px}.traffic-tabs{width:100%}.traffic-tabs button{flex:1}.traffic-toolbar>div:last-child{align-items:flex-start;flex-direction:column}.traffic-item{grid-template-columns:1fr;gap:9px;padding:16px}.traffic-item>a{grid-column:auto}.traffic-kind{width:max-content}.program-entry{grid-template-columns:64px minmax(0,1fr);gap:12px}.program-entry time{grid-column:1/-1}.program-entry img{width:54px;height:54px}.program-entry>b{grid-column:2}} + +/* + * v15 – neuer Hero, präzise Bildausschnitte, Hörerwünsche und Social-Footer + */ +.hero-video { + object-position: center center; +} + +/* Das Moderatorfoto bleibt exakt im runden Ausschnitt; der LIVE-Badge darf + weiterhin außerhalb des Kreises sitzen. */ +.host-avatar img { + display: block; + object-position: 50% 50%; + transform: none; + clip-path: circle(49% at 50% 50%); +} + +/* Überschrift und Karten bekommen voneinander unabhängige Layoutbereiche. + Damit können weder Überschriften noch Bilder optisch ineinander rutschen. */ +.portal-section { + display: flex; + min-width: 0; + flex-direction: column; +} +.section-heading { + position: relative; + z-index: 2; + height: auto; + min-height: 29px; + margin-bottom: 7px; + align-items: center; +} +.compact-grid { + position: relative; + z-index: 1; + min-width: 0; +} +.portal-card .media { + isolation: isolate; +} +.portal-card .media img { + display: block; + object-position: 50% 50%; + transform: none; +} +.portal-card:hover .media img { + transform: scale(1.015); +} +.news-card .media img { + object-position: 50% 50%; +} + +/* Social-Kanäle und Copyright */ +.footer-socials { + display: flex; + align-items: center; + gap: 9px; + margin-top: 12px; +} +.footer-socials a { + width: 34px; + height: 34px; + display: grid; + place-items: center; + border: 1px solid rgba(255,255,255,.28); + border-radius: 50%; + color: #fff; + background: rgba(255,255,255,.045); + transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease; +} +.footer-socials a:hover, +.footer-socials a:focus-visible { + color: #a8db36; + border-color: #83bd0c; + background: rgba(127,189,0,.12); + transform: translateY(-2px); +} +.footer-socials svg { + width: 19px; + height: 19px; + fill: currentColor; +} +.footer-bottom { + display: flex; + align-items: center; + justify-content: space-between; + gap: 20px; + margin-top: 18px; + padding-top: 14px; + border-top: 1px solid rgba(255,255,255,.11); + color: #969d96; + font-size: 10px; +} +.footer-bottom span:last-child { + color: #7fbd00; + font-weight: 750; +} + +/* Hörerwünsche & Grüße */ +.wish-page { + background: #f4f6f1; +} +.wish-hero { + min-height: 335px; + display: flex; + align-items: center; + background: + linear-gradient(90deg, rgba(5,8,6,.9), rgba(8,12,9,.63) 55%, rgba(8,12,9,.32)), + url('/assets/hero-poster.jpg') center 57% / cover no-repeat; +} +.wish-hero .page-shell { + padding-bottom: 42px; +} +.wish-hero span { + color: #a4d934; +} +.wish-layout { + position: relative; + z-index: 3; + display: grid; + grid-template-columns: minmax(0, 1.75fr) minmax(280px, .75fr); + gap: 28px; + margin-top: -52px; + padding-bottom: 42px; + align-items: start; +} +.wish-form-card, +.wish-side-card { + border: 1px solid #dde2d9; + border-radius: 16px; + background: #fff; + box-shadow: 0 15px 38px rgba(20,29,18,.13); +} +.wish-form-card { + padding: 30px 34px 34px; +} +.wish-form-head { + padding-bottom: 21px; + border-bottom: 1px solid #e7eae4; +} +.wish-kicker { + display: block; + color: #70a900; + font-size: 11px; + font-weight: 900; + letter-spacing: .09em; + text-transform: uppercase; +} +.wish-form-head h2 { + margin: 5px 0 8px; + font-size: 31px; + line-height: 1.05; + letter-spacing: -.035em; +} +.wish-form-head p { + max-width: 740px; + margin: 0; + color: #626a62; + font-size: 14px; + line-height: 1.55; +} +.wish-alert { + margin-top: 20px; + padding: 13px 15px; + border-radius: 9px; + font-size: 13px; + line-height: 1.45; +} +.wish-alert b { display: block; margin-bottom: 2px; } +.wish-alert-success { border: 1px solid #cde3a4; color: #335200; background: #f1f9e6; } +.wish-alert-error { border: 1px solid #efc0bc; color: #7f241b; background: #fff0ee; } +.wish-form { margin-top: 23px; } +.wish-form-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 17px 19px; +} +.wish-form label > span, +.wish-message > span { + display: block; + margin-bottom: 7px; + color: #2e342e; + font-size: 12px; + font-weight: 820; +} +.wish-form input[type="text"], +.wish-form textarea { + width: 100%; + border: 1px solid #d5dbd1; + border-radius: 8px; + color: #171b17; + background: #fbfcfa; + outline: 0; + transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; +} +.wish-form input[type="text"] { + height: 48px; + padding: 0 13px; +} +.wish-form textarea { + min-height: 132px; + resize: vertical; + padding: 12px 13px; + font: inherit; + line-height: 1.45; +} +.wish-form input:focus, +.wish-form textarea:focus { + border-color: #7eb800; + background: #fff; + box-shadow: 0 0 0 4px rgba(127,189,0,.12); +} +.wish-form input::placeholder, +.wish-form textarea::placeholder { color: #9aa09a; } +.wish-message { display: block; margin-top: 18px; } +.wish-message small { + display: block; + margin-top: 7px; + color: #7a817a; + font-size: 10px; +} +.wish-consent { + display: grid; + grid-template-columns: 19px minmax(0,1fr); + gap: 9px; + align-items: start; + margin-top: 18px; + color: #555d55; + font-size: 11px; + line-height: 1.45; +} +.wish-consent input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: #78b000; } +.wish-consent > span { margin: 0 !important; font-size: inherit !important; font-weight: 500 !important; } +.wish-honeypot { + position: absolute !important; + width: 1px; + height: 1px; + overflow: hidden; + clip-path: inset(100%); +} +.wish-submit { + min-height: 49px; + display: inline-flex; + align-items: center; + justify-content: center; + gap: 10px; + margin-top: 21px; + padding: 0 22px; + border: 0; + border-radius: 8px; + color: #fff; + background: linear-gradient(#91cc17,#70a700); + box-shadow: 0 7px 16px rgba(92,143,0,.24), inset 0 1px rgba(255,255,255,.25); + font-weight: 850; +} +.wish-submit:hover { filter: brightness(1.05); } +.wish-submit:focus-visible { outline: 3px solid rgba(127,189,0,.36); outline-offset: 3px; } +.wish-submit svg { width: 20px; fill: currentColor; } +.wish-side-card { + position: sticky; + top: 24px; + overflow: hidden; + padding: 27px 26px 29px; + color: #fff; + background: + radial-gradient(circle at 80% 10%, rgba(146,207,22,.26), transparent 32%), + linear-gradient(145deg,#101511,#050706 70%); +} +.wish-side-card:after { + content: ""; + position: absolute; + right: -72px; + bottom: -82px; + width: 230px; + height: 230px; + border: 34px solid rgba(127,189,0,.12); + border-radius: 50%; +} +.wish-side-card img { width: 215px; margin: 0 0 20px -7px; position: relative; z-index: 1; } +.wish-side-card > span { color: #9ed32f; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; } +.wish-side-card h2 { position: relative; z-index: 1; margin: 7px 0 12px; font-size: 27px; line-height: 1.08; letter-spacing: -.03em; } +.wish-side-card p { position: relative; z-index: 1; margin: 0; color: #c7cdc7; font-size: 13px; line-height: 1.55; } +.wish-side-card a { position: relative; z-index: 1; display: inline-flex; margin-top: 22px; color: #a8db36; font-weight: 820; } +.wish-wall { + padding: 45px 0 58px; + border-top: 1px solid #e2e7de; + background: #fff; +} +.wish-wall-head { + display: flex; + align-items: end; + justify-content: space-between; + gap: 24px; + margin-bottom: 22px; +} +.wish-wall-head span { color: #72a900; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; } +.wish-wall-head h2 { margin: 4px 0 0; font-size: 28px; letter-spacing: -.03em; } +.wish-wall-head > p { margin: 0; color: #727972; font-size: 12px; } +.wish-list { display: grid; gap: 11px; } +.wish-entry { + display: grid; + grid-template-columns: 50px minmax(0,1fr); + gap: 15px; + padding: 17px 20px; + border: 1px solid #e0e5dc; + border-radius: 11px; + background: linear-gradient(90deg,#fbfdf8,#fff); + box-shadow: 0 3px 11px rgba(25,32,23,.055); +} +.wish-entry-icon { + width: 48px; + height: 48px; + display: grid; + place-items: center; + border-radius: 50%; + color: #fff; + background: linear-gradient(145deg,#93ce1a,#699f00); + font-size: 21px; + font-weight: 900; + box-shadow: 0 5px 12px rgba(101,151,0,.2); +} +.wish-entry-main { min-width: 0; } +.wish-entry header { display: flex; align-items: start; justify-content: space-between; gap: 18px; } +.wish-entry header strong { display: inline; font-size: 14px; } +.wish-entry header div span { margin-left: 6px; color: #6b726b; font-size: 11px; } +.wish-entry time { color: #838983; font-size: 10px; white-space: nowrap; } +.wish-song { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 0; color: #303630; font-size: 12px; font-weight: 750; } +.wish-song span { padding: 2px 6px; border-radius: 4px; color: #608f00; background: #edf6dd; font-size: 9px; font-weight: 900; text-transform: uppercase; } +.wish-text { margin: 7px 0 0; color: #565d56; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; } +.wish-empty { padding: 45px 20px; border: 1px dashed #cfd8c8; border-radius: 12px; text-align: center; background: #f9fbf7; } +.wish-empty span { color: #7fbd00; font-size: 36px; } +.wish-empty h3 { margin: 7px 0 4px; font-size: 19px; } +.wish-empty p { margin: 0; color: #737a73; } +.wish-pagination { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 24px; } +.wish-pagination a, +.wish-pagination > span { + min-width: 38px; + height: 38px; + display: grid; + place-items: center; + border: 1px solid #d9ded5; + border-radius: 7px; + color: #3d443d; + background: #fff; + font-size: 12px; + font-weight: 800; +} +.wish-pagination a:hover { border-color: #8cbe23; color: #5c8d00; } +.wish-pagination .is-current { color: #fff; border-color: #76ae00; background: #78b000; } +.wish-pagination .is-disabled { color: #b6bbb6; background: #f2f4f0; } +.wish-page-arrow { font-size: 17px !important; } + +@media (min-width:1500px) { + .section-heading { min-height: 35px; margin-bottom: 9px; } + .footer-socials a { width: 39px; height: 39px; } + .footer-socials svg { width: 22px; height: 22px; } + .footer-bottom { font-size: 12px; } + .wish-hero { min-height: 395px; } + .wish-form-card { padding: 38px 43px 42px; } + .wish-form-head h2 { font-size: 38px; } + .wish-form-head p { font-size: 16px; } + .wish-form label > span, .wish-message > span { font-size: 14px; } + .wish-form input[type="text"] { height: 55px; font-size: 15px; } + .wish-form textarea { min-height: 150px; font-size: 15px; } + .wish-side-card { padding: 34px 31px 36px; } + .wish-side-card h2 { font-size: 33px; } + .wish-side-card p { font-size: 15px; } + .wish-wall-head h2 { font-size: 34px; } + .wish-entry { padding: 21px 25px; } + .wish-entry header strong { font-size: 16px; } + .wish-entry header div span, .wish-song { font-size: 13px; } + .wish-text { font-size: 15px; } +} + +@media (max-width: 900px) { + .section-heading { min-height: 30px; margin-bottom: 7px; } + .footer-bottom { flex-direction: column; align-items: flex-start; gap: 5px; } + .wish-hero { min-height: 310px; } + .wish-layout { grid-template-columns: 1fr; margin-top: -42px; } + .wish-side-card { position: relative; top: auto; } +} + +@media (max-width: 650px) { + .wish-hero { min-height: 340px; } + .wish-hero .page-shell { padding-bottom: 55px; } + .wish-layout { width: min(100% - 24px,var(--page)); gap: 16px; } + .wish-form-card { padding: 23px 19px 25px; border-radius: 12px; } + .wish-form-head h2 { font-size: 27px; } + .wish-form-grid { grid-template-columns: 1fr; gap: 14px; } + .wish-submit { width: 100%; } + .wish-side-card { padding: 24px 21px 27px; } + .wish-wall { padding: 37px 0 45px; } + .wish-wall-head { align-items: start; flex-direction: column; gap: 6px; } + .wish-wall-head h2 { font-size: 25px; } + .wish-entry { grid-template-columns: 40px minmax(0,1fr); gap: 11px; padding: 14px; } + .wish-entry-icon { width: 40px; height: 40px; font-size: 18px; } + .wish-entry header { flex-direction: column; gap: 3px; } + .wish-entry header div span { display: block; margin: 1px 0 0; } + .wish-pagination { flex-wrap: wrap; } +} + +/* Team page */ +.team-page{background:linear-gradient(180deg,#0b0e0b 0,#111711 460px,#f4f6f1 460px,#f4f6f1 100%)} +.team-hero{padding:48px 0 60px;color:#fff;background:radial-gradient(circle at 84% 4%,rgba(125,190,0,.2),transparent 32%),linear-gradient(145deg,#101510,#050705)} +.team-hero-inner{display:grid;gap:26px}.team-hero-copy{max-width:760px}.team-kicker,.team-section-head>span,.team-modal-kicker{color:#9bd32b;font-size:12px;font-weight:900;letter-spacing:.1em;text-transform:uppercase}.team-hero h1{margin:8px 0 12px;font-size:clamp(42px,6vw,76px);line-height:.96;letter-spacing:-.05em}.team-hero-copy p{max-width:660px;margin:0;color:#ccd3cc;font-size:clamp(17px,2vw,22px);line-height:1.5}.team-group-photo{overflow:hidden;width:min(100%,980px);margin:0 auto;border:1px solid rgba(151,211,42,.35);border-radius:28px;background:#101410;box-shadow:0 28px 70px rgba(0,0,0,.42),0 0 0 7px rgba(119,177,0,.08)}.team-group-photo img{display:block;width:100%;height:clamp(300px,36vw,460px);object-fit:cover;object-position:center 42%}.team-group-photo figcaption{padding:13px 18px;color:#aeb7ae;background:#0c100c;font-size:12px} +.team-members{padding-top:66px;padding-bottom:86px}.team-section-head{max-width:680px;margin-bottom:32px}.team-section-head h2{margin:7px 0 9px;color:#151a15;font-size:clamp(30px,4vw,46px);letter-spacing:-.04em}.team-section-head p{margin:0;color:#687068}.team-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,280px));gap:26px}.team-card{display:flex;flex-direction:column;align-items:center;padding:29px 22px 24px;border:1px solid #dce3d8;border-radius:22px;color:#171c17;background:linear-gradient(180deg,#fff,#f8faf6);box-shadow:0 12px 30px rgba(28,39,24,.08);cursor:pointer;transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease}.team-card:hover{transform:translateY(-5px);border-color:#8fc429;box-shadow:0 18px 38px rgba(65,99,17,.16)}.team-card:focus-visible{outline:3px solid rgba(126,189,0,.4);outline-offset:4px}.team-avatar{width:164px;height:164px;padding:6px;border-radius:50%;background:linear-gradient(145deg,#b8eb4b,#6da400);box-shadow:0 12px 26px rgba(93,144,0,.25)}.team-avatar img,.team-modal-avatar img{width:100%;height:100%;display:block;object-fit:cover;border-radius:50%;background:#dfe5dc}.team-card-name{margin-top:19px;font-size:21px;font-weight:900}.team-card-role{margin-top:4px;color:#679600;font-size:13px;font-weight:800}.team-card-more{margin-top:17px;color:#4c554c;font-size:12px;font-weight:800}.team-card-more b{color:#75aa00;font-size:16px} +.team-modal[hidden]{display:none}.team-modal{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px}.team-modal-backdrop{position:absolute;inset:0;background:rgba(3,6,3,.78);backdrop-filter:blur(8px)}.team-modal-dialog{position:relative;width:min(620px,100%);max-height:calc(100vh - 40px);overflow:auto;padding:34px;border:1px solid rgba(151,211,42,.38);border-radius:26px;color:#eef3ed;background:radial-gradient(circle at 90% 0,rgba(139,204,15,.2),transparent 34%),linear-gradient(145deg,#151b15,#080b08);box-shadow:0 35px 90px rgba(0,0,0,.55);outline:0}.team-modal-close{position:absolute;top:16px;right:17px;width:40px;height:40px;border:1px solid rgba(255,255,255,.14);border-radius:50%;color:#fff;background:rgba(255,255,255,.06);font-size:27px;line-height:1;cursor:pointer}.team-modal-profile{display:flex;align-items:center;gap:22px;padding-right:44px}.team-modal-avatar{width:128px;height:128px;flex:0 0 auto;padding:5px;border-radius:50%;background:linear-gradient(145deg,#b8eb4b,#6da400)}.team-modal-profile h2{margin:5px 0 3px;font-size:34px;letter-spacing:-.04em}.team-modal-profile p{margin:0;color:#a9d64c;font-weight:800}.team-modal-bio{margin:27px 0 24px;color:#ccd3cc;line-height:1.65}.team-facts{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:0}.team-facts div{padding:15px;border:1px solid rgba(255,255,255,.09);border-radius:13px;background:rgba(255,255,255,.04)}.team-facts dt{color:#8ea08e;font-size:10px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.team-facts dd{margin:6px 0 0;color:#fff;font-size:13px;font-weight:800}.team-modal-open{overflow:hidden} +@media(max-width:650px){.team-page{background:#f4f6f1}.team-hero{padding:34px 0 42px}.team-group-photo{border-radius:18px}.team-group-photo img{height:260px;min-height:0;object-position:center 42%;}.team-members{padding-top:46px;padding-bottom:60px}.team-grid{grid-template-columns:1fr}.team-card{width:100%}.team-modal-dialog{padding:27px 20px 23px;border-radius:20px}.team-modal-profile{align-items:flex-start;flex-direction:column;gap:14px}.team-modal-avatar{width:112px;height:112px}.team-modal-profile h2{font-size:29px}.team-facts{grid-template-columns:1fr}} + +/* Teamseite v18 – Aufbau analog zu /ueber-landwelle */ +.team-page-v18{background:#f4f6f1}.team-content-grid{align-items:start}.team-intro-card>p,.team-members-block>p{max-width:760px}.team-group-photo-v18{overflow:hidden;margin:24px 0 0;border:1px solid var(--line);border-radius:12px;background:#111;box-shadow:0 3px 14px rgba(20,24,20,.1)}.team-group-photo-v18 img{display:block;width:100%;height:auto;max-height:430px;object-fit:cover;object-position:center 42%}.team-group-photo-v18 figcaption{padding:11px 15px;color:#657065;background:#f7f9f5;border-top:1px solid var(--line);font-size:12px}.team-section-kicker{display:block;margin-bottom:6px;color:#699b00;font-size:12px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.team-grid-v18{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:24px}.team-card-v18{display:flex;align-items:center;gap:17px;width:100%;padding:17px;border:1px solid #dce3d8;border-radius:12px;color:#171c17;text-align:left;background:#f9fbf7;cursor:pointer;transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease}.team-card-v18:hover{transform:translateY(-2px);border-color:#8fc429;box-shadow:0 9px 22px rgba(54,78,32,.12)}.team-card-v18:focus-visible{outline:3px solid rgba(126,189,0,.35);outline-offset:3px}.team-avatar-v18{width:92px;height:92px;flex:0 0 auto;padding:4px;border-radius:50%;background:linear-gradient(145deg,#b8eb4b,#6da400);box-shadow:0 7px 17px rgba(93,144,0,.2)}.team-avatar-v18 img{display:block;width:100%;height:100%;object-fit:cover;border-radius:50%;background:#dfe5dc}.team-card-copy{display:flex;min-width:0;flex-direction:column}.team-card-copy strong{font-size:18px}.team-card-copy small{margin-top:3px;color:#699b00;font-size:12px;font-weight:800}.team-card-copy em{margin-top:12px;color:#535b53;font-size:11px;font-style:normal;font-weight:800}.team-card-copy em b{color:#75aa00;font-size:15px}.team-side-v18 p{margin-bottom:18px} +@media(max-width:1100px){.team-grid-v18{grid-template-columns:1fr}} +@media(max-width:650px){.team-group-photo-v18{margin-top:18px}.team-group-photo-v18 img{max-height:300px}.team-card-v18{padding:14px}.team-avatar-v18{width:78px;height:78px}.team-card-copy strong{font-size:17px}} + +/* Radio-Dropdown und Radio-Service-Seiten v22 */ +.nav-dropdown{position:relative;display:flex;align-items:center;height:72px} +.nav-dropdown-toggle{appearance:none;border:0;background:transparent;color:#f2f4f1;font:inherit;font-weight:650;font-size:13px;cursor:pointer;padding:10px 16px 10px 0;position:relative;white-space:nowrap} +.nav-dropdown-toggle::after{content:"";position:absolute;right:0;top:50%;width:6px;height:6px;border-right:2px solid #9fd33b;border-bottom:2px solid #9fd33b;transform:translateY(-70%) rotate(45deg);transition:transform .2s ease} +.nav-dropdown.is-open .nav-dropdown-toggle::after{transform:translateY(-20%) rotate(225deg)} +.nav-dropdown-menu{position:absolute;top:calc(100% - 8px);left:-18px;min-width:220px;padding:10px;background:#111512;border:1px solid rgba(159,211,59,.28);border-radius:14px;box-shadow:0 18px 48px rgba(0,0,0,.35);opacity:0;visibility:hidden;transform:translateY(-6px);transition:.18s ease;z-index:50} +.nav-dropdown:hover .nav-dropdown-menu,.nav-dropdown:focus-within .nav-dropdown-menu,.nav-dropdown.is-open .nav-dropdown-menu{opacity:1;visibility:visible;transform:translateY(0)} +.main-nav .nav-dropdown-menu a{display:flex;align-items:center;gap:10px;padding:11px 12px;border-radius:9px;font-size:14px;color:#f3f6f2} +.main-nav .nav-dropdown-menu a:hover{background:rgba(159,211,59,.11);color:#b7e74a} +.main-nav .nav-dropdown-menu a::before{content:"";width:7px;height:7px;border-radius:50%;background:#80bd22;box-shadow:0 0 0 4px rgba(128,189,34,.12)} +.radio-service-main{background:#f4f6f2;padding:52px 0 72px} +.radio-service-grid{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:28px;align-items:start} +.radio-service-stack{display:grid;gap:22px} +.radio-card{background:#fff;border:1px solid #dfe5dc;border-radius:20px;padding:28px;box-shadow:0 12px 34px rgba(18,33,19,.07)} +.radio-card h2{margin:0 0 10px;font-size:25px;color:#182019}.radio-card p{margin:0;color:#59635a;line-height:1.72} +.download-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-top:24px} +.download-card{display:flex;flex-direction:column;min-height:260px;padding:24px;border-radius:17px;background:linear-gradient(145deg,#f7faf5,#edf3e9);border:1px solid #dce7d5} +.download-card .platform-icon{width:54px;height:54px;display:grid;place-items:center;border-radius:15px;background:#121713;color:#a5d83d;font-weight:800;font-size:19px;margin-bottom:18px} +.download-card h3{margin:0 0 8px;font-size:20px;color:#182019}.download-card p{font-size:14px;line-height:1.6;flex:1} +.download-card a,.radio-action{display:inline-flex;justify-content:center;align-items:center;gap:8px;margin-top:20px;padding:12px 16px;border-radius:10px;background:#69ae20;color:#fff;font-weight:750;box-shadow:0 8px 20px rgba(88,154,25,.22)} +.download-card a:hover,.radio-action:hover{background:#579719;color:#fff} +.service-list{display:grid;gap:14px;margin-top:22px}.service-item{display:grid;grid-template-columns:52px 1fr;gap:16px;align-items:start;padding:18px;border-radius:15px;background:#f6f8f4;border:1px solid #e1e7dd} +.service-item i{display:grid;place-items:center;width:48px;height:48px;border-radius:50%;background:#162019;color:#a5d83d;font-style:normal;font-weight:800}.service-item h3{margin:2px 0 5px;font-size:18px}.service-item p{font-size:14px;line-height:1.6} +.alexa-quote{margin-top:18px;padding:20px 22px;border-left:5px solid #78b82a;border-radius:0 14px 14px 0;background:#121713;color:#fff;font-size:20px;font-weight:750} +.radio-side{position:sticky;top:96px;padding:26px;border-radius:20px;background:linear-gradient(150deg,#101510,#1d271c);color:#fff;box-shadow:0 18px 38px rgba(13,24,13,.2)}.radio-side img{width:180px;max-width:100%;margin-bottom:20px}.radio-side strong{display:block;font-size:22px;margin-bottom:10px}.radio-side p{color:#ccd4ca;line-height:1.65}.radio-side a{display:inline-flex;margin-top:16px;color:#b2e345;font-weight:750} +.app-feature-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px;margin-top:22px}.app-feature{padding:18px;border-radius:14px;background:#f6f8f4;border:1px solid #e1e7dd}.app-feature strong{display:block;color:#1a241a;margin-bottom:5px}.app-feature span{font-size:14px;color:#647064;line-height:1.5} +.availability{display:flex;gap:12px;flex-wrap:wrap;margin-top:20px}.availability span{padding:9px 12px;border-radius:999px;background:#e9f4dc;color:#3d6e10;font-weight:700;font-size:13px}.availability .planned{background:#eef0ed;color:#687068} +@media(max-width:980px){.radio-service-grid{grid-template-columns:1fr}.radio-side{position:static}.download-grid{grid-template-columns:1fr}.nav-dropdown{height:auto;display:block;width:100%}.nav-dropdown-toggle{width:100%;text-align:left;font-size:15px;padding:0 22px 0 0}.nav-dropdown-menu{position:static;min-width:0;width:100%;margin-top:10px;padding:6px 0 0 14px;background:transparent;border:0;box-shadow:none;display:none;opacity:1;visibility:visible;transform:none}.nav-dropdown.is-open .nav-dropdown-menu{display:block}.nav-dropdown:hover .nav-dropdown-menu:not(:focus-within){display:none}.nav-dropdown.is-open:hover .nav-dropdown-menu{display:block}.main-nav .nav-dropdown-menu a{padding:8px 10px}} +@media(max-width:620px){.radio-service-main{padding-top:30px}.radio-card{padding:21px}.app-feature-grid{grid-template-columns:1fr}.alexa-quote{font-size:17px}.service-item{grid-template-columns:42px 1fr;padding:15px}.service-item i{width:40px;height:40px}} +/* v41 legal pages */ +.content-page-body .content-block p{white-space:pre-line} +.content-page-body .content-block h2{scroll-margin-top:110px} +.content-page-body .content-block{line-height:1.72} +.content-page-body .content-block a{overflow-wrap:anywhere} +.forum-page{background:#f3f5f1;min-height:70vh}.forum-hero{background:linear-gradient(130deg,#0a0d0b,#172016);padding:70px 0;color:#fff}.forum-shell{padding-top:38px;padding-bottom:70px}.forum-toolbar{display:flex;justify-content:space-between;align-items:center;gap:20px;background:#fff;border:1px solid #dfe5dc;border-radius:18px;padding:22px 26px;margin-bottom:24px;box-shadow:0 8px 24px rgba(20,30,20,.07)}.forum-toolbar div{display:flex;flex-direction:column}.forum-toolbar span{color:#687068}.forum-primary{border:0;border-radius:999px;background:#74b82a;color:#fff;padding:13px 21px;font-weight:850;text-decoration:none;cursor:pointer}.forum-category-list,.forum-topic-list{display:grid;gap:13px}.forum-category,.forum-topic-row{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:18px;background:#fff;border:1px solid #dfe5dc;border-radius:16px;padding:21px 24px;color:#172016;text-decoration:none;box-shadow:0 4px 16px rgba(20,30,20,.05);transition:.2s}.forum-category:hover,.forum-topic-row:hover{transform:translateY(-2px);border-color:#9ccb5e}.forum-icon{width:54px;height:54px;border-radius:15px;display:grid;place-items:center;background:#eef6e5;font-size:27px}.forum-category h2,.forum-topic-row h3{margin:0 0 6px}.forum-category p{margin:0 0 7px;color:#596159}.forum-category small,.forum-topic-row small{color:#7b837b}.forum-latest{margin-top:36px}.forum-topic-row{grid-template-columns:1fr auto}.forum-topic-row span{color:#6d9f25;font-size:12px;text-transform:uppercase;font-weight:850}.forum-topic-row em{background:#eef6e5;color:#61941f;border-radius:999px;padding:7px 11px;font-style:normal;font-size:12px}.forum-empty,.forum-alert{background:#fff;border:1px dashed #cbd3c8;border-radius:15px;padding:25px;color:#616961}.forum-alert{border-style:solid;border-color:#e0b45a;background:#fff8e8}.forum-breadcrumb{display:flex;gap:9px;margin-bottom:20px}.forum-breadcrumb a{color:#659c21}.forum-topic-shell{max-width:980px}.forum-post,.forum-reply,.forum-form-card,.forum-login-callout{background:#fff;border:1px solid #dfe5dc;border-radius:18px;padding:26px;margin-bottom:18px;box-shadow:0 5px 18px rgba(20,30,20,.05)}.forum-post header{display:flex;justify-content:space-between;gap:20px;border-bottom:1px solid #edf0eb;padding-bottom:14px;margin-bottom:20px}.forum-post h1{font-size:34px;margin:5px 0}.forum-post header span{color:#6d9f25;font-weight:800;text-transform:uppercase;font-size:12px}.forum-post-body{white-space:pre-wrap;line-height:1.75}.forum-reply textarea,.forum-form-card textarea,.forum-form-card input,.forum-form-card select{width:100%;border:1px solid #cad2c7;border-radius:10px;padding:12px;font:inherit}.forum-form-card form,.forum-reply{display:grid;gap:16px}.forum-form-card label{display:grid;gap:7px}.account-button{border:1px solid rgba(255,255,255,.28);background:transparent;color:#fff;border-radius:999px;padding:11px 16px;font-weight:800;cursor:pointer;white-space:nowrap}.auth-modal[hidden]{display:none}.auth-modal{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px}.auth-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.72);backdrop-filter:blur(7px)}.auth-dialog{position:relative;width:min(100%,480px);background:#101511;color:#fff;border:1px solid rgba(151,216,75,.28);border-radius:24px;padding:28px;box-shadow:0 30px 90px rgba(0,0,0,.45)}.auth-dialog>img{width:180px}.auth-dialog h2{font-size:30px;margin:18px 0 6px}.auth-dialog>p{color:#b7c0b9}.auth-close{position:absolute;right:18px;top:15px;border:0;background:transparent;color:#fff;font-size:30px;cursor:pointer}.auth-tabs{display:grid;grid-template-columns:1fr 1fr;background:#080b09;padding:5px;border-radius:12px;margin:22px 0}.auth-tabs button{border:0;background:transparent;color:#aab3ac;padding:10px;border-radius:9px;font-weight:800}.auth-tabs button.is-active{background:#74b82a;color:#fff}.auth-form{display:none;gap:14px}.auth-form.is-active{display:grid}.auth-form label{display:grid;gap:6px}.auth-form input{width:100%;border:1px solid #3c463e;background:#090c0a;color:#fff;border-radius:10px;padding:12px}.auth-form button{border:0;border-radius:10px;background:#74b82a;color:#fff;padding:13px;font-weight:850}.auth-consent{grid-template-columns:auto 1fr!important;align-items:start}.auth-consent input{width:auto}.auth-consent a{color:#9bd34e}@media(max-width:900px){.account-button{font-size:0;width:43px;height:40px;padding:0}.account-button:after{content:'👤';font-size:17px}.forum-toolbar{align-items:flex-start;flex-direction:column}.forum-category{grid-template-columns:auto 1fr}.forum-category>b{display:none}} +.forum-actions{display:flex;align-items:center;gap:9px}.forum-actions form{margin:0}.forum-secondary{border:1px solid #ccd4c9;background:#fff;color:#364036;border-radius:999px;padding:12px 17px;font-weight:800;cursor:pointer} +.account-dropdown{position:relative;flex:0 0 auto}.account-button-user{display:inline-flex;align-items:center;gap:9px;padding:7px 13px 7px 8px}.account-avatar{width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:#79b92d;color:#fff;font-size:13px;font-weight:900}.account-name{max-width:130px;overflow:hidden;text-overflow:ellipsis}.account-caret{font-size:13px;color:#a8d866}.account-menu{position:absolute;z-index:200;right:0;top:calc(100% + 10px);width:230px;padding:8px;background:#101511;border:1px solid rgba(151,216,75,.28);border-radius:14px;box-shadow:0 20px 55px rgba(0,0,0,.38);color:#fff}.account-menu[hidden]{display:none}.account-menu-head{display:grid;gap:2px;padding:10px 11px 12px;border-bottom:1px solid rgba(255,255,255,.09);margin-bottom:5px}.account-menu-head strong{font-size:14px}.account-menu-head span{font-size:12px;color:#9da79f}.account-menu a,.account-menu form button{display:block;width:100%;padding:10px 11px;border:0;border-radius:9px;background:transparent;color:#eef4ea;text-align:left;font:inherit;font-size:13px;font-weight:700;text-decoration:none;cursor:pointer}.account-menu a:hover,.account-menu form button:hover{background:rgba(121,185,45,.15);color:#a8dc57}.account-menu form{margin:4px 0 0;padding-top:4px;border-top:1px solid rgba(255,255,255,.08)} +@media(max-width:700px){.account-button-user{width:auto;min-width:43px;padding:5px}.account-button-user:after{content:none}.account-name,.account-caret{display:none}.account-menu{position:fixed;right:16px;top:76px}} + +/* Playlist v1.1.5 */ +.playlist-hero{background:linear-gradient(90deg,rgba(5,9,6,.96),rgba(5,9,6,.72)),radial-gradient(circle at 78% 40%,rgba(132,207,36,.24),transparent 36%);} +.playlist-page{padding-top:44px;padding-bottom:70px}.playlist-heading{display:flex;align-items:end;justify-content:space-between;gap:24px;margin-bottom:22px}.playlist-heading h2{margin:.2rem 0 0}.playlist-heading>strong{color:#73b91f;font-size:.95rem}.playlist-list{border:1px solid #dfe5dc;border-radius:16px;overflow:hidden;background:#fff}.playlist-entry{display:grid;grid-template-columns:92px 72px minmax(0,1fr) auto;align-items:center;gap:18px;padding:14px 18px;border-bottom:1px solid #e5e9e2}.playlist-entry:last-child{border-bottom:0}.playlist-entry time{display:flex;flex-direction:column}.playlist-entry time strong{font-size:1.15rem;color:#152014}.playlist-entry time span{font-size:.75rem;color:#778074}.playlist-entry img{width:64px;height:64px;border-radius:10px;object-fit:cover;background:#edf1eb}.playlist-entry div{min-width:0}.playlist-entry div>span{display:block;color:#658f25;font-size:.82rem;font-weight:800;text-transform:uppercase;letter-spacing:.05em}.playlist-entry h3{margin:3px 0 1px;font-size:1.08rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.playlist-entry small{color:#7d857b}.playlist-entry>a{border:1px solid #76ba25;border-radius:999px;padding:8px 13px;color:#4c7e12;font-weight:800;text-decoration:none}.playlist-entry>a:hover{background:#76ba25;color:#fff}.playlist-pagination{display:flex;justify-content:space-between;align-items:center;margin-top:24px;gap:20px}.playlist-pagination div{display:flex;gap:10px}.playlist-pagination a{background:#102014;color:#fff;border-radius:9px;padding:10px 14px;text-decoration:none}@media(max-width:700px){.playlist-heading{align-items:flex-start;flex-direction:column}.playlist-entry{grid-template-columns:62px 54px minmax(0,1fr);gap:11px;padding:12px}.playlist-entry img{width:50px;height:50px}.playlist-entry>a{grid-column:3;justify-self:start;padding:6px 10px}.playlist-pagination{align-items:flex-start;flex-direction:column}} + +/* Playlist v1.1.8 */ +.playlist-view{background:#f4f6f1}.playlist-hero{min-height:355px;display:flex;align-items:center;background:linear-gradient(90deg,rgba(5,9,6,.96),rgba(5,9,6,.68)),radial-gradient(circle at 78% 40%,rgba(132,207,36,.26),transparent 36%)} +.playlist-layout{position:relative;z-index:2;display:grid;grid-template-columns:minmax(0,1.65fr) minmax(290px,.75fr);gap:24px;margin-top:-54px;padding-bottom:45px} +.playlist-search-card,.playlist-side-card{border-radius:16px;box-shadow:0 13px 36px rgba(24,34,22,.11)}.playlist-search-card{padding:34px 38px 38px;border:1px solid #e1e6dd;background:#fff}.playlist-search-head h2{margin:5px 0 9px;font-size:34px;letter-spacing:-.035em}.playlist-search-head p{max-width:700px;margin:0;color:#697169;line-height:1.55} +.playlist-search-form{display:grid;gap:18px;margin-top:25px}.playlist-search-form label{display:grid;gap:7px}.playlist-search-form label>span{color:#323a32;font-size:13px;font-weight:800}.playlist-search-form input{width:100%;height:50px;padding:0 14px;border:1px solid #ccd4c8;border-radius:8px;background:#fbfcfa;color:#182018;font:inherit}.playlist-search-form input:focus{outline:3px solid rgba(127,189,0,.2);border-color:#78ad17}.playlist-filter-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:13px}.playlist-search-actions{display:flex;align-items:center;gap:18px}.playlist-search-actions .wish-submit{margin:0}.playlist-search-actions>a{color:#648f20;font-size:13px;font-weight:800}.playlist-side-card{position:relative;top:auto} +.playlist-results{padding:43px 0 65px;border-top:1px solid #e0e5dc;background:#fff}.playlist-results-head{margin-bottom:24px}.playlist-days{display:grid;gap:28px}.playlist-day{display:grid;gap:10px}.playlist-day-head{display:flex;align-items:end;justify-content:space-between;gap:20px;padding:0 4px}.playlist-day-head span{color:#6d9f25;font-size:11px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.playlist-day-head h3{margin:2px 0 0;font-size:23px;letter-spacing:-.025em}.playlist-day-head>strong{color:#7b8379;font-size:12px}.playlist-list{border:1px solid #dfe5dc;border-radius:13px;overflow:hidden;background:#fff;box-shadow:0 4px 14px rgba(26,35,24,.045)}.playlist-entry{display:grid;grid-template-columns:76px 64px minmax(0,1fr) auto;align-items:center;gap:16px;padding:13px 17px;border-bottom:1px solid #e6eae3}.playlist-entry:last-child{border-bottom:0}.playlist-entry time{display:flex;flex-direction:column}.playlist-entry time strong{color:#162016;font-size:18px}.playlist-entry time span{color:#838a81;font-size:10px;text-transform:uppercase}.playlist-entry img{width:58px;height:58px;border-radius:9px;object-fit:cover;background:#edf1eb}.playlist-entry-copy{min-width:0}.playlist-entry-copy>span{display:block;color:#658f25;font-size:11px;font-weight:900;letter-spacing:.05em;text-transform:uppercase}.playlist-entry-copy h3{margin:3px 0 1px;font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.playlist-entry-copy small{display:block;color:#7d857b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.playlist-entry>a{padding:8px 13px;border:1px solid #76ba25;border-radius:999px;color:#4c7e12;font-size:12px;font-weight:850;text-decoration:none}.playlist-entry>a:hover{color:#fff;background:#76ba25}.playlist-results .wish-empty a{display:inline-flex;margin-top:14px;color:#5f8f18;font-weight:850} +@media(max-width:900px){.playlist-layout{grid-template-columns:1fr;margin-top:-40px}.playlist-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}} +@media(max-width:650px){.playlist-hero{min-height:330px}.playlist-layout{width:min(100% - 24px,var(--page));gap:16px}.playlist-search-card{padding:23px 19px 26px}.playlist-search-head h2{font-size:27px}.playlist-filter-grid{grid-template-columns:1fr 1fr}.playlist-search-actions{align-items:stretch;flex-direction:column}.playlist-search-actions .wish-submit{width:100%}.playlist-entry{grid-template-columns:52px 50px minmax(0,1fr);gap:10px;padding:11px}.playlist-entry img{width:46px;height:46px}.playlist-entry>a{grid-column:3;justify-self:start;padding:6px 10px}.playlist-day-head{align-items:start;flex-direction:column;gap:3px}.playlist-results-head{align-items:start}.playlist-filter-grid label>span{font-size:12px}} + + +/* Playlist Hero v1.1.9 */ +.playlist-image-hero{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:300px;overflow:hidden;background:#070a07;border-bottom:3px solid #82c30f} +.playlist-image-hero img{display:block;width:100%;height:100%;margin:0 auto;object-fit:cover;object-position:center center} +.playlist-hero-accessible{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0} +.playlist-image-hero+.playlist-layout{margin-top:-18px} +@media(max-width:1100px){.playlist-image-hero{height:250px}} +@media(max-width:760px){.playlist-image-hero{height:210px}.playlist-image-hero+.playlist-layout{margin-top:-12px}} +@media(max-width:480px){.playlist-image-hero{height:185px}} + +.home-stories-empty{padding:24px;border:1px dashed #cbd9c5;border-radius:18px;background:#f6f9f3}.home-stories-empty span{display:block;color:#6c9e28;font-size:.72rem;font-weight:900;letter-spacing:.12em;text-transform:uppercase}.home-stories-empty strong{display:block;margin:7px 0 5px;font-size:1.1rem;color:#273625}.home-stories-empty p{margin:0 0 12px;color:#667364}.home-stories-empty a{color:#426f1c;font-weight:800;text-decoration:none} diff --git a/web/assets/team-ai-v1.css b/web/assets/team-ai-v1.css new file mode 100644 index 0000000..6172ec1 --- /dev/null +++ b/web/assets/team-ai-v1.css @@ -0,0 +1,3 @@ +/* Landwelle v1.5.25 – öffentliche KI-Teamkennzeichnung und Bildwasserzeichen */ +.team-avatar-v18,.team-modal-avatar{position:relative;overflow:hidden}.public-ai-watermark{position:absolute;right:4px;bottom:4px;z-index:3;display:inline-flex;max-width:calc(100% - 8px);padding:4px 6px;border:1px solid rgba(255,255,255,.76);border-radius:6px;color:#fff;background:rgba(10,16,11,.9);box-shadow:0 3px 10px rgba(0,0,0,.32);font-size:8px;font-weight:900;line-height:1.15;text-align:center;text-shadow:0 1px 2px #000}.team-modal-avatar .public-ai-watermark{right:6px;bottom:6px;padding:5px 8px;font-size:10px}.team-public-ai-badge{display:inline-flex;width:max-content;margin-top:7px;padding:5px 8px;border-radius:999px;color:#fff;background:#5c3d73;font-size:10px;font-weight:900;letter-spacing:.03em}.team-ai-disclosure{margin:18px 0;padding:16px 18px;border:1px solid #d8c8e4;border-radius:12px;background:#faf7fd}.team-ai-disclosure strong{display:block;color:#4d3263}.team-ai-disclosure p{margin:7px 0;color:#54475d}.team-ai-disclosure a{color:#5f3d78;font-size:12px;font-weight:850;text-decoration:none}.team-ai-disclosure a:hover{text-decoration:underline} +@media(max-width:650px){.public-ai-watermark{font-size:7px}.team-modal-avatar .public-ai-watermark{font-size:9px}} diff --git a/web/assets/team-gesamt-v16.png b/web/assets/team-gesamt-v16.png new file mode 100644 index 0000000..f87cb86 Binary files /dev/null and b/web/assets/team-gesamt-v16.png differ diff --git a/web/assets/team-v16.js b/web/assets/team-v16.js new file mode 100644 index 0000000..a502e09 --- /dev/null +++ b/web/assets/team-v16.js @@ -0,0 +1,32 @@ +(() => { + 'use strict'; + let activeModal = null; + let previousFocus = null; + + const closeModal = () => { + if (!activeModal) return; + activeModal.hidden = true; + document.body.classList.remove('team-modal-open'); + activeModal = null; + if (previousFocus) previousFocus.focus(); + }; + + document.addEventListener('click', (event) => { + const opener = event.target.closest('[data-team-open]'); + if (opener) { + const modal = document.querySelector(`[data-team-modal="${opener.dataset.teamOpen}"]`); + if (!modal) return; + previousFocus = opener; + activeModal = modal; + modal.hidden = false; + document.body.classList.add('team-modal-open'); + modal.querySelector('.team-modal-dialog')?.focus(); + return; + } + if (event.target.closest('[data-team-close]')) closeModal(); + }); + + document.addEventListener('keydown', (event) => { + if (event.key === 'Escape') closeModal(); + }); +})(); diff --git a/web/assets/tip-radtour.jpg b/web/assets/tip-radtour.jpg new file mode 100644 index 0000000..86ca88d Binary files /dev/null and b/web/assets/tip-radtour.jpg differ diff --git a/web/assets/traffic-hero-v1.png b/web/assets/traffic-hero-v1.png new file mode 100644 index 0000000..b9c57d7 Binary files /dev/null and b/web/assets/traffic-hero-v1.png differ diff --git a/web/assets/traffic-v14.js b/web/assets/traffic-v14.js new file mode 100644 index 0000000..b4acdde --- /dev/null +++ b/web/assets/traffic-v14.js @@ -0,0 +1,87 @@ +(() => { + 'use strict'; + const root = document.querySelector('[data-traffic-page]'); + if (!root) return; + const trafficList = root.querySelector('[data-traffic-list]'); + const cameraList = root.querySelector('[data-camera-list]'); + const status = root.querySelector('[data-traffic-status]'); + const counts = root.querySelector('[data-traffic-counts]'); + const refresh = root.querySelector('[data-traffic-refresh]'); + const tabs = Array.from(root.querySelectorAll('[data-traffic-tab]')); + const panels = Array.from(root.querySelectorAll('[data-traffic-panel]')); + let timer = 0; + + const text = (value, fallback = '–') => String(value || fallback); + const createItem = (item, camera = false) => { + const article = document.createElement('article'); + article.className = `traffic-item ${camera ? 'is-camera' : ''}`; + const badge = document.createElement('span'); + badge.className = 'traffic-kind'; + badge.textContent = camera ? 'Blitzer' : text(item.kind, 'Verkehr'); + const body = document.createElement('div'); + const title = document.createElement('h3'); + title.textContent = camera ? text(item.title) : `${text(item.road, '')} ${text(item.title)}`.trim(); + const detail = document.createElement('p'); + detail.textContent = text(camera ? item.description : (item.direction || item.description), 'Keine weiteren Angaben'); + const meta = document.createElement('small'); + const dateValue = item.published_at || item.updated_at; + const date = dateValue ? new Date(dateValue) : new Date(); + const time = Number.isNaN(date.getTime()) ? '' : date.toLocaleString('de-DE', { day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' }); + meta.textContent = `${camera ? text(item.region, 'Niedersachsen') : text(item.source_name, 'Verkehrsdienst')} · ${time}`; + body.append(title, detail, meta); + const source = document.createElement('a'); + source.href = item.source_url || '#'; + source.target = '_blank'; + source.rel = 'noopener noreferrer'; + source.textContent = 'Quelle ↗'; + article.append(badge, body, source); + return article; + }; + + const render = (container, items, camera) => { + container.replaceChildren(); + if (!items.length) { + const empty = document.createElement('div'); + empty.className = 'traffic-empty'; + empty.innerHTML = 'Aktuell keine Meldungen verfügbarDie Daten werden automatisch erneut geladen.'; + container.append(empty); + return; + } + items.forEach((item) => container.append(createItem(item, camera))); + }; + + const load = async (force = false) => { + refresh?.classList.add('is-loading'); + if (status) status.textContent = 'Live-Daten werden aktualisiert …'; + try { + const response = await fetch(`/api/v1/traffic${force ? '?refresh=1' : ''}`, { headers: { Accept: 'application/json' }, cache: 'no-store' }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const payload = await response.json(); + const data = payload.data || {}; + const traffic = Array.isArray(data.traffic) ? data.traffic : []; + const cameras = Array.isArray(data.speed_cameras) ? data.speed_cameras : []; + render(trafficList, traffic, false); + render(cameraList, cameras, true); + if (counts) counts.textContent = `${traffic.length} Verkehrsmeldungen · ${cameras.length} Blitzermeldungen`; + const fetched = data.fetched_at ? new Date(data.fetched_at) : new Date(); + if (status) status.textContent = `Aktualisiert ${fetched.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' })} Uhr${data.stale ? ' · zwischengespeichert' : ''}`; + } catch (error) { + if (status) status.textContent = 'Die Live-Daten sind momentan nicht erreichbar. Neuer Versuch in zwei Minuten.'; + console.error('Landwelle Verkehr:', error); + } finally { + refresh?.classList.remove('is-loading'); + window.clearTimeout(timer); + timer = window.setTimeout(() => load(false), 120000); + } + }; + + tabs.forEach((tab) => tab.addEventListener('click', () => { + const name = tab.dataset.trafficTab; + tabs.forEach((item) => item.classList.toggle('is-active', item === tab)); + panels.forEach((panel) => panel.hidden = panel.dataset.trafficPanel !== name); + })); + refresh?.addEventListener('click', () => load(true)); + document.addEventListener('visibilitychange', () => { if (!document.hidden) load(false); }); + window.addEventListener('pagehide', () => window.clearTimeout(timer), { once: true }); + load(false); +})(); diff --git a/web/assets/traffic-v15.css b/web/assets/traffic-v15.css new file mode 100644 index 0000000..4777e3e --- /dev/null +++ b/web/assets/traffic-v15.css @@ -0,0 +1 @@ +.traffic-compact-page{background:#f4f6f2}.traffic-compact-hero{position:relative;isolation:isolate;overflow:hidden;min-height:clamp(290px,36vw,460px);display:flex;align-items:flex-end;padding:56px 0 76px;background:#142019 url("/assets/traffic-hero-v1.png") center 55%/cover no-repeat}.traffic-compact-hero::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(8,18,24,.78) 0%,rgba(8,18,24,.42) 42%,rgba(8,18,24,.12) 72%),linear-gradient(0deg,rgba(8,18,24,.62) 0%,transparent 58%)}.traffic-compact-hero .page-shell{position:relative;z-index:1}.traffic-compact-hero span,.traffic-compact-hero h1,.traffic-compact-hero p{text-shadow:0 2px 18px rgba(0,0,0,.5)}.traffic-compact-hero p{max-width:680px}.traffic-compact-layout{grid-template-columns:minmax(0,1fr) 315px;gap:22px;margin-top:-48px;padding-bottom:48px}.traffic-main-card{padding:28px 30px 26px;min-width:0}.traffic-card-head{margin-bottom:18px}.traffic-card-head h2{font-size:30px}.traffic-toolbar-compact{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0 0 10px;padding:10px;border-radius:14px;background:#f3f6f0;border:1px solid #e1e7dd}.traffic-tabs{display:flex;gap:7px}.traffic-tabs button{min-width:105px;padding:9px 15px}.traffic-live-tools{display:flex;align-items:center;gap:12px;color:#667066;font-size:12px}.traffic-live-tools [data-traffic-refresh]{border:0;border-radius:999px;background:#111711;color:#fff;padding:9px 13px;font-weight:850}.traffic-status{margin:0 0 10px;font-size:12px;color:#747c73}.traffic-scroll-area{max-height:570px;overflow:auto;padding-right:5px;scrollbar-gutter:stable}.traffic-list{display:grid;gap:8px}.traffic-item{grid-template-columns:105px minmax(0,1fr) auto;gap:13px;padding:13px 15px;border-radius:11px;box-shadow:none}.traffic-item h3{font-size:15px;margin-bottom:3px}.traffic-item p{font-size:13px;line-height:1.4}.traffic-item small{margin-top:4px;font-size:11px}.traffic-kind{padding:6px 9px;font-size:10px}.traffic-item>a{font-size:12px}.traffic-source-note{margin-top:13px;border-top:1px solid #e5e9e2;padding-top:12px;color:#626a61;font-size:12px}.traffic-source-note summary{cursor:pointer;color:#4f7e19;font-weight:850}.traffic-source-note p{margin:9px 0 0;line-height:1.5}.traffic-side-card{top:88px;padding:28px 25px 30px}.traffic-side-card img{width:180px;margin-bottom:16px}.traffic-side-card h2{font-size:25px}.traffic-side-card ul{display:grid;gap:8px;margin:18px 0 0;padding:0;list-style:none}.traffic-side-card li{position:relative;padding-left:20px;color:#d0d6cf;font-size:13px}.traffic-side-card li::before{content:"✓";position:absolute;left:0;color:#9ed32f;font-weight:900}@media(max-width:900px){.traffic-compact-layout{grid-template-columns:1fr}.traffic-side-card{position:relative;top:auto}.traffic-scroll-area{max-height:520px}.traffic-item{grid-template-columns:90px minmax(0,1fr)}.traffic-item>a{grid-column:2}}@media(max-width:650px){.traffic-compact-hero{min-height:270px;padding:42px 0 64px;background-position:63% 50%}.traffic-compact-layout{margin-top:-38px;width:min(100% - 22px,var(--page));gap:14px}.traffic-main-card{padding:21px 16px 20px}.traffic-card-head h2{font-size:25px}.traffic-toolbar-compact{align-items:stretch;flex-direction:column}.traffic-tabs{width:100%}.traffic-tabs button{flex:1;min-width:0}.traffic-live-tools{justify-content:space-between}.traffic-scroll-area{max-height:460px}.traffic-item{grid-template-columns:1fr;gap:7px;padding:12px}.traffic-item>a{grid-column:auto}.traffic-kind{width:max-content}} \ No newline at end of file diff --git a/web/charts-listener.html b/web/charts-listener.html new file mode 100644 index 0000000..0abbdd6 --- /dev/null +++ b/web/charts-listener.html @@ -0,0 +1,110 @@ +{{define "chart-rating"}}{{if .FrontendVoting}}
{{range $i := (seq 1 5)}}{{end}}
{{end}}{{end}} +{{define "chart-preview-button"}}{{if .PreviewURL}}{{else}}Keine Hörprobe{{end}}{{end}} +{{define "chart-info-button"}}{{if .FrontendAnnual}}{{end}}{{end}} +{{define "chart-trend"}}{{if eq .Trend "up"}}↑{{else if eq .Trend "down"}}↓{{else if eq .Trend "new"}}NEU{{else}}→{{end}}{{end}} +{{define "charts-listener.html"}} + + + + + + {{seoHead .Config.HeroTitle .Config.SEODescription .Config.RoutePath "website"}} + + + + + + + + + + +{{template "public_header" .}} +
+
+
+ {{.Config.HeroKicker}} +

{{.Config.HeroTitle}}

+

{{.Config.HeroLead}}

+ {{if .Config.Annual}} +
+ + +
+ {{else}} +
Jede Woche sortiert eure Stimme die Landwelle-Charts neu.
+ {{end}} +
+
+ +
+
+
{{.Config.IntroKicker}}

{{.Config.IntroTitle}}

{{.Config.IntroLead}}

+
Zuletzt aktualisiert: {{.UpdatedLabel}}
+
+ + {{if .Config.Annual}}
Aus dem Landwelle-Musikarchiv

Blättere durch vergangene Musikjahre, entdecke alte Platzierungen wieder und höre in längst vergessene Titel hinein.

{{end}} + {{if .TopThree}} +
+ {{range .TopThree}} +
+
+ Cover {{.Artist}} – {{.Title}} + {{.Position}} +
+
+ {{.Artist}}

{{.Title}}

+
+
Aktuelle Punkte{{.VotePoints}}
+
Letzte Woche{{if .PreviousWeekPosition}}#{{.PreviousWeekPosition}}{{else}}Neu{{end}}
+
Dabei seit{{if .EntryMonth}}{{.EntryMonth}}/{{.EntryYear}}{{else if .EntryYear}}{{.EntryYear}}{{else}}–{{end}}
+
Tendenz{{template "chart-trend" .}}
+
+
{{template "chart-preview-button" .}}{{template "chart-info-button" .}}
+ {{if .FrontendVoting}}
Wie gut gefällt dir dieser Titel?{{template "chart-rating" .}}
{{end}} +
+
+ {{end}} +
+ {{else}}
♪

{{.Config.EmptyTopTitle}}

{{.Config.EmptyTopText}}

{{end}} +
+ +
+
+
{{.Config.ListKicker}}

{{.Config.ListTitle}}

{{len .Entries}} Titel
+ {{if .Entries}}
+ {{range .Entries}} +
+ {{.Position}} + Cover {{.Artist}} – {{.Title}} +
{{.Artist}}

{{.Title}}

+
Aktuelle Punkte{{.VotePoints}}
+
Letzte Woche{{if .PreviousWeekPosition}}#{{.PreviousWeekPosition}}{{else}}Neu{{end}}
+
Dabei seit{{if .EntryMonth}}{{.EntryMonth}}/{{.EntryYear}}{{else if .EntryYear}}{{.EntryYear}}{{else}}–{{end}}
+ {{template "chart-trend" .}} +
{{template "chart-preview-button" .}}{{template "chart-info-button" .}}
+ {{if .FrontendVoting}}
{{template "chart-rating" .}}
{{end}} +
+ {{end}} +
{{else}}
♪

{{.Config.EmptyListTitle}}

{{.Config.EmptyListText}}

{{end}} +
+
+ + {{if .NewEntries}} +
+
+
Neu dabei

{{.Config.NewEntriesTitle}}

Diese Titel sind neu dabei und freuen sich auf deine Stimme.

{{len .NewEntries}} Neuvorstellungen
+
{{range .NewEntries}}
Cover {{.Artist}} – {{.Title}}{{.Position}}
{{.Artist}}

{{.Title}}

{{template "chart-preview-button" .}}
{{if .FrontendVoting}}
{{template "chart-rating" .}}
{{end}}
{{end}}
+
+
+ {{end}} +
+ +
♪
Hörprobe

+Landwelle Titel-Info
✦ KI-generierte Information

Diese Titelinformationen wurden mit künstlicher Intelligenz erstellt und können trotz Plausibilitätsprüfung Fehler enthalten.

Mehr zur KI-Transparenz →

Informationen werden geladen …
+{{template "public_footer" .}}{{template "cookie_consent" .}} + +{{end}} diff --git a/web/contact.html b/web/contact.html new file mode 100644 index 0000000..87415c6 --- /dev/null +++ b/web/contact.html @@ -0,0 +1 @@ +{{define "contact.html"}}{{seoHead .Page.Title .Page.Lead "/kontakt" "website"}}{{template "public_header" .}}
{{.Page.Kicker}}

{{.Page.Title}}

{{.Page.Lead}}

{{range .Page.Blocks}}{{if .Active}}
Landwelle Kontakt

{{.Title}}

{{paragraphs .Body}}
{{if .CTALabel}}{{.CTALabel}} →{{end}}
{{end}}{{end}}
Nachricht an Landwelle

Schreib uns direkt

Deine Nachricht wird intern gespeichert und von unserem Team bearbeitet.

{{if .Error}}
{{.Error}}
{{end}}{{if .Success}}
{{.Success}}
{{end}}
{{template "public_footer" .}}{{template "cookie_consent" .}}{{end}} diff --git a/web/directory.html b/web/directory.html new file mode 100644 index 0000000..a99f5d3 --- /dev/null +++ b/web/directory.html @@ -0,0 +1,19 @@ +{{define "directory.html"}} + +{{seoHead "Branchenbuch Niedersachsen" "Kostenloses Branchenbuch von Landwelle für Unternehmen, Vereine, Gastronomie, Unterkünfte, Musiker, DJs, Bands und regionale Angebote." "/branchenbuch" "website"}} + +{{template "public_header" .}} +
+
Regional finden. Kostenlos sichtbar werden.

Landwelle Branchenbuch

Unternehmen, Vereine, Gastronomie, Unterkünfte, Musiker und regionale Dienstleister aus Niedersachsen auf einen Blick.

Branchen entdecken
{{.TotalEntries}} veröffentlichte Einträge
+{{if .Success}}
✓

Eintrag erfolgreich übermittelt

Wir haben deinen kostenlosen Branchenbucheintrag{{if .EntryID}} unter der Nummer {{.EntryID}}{{end}} gespeichert. Nach der redaktionellen Prüfung kann er veröffentlicht werden.

{{end}} +
Branchenbuch

Regionale Anbieter entdecken

Nutze die Live-Suche oder filtere nach einer Kategorie.

+ +
{{range .Entries}}
{{.Category}}{{printf "%.1s" .Name}}

{{.Name}}

{{.Description}}

Ort
{{.PostalCode}} {{.City}}
{{if .Address}}
Adresse
{{.Address}}
{{end}}{{if .OpeningHours}}
Zeiten
{{.OpeningHours}}
{{end}}
{{if .Website}}Webseite öffnen{{end}}{{if .Phone}}Anrufen{{end}}{{if .Email}}E-Mail{{end}}
{{else}}
⌕

Noch keine Einträge in dieser Auswahl

Probiere eine andere Suche oder trage ein regionales Angebot kostenlos ein.

{{end}}
+ +{{if gt .TotalPages 1}}{{end}}
+
+
+ + +{{template "public_footer" .}}{{template "cookie_consent" .}} +{{end}} diff --git a/web/downloads.html b/web/downloads.html new file mode 100644 index 0000000..e1f270b --- /dev/null +++ b/web/downloads.html @@ -0,0 +1,93 @@ +{{define "downloads.html"}} + + + + + + {{seoHead "Downloads" "Landwelle Player und Downloads für Windows, Linux und macOS. Aktueller Stand und verfügbare Anwendungen von Landwelle Radio." "/downloads" "website"}} + + + + + + + + + +{{template "public_header" .}} +
+
+
+
+ Landwelle überall dabei +

Dein Radio.
Direkt auf dem Desktop.

+

Die Landwelle Player für Windows, Linux und macOS bringen Livestream, Titelanzeige und Cover in ein eigenes, aufgeräumtes Programmfenster.

+ +
+ ✓ Direkter Livestream✓ Keine Browser-Suche✓ Landwelle-Look +
+
+ +
+
+ +
+
+
+
Desktop-Apps

Wähle deine Plattform

+

Verfügbare Versionen können direkt geladen werden. Noch nicht veröffentlichte Player werden nach Abschluss der Plattformtests freigeschaltet.

+
+ +
+ {{range .Platforms}} +
+
+ {{if eq .ID "windows"}}WIN{{else if eq .ID "linux"}}LIN{{else if eq .ID "macos"}}MAC{{else}}WALL{{end}} + {{if .Available}}Verfügbar{{else}}In Arbeit{{end}} +
+

{{.Name}}

{{if and .IsWallpaper .PreviewURL}}Vorschau des offiziellen Landwelle Wallpaper-Pakets{{end}} + {{if .IsWallpaper}}

{{.Description}}. Ein ZIP-Paket mit ausgewählten Landwelle-Motiven in verschiedenen Formaten.

  • Desktop-Hintergründe
  • Smartphone-Formate
  • Offizielle Landwelle-Motive
{{else}}

{{.Description}}. Mit eigenständiger Player-Oberfläche, direkter Streamwiedergabe und aktuellen Titelinformationen.

  • Landwelle Livestream
  • Cover & Titelanzeige
  • Play/Pause & Lautstärke
{{end}} + {{if .Available}} + {{.Filename}} laden↓ + {{.Size}} · Stand {{.Updated}} + {{else}} + Noch nicht verfügbar⌛ + Veröffentlichung nach erfolgreichem Plattformtest. + {{end}} +
+ {{end}} +
+ +
+
01

Sofort im Programm

Landwelle startet in einem eigenen Fenster – ohne offene Browser-Tabs und ohne Umwege.

+
02

Immer im Blick

Aktueller Titel, Interpret und Cover werden übersichtlich direkt im Player angezeigt.

+
03

Einfach bedienen

Play, Pause und Lautstärke bleiben bewusst klar und schnell erreichbar.

+
+ +
+
Sofort verfügbar

Du möchtest Landwelle jetzt hören?

Der Web-Player funktioniert bereits auf Computer, Smartphone und Tablet – ganz ohne Installation.

+ +
+
+
+
+{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/editorial-story.html b/web/editorial-story.html new file mode 100644 index 0000000..1b1c5fb --- /dev/null +++ b/web/editorial-story.html @@ -0,0 +1,4 @@ +{{define "editorial-story.html"}} +{{seoHead .Entry.Title .Entry.Teaser .Entry.PublicPath "article"}}{{if .Entry.HasAITransparency}}{{end}}{{template "public_header" .}} +
{{.Entry.ContentTypeLabel}}{{if .Entry.HasAITransparency}}
✦ {{.Entry.AIShortLabel}}{{.Entry.AITransparencyText}}
{{end}}

{{.Entry.Title}}

{{.Entry.Teaser}}

{{if .Entry.Location}}⌖ {{.Entry.Location}}{{end}}
{{if .Entry.MediaURL}}
{{.Entry.MediaAlt}}{{if .Entry.HasMediaWatermark}}{{.Entry.MediaWatermarkLabel}}{{end}}
{{if .Entry.HasMediaAITransparency}}
KI-Hinweis zum Bild: {{.Entry.MediaAITransparencyText}}
{{end}}
{{end}}{{if .Entry.HasAITransparency}}{{end}}
{{.Entry.Body}}
{{template "public_footer" .}}{{template "cookie_consent" .}} +{{end}} diff --git a/web/empfangen.html b/web/empfangen.html new file mode 100644 index 0000000..d5fce7f --- /dev/null +++ b/web/empfangen.html @@ -0,0 +1,32 @@ +{{define "empfangen.html"}} + + {{seoHead "Landwelle empfangen" "Landwelle Radio im Web, über Alexa, radio.de, myTuner und mit dem eigenen Player hören." "/empfangen" "website"}} + + + + + + + + +{{template "public_header" .}} +
+
Überall live dabei

So empfängst du Landwelle

Im Browser, über Alexa sowie auf radio.de und myTuner – schnell, kostenlos und überall mit Internetverbindung.

Landwelle ist onlineAlexaradio.demyTuner
+
+
Smart Speaker

Amazon Alexa

✓ Verfügbar

Landwelle lässt sich bereits direkt über Alexa starten. Sprich den Sendernamen deutlich aus – meistens reicht dieser einfache Sprachbefehl:

„Alexa, spiele Landwelle Radio.“

Sollte Alexa nicht sofort den richtigen Sender wählen, wiederhole den vollständigen Namen „Landwelle Radio“.

+ +
Empfangswege

Landwelle hören

6 Möglichkeiten
+
WEB

Landwelle Webplayer

✓ Verfügbar

Auf jeder Seite findest du den grünen Button „Jetzt live hören“. Der Player zeigt zusätzlich den aktuellen Titel, das Cover und das laufende Programm.

Webplayer öffnen ▶
+
R.DE

radio.de

✓ Verfügbar

Landwelle ist bereits bei radio.de gelistet. Suche dort einfach nach „Landwelle Radio“ und starte den Stream direkt.

+
MY

myTuner Radio

✓ Verfügbar

Auch bei myTuner ist Landwelle bereits verfügbar. Suche in der App oder auf der Plattform nach „Landwelle Radio“.

+
POP

Popup-Player

✓ Verfügbar

Der eigene Player öffnet sich in einem separaten Fenster und spielt weiter, auch wenn du auf der Landwelle-Seite navigierst.

Popup-Player öffnen ▶
+
APP

Mobile App

In Planung

Die geplante Landwelle-App bündelt Livestream, Programminformationen, aktuelle Titel und regionale Inhalte.

Mehr zur Mobile App →
+
PC

Desktop-Player

Im Aufbau

Eigene Landwelle-Player für Windows, Linux und macOS werden vorbereitet.

Zu den Downloads →
+
+ +
Direkter Zugang

Livestream ohne Umwege

Der offizielle Webplayer ist die beste Wahl, weil er neben dem Ton auch Titel, Cover und laufendes Programm anzeigt. Fortgeschrittene Nutzer können den Stream außerdem in kompatiblen Audioplayern öffnen.

Jetzt Landwelle hören
+
+{{template "public_footer" .}} +{{template "cookie_consent" .}} + +{{end}} diff --git a/web/events.html b/web/events.html new file mode 100644 index 0000000..ed100ec --- /dev/null +++ b/web/events.html @@ -0,0 +1,20 @@ +{{define "events.html"}} + +{{seoHead "Veranstaltungen in Niedersachsen" "Feste, Märkte, Konzerte, Flohmärkte, Treckertreffen und regionale Termine aus ganz Niedersachsen." "/veranstaltungen" "website"}} + +{{template "public_header" .}} +
+
Was ist los in Niedersachsen?

Veranstaltungen entdecken

Von Stadtfest und Konzert bis Flohmarkt, Treckertreffen und Vereinsfest – hier findest du Termine aus großen Städten und kleinen Orten.

Kalender abonnierenTermine ansehen ↓
+{{if .Success}}
✓ Danke! Deine Veranstaltung ist bei uns angekommen. Du erhältst eine Bestätigung per E-Mail.
{{end}} +
+
Veranstaltungskalender

Das ist demnächst los

Stöbere durch Termine aus ganz Niedersachsen oder wähle eine Kategorie.

+ +{{if .Events}}
{{range .Events}}
{{if .ImageURL}}{{.Title}}{{else}}{{end}}
{{.Day}}{{.MonthShort}}
{{.Category}}

{{.Title}}

{{.Description}}

Wann
{{.DateLabel}}
Wo
{{.Venue}}{{if .Venue}}, {{end}}{{.PostalCode}} {{.City}}
{{if eq .SourceName "Landwelle Einsendung"}}Von Landwelle geprüft{{else}}Quelle: {{.SourceName}}{{end}}
In Google Kalender +{{if .Website}}Mehr erfahren →{{end}}
{{end}}
+{{if gt .TotalPages 1}}{{end}} +{{else}}
📅

Noch keine Termine in dieser Auswahl

Schau bald wieder vorbei oder sende uns eine Veranstaltung aus deiner Region.

{{end}}
+ +
+ + +{{template "public_footer" .}}{{template "cookie_consent" .}} +{{end}} diff --git a/web/excursions.html b/web/excursions.html new file mode 100644 index 0000000..6fe4255 --- /dev/null +++ b/web/excursions.html @@ -0,0 +1,15 @@ +{{define "excursions.html"}} + + {{seoHead "Ausflugstipps für Niedersachsen" "Ausflugstipps für Niedersachsen: Radtouren, Natur, Kultur, Freizeitparks und Familienziele aus der Region." "/ausflugstipps" "website"}} + + + + + +{{template "public_header" .}} +
Landwelle unterwegs

Ausflugstipps für Niedersachsen

Radtouren, Natur, Kultur, Freizeitparks und Familienziele – ausgewählt für einen schönen Tag im Land.

+
{{range .Categories}}{{end}}
+
{{range .Excursions}}{{end}}
+
Hinweis: Öffnungszeiten, Sperrungen und Routenbedingungen bitte vor der Fahrt direkt beim verlinkten Anbieter prüfen.
+{{template "public_footer" .}}{{template "cookie_consent" .}} +{{end}} diff --git a/web/faq.html b/web/faq.html new file mode 100644 index 0000000..222c6a7 --- /dev/null +++ b/web/faq.html @@ -0,0 +1 @@ +{{define "faq.html"}}{{seoHead .Page.Title .Page.Lead "/faq" "website"}}{{template "public_header" .}}
{{.Page.Kicker}}

{{.Page.Title}}

{{.Page.Lead}}

{{range .Page.Blocks}}{{if .Active}}
{{.Title}}+
{{paragraphs .Body}}
{{if .CTALabel}}{{.CTALabel}} →{{end}}
{{end}}{{else}}
Noch keine Fragen hinterlegt.
{{end}}
{{template "public_footer" .}}{{template "cookie_consent" .}}{{end}} diff --git a/web/forum-new.html b/web/forum-new.html new file mode 100644 index 0000000..b3a6cbe --- /dev/null +++ b/web/forum-new.html @@ -0,0 +1,52 @@ +{{define "forum-new.html"}} + + + + + + + Neues Thema – Landwelle Forum + + + + + + + +{{template "public_header" .}} +
+
Landwelle Community

Neues Thema

Starte eine neue Diskussion im Landwelle Forum.

+
+
+
Neuer Beitrag

Thema erstellen

Wähle die passende Kategorie und beschreibe dein Anliegen möglichst verständlich.

+ {{if .Error}}
{{.Error}}
{{end}} +
+ + + + Erlaubt: [b], [i], [u], [s], [quote], [code], [url] und [list]. Bilder sind im Forum bewusst deaktiviert. +
Abbrechen
+
+
+ +
+
+{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/forum-topic.html b/web/forum-topic.html new file mode 100644 index 0000000..d7bae07 --- /dev/null +++ b/web/forum-topic.html @@ -0,0 +1,112 @@ +{{define "forum-topic.html"}} + + + + + + {{seoHead .Topic.Title .Topic.Body (printf "/forum/topic/%s" .Topic.Slug) "article"}} + + + + + + + +{{template "public_header" .}} +
+
+
+ {{.Topic.CategoryName}} +

{{.Topic.Title}}

+

{{.Topic.ReplyCount}} Antworten · {{.Topic.Views}} Aufrufe · {{.Topic.ThankCount}} Danke

+
+
+ +
+ + {{if .Success}}
{{.Success}}
{{end}} + {{if .Error}}
{{.Error}}
{{end}} + +
+ +
+
#1 · Thema
+

{{.Topic.Title}}

+
{{.Topic.BodyHTML}}
+
+ {{.Topic.ThankCount}}× Danke + {{if .Topic.CanThank}}
{{else if .Topic.ThankedByUser}}✓ Du hast dich bedankt{{end}} +
+
+
+ + {{range .Topic.Posts}} +
+ +
+
Antwort #{{.ID}}
+
{{.BodyHTML}}
+
+ {{.ThankCount}}× Danke + {{if .CanThank}}
{{else if .ThankedByUser}}✓ Du hast dich bedankt{{end}} +
+
+
+ {{end}} + + + {{if eq .Topic.Status "locked"}} +
Dieses Thema ist geschlossen.
+ {{else if .User}} +
+
Antwort

Beitrag schreiben

Formatiere deinen Text mit BBCode. Bilder werden nicht unterstützt.

+ + + Erlaubt: [b], [i], [u], [s], [quote], [code], [url] und [list]. Keine Bildcodes. +
Zurück zur Kategorie
+
+ {{else}} + + {{end}} +
+
+{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/forum.html b/web/forum.html new file mode 100644 index 0000000..9b7938c --- /dev/null +++ b/web/forum.html @@ -0,0 +1,143 @@ +{{define "forum.html"}} + + + + + + {{if .CurrentCategory}} + {{seoHead (printf "%s – Landwelle Forum" .CurrentCategory.Name) .CurrentCategory.Description (printf "/forum/category/%s" .CurrentCategory.Slug) "website"}} + {{else}} + {{seoHead "Landwelle Forum" "Das Landwelle Forum für Musik, Radio, Niedersachsen, Veranstaltungen und Technik." "/forum" "website"}} + {{end}} + + + + + + + +{{template "public_header" .}} +
+
+
+ {{if .CurrentCategory}} + Landwelle Forum · Kategorie +

{{.CurrentCategory.Name}}

+

{{.CurrentCategory.Description}}

+ {{else}} + Landwelle Community +

Forum

+

Musik, Radio, Veranstaltungen und unser Niedersachsen – miteinander, übersichtlich und regional.

+ {{end}} +
+
+ +
+
+
+
+ {{if .User}} + Hallo {{.User.DisplayName}} + Neue Bereiche und Themen sind für dich deutlich markiert. + {{else}} + Willkommen im Landwelle Forum + Zum Schreiben, Bedanken und persönlichen Lesestatus bitte anmelden. + {{end}} +
+
+ {{if .CategoryView}}Forenübersicht{{end}} + {{if .User}} + Neues Thema +
+ {{else}} + + {{end}} +
+
+ + {{if .Success}}
{{.Success}}
{{end}} + {{if .Error}}
{{.Error}}
{{end}} + + {{if not .CategoryView}} +
+
+

Forenübersicht

+ ThemenBeiträgeLetzter Beitrag +
+ +
+ {{end}} + +
+
+

{{if .CategoryView}}Themen in {{.CurrentCategory.Name}}{{else}}Aktuelle Themen{{end}}

+ AntwortenAufrufeLetzter Beitrag +
+ +
+
+ + +
+
+{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..a235017 --- /dev/null +++ b/web/index.html @@ -0,0 +1,278 @@ + + + + + + {{seoHead "Landwelle Radio – Sound & Infos aus Niedersachsen" "Landwelle Radio aus Niedersachsen: Livestream, aktuelle Musik, Programm, regionale Nachrichten, Wetter, Verkehr, Veranstaltungen und Ausflugstipps." "/" "website"}} + + + + + + + + + + + + + + + + + + {{template "public_header" .}} + +
+
+ +
+ + +
+ +
+
+
+
+
Aktuelle ModerationLIVE
+
+ Jetzt live auf Landwelle + Moin Niedersachsen · 06:00–10:00 Uhr + mit Jan-Henrik Gerdes +
+ + +
Aktuelles Cover
+
+ Aktueller Titel + Kerstin Ott + Für immer für dich +
+ +
+

+ +
+ +
+
+ + +
+
+
+

Aktuelles aus Niedersachsen

Mehr Nachrichten ›
+
+ {{range .News}} +
+ +
{{.Category}}

{{.Title}}

{{if .Source}}Quelle: {{.Source}}{{end}}
+
+ {{end}} +
+
+ +
+ +
+ {{range .Events}} +
+ {{.Day}}{{.Month}} +

{{.Title}}

{{.DateTime}}

⌖ {{.Place}}Weitere Informationen →
+
+ {{end}} +
+
+ +
+

Landwelle vor Ort

Thema vorschlagen ›
+ {{if .Stories}}
+ {{range .Stories}} + + {{end}} +
{{else}}
Landwelle vor OrtAktuell liegen uns keine neuen Geschichten aus der Region vor.

Du hast ein Thema, das bei Landwelle gehört werden sollte? Schreib unserer Redaktion.

Thema an Landwelle senden →
{{end}} +
+ +
+

Programm-Highlights

Zum Programm ›
+
+ {{range .Program}} +
+ +
{{.Show}}{{.PresenterLabel}}
+ + {{if .Live}}Jetzt live{{end}} +
+ {{end}} +
+
+
+ + +
+ + {{if .AppBetaEnabled}} + +
+
+
+ +
+ Landwelle App · Beta-Test +

Teste die neue Landwelle App vor dem offiziellen Start.

+

Werde Teil unseres Testteams, probiere neue Funktionen aus und hilf uns mit deinem Feedback, die App noch besser zu machen.

+
    +
  • Direkter Beitritt
  • +
  • Früher App-Zugang
  • +
  • Neuigkeiten zum Test
  • +
+
+
+ + + Beta-Test beitreten + + + Google-Konto erforderlich
{{.AppBetaGroupEmail}}
+
+
+
+
+ {{end}} +
+ {{template "public_footer" .}} + + + + + + + diff --git a/web/jobs.html b/web/jobs.html new file mode 100644 index 0000000..ce6dbd2 --- /dev/null +++ b/web/jobs.html @@ -0,0 +1,23 @@ +{{define "jobs.html"}} + +{{seoHead "Stellenbörse Niedersachsen" "Aktuelle Stellenangebote für Niedersachsen und Norddeutschland durchsuchen – präsentiert von Landwelle Radio." "/service/stellenboerse" "website"}} + +{{template "public_header" .}} +
+
Arbeiten im Norden

Landwelle Stellenbörse

Finde aktuelle Jobs, Ausbildungsplätze, Praktika und regionale Chancen in Niedersachsen.

+
+ +{{if .Error}}
Die Stellenbörse ist gerade nicht erreichbar.

{{.Error}}

{{end}} +
Aktuelle Angebote

Jobs für deine Region

{{if gt .Total 0}}

{{.Total}} Treffer

{{end}}
+{{if .Jobs}}
{{range .Jobs}}
{{if .LocationLabel}}{{.LocationLabel}}{{else}}Deutschland{{end}}

{{.DisplayTitle}}

{{.Employer}}

{{if .StartLabel}}Start: {{.StartLabel}}{{end}}Ref. {{.JobReference}}
{{end}}
{{else if .Loaded}}

Keine passenden Stellen gefunden

Ändere Suchbegriff, Umkreis oder Zeitraum.

{{end}} +{{if or .HasPrev .HasNext}}{{end}} +

Die Stellenangebote werden serverseitig aus der Jobsuche der Bundesagentur für Arbeit geladen. Landwelle ist nicht Arbeitgeber der angezeigten Stellen.

+
+ +{{template "public_footer" .}}{{template "cookie_consent" .}}{{end}} diff --git a/web/landwelle-vor-ort.html b/web/landwelle-vor-ort.html new file mode 100644 index 0000000..13abdb3 --- /dev/null +++ b/web/landwelle-vor-ort.html @@ -0,0 +1,83 @@ +{{define "landwelle-vor-ort.html"}} + + + + + + {{seoHead .PageTitle .MetaDescription .CanonicalPath "website"}} + + + + + + + +{{template "public_header" .}} +
+
+
+ Unser Norden +

Landwelle vor Ort

+

Wir sind dort, wo der Norden lebt: bei Menschen, Vereinen, Veranstaltungen, besonderen Orten und Geschichten aus der Region.

+
+
+ +
+
+
{{if .HasActiveCategory}}Kategorie{{else}}Unterwegs mit Landwelle{{end}}

{{.SectionTitle}}

+ {{if .Entries}}

{{len .Entries}} {{if eq (len .Entries) 1}}veröffentlichter Beitrag{{else}}veröffentlichte Beiträge{{end}}{{if .SectionDescription}} · {{.SectionDescription}}{{end}}

{{end}} +
+ + {{if .Categories}} + + {{end}} + + {{if .Entries}} + + {{else}} +
+ Landwelle +

Noch keine veröffentlichten Beiträge

+

Sobald die Redaktion einen neuen „Landwelle vor Ort“-Beitrag veröffentlicht, erscheint er automatisch hier.

+
+ {{end}} +
+
+{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/landwelle-zuhause.html b/web/landwelle-zuhause.html new file mode 100644 index 0000000..da95e60 --- /dev/null +++ b/web/landwelle-zuhause.html @@ -0,0 +1,200 @@ +{{define "landwelle-zuhause.html"}} + + + + + + {{seoHead "Landwelle Zuhause" "Landwelle Zuhause ist die digitale Welt von Landwelle in OpenGenesisLINK – mit Radiosendestation, Treffpunkten, Events, Festzelt und DJ Jens." "/zuhause/landwelle" "website"}} + + + + + + + + + + + +{{template "public_header" .}} + +
+
+ +
+
+ Demnächst in OpenGenesisLINK +

Die digitale Welt der Landwelle

+

Willkommen bei
Landwelle Zuhause

+

Ein Ort zum Hören, Treffen, Feiern und Entdecken. In unserer digitalen Landwelle-Welt entsteht eine eigene Radiosendestation mit Veranstaltungsflächen, Festzelt, Treffpunkten und besonderen Events.

+ +
+ RADIO Sendestation + LIVE Veranstaltungen + PARTY Festzelt & DJ +
+
+ +
+
+ +
+
+
+ Mehr als nur Radio +

Landwelle bekommt ein digitales Zuhause.

+

Unsere Welt verbindet das Radioprogramm mit einem virtuellen Treffpunkt. Hier soll Landwelle nicht nur zu hören, sondern auch räumlich erlebbar werden – mit Orten, an denen unsere Community zusammenkommt.

+
+
+
+ +

Radio-Sendestation

+

Das Herz der digitalen Welt. Die Landwelle-Sendestation wird zum zentralen Treffpunkt rund um unser Radio, unser Programm und besondere Aktionen.

+
+
+ +

Events & Musik

+

Von besonderen Musikabenden bis zu eigenen Landwelle-Veranstaltungen: Die digitale Welt bekommt wechselnde Events mit echter Landwelle-Atmosphäre.

+
+
+ +

Festzelt & DJ Jens

+

Natürlich darf gefeiert werden. Im virtuellen Festzelt sind Veranstaltungen mit unserem bekannten DJ Jens geplant – mit Musik, Stimmung und Landwelle-Partygefühl.

+
+
+ +

Treffpunkt für alle

+

Schaut euch um, trefft andere Besucher und erlebt Landwelle einmal anders. Die Welt soll Stück für Stück wachsen und immer wieder Neues bieten.

+
+
+
+
+ +
+
+
+ Die Radio-Sendestation in Landwelle Zuhause in OpenGenesisLINK +
+ Originalbild + Die Radio-Sendestation + Außenansicht der Sendestation in Landwelle Zuhause +
+
+
+ +

Hier sendet die Landwelle.

+

Die Radio-Sendestation bildet den Mittelpunkt von Landwelle Zuhause. Sie ist Anlaufstelle für Besucher, Kulisse für Aktionen und der Ort, an dem die digitale Welt mit unserem echten Radioprogramm zusammenkommt.

+

Rund um die Station entstehen weitere Bereiche: Plätze zum Treffen, Wege zum Erkunden und Flächen für wechselnde Veranstaltungen. So wird aus einem Radiosender nach und nach ein eigener digitaler Ort.

+
Im AufbauHier siehst du jetzt bereits die erste echte Ansicht aus unserer digitalen Welt.
+
+
+
+ +
+
+
+ +

Feiern mit DJ Jens.

+

Zu Landwelle gehört Musik – und zu Landwelle Zuhause gehört deshalb auch ein richtiges virtuelles Festzelt. Für ausgewählte Veranstaltungen steht unser DJ Jens am Pult und bringt die digitale Tanzfläche in Bewegung.

+

Geplant sind besondere Partyabende, Themenveranstaltungen und gemeinsame Treffen. Termine kündigen wir rechtzeitig auf Landwelle an.

+ Landwelle Events · Musik · Community +
+ +
+
+ + + +
+
+
+ Dein Weg in die Welt +

So betrittst du Landwelle Zuhause.

+

Landwelle Zuhause wird über OpenGenesisLINK erreichbar sein. Für den Besuch benötigst du den OpenGenesisLINK Viewer und einen passenden Zugang.

+
+
+
+ 1 +
Vorbereiten

Viewer installieren

Installiere den OpenGenesisLINK Viewer auf deinem Rechner. Den direkten offiziellen Downloadlink hinterlegen wir hier, sobald der öffentliche Landwelle-Zugang freigegeben wird.

+
+
+ 2 +
Anmelden

Mit deinem Zugang starten

Öffne den Viewer und melde dich mit deinem OpenGenesisLINK-Zugang an. Die endgültigen Zugangsdaten und Hinweise für Landwelle veröffentlichen wir rechtzeitig vor dem Start.

+
+
+ 3 +
Ankommen

Landwelle Zuhause besuchen

Wähle anschließend „Landwelle Zuhause“ als Ziel. Den direkten Ziel- beziehungsweise Teleport-Hinweis ergänzen wir hier, sobald unsere Welt öffentlich geöffnet ist.

+
+
+
+
Noch ein wenig Geduld

Besucht uns demnächst in OpenGenesisLINK.

Wir bauen gerade an der digitalen Heimat der Landwelle. Sobald die Tore öffnen, findest du auf dieser Seite alle Zugangsdaten, Termine und neuen Bilder.

+ Zurück zur Landwelle +
+
+
+
+ +{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/livestudio.html b/web/livestudio.html new file mode 100644 index 0000000..d55a8cf --- /dev/null +++ b/web/livestudio.html @@ -0,0 +1,171 @@ +{{define "livestudio.html"}} + + + + + + + Landwelle Livestudio + + + + +
+
+
+ +
+
+ Livestudio + Studio-Monitor + Automatik aktiv +
+

Wandmonitor-Ansicht mit Uhr, On-Air-Status, Studioinfos, Verkehr und Hinweisen

+
+
+
Verbindung wird hergestellt
+
+ +
+
+
+
+
+
+ Landwelle + KW -- +
+
+
+
+
+
+
+ Studiozeit +
--:--:--
+ +
+ Region Niedersachsen + Europa/Berlin + Tagesmodus +
+
+
+
+ +
+
+
+ On-Air-Ampel + Bereit +
+
+ + + +
+
+ +
+ + Jetzt auf Landwelle +

Landwelle Radio

+

Aktuelles Programm wird geladen

+

+ +
+ Countdown + --:--:-- +

Nächste Studiomarke wird berechnet

+
+ +
+
+ Als Nächstes +

Programm wird geladen

+

+
+
+
+ +
+
+ Zuhörer live + -- + aktuell verbunden +
+ +
+ Wetter im Land +
◌--°
+

Wetterdaten werden geladen

+

+
+ +
+ Cover des aktuellen Titels +
+ Aktueller Titel +

Titel wird geladen

+

Landwelle Radio

+
+
+ +
+ Studio-Info +
+
Datenstand
--
+
Quelle
--
+
Anzeige
Livestudio
+
Status
bereit
+
+
+
+ +
+
Hinweise
+
+
+ Landwelle Livestudio wird geladen … +
+
+
+ +
+
+
+
+ Verkehr +

Aktuelle Meldungen

+
+ -- +
+
+
Verkehrsdaten werden geladen …
+
+
+ +
+
+
+ Blitzer +

Gemeldete Kontrollen

+
+ -- +
+
+
Blitzermeldungen werden geladen …
+
+
+
+ +
Landwelle Radio · Niedersachsen hört Landwelle · optimiert für Vollbild, Studio und Regie
+
+ + + +{{end}} diff --git a/web/managed-page.html b/web/managed-page.html new file mode 100644 index 0000000..a3beaac --- /dev/null +++ b/web/managed-page.html @@ -0,0 +1 @@ +{{define "managed-page.html"}}{{seoHead .Page.Title .Page.Lead (printf "/%s" .Page.PageKey) "website"}}{{template "public_header" .}}
{{.Page.Kicker}}

{{.Page.Title}}

{{.Page.Lead}}

{{range .Page.Blocks}}{{if .Active}}

{{.Title}}

{{paragraphs .Body}}
{{if .CTALabel}}{{.CTALabel}} →{{end}}
{{end}}{{else}}
Diese Seite wird gerade vorbereitet.

Schau bald wieder vorbei oder melde dich direkt bei Landwelle.

{{end}}
{{template "public_footer" .}}{{template "cookie_consent" .}}{{end}} diff --git a/web/mediathek.html b/web/mediathek.html new file mode 100644 index 0000000..de36fd7 --- /dev/null +++ b/web/mediathek.html @@ -0,0 +1 @@ +{{define "mediathek.html"}}{{seoHead "Landwelle Mediathek" "Sendungen, Interviews und regionale Beiträge zum Nachhören." "/mediathek" "website"}}{{template "public_header" .}}
Landwelle zum NachhörenIllustration mit KI erstellt

Unsere Mediathek

Sendungen, Interviews, regionale Geschichten und ausgewählte KI-Beiträge – dann, wenn du Zeit dafür hast.

Aus dem Landwelle-Programm

Jetzt nachhören

{{if .Entries}}
{{range .Entries}}
{{if .CoverURL}}Cover {{.Title}}{{if .HasCoverWatermark}}{{.CoverWatermarkLabel}}{{end}}{{else}}Landwelle{{end}}{{.KindLabel}}
{{.DateLabel}}{{if .EpisodeLabel}} · {{.EpisodeLabel}}{{end}}{{if .DurationLabel}} · {{.DurationLabel}}{{end}}

{{.Title}}

{{if .Subtitle}}{{.Subtitle}}{{end}}

{{.Description}}

{{if .HasAITransparency}}
✦ {{.AIShortLabel}}

{{.AITransparencyText}}

{{.AIReviewLabel}}Mehr zur KI-Transparenz →
{{end}}{{if .HasAITransparency}}{{.AITransparencyText}}{{end}}
{{end}}
{{else}}
♪

Die Mediathek wird gerade gefüllt.

Sobald erste Sendungen und Beiträge veröffentlicht sind, kannst du sie hier direkt nachhören.

Bis dahin Landwelle live hören →
{{end}}
{{template "public_footer" .}}{{template "cookie_consent" .}}{{end}} diff --git a/web/mitmachen.html b/web/mitmachen.html new file mode 100644 index 0000000..6761218 --- /dev/null +++ b/web/mitmachen.html @@ -0,0 +1,104 @@ +{{define "mitmachen.html"}} + + + + + + {{seoHead "Musikwünsche & Grüße" "Sende deinen Musikwunsch oder Gruß an Landwelle Radio und werde Teil des Programms aus Niedersachsen." "/mitmachen" "website"}} + + + + + + + + + + + + + + +{{template "public_header" .}} +
+
+
+ Du bist Teil der Landwelle +

Musikwünsche & Grüße

+

Wünsch dir deinen Song, grüß Familie, Freunde, Vereine oder Kolleginnen und Kollegen – direkt aus Niedersachsen.

+
+
+ +
+
+
+ Ab ins Studio +

Dein Wunsch für Landwelle

+

Dein Gruß wird öffentlich auf dieser Seite angezeigt. Musikwünsche können je nach Programm und Verfügbarkeit berücksichtigt werden.

+
+ + {{if .Success}}
Danke! Dein Musikwunsch oder Gruß ist bei Landwelle angekommen und wurde in die Liste aufgenommen.
{{end}} + {{if .Error}}{{end}} + +
+
+ + + + +
+ + + + +
+
+ + +
+ +
+
+
+
Direkt aus Niedersachsen

Aktuelle Hörerwünsche & Grüße

+

{{.Total}} {{if eq .Total 1}}Eintrag{{else}}Einträge{{end}}

+
+ + {{if .Entries}} +
+ {{range .Entries}} +
+ +
+
{{.Name}}aus {{.Place}}
+ {{if .SongLabel}}

Musikwunsch{{.SongLabel}}

{{end}} +

„{{.Message}}“

+
+
+ {{end}} +
+ + {{if gt .TotalPage 1}} + + {{end}} + {{else}} +
♪

Noch keine Grüße eingegangen

Mach den Anfang und schick deinen Wunsch direkt ins Landwelle-Studio.

+ {{end}} +
+
+
+{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/mobile-app.html b/web/mobile-app.html new file mode 100644 index 0000000..95a6901 --- /dev/null +++ b/web/mobile-app.html @@ -0,0 +1,136 @@ +{{define "mobile-app.html"}} + + + + + + {{seoHead "Landwelle Mobile App" "Die geplante Landwelle App für Android und iOS mit Livestream, Charts, Programm und regionalen Informationen." "/mobile-app" "website"}} + + + + + + + + + + +{{template "public_header" .}} +
+
+
+
+ Landwelle für unterwegs +

Dein Radio.
Immer dabei.

+

Die Landwelle App bringt Livestream, Programm, Charts und regionale Inhalte übersichtlich auf dein Smartphone.

+
+ Entwicklung läuft + Android geplant + iOS geplant +
+ +
+ +
+
+
+
+
Charts
+
ZuhörerSchlager
+
    +
  1. 1
    Landwelle Top HitAktueller Titel
    ↑
  2. +
  3. 2
    NordlichtLieblingssong
    →
  4. +
  5. 3
    KüstenwindNeueinsteiger
    NEU
  6. +
  7. 4
    SommerabendLandwelle Musik
    ↑
  8. +
+
+
+
+
+
+
Live
+ Jetzt läuft +
♪
+

Landwelle Radio

+

Die beste Musik für Niedersachsen

+
+
↶▶↷
+
10:00–12:00 UhrLandwelle am Vormittag
+
+
+
+
+
+
+ +
+
+
+ Aktueller Stand +

Die App entsteht Schritt für Schritt.

+

Android und iOS sind vorgesehen. Bis zur Veröffentlichung kannst du Landwelle bereits vollständig mobil im Browser hören und die Webseite zum Startbildschirm hinzufügen.

+
+
+
ANDROIDIn VorbereitungNative App geplant
+
iOSIn VorbereitungNative App geplant
+
WEBSchon verfügbarMobil optimiert
+
+
+
+ +
+
+
+ Geplante Funktionen +

Alles Wichtige in einer App.

+

Die Anwendung konzentriert sich bewusst auf die Funktionen, die Hörerinnen und Hörer im Alltag wirklich brauchen.

+
+
+
▶

Live-Radio

Stabiler Livestream mit übersichtlicher Wiedergabesteuerung und Hintergrundbetrieb.

+
♪

Aktueller Titel

Interpret, Songtitel, Cover und laufende Sendung direkt im Blick.

+
▦

Programm

Sendungen, Zeiten und Moderation für den gesamten Tag übersichtlich dargestellt.

+
↕

Charts & Voting

Zuhörer- und Schlager-Charts ansehen, Titel vorhören und Favoriten bewerten.

+
⌖

Regionale Inhalte

Nachrichten, Verkehr, Wetter und Veranstaltungen aus Niedersachsen.

+
✉

Wünsche & Grüße

Musikwünsche und Grüße direkt aus der App an die Landwelle-Redaktion senden.

+
+
+
+ +
+
+
+ Produkt-Roadmap +

Von der mobilen Webseite zur nativen App.

+

Die technische Basis ist bereits vorhanden. Die nächsten Schritte führen die bestehenden Landwelle-Funktionen in eine eigenständige App-Erfahrung.

+
+
    +
  1. 01
    Mobile Webseite

    Responsive Portalansicht und mobiler Webplayer.

  2. +
  3. 02
    App-Konzept & Schnittstellen

    Design, Datenversorgung und Push-Infrastruktur.

  4. +
  5. 03
    Android & iOS Entwicklung

    Native Apps, Tests und Store-Vorbereitung.

  6. +
  7. 04
    Veröffentlichung

    Bereitstellung in den offiziellen App Stores.

  8. +
+
+
+ +
+
+
+ Schon heute mobil nutzen +

Landwelle auf den Home-Bildschirm legen.

+

Öffne landwelle.de auf deinem Smartphone. Unter Android findest du im Browsermenü „Zum Startbildschirm hinzufügen“. Auf iPhone und iPad nutzt du „Teilen“ und anschließend „Zum Home-Bildschirm“.

+
+ +
+
+
+{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/news-article.html b/web/news-article.html new file mode 100644 index 0000000..f2b766b --- /dev/null +++ b/web/news-article.html @@ -0,0 +1,40 @@ +{{define "news-article.html"}} + + + + + + {{seoHead .Article.Title .Article.Teaser .Article.ArticleURL "article"}} + + + + + + +{{template "public_header" .}} +
+
+ ← Zur Nachrichtenübersicht +
{{.Article.Category}}Von Landwelle
+

{{.Article.Title}}

+

{{.Article.Teaser}}

+
+
+
+ {{if .Article.ImageAlt}}{{.Article.ImageAlt}}{{else}}{{.Article.Title}}{{end}} +
{{.Article.Body}}
+
+ +
+
+{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/news.html b/web/news.html new file mode 100644 index 0000000..4f8a403 --- /dev/null +++ b/web/news.html @@ -0,0 +1,174 @@ +{{define "news.html"}} + + + + + + {{seoHead "Aktuelles aus Niedersachsen" "Nachrichten, Geschichten und wichtige Hinweise aus Niedersachsen und der Region." "/aktuelles" "website"}} + + + + + + + + + +{{template "public_header" .}} +
+
+
+ Nachrichten aus deiner Region +

Aktuelles aus Niedersachsen

+

Was heute wichtig ist: Nachrichten, Geschichten und Hinweise aus Niedersachsen – übersichtlich für dich zusammengestellt.

+
+
+ + {{if .Lead.Title}} +
+
+
+ Im Mittelpunkt +

Die wichtigste Meldung des Tages

+

Hier findest du den aktuellen Aufmacher und weitere Themen, über die in Niedersachsen gesprochen wird.

+
+ +
+ {{if .Lead.ImageAlt}}{{.Lead.ImageAlt}}{{else}}{{.Lead.Title}}{{end}} +
+
+
{{.Lead.Category}}{{if .Lead.External}}Quelle: {{.Lead.Source}}{{else if .Lead.Editorial}}Von Landwelle{{end}}
+

{{.Lead.Title}}

+

{{.Lead.Teaser}}

+ {{if .Lead.ArticleURL}}Mehr erfahren →{{end}} +
+
+ + {{if .TopStories}} +
+
Weitere wichtige Themen

Das bewegt Niedersachsen

+
+ {{range .TopStories}} +
+ {{.Title}} +
+
{{.Category}}{{if .External}}Quelle: {{.Source}}{{else if .Editorial}}Von Landwelle{{end}}
+

{{.Title}}

+

{{.Teaser}}

+ {{if .ArticleURL}}Weiterlesen →{{end}} +
+
+ {{end}} +
+
+ {{end}} +
+ + +
+ {{end}} + +
+
+
+
Neu aus Niedersachsen

Weitere Nachrichten

+

Stand {{.Updated}}

+
+ + {{if .More}} +
+ {{range .More}} + + {{end}} +
+ {{else}} +
▤

Im Moment gibt es keine weiteren Meldungen

Schau später noch einmal vorbei – wir halten dich hier auf dem Laufenden.

+ {{end}} + + {{if gt .LocalPagination.TotalPages 1}} + + {{end}} +
+
+ + +
+
+
+
Aus Deutschland und der Welt

Welt Nachrichten

+

Quelle: tagesschau.de · Stand {{.Updated}}

+
+ + {{if .World}} +
+ {{range .World}} + + {{end}} +
+ {{else}} +
◎

Aktuell sind keine Weltmeldungen verfügbar

Sobald der Tagesschau-RSS-Feed neue Meldungen liefert, werden sie hier automatisch angezeigt.

+ {{end}} + + {{if gt .WorldPagination.TotalPages 1}} + + {{end}} +
+
+ +
+
Du hast etwas mitbekommen?

Schick uns deinen Hinweis aus der Region

Ob Straßensperrung, Vereinsaktion oder besonderes Ereignis: Schreib uns, was bei dir vor Ort passiert.

+ Hinweis senden → +
+
+{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/ontour.html b/web/ontour.html new file mode 100644 index 0000000..4dfbcbf --- /dev/null +++ b/web/ontour.html @@ -0,0 +1,17 @@ +{{define "ontour.html"}} + +{{seoHead "Landwelle OnTour" "Landwelle unterwegs in Niedersachsen: Videos, Veranstaltungen, Begegnungen und Geschichten direkt vom Landwelle-YouTube-Kanal." "/ontour" "website"}} + +{{template "public_header" .}} +
+
Landwelle ist da, wo Niedersachsen lebt

Landwelle OnTour

Wir treffen Menschen, besuchen Veranstaltungen und zeigen Geschichten aus Stadt und Land. Direkt, nahbar und mitten aus Niedersachsen.

+
Veranstaltungen•Vereine•Land & Leute•Musik•Regionale Geschichten•Niedersachsen
+{{if .Error}}
Hinweis

{{.Error}}

Zum Landwelle-YouTube-Kanal →
{{end}} +{{if .HasVideos}}
Frisch von unterwegs · {{.Featured.Published}}

{{.Featured.Title}}

{{if .Featured.Description}}{{.Featured.Description}}{{else}}Das neueste Video vom Landwelle-OnTour-Kanal.{{end}}

Auf YouTube öffnen
{{end}} +
Was wir zeigen

Niedersachsen abseits der großen Schlagzeilen

Landwelle OnTour schaut dort hin, wo Menschen gemeinsam etwas auf die Beine stellen: auf Dorffesten, Konzerten, Märkten, Vereinsgeländen, Höfen und an besonderen Orten.

01Vor Ort

Begegnungen, Eindrücke und Stimmen direkt aus der Region.

02Im Gespräch

Menschen erzählen, was sie bewegt und warum ihr Projekt wichtig ist.

03Auf Sendung

Geschichten werden für Radio, Website und Video passend aufbereitet.

+
Landwelle auf YouTube

Aktuelle OnTour-Videos

Die neuesten Veröffentlichungen werden automatisch aus dem offiziellen Landwelle-Kanal geladen.

Alle Videos auf YouTube →
{{if .Videos}}
{{range .Videos}}
{{.Published}}

{{.Title}}

{{.Description}}

{{end}}
{{else}}
▶

Die Videos werden gerade geladen

Öffne den Landwelle-Kanal direkt auf YouTube.

YouTube-Kanal öffnen
{{end}}
+
Landwelle bei deiner Veranstaltung?

Hol Landwelle OnTour zu euch

Du planst ein Fest, Konzert, Vereinsprojekt oder eine besondere regionale Aktion? Schick uns die wichtigsten Informationen.

+
+ +{{template "public_footer" .}}{{template "cookie_consent" .}} +{{end}} diff --git a/web/page.html b/web/page.html new file mode 100644 index 0000000..73d8351 --- /dev/null +++ b/web/page.html @@ -0,0 +1,16 @@ +{{define "page.html"}} + + {{seoHead .Page.Title .Page.Lead (printf "/%s" .Page.Slug) "website"}} + + + + + +{{template "public_header" .}} +
{{.Page.Kicker}}

{{.Page.Title}}

{{.Page.Lead}}

+
+{{range .Page.Sections}}

{{.Title}}

{{.Text}}

{{if .Items}}
    {{range .Items}}
  • {{.}}
  • {{end}}
{{end}}{{if .CTA}}{{.CTA}} →{{end}}
{{end}} +

Stand: {{.Page.Updated}}

+
+{{template "public_footer" .}}{{template "cookie_consent" .}} +{{end}} diff --git a/web/partials.html b/web/partials.html new file mode 100644 index 0000000..5d695f8 --- /dev/null +++ b/web/partials.html @@ -0,0 +1,59 @@ +{{define "public_header"}} + +{{end}} + +{{define "public_footer"}} + +{{template "auth_modal" .}} +{{end}} + +{{define "cookie_consent"}} + +{{end}} + +{{define "auth_modal"}} + +{{end}} diff --git a/web/player.html b/web/player.html new file mode 100644 index 0000000..009b87d --- /dev/null +++ b/web/player.html @@ -0,0 +1,79 @@ + + + + + + + + + Landwelle Liveplayer + + + + + +
+ + + + + + + +
+ + diff --git a/web/playlist.html b/web/playlist.html new file mode 100644 index 0000000..676212f --- /dev/null +++ b/web/playlist.html @@ -0,0 +1,113 @@ +{{define "playlist.html"}} + + + + + + {{seoHead "Playlist – zuletzt gespielt" "Durchsuche alle zuletzt auf Landwelle gespielten Titel nach Song, Interpret, Datum und Uhrzeit." "/playlist" "website"}} + + + + + + + + + +{{template "public_header" .}} +
+
+ Landwelle Playlist – alle gespielten Titel auf einen Blick +
+

Landwelle Playlist

+

Finde heraus, welcher Titel wann auf Landwelle gelaufen ist – nach Song, Interpret, Datum oder Uhrzeit.

+
+
+ +
+
+
+ Playlist durchsuchen +

Welcher Song lief wann?

+

Die Suche aktualisiert sich während der Eingabe. Datum und Uhrzeit lassen sich zusätzlich eingrenzen.

+
+
+ +
+ + + + +
+
+ + {{if .Filtered}}Filter zurücksetzen{{end}} +
+
+
+ + +
+ +
+
+
+
Chronologisch nach Ausstrahlung

{{if .Filtered}}Gefundene Titel{{else}}Zuletzt auf Landwelle{{end}}

+

{{.Total}} {{if eq .Total 1}}Titel{{else}}Titel{{end}} · maximal 15 pro Seite

+
+ + {{if .Days}} +
+ {{range .Days}} +
+
{{.Weekday}}

{{.DateLabel}}

{{len .Entries}} {{if eq (len .Entries) 1}}Titel{{else}}Titel{{end}}
+
+ {{range .Entries}} +
+ + Cover zu {{.Artist}} – {{.Title}} +
{{.Artist}}

{{.Title}}

{{if .Album}}{{.Album}}{{end}}
+ Wünschen +
+ {{end}} +
+
+ {{end}} +
+ + {{if gt .TotalPages 1}} + + {{end}} + {{else}} +
♪

Keine passenden Titel gefunden

Ändere den Suchbegriff oder erweitere den gewählten Zeitraum.

{{if .Filtered}}Alle Titel anzeigen{{end}}
+ {{end}} +
+
+
+ +{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/program.html b/web/program.html new file mode 100644 index 0000000..83f705c --- /dev/null +++ b/web/program.html @@ -0,0 +1,106 @@ +{{define "program.html"}} + + + + + + {{seoHead "Programm" "Das Landwelle-Wochenprogramm von Montag bis Sonntag mit Sendungen, Stimmen und Sendezeiten." "/programm" "website"}} + + + + + + + + + + + + +{{template "public_header" .}} +
+
+
+ Sieben Tage Landwelle +

Dein Programm für die ganze Woche

+

Von Montag bis Sonntag: Musik, regionale Themen und gute Begleitung durch deinen Tag.

+
+
+ +
+
+
+
+ Heute ist {{.TodayName}} +

Was läuft bei Landwelle?

+

Wähle einfach deinen Tag und sieh sofort, welche Sendungen dich erwarten.

+
+ Stand {{.Updated}} +
+ + + +
+ {{range .Days}} +
+
Sendetag

{{.Name}}

{{len .Items}} Sendungen
+ {{if .Items}} +
+ {{range .Items}} +
+ + {{if .HasImageWatermark}}{{.ImageWatermarkLabel}}{{end}} +
+ {{.ProgramType}} +

{{.Show}}

+ {{.PresenterLabel}}{{if .PresenterIsAI}}✦ KI-Stimme{{end}} + {{if .Description}}

{{.Description}}

{{end}} +
+ {{if .Live}}● Jetzt live{{end}} +
+ {{end}} +
+ {{else}} +
♪

Für diesen Tag ist noch nichts eingetragen

Schau bald wieder vorbei – der Wochenplan wird laufend ergänzt.

+ {{end}} +
+ {{end}} +
+
+ + +
+ +
+
+
+
Durch den Tag mit Landwelle

Das erwartet dich im Programm

+
+
+
☀

Gut in den Tag

Musik, Wetter und das Wichtigste aus Niedersachsen.

+
♫

Mehr Musik

Bekannte Hits, Schlager, Oldies und neue Lieblingssongs.

+
⌖

Aus deiner Region

Nachrichten, Veranstaltungen und Geschichten von hier.

+
+
+
+
+{{template "public_footer" .}} +{{template "cookie_consent" .}} + + +{{end}} diff --git a/web/team.html b/web/team.html new file mode 100644 index 0000000..d28e9cb --- /dev/null +++ b/web/team.html @@ -0,0 +1,53 @@ +{{define "team.html"}} + + {{seoHead "Unser Team" "Lerne das Team hinter Landwelle Radio kennen: Moderation, Geschäftsführung, IT, Entwicklung, Marketing und Werbung." "/team" "profile"}} + + + + + +{{template "public_header" .}} +
+
Menschen hinter Landwelle

Unser Team

Mit Herz für Radio, Niedersachsen und die Geschichten aus unserer Region.

+ +
+
+
+

Gemeinsam für Landwelle

+

Unser Team bringt regionale Verbundenheit, gute Musik und aktuelle Informationen zusammen. Hinter Mikrofon, Redaktion und Technik arbeiten wir jeden Tag daran, Landwelle nahbar, verlässlich und abwechslungsreich zu gestalten.

+
Das Team von Landwelle Radio im Studio
Gemeinsam für Sound & Infos aus Niedersachsen.
+
+ +
+ Die Stimmen von Landwelle +

Lerne unser Team kennen

+

Klicke auf ein Teammitglied, um mehr über die Person und ihre Aufgabe bei Landwelle zu erfahren.

+
+ {{range .Members}} + + {{end}} +
+
+
+ + +
+ + {{range .Members}} + + {{end}} +
+{{template "public_footer" .}}{{template "cookie_consent" .}} +{{end}} diff --git a/web/traffic.html b/web/traffic.html new file mode 100644 index 0000000..d204fb4 --- /dev/null +++ b/web/traffic.html @@ -0,0 +1,14 @@ +{{define "traffic.html"}} + +{{seoHead "Verkehr & Blitzer Niedersachsen" "Aktuelle Verkehrsmeldungen und Blitzerhinweise für Niedersachsen auf Landwelle Radio." "/verkehr" "website"}} + +{{template "public_header" .}} +
+
Unterwegs in Niedersachsen

Verkehr & Blitzer

Staus, Sperrungen und aktuelle Hinweise auf einen Blick – damit du entspannter ans Ziel kommst.

+
+
Aktuelle Lage

Was ist auf den Straßen los?

Wechsle zwischen Verkehrsmeldungen und mobilen Kontrollen. Die Liste wird laufend aktualisiert.

+
Live-Daten werden geladen
+

Live-Daten werden geladen …

+
Hinweise zu den Datenquellen

Verkehrsmeldungen stammen von der Autobahn GmbH des Bundes. Für Bundes-, Landes- und Kreisstraßen lohnt zusätzlich ein Blick auf die VMZ Niedersachsen ↗.

Blitzermeldungen können sich kurzfristig ändern. Bitte halte dich unabhängig davon immer an die ausgeschilderte Geschwindigkeit.

+ +
{{template "public_footer" .}}{{template "cookie_consent" .}}{{end}} \ No newline at end of file diff --git a/wish_audio_v1534_test.go b/wish_audio_v1534_test.go new file mode 100644 index 0000000..20f3774 --- /dev/null +++ b/wish_audio_v1534_test.go @@ -0,0 +1,68 @@ +package main + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +func TestWishOutputFilenameUsesConfiguredTokens(t *testing.T) { + wish := ListenerWish{ID: "abc-123", Name: "Jens", Place: "Visselhövede", Artist: "ABBA", Song: "Waterloo"} + got := wishOutputFilename("wunsch-{{id}}-{{artist}}-{{song}}.mp3", wish) + if got != "wunsch-abc-123-ABBA-Waterloo.mp3" { + t.Fatalf("unexpected wish output filename %q", got) + } +} + +func TestWishOutputFilenameAddsMP3Suffix(t *testing.T) { + wish := ListenerWish{ID: "abc-123"} + if got := wishOutputFilename("musikwunsch-{{id}}", wish); got != "musikwunsch-abc-123.mp3" { + t.Fatalf("unexpected filename %q", got) + } +} + +func TestDefaultWishAudioSettingsAreProductionReady(t *testing.T) { + cfg := defaultRuntimeSettings("https://stream.example/listen/landwelle/radio.mp3").WishAutomation + if cfg.FileNamePattern != "musikwunsch-{{id}}.mp3" { + t.Fatalf("unexpected filename pattern %q", cfg.FileNamePattern) + } + if !cfg.DeleteLocalAfterUpload { + t.Fatal("successful wish FTP uploads should clean local MP3s by default") + } + if cfg.BackgroundVolume != -18 { + t.Fatalf("unexpected background volume %.1f", cfg.BackgroundVolume) + } +} + +func TestAudioWishesAdminTemplateContainsFullConfiguration(t *testing.T) { + body, err := os.ReadFile(filepath.Join("web", "admin", "ai-wishes.html")) + if err != nil { + t.Fatal(err) + } + text := string(body) + for _, want := range []string{ + `name="prompt"`, `name="model"`, `name="temperature"`, `name="voice_id"`, + `name="background_id"`, `name="tts_gain_db"`, `name="background_gain_db"`, + `name="remote_directory"`, `name="file_name_pattern"`, `name="delete_local_after_upload"`, + `name="ai_disclosure_enabled"`, + } { + if !strings.Contains(text, want) { + t.Fatalf("audio wishes template missing %s", want) + } + } +} + +func TestManualWishProductionUsesManualWorkflow(t *testing.T) { + body, err := os.ReadFile("admin.go") + if err != nil { + t.Fatal(err) + } + text := string(body) + if !strings.Contains(text, `a.wishAutomation.ProcessManual(ctx, wish)`) { + t.Fatal("manual wish production is not routed through ProcessManual") + } + if !strings.Contains(text, `wishSettings.Enabled && wishSettings.AutoProcessOnApprove`) { + t.Fatal("automatic approval must require both automation switches") + } +} diff --git a/wishes.go b/wishes.go new file mode 100644 index 0000000..42932c1 --- /dev/null +++ b/wishes.go @@ -0,0 +1,595 @@ +package main + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "html/template" + "log" + "net" + "net/http" + "net/url" + "os" + "path/filepath" + "strconv" + "strings" + "sync" + "time" +) + +const wishesPerPage = 10 + +type ListenerWish struct { + ID string `json:"id"` + Name string `json:"name"` + Place string `json:"place"` + Artist string `json:"artist,omitempty"` + Song string `json:"song,omitempty"` + Message string `json:"message"` + CreatedAt time.Time `json:"created_at"` + Status string `json:"status,omitempty"` + EditorialNote string `json:"editorial_note,omitempty"` + GeneratedText string `json:"generated_text,omitempty"` + AudioFile string `json:"audio_file,omitempty"` + RemotePath string `json:"remote_path,omitempty"` + ProcessingStatus string `json:"processing_status,omitempty"` + ProcessingError string `json:"processing_error,omitempty"` + ProcessedAt time.Time `json:"processed_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` +} + +func (w ListenerWish) DateLabel() string { + return w.CreatedAt.Local().Format("02.01.2006 · 15:04 Uhr") +} + +func (w ListenerWish) SongLabel() string { + parts := make([]string, 0, 2) + if strings.TrimSpace(w.Artist) != "" { + parts = append(parts, strings.TrimSpace(w.Artist)) + } + if strings.TrimSpace(w.Song) != "" { + parts = append(parts, strings.TrimSpace(w.Song)) + } + return strings.Join(parts, " – ") +} + +type WishForm struct { + Name string + Place string + Artist string + Song string + Message string +} + +type WishPageData struct { + StreamURL string + Entries []ListenerWish + Page int + Pages []int + Total int + TotalPage int + HasPrev bool + HasNext bool + PrevURL string + NextURL string + Success bool + Error string + Form WishForm +} + +type wishStore struct { + mu sync.RWMutex + path string + items []ListenerWish + db *postgresStore + onAdded func(ListenerWish) +} + +func newWishStore(databases ...*postgresStore) (*wishStore, error) { + stateDir := envOr("LANDWELLE_STATE_DIR", "/var/lib/landwelle") + path := envOr("LANDWELLE_WISHES_FILE", filepath.Join(stateDir, "wishes.json")) + var db *postgresStore + if len(databases) > 0 { + db = databases[0] + } + s := &wishStore{path: path, db: db} + if err := s.load(); err != nil { + return nil, err + } + return s, nil +} + +func (s *wishStore) load() error { + if s.db != nil && s.db.Enabled() { + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + var items []ListenerWish + q := `SELECT COALESCE(json_agg(json_build_object('id',id,'name',name,'place',place,'artist',artist,'song',song,'message',message,'created_at',created_at,'status',status,'editorial_note',editorial_note,'generated_text',generated_text,'audio_file',audio_file,'remote_path',remote_path,'processing_status',processing_status,'processing_error',processing_error,'processed_at',processed_at,'updated_at',updated_at) ORDER BY created_at DESC),'[]'::json)::text FROM landwelle.listener_wishes;` + if err := s.db.queryJSON(ctx, q, &items); err != nil { + return err + } + s.items = items + return nil + } + b, err := os.ReadFile(s.path) + if errors.Is(err, os.ErrNotExist) { + return nil + } + if err != nil { + return err + } + var items []ListenerWish + if err := json.Unmarshal(b, &items); err != nil { + return fmt.Errorf("Hörerwünsche lesen: %w", err) + } + for i := range items { + normalizeWish(&items[i]) + } + s.items = items + return nil +} + +func (s *wishStore) saveLocked() error { + if err := os.MkdirAll(filepath.Dir(s.path), 0o750); err != nil { + return err + } + b, err := json.MarshalIndent(s.items, "", " ") + if err != nil { + return err + } + tmp := s.path + ".new" + if err := os.WriteFile(tmp, append(b, '\n'), 0o640); err != nil { + return err + } + return os.Rename(tmp, s.path) +} + +func (s *wishStore) Add(item ListenerWish) error { + normalizeWish(&item) + if err := validateWish(item); err != nil { + return err + } + if item.ID == "" { + item.ID = randomID() + } + if item.CreatedAt.IsZero() { + item.CreatedAt = time.Now() + } + if item.Status == "" { + item.Status = "pending" + } + if s.db != nil && s.db.Enabled() { + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + q := `INSERT INTO landwelle.listener_wishes(id,name,place,artist,song,message,status,created_at) VALUES (` + sqlText(item.ID) + `,` + sqlText(item.Name) + `,` + sqlText(item.Place) + `,` + sqlText(item.Artist) + `,` + sqlText(item.Song) + `,` + sqlText(item.Message) + `,` + sqlText(item.Status) + `,` + sqlText(item.CreatedAt.UTC().Format(time.RFC3339)) + `::timestamptz);` + if _, err := s.db.exec(ctx, q); err != nil { + return err + } + if err := s.load(); err != nil { + return err + } + if s.onAdded != nil { + s.onAdded(item) + } + return nil + } + + s.mu.Lock() + defer s.mu.Unlock() + s.items = append([]ListenerWish{item}, s.items...) + if len(s.items) > 500 { + s.items = s.items[:500] + } + if err := s.saveLocked(); err != nil { + return err + } + if s.onAdded != nil { + s.onAdded(item) + } + return nil +} + +func (s *wishStore) Page(page, perPage int) ([]ListenerWish, int) { + if perPage <= 0 { + perPage = wishesPerPage + } + s.mu.RLock() + defer s.mu.RUnlock() + visible := make([]ListenerWish, 0, len(s.items)) + for _, item := range s.items { + if s.db == nil || !s.db.Enabled() || item.Status == "approved" { + visible = append(visible, item) + } + } + total := len(visible) + pages := maxWishInt(1, (total+perPage-1)/perPage) + if page < 1 { + page = 1 + } + if page > pages { + page = pages + } + start := (page - 1) * perPage + if start > total { + start = total + } + end := minWishInt(start+perPage, total) + return append([]ListenerWish(nil), visible[start:end]...), total +} + +func (s *wishStore) ListAll() []ListenerWish { + s.mu.RLock() + defer s.mu.RUnlock() + return append([]ListenerWish(nil), s.items...) +} +func (s *wishStore) Moderate(id, status, note string) error { + allowed := map[string]bool{"pending": true, "approved": true, "rejected": true, "archived": true} + if !allowed[status] { + return errors.New("ungültiger Status") + } + if s.db != nil && s.db.Enabled() { + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + q := `UPDATE landwelle.listener_wishes SET status=` + sqlText(status) + `,editorial_note=` + sqlText(note) + `,reviewed_at=now() WHERE id=` + sqlText(id) + `;` + if _, err := s.db.exec(ctx, q); err != nil { + return err + } + return s.load() + } + s.mu.Lock() + defer s.mu.Unlock() + for i := range s.items { + if s.items[i].ID == id { + s.items[i].Status = status + s.items[i].EditorialNote = note + return s.saveLocked() + } + } + return nil +} +func (s *wishStore) Get(id string) (ListenerWish, bool) { + s.mu.RLock() + defer s.mu.RUnlock() + for _, item := range s.items { + if item.ID == id { + return item, true + } + } + return ListenerWish{}, false +} +func (s *wishStore) AdminPage(page, perPage int) ([]ListenerWish, int) { + if perPage != 10 && perPage != 20 && perPage != 50 { + perPage = 20 + } + s.mu.RLock() + defer s.mu.RUnlock() + total := len(s.items) + pages := maxWishInt(1, (total+perPage-1)/perPage) + if page < 1 { + page = 1 + } + if page > pages { + page = pages + } + start := (page - 1) * perPage + if start > total { + start = total + } + end := minWishInt(start+perPage, total) + return append([]ListenerWish(nil), s.items[start:end]...), total +} +func (s *wishStore) Update(item ListenerWish) error { + normalizeWish(&item) + if err := validateWish(item); err != nil { + return err + } + if s.db != nil && s.db.Enabled() { + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + q := `UPDATE landwelle.listener_wishes SET name=` + sqlText(item.Name) + `,place=` + sqlText(item.Place) + `,artist=` + sqlText(item.Artist) + `,song=` + sqlText(item.Song) + `,message=` + sqlText(item.Message) + `,editorial_note=` + sqlText(item.EditorialNote) + `,updated_at=now() WHERE id=` + sqlText(item.ID) + `;` + if _, err := s.db.exec(ctx, q); err != nil { + return err + } + return s.load() + } + s.mu.Lock() + defer s.mu.Unlock() + for i := range s.items { + if s.items[i].ID == item.ID { + item.Status = s.items[i].Status + item.CreatedAt = s.items[i].CreatedAt + item.GeneratedText = s.items[i].GeneratedText + item.AudioFile = s.items[i].AudioFile + item.RemotePath = s.items[i].RemotePath + item.ProcessingStatus = s.items[i].ProcessingStatus + s.items[i] = item + return s.saveLocked() + } + } + return errors.New("Musikwunsch nicht gefunden") +} +func (s *wishStore) Delete(id string) error { + if s.db != nil && s.db.Enabled() { + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + if _, err := s.db.exec(ctx, `DELETE FROM landwelle.listener_wishes WHERE id=`+sqlText(id)+`;`); err != nil { + return err + } + return s.load() + } + s.mu.Lock() + defer s.mu.Unlock() + for i := range s.items { + if s.items[i].ID == id { + s.items = append(s.items[:i], s.items[i+1:]...) + return s.saveLocked() + } + } + return nil +} +func (s *wishStore) SetProcessing(id, status, processingError string) error { + return s.SetGenerated(id, "", "", "", status, processingError) +} +func (s *wishStore) SetGenerated(id, text, audio, remote, status, processingError string) error { + if s.db != nil && s.db.Enabled() { + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + sets := []string{`processing_status=` + sqlText(status), `processing_error=` + sqlText(processingError), `updated_at=now()`} + if text != "" { + sets = append(sets, `generated_text=`+sqlText(text)) + } + if audio != "" { + sets = append(sets, `audio_file=`+sqlText(audio)) + } + if remote != "" { + sets = append(sets, `remote_path=`+sqlText(remote)) + } + if status == "done" { + sets = append(sets, `processed_at=now()`) + } + if _, err := s.db.exec(ctx, `UPDATE landwelle.listener_wishes SET `+strings.Join(sets, ",")+` WHERE id=`+sqlText(id)+`;`); err != nil { + return err + } + return s.load() + } + s.mu.Lock() + defer s.mu.Unlock() + for i := range s.items { + if s.items[i].ID == id { + if text != "" { + s.items[i].GeneratedText = text + } + if audio != "" { + s.items[i].AudioFile = audio + } + if remote != "" { + s.items[i].RemotePath = remote + } + s.items[i].ProcessingStatus = status + s.items[i].ProcessingError = processingError + s.items[i].UpdatedAt = time.Now() + if status == "done" { + s.items[i].ProcessedAt = time.Now() + } + return s.saveLocked() + } + } + return errors.New("Musikwunsch nicht gefunden") +} + +func (s *wishStore) Path() string { + if s.db != nil && s.db.Enabled() { + return "PostgreSQL · landwelle.listener_wishes" + } + return s.path +} + +func normalizeWish(item *ListenerWish) { + item.ID = strings.TrimSpace(item.ID) + item.Name = compactText(item.Name) + item.Place = compactText(item.Place) + item.Artist = compactText(item.Artist) + item.Song = compactText(item.Song) + item.Message = compactText(item.Message) + item.Status = strings.TrimSpace(item.Status) + if item.Status == "" { + item.Status = "pending" + } +} + +func compactText(value string) string { + return strings.Join(strings.Fields(strings.TrimSpace(value)), " ") +} + +func validateWish(item ListenerWish) error { + switch { + case len([]rune(item.Name)) < 2: + return errors.New("bitte gib deinen Namen an") + case len([]rune(item.Name)) > 60: + return errors.New("der Name ist zu lang") + case len([]rune(item.Place)) < 2: + return errors.New("bitte gib deinen Ort an") + case len([]rune(item.Place)) > 80: + return errors.New("der Ort ist zu lang") + case len([]rune(item.Artist)) > 100 || len([]rune(item.Song)) > 100: + return errors.New("der Musikwunsch ist zu lang") + case len([]rune(item.Message)) < 5: + return errors.New("dein Grußtext ist noch zu kurz") + case len([]rune(item.Message)) > 300: + return errors.New("der Grußtext darf höchstens 300 Zeichen lang sein") + } + return nil +} + +type wishRateLimiter struct { + mu sync.Mutex + last map[string]time.Time +} + +func newWishRateLimiter() *wishRateLimiter { + return &wishRateLimiter{last: make(map[string]time.Time)} +} + +func (l *wishRateLimiter) Allow(r *http.Request) bool { + host, _, err := net.SplitHostPort(r.RemoteAddr) + if err != nil { + host = r.RemoteAddr + } + if forwarded := strings.TrimSpace(strings.Split(r.Header.Get("X-Forwarded-For"), ",")[0]); forwarded != "" { + host = forwarded + } + now := time.Now() + l.mu.Lock() + defer l.mu.Unlock() + if previous, ok := l.last[host]; ok && now.Sub(previous) < 45*time.Second { + return false + } + l.last[host] = now + for key, stamp := range l.last { + if now.Sub(stamp) > 24*time.Hour { + delete(l.last, key) + } + } + return true +} + +func wishPageHandler(tmplExecutor *template.Template, logger *log.Logger, streamURL string, store *wishStore) http.HandlerFunc { + limiter := newWishRateLimiter() + return func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/mitmachen" { + http.NotFound(w, r) + return + } + if r.Method != http.MethodGet && r.Method != http.MethodHead && r.Method != http.MethodPost { + w.Header().Set("Allow", "GET, HEAD, POST") + writeAPIError(w, http.StatusMethodNotAllowed, "method_not_allowed", "Diese HTTP-Methode ist nicht erlaubt.") + return + } + + page := parsePositiveInt(r.URL.Query().Get("page"), 1) + data := buildWishPageData(streamURL, store, page) + data.Success = r.URL.Query().Get("danke") == "1" + if r.Method == http.MethodGet || r.Method == http.MethodHead { + data.Form.Artist = compactText(r.URL.Query().Get("artist")) + data.Form.Song = compactText(r.URL.Query().Get("song")) + } + + if r.Method == http.MethodPost { + if err := r.ParseForm(); err != nil { + data.Error = "Die Eingabe konnte nicht gelesen werden." + renderWishPage(w, tmplExecutor, logger, data) + return + } + data.Form = WishForm{ + Name: compactText(r.FormValue("name")), Place: compactText(r.FormValue("place")), + Artist: compactText(r.FormValue("artist")), Song: compactText(r.FormValue("song")), + Message: compactText(r.FormValue("message")), + } + if r.FormValue("website") != "" { + http.Redirect(w, r, "/mitmachen?danke=1", http.StatusSeeOther) + return + } + if r.FormValue("publish_consent") != "on" { + data.Error = "Bitte bestätige, dass dein Gruß öffentlich angezeigt werden darf." + renderWishPage(w, tmplExecutor, logger, data) + return + } + item := ListenerWish{ + Name: data.Form.Name, Place: data.Form.Place, Artist: data.Form.Artist, + Song: data.Form.Song, Message: data.Form.Message, CreatedAt: time.Now(), + } + normalizeWish(&item) + if err := validateWish(item); err != nil { + data.Error = err.Error() + renderWishPage(w, tmplExecutor, logger, data) + return + } + if !limiter.Allow(r) { + data.Error = "Bitte warte kurz, bevor du einen weiteren Gruß sendest." + renderWishPage(w, tmplExecutor, logger, data) + return + } + if err := store.Add(item); err != nil { + data.Error = err.Error() + renderWishPage(w, tmplExecutor, logger, data) + return + } + http.Redirect(w, r, "/mitmachen?danke=1", http.StatusSeeOther) + return + } + + if r.Method == http.MethodHead { + w.WriteHeader(http.StatusOK) + return + } + renderWishPage(w, tmplExecutor, logger, data) + } +} + +func renderWishPage(w http.ResponseWriter, tmpl *template.Template, logger *log.Logger, data WishPageData) { + w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.Header().Set("Cache-Control", "no-store") + if err := tmpl.ExecuteTemplate(w, "mitmachen.html", data); err != nil { + logger.Printf("mitmachen template: %v", err) + } +} + +func buildWishPageData(streamURL string, store *wishStore, page int) WishPageData { + entries, total := store.Page(page, wishesPerPage) + totalPages := maxWishInt(1, (total+wishesPerPage-1)/wishesPerPage) + if page < 1 { + page = 1 + } + if page > totalPages { + page = totalPages + } + pages := make([]int, totalPages) + for i := range pages { + pages[i] = i + 1 + } + data := WishPageData{ + StreamURL: streamURL, Entries: entries, Page: page, Pages: pages, + Total: total, TotalPage: totalPages, HasPrev: page > 1, HasNext: page < totalPages, + } + if data.HasPrev { + data.PrevURL = wishPageURL(page - 1) + } + if data.HasNext { + data.NextURL = wishPageURL(page + 1) + } + return data +} + +func wishPageURL(page int) string { + values := url.Values{} + if page > 1 { + values.Set("page", strconv.Itoa(page)) + } + if encoded := values.Encode(); encoded != "" { + return "/mitmachen?" + encoded + } + return "/mitmachen" +} + +func parsePositiveInt(value string, fallback int) int { + n, err := strconv.Atoi(strings.TrimSpace(value)) + if err != nil || n < 1 { + return fallback + } + return n +} + +func minWishInt(a, b int) int { + if a < b { + return a + } + return b +} + +func maxWishInt(a, b int) int { + if a > b { + return a + } + return b +} diff --git a/wishes_test.go b/wishes_test.go new file mode 100644 index 0000000..0782a9d --- /dev/null +++ b/wishes_test.go @@ -0,0 +1,61 @@ +package main + +import ( + "path/filepath" + "testing" + "time" +) + +func TestWishStorePersistsAndPaginates(t *testing.T) { + path := filepath.Join(t.TempDir(), "wishes.json") + store := &wishStore{path: path} + for i := 0; i < 12; i++ { + if err := store.Add(ListenerWish{ + Name: "Hörer Test", + Place: "Visselhövede", + Artist: "Landwelle", + Song: "Testtitel", + Message: "Viele Grüße aus Niedersachsen.", + CreatedAt: time.Date(2026, 7, 15, 12, i, 0, 0, time.UTC), + }); err != nil { + t.Fatalf("add wish: %v", err) + } + } + + first, total := store.Page(1, 10) + if total != 12 || len(first) != 10 { + t.Fatalf("expected 12 total and 10 on first page, got %d and %d", total, len(first)) + } + second, _ := store.Page(2, 10) + if len(second) != 2 { + t.Fatalf("expected 2 on second page, got %d", len(second)) + } + + reloaded := &wishStore{path: path} + if err := reloaded.load(); err != nil { + t.Fatalf("reload wishes: %v", err) + } + entries, total := reloaded.Page(1, 10) + if total != 12 || len(entries) != 10 { + t.Fatalf("persisted pagination mismatch: %d / %d", total, len(entries)) + } +} + +func TestWishValidation(t *testing.T) { + item := ListenerWish{Name: "J", Place: "V", Message: "Hi"} + if err := validateWish(item); err == nil { + t.Fatal("expected validation error") + } +} + +func TestCurrentProgram(t *testing.T) { + store := &programStore{items: defaultProgram()} + now := time.Date(2026, 7, 15, 15, 30, 0, 0, time.Local) + item, ok := store.Current(now) + if !ok { + t.Fatal("expected a current program") + } + if item.Show != "Landwelle am Nachmittag" || item.Start != "14:00" || item.End != "18:00" { + t.Fatalf("unexpected current program: %#v", item) + } +} diff --git a/workflow.go b/workflow.go new file mode 100644 index 0000000..bf5932d --- /dev/null +++ b/workflow.go @@ -0,0 +1,522 @@ +package main + +import ( + "bufio" + "context" + "crypto/tls" + "encoding/base64" + "errors" + "fmt" + "html/template" + "io" + "mime" + "net" + "net/mail" + "net/smtp" + "os" + "path/filepath" + "strconv" + "strings" + "time" +) + +type SMTPSettings struct { + Enabled bool `json:"enabled"` + Host string `json:"host"` + Port int `json:"port"` + Username string `json:"username"` + Password string `json:"password"` + FromName string `json:"from_name"` + FromEmail string `json:"from_email"` + AdminEmail string `json:"admin_email"` + TLSMode string `json:"tls_mode"` +} + +type FTPSettings struct { + Enabled bool `json:"enabled"` + Host string `json:"host"` + Port int `json:"port"` + Username string `json:"username"` + Password string `json:"password"` + TLS bool `json:"tls"` + Passive bool `json:"passive"` + TimeoutSeconds int `json:"timeout_seconds"` +} + +type WishAutomationSettings struct { + Enabled bool `json:"enabled"` + Prompt string `json:"prompt"` + Model string `json:"model"` + Temperature float64 `json:"temperature"` + VoiceID string `json:"voice_id"` + BackgroundID string `json:"background_id"` + TTSVolume float64 `json:"tts_gain_db"` + BackgroundVolume float64 `json:"background_gain_db"` + RemoteDirectory string `json:"remote_directory"` + FileNamePattern string `json:"file_name_pattern"` + PublicBaseURL string `json:"public_base_url"` + AutoProcessOnApprove bool `json:"auto_process_on_approve"` + DeleteLocalAfterUpload bool `json:"delete_local_after_upload"` + DisableAIDisclosure bool `json:"disable_ai_disclosure"` +} + +type EmailTemplate struct { + Key string `json:"key"` + Name string `json:"name"` + Subject string `json:"subject"` + HTMLBody string `json:"html_body"` + TextBody string `json:"text_body"` + Enabled bool `json:"enabled"` +} + +type emailTemplateStore struct { + db *postgresStore + fallback map[string]EmailTemplate +} + +func newEmailTemplateStore(db *postgresStore) *emailTemplateStore { + t := EmailTemplate{Key: "new_wish_admin", Name: "Neuer Musikwunsch – Administrator", Subject: "Neuer Musikwunsch von {{name}} aus {{place}}", Enabled: true, + HTMLBody: `

Neuer Musikwunsch

Bei Landwelle ist ein neuer Musikwunsch eingegangen.

Name: {{name}}
Ort: {{place}}
Musikwunsch: {{artist}} – {{song}}

Gruß:
{{message}}

Musikwunsch prüfen und freigeben

`, + TextBody: `Neuer Musikwunsch von {{name}} aus {{place}}. Wunsch: {{artist}} – {{song}}. Gruß: {{message}}. Admin: {{admin_url}}`} + welcome := EmailTemplate{Key: "user_registered_welcome", Name: "Willkommen nach Registrierung", Subject: "Willkommen bei der Landwelle Community, {{display_name}}", Enabled: true, + HTMLBody: `
Landwelle Radio

Willkommen bei Landwelle

Hallo {{display_name}},

dein Benutzerkonto wurde erfolgreich angelegt.

Benutzername: {{username}}
E-Mail: {{email}}

Im Landwelle Forum kannst du dich über Musik, Sendungen, Niedersachsen, Technik und Rezepte austauschen.

Zum Landwelle Forum

Viele Grüße
dein Landwelle Team

`, + TextBody: `Hallo {{display_name}}, dein Landwelle-Benutzerkonto wurde erfolgreich angelegt. Benutzername: {{username}}. Forum: {{forum_url}}`} + eventConfirmation := EmailTemplate{Key: "event_submission_confirmation", Name: "Veranstaltungseinsendung – Bestätigung", Subject: "Danke für deine Veranstaltung: {{title}}", Enabled: true, + HTMLBody: `

Danke für deine Einsendung

Hallo {{contact_name}},

wir haben deine Veranstaltung {{title}} erhalten und schauen sie uns zeitnah an.

Termin: {{date_time}}
Ort: {{venue}}, {{postal_code}} {{city}}
Kategorie: {{category}}

Nach der Prüfung kann der Termin im Landwelle-Veranstaltungskalender erscheinen.

`, + TextBody: `Hallo {{contact_name}}, wir haben deine Veranstaltung „{{title}}“ erhalten. Termin: {{date_time}}. Ort: {{venue}}, {{postal_code}} {{city}}.`} + eventAdmin := EmailTemplate{Key: "event_submission_admin", Name: "Neue Veranstaltung – Redaktion", Subject: "Neue Veranstaltung: {{title}} am {{date_time}}", Enabled: true, + HTMLBody: `

Neue Veranstaltung

Titel: {{title}}
Kategorie: {{category}}
Termin: {{date_time}}
Ort: {{venue}}, {{postal_code}} {{city}}
Veranstalter: {{organizer}}

Beschreibung:
{{description}}

Kontakt: {{contact_name}} · {{contact_email}} · {{contact_phone}}
Webseite: {{website}}

`, + TextBody: `Neue Veranstaltung: {{title}}. Termin: {{date_time}}. Ort: {{venue}}, {{postal_code}} {{city}}. Kontakt: {{contact_name}}, {{contact_email}}.`} + advertisingConfirmation := EmailTemplate{Key: "advertising_inquiry_confirmation", Name: "Werbeanfrage – Bestätigung", Subject: "Deine Werbeanfrage bei Landwelle", Enabled: true, HTMLBody: `

Danke für deine Werbeanfrage

Hallo {{contact_name}},

wir haben die Anfrage für {{company}} erhalten.

Ausgewählte Möglichkeiten:
{{formats}}

Wir melden uns persönlich. Anfragenummer: {{inquiry_id}}

`, TextBody: `Hallo {{contact_name}}, wir haben die Werbeanfrage für {{company}} erhalten. Möglichkeiten: {{formats}}. Anfragenummer: {{inquiry_id}}.`} + advertisingAdmin := EmailTemplate{Key: "advertising_inquiry_admin", Name: "Werbeanfrage – Landwelle", Subject: "Neue Werbeanfrage: {{company}} · {{formats}}", Enabled: true, HTMLBody: `

Neue Werbeanfrage

Nr.: {{inquiry_id}}
Unternehmen: {{company}}
Kontakt: {{contact_name}} · {{email}} · {{phone}}

Formate: {{formats}}
Region: {{region}}
Budget: {{budget}}
Start: {{campaign_start}}
Laufzeit: {{duration}}

{{message}}

`, TextBody: `Neue Werbeanfrage {{inquiry_id}} von {{company}}. Kontakt: {{contact_name}}, {{email}}, {{phone}}. Formate: {{formats}}. Nachricht: {{message}}.`} + directoryConfirmation := EmailTemplate{Key: "directory_submission_confirmation", Name: "Branchenbuch – Bestätigung", Subject: "Dein Eintrag im Landwelle Branchenbuch", Enabled: true, HTMLBody: `

Danke für deinen Eintrag

Hallo {{contact_name}},

wir haben den kostenlosen Eintrag für {{name}} erhalten und prüfen ihn vor der Veröffentlichung.

Eintragsnummer: {{entry_id}}

`, TextBody: `Hallo {{contact_name}}, wir haben den Branchenbucheintrag für {{name}} erhalten. Eintragsnummer: {{entry_id}}.`} + directoryAdmin := EmailTemplate{Key: "directory_submission_admin", Name: "Branchenbuch – neuer Eintrag", Subject: "Neuer Branchenbucheintrag: {{name}} · {{category}}", Enabled: true, HTMLBody: `

Neuer Branchenbucheintrag

Nr.: {{entry_id}}
Name: {{name}}
Kategorie: {{category}}
Ort: {{postal_code}} {{city}}

{{description}}

Kontakt: {{contact_name}} · {{email}} · {{phone}}

`, TextBody: `Neuer Branchenbucheintrag {{entry_id}}: {{name}}, {{category}}, {{postal_code}} {{city}}. Kontakt: {{contact_name}}, {{email}}.`} + return &emailTemplateStore{db: db, fallback: map[string]EmailTemplate{t.Key: t, welcome.Key: welcome, eventConfirmation.Key: eventConfirmation, eventAdmin.Key: eventAdmin, advertisingConfirmation.Key: advertisingConfirmation, advertisingAdmin.Key: advertisingAdmin, directoryConfirmation.Key: directoryConfirmation, directoryAdmin.Key: directoryAdmin}} +} +func (s *emailTemplateStore) List() ([]EmailTemplate, error) { + if s.db != nil && s.db.Enabled() { + var out []EmailTemplate + q := `SELECT COALESCE(json_agg(json_build_object('key',template_key,'name',name,'subject',subject,'html_body',html_body,'text_body',text_body,'enabled',enabled) ORDER BY name),'[]'::json)::text FROM landwelle.email_templates;` + if err := s.db.queryJSON(context.Background(), q, &out); err != nil { + return nil, err + } + return out, nil + } + out := make([]EmailTemplate, 0, len(s.fallback)) + for _, v := range s.fallback { + out = append(out, v) + } + return out, nil +} +func (s *emailTemplateStore) Get(key string) (EmailTemplate, bool) { + items, err := s.List() + if err != nil { + return EmailTemplate{}, false + } + for _, v := range items { + if v.Key == key { + return v, true + } + } + return EmailTemplate{}, false +} +func (s *emailTemplateStore) Save(t EmailTemplate) error { + t.Key = strings.TrimSpace(t.Key) + t.Name = strings.TrimSpace(t.Name) + if t.Key == "" || t.Name == "" || strings.TrimSpace(t.Subject) == "" { + return errors.New("Template-Key, Name und Betreff werden benötigt") + } + if s.db != nil && s.db.Enabled() { + q := `INSERT INTO landwelle.email_templates(template_key,name,subject,html_body,text_body,enabled,updated_at) VALUES (` + sqlText(t.Key) + `,` + sqlText(t.Name) + `,` + sqlText(t.Subject) + `,` + sqlText(t.HTMLBody) + `,` + sqlText(t.TextBody) + `,` + sqlBool(t.Enabled) + `,now()) ON CONFLICT(template_key) DO UPDATE SET name=excluded.name,subject=excluded.subject,html_body=excluded.html_body,text_body=excluded.text_body,enabled=excluded.enabled,updated_at=now();` + _, err := s.db.exec(context.Background(), q) + return err + } + s.fallback[t.Key] = t + return nil +} + +type wishWorkflow struct { + settings *settingsStore + ai *aiService + wishes *wishStore + templates *emailTemplateStore +} + +func newWishWorkflow(settings *settingsStore, ai *aiService, wishes *wishStore, templates *emailTemplateStore) *wishWorkflow { + return &wishWorkflow{settings: settings, ai: ai, wishes: wishes, templates: templates} +} + +func (w *wishWorkflow) NotifyNewWish(ctx context.Context, wish ListenerWish) error { + cfg := w.settings.Get().SMTP + if !cfg.Enabled { + return nil + } + tpl, ok := w.templates.Get("new_wish_admin") + if !ok || !tpl.Enabled { + return nil + } + vars := map[string]string{"name": wish.Name, "place": wish.Place, "artist": wish.Artist, "song": wish.Song, "message": wish.Message, "admin_url": strings.TrimRight(w.settings.Get().WishAutomation.PublicBaseURL, "/") + "/admin/wishes"} + subject := renderTokens(tpl.Subject, vars) + html := renderTokens(tpl.HTMLBody, vars) + text := renderTokens(tpl.TextBody, vars) + return sendSMTP(ctx, cfg, cfg.AdminEmail, subject, html, text) +} +func wishDateToken(at time.Time) string { + return at.In(berlinLocation()).Format("2006-01-02") +} + +func wishOutputFilenameAt(pattern string, wish ListenerWish, at time.Time) string { + pattern = strings.TrimSpace(pattern) + if pattern == "" { + pattern = "musikwunsch-{{id}}.mp3" + } + vars := map[string]string{ + "id": wish.ID, + "name": wish.Name, + "place": wish.Place, + "artist": wish.Artist, + "song": wish.Song, + "datum": wishDateToken(at), + } + out := renderTokens(pattern, vars) + out = filepath.Base(strings.TrimSpace(out)) + if out == "." || out == "" { + out = "musikwunsch-" + wish.ID + ".mp3" + } + // Keep the configured structure, but prevent path/control characters in FTP filenames. + replacer := strings.NewReplacer("/", "-", "\\\\", "-", "\\x00", "") + out = replacer.Replace(out) + if !strings.HasSuffix(strings.ToLower(out), ".mp3") { + out += ".mp3" + } + return out +} + +func wishOutputFilename(pattern string, wish ListenerWish) string { + return wishOutputFilenameAt(pattern, wish, time.Now()) +} + +func (w *wishWorkflow) Process(ctx context.Context, wish ListenerWish) (ListenerWish, error) { + return w.process(ctx, wish, true) +} + +func (w *wishWorkflow) ProcessManual(ctx context.Context, wish ListenerWish) (ListenerWish, error) { + return w.process(ctx, wish, false) +} + +func (w *wishWorkflow) process(ctx context.Context, wish ListenerWish, requireEnabled bool) (ListenerWish, error) { + cfg := w.settings.Get() + wishCfg := cfg.WishAutomation + if requireEnabled && !wishCfg.Enabled { + return wish, errors.New("Musikwunsch-Automation ist deaktiviert") + } + if strings.TrimSpace(wishCfg.VoiceID) == "" { + return wish, errors.New("keine ElevenLabs Voice ID für Musikwünsche konfiguriert") + } + _ = w.wishes.SetProcessing(wish.ID, "processing", "") + source := fmt.Sprintf("Name: %s\nOrt: %s\nInterpret: %s\nTitel: %s\nGruß: %s", wish.Name, wish.Place, wish.Artist, wish.Song, wish.Message) + prompt := wishCfg.Prompt + if strings.TrimSpace(prompt) == "" { + prompt = "Formuliere eine natürliche, freundliche Radio-Anmoderation für diesen Musikwunsch. Verwende nur die gelieferten Fakten. Der Text soll 20 bis 35 Sekunden lang sein und direkt sprechbar sein." + } + generated, err := w.ai.GenerateText(ctx, prompt, source) + if err != nil { + _ = w.wishes.SetProcessing(wish.ID, "error", err.Error()) + return wish, err + } + audio, err := w.ai.GenerateSpeechWithDisclosure(ctx, generated, wishCfg.VoiceID, !wishCfg.DisableAIDisclosure) + if err != nil { + _ = w.wishes.SetGenerated(wish.ID, generated, "", "", "error", err.Error()) + return wish, err + } + local, ok := w.ai.AudioPath(audio) + if !ok { + return wish, errors.New("erzeugte MP3-Datei wurde nicht gefunden") + } + outputName := wishOutputFilename(wishCfg.FileNamePattern, wish) + remote := strings.TrimRight(wishCfg.RemoteDirectory, "/") + "/" + outputName + if cfg.FTP.Enabled { + if err := uploadFTP(ctx, cfg.FTP, local, remote); err != nil { + _ = w.wishes.SetGenerated(wish.ID, generated, audio, remote, "error", err.Error()) + return wish, err + } + if wishCfg.DeleteLocalAfterUpload { + _ = os.Remove(local) + } + } + if err := w.wishes.SetGenerated(wish.ID, generated, audio, remote, "done", ""); err != nil { + return wish, err + } + updated, _ := w.wishes.Get(wish.ID) + return updated, nil +} +func renderTokens(s string, vars map[string]string) string { + for k, v := range vars { + s = strings.ReplaceAll(s, "{{"+k+"}}", v) + } + return s +} + +type SMTPAttachment struct { + Filename string + ContentType string + Data []byte +} + +func sendSMTPWithAttachments(ctx context.Context, c SMTPSettings, to, subject, htmlBody, textBody string, attachments []SMTPAttachment) error { + if len(attachments) == 0 { + return sendSMTP(ctx, c, to, subject, htmlBody, textBody) + } + if _, err := mail.ParseAddress(to); err != nil { + return fmt.Errorf("Empfängeradresse ungültig: %w", err) + } + from := mail.Address{Name: c.FromName, Address: c.FromEmail} + mixed := "landwelle-mixed-" + strconv.FormatInt(time.Now().UnixNano(), 36) + alt := "landwelle-alt-" + strconv.FormatInt(time.Now().UnixNano(), 36) + var b strings.Builder + b.WriteString("From: " + from.String() + "\r\nTo: " + to + "\r\nSubject: " + mime.QEncoding.Encode("utf-8", subject) + "\r\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=" + mixed + "\r\n\r\n") + b.WriteString("--" + mixed + "\r\nContent-Type: multipart/alternative; boundary=" + alt + "\r\n\r\n") + b.WriteString("--" + alt + "\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n" + textBody + "\r\n") + b.WriteString("--" + alt + "\r\nContent-Type: text/html; charset=utf-8\r\n\r\n
" + htmlBody + "

Landwelle Radio · Sound & Infos aus Niedersachsen

\r\n--" + alt + "--\r\n") + for _, a := range attachments { + name := mime.QEncoding.Encode("utf-8", filepath.Base(a.Filename)) + ct := a.ContentType + if ct == "" { + ct = "application/octet-stream" + } + b.WriteString("--" + mixed + "\r\nContent-Type: " + ct + "; name=\"" + name + "\"\r\nContent-Disposition: attachment; filename=\"" + name + "\"\r\nContent-Transfer-Encoding: base64\r\n\r\n") + encoded := base64.StdEncoding.EncodeToString(a.Data) + for len(encoded) > 76 { + b.WriteString(encoded[:76] + "\r\n") + encoded = encoded[76:] + } + b.WriteString(encoded + "\r\n") + } + b.WriteString("--" + mixed + "--\r\n") + return sendSMTPMessage(ctx, c, to, b.String()) +} + +func sendSMTPMessage(ctx context.Context, c SMTPSettings, to, message string) error { + addr := net.JoinHostPort(c.Host, strconv.Itoa(c.Port)) + dialer := net.Dialer{Timeout: 15 * time.Second} + var conn net.Conn + var err error + if c.TLSMode == "implicit" { + conn, err = tls.DialWithDialer(&dialer, "tcp", addr, &tls.Config{ServerName: c.Host, MinVersion: tls.VersionTLS12}) + } else { + conn, err = dialer.DialContext(ctx, "tcp", addr) + } + if err != nil { + return err + } + client, err := smtp.NewClient(conn, c.Host) + if err != nil { + return err + } + defer client.Close() + if c.TLSMode == "starttls" { + if err := client.StartTLS(&tls.Config{ServerName: c.Host, MinVersion: tls.VersionTLS12}); err != nil { + return err + } + } + if c.Username != "" { + if err := client.Auth(smtp.PlainAuth("", c.Username, c.Password, c.Host)); err != nil { + return err + } + } + if err := client.Mail(c.FromEmail); err != nil { + return err + } + if err := client.Rcpt(to); err != nil { + return err + } + wc, err := client.Data() + if err != nil { + return err + } + if _, err = io.WriteString(wc, message); err != nil { + return err + } + if err = wc.Close(); err != nil { + return err + } + return client.Quit() +} + +func sendSMTP(ctx context.Context, c SMTPSettings, to, subject, htmlBody, textBody string) error { + if _, err := mail.ParseAddress(to); err != nil { + return fmt.Errorf("Empfängeradresse ungültig: %w", err) + } + from := mail.Address{Name: c.FromName, Address: c.FromEmail} + boundary := "landwelle-" + strconv.FormatInt(time.Now().UnixNano(), 36) + var b strings.Builder + b.WriteString("From: " + from.String() + "\r\nTo: " + to + "\r\nSubject: " + mime.QEncoding.Encode("utf-8", subject) + "\r\nMIME-Version: 1.0\r\nContent-Type: multipart/alternative; boundary=" + boundary + "\r\n\r\n") + b.WriteString("--" + boundary + "\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n" + textBody + "\r\n") + b.WriteString("--" + boundary + "\r\nContent-Type: text/html; charset=utf-8\r\n\r\n
\"\"" + htmlBody + "

Landwelle Radio · Sound & Infos aus Niedersachsen

\r\n--" + boundary + "--\r\n") + addr := net.JoinHostPort(c.Host, strconv.Itoa(c.Port)) + dialer := net.Dialer{Timeout: 15 * time.Second} + var conn net.Conn + var err error + if c.TLSMode == "implicit" { + conn, err = tls.DialWithDialer(&dialer, "tcp", addr, &tls.Config{ServerName: c.Host, MinVersion: tls.VersionTLS12}) + } else { + conn, err = dialer.DialContext(ctx, "tcp", addr) + } + if err != nil { + return err + } + client, err := smtp.NewClient(conn, c.Host) + if err != nil { + return err + } + defer client.Close() + if c.TLSMode == "starttls" { + if err := client.StartTLS(&tls.Config{ServerName: c.Host, MinVersion: tls.VersionTLS12}); err != nil { + return err + } + } + if c.Username != "" { + if err := client.Auth(smtp.PlainAuth("", c.Username, c.Password, c.Host)); err != nil { + return err + } + } + if err := client.Mail(c.FromEmail); err != nil { + return err + } + if err := client.Rcpt(to); err != nil { + return err + } + wc, err := client.Data() + if err != nil { + return err + } + if _, err = io.WriteString(wc, b.String()); err != nil { + return err + } + if err = wc.Close(); err != nil { + return err + } + return client.Quit() +} + +func uploadFTP(ctx context.Context, c FTPSettings, localPath, remotePath string) error { + timeout := time.Duration(c.TimeoutSeconds) * time.Second + if timeout <= 0 { + timeout = 20 * time.Second + } + d := net.Dialer{Timeout: timeout} + addr := net.JoinHostPort(c.Host, strconv.Itoa(c.Port)) + conn, err := d.DialContext(ctx, "tcp", addr) + if err != nil { + return err + } + defer conn.Close() + _ = conn.SetDeadline(time.Now().Add(timeout)) + r := bufio.NewReader(conn) + read := func() (int, string, error) { + line, err := r.ReadString('\n') + if err != nil { + return 0, "", err + } + if len(line) < 3 { + return 0, line, errors.New("ungültige FTP-Antwort") + } + code, _ := strconv.Atoi(line[:3]) + return code, strings.TrimSpace(line), nil + } + cmd := func(s string, okCodes ...int) (string, error) { + if _, err := fmt.Fprintf(conn, "%s\r\n", s); err != nil { + return "", err + } + code, line, err := read() + if err != nil { + return line, err + } + for _, ok := range okCodes { + if code == ok { + return line, nil + } + } + return line, fmt.Errorf("FTP %s: %s", s, line) + } + if _, _, err = read(); err != nil { + return err + } + if c.TLS { + if _, err = cmd("AUTH TLS", 234); err != nil { + return err + } + tc := tls.Client(conn, &tls.Config{ServerName: c.Host, MinVersion: tls.VersionTLS12}) + if err = tc.HandshakeContext(ctx); err != nil { + return err + } + conn = tc + r = bufio.NewReader(conn) + _, _ = cmd("PBSZ 0", 200) + _, _ = cmd("PROT P", 200) + } + if _, err = cmd("USER "+c.Username, 230, 331); err != nil { + return err + } + if _, err = cmd("PASS "+c.Password, 230); err != nil { + return err + } + if _, err = cmd("TYPE I", 200); err != nil { + return err + } + dir, file := filepath.ToSlash(filepath.Dir(remotePath)), filepath.Base(remotePath) + if dir != "." && dir != "/" { + parts := strings.Split(strings.Trim(dir, "/"), "/") + for _, part := range parts { + _, _ = cmd("MKD "+part, 257, 550) + if _, err = cmd("CWD "+part, 250); err != nil { + return err + } + } + } + line, err := cmd("PASV", 227) + if err != nil { + return err + } + l := strings.Index(line, "(") + rr := strings.Index(line, ")") + if l < 0 || rr < l { + return errors.New("PASV-Antwort ungültig") + } + nums := strings.Split(line[l+1:rr], ",") + if len(nums) != 6 { + return errors.New("PASV-Adresse ungültig") + } + p1, _ := strconv.Atoi(nums[4]) + p2, _ := strconv.Atoi(nums[5]) + dataAddr := strings.Join(nums[:4], ".") + ":" + strconv.Itoa(p1*256+p2) + dataConn, err := d.DialContext(ctx, "tcp", dataAddr) + if err != nil { + return err + } + defer dataConn.Close() + if _, err = fmt.Fprintf(conn, "STOR %s\r\n", file); err != nil { + return err + } + if code, msg, err := read(); err != nil || !(code == 125 || code == 150) { + return fmt.Errorf("FTP STOR: %s %v", msg, err) + } + f, err := os.Open(localPath) + if err != nil { + return err + } + _, err = io.Copy(dataConn, f) + _ = f.Close() + _ = dataConn.Close() + if err != nil { + return err + } + code, msg, err := read() + if err != nil || !(code == 226 || code == 250) { + return fmt.Errorf("FTP Abschluss: %s %v", msg, err) + } + _, _ = cmd("QUIT", 221) + return nil +} + +var _ = template.HTMLEscapeString