sovereign-stack-pwa/sw.js
Alex Payne 19a45c485d Initial Sovereign Stack PWA scaffold
- PWA shell with service worker offline caching
- Encrypted vault using IndexedDB
- Lightning/L402 module placeholder
- Ollama bridge placeholder
- MIT license, no proprietary deps

Co-authored-by: Hermes <hermes@nousresearch.com>
2026-07-30 16:29:26 +00:00

6 lines
586 B
JavaScript

const CACHE = 'sovereign-v1';
const ASSETS = ['./', './index.html'];
self.addEventListener('install', (e) => { e.waitUntil(caches.open(CACHE).then(c => c.addAll(ASSETS)).then(() => self.skipWaiting())); });
self.addEventListener('activate', (e) => { e.waitUntil(self.clients.claim()); });
self.addEventListener('fetch', (e) => { e.respondWith(caches.match(e.request).then(r => r || fetch(e.request).then(res => { if (res.status === 200) { const clone = res.clone(); caches.open(CACHE).then(c => c.put(e.request, clone)); } return res; }).catch(() => caches.match('./index.html'))); });