From 266fe5c500332a708618848258bacaba6507e34c Mon Sep 17 00:00:00 2001 From: Perry Mitchell Date: Sun, 31 Mar 2024 20:09:10 +0300 Subject: [PATCH 1/4] Upgrade electron-updater --- package-lock.json | 112 +++++++++++++++++++--------------------------- package.json | 2 +- 2 files changed, 48 insertions(+), 66 deletions(-) diff --git a/package-lock.json b/package-lock.json index 788f542e..f57cec28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "debounce-promise": "^3.1.2", "delayable-setinterval": "^0.1.1", "electron-is-dev": "^2.0.0", - "electron-updater": "^5.3.0", + "electron-updater": "^6.1.8", "env-paths": "^2.2.1", "eventemitter3": "^4.0.7", "execution-time": "^1.4.1", @@ -4289,11 +4289,6 @@ "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==", "dev": true }, - "node_modules/@types/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-D/2EJvAlCEtYFEYmmlGwbGXuK886HzyCc3nZX/tkFTQdEU8jZDAgiv08P162yB17y4ZXZoq7yFAnW4GDBb9Now==" - }, "node_modules/@types/serve-static": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.0.tgz", @@ -5864,9 +5859,9 @@ } }, "node_modules/builder-util-runtime": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.1.1.tgz", - "integrity": "sha512-azRhYLEoDvRDR8Dhis4JatELC/jUvYjm4cVSj7n9dauGTOM2eeNn9KS0z6YA6oDsjI1xphjNbY6PZZeHPzzqaw==", + "version": "9.2.3", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.3.tgz", + "integrity": "sha512-FGhkqXdFFZ5dNC4C+yuQB9ak311rpGAw+/ASz8ZdxwODCv1GGMWgLDeofRkdi0F3VCHQEWy/aXcJQozx2nOPiw==", "dependencies": { "debug": "^4.3.4", "sax": "^1.2.4" @@ -8380,25 +8375,24 @@ "dev": true }, "node_modules/electron-updater": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-5.3.0.tgz", - "integrity": "sha512-iKEr7yQBcvnQUPnSDYGSWC9t0eF2YbZWeYYYZzYxdl+HiRejXFENjYMnYjoOm2zxyD6Cr2JTHZhp9pqxiXuCOw==", + "version": "6.1.8", + "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.1.8.tgz", + "integrity": "sha512-hhOTfaFAd6wRHAfUaBhnAOYc+ymSGCWJLtFkw4xJqOvtpHmIdNHnXDV9m1MHC+A6q08Abx4Ykgyz/R5DGKNAMQ==", "dependencies": { - "@types/semver": "^7.3.6", - "builder-util-runtime": "9.1.1", - "fs-extra": "^10.0.0", + "builder-util-runtime": "9.2.3", + "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.5", - "typed-emitter": "^2.1.0" + "semver": "^7.3.8", + "tiny-typed-emitter": "^2.1.0" } }, "node_modules/electron-updater/node_modules/fs-extra": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", - "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -8434,9 +8428,9 @@ } }, "node_modules/electron-updater/node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "engines": { "node": ">= 10.0.0" } @@ -17217,7 +17211,7 @@ "version": "6.6.7", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", - "devOptional": true, + "dev": true, "dependencies": { "tslib": "^1.9.0" }, @@ -18735,6 +18729,11 @@ "integrity": "sha512-1Uhn/aqw5C6RI4KejVeTg6mIS7IqxnLJ8Mv2tV5rTc0qWobay7pDUz6Wi392Cnc8ak1H0F2cjoRzb2/AW4+Fvg==", "dev": true }, + "node_modules/tiny-typed-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz", + "integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==" + }, "node_modules/tiny-warning": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", @@ -18949,7 +18948,7 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "devOptional": true + "dev": true }, "node_modules/tunnel": { "version": "0.0.6", @@ -19005,14 +19004,6 @@ "node": ">= 0.6" } }, - "node_modules/typed-emitter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-2.1.0.tgz", - "integrity": "sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA==", - "optionalDependencies": { - "rxjs": "*" - } - }, "node_modules/typed-styles": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/typed-styles/-/typed-styles-0.0.7.tgz", @@ -23607,11 +23598,6 @@ "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==", "dev": true }, - "@types/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-D/2EJvAlCEtYFEYmmlGwbGXuK886HzyCc3nZX/tkFTQdEU8jZDAgiv08P162yB17y4ZXZoq7yFAnW4GDBb9Now==" - }, "@types/serve-static": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.0.tgz", @@ -24973,9 +24959,9 @@ } }, "builder-util-runtime": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.1.1.tgz", - "integrity": "sha512-azRhYLEoDvRDR8Dhis4JatELC/jUvYjm4cVSj7n9dauGTOM2eeNn9KS0z6YA6oDsjI1xphjNbY6PZZeHPzzqaw==", + "version": "9.2.3", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.3.tgz", + "integrity": "sha512-FGhkqXdFFZ5dNC4C+yuQB9ak311rpGAw+/ASz8ZdxwODCv1GGMWgLDeofRkdi0F3VCHQEWy/aXcJQozx2nOPiw==", "requires": { "debug": "^4.3.4", "sax": "^1.2.4" @@ -26971,25 +26957,24 @@ "dev": true }, "electron-updater": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-5.3.0.tgz", - "integrity": "sha512-iKEr7yQBcvnQUPnSDYGSWC9t0eF2YbZWeYYYZzYxdl+HiRejXFENjYMnYjoOm2zxyD6Cr2JTHZhp9pqxiXuCOw==", + "version": "6.1.8", + "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.1.8.tgz", + "integrity": "sha512-hhOTfaFAd6wRHAfUaBhnAOYc+ymSGCWJLtFkw4xJqOvtpHmIdNHnXDV9m1MHC+A6q08Abx4Ykgyz/R5DGKNAMQ==", "requires": { - "@types/semver": "^7.3.6", - "builder-util-runtime": "9.1.1", - "fs-extra": "^10.0.0", + "builder-util-runtime": "9.2.3", + "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.5", - "typed-emitter": "^2.1.0" + "semver": "^7.3.8", + "tiny-typed-emitter": "^2.1.0" }, "dependencies": { "fs-extra": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", - "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", "requires": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -27014,9 +26999,9 @@ } }, "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==" } } }, @@ -33513,7 +33498,7 @@ "version": "6.6.7", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", - "devOptional": true, + "dev": true, "requires": { "tslib": "^1.9.0" } @@ -34660,6 +34645,11 @@ "integrity": "sha512-1Uhn/aqw5C6RI4KejVeTg6mIS7IqxnLJ8Mv2tV5rTc0qWobay7pDUz6Wi392Cnc8ak1H0F2cjoRzb2/AW4+Fvg==", "dev": true }, + "tiny-typed-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz", + "integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==" + }, "tiny-warning": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", @@ -34824,7 +34814,7 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "devOptional": true + "dev": true }, "tunnel": { "version": "0.0.6", @@ -34862,14 +34852,6 @@ "mime-types": "~2.1.24" } }, - "typed-emitter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-2.1.0.tgz", - "integrity": "sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA==", - "requires": { - "rxjs": "*" - } - }, "typed-styles": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/typed-styles/-/typed-styles-0.0.7.tgz", diff --git a/package.json b/package.json index d51dbf6d..4f588e82 100644 --- a/package.json +++ b/package.json @@ -211,7 +211,7 @@ "debounce-promise": "^3.1.2", "delayable-setinterval": "^0.1.1", "electron-is-dev": "^2.0.0", - "electron-updater": "^5.3.0", + "electron-updater": "^6.1.8", "env-paths": "^2.2.1", "eventemitter3": "^4.0.7", "execution-time": "^1.4.1", From 4d7f2c98eb5534c8ec0dc817174dc6d26826212c Mon Sep 17 00:00:00 2001 From: Perry Mitchell Date: Sun, 31 Mar 2024 21:39:42 +0300 Subject: [PATCH 2/4] Add pre-release channel support for updates Fixes #1277 --- source/main/library/build.ts | 2 +- source/main/services/config.ts | 11 ++++++- source/main/services/update.ts | 4 +++ .../renderer/components/PreferencesDialog.tsx | 31 ++++++++++++++----- source/shared/i18n/translations/ca_es.json | 1 - source/shared/i18n/translations/de.json | 1 - source/shared/i18n/translations/en.json | 10 ++++-- source/shared/i18n/translations/es.json | 1 - source/shared/i18n/translations/fi.json | 1 - source/shared/i18n/translations/fr.json | 1 - source/shared/i18n/translations/it.json | 1 - source/shared/i18n/translations/ja.json | 1 - source/shared/i18n/translations/nl.json | 1 - source/shared/i18n/translations/pl.json | 1 - source/shared/i18n/translations/pt-br.json | 1 - source/shared/i18n/translations/ro.json | 1 - source/shared/i18n/translations/zh_cn.json | 1 - source/shared/symbols.ts | 1 + source/shared/types.ts | 1 + 19 files changed, 47 insertions(+), 25 deletions(-) diff --git a/source/main/library/build.ts b/source/main/library/build.ts index 0885aefc..b817b022 100644 --- a/source/main/library/build.ts +++ b/source/main/library/build.ts @@ -1,3 +1,3 @@ // This file updated automatically: changes made here will be overwritten! -export const VERSION = "2.26.1"; +export const VERSION = "2.26.4"; diff --git a/source/main/services/config.ts b/source/main/services/config.ts index 2ec4ccef..92ab728c 100644 --- a/source/main/services/config.ts +++ b/source/main/services/config.ts @@ -36,14 +36,23 @@ export async function getVaultSettings(sourceID: VaultSourceID): Promise { - // Run migrations + // Initialise config const storage = getConfigStorage(); const config = (await storage.getValues()) as unknown as Config; + // Run migrations const [updatedConfig, didMigrate] = runConfigMigrations(config); if (didMigrate) { logInfo("Detected config migration changes"); await storage.setValues(updatedConfig); } + // Fill empty config values + for (const key in DEFAULT_CONFIG) { + const configKey = key as keyof Config; + if (typeof config[configKey] === "undefined") { + // Fill value + await setConfigValue(configKey, DEFAULT_CONFIG[configKey]); + } + } // Initialise preferences const preferences = naiveClone(await getConfigValue("preferences")); for (const key in PREFERENCES_DEFAULT) { diff --git a/source/main/services/update.ts b/source/main/services/update.ts index 0d545e69..2cfe2588 100644 --- a/source/main/services/update.ts +++ b/source/main/services/update.ts @@ -8,6 +8,7 @@ import { clearDelayedInterval, setDelayedInterval } from "delayable-setinterval" import { getMainWindow } from "./windows"; import { logErr, logInfo, logWarn } from "../library/log"; import { fileExists } from "../library/file"; +import { getConfigValue } from "./config"; import { UpdateProgressInfo } from "../types"; const UPDATE_AUTO_CHECK = ms("30m"); @@ -80,6 +81,9 @@ async function checkForUpdateInternal() { __currentUpdate = null; __readyUpdate = null; __updateErrored = false; + const usePrerelease = await getConfigValue("prereleaseUpdates"); + logInfo(`Using pre-release channel for updates: ${usePrerelease ? "yes" : "no"}`); + autoUpdater.allowPrerelease = usePrerelease; autoUpdater.autoDownload = false; autoUpdater.setFeedURL({ provider: "github", diff --git a/source/renderer/components/PreferencesDialog.tsx b/source/renderer/components/PreferencesDialog.tsx index b821979d..47236bf8 100644 --- a/source/renderer/components/PreferencesDialog.tsx +++ b/source/renderer/components/PreferencesDialog.tsx @@ -26,6 +26,7 @@ const LOCK_VAULTS_TIME_MAX = ms("1d") / 1000; const PAGE_CONNECTIVITY = "connectivity"; const PAGE_GENERAL = "general"; const PAGE_SECURITY = "security"; +const PAGE_UPDATES = "updates"; const THEME_AUTO_NAME = "Auto (OS)"; const DialogFreeWidth = styled(Dialog)` @@ -252,6 +253,23 @@ export function PreferencesDialog() { ); + const pageUpdates = () => ( + <> + + +
+ + ) => setPreferences({ + ...naiveClone(preferences), + prereleaseUpdates: evt.target.checked + })} + /> + + + ); // Render return ( @@ -283,14 +301,10 @@ export function PreferencesDialog() { text={t("preferences.section.connectivity")} />