| @@ -54,6 +54,11 @@ import { isBackendReadinessAborted, waitForHttpReady } from "./backendReadiness" · 53 unmodified lines |
| 54 | import { showDesktopConfirmDialog } from "./confirmDialog"; | 54 | import { showDesktopConfirmDialog } from "./confirmDialog"; |
| 55 | import { resolveDesktopServerExposure } from "./serverExposure"; | 55 | import { resolveDesktopServerExposure } from "./serverExposure"; |
| 56 | import { syncShellEnvironment } from "./syncShellEnvironment"; | 56 | import { syncShellEnvironment } from "./syncShellEnvironment"; |
| | 57 | import { |
| | 58 | resolveDesktopUpdateChannel, |
| | 59 | shouldAcceptDesktopUpdateForCurrentVersion, |
| | 60 | shouldAllowDesktopPrereleaseUpdates, |
| | 61 | } from "./updateChannel"; |
| 57 | import { getAutoUpdateDisabledReason, shouldBroadcastDownloadProgress } from "./updateState"; | 62 | import { getAutoUpdateDisabledReason, shouldBroadcastDownloadProgress } from "./updateState"; |
| 58 | import { ServerListeningDetector } from "./serverListeningDetector"; | 63 | import { ServerListeningDetector } from "./serverListeningDetector"; |
| 59 | import { | 64 | import { |
| @@ -116,8 +121,6 @@ const APP_RUN_ID = Crypto.randomBytes(6).toString("hex"); · 56 unmodified lines |
| 116 | const SERVER_SETTINGS_PATH = Path.join(STATE_DIR, "settings.json"); | 121 | const SERVER_SETTINGS_PATH = Path.join(STATE_DIR, "settings.json"); |
| 117 | const AUTO_UPDATE_STARTUP_DELAY_MS = 15_000; | 122 | const AUTO_UPDATE_STARTUP_DELAY_MS = 15_000; |
| 118 | const AUTO_UPDATE_POLL_INTERVAL_MS = 4 * 60 * 60 * 1000; | 123 | const AUTO_UPDATE_POLL_INTERVAL_MS = 4 * 60 * 60 * 1000; |
| 119 | const DESKTOP_UPDATE_CHANNEL = "latest"; | | |
| 120 | const DESKTOP_UPDATE_ALLOW_PRERELEASE = false; | | |
| 121 | const DESKTOP_LOOPBACK_HOST = "127.0.0.1"; | 124 | const DESKTOP_LOOPBACK_HOST = "127.0.0.1"; |
| 122 | const DESKTOP_REQUIRED_PORT_PROBE_HOSTS = ["0.0.0.0", "::"] as const; | 125 | const DESKTOP_REQUIRED_PORT_PROBE_HOSTS = ["0.0.0.0", "::"] as const; |
| 123 | const TITLEBAR_HEIGHT = 40; | 126 | const TITLEBAR_HEIGHT = 40; |
| @@ -1168,6 +1171,9 @@ async function installDownloadedUpdate(): Promise<{ accepted: boolean; completed · 1044 unmodified lines |
| 1168 | } | 1171 | } |
| 1169 | | 1172 | |
| 1170 | function configureAutoUpdater(): void { | 1173 | function configureAutoUpdater(): void { |
| | 1174 | const currentVersion = app.getVersion(); |
| | 1175 | const updateChannel = resolveDesktopUpdateChannel(currentVersion); |
| | 1176 | const allowPrerelease = shouldAllowDesktopPrereleaseUpdates(currentVersion); |
| 1171 | const githubToken = | 1177 | const githubToken = |
| 1172 | process.env.T3CODE_DESKTOP_UPDATE_GITHUB_TOKEN?.trim() || process.env.GH_TOKEN?.trim() || ""; | 1178 | process.env.T3CODE_DESKTOP_UPDATE_GITHUB_TOKEN?.trim() || process.env.GH_TOKEN?.trim() || ""; |
| 1173 | if (githubToken) { | 1179 | if (githubToken) { |
| @@ -1205,12 +1211,14 @@ function configureAutoUpdater(): void { · 31 unmodified lines |
| 1205 | | 1211 | |
| 1206 | autoUpdater.autoDownload = false; | 1212 | autoUpdater.autoDownload = false; |
| 1207 | autoUpdater.autoInstallOnAppQuit = false; | 1213 | autoUpdater.autoInstallOnAppQuit = false; |
| 1208 | // Keep alpha branding, but force all installs onto the stable update track. | 1214 | autoUpdater.channel = updateChannel; |
| 1209 | autoUpdater.channel = DESKTOP_UPDATE_CHANNEL; | 1215 | autoUpdater.allowPrerelease = allowPrerelease; |
| 1210 | autoUpdater.allowPrerelease = DESKTOP_UPDATE_ALLOW_PRERELEASE; | | |
| 1211 | autoUpdater.allowDowngrade = false; | 1216 | autoUpdater.allowDowngrade = false; |
| 1212 | autoUpdater.disableDifferentialDownload = isArm64HostRunningIntelBuild(desktopRuntimeInfo); | 1217 | autoUpdater.disableDifferentialDownload = isArm64HostRunningIntelBuild(desktopRuntimeInfo); |
| 1213 | let lastLoggedDownloadMilestone = -1; | 1218 | let lastLoggedDownloadMilestone = -1; |
| | 1219 | console.info( |
| | 1220 | `[desktop-updater] Configured update channel=${updateChannel} currentVersion=${currentVersion} allowPrerelease=${allowPrerelease}.`, |
| | 1221 | ); |
| 1214 | | 1222 | |
| 1215 | if (isArm64HostRunningIntelBuild(desktopRuntimeInfo)) { | 1223 | if (isArm64HostRunningIntelBuild(desktopRuntimeInfo)) { |
| 1216 | console.info( | 1224 | console.info( |
| @@ -1222,6 +1230,15 @@ function configureAutoUpdater(): void { · 5 unmodified lines |
| 1222 | console.info("[desktop-updater] Looking for updates..."); | 1230 | console.info("[desktop-updater] Looking for updates..."); |
| 1223 | }); | 1231 | }); |
| 1224 | autoUpdater.on("update-available", (info) => { | 1232 | autoUpdater.on("update-available", (info) => { |
| | 1233 | if (!shouldAcceptDesktopUpdateForCurrentVersion(currentVersion, info.version)) { |
| | 1234 | setUpdateState(reduceDesktopUpdateStateOnNoUpdate(updateState, new Date().toISOString())); |
| | 1235 | lastLoggedDownloadMilestone = -1; |
| | 1236 | console.info( |
| | 1237 | `[desktop-updater] Ignoring update ${info.version} on channel=${resolveDesktopUpdateChannel(info.version)} while currentVersion=${currentVersion} is on channel=${updateChannel}.`, |
| | 1238 | ); |
| | 1239 | return; |
| | 1240 | } |
| | 1241 | |
| 1225 | setUpdateState( | 1242 | setUpdateState( |
| 1226 | reduceDesktopUpdateStateOnUpdateAvailable( | 1243 | reduceDesktopUpdateStateOnUpdateAvailable( |
| 1227 | updateState, | 1244 | updateState, |