feat: establish reproducible FreeCAD web compatibility baseline

This commit is contained in:
2026-08-10 16:11:38 -04:00
parent e5a5d74dbc
commit b962a5c3b5
733 changed files with 349081 additions and 647 deletions

18
public/sw.js Normal file
View File

@@ -0,0 +1,18 @@
const CACHE_NAME = 'bitbybit-cad-shell-v1'
const SHELL = ['/','/index.html','/manifest.webmanifest']
self.addEventListener('install', (event) => {
event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(SHELL)).then(() => self.skipWaiting()))
})
self.addEventListener('activate', (event) => {
event.waitUntil(caches.keys().then((keys) => Promise.all(keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key)))).then(() => self.clients.claim()))
})
self.addEventListener('fetch', (event) => {
if (event.request.method !== 'GET' || new URL(event.request.url).origin !== self.location.origin) return
event.respondWith(fetch(event.request).then((response) => {
if (response.ok) void caches.open(CACHE_NAME).then((cache) => cache.put(event.request, response.clone()))
return response
}).catch(() => caches.match(event.request).then((cached) => cached || caches.match('/index.html'))))
})