From ecec704e44145b6a12232089ac975efc65b26951 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Fri, 13 Jun 2025 20:19:28 +0100 Subject: [PATCH] fix: make /api/version endpoint respect channel query parameter - Add support for ?channel=stable or ?channel=rc query parameter to /api/version - This enables frontend channel switching preview functionality - Aligns /api/version behavior with /api/updates/check endpoint - Fixes issue where channel switching in settings UI didn't work properly --- server/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/index.js b/server/index.js index aa048b4f5..1c6caf0ab 100644 --- a/server/index.js +++ b/server/index.js @@ -741,10 +741,13 @@ app.get('/api/version', async (req, res) => { let updateAvailable = false; try { - // Try to check for updates, but don't fail if it doesn't work - const updateInfo = await updateManager.checkForUpdates(); + // Check for channel override from query parameter (for preview functionality) + const channelOverride = req.query.channel; + + // Try to check for updates with optional channel override + const updateInfo = await updateManager.checkForUpdates(channelOverride); latestVersion = updateInfo.latestVersion || currentVersion; - updateAvailable = updateInfo.hasUpdate || false; + updateAvailable = updateInfo.updateAvailable || false; } catch (updateError) { // Log the error but continue with current version info console.error("[Version API] Error checking for updates:", updateError.message);