feat: replace the epub reader with foliate-js

Drops epub.js's 1600-location pre-pass and its localStorage cache: foliate
hands back a CFI and an overall fraction on every relocate, so first open no
longer freezes.

Also fixes resuming (pre-resolves the stored CFI, falling back to the stored
percentage rather than silently resetting to page one), progress saving
(missing Content-Type, and no flush on the way out), and arrow keys inside
the book iframe.
This commit is contained in:
2026-08-11 22:21:15 -04:00
parent 783f4d226d
commit 190e7af76d
7 changed files with 581 additions and 352 deletions
@@ -7,18 +7,15 @@
const fileId = page.params.fileId!;
const bookId = page.params.bookId!;
// Streams the file through the proxy so the browser fetches it directly
// Fetched by the browser through the proxy, which attaches the auth header
const bookUrl = `/api/books/download/${bookId}/${fileId}`;
</script>
<svelte:head>
<title>{data.title} — Chitai</title>
</svelte:head>
<EpubReader
{bookUrl}
{bookId}
title={data.title}
filename={data.filename}
initialProgress={data.initialProgress}
initialEpubLoc={data.initialEpubLoc}
/>