From f67cdb39ecf20e3aad06671205b886d0a5d9755b Mon Sep 17 00:00:00 2001 From: Phil Rzewski Date: Wed, 5 Jun 2024 18:35:42 -0700 Subject: [PATCH 1/3] Update electron-updater dependency to 6.2.1 --- apps/insiders/src/insiders-packager.ts | 2 +- apps/zui/package.json | 2 +- apps/zui/src/domain/updates/linux-updater.ts | 27 ++++------ .../zui/src/domain/updates/mac-win-updater.ts | 1 + yarn.lock | 51 ++++++++++--------- 5 files changed, 40 insertions(+), 43 deletions(-) diff --git a/apps/insiders/src/insiders-packager.ts b/apps/insiders/src/insiders-packager.ts index af46b8456b..86c6dc8f8a 100644 --- a/apps/insiders/src/insiders-packager.ts +++ b/apps/insiders/src/insiders-packager.ts @@ -40,7 +40,7 @@ export class InsidersPackager { const version = this.strategy === 'match-stable' ? this.stableVersion - : semver.inc(this.lastVersion, 'prerelease'); + : semver.inc(this.lastVersion, 'prerelease', 'insiders'); return version; } diff --git a/apps/zui/package.json b/apps/zui/package.json index 803b2f512e..96704a70fa 100644 --- a/apps/zui/package.json +++ b/apps/zui/package.json @@ -91,7 +91,7 @@ "electron-localshortcut": "^3.2.1", "electron-log": "5.0.0-beta.6", "electron-mock-ipc": "^0.3.12", - "electron-updater": "^4.3.8", + "electron-updater": "6.2.1", "esbuild": "^0.18.14", "eslint": "^8.11.0", "eslint-config-prettier": "^8.5.0", diff --git a/apps/zui/src/domain/updates/linux-updater.ts b/apps/zui/src/domain/updates/linux-updater.ts index 8d3203c726..a8982d0441 100644 --- a/apps/zui/src/domain/updates/linux-updater.ts +++ b/apps/zui/src/domain/updates/linux-updater.ts @@ -1,15 +1,19 @@ -import {app, shell} from "electron" -import fetch from "node-fetch" +import {autoUpdater} from "electron-updater" +import {Updater} from "./types" import semver from "semver" +import {app, shell} from "electron" import env from "src/app/core/env" import links from "src/app/core/links" import pkg from "src/electron/pkg" -import {Updater} from "./types" -import {getMainObject} from "src/core/main" + +autoUpdater.autoDownload = false +autoUpdater.autoInstallOnAppQuit = false +autoUpdater.forceDevUpdateConfig = true export class LinuxUpdater implements Updater { async check() { - const latest = await this.latest() + const {updateInfo} = await autoUpdater.checkForUpdates() + const latest = updateInfo.version const current = app.getVersion() if (semver.lt(current, latest)) { return latest @@ -22,19 +26,6 @@ export class LinuxUpdater implements Updater { shell.openExternal(this.downloadUrl()) } - private async latest() { - const resp = await fetch(this.latestUrl()) - if (resp.status === 204) return app.getVersion() - const data = await resp.json() - return data.name - } - - private latestUrl() { - const repo = getMainObject().appMeta.repo - const platform = "darwin-x64" // If the mac version exists, the linux does too - return `https://update.electronjs.org/${repo}/${platform}/${app.getVersion()}` - } - private downloadUrl() { if (env.isInsiders) { return pkg.repository + "/releases/latest" diff --git a/apps/zui/src/domain/updates/mac-win-updater.ts b/apps/zui/src/domain/updates/mac-win-updater.ts index 9aab2156b1..194fa0fef7 100644 --- a/apps/zui/src/domain/updates/mac-win-updater.ts +++ b/apps/zui/src/domain/updates/mac-win-updater.ts @@ -6,6 +6,7 @@ import {getMainObject} from "src/core/main" autoUpdater.autoDownload = false autoUpdater.autoInstallOnAppQuit = false +autoUpdater.forceDevUpdateConfig = true export class MacWinUpdater implements Updater { async check() { diff --git a/yarn.lock b/yarn.lock index 04d1d2dbcb..654899a5e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5579,7 +5579,7 @@ __metadata: languageName: node linkType: hard -"@types/semver@npm:^7.3.3, @types/semver@npm:^7.3.4": +"@types/semver@npm:^7.3.3": version: 7.3.4 resolution: "@types/semver@npm:7.3.4" checksum: 577dc7f607fbf46cf185f61ba726e4cfecea41c4b17e55069e70a64b6cd92658f8286aa075a607303455658e87ed045d3d14c32a513c0eff381d64aecd7b72a7 @@ -7299,16 +7299,6 @@ __metadata: languageName: node linkType: hard -"builder-util-runtime@npm:8.7.3": - version: 8.7.3 - resolution: "builder-util-runtime@npm:8.7.3" - dependencies: - debug: ^4.3.2 - sax: ^1.2.4 - checksum: eaf55ffcbde90a65639d7e102626ea819d0c0e4b296984755dab8d9df2bd85c56fb586e536a175b9229477d7e122c8f553aa232827aa7e275b43274b87a6e3e5 - languageName: node - linkType: hard - "builder-util-runtime@npm:9.2.4": version: 9.2.4 resolution: "builder-util-runtime@npm:9.2.4" @@ -9219,18 +9209,19 @@ __metadata: languageName: node linkType: hard -"electron-updater@npm:^4.3.8": - version: 4.3.8 - resolution: "electron-updater@npm:4.3.8" +"electron-updater@npm:6.2.1": + version: 6.2.1 + resolution: "electron-updater@npm:6.2.1" dependencies: - "@types/semver": ^7.3.4 - builder-util-runtime: 8.7.3 - fs-extra: ^9.1.0 - js-yaml: ^4.0.0 - lazy-val: ^1.0.4 + builder-util-runtime: 9.2.4 + fs-extra: ^10.1.0 + js-yaml: ^4.1.0 + lazy-val: ^1.0.5 + lodash.escaperegexp: ^4.1.2 lodash.isequal: ^4.5.0 - semver: ^7.3.4 - checksum: 1814fe7c99eb6c1cb2251fc24eb62f51df716e44c891d5433e8e036a77ff2beec241249f7ba26b33a60cf134158c2160a74117dff7751b4d2e59c57e688ae17a + semver: ^7.3.8 + tiny-typed-emitter: ^2.1.0 + checksum: 92a064610a3c9df747dce9c3eccd69c48adb2c8b37b9d7c13d1c39f7e2a9ffaef4e909ab50e6973d557566bde6de7ec9c64e2cc3a2cdef18b3220c5d91333e1c languageName: node linkType: hard @@ -13287,7 +13278,7 @@ __metadata: languageName: node linkType: hard -"js-yaml@npm:4.1.0, js-yaml@npm:^4.0.0, js-yaml@npm:^4.1.0": +"js-yaml@npm:4.1.0, js-yaml@npm:^4.1.0": version: 4.1.0 resolution: "js-yaml@npm:4.1.0" dependencies: @@ -13759,6 +13750,13 @@ __metadata: languageName: node linkType: hard +"lodash.escaperegexp@npm:^4.1.2": + version: 4.1.2 + resolution: "lodash.escaperegexp@npm:4.1.2" + checksum: 6d99452b1cfd6073175a9b741a9b09ece159eac463f86f02ea3bee2e2092923fce812c8d2bf446309cc52d1d61bf9af51c8118b0d7421388e6cead7bd3798f0f + languageName: node + linkType: hard + "lodash.isequal@npm:^4.5.0": version: 4.5.0 resolution: "lodash.isequal@npm:4.5.0" @@ -18197,6 +18195,13 @@ __metadata: languageName: node linkType: hard +"tiny-typed-emitter@npm:^2.1.0": + version: 2.1.0 + resolution: "tiny-typed-emitter@npm:2.1.0" + checksum: 709bca410054e08df4dc29d5ea0916328bb2900d60245c6a743068ea223887d9fd2c945b6070eb20336275a557a36c2808e5c87d2ed4b60633458632be4a3e10 + languageName: node + linkType: hard + "tiny-warning@npm:^1.0.0, tiny-warning@npm:^1.0.3": version: 1.0.3 resolution: "tiny-warning@npm:1.0.3" @@ -19701,7 +19706,7 @@ __metadata: electron-localshortcut: ^3.2.1 electron-log: 5.0.0-beta.6 electron-mock-ipc: ^0.3.12 - electron-updater: ^4.3.8 + electron-updater: 6.2.1 esbuild: ^0.18.14 eslint: ^8.11.0 eslint-config-prettier: ^8.5.0 From 64d901252e1d6d4b2625edcd2603b0ff2490f39c Mon Sep 17 00:00:00 2001 From: Phil Rzewski Date: Wed, 5 Jun 2024 18:37:04 -0700 Subject: [PATCH 2/3] Add updater debug logging --- apps/zui/src/domain/updates/linux-updater.ts | 1 + apps/zui/src/domain/updates/mac-win-updater.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/apps/zui/src/domain/updates/linux-updater.ts b/apps/zui/src/domain/updates/linux-updater.ts index a8982d0441..be66fe2f76 100644 --- a/apps/zui/src/domain/updates/linux-updater.ts +++ b/apps/zui/src/domain/updates/linux-updater.ts @@ -13,6 +13,7 @@ autoUpdater.forceDevUpdateConfig = true export class LinuxUpdater implements Updater { async check() { const {updateInfo} = await autoUpdater.checkForUpdates() + console.log(updateInfo) const latest = updateInfo.version const current = app.getVersion() if (semver.lt(current, latest)) { diff --git a/apps/zui/src/domain/updates/mac-win-updater.ts b/apps/zui/src/domain/updates/mac-win-updater.ts index 194fa0fef7..0397415a57 100644 --- a/apps/zui/src/domain/updates/mac-win-updater.ts +++ b/apps/zui/src/domain/updates/mac-win-updater.ts @@ -11,6 +11,7 @@ autoUpdater.forceDevUpdateConfig = true export class MacWinUpdater implements Updater { async check() { const {updateInfo} = await autoUpdater.checkForUpdates() + console.log(updateInfo) const latest = updateInfo.version const current = app.getVersion() if (semver.lt(current, latest)) { From 2c65199bf4437f76dc12f55b6e1a1242e3cfafae Mon Sep 17 00:00:00 2001 From: Phil Rzewski Date: Fri, 7 Jun 2024 09:44:57 -0700 Subject: [PATCH 3/3] Revert "Add updater debug logging" This reverts commit 64d901252e1d6d4b2625edcd2603b0ff2490f39c. --- apps/zui/src/domain/updates/linux-updater.ts | 1 - apps/zui/src/domain/updates/mac-win-updater.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/apps/zui/src/domain/updates/linux-updater.ts b/apps/zui/src/domain/updates/linux-updater.ts index be66fe2f76..a8982d0441 100644 --- a/apps/zui/src/domain/updates/linux-updater.ts +++ b/apps/zui/src/domain/updates/linux-updater.ts @@ -13,7 +13,6 @@ autoUpdater.forceDevUpdateConfig = true export class LinuxUpdater implements Updater { async check() { const {updateInfo} = await autoUpdater.checkForUpdates() - console.log(updateInfo) const latest = updateInfo.version const current = app.getVersion() if (semver.lt(current, latest)) { diff --git a/apps/zui/src/domain/updates/mac-win-updater.ts b/apps/zui/src/domain/updates/mac-win-updater.ts index 0397415a57..194fa0fef7 100644 --- a/apps/zui/src/domain/updates/mac-win-updater.ts +++ b/apps/zui/src/domain/updates/mac-win-updater.ts @@ -11,7 +11,6 @@ autoUpdater.forceDevUpdateConfig = true export class MacWinUpdater implements Updater { async check() { const {updateInfo} = await autoUpdater.checkForUpdates() - console.log(updateInfo) const latest = updateInfo.version const current = app.getVersion() if (semver.lt(current, latest)) {