Repository navigation
Update Lantern by itself on macOS, announce releases elsewhere - #29
Merged
Merged
Conversation
…he feed body read
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
An installed Lantern now finds a newer GitHub release by itself. On a Mac it uses Electron's
autoUpdaterwithupdate.electronjs.org, downloads in the background and installs only when nothing would be ended; elsewhere it shows "Lantern X is available" with a button to the release page. There is a Check for Updates… menu item and an Updates setting, "Check for updates automatically" (on by default), anddocs/updates.mdsays what each check sends and how to turn it off.The Mac feed does not work yet, and it is not fixable in this PR.
update.electronjs.org/MobileReality/lantern/darwin-arm64/0.2.2answers 404 ("needs asset matching .-(mac|darwin|osx)..zip"). The service classifies an asset by name, andLantern-mac.ziphas no-arm64, so it is filed under darwin-x64 (darwin-x64/0.2.2answers 200 with the v0.3.0 asset,darwin-x64/0.3.0answers 204). The service needs the asset to be namedLantern-mac-arm64.zip(orLantern-darwin-arm64.zip). The release workflow was not touched; until the asset is renamed the Mac path is a quiet no-op: one warning in Diagnostics, and Check for Updates points to the release page.Key files
src/main/updater/guard.ts—canInstallNow(state): false for a live session (anything not finished, so unknown counts), a run started by Lantern, an editor terminal, a process below Lantern, or activity that cannot be read.src/main/updater/service.ts— check on start and every 4 h, download, guard polling, postpone, confirmed Restart now; every request goes through the injected fetch and nothing is requested with the setting off.src/main/updater/process-activity.ts— terminals and running commands below Lantern, from the existing process-table helpers.src/main/updater/feed.ts,version.ts— 204/200/404 handling, the latest-release reader with no token, a small semver comparison.src/main/updater/controller.ts,dialogs.ts,native.ts— the menu check and its result texts, the update IPC, the Squirrel adapter.src/main/main.ts,src/main/app-menu.ts,src/renderer/features/update-notice.ts— wiring, the menu item, the in-window notice.src/shared/session-liveness.ts— the one definition of a live session, now shared with the idle tabs.Before / after
Before: a new release was found and installed by hand. After: a packaged Mac that has a download in the feed reads
Update ready: restart when your sessions finishwhile any session, run, terminal or editor process is alive, installs by itself when none is (unless "Not now" was pressed), and "Restart now" with something alive first lists what would be lost ("Restarting ends 1 AI assistant session and 2 editor terminals") and restarts only after a confirmation.Verified with
pnpm run typecheck,pnpm run lint,pnpm test, all green, and the real service:darwin-arm64/0.2.2404,darwin-arm64/0.3.0404,darwin-x64/0.2.2200,darwin-x64/0.3.0204. The update flow itself (a download,quitAndInstallnext to the async before-quit handler) was never run. Unreviewed fixes: 0ea2bf5 (reset the install state when Squirrel reports a failure, bound the feed body read, skip the process listing while postponed). Decisions the brief left open: with the setting off, Check for Updates makes no request and says so; a manual check that fails shows a plain information message, not an error dialog. Lantern: 34 files re-mapped.Run cost