mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Add service worker to cache feed icons
This commit is contained in:
parent
c926498d3d
commit
6aa02680d8
8 changed files with 94 additions and 35 deletions
14
ui/static/js/sw.js
Normal file
14
ui/static/js/sw.js
Normal file
|
@ -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;
|
||||
});
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue