From 971f3aadb0e2c86f0e156da388d9d2bb53782ec6 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Sat, 30 Aug 2025 14:36:48 +0000 Subject: [PATCH] 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 --- server/routes.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/server/routes.ts b/server/routes.ts index ee873cf..2222f6d 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -176,6 +176,26 @@ export async function registerRoutes(app: Express): Promise { } }); + // 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) => {