revert(bundle): restore type==='rtsp' gate on stream fallback

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.
This commit is contained in:
Mitchell R 2026-05-21 09:39:54 +02:00
parent 281c0adf44
commit 28ff450d35
No known key found for this signature in database
2 changed files with 1 additions and 15 deletions

View file

@ -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
)
`);
},
];

View file

@ -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,