Books: request persistent storage when first caching a book
All checks were successful
Build and push Docker image / build (push) Successful in 16s
Test / test (push) Successful in 15s

Ohne navigator.storage.persist() ist der IndexedDB-Speicher "best-effort"
und kann vom Browser bei Speicherknappheit still gelöscht werden. Der
Aufruf erfolgt beim ersten Schreiben eines Buches in den Cache — Chrome
gewährt das für installierte PWAs automatisch, Firefox kann einen Dialog
zeigen.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
marwin 2026-05-29 23:54:54 +02:00
parent 3d25519367
commit 5ba1a7bdad

View file

@ -2731,6 +2731,10 @@ async function _setCachedBook(bookId, data_ct, data_iv) {
tx.oncomplete = resolve;
tx.onerror = resolve;
});
// Request persistent storage so the browser doesn't evict cached books
// under storage pressure. Chrome grants this silently for installed PWAs;
// Firefox may show a permission prompt.
if (navigator.storage?.persist) navigator.storage.persist();
} catch {}
}