1 line
9.4 KiB
JSON
1 line
9.4 KiB
JSON
{"repo": "austinwin/elearning", "files": {"sw.js": {"6f42ffdc79b85bcfbaa6b272c0b9566b7f24008f": {"t": 1785745999.1158986, "n": 2184, "h": "0d3611a979dae624", "c": "// aiMath - Service Worker\n// Cache-first strategy for static assets; bypass for API calls\n\nconst CACHE_NAME = 'aimath-v2.1';\n\nconst STATIC_ASSETS = [\n '/',\n '/index.html',\n '/styles.css',\n '/app.js',\n '/db.js',\n '/ai.js',\n '/curriculum.js',\n '/manifest.json',\n '/favicon.svg'\n];\n\nself.addEventListener('install', (event) => {\n event.waitUntil(\n caches.open(CACHE_NAME).then((cache) => {\n return cache.addAll(STATIC_ASSETS);\n }).catch((err) => {\n console.warn('SW install: failed to cache some assets', err);\n })\n );\n self.skipWaiting();\n});\n\nself.addEventListener('activate', (event) => {\n event.waitUntil(\n caches.keys().then((cacheNames) => {\n return Promise.all(\n cacheNames\n .filter((name) => name !== CACHE_NAME)\n .map((name) => caches.delete(name))\n );\n })\n );\n self.clients.claim();\n});\n\nself.addEventListener('fetch', (event) => {\n const url = new URL(event.request.url);\n\n // Bypass API calls – never cache them\n if (url.pathname.includes('/chat/completions') || url.hostname === 'api.deepseek.com') {\n return;\n }\n\n // For navigation requests (HTML), use network-first with cache fallback\n if (event.request.mode === 'navigate') {\n event.respondWith(\n fetch(event.request)\n .then((response) => {\n const cloned = response.clone();\n caches.open(CACHE_NAME).then((cache) => cache.put(event.request, cloned));\n return response;\n })\n .catch(() => caches.match(event.request))\n );\n return;\n }\n\n // For static assets, use cache-first\n event.respondWith(\n caches.match(event.request).then((cached) => {\n if (cached) {\n return cached;\n }\n return fetch(event.request).then((response) => {\n if (!response || response.status !== 200 || response.type !== 'basic') {\n return response;\n }\n const cloned = response.clone();\n caches.open(CACHE_NAME).then((cache) => cache.put(event.request, cloned));\n return response;\n }).catch(() => {\n // Offline fallback for non-critical resources\n return new Response('', { status: 408 });\n });\n })\n );\n});\n"}, "5f9b0d4d9464af813ed6b966f12019fd687919ad": {"t": 1785758649.453746, "n": 2184, "h": "0d3611a979dae624", "c": "// aiMath - Service Worker\n// Cache-first strategy for static assets; bypass for API calls\n\nconst CACHE_NAME = 'aimath-v2.1';\n\nconst STATIC_ASSETS = [\n '/',\n '/index.html',\n '/styles.css',\n '/app.js',\n '/db.js',\n '/ai.js',\n '/curriculum.js',\n '/manifest.json',\n '/favicon.svg'\n];\n\nself.addEventListener('install', (event) => {\n event.waitUntil(\n caches.open(CACHE_NAME).then((cache) => {\n return cache.addAll(STATIC_ASSETS);\n }).catch((err) => {\n console.warn('SW install: failed to cache some assets', err);\n })\n );\n self.skipWaiting();\n});\n\nself.addEventListener('activate', (event) => {\n event.waitUntil(\n caches.keys().then((cacheNames) => {\n return Promise.all(\n cacheNames\n .filter((name) => name !== CACHE_NAME)\n .map((name) => caches.delete(name))\n );\n })\n );\n self.clients.claim();\n});\n\nself.addEventListener('fetch', (event) => {\n const url = new URL(event.request.url);\n\n // Bypass API calls – never cache them\n if (url.pathname.includes('/chat/completions') || url.hostname === 'api.deepseek.com') {\n return;\n }\n\n // For navigation requests (HTML), use network-first with cache fallback\n if (event.request.mode === 'navigate') {\n event.respondWith(\n fetch(event.request)\n .then((response) => {\n const cloned = response.clone();\n caches.open(CACHE_NAME).then((cache) => cache.put(event.request, cloned));\n return response;\n })\n .catch(() => caches.match(event.request))\n );\n return;\n }\n\n // For static assets, use cache-first\n event.respondWith(\n caches.match(event.request).then((cached) => {\n if (cached) {\n return cached;\n }\n return fetch(event.request).then((response) => {\n if (!response || response.status !== 200 || response.type !== 'basic') {\n return response;\n }\n const cloned = response.clone();\n caches.open(CACHE_NAME).then((cache) => cache.put(event.request, cloned));\n return response;\n }).catch(() => {\n // Offline fallback for non-critical resources\n return new Response('', { status: 408 });\n });\n })\n );\n});\n"}, "663c9b08603ce495a4c5fdad15021a97a3985462": {"t": 1785758650.9223223, "n": 2202, "h": "936c0ef634191433", "c": "// Smart Math Tutor - Service Worker\n// Cache-first strategy for static assets; bypass for API calls\n\nconst CACHE_NAME = 'smart-math-tutor-v2';\n\nconst STATIC_ASSETS = [\n '/',\n '/index.html',\n '/styles.css',\n '/app.js',\n '/db.js',\n '/ai.js',\n '/curriculum.js',\n '/manifest.json',\n '/favicon.svg'\n];\n\nself.addEventListener('install', (event) => {\n event.waitUntil(\n caches.open(CACHE_NAME).then((cache) => {\n return cache.addAll(STATIC_ASSETS);\n }).catch((err) => {\n console.warn('SW install: failed to cache some assets', err);\n })\n );\n self.skipWaiting();\n});\n\nself.addEventListener('activate', (event) => {\n event.waitUntil(\n caches.keys().then((cacheNames) => {\n return Promise.all(\n cacheNames\n .filter((name) => name !== CACHE_NAME)\n .map((name) => caches.delete(name))\n );\n })\n );\n self.clients.claim();\n});\n\nself.addEventListener('fetch', (event) => {\n const url = new URL(event.request.url);\n\n // Bypass API calls – never cache them\n if (url.pathname.includes('/chat/completions') || url.hostname === 'api.deepseek.com') {\n return;\n }\n\n // For navigation requests (HTML), use network-first with cache fallback\n if (event.request.mode === 'navigate') {\n event.respondWith(\n fetch(event.request)\n .then((response) => {\n const cloned = response.clone();\n caches.open(CACHE_NAME).then((cache) => cache.put(event.request, cloned));\n return response;\n })\n .catch(() => caches.match(event.request))\n );\n return;\n }\n\n // For static assets, use cache-first\n event.respondWith(\n caches.match(event.request).then((cached) => {\n if (cached) {\n return cached;\n }\n return fetch(event.request).then((response) => {\n if (!response || response.status !== 200 || response.type !== 'basic') {\n return response;\n }\n const cloned = response.clone();\n caches.open(CACHE_NAME).then((cache) => cache.put(event.request, cloned));\n return response;\n }).catch(() => {\n // Offline fallback for non-critical resources\n return new Response('', { status: 408 });\n });\n })\n );\n});\n"}, "6085517620fb6f95c0e83b10560a6cad31774271": {"t": 1785758652.1664515, "n": 2184, "h": "7660748d11472acb", "c": "// Smart Math Tutor - Service Worker\n// Cache-first strategy for static assets; bypass for API calls\n\nconst CACHE_NAME = 'smart-math-tutor-v2';\n\nconst STATIC_ASSETS = [\n '/',\n '/index.html',\n '/styles.css',\n '/app.js',\n '/db.js',\n '/ai.js',\n '/curriculum.js',\n '/manifest.json'\n];\n\nself.addEventListener('install', (event) => {\n event.waitUntil(\n caches.open(CACHE_NAME).then((cache) => {\n return cache.addAll(STATIC_ASSETS);\n }).catch((err) => {\n console.warn('SW install: failed to cache some assets', err);\n })\n );\n self.skipWaiting();\n});\n\nself.addEventListener('activate', (event) => {\n event.waitUntil(\n caches.keys().then((cacheNames) => {\n return Promise.all(\n cacheNames\n .filter((name) => name !== CACHE_NAME)\n .map((name) => caches.delete(name))\n );\n })\n );\n self.clients.claim();\n});\n\nself.addEventListener('fetch', (event) => {\n const url = new URL(event.request.url);\n\n // Bypass API calls – never cache them\n if (url.pathname.includes('/chat/completions') || url.hostname === 'api.deepseek.com') {\n return;\n }\n\n // For navigation requests (HTML), use network-first with cache fallback\n if (event.request.mode === 'navigate') {\n event.respondWith(\n fetch(event.request)\n .then((response) => {\n const cloned = response.clone();\n caches.open(CACHE_NAME).then((cache) => cache.put(event.request, cloned));\n return response;\n })\n .catch(() => caches.match(event.request))\n );\n return;\n }\n\n // For static assets, use cache-first\n event.respondWith(\n caches.match(event.request).then((cached) => {\n if (cached) {\n return cached;\n }\n return fetch(event.request).then((response) => {\n if (!response || response.status !== 200 || response.type !== 'basic') {\n return response;\n }\n const cloned = response.clone();\n caches.open(CACHE_NAME).then((cache) => cache.put(event.request, cloned));\n return response;\n }).catch(() => {\n // Offline fallback for non-critical resources\n return new Response('', { status: 408 });\n });\n })\n );\n});\n"}}}} |