Files
bscscore/public/service-worker.js
Frank Schwenk 501e064711 Add PWA assets, update index.astro, set .gitea
- Added PWA-related files: LICENSE, favicon.ico, icon-192.png, icon-512.png, manifest.json, service-worker.js in public/
- Deleted legacy favicon.svg
- Major update to src/pages/index.astro: implements full responsive UI, PWA manifest, service worker registration, and touch/mobile optimizations
- Added/updated .gitea to track current Gitea issue for workflow compliance

Purpose: Implements PWA support and refactors the main page for the Astro app, aligning with the migration and refactor described in issue #1.

Refs #1
2025-06-05 12:14:59 +02:00

31 lines
712 B
JavaScript

const CACHE_NAME = 'bscscore-v1';
const URLS_TO_CACHE = [
'/',
'/index.html',
'/manifest.json',
'/favicon.ico',
'/icon-192.png',
'/icon-512.png'
];
self.addEventListener('install', event => {
event.waitUntil(
caches.open(CACHE_NAME).then(cache => cache.addAll(URLS_TO_CACHE))
);
});
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys().then(keys =>
Promise.all(keys.filter(key => key !== CACHE_NAME).map(key => caches.delete(key)))
)
);
});
self.addEventListener('fetch', event => {
event.respondWith(
caches.match(event.request).then(response =>
response || fetch(event.request).catch(() => caches.match('/index.html'))
)
);
});