Docs, README, launchers, PWA install
Milestone 7. docs/MODULE-GUIDE.md documents the whole module contract from an author's point of view — manifest reference, client factory + moduleApi, server init/routes/health, scoping and resilience rules, a copy-paste minimal module, and a testing section with the two mocks and a resilience checklist. README rewritten with run/configure/use instructions in the prodcom-listener style, plus double-click launchers for macOS and Windows. PWA: manifest, icons, and a minimal network-first service worker that never touches /api/*. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RNYUv9EyrGSFmCnmH7WYKH
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>ProdDash Admin</title>
|
||||
<meta name="theme-color" content="#0b0e12">
|
||||
<link rel="icon" href="/icons/icon-192.png">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<link rel="stylesheet" href="/admin/admin.css">
|
||||
</head>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -5,6 +5,12 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>ProdDash</title>
|
||||
<meta name="theme-color" content="#0b0e12">
|
||||
<link rel="manifest" href="/manifest.webmanifest">
|
||||
<link rel="icon" href="/icons/icon-192.png">
|
||||
<link rel="apple-touch-icon" href="/icons/icon-180.png">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta name="apple-mobile-web-app-title" content="ProdDash">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "ProdDash",
|
||||
"short_name": "ProdDash",
|
||||
"description": "Modular production dashboard for Waters Church",
|
||||
"start_url": "/",
|
||||
"scope": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#0b0e12",
|
||||
"theme_color": "#0b0e12",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icons/icon-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "/icons/icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "/icons/icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -844,3 +844,7 @@ async function boot() {
|
||||
}
|
||||
|
||||
boot();
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('/sw.js').catch(() => {});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
/* Minimal service worker: caches the shell so the PWA is installable.
|
||||
Never touches /api/* (live data + SSE streams). Network-first, so open
|
||||
dashboards always run the latest shell when the server is reachable. */
|
||||
|
||||
const CACHE = 'proddash-v1';
|
||||
const SHELL = [
|
||||
'/',
|
||||
'/style.css',
|
||||
'/shell.js',
|
||||
'/manifest.webmanifest',
|
||||
'/icons/icon-192.png',
|
||||
'/icons/icon-512.png',
|
||||
];
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE).then((cache) => cache.addAll(SHELL)).then(() => self.skipWaiting())
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('activate', (event) => {
|
||||
event.waitUntil(
|
||||
caches.keys()
|
||||
.then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k))))
|
||||
.then(() => self.clients.claim())
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
const url = new URL(event.request.url);
|
||||
if (event.request.method !== 'GET' || url.pathname.startsWith('/api/')) return;
|
||||
|
||||
// Network first, cache fallback
|
||||
event.respondWith(
|
||||
fetch(event.request)
|
||||
.then((res) => {
|
||||
const copy = res.clone();
|
||||
caches.open(CACHE).then((cache) => cache.put(event.request, copy));
|
||||
return res;
|
||||
})
|
||||
.catch(() => caches.match(event.request, { ignoreSearch: true }))
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user