Add secure video playback links using CDN signed URLs
Update database storage to use Bunny.net CDN and generate signed URLs for video playback, ensuring secure and time-limited access. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d7424866-83d1-4486-a212-ac12b4c7becf Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/d7424866-83d1-4486-a212-ac12b4c7becf/nodk9hG
This commit is contained in:
parent
6a20747a32
commit
65a86b9f65
@ -73,13 +73,16 @@ export class DatabaseStorage implements IStorage {
|
|||||||
const result = await db.execute(sqlQuery);
|
const result = await db.execute(sqlQuery);
|
||||||
console.log(`📊 DatabaseStorage: Found ${result.rows.length} videos (search: "${search || 'none'}")`);
|
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) => ({
|
return result.rows.map((row: any) => ({
|
||||||
id: row.id,
|
id: row.id,
|
||||||
title: row.title,
|
title: row.title,
|
||||||
description: row.description,
|
description: row.description,
|
||||||
thumbnailUrl: row.thumbnail_url,
|
thumbnailUrl: row.thumbnail_url,
|
||||||
videoUrl: row.video_url,
|
videoUrl: bunnyService.generateSignedUrl(row.id, 7200), // 2 hour expiration
|
||||||
duration: row.duration,
|
duration: row.duration,
|
||||||
views: row.views,
|
views: row.views,
|
||||||
category: row.category,
|
category: row.category,
|
||||||
@ -104,13 +107,16 @@ export class DatabaseStorage implements IStorage {
|
|||||||
|
|
||||||
if (result.rows.length === 0) return undefined;
|
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;
|
const row = result.rows[0] as any;
|
||||||
return {
|
return {
|
||||||
id: row.id,
|
id: row.id,
|
||||||
title: row.title,
|
title: row.title,
|
||||||
description: row.description,
|
description: row.description,
|
||||||
thumbnailUrl: row.thumbnail_url,
|
thumbnailUrl: row.thumbnail_url,
|
||||||
videoUrl: row.video_url,
|
videoUrl: bunnyService.generateSignedUrl(row.id, 7200), // 2 hour expiration
|
||||||
duration: row.duration,
|
duration: row.duration,
|
||||||
views: row.views,
|
views: row.views,
|
||||||
category: row.category,
|
category: row.category,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user