fix: integrate updater downgrade guard
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled

This commit is contained in:
2026-08-26 16:41:53 +08:00
parent 48a9189939
commit 2eaf0450b8
13 changed files with 276 additions and 47 deletions

View File

@@ -115,7 +115,9 @@ export class AppUpdater extends EventEmitter {
// Set channel so electron-updater requests the correct yml filename.
// e.g. channel "alpha" → requests alpha-mac.yml, channel "latest" → requests latest-mac.yml
// The channel setter also enables downgrades, which automatic updates must never allow.
autoUpdater.channel = feed.channel;
autoUpdater.allowDowngrade = false;
if (feed.url) {
autoUpdater.setFeedURL({
@@ -334,6 +336,7 @@ export class AppUpdater extends EventEmitter {
*/
setChannel(channel: 'stable' | 'beta' | 'dev'): void {
autoUpdater.channel = channel;
autoUpdater.allowDowngrade = false;
}
/**