From 7023e4c7c8f158df78b5e71ddc2640290409eca1 Mon Sep 17 00:00:00 2001 From: chers Date: Fri, 31 Jul 2026 09:18:39 +0000 Subject: Update cl-bbs --- static/sw.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 static/sw.js (limited to 'static/sw.js') diff --git a/static/sw.js b/static/sw.js new file mode 100644 index 0000000..edf8149 --- /dev/null +++ b/static/sw.js @@ -0,0 +1,31 @@ +const CACHE_NAME = 'cl-bbs-v2'; +const ASSETS = [ + '/static/styles/themes/default.css', + '/static/styles/themes/dark.css', + '/static/styles/themes/no.css', + '/static/styles/themes/colored.css', + '/static/styles/themes/matrix.css', + '/static/favicon.ico', + '/static/schemebbs.png' +]; + +self.addEventListener('install', (event) => { + event.waitUntil( + caches.open(CACHE_NAME).then((cache) => { + return cache.addAll(ASSETS); + }) + ); +}); + +self.addEventListener('fetch', (event) => { + event.respondWith( + caches.match(event.request).then((cachedResponse) => { + if (cachedResponse) { + return cachedResponse; + } + return fetch(event.request).catch(() => { + // Fallback or offline page + }); + }) + ); +}); -- cgit v1.2.3