fix(web,api): UI fiche livre et lecteur — progression, locators EPUB/PDF, styles
- web: BookPage/ReaderPage enrichis, sauvegarde de progression lecteur - web: locators EPUB/PDF normalisés (+ tests), EpubReader/PdfReader ajustés - web: nginx et service worker ajustés - api: progress — corrections contrôleur/service Refs: #13
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
const CACHE_NAME = "readabook-shell-v1";
|
||||
const SHELL = ["/", "/home", "/manifest.webmanifest", "/icons/readabook.svg"];
|
||||
const CACHE_NAME = "readabook-shell-v2";
|
||||
const SHELL = ["/", "/index.html", "/manifest.webmanifest", "/icons/readabook.svg"];
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(SHELL)));
|
||||
@ -18,5 +18,19 @@ self.addEventListener("fetch", (event) => {
|
||||
if (event.request.method !== "GET" || ["/auth", "/admin", "/books", "/progress"].some((path) => url.pathname.startsWith(path))) {
|
||||
return;
|
||||
}
|
||||
event.respondWith(fetch(event.request).catch(() => caches.match(event.request).then((hit) => hit || caches.match("/"))));
|
||||
if (event.request.mode === "navigate") {
|
||||
event.respondWith(
|
||||
fetch(event.request)
|
||||
.then((response) => {
|
||||
const copy = response.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => cache.put("/index.html", copy));
|
||||
return response;
|
||||
})
|
||||
.catch(() => caches.match("/index.html").then((hit) => hit || caches.match("/")))
|
||||
);
|
||||
return;
|
||||
}
|
||||
event.respondWith(
|
||||
caches.match(event.request).then((hit) => hit || fetch(event.request))
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user