From 211d08f9804c70943d7395175f25096483f006d0 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Sat, 19 Aug 2023 10:39:52 -0700 Subject: Version 2.0.0 Refactor, Add PWA Support --- static/font/Abridge.woff2 | Bin 768 -> 0 bytes static/font/Arimo-Bold.woff2 | Bin 10008 -> 0 bytes static/font/Arimo-Italic.woff2 | Bin 10972 -> 0 bytes static/font/Arimo.woff2 | Bin 9988 -> 0 bytes static/font/FiraCode.woff2 | Bin 21096 -> 0 bytes static/font/Roboto-Bold.woff2 | Bin 15860 -> 0 bytes static/font/Roboto-Italic.woff2 | Bin 17368 -> 0 bytes static/font/Roboto-Mono-Italic.woff2 | Bin 13572 -> 0 bytes static/font/Roboto-Mono.woff2 | Bin 12312 -> 0 bytes static/font/Roboto.woff2 | Bin 15744 -> 0 bytes static/fonts/Roboto-Bold.woff2 | Bin 0 -> 15860 bytes static/fonts/Roboto-Italic.woff2 | Bin 0 -> 17368 bytes static/fonts/Roboto-Mono-Italic.woff2 | Bin 0 -> 13572 bytes static/fonts/Roboto-Mono.woff2 | Bin 0 -> 12312 bytes static/fonts/Roboto.woff2 | Bin 0 -> 15744 bytes static/js/sw_load.js | 13 +++ static/js/sw_load.min.js | 1 + static/manifest.json | 30 ++++++ static/site.webmanifest | 28 ------ static/stork.st | Bin 312789 -> 0 bytes static/stork.wasm | Bin 336673 -> 0 bytes static/sw.js | 175 ++++++++++++++++++++++++++++++++++ static/sw.min.js | 1 + static/tinysearch_engine_bg.wasm | Bin 96681 -> 0 bytes 24 files changed, 220 insertions(+), 28 deletions(-) delete mode 100644 static/font/Abridge.woff2 delete mode 100644 static/font/Arimo-Bold.woff2 delete mode 100644 static/font/Arimo-Italic.woff2 delete mode 100644 static/font/Arimo.woff2 delete mode 100644 static/font/FiraCode.woff2 delete mode 100644 static/font/Roboto-Bold.woff2 delete mode 100644 static/font/Roboto-Italic.woff2 delete mode 100644 static/font/Roboto-Mono-Italic.woff2 delete mode 100644 static/font/Roboto-Mono.woff2 delete mode 100644 static/font/Roboto.woff2 create mode 100644 static/fonts/Roboto-Bold.woff2 create mode 100644 static/fonts/Roboto-Italic.woff2 create mode 100644 static/fonts/Roboto-Mono-Italic.woff2 create mode 100644 static/fonts/Roboto-Mono.woff2 create mode 100644 static/fonts/Roboto.woff2 create mode 100644 static/js/sw_load.js create mode 100644 static/js/sw_load.min.js create mode 100644 static/manifest.json delete mode 100644 static/site.webmanifest delete mode 100644 static/stork.st delete mode 100644 static/stork.wasm create mode 100644 static/sw.js create mode 100644 static/sw.min.js delete mode 100644 static/tinysearch_engine_bg.wasm (limited to 'static') diff --git a/static/font/Abridge.woff2 b/static/font/Abridge.woff2 deleted file mode 100644 index 2ce0193..0000000 Binary files a/static/font/Abridge.woff2 and /dev/null differ diff --git a/static/font/Arimo-Bold.woff2 b/static/font/Arimo-Bold.woff2 deleted file mode 100644 index cff36d9..0000000 Binary files a/static/font/Arimo-Bold.woff2 and /dev/null differ diff --git a/static/font/Arimo-Italic.woff2 b/static/font/Arimo-Italic.woff2 deleted file mode 100644 index 2adf459..0000000 Binary files a/static/font/Arimo-Italic.woff2 and /dev/null differ diff --git a/static/font/Arimo.woff2 b/static/font/Arimo.woff2 deleted file mode 100644 index f10b6c5..0000000 Binary files a/static/font/Arimo.woff2 and /dev/null differ diff --git a/static/font/FiraCode.woff2 b/static/font/FiraCode.woff2 deleted file mode 100644 index 41a8ef1..0000000 Binary files a/static/font/FiraCode.woff2 and /dev/null differ diff --git a/static/font/Roboto-Bold.woff2 b/static/font/Roboto-Bold.woff2 deleted file mode 100644 index 771fbec..0000000 Binary files a/static/font/Roboto-Bold.woff2 and /dev/null differ diff --git a/static/font/Roboto-Italic.woff2 b/static/font/Roboto-Italic.woff2 deleted file mode 100644 index e1b7a79..0000000 Binary files a/static/font/Roboto-Italic.woff2 and /dev/null differ diff --git a/static/font/Roboto-Mono-Italic.woff2 b/static/font/Roboto-Mono-Italic.woff2 deleted file mode 100644 index ece53bd..0000000 Binary files a/static/font/Roboto-Mono-Italic.woff2 and /dev/null differ diff --git a/static/font/Roboto-Mono.woff2 b/static/font/Roboto-Mono.woff2 deleted file mode 100644 index f8894ba..0000000 Binary files a/static/font/Roboto-Mono.woff2 and /dev/null differ diff --git a/static/font/Roboto.woff2 b/static/font/Roboto.woff2 deleted file mode 100644 index 020729e..0000000 Binary files a/static/font/Roboto.woff2 and /dev/null differ diff --git a/static/fonts/Roboto-Bold.woff2 b/static/fonts/Roboto-Bold.woff2 new file mode 100644 index 0000000..771fbec Binary files /dev/null and b/static/fonts/Roboto-Bold.woff2 differ diff --git a/static/fonts/Roboto-Italic.woff2 b/static/fonts/Roboto-Italic.woff2 new file mode 100644 index 0000000..e1b7a79 Binary files /dev/null and b/static/fonts/Roboto-Italic.woff2 differ diff --git a/static/fonts/Roboto-Mono-Italic.woff2 b/static/fonts/Roboto-Mono-Italic.woff2 new file mode 100644 index 0000000..ece53bd Binary files /dev/null and b/static/fonts/Roboto-Mono-Italic.woff2 differ diff --git a/static/fonts/Roboto-Mono.woff2 b/static/fonts/Roboto-Mono.woff2 new file mode 100644 index 0000000..f8894ba Binary files /dev/null and b/static/fonts/Roboto-Mono.woff2 differ diff --git a/static/fonts/Roboto.woff2 b/static/fonts/Roboto.woff2 new file mode 100644 index 0000000..020729e Binary files /dev/null and b/static/fonts/Roboto.woff2 differ diff --git a/static/js/sw_load.js b/static/js/sw_load.js new file mode 100644 index 0000000..b38f118 --- /dev/null +++ b/static/js/sw_load.js @@ -0,0 +1,13 @@ +if ("serviceWorker" in navigator) { + navigator.serviceWorker + .register("/sw.min.js?v=3.7.6", { scope: "/" }) + .then(() => { + console.info("SW Loaded"); + }, err => console.error("SW error: ", err)); + + navigator.serviceWorker + .ready + .then(() => { + console.info("SW Ready"); + }); +} diff --git a/static/js/sw_load.min.js b/static/js/sw_load.min.js new file mode 100644 index 0000000..c6cd8a1 --- /dev/null +++ b/static/js/sw_load.min.js @@ -0,0 +1 @@ +"serviceWorker"in navigator&&(navigator.serviceWorker.register("/sw.min.js?v=3.7.6",{scope:"/"}).then(()=>{console.info("SW Loaded")},e=>console.error("SW error: ",e)),navigator.serviceWorker.ready.then(()=>{console.info("SW Ready")})); \ No newline at end of file diff --git a/static/manifest.json b/static/manifest.json new file mode 100644 index 0000000..04ed38b --- /dev/null +++ b/static/manifest.json @@ -0,0 +1,30 @@ +{ + "name": "Abridge Zola Theme", + "short_name": "Abridge", + "description": "Fast & Lightweight Zola Theme", + "background_color": "#111", + "theme_color": "#222", + "display": "standalone", + "orientation": "any", + "start_url": "/", + "scope": "/", + "categories": ["developer", "development", "productivity"], + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "/android-chrome-192x192m.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/static/site.webmanifest b/static/site.webmanifest deleted file mode 100644 index 8634a6c..0000000 --- a/static/site.webmanifest +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "Abridge Zola Theme", - "short_name": "Abridge", - "description": "Fast & Lightweight Zola Theme", - "start_url": "/index.html", - "scope": "/", - "background_color": "#111111", - "theme_color": "#222222", - "display": "standalone", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - }, - { - "src": "/android-chrome-192x192m.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "maskable" - } - ] -} diff --git a/static/stork.st b/static/stork.st deleted file mode 100644 index a6aafe2..0000000 Binary files a/static/stork.st and /dev/null differ diff --git a/static/stork.wasm b/static/stork.wasm deleted file mode 100644 index 82559be..0000000 Binary files a/static/stork.wasm and /dev/null differ diff --git a/static/sw.js b/static/sw.js new file mode 100644 index 0000000..4a2b0db --- /dev/null +++ b/static/sw.js @@ -0,0 +1,175 @@ +class Pwa { + + constructor(self) { + this.scope = self; + const Version = new URL(location).searchParams.get("v"); + this.CACHE_VERSION = Version; + //this.BASE_CACHE_FILES=['/js/theme.min.js','/js/theme_light.min.js','/abridge.css','/js/abridge.min.js','/','/404.html','/offline/','/manifest.json']; + this.BASE_CACHE_FILES = ['/js/theme.min.js','/js/theme_light.min.js','/abridge.css','/js/abridge.min.js','/','/404.html','/offline/','/manifest.json']; + this.host = `${self.location.protocol}//${self.location.host}`; + console.info(`Host: ${this.host}`); + this.OFFLINE_PAGE = '/offline/'; + this.NOT_FOUND_PAGE = '/404.html'; + this.CACHE_NAME = `content-v${this.CACHE_VERSION}`; + // 3600=1hour, 28800=8hours, 86400=1day, 604800=1week, 1209600=2weeks + this.NORM_TTL = 86400;// html, json, xml, anything else undefined + this.LONG_TTL = 604800;// js, css + // rarely change, may be a good idea to periodically refresh, incase I change these and forget to increment service worker version: + this.TTL_LONG = ["js", "css"]; + // never change, cache forever unless service worker version is incremented: + this.TTL_EXEMPT = ["jpg", "jpeg", "png", "gif", "webp", "avif", "ico", "svg", "otf", "eot", "ttf", "woff", "woff2", "xml", "xsl", "txt", "mp4", "webm", "mp3", "ogg"]; + // skip these extensions so they expire same time as html: st,wasm,json(search), xml(sitemap,atom,rss) + } + + canCache(url) { + if (url.startsWith("http://localhost")) { + return false; + } + const result = url.toString().startsWith(this.host); + return result; + } + + getFileExtension(url) { + const extension = url.split('.').reverse()[0].split('?')[0]; + return (extension.endsWith('/')) ? '/' : extension; + } + + getTTL(url) { + if (typeof url === 'string') { + const extension = this.getFileExtension(url); + if (this.TTL_LONG.indexOf(extension) > -1) { + //console.info(url + ' contains a TTL_LONG extension'); + return this.LONG_TTL; + } + if (this.TTL_EXEMPT.indexOf(extension) > -1) { + //console.info(url + ' contains a TTL_EXEMPT extension'); + return null; + } + return this.NORM_TTL; + } + return null; + } + + async installServiceWorker() { + try { + await caches.open(this.CACHE_NAME).then((cache) => { + return cache.addAll(this.BASE_CACHE_FILES); + }, err => console.error(`Error with ${this.CACHE_NAME}`, err)); + return this.scope.skipWaiting(); + } + catch (err) { + return console.error("Error with installation: ", err); + } + } + + cleanupLegacyCache() { + + const currentCaches = [this.CACHE_NAME]; + + return new Promise( + (resolve, reject) => { + caches.keys() + .then((keys) => keys.filter((key) => !~currentCaches.indexOf(key))) + .then((legacy) => { + if (legacy.length) { + Promise.all(legacy.map((legacyKey) => caches.delete(legacyKey)) + ).then(() => resolve()).catch((err) => { + console.error("Error in legacy cleanup: ", err); + reject(err); + }); + } else { + resolve(); + } + }).catch((err) => { + console.error("Error in legacy cleanup: ", err); + reject(err); + }); + }); + } + + async preCacheUrl(url) { + const cache = await caches.open(this.CACHE_NAME); + const response = await cache.match(url); + if (!response) { + return fetch(url).then(resp => cache.put(url, resp.clone())); + } + return null; + } + + register() { + this.scope.addEventListener('install', event => { + event.waitUntil( + Promise.all([ + this.installServiceWorker(), + this.scope.skipWaiting(), + ])); + console.info('SW Installed'); + }); + + this.scope.addEventListener('activate', event => { + event.waitUntil(Promise.all( + [this.cleanupLegacyCache(), + this.scope.clients.claim(), + this.scope.skipWaiting()]).catch((err) => { + console.error("Activation error: ", err); + event.skipWaiting(); + })); + }); + + this.scope.addEventListener('fetch', event => { + event.respondWith( + caches.open(this.CACHE_NAME).then(async cache => { + // check if this is NOT a resource we allow cacheing (some other domain), if so fetch it instead of cache. + if (!this.canCache(event.request.url)) { + return fetch(event.request); + } + // check the cache for the requested resource + const response = await cache.match(event.request); + if (response) { + const headers = response.headers.entries(); + let date = null; + for (let pair of headers) { + if (pair[0] === 'date') { + date = new Date(pair[1]); + break; + } + } + // date is not working, so ignore TTL and just serve the cached resource. + if (!date) { + return response; + } + const age = parseInt(((new Date().getTime() - date.getTime()) / 1000).toString()); + const ttl = this.getTTL(event.request.url); + if (ttl === null || (ttl && age < ttl)) { + // return the resource if it is not beyond the TTL + return response; + } + } + // if we made it here then we either did not have the cache, or the TTL was expired. + return fetch(event.request.clone()).then(resp => { + if (resp.status < 400) { + if (this.canCache(event.request.url)) { + cache.put(event.request, resp.clone()); + } + return resp; + } + else { + return cache.match(this.NOT_FOUND_PAGE); + } + }).catch(err => { + // if we made it here then we were unable to fetch the resource. + // maybe we were only fetching because of expired TTL, so use the cache regardless of TTL: + if (response) { + return response; + } + // if we made it here then we were unable to fetch the resource and do not have it cached. + console.error(`Error fetching ${event.request.url} resulted in offline`, err); + return cache.match(this.OFFLINE_PAGE); + }) + })); + }); + } +} + +const pwa = new Pwa(self); +pwa.register(); diff --git a/static/sw.min.js b/static/sw.min.js new file mode 100644 index 0000000..c05bb61 --- /dev/null +++ b/static/sw.min.js @@ -0,0 +1 @@ +class Pwa{constructor(e){this.scope=e;var s=new URL(location).searchParams.get("v");this.CACHE_VERSION=s,this.BASE_CACHE_FILES=["/","/404.html","/about/","/abridge.css","/android-chrome-192x192m.png","/android-chrome-192x192.png","/android-chrome-512x512.png","/apple-touch-icon.png","/archive/","/atom.xml","/banner.png","/blog/","/blog/blog-section/","/blog/page/1/","/browserconfig.xml","/categories/","/categories/features/","/categories/features/atom.xml","/contact/","/elasticlunr.min.js","/favicon-16x16.png","/favicon-32x32.png","/favicon.ico","/favicon.svg","/font/Abridge.woff2","/font/Arimo-Bold.woff2","/font/Arimo-Italic.woff2","/font/Arimo.woff2","/font/FiraCode.woff2","/font/Roboto-Bold.woff2","/font/Roboto-Italic.woff2","/font/Roboto-Mono-Italic.woff2","/font/Roboto-Mono.woff2","/font/Roboto.woff2","/fonts/KaTeX_AMS-Regular.woff2","/fonts/KaTeX_Caligraphic-Bold.woff2","/fonts/KaTeX_Caligraphic-Regular.woff2","/fonts/KaTeX_Fraktur-Bold.woff2","/fonts/KaTeX_Fraktur-Regular.woff2","/fonts/KaTeX_Main-BoldItalic.woff2","/fonts/KaTeX_Main-Bold.woff2","/fonts/KaTeX_Main-Italic.woff2","/fonts/KaTeX_Main-Regular.woff2","/fonts/KaTeX_Math-BoldItalic.woff2","/fonts/KaTeX_Math-Italic.woff2","/fonts/KaTeX_SansSerif-Bold.woff2","/fonts/KaTeX_SansSerif-Italic.woff2","/fonts/KaTeX_SansSerif-Regular.woff2","/fonts/KaTeX_Script-Regular.woff2","/fonts/KaTeX_Size1-Regular.woff2","/fonts/KaTeX_Size2-Regular.woff2","/fonts/KaTeX_Size3-Regular.woff2","/fonts/KaTeX_Size4-Regular.woff2","/fonts/KaTeX_Typewriter-Regular.woff2","/fr/","/fr/about/","/fr/archive/","/fr/atom.xml","/fr/blog/","/fr/blog/blog-section/","/fr/blog/page/1/","/fr/categories/","/fr/categories/features/","/fr/categories/features/atom.xml","/fr/contact/","/fr/offline/","/fr/overview-abridge/","/fr/overview-code-blocks/","/fr/overview-embed-streamable/","/fr/overview-embed-vimeo/","/fr/overview-embed-youtube/","/fr/overview-images/","/fr/overview-images/corro.svg","/fr/overview-images/ferris-gesture.png","/fr/overview-images/ferris-gesture.svg","/fr/overview-images/ferris-happy.svg","/fr/overview-images/ferris.svg","/fr/overview-images/img/ferris-gesture.svg","/fr/overview-images/img/ferris.svg","/fr/overview-markdown-and-style/","/fr/overview-math/","/fr/overview-rich-content/","/fr/overview-rich-content/ferris-gesture.svg","/fr/overview-rich-content/ferris.svg","/fr/overview-rich-content/over9000-400.avif","/fr/overview-rich-content/over9000-640.avif","/fr/overview-rich-content/over9000-640.webp","/fr/overview-rich-content/over9000-960.avif","/fr/overview-rich-content/over9000_av1.mp4","/fr/overview-rich-content/over9000.mp3","/fr/overview-rich-content/over9000.ogg","/fr/overview-rich-content/over9000_vp9.webm","/fr/page/1/","/fr/page/2/","/fr/page/3/","/fr/page/4/","/fr/posts/","/fr/posts/posts-section/","/fr/privacy/","/fr/tags/","/fr/tags/audio/","/fr/tags/audio/atom.xml","/fr/tags/config/","/fr/tags/config/atom.xml","/fr/tags/images/","/fr/tags/images/atom.xml","/fr/tags/markdown/","/fr/tags/markdown/atom.xml","/fr/tags/mathematics/","/fr/tags/mathematics/atom.xml","/fr/tags/shortcodes/","/fr/tags/shortcodes/atom.xml","/fr/tags/video/","/fr/tags/video/atom.xml","/js/abridge.min.js","/js/codecopy.js","/js/elasticlunr.min.js","/js/email.js","/js/katex-auto-render.min.js","/js/katexbundle.min.js","/js/katex.min.js","/js/katexoptions.js","/js/lunr.da.js","/js/lunr.da.min.js","/js/lunr.de.js","/js/lunr.de.min.js","/js/lunr.du.js","/js/lunr.du.min.js","/js/lunr.es.js","/js/lunr.es.min.js","/js/lunr.fi.js","/js/lunr.fi.min.js","/js/lunr.fr.js","/js/lunr.fr.min.js","/js/lunr.hu.js","/js/lunr.hu.min.js","/js/lunr.it.js","/js/lunr.it.min.js","/js/lunr.jp.js","/js/lunr.jp.min.js","/js/lunr.no.js","/js/lunr.no.min.js","/js/lunr.pt.js","/js/lunr.pt.min.js","/js/lunr.ro.js","/js/lunr.ro.min.js","/js/lunr.ru.js","/js/lunr.ru.min.js","/js/lunr.stemmer.support.js","/js/lunr.stemmer.support.min.js","/js/lunr.sv.js","/js/lunr.sv.min.js","/js/lunr.tr.js","/js/lunr.tr.min.js","/js/lunr.zh.js","/js/lunr.zh.min.js","/js/mathtex-script-type.min.js","/js/prestyle.js","/js/search_elasticlunr.min.js","/js/searchjava.js","/js/searchjavaugly.js","/js/search.js","/js/theme_button.js","/js/theme.js","/js/theme_light.js","/js/theme_light.min.js","/js/theme.min.js","/katex.min.css","/manifest.json","/mstile-150x150.png","/nojs.css","/offline/","/overview-abridge/","/overview-code-blocks/","/overview-embed-streamable/","/overview-embed-vimeo/","/overview-embed-youtube/","/overview-images/","/overview-images/corro.svg","/overview-images/ferris-gesture.png","/overview-images/ferris-gesture.svg","/overview-images/ferris-happy.svg","/overview-images/ferris.svg","/overview-images/img/ferris-gesture.svg","/overview-images/img/ferris.svg","/overview-markdown-and-style/","/overview-math/","/overview-rich-content/","/overview-rich-content/ferris-gesture.svg","/overview-rich-content/ferris.svg","/overview-rich-content/over9000-400.avif","/overview-rich-content/over9000-640.avif","/overview-rich-content/over9000-640.webp","/overview-rich-content/over9000-960.avif","/overview-rich-content/over9000_av1.mp4","/overview-rich-content/over9000.mp3","/overview-rich-content/over9000.ogg","/overview-rich-content/over9000_vp9.webm","/page/1/","/page/2/","/page/3/","/page/4/","/posts/","/posts/posts-section/","/privacy/","/robots.txt","/safari-pinned-tab.svg","/search_index.en.json","/search_index.fr.json","/sitemap.xml","/tags/","/tags/audio/","/tags/audio/atom.xml","/tags/config/","/tags/config/atom.xml","/tags/images/","/tags/images/atom.xml","/tags/markdown/","/tags/markdown/atom.xml","/tags/mathematics/","/tags/mathematics/atom.xml","/tags/shortcodes/","/tags/shortcodes/atom.xml","/tags/video/","/tags/video/atom.xml"],this.host=e.location.protocol+"//"+e.location.host,console.info("Host: "+this.host),this.OFFLINE_PAGE="/offline/",this.NOT_FOUND_PAGE="/404.html",this.CACHE_NAME="content-v"+this.CACHE_VERSION,this.NORM_TTL=86400,this.LONG_TTL=1209600,this.TTL_LONG=["js","css"],this.TTL_EXEMPT=["jpg","jpeg","png","gif","webp","avif","ico","svg","otf","eot","ttf","woff","woff2","xml","xsl","txt","mp4","webm","mp3","ogg"]}canCache(e){return!e.startsWith("http://localhost")&&e.toString().startsWith(this.host)}getFileExtension(e){e=e.split(".").reverse()[0].split("?")[0];return e.endsWith("/")?"/":e}getTTL(e){var s;return"string"!=typeof e||(s=this.getFileExtension(e),-1e.addAll(this.BASE_CACHE_FILES),e=>console.error("Error with "+this.CACHE_NAME,e)),this.scope.skipWaiting()}catch(e){return console.error("Error with installation: ",e)}}cleanupLegacyCache(){const t=[this.CACHE_NAME];return new Promise((s,r)=>{caches.keys().then(e=>e.filter(e=>!~t.indexOf(e))).then(e=>{e.length?Promise.all(e.map(e=>caches.delete(e))).then(()=>s()).catch(e=>{console.error("Error in legacy cleanup: ",e),r(e)}):s()}).catch(e=>{console.error("Error in legacy cleanup: ",e),r(e)})})}async preCacheUrl(s){const r=await caches.open(this.CACHE_NAME);return await r.match(s)?null:fetch(s).then(e=>r.put(s,e.clone()))}register(){this.scope.addEventListener("install",e=>{e.waitUntil(Promise.all([this.installServiceWorker(),this.scope.skipWaiting()])),console.info("SW Installed")}),this.scope.addEventListener("activate",s=>{s.waitUntil(Promise.all([this.cleanupLegacyCache(),this.scope.clients.claim(),this.scope.skipWaiting()]).catch(e=>{console.error("Activation error: ",e),s.skipWaiting()}))}),this.scope.addEventListener("fetch",a=>{a.respondWith(caches.open(this.CACHE_NAME).then(async s=>{if(!this.canCache(a.request.url))return fetch(a.request);const r=await s.match(a.request);if(r){var t;let e=null;for(t of r.headers.entries())if("date"===t[0]){e=new Date(t[1]);break}if(!e)return r;var o=parseInt((((new Date).getTime()-e.getTime())/1e3).toString()),i=this.getTTL(a.request.url);if(null===i||i&&oe.status<400?(this.canCache(a.request.url)&&s.put(a.request,e.clone()),e):s.match(this.NOT_FOUND_PAGE)).catch(e=>r||(console.error(`Error fetching ${a.request.url} resulted in offline`,e),s.match(this.OFFLINE_PAGE)))}))})}}const pwa=new Pwa(self);pwa.register(); \ No newline at end of file diff --git a/static/tinysearch_engine_bg.wasm b/static/tinysearch_engine_bg.wasm deleted file mode 100644 index c3559af..0000000 Binary files a/static/tinysearch_engine_bg.wasm and /dev/null differ -- cgit v1.3.1