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
This commit is contained in:
31
public/service-worker.js
Normal file
31
public/service-worker.js
Normal file
@@ -0,0 +1,31 @@
|
||||
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'))
|
||||
)
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user