mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-26 22:57:32 +00:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user