diff --git a/www/index.html b/www/index.html index 0c3c0df..9bd5502 100644 --- a/www/index.html +++ b/www/index.html @@ -5,6 +5,7 @@ + Webcam des MSV Bühl-Moos e.V. @@ -43,14 +44,19 @@
-
+
+ diff --git a/www/manifest.json b/www/manifest.json new file mode 100644 index 0000000..6442c98 --- /dev/null +++ b/www/manifest.json @@ -0,0 +1,20 @@ +{ + "name": "Webcam des MSV Bühl-Moos e.V.", + "short_name": "MSV Webcam", + "start_url": "./index.html", + "display": "standalone", + "background_color": "#0d1117", + "theme_color": "#0d1117", + "icons": [ + { + "src": "data/icon.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "data/icon.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} \ No newline at end of file diff --git a/www/service-worker.js b/www/service-worker.js new file mode 100644 index 0000000..440a186 --- /dev/null +++ b/www/service-worker.js @@ -0,0 +1,39 @@ +const CACHE_NAME = "msv-moos-webcam-app-v1"; +const URLS_TO_CACHE = [ + "./", + "./index.html", + "./css/custom.css", + "./css/w3.css", + "./js/webcam.js", + "./manifest.json", + "./data/icon.png", + "./data/favicon.ico" +]; + +self.addEventListener("install", (event) => { + event.waitUntil( + caches.open(CACHE_NAME).then((cache) => cache.addAll(URLS_TO_CACHE)) + ); +}); + +self.addEventListener("fetch", (event) => { + event.respondWith( + caches.match(event.request).then((response) => { + return response || fetch(event.request); + }) + ); +}); + +self.addEventListener("activate", (event) => { + event.waitUntil( + caches.keys().then((cacheNames) => + Promise.all( + cacheNames.map((cache) => { + if (cache !== CACHE_NAME) { + return caches.delete(cache); + } + }) + ) + ) + ); +});