Add ability to manually sync video updates from Bunny.net

Adds a POST endpoint `/api/bunny/sync` to trigger a manual synchronization of video data from Bunny.net, allowing for immediate updates to the video library.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 074b0e4c-6171-43bd-aa98-f9e04623ca14
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/074b0e4c-6171-43bd-aa98-f9e04623ca14/DVZN4Rp
This commit is contained in:
sebastjanartic 2025-08-30 14:36:48 +00:00
parent 0442820789
commit 971f3aadb0

View File

@ -176,6 +176,26 @@ export async function registerRoutes(app: Express): Promise<Server> {
}
});
// Manual sync endpoint to force refresh from Bunny.net
app.post("/api/bunny/sync", async (req, res) => {
try {
console.log('🔄 Manual video sync requested...');
// Import videoSyncService to trigger manual sync
const { videoSyncService } = await import('./videoSync');
await videoSyncService.initialize();
const videos = await storage.getVideos(1, 1000);
res.json({
message: "Video sync completed successfully",
totalVideos: videos.length,
timestamp: new Date().toISOString()
});
} catch (error) {
console.error("Error during manual sync:", error);
res.status(500).json({ message: "Failed to sync videos from Bunny.net" });
}
});
app.get("/api/videos", async (req, res) => {