Skip to content

Installable web app that opens offline (D4.2) - #52

Merged
NCCU-Schultz-Lab merged 2 commits into
mainfrom
claude/d4-pwa
Nov 6, 2026
Merged

NCCU-Schultz-Lab merged 2 commits into
mainfrom
claude/d4-pwa

Conversation

@NCCU-Schultz-Lab

@NCCU-Schultz-Lab NCCU-Schultz-Lab commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

This is roadmap D4.2. The browser app becomes a Progressive Web App:

  • Installable: Chrome and Edge offer Install EaglePlot. It then opens in its own window from a desktop or Start-menu icon, with no admin rights. For many locked-down laptops, this is the "desktop app" without installers.
  • Works offline after one online visit.
  • Later visits load from the computer instead of the network.

What's added

  • manifest.webmanifest (written by build_site.py):
    • name, start URL, scope, display: standalone
    • dark background and theme colours
    • icons in packaging/web/icons/: 192 and 512 px, maskable versions on the dark background, and a 180 px Apple touch icon, all made from eagleplot/assets/logo.png
  • sw.js, the service worker:
    • Site files: network-first, so a new deploy shows up at once; the cached copy is used offline.
    • Per-build cache: build_site.py stamps the worker with a hash of the build, and older builds' caches are removed when a new one activates.
    • Pyodide from the CDN: cache-first. Its URLs contain the version and never change.
  • index.html:
    • Links the manifest, theme colour and Apple touch icon.
    • Registers the worker. On a first visit it waits (at most 3 s) until the worker controls the page before starting Python, so that visit's downloads are cached too, including the Python worker's.
    • Sends the worker the URLs that loaded before it took over (the page itself and the stlite runtime) to cache.
    • Sets window.eaglePlotOffline to ready, next-visit, failed or unsupported.
  • scripts/web/smoke.js now also checks that:
    • Chromium's installability check (Page.getInstallabilityErrors) reports no errors
    • the service worker controls the page
    • a reload with the network off reaches "ready"
  • README: the packaging/web README covers all of this. CHANGELOG [Unreleased] has an entry.

Tested (local build, self-hosted Pyodide)

  • smoke.js passes 33 page loads. The app is installable, the service worker controls the page, and the offline reload is ready in 7.9 s.
  • The first offline attempt failed with net::ERR_FAILED, because the page itself never passed through the worker on a first visit. That's what the "send the worker the URLs already loaded" step fixes.
  • This PR's CI run tests the CDN path, where Pyodide is cached cache-first from jsDelivr.

🤖 Generated with Claude Code

- manifest.webmanifest (written by build_site.py) and icons (192/512 px,
  maskable versions on the dark background, Apple touch icon): Chrome and
  Edge offer "Install EaglePlot"; it opens in its own window, no admin
  rights.
- sw.js: site files network-first with a per-build cache (stamped with a
  hash of the build; older caches removed on activate), Pyodide from the
  CDN cache-first. index.html registers it and, on a first visit, waits
  (max 3 s) until it controls the page before starting Python, then sends
  it the URLs loaded before that (the page, the stlite runtime) to cache.
- smoke.js: Chromium's installability check must pass, and a reload with
  the network off must reach "ready". Locally: installable, offline reload
  ready in 7.9 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…onding

Awaiting cache.put() before returning a response held every download until
it had been copied into the cache. In CI with the real CDN, start-up went
from 8.1 s / 7.2 s (cold / warm) to 11.7 s / 10.6 s. The response now goes
to the page at once and the cache write finishes under event.waitUntil.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NCCU-Schultz-Lab
NCCU-Schultz-Lab merged commit db3e33a into main Nov 6, 2026
9 checks passed
@NCCU-Schultz-Lab NCCU-Schultz-Lab mentioned this pull request Nov 7, 2026
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.

2 participants