diff --git a/index.html b/index.html index 7597861..b68d535 100644 --- a/index.html +++ b/index.html @@ -9,6 +9,7 @@ content="WijiBoard SCARA arm control dashboard. Web Bluetooth interface for the ESP32-C3 stepper controller." /> + @@ -181,6 +182,15 @@ // ── Init router (last step) ──────────────────────────────────── Router.init('#view', '#home'); + // ── Register Service Worker for PWA ──────────────────────────── + if ('serviceWorker' in navigator) { + window.addEventListener('load', () => { + navigator.serviceWorker.register('./sw.js').catch(err => { + console.warn('[PWA] Service Worker registration failed:', err); + }); + }); + } + // ── Check Web Bluetooth availability ────────────────────────── if (!navigator.bluetooth) { setTimeout(() => { diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..4c70801 --- /dev/null +++ b/manifest.json @@ -0,0 +1,17 @@ +{ + "name": "WijiBoard Control", + "short_name": "WijiBoard", + "description": "WijiBoard SCARA arm control dashboard.", + "start_url": ".", + "display": "standalone", + "background_color": "#1e1e1e", + "theme_color": "#1a73e8", + "icons": [ + { + "src": "favicon.svg", + "sizes": "192x192 512x512 any", + "type": "image/svg+xml", + "purpose": "any maskable" + } + ] +} diff --git a/sw.js b/sw.js new file mode 100644 index 0000000..9a7adbc --- /dev/null +++ b/sw.js @@ -0,0 +1,5 @@ +// Minimal Service Worker to satisfy PWA installability requirements +self.addEventListener('fetch', function(event) { + // We do not intercept or cache anything, just pass the request through. + // This minimal fetch listener is enough to trigger the PWA install prompt. +});