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
This commit is contained in:
rcourtman
2025-06-13 20:19:28 +01:00
parent f7d6be8b24
commit ecec704e44
+6 -3
View File
@@ -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);