fix(diashow): open SSE on mount; raise upload rate 10→100/hour

diashow only subscribed to SSE events but never called connectSse(), so a
kiosk/projector opening /diashow directly (not via /feed) never opened the
EventSource — the showcase display got a one-time /feed snapshot and no live
updates, showing "Noch keine Beiträge" forever when turned on before any
photos. Open the stream in onMount (idempotent) and close it in onDestroy,
mirroring the feed page.

Raise the default upload_rate_per_hour from 10 to 100 (migration 015, scoped
to installs still on the old default so admin overrides are preserved). Guests
routinely upload bursts of 10-20 photos; the old default throttled the first
burst. Also update the code fallback and the test-mode reseed.

Both verified end-to-end against the docker test stack.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-07-18 17:29:08 +02:00
parent 3654aca18b
commit 3c3a7d0082
6 changed files with 26 additions and 5 deletions

View File

@@ -5,7 +5,7 @@
import { getToken } from '$lib/auth';
import { showBottomNav } from '$lib/ui-store';
import { dataMode, pickMediaUrl } from '$lib/data-mode-store';
import { onSseEvent } from '$lib/sse';
import { connectSse, disconnectSse, onSseEvent } from '$lib/sse';
import { SlideQueue } from '$lib/diashow/queue';
import { transitions, findTransition } from '$lib/diashow/transitions';
import { acquireWakeLock, releaseWakeLock } from '$lib/diashow/wakelock';
@@ -233,6 +233,13 @@
unsubs.push(onSseEvent('upload-deleted', handleUploadDeleted));
unsubs.push(onSseEvent('user-hidden', handleUserHidden));
unsubs.push(onSseEvent('feed-delta', handleFeedDelta));
// Open the stream ourselves — a kiosk/projector loads /diashow directly (never
// via /feed), so we can't rely on another page having opened the singleton
// EventSource. Without this the show only ever gets its one-time /feed snapshot
// and never receives live `upload-processed` events. connectSse() is idempotent
// (no-ops if the feed page already opened it). Subscriptions are registered above
// first so no early event is missed.
connectSse();
void loadInitial();
});
@@ -243,6 +250,7 @@
if (processedDebounce) clearTimeout(processedDebounce);
void releaseWakeLock();
for (const unsub of unsubs) unsub();
disconnectSse();
});
</script>