upgrade to installable PWA. Fixes #6

This commit is contained in:
osiu97
2026-07-08 19:02:00 +02:00
parent 49f91c761d
commit a321e8dd4c
3 changed files with 32 additions and 0 deletions
+10
View File
@@ -9,6 +9,7 @@
content="WijiBoard SCARA arm control dashboard. Web Bluetooth interface for the ESP32-C3 stepper controller." />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<link rel="manifest" href="manifest.json" />
<!-- Shared styles -->
<link rel="stylesheet" href="web/styles/base.css" />
@@ -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(() => {
+17
View File
@@ -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"
}
]
}
+5
View File
@@ -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.
});