| ... | @@ -700,12 +700,15 @@ function dispatchMenuAction(action: string): void { | ... | @@ -700,12 +700,15 @@ function dispatchMenuAction(action: string): void { |
| 700 | } | 700 | } |
| 701 | | 701 | |
| 702 | function handleCheckForUpdatesMenuClick(): void { | 702 | function handleCheckForUpdatesMenuClick(): void { |
| | 703 | const hasUpdateFeedConfig = |
| | 704 | readAppUpdateYml() !== null || Boolean(process.env.T3CODE_DESKTOP_MOCK_UPDATES); |
| 703 | const disabledReason = getAutoUpdateDisabledReason({ | 705 | const disabledReason = getAutoUpdateDisabledReason({ |
| 704 | isDevelopment, | 706 | isDevelopment, |
| 705 | isPackaged: app.isPackaged, | 707 | isPackaged: app.isPackaged, |
| 706 | platform: process.platform, | 708 | platform: process.platform, |
| 707 | appImage: process.env.APPIMAGE, | 709 | appImage: process.env.APPIMAGE, |
| 708 | disabledByEnv: process.env.T3CODE_DISABLE_AUTO_UPDATE === "1", | 710 | disabledByEnv: process.env.T3CODE_DISABLE_AUTO_UPDATE === "1", |
| | 711 | hasUpdateFeedConfig, |
| 709 | }); | 712 | }); |
| 710 | if (disabledReason) { | 713 | if (disabledReason) { |
| 711 | console.info("[desktop-updater] Manual update check requested, but updates are disabled."); | 714 | console.info("[desktop-updater] Manual update check requested, but updates are disabled."); |
| ... | @@ -942,6 +945,8 @@ function setUpdateState(patch: Partial<DesktopUpdateState>): void { | ... | @@ -942,6 +945,8 @@ function setUpdateState(patch: Partial<DesktopUpdateState>): void { |
| 942 | } | 945 | } |
| 943 | | 946 | |
| 944 | function shouldEnableAutoUpdates(): boolean { | 947 | function shouldEnableAutoUpdates(): boolean { |
| | 948 | const hasUpdateFeedConfig = |
| | 949 | readAppUpdateYml() !== null || Boolean(process.env.T3CODE_DESKTOP_MOCK_UPDATES); |
| 945 | return ( | 950 | return ( |
| 946 | getAutoUpdateDisabledReason({ | 951 | getAutoUpdateDisabledReason({ |
| 947 | isDevelopment, | 952 | isDevelopment, |
| ... | @@ -949,6 +954,7 @@ function shouldEnableAutoUpdates(): boolean { | ... | @@ -949,6 +954,7 @@ function shouldEnableAutoUpdates(): boolean { |
| 949 | platform: process.platform, | 954 | platform: process.platform, |
| 950 | appImage: process.env.APPIMAGE, | 955 | appImage: process.env.APPIMAGE, |
| 951 | disabledByEnv: process.env.T3CODE_DISABLE_AUTO_UPDATE === "1", | 956 | disabledByEnv: process.env.T3CODE_DISABLE_AUTO_UPDATE === "1", |
| | 957 | hasUpdateFeedConfig, |
| 952 | }) === null | 958 | }) === null |
| 953 | ); | 959 | ); |
| 954 | } | 960 | } |
| ... | @@ -1032,17 +1038,6 @@ async function installDownloadedUpdate(): Promise<{ accepted: boolean; completed | ... | @@ -1032,17 +1038,6 @@ async function installDownloadedUpdate(): Promise<{ accepted: boolean; completed |
| 1032 | } | 1038 | } |
| 1033 | | 1039 | |
| 1034 | function configureAutoUpdater(): void { | 1040 | function configureAutoUpdater(): void { |
| 1035 | const enabled = shouldEnableAutoUpdates(); | | |
| 1036 | setUpdateState({ | | |
| 1037 | ...createInitialDesktopUpdateState(app.getVersion(), desktopRuntimeInfo), | | |
| 1038 | enabled, | | |
| 1039 | status: enabled ? "idle" : "disabled", | | |
| 1040 | }); | | |
| 1041 | if (!enabled) { | | |
| 1042 | return; | | |
| 1043 | } | | |
| 1044 | updaterConfigured = true; | | |
| 1045 | | | |
| 1046 | const githubToken = | 1041 | const githubToken = |
| 1047 | process.env.T3CODE_DESKTOP_UPDATE_GITHUB_TOKEN?.trim() || process.env.GH_TOKEN?.trim() || ""; | 1042 | process.env.T3CODE_DESKTOP_UPDATE_GITHUB_TOKEN?.trim() || process.env.GH_TOKEN?.trim() || ""; |
| 1048 | if (githubToken) { | 1043 | if (githubToken) { |
| ... | @@ -1067,6 +1062,17 @@ function configureAutoUpdater(): void { | ... | @@ -1067,6 +1062,17 @@ function configureAutoUpdater(): void { |
| 1067 | }); | 1062 | }); |
| 1068 | } | 1063 | } |
| 1069 | | 1064 | |
| | 1065 | const enabled = shouldEnableAutoUpdates(); |
| | 1066 | setUpdateState({ |
| | 1067 | ...createInitialDesktopUpdateState(app.getVersion(), desktopRuntimeInfo), |
| | 1068 | enabled, |
| | 1069 | status: enabled ? "idle" : "disabled", |
| | 1070 | }); |
| | 1071 | if (!enabled) { |
| | 1072 | return; |
| | 1073 | } |
| | 1074 | updaterConfigured = true; |
| | 1075 | |
| 1070 | autoUpdater.autoDownload = false; | 1076 | autoUpdater.autoDownload = false; |
| 1071 | autoUpdater.autoInstallOnAppQuit = false; | 1077 | autoUpdater.autoInstallOnAppQuit = false; |
| 1072 | // Keep alpha branding, but force all installs onto the stable update track. | 1078 | // Keep alpha branding, but force all installs onto the stable update track. |