From 28ff450d35fc63c36897e512662dee0e4e742a4a Mon Sep 17 00:00:00 2001 From: Mitchell R Date: Thu, 21 May 2026 09:39:54 +0200 Subject: [PATCH] revert(bundle): restore type==='rtsp' gate on stream fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ONVIF cams legitimately have multiple streams (main+sub) stored in camera_streams. Dropping the type gate synthesized a single "main" row for ONVIF cams that lacked rows, hiding the multi-stream design the kiosk's pick_stream relies on (area >= 0.2 → main, else sub). The "(no stream)" symptom is a partial-import bug to chase separately; the bundle fallback is for single-URL RTSP cams only. Also drop the backfill migration that did the same insert at the DB layer. --- server/src/plugins/service-store/migrations.ts | 14 -------------- server/src/shared/bundle.ts | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/server/src/plugins/service-store/migrations.ts b/server/src/plugins/service-store/migrations.ts index c4aac33..283fb11 100644 --- a/server/src/plugins/service-store/migrations.ts +++ b/server/src/plugins/service-store/migrations.ts @@ -867,18 +867,4 @@ export const MIGRATIONS: readonly MigrationEntry[] = [ addColumnIfNotExists(db, "displays", "actual_power_state_at", "TEXT"); }, - // Backfill any camera type with a direct RTSP URL. Earlier backfill only - // covered type=rtsp, but ONVIF imports can also retain rtsp_url. - (db: DatabaseSync) => { - db.exec(` - INSERT INTO camera_streams (camera_id, role, name, rtsp_uri, is_discovered) - SELECT c.id, 'main', 'Main', c.rtsp_url, 0 - FROM cameras c - WHERE c.rtsp_url IS NOT NULL - AND c.rtsp_url != '' - AND NOT EXISTS ( - SELECT 1 FROM camera_streams s WHERE s.camera_id = c.id - ) - `); - }, ]; diff --git a/server/src/shared/bundle.ts b/server/src/shared/bundle.ts index cb9cec6..c65a59f 100644 --- a/server/src/shared/bundle.ts +++ b/server/src/shared/bundle.ts @@ -209,7 +209,7 @@ export function generateBundle( const bundleCameras: BundleCamera[] = cameras.map((cam) => { const streams = repo.listCameraStreams(cam.id); const effectiveStreams = streams.length > 0 ? streams : ( - cam.rtsp_url + cam.type === "rtsp" && cam.rtsp_url ? [{ id: 0, role: "main" as const,