Update Preferences
Overview
Update preference handling is split into small policy helpers under src/main/ and consumed by the Electron shell in src/…/electron.js. src/…/update-mode.js decides whether the running install should use automatic in-place updates, notify-only update discovery, or no updater at all. Its getUpdateMode(...) return values are:
auto: the app may download updates and install them on quit or through Restart to Update.notify: the app checks for releases, but only exposes the release page URL instead of installing in place.off: the app does not configure or checkelectron-updater.
src/…/electron.js turns explicit disable signals into off before calling getUpdateMode(...): src/…/disableUpdate.js currently exports disableUpdate() as false, while DRAWIO_DISABLE_UPDATE=true and --disable-update also disable updates. When the effective mode is off, src/…/electron.js passes disableUpdate=1 into URL state, omits update menu items, and skips autoUpdater.setFeedURL(...) and scheduled checks.
src/…/update-mode.js treats app-store or sandbox-managed installs as off: Windows Store (windowsStore), Snap (env.SNAP), and Flatpak (/.flatpak-info). macOS returns auto. Windows returns notify for portable builds (PORTABLE_EXECUTABLE_FILE) and for installs without the NSIS uninstaller next to execPath; only an NSIS install with Uninstall <productName>.exe beside the executable returns auto. Linux AppImage returns auto; deb/rpm-style installs with resourcesPath/package-type return notify; unknown Linux packaging returns off. getReleaseUrl(version) builds the GitHub release tag URL used by notify mode, and src/…/electron.js opens that URL from the update notice.
src/…/update-channel.js handles the only custom feed channel: Windows arm64 returns latest-arm64, while all other platform/architecture pairs return null and use electron-updater defaults. src/…/electron.js applies this channel when configuring the GitHub feed for jgraph/drawio-desktop.
The tests pin these policies. src/…/update-mode.test.js exercises each packaging branch plus getReleaseUrl(...). src/…/update-channel.test.js checks Windows arm64, Windows x64, macOS, and Linux channel choices, and reads electron-builder-win-arm64.json and electron-builder-win.json so the app-requested arm64 channel stays aligned with the publish configuration.
Coupling
- If src/…/update-channel.js changes the Windows arm64 channel name, also update electron-builder-win-arm64.json and src/…/update-channel.test.js; the arm64 app asks
electron-updaterfor this channel, and electron-builder must publish the same manifest name. - If Windows installer targets or artifact layout change, verify src/…/update-mode.js and src/…/update-mode.test.js: Windows
automode depends on findingUninstall <productName>.exebesideprocess.execPath, while portable builds are detected throughPORTABLE_EXECUTABLE_FILE. - If Linux packaging changes, verify the marker and environment checks in src/…/update-mode.js: AppImage is keyed from
APPIMAGE, deb/rpm notify mode fromresourcesPath/package-type, Snap fromSNAP, and Flatpak from/.flatpak-info. - If disable-update behavior changes in src/…/disableUpdate.js, keep src/…/electron.js expectations in mind: its result is ORed with
DRAWIO_DISABLE_UPDATE=trueand--disable-update, then converted intoupdateMode == 'off'before menus, URL state, feed setup, and update checks are initialized.
Risks
- src/…/update-channel.js and electron-builder-win-arm64.json must stay synchronized. The comments and src/…/update-channel.test.js reference
jgraph/drawio-desktop#2197: Windows update manifests do not include an architecture suffix by default, so if arm64 stops usinglatest-arm64, x64 and arm64 publishing can overwrite the same latest.yml and clients can see the wrong update feed. - src/…/update-mode.js intentionally keeps non-NSIS Windows installs out of automatic in-place updates. The comments cite
jgraph/drawio-desktop#2142: if MSI, zip, or portable builds are misclassified asauto, running the NSIS updater over them can leave files that no installer tracks. - src/…/update-mode.js leaves package-manager-managed Linux and store/sandbox installs out of in-app installation. The comments cite
jgraph/drawio-desktop#2569: if deb/rpm, Snap, Flatpak, or Store installs are moved toauto, the desktop updater can compete with the package manager or platform store instead of letting those systems update the app.