Offline access: self-updating worker, quiet console, setting in Accounts

- The page asks the service worker for its version before using it, and
  has the browser fetch a newer one when it is out of date; the app also
  checks for a new sw.js on every start. An older worker left over from a
  previous release silently ignored the page's requests, so saving only
  resumed after offline access was switched off and on.
- Fewer console errors offline: the server probe goes through the worker;
  fonts, the illustration, lazy chunks and the PDF worker (named inside
  the app's scripts and styles) are saved with the app; sender pictures
  are pre-loaded, and an unsaved one is "no picture" (204), not a 503;
  plugin bundles and plugin lookups are saved (per-message ones go with
  their message); POST lookups and live-update reconnects wait for the
  server to be back instead of failing over and over.
- The setting moves from Settings → Security to Settings → Accounts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-05 20:45:37 +02:00
co-authored by Claude Opus 5.5
parent 01bfbb37d4
commit c9c24e7e2f
8 changed files with 190 additions and 40 deletions
+2 -7
View File
@@ -19,7 +19,7 @@ import {
useOffline,
useOfflineEnabled,
} from "../lib/offline";
import { prefetchRecent } from "../lib/offlinePrefetch";
import { prefetchRecent, serverAnswers } from "../lib/offlinePrefetch";
import { subscribeWs } from "../lib/ws";
const PROBE_MS = 10_000;
@@ -111,12 +111,7 @@ export function OfflineController() {
useEffect(() => {
if (!offline) return;
const probe = async () => {
try {
const resp = await fetch("/api/healthz", { cache: "no-store", credentials: "include" });
if (!resp.headers.has("X-WM-Offline")) reportOnline();
} catch {
/* still offline */
}
if (await serverAnswers()) reportOnline();
};
const timer = window.setInterval(probe, PROBE_MS);
window.addEventListener("online", probe);