fix: exclude legacy Niedersachsen Hub events in Landwelle v1.5.76

* fix(events): exclude legacy tourism hub sources in events.go

* fix(events): exclude legacy tourism hub sources in admin_management.go

* test(events): prevent reintroduction of legacy tourism hub entries

* chore: bump Landwelle to v1.5.76

* chore: bump Landwelle to v1.5.76

* docs(events): clarify v1.5.76 external-event hardening and server checks

* docs(events): clarify v1.5.76 external-event hardening and server checks

* docs(events): clarify v1.5.76 external-event hardening and server checks

* docs: release notes for Landwelle v1.5.76

* fix(events): escape ILIKE percent signs inside fmt.Sprintf SQL

* test(events): normalize escaped SQL wildcards in fmt.Sprintf queries

* ci: compare container version to source instead of hardcoding 1.5.75
This commit is contained in:
OpenGenesis (MPL 2.0) authored and GitHub committed 2026-11-10 17:07:27 +01:00
1 parent 2ed47e77b5
commit fda6501439
10 files changed
+105 -16

No files matched your search

+3 -1
View File
@@ -98,7 +98,9 @@ jobs:
- name: Verify x64 container binary
run: |
docker image inspect landwelle-portal:x64-ci --format '{{.Architecture}}' | grep -qx amd64
docker run --rm --entrypoint /usr/local/bin/landwelle-portal landwelle-portal:x64-ci --version | grep -qx 'Landwelle v1.5.75'
expected_version="$(sed -nE 's/^[[:space:]]*applicationVersion[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/p' main.go | head -n1)"
test -n "$expected_version"
docker run --rm --entrypoint /usr/local/bin/landwelle-portal landwelle-portal:x64-ci --version | grep -Fx "Landwelle v$expected_version"
frontend-static:
name: JavaScript and deployment-script checks
runs-on: ubuntu-latest
+6
View File
@@ -1,3 +1,9 @@
## v1.5.76 – Externe Niedersachsen-Hub-Termine zuverlässig ausblenden
- Öffentliche Terminlisten, Startseitenrotation und redaktionelle Verwaltung schließen auch irrtümlich als eigene Einträge klassifizierte destination.one-/Niedersachsen-Hub-Quellen aus.
- Zusätzliche Regressionstests für alle Event-SQL-Filter und die Startseitenrotation.
- Bestehende importierte Datensätze bleiben als Historie erhalten; keine automatische Datenlöschung und keine neue Datenbankmigration.
- Betriebshinweis: Wenn die Live-Webseite weiterhin Hub-Termine zeigt, den aktiven /version-Endpunkt auf 1.5.76 und das Reverse-Proxy-Ziel kontrollieren.
## v1.5.75 – Umstellung des Serverprojekts auf Linux x64
- Neue Linux-x64-Produktionsbuilds (x86_64/Go amd64, GOAMD64=v1) für Portal, PostgreSQL-Migrator und Adminpass.
- Eigenständige Build-, Deployment- und Adminskripte für x64, mit Plattformkontrollen, Versionsprüfung und vorhandenem Rollback.
+2 -2
View File
@@ -1,6 +1,6 @@
# Landwelle Radio Portal
**Quellstand: Landwelle v1.5.75 – Linux x64 Migration (7. November 2026)**
**Quellstand: Landwelle v1.5.76 – Veranstaltungen ohne Niedersachsen Hub (10. November 2026)**
Landwelle ist ein Go-basiertes Radio- und Regionalportal mit öffentlicher Website, geschütztem Adminbereich, PostgreSQL-Datenbank, Radio-App-API und internen Produktionswerkzeugen. Die neue Zielplattform ist Linux x64 (x86_64/amd64). Der bisherige ARM64-Server läuft bis zur abgesicherten Umschaltung weiter.
@@ -136,7 +136,7 @@ curl -fsS http://127.0.0.1:2200/version
curl -fsS http://127.0.0.1:2200/ready
```
Erwartete Version: `Landwelle v1.5.75`.
Erwartete Version: `Landwelle v1.5.76`.
## Verbindliche Projektdokumente
+6 -6
View File
@@ -671,14 +671,14 @@ func (a *adminHandler) listChartYearEntries(ctx context.Context, year int) ([]Ch
func (a *adminHandler) countAdminEvents(ctx context.Context) (int, error) {
var count int
q := `SELECT count(*)::text FROM landwelle.event_submissions WHERE source_type IN ('submission','editorial') AND COALESCE(end_at,start_at)>=now()-interval '30 days';`
q := `SELECT count(*)::text FROM landwelle.event_submissions WHERE source_type IN ('submission','editorial') AND source_name NOT ILIKE '%destination.one%' AND source_name NOT ILIKE '%Niedersachsen Hub%' AND COALESCE(end_at,start_at)>=now()-interval '30 days';`
err := a.database.queryJSON(ctx, q, &count)
return count, err
}
func (a *adminHandler) listAdminEvents(ctx context.Context, page, perPage int) ([]AdminEventRow, error) {
var out []AdminEventRow
where := `source_type IN ('submission','editorial') AND COALESCE(end_at,start_at)>=now()-interval '30 days'`
where := `source_type IN ('submission','editorial') AND source_name NOT ILIKE '%destination.one%' AND source_name NOT ILIKE '%Niedersachsen Hub%' 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,
@@ -859,7 +859,7 @@ RETURNING c.id
imageSQL = ",image_path=" + sqlText(imagePath)
}
status := normalizeAdminEventStatus(r.FormValue("status"))
q := fmt.Sprintf(`UPDATE landwelle.event_submissions SET title=%s,category=%s,start_at=%s::timestamptz,end_at=%s,city=%s,venue=%s,postal_code=%s,organizer=%s,contact_name=%s,contact_email=%s,contact_phone=%s,website=%s,external_image_url=%s,description=%s,status=%s%s,updated_at=now() WHERE id=%d AND source_type IN ('submission','editorial') RETURNING id;`,
q := fmt.Sprintf(`UPDATE landwelle.event_submissions SET title=%s,category=%s,start_at=%s::timestamptz,end_at=%s,city=%s,venue=%s,postal_code=%s,organizer=%s,contact_name=%s,contact_email=%s,contact_phone=%s,website=%s,external_image_url=%s,description=%s,status=%s%s,updated_at=now() WHERE id=%d AND source_type IN ('submission','editorial') AND source_name NOT ILIKE '%%destination.one%%' AND source_name NOT ILIKE '%%Niedersachsen Hub%%' RETURNING id;`,
sqlText(title), sqlText(r.FormValue("category")), sqlText(startAt.Format(time.RFC3339)), endSQL, sqlText(city), sqlText(r.FormValue("venue")), sqlText(r.FormValue("postal_code")), sqlText(r.FormValue("organizer")), sqlText(r.FormValue("contact_name")), sqlText(r.FormValue("contact_email")), sqlText(r.FormValue("contact_phone")), sqlText(r.FormValue("website")), sqlText(r.FormValue("external_image_url")), sqlText(description), sqlText(status), imageSQL, id)
if _, err := a.database.exec(r.Context(), q); err != nil {
return err.Error()
@@ -884,7 +884,7 @@ RETURNING c.id
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')
WHERE id=%d AND source_type IN ('submission','editorial') AND source_name NOT ILIKE '%%destination.one%%' AND source_name NOT ILIKE '%%Niedersachsen Hub%%'
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 {
@@ -902,7 +902,7 @@ RETURNING id
a.audit(r.Context(), s, r, actionName, "event", id, summary, true)
return ""
case "delete":
deleted, err := a.database.exec(r.Context(), fmt.Sprintf("DELETE FROM landwelle.event_submissions WHERE id=%d AND source_type IN ('submission','editorial') RETURNING id;", id))
deleted, err := a.database.exec(r.Context(), fmt.Sprintf("DELETE FROM landwelle.event_submissions WHERE id=%d AND source_type IN ('submission','editorial') AND source_name NOT ILIKE '%%destination.one%%' AND source_name NOT ILIKE '%%Niedersachsen Hub%%' RETURNING id;", id))
if err != nil {
return err.Error()
}
@@ -914,7 +914,7 @@ RETURNING id
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 AND source_type IN ('submission','editorial') RETURNING id;", sqlText(status), id)); err != nil {
if _, err := a.database.exec(r.Context(), fmt.Sprintf("UPDATE landwelle.event_submissions SET status=%s,updated_at=now() WHERE id=%d AND source_type IN ('submission','editorial') AND source_name NOT ILIKE '%%destination.one%%' AND source_name NOT ILIKE '%%Niedersachsen Hub%%' 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)
+4 -1
View File
@@ -11,7 +11,7 @@ Unter `/admin/events` kann die Landwelle-Redaktion Termine anlegen, bearbeiten,
## Keine automatische Übernahme externer Veranstaltungskalender
Die ehemalige destination.one-/Niedersachsen-HUB-Anbindung und die zusätzlichen Tourismusseiten sind im Portal deaktiviert und aus dem Quellcode entfernt. Es gibt keine Import-Schaltflächen, Synchronisierungsjobs oder API-Zugangsdaten-Einstellungen mehr.
Aus Gründen der Datensicherheit löscht das Update keine bereits in PostgreSQL gespeicherten importierten Einträge. Die öffentlichen Veranstaltungsabfragen und die Adminliste filtern solche Datensätze aus. Die Navigation wird in Migration 0047 bereinigt.
Aus Gründen der Datensicherheit löscht das Update keine bereits in PostgreSQL gespeicherten importierten Einträge. Die öffentlichen Veranstaltungsabfragen und die Adminliste filtern solche Datensätze aus – sowohl anhand des Eintragstyps als auch zusätzlich anhand einer ehemaligen Hub-/destination.one-Quellenkennung, falls Altdaten irrtümlich als eigene Termine klassifiziert wurden. Die Navigation wird in Migration 0047 bereinigt.
## Favoriten
Eigene, veröffentlichte Termine können als Startseiten-Favorit markiert werden. Die bestehende Zufallsauswahl der bis zu drei Termine auf der Startseite bleibt bestehen; Fremddaten werden ausgeschlossen.
@@ -21,3 +21,6 @@ Die öffentliche Suche und Detailansicht laufen unter `/api/events/search` und `
## Release v1.5.72
Die früheren Datenbankmigrationen 0014 und 0046 bleiben aus Gründen der Migrationshistorie bestehen; nicht benötigte Tourismus-Datenbanktabellen werden nicht automatisch gelöscht. Migration 0047 entfernt nur den automatisch hinzugefügten Navigationseintrag.
## Live-Diagnose nach dem Umzug
Wenn trotz dieser Filter Hub-Termine auf landwelle.de angezeigt werden, zuerst die laufende Binärversion (`curl -fsS http://127.0.0.1:2200/version`) und die Proxy-Weiterleitung zur richtigen Serverinstanz überprüfen. Alte /opt/landwelle-Binaries oder Proxy-Ziele können auch bei korrekt vorliegendem x64-Quellcode weiterhin historische Seiten ausliefern.
+19
View File
@@ -0,0 +1,19 @@
# Landwelle v1.5.76 – Kein Niedersachsen Hub im Veranstaltungskalender
Die öffentliche Terminliste, die Startseitenrotation mit bis zu drei zufälligen eigenen Terminen, die Event-APIs und der Admin-Veranstaltungsbereich verwenden weiterhin nur redaktionell angelegte und selbst eingereichte Termine.
Zusätzliche Schutzmaßnahme: Als Altbestand erhaltene destination.one-/Niedersachsen-Hub-Einträge werden unabhängig von einer etwaigen fehlerhaften `source_type`-Zuordnung anhand ihrer Quellenkennung ausgeblendet. Das Update verändert oder löscht keine gespeicherten Termine.
Keine neue PostgreSQL-Migration. Die vorhandene Migration `0047_only_manual_events_navigation.sql` entfernt bei Bedarf den historischen Menüeintrag.
## Nach dem Update auf Linux x64
```bash
cd /home/users/slmmradio/www/landwelle.de
./scripts/build-x64.sh
sudo ./scripts/update-portal-on-x64.sh
curl -fsS http://127.0.0.1:2200/version
curl -fsS http://127.0.0.1:2200/ready
```
Erwartet: `Landwelle v1.5.76`. Danach die öffentliche Website erneut überprüfen. Bleiben Hub-Daten sichtbar, vergleiche die lokale Startseite (`curl -fsS http://127.0.0.1:2200/veranstaltungen`) mit `https://landwelle.de/veranstaltungen`: Falls sich die Ergebnisse unterscheiden, sind Reverse Proxy oder alte parallel laufende Instanzen zu prüfen. Das Portal-Binary wird unter `/opt/landwelle/landwelle-portal` installiert, nicht im Webroot.
+4 -4
View File
@@ -120,7 +120,7 @@ func (s *eventStore) Categories(ctx context.Context, includeInactive bool) ([]Ev
var out []EventCategory
q := `SELECT COALESCE(json_agg(json_build_object(
'id',c.id,'name',c.name,'sort_order',c.sort_order,'active',c.active,
'event_count',(SELECT count(*) FROM landwelle.event_submissions e WHERE e.source_type IN ('submission','editorial') AND lower(e.category)=lower(c.name))
'event_count',(SELECT count(*) FROM landwelle.event_submissions e WHERE e.source_type IN ('submission','editorial') AND source_name NOT ILIKE '%destination.one%' AND source_name NOT ILIKE '%Niedersachsen Hub%' AND lower(e.category)=lower(c.name))
) ORDER BY c.sort_order,c.name),'[]'::json)::text FROM landwelle.event_categories c` + where + `;`
if err := s.db.queryJSON(ctx, q, &out); err != nil {
return nil, err
@@ -145,7 +145,7 @@ func (s *eventStore) ListPublished(ctx context.Context, category string) ([]Cale
if s == nil || s.db == nil || !s.db.Enabled() {
return nil, nil
}
where := "status='published' AND source_type IN ('submission','editorial') AND start_at >= date_trunc('day', now()) - interval '14 days' AND CASE WHEN end_at IS NULL OR end_at <= start_at OR end_at - start_at > interval '31 days' THEN date_trunc('day',start_at)+interval '1 day' ELSE end_at END > now()"
where := "status='published' AND source_type IN ('submission','editorial') AND source_name NOT ILIKE '%destination.one%' AND source_name NOT ILIKE '%Niedersachsen Hub%' AND start_at >= date_trunc('day', now()) - interval '14 days' AND CASE WHEN end_at IS NULL OR end_at <= start_at OR end_at - start_at > interval '31 days' THEN date_trunc('day',start_at)+interval '1 day' ELSE end_at END > now()"
if strings.TrimSpace(category) != "" {
where += " AND category=" + sqlText(category)
}
@@ -170,7 +170,7 @@ func (s *eventStore) SearchPublished(ctx context.Context, query, category string
if limit <= 0 || limit > 100 {
limit = 50
}
where := "status='published' AND source_type IN ('submission','editorial') AND start_at >= date_trunc('day', now()) - interval '14 days' AND CASE WHEN end_at IS NULL OR end_at <= start_at OR end_at - start_at > interval '31 days' THEN date_trunc('day',start_at)+interval '1 day' ELSE end_at END > now()"
where := "status='published' AND source_type IN ('submission','editorial') AND source_name NOT ILIKE '%destination.one%' AND source_name NOT ILIKE '%Niedersachsen Hub%' AND start_at >= date_trunc('day', now()) - interval '14 days' AND CASE WHEN end_at IS NULL OR end_at <= start_at OR end_at - start_at > interval '31 days' THEN date_trunc('day',start_at)+interval '1 day' ELSE end_at END > now()"
if strings.TrimSpace(category) != "" {
where += " AND category=" + sqlText(strings.TrimSpace(category))
}
@@ -200,7 +200,7 @@ func (s *eventStore) GetPublished(ctx context.Context, id int64) (CalendarEvent,
'id',id,'title',title,'category',category,'start_at',start_at,'end_at',end_at,'venue',venue,'city',city,'postal_code',postal_code,
'organizer',organizer,'description',description,'website',website,'image_url',CASE WHEN image_path<>'' THEN '/event-media/'||image_path ELSE external_image_url END,
'source_name',source_name,'source_url',source_url,'homepage_favorite',homepage_favorite)),'[]'::json)::text FROM landwelle.event_submissions
WHERE id=` + strconv.FormatInt(id, 10) + ` AND source_type IN ('submission','editorial') AND status='published' AND CASE WHEN end_at IS NULL OR end_at <= start_at OR end_at - start_at > interval '31 days' THEN date_trunc('day',start_at)+interval '1 day' ELSE end_at END > now();`
WHERE id=` + strconv.FormatInt(id, 10) + ` AND source_type IN ('submission','editorial') AND source_name NOT ILIKE '%destination.one%' AND source_name NOT ILIKE '%Niedersachsen Hub%' AND status='published' AND CASE WHEN end_at IS NULL OR end_at <= start_at OR end_at - start_at > interval '31 days' THEN date_trunc('day',start_at)+interval '1 day' ELSE end_at END > now();`
var rows []CalendarEvent
if err := s.db.queryJSON(ctx, q, &rows); err != nil {
return CalendarEvent{}, false, err
+59
View File
@@ -0,0 +1,59 @@
package main
import (
"os"
"strings"
"testing"
)
// Even if legacy destination.one rows were accidentally marked editorial,
// none may enter public event pages, the homepage rotation or the admin list.
func TestEveryManualEventSQLFilterRejectsLegacyHubSources(t *testing.T) {
for _, path := range []string{"events.go", "admin_management.go"} {
data, err := os.ReadFile(path)
if err != nil {
t.Fatal(err)
}
count := 0
for index, line := range strings.Split(string(data), "\n") {
if !strings.Contains(line, "source_type IN ('submission','editorial')") {
continue
}
count++
// fmt.Sprintf queries escape percent signs as %% in Go source.
normalized := strings.ReplaceAll(line, "%%", "%")
if !strings.Contains(normalized, "source_name NOT ILIKE '%destination.one%'") ||
!strings.Contains(normalized, "source_name NOT ILIKE '%Niedersachsen Hub%'") {
t.Errorf("%s:%d: legacy hub exclusion missing from event filter", path, index+1)
}
}
if count < 2 {
t.Errorf("%s: expected event filtering in multiple public/admin queries, found %d", path, count)
}
}
}
func TestHomepageEventsContinueUsingCuratedPublishedStore(t *testing.T) {
data, err := os.ReadFile("main.go")
if err != nil {
t.Fatal(err)
}
source := string(data)
if !strings.Contains(source, "events.ListPublished(r.Context(), \"\")") {
t.Fatal("homepage no longer selects curated published events")
}
if !strings.Contains(source, "selectHomepageCalendarEvents(calendarEvents, 3,") {
t.Fatal("homepage no longer rotates three published events")
}
}
func TestFormerHubNavigationCleanupMigrationIsPresent(t *testing.T) {
data, err := os.ReadFile("migrations/0047_only_manual_events_navigation.sql")
if err != nil {
t.Fatal(err)
}
if !strings.Contains(string(data), "DELETE FROM navigation_items") ||
!strings.Contains(string(data), "/niedersachsen-entdecken") {
t.Fatal("old Niedersachsen hub navigation cleanup migration is missing")
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ const (
apiVersion = "v1"
apiContractVersion = "1.0.0"
applicationName = "Landwelle Radio"
applicationVersion = "1.5.75"
applicationVersion = "1.5.76"
)
var publicTemplateFiles = []string{
+1 -1
View File
@@ -181,7 +181,7 @@ func TestWeatherHelpers(t *testing.T) {
}
func TestApplicationVersion(t *testing.T) {
if applicationVersion != "1.5.75" {
if applicationVersion != "1.5.76" {
t.Fatalf("unexpected application version %q", applicationVersion)
}
}