Files
defiQUG a2dc194a49 Monorepo: Gitea CI, docs, auth/sync, backend APIs, gitignore
- Add Gitea Actions workflow; point README to gitea.d-bis.org/Sankofa_Phoenix/SMOA
- Expand .gitignore for Spring H2 data, secrets, Kotlin .kotlin/, tooling
- Track docs/api/generated ReDoc bundle; refresh api docs README
- Android: network/auth/sync, UI shell, tests; backend credentials/integrity APIs
- Docs, scripts (generate-api-docs), modules and core updates

Made-with: Cursor
2026-03-23 20:19:24 -07:00

28 lines
1.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* SMOA web scaffold minimal offline shell (cache static assets only). */
const CACHE = 'smoa-web-v1';
const ASSETS = ['./index.html', './manifest.webmanifest', './sw.js', './offline-queue.js'];
self.addEventListener('install', (event) => {
event.waitUntil(caches.open(CACHE).then((c) => c.addAll(ASSETS)).then(() => self.skipWaiting()));
});
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys().then((keys) =>
Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))
).then(() => self.clients.claim())
);
});
self.addEventListener('fetch', (event) => {
const url = new URL(event.request.url);
if (url.origin === self.location.origin && ASSETS.some((p) => url.pathname.endsWith(p.replace('./', '/')))) {
event.respondWith(caches.match(event.request).then((r) => r || fetch(event.request)));
return;
}
// API calls: network-first (no offline queue in this scaffold)
if (event.request.method === 'GET') {
event.respondWith(fetch(event.request).catch(() => caches.match('./index.html')));
}
});