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:
Git Agent
2026-08-23 10:32:44 +02:00
parent e94524f119
commit 85b56ef3b2
12 changed files with 254 additions and 54 deletions

View File

@ -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))
);
});