Skip to content

Commit

Permalink
[PM-7280] Check command args for disabled updater (#8613)
Browse files Browse the repository at this point in the history
* dont autoupdate on older OS and with args

* remove os release checking

* use dashes
  • Loading branch information
kspearrin authored Apr 11, 2024
1 parent 787ad64 commit 5939241
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/desktop/src/main/updater.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export class UpdaterMain {
process.platform === "win32" && !isWindowsStore() && !isWindowsPortable();
const macCanUpdate = process.platform === "darwin" && !isMacAppStore();
this.canUpdate =
process.env.ELECTRON_NO_UPDATER !== "1" &&
(linuxCanUpdate || windowsCanUpdate || macCanUpdate);
!this.userDisabledUpdates() && (linuxCanUpdate || windowsCanUpdate || macCanUpdate);
}

async init() {
Expand Down Expand Up @@ -144,4 +143,13 @@ export class UpdaterMain {
autoUpdater.autoDownload = true;
this.doingUpdateCheck = false;
}

private userDisabledUpdates(): boolean {
for (const arg of process.argv) {
if (arg != null && arg.toUpperCase().indexOf("--ELECTRON_NO_UPDATER=1") > -1) {
return true;
}
}
return process.env.ELECTRON_NO_UPDATER === "1";
}
}

0 comments on commit 5939241

Please sign in to comment.