diff --git a/server/storage.ts b/server/storage.ts index 7e306cc..6cf0873 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -73,13 +73,16 @@ export class DatabaseStorage implements IStorage { const result = await db.execute(sqlQuery); console.log(`📊 DatabaseStorage: Found ${result.rows.length} videos (search: "${search || 'none'}")`); - // Transform database rows to Video objects + // Import Bunny service for signed URLs + const { bunnyService } = await import('./bunny'); + + // Transform database rows to Video objects with signed URLs return result.rows.map((row: any) => ({ id: row.id, title: row.title, description: row.description, thumbnailUrl: row.thumbnail_url, - videoUrl: row.video_url, + videoUrl: bunnyService.generateSignedUrl(row.id, 7200), // 2 hour expiration duration: row.duration, views: row.views, category: row.category, @@ -104,13 +107,16 @@ export class DatabaseStorage implements IStorage { if (result.rows.length === 0) return undefined; + // Import Bunny service for signed URLs + const { bunnyService } = await import('./bunny'); + const row = result.rows[0] as any; return { id: row.id, title: row.title, description: row.description, thumbnailUrl: row.thumbnail_url, - videoUrl: row.video_url, + videoUrl: bunnyService.generateSignedUrl(row.id, 7200), // 2 hour expiration duration: row.duration, views: row.views, category: row.category,