mirror of
https://github.com/kbenestad/mdcms.git
synced 2026-06-18 07:24:31 +00:00
- Generate 192x192 blue/white M icon as favicon.png - manifest.json: add id field, proper icon sizes (192/512), purpose: any - mdcms.py generate_pwa(): respect favicon config key, skip icons if file missing, emit id and correct sizes https://claude.ai/code/session_01UP8Wo2CKPNhvvTkzX48CWF
57 lines
1.5 KiB
JavaScript
57 lines
1.5 KiB
JavaScript
// mdcms service worker — generated by mdcms build
|
|
const CACHE_NAME = 'mdcms-eb384247';
|
|
const PRECACHE_URLS = [
|
|
"index.html",
|
|
"config.yml",
|
|
"nav.yml",
|
|
"search.json",
|
|
"theme.yml",
|
|
"pages/about.md",
|
|
"pages/docs.md",
|
|
"pages/home.md",
|
|
"posts/.gitkeep",
|
|
"assets/fonts/.gitkeep",
|
|
"assets/icons/.gitkeep",
|
|
"assets/icons/arrow_drop_down.svg",
|
|
"assets/icons/arrow_right.svg",
|
|
"assets/icons/dangerous.svg",
|
|
"assets/icons/dark_mode.svg",
|
|
"assets/icons/error.svg",
|
|
"assets/icons/exclamation.svg",
|
|
"assets/icons/history.svg",
|
|
"assets/icons/info.svg",
|
|
"assets/icons/language.svg",
|
|
"assets/icons/light_mode.svg",
|
|
"assets/icons/menu.svg",
|
|
"assets/icons/mobile_arrow_down.svg",
|
|
"assets/icons/report.svg",
|
|
"assets/icons/search.svg",
|
|
"assets/icons/success.svg",
|
|
"assets/icons/text_compare.svg",
|
|
"assets/icons/warning.svg",
|
|
"assets/images/.gitkeep",
|
|
"assets/images/favicon.png"
|
|
];
|
|
|
|
self.addEventListener('install', event => {
|
|
event.waitUntil(
|
|
caches.open(CACHE_NAME).then(cache => cache.addAll(PRECACHE_URLS))
|
|
);
|
|
self.skipWaiting();
|
|
});
|
|
|
|
self.addEventListener('activate', event => {
|
|
event.waitUntil(
|
|
caches.keys().then(keys =>
|
|
Promise.all(keys.filter(k => k !== CACHE_NAME).map(k => caches.delete(k)))
|
|
)
|
|
);
|
|
self.clients.claim();
|
|
});
|
|
|
|
self.addEventListener('fetch', event => {
|
|
if (event.request.method !== 'GET') return;
|
|
event.respondWith(
|
|
caches.match(event.request).then(cached => cached || fetch(event.request))
|
|
);
|
|
});
|