diff --git a/static/icon-192.png b/static/icon-192.png new file mode 100644 index 0000000..15c5272 Binary files /dev/null and b/static/icon-192.png differ diff --git a/static/icon-512.png b/static/icon-512.png new file mode 100644 index 0000000..b29e9b4 Binary files /dev/null and b/static/icon-512.png differ diff --git a/static/manifest.json b/static/manifest.json new file mode 100644 index 0000000..ecbef17 --- /dev/null +++ b/static/manifest.json @@ -0,0 +1,14 @@ +{ + "name": "Astraea — Washington Family Law Assistant", + "short_name": "Astraea", + "description": "Eight specialist AI attorneys grounded in Washington statute and case law. Not legal advice.", + "start_url": "/", + "display": "standalone", + "background_color": "#070b1a", + "theme_color": "#070b1a", + "orientation": "portrait-primary", + "icons": [ + { "src": "/static/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any maskable" }, + { "src": "/static/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" } + ] +} diff --git a/static/sw.js b/static/sw.js new file mode 100644 index 0000000..6bf11ba --- /dev/null +++ b/static/sw.js @@ -0,0 +1,31 @@ +const CACHE = 'astraea-v1'; +const ASSETS = ['/', '/static/manifest.json', '/static/icon-192.png', '/static/icon-512.png']; + +self.addEventListener('install', (e) => { + e.waitUntil(caches.open(CACHE).then((c) => c.addAll(ASSETS)).then(() => self.skipWaiting())); +}); + +self.addEventListener('activate', (e) => { + e.waitUntil( + caches.keys().then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))) + .then(() => self.clients.claim()) + ); +}); + +// Network-first for everything except static assets (the app shell is tiny; +// API responses must never be served stale). +self.addEventListener('fetch', (e) => { + const url = new URL(e.request.url); + if (e.request.method !== 'GET') return; + if (url.pathname.startsWith('/api/')) return; // always live + + e.respondWith( + fetch(e.request) + .then((resp) => { + const copy = resp.clone(); + caches.open(CACHE).then((c) => c.put(e.request, copy)); + return resp; + }) + .catch(() => caches.match(e.request).then((c) => c || caches.match('/'))) + ); +}); diff --git a/templates/index.html b/templates/index.html index 87b2499..49c8261 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,7 +2,15 @@ - + + + + + + + + + Astraea — Your Attorney @@ -110,8 +159,8 @@

ASTRAEA

- - + +
⚖
@@ -241,6 +290,10 @@