Add a web app manifest, icons, and a runtime-caching service worker so the UI can be installed on Android Chrome (and added to the iOS home screen). - web/public/manifest.webmanifest: standalone display, theme/bg colors, icon set - web/public/icon.svg + generated icon-192/512 and apple-touch-icon PNGs - web/public/sw.js: caches the static shell for offline launch; never touches /api (HTTP or WS), so live-daemon behavior is unchanged - index.html: link manifest + apple-touch-icon, iOS standalone metas - main.ts: register the service worker (production only) Assets land in web/dist via Vite's public/ dir and are embedded by the existing include_dir! in maestro-web, so no Rust changes are needed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,19 @@ import "./styles.css";
|
||||
|
||||
initTheme();
|
||||
installViewportSizing();
|
||||
registerServiceWorker();
|
||||
|
||||
// Register the PWA service worker so the app is installable and the shell loads
|
||||
// offline. Production only — in dev the SW would fight Vite's HMR.
|
||||
function registerServiceWorker(): void {
|
||||
if (import.meta.env.DEV) return;
|
||||
if (!("serviceWorker" in navigator)) return;
|
||||
window.addEventListener("load", () => {
|
||||
void navigator.serviceWorker.register("/sw.js").catch(() => {
|
||||
// Best-effort: a failed registration must never break the app.
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const rootEl = document.getElementById("app");
|
||||
if (!rootEl) {
|
||||
|
||||
Reference in New Issue
Block a user