Skip to content

Tell open pages and the extension when a new version is out - #2

Merged
Kernel-Hunter merged 1 commit into
mainfrom
auto-update
Oct 31, 2026
Merged

Kernel-Hunter merged 1 commit into
mainfrom
auto-update

Conversation

@Kernel-Hunter

Copy link
Copy Markdown
Owner

The app and the extension now tell people when a new version is out, and updating takes one click.

Web app

  • The build writes its id into index.html and version.json. The page checks version.json when it becomes visible again (at most once a minute), every 30 minutes, and when the browser finds a new service worker. The service worker never caches version.json, and the fetch adds a query and uses no-store, so the max-age=600 that GitHub Pages sends cannot hide a deploy.
  • When the ids differ, the page shows "Narrata was updated. Reload to get the new version." with Reload and a close button. Nothing reloads on its own. Reload pauses playback, saves the reading position right away (normally it is saved 1.5 s after each word), gives the new service worker up to 10 s to install, then reloads. While a voice is downloading, it asks you to wait instead.
  • Voices live in the Origin Private File System, which the service worker never touches, so updates keep them.
  • The isolation code in register.ts is unchanged.

Extension

  • The popup asks api.github.com for the latest release at most once a day (cached in chrome.storage). When that release is newer than the manifest version, it shows "Update available: vX", the steps, and a button to the release page. There are still no host permissions; connect-src only gains https://api.github.com.
  • New release workflow: on a v* tag it checks that the tag matches package.json, builds the extension and attaches narrata-extension-<version>.zip to the release. package.json stays the only place the version is set.
  • README: install from the release zip, how to update, and privacy text that mentions the GitHub check and version.json.

There is no release yet, so the README's zip link has nothing to point to until a v0.1.0 tag is pushed after this is merged.

Tests

  • Unit tests for the version.json check, and for the extension's version compare, release parsing and daily cache.
  • tests/e2e/verify-update.mjs builds A, serves it under /narrata/ without isolation headers, waits for isolation, starts reading the sample, then builds B into the same folder during playback. The notice appears, nothing reloads while audio plays, and Reload gives B, still isolated, on the same document and position, with the voice files unchanged. Passed locally.
  • tests/e2e/verify-ext-update.mjs loads the extension unpacked with GitHub stubbed: a notice for a newer release, none when up to date, one request a day. Passed locally.

The web app writes its build id into index.html and version.json. The
page compares the two when it is shown again and every 30 minutes, and
shows a notice with a Reload button. It never reloads by itself: Reload
pauses playback and saves the reading position first, and waits while a
voice is downloading. The service worker never caches version.json, and
the voices stay in the Origin Private File System, which updates do not
touch.

The extension popup asks GitHub for the latest release at most once a
day and, when it is newer, says how to update the unpacked folder. A
release workflow attaches narrata-extension-<version>.zip to v* tags.
@Kernel-Hunter
Kernel-Hunter merged commit 41c0ed2 into main Oct 31, 2026
2 checks passed
@Kernel-Hunter
Kernel-Hunter deleted the auto-update branch October 31, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant