updater

Source: updater.js:16

electron-updater wiring: auto-update against updates.ezlaybacks.com (the auth-gated Worker in front of the private R2 bucket — see updates-worker/ and docs/Auto_Update_Design.md). electron-updater reads the feed URL from the app-update.yml that electron-builder embeds from build.publish; this module supplies the entitlement header the Worker demands, the check cadence, and the ONE piece of update UI the app has: a single Restart Now / Later dialog when a download is ready. No OS notifications, ever — the stock checkForUpdatesAndNotify re-notified on every launch until the update was installed. The download is verified two ways that we don't implement: sha512 from latest-mac.yml, and macOS code-signature match against the running app.


Instance Methods

shouldPrompt( promptedVersion: string | undefined, version: string, manual: boolean, ): boolean

Decide whether the restart dialog should appear for a downloaded update — one background prompt per version: update-downloaded fires again on EVERY launch until the update installs (electron-updater re-finds the cached download), so without this memory the dialog would re-nag daily. A manual menu check always prompts — the user just asked.

Parameters

  • promptedVersion (string | undefined) — Version last prompted for (from settings).
  • version (string) — Version just downloaded.
  • manual (boolean) — True when the check came from the menu.

Returns

  • boolean — True when the dialog should be shown.

showProgress(fraction: number)

Paint download progress on the dock icon. The download is ~160MB and used to be invisible — it read as a hang. setProgressBar paints the standard progress bar across the dock icon. No window of our own, no notification.

Parameters

  • fraction (number) — 0–1 progress; -1 removes the bar.

infoBox(message: string, detail: string)

Show a one-button informational dialog.

Parameters

  • message (string) — Headline text.
  • detail (string) — Body text.

promptRestart(version: string): Promise.<void>

Show the Restart Now / Later dialog for a downloaded update; a dialog already on screen suppresses a second one. quitAndInstall is deferred with setImmediate: calling it from inside the dialog callback can stall the quit sequence while the modal tears down — the app then never exits, ShipIt times out on "App Still Running", and the click does nothing (the other half of the 2026.715.2 restart failure).

Parameters

  • version (string) — Version ready to install.

Returns

  • Promise.<void>

runCheck()

Start one update check. Signed-out installs skip it (the Worker would 401 them); a manual check while signed out explains itself instead. The entitlement header rides on the request as a Bearer token. Check failures surface through the 'error' event; nothing to handle here.

checkNow()

Menu-initiated check ("Check for Updates…"). Unlike the background cadence, every outcome gets said out loud: up to date, downloading, ready, or failed. Dev runs aren't installed, so there's nothing to update and the dialog says so. Setting manualCheck while a background check is in flight makes that check report its outcome.

start(getHeader: function, getWin: function)

Wire up auto-update and start the check cadence. No-op in dev runs — they aren't installed, so there's nothing to update.

Logging goes to a file at ~/Library/Logs//main.log — debugging the first live run meant reading ShipIt's logs by hand; never again. autoInstallOnAppQuit means "Later" = install on next quit.

Event handling: update-available flips to downloading and zeroes the dock progress bar; download-progress keeps it moving; update-not-available returns to idle. update-downloaded records the ready version, clears the progress bar, and prompts per shouldPrompt — when the prompt for this version already happened, it stays quiet and the update installs on quit. Errors (offline, 401, feed missing) are non-events for background checks (next tick retries) and one calm sentence for a manual one; details go to the log only, and a dead download must not leave a frozen progress bar, so it's cleared. Manual checks additionally announce update-available and update-not-available outcomes.

The Settings toggle (app.checkUpdatesOnLaunch) gates the BACKGROUND cadence only; checkNow() from the menu ignores it, because an explicit ask is an explicit ask. Read once at start: a running app has already made its decision, so a change takes effect on the next launch — which is what the toggle's subtitle promises.

Parameters

  • getHeader (function) — Returns the base64 entitlement header, or null when signed out.
  • getWin (function) — Window accessor for the dock progress bar.

Instance Fields

getAuthHeader

auth.js's cached entitlement accessor: () => base64 string, or null when signed out.

getWindow

Main window accessor — drives the dock-icon progress bar.

state

Updater state: 'idle' | 'checking' | 'downloading' | 'ready'.

readyVersion

Version string once update-downloaded has fired.

manualCheck

Current check came from the menu — give honest feedback.

prompting

Restart dialog on screen — don't stack a second one.

downloadPercent

0-100 while state === 'downloading'.

Other

CHECK_EVERY_MS

Interval between background update checks.