[eric] updates: first check reads the experimental toggle from disk, ending the prerelease self-downgrade ping-pong

This commit is contained in:
ciregenz
2026-08-10 17:55:10 -07:00
parent fb71f3b686
commit bceb407b56
2 changed files with 9 additions and 2 deletions
+7
View File
@@ -1866,6 +1866,13 @@ function setupAutoUpdater() {
autoUpdater.autoInstallOnAppQuit = true;
// Renderer pushes the user's experimental-updates setting via IPC right after settings load.
autoUpdater.allowPrerelease = false;
// The boot check below must not race that IPC push: with allowDowngrade on, a prerelease build checking while allowPrerelease is still false sees latest-stable as a valid target and silently self-downgrades, then upgrades again next boot (the 1.7.5 <-> 1.7.6-exp1 ping-pong). Read the toggle straight from disk so the first check already knows it.
try {
const onDisk = JSON.parse(fs.readFileSync(path.join(app.getPath('userData'), 'data', 'settings', 'settings.json'), 'utf8'));
autoUpdater.allowPrerelease = !!onDisk.allow_experimental_updates;
} catch (_) {
// Fresh install or unreadable settings: stays false, and a fresh install is never on a prerelease.
}
// Lets us un-ship a bad release: re-flip GH 'latest' to an older one and users hop back to it.
autoUpdater.allowDowngrade = true;
}
@@ -103,9 +103,9 @@ const SoftwareUpdateRow: React.FC<{ styles: SettingsStyles }> = ({ styles }) =>
<Typography sx={descSx}>
{updateStatus === 'checking' && 'Checking for updates…'}
{updateStatus === 'not-available' && 'You\'re on the latest version.'}
{updateStatus === 'available' && `Version ${availableVersion} is available.`}
{updateStatus === 'available' && (availableVersion ? `Version ${availableVersion} is available.` : 'An update is available.')}
{updateStatus === 'downloading' && `Downloading update… ${Math.round(downloadPercent)}%`}
{updateStatus === 'downloaded' && `Version ${availableVersion} is ready to install.`}
{updateStatus === 'downloaded' && (availableVersion ? `Version ${availableVersion} is ready to install.` : 'An update is ready to install.')}
{updateStatus === 'error' && (updateError || 'Update check failed.')}
{updateStatus === 'idle' && 'Check for new versions of OpenSwarm.'}
</Typography>