feat(video): media_type discriminator + local gallery video upload (server)

trek_photos gains a media_type column (migration) so the registry can hold video as well as images. A new POST :id/gallery/video endpoint accepts a video plus a client-captured poster (500 MB cap, video MIME/extension allowlist), stores the poster as the thumbnail, and the photo stream serves the poster for the thumbnail kind and the raw file (HTTP Range) for the original — without running the image thumbnailer on video bytes.
This commit is contained in:
Maurice
2026-06-30 10:31:23 +02:00
committed by Maurice
parent c7e4b2781b
commit 993d9bf713
7 changed files with 120 additions and 12 deletions
+16
View File
@@ -3107,6 +3107,22 @@ function runMigrations(db: Database.Database): void {
}
db.exec('UPDATE packing_items SET updated_at = COALESCE(updated_at, created_at, CURRENT_TIMESTAMP) WHERE updated_at IS NULL');
},
// Video support (#823): the trek_photos registry held only images. media_type
// discriminates image vs video so the gallery, lightbox and provider proxy can
// branch; duration_ms is optional metadata for the player. Additive — existing
// rows default to 'image'.
() => {
for (const stmt of [
"ALTER TABLE trek_photos ADD COLUMN media_type TEXT NOT NULL DEFAULT 'image'",
'ALTER TABLE trek_photos ADD COLUMN duration_ms INTEGER',
]) {
try {
db.exec(stmt);
} catch (err: any) {
if (!err.message?.includes('duplicate column name')) throw err;
}
}
},
];
if (currentVersion < migrations.length) {