diff options
author | 2020-09-23 20:20:31 -0700 | |
---|---|---|
committer | 2020-09-23 20:40:06 -0700 | |
commit | 75b11d5744bdd0a39b1fc86fcb2a815beba8d893 (patch) | |
tree | a353471f0144eb1390149b1864219435b019c658 /ui/static/js/service_worker.js | |
parent | eb026ae4ac13e6dda7b761945731eb0df658b1cb (diff) | |
download | v2-75b11d5744bdd0a39b1fc86fcb2a815beba8d893.tar.gz v2-75b11d5744bdd0a39b1fc86fcb2a815beba8d893.tar.zst v2-75b11d5744bdd0a39b1fc86fcb2a815beba8d893.zip |
Rename service worker script to avoid being blocked by uBlock
Diffstat (limited to 'ui/static/js/service_worker.js')
-rw-r--r-- | ui/static/js/service_worker.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ui/static/js/service_worker.js b/ui/static/js/service_worker.js new file mode 100644 index 00000000..8e32fcbb --- /dev/null +++ b/ui/static/js/service_worker.js @@ -0,0 +1,14 @@ +self.addEventListener("fetch", (event) => { + if (event.request.url.includes("/feed/icon/")) { + event.respondWith( + caches.open("feed_icons").then((cache) => { + return cache.match(event.request).then((response) => { + return response || fetch(event.request).then((response) => { + cache.put(event.request, response.clone()); + return response; + }); + }); + }) + ); + } +}); |