[Reader][Offline] Read downloaded EPUBs offline + blob-URL resource rewriter #658

Closed
opened 2026-07-17 15:18:19 +00:00 by spikerj · 1 comment
Owner

The final piece of the offline reading workstream — a downloaded EPUB reads with no network, images included.

  • epub-offline-resource-rewriter (pure module): rewrites each epub-resource?file=X URL in already-sanitized page HTML to a blob: URL from the offline store. Runs post-sanitize because DOMPurify strips blob: URIs; uncached resources keep their original URL (online unaffected); returns every created object URL so the caller can revoke them.
  • epub-reader: when !navigator.onLine, loadPage/loadChapters resolve from the offline store (page + TOC) with a cache fallback. safeHtml is now set by an async render effect that applies the resource rewrite when offline and revokes the previous page's blob URLs on each render and on destroy (no leaks). The online path is unchanged (synchronous cache/network).

Unit-tested: rewriter (no-op / rewrite+track / keep-uncached / dedup) + epub-reader offline store-first read (no network) alongside the existing 43 online tests.

Completes the reader offline feature (with the store #651, download service, download button #653, profile section #654, PDF-offline #655).

PR: spikersoft-angular feat/reader-offline-epub-read.

The final piece of the offline reading workstream — a downloaded EPUB reads with no network, images included. - **`epub-offline-resource-rewriter`** (pure module): rewrites each `epub-resource?file=X` URL in already-sanitized page HTML to a `blob:` URL from the offline store. Runs **post-sanitize** because DOMPurify strips `blob:` URIs; uncached resources keep their original URL (online unaffected); returns every created object URL so the caller can revoke them. - **epub-reader**: when `!navigator.onLine`, `loadPage`/`loadChapters` resolve from the offline store (page + TOC) with a cache fallback. `safeHtml` is now set by an async render effect that applies the resource rewrite when offline and **revokes the previous page's blob URLs** on each render and on destroy (no leaks). The online path is unchanged (synchronous cache/network). Unit-tested: rewriter (no-op / rewrite+track / keep-uncached / dedup) + epub-reader offline store-first read (no network) alongside the existing 43 online tests. Completes the reader offline feature (with the store #651, download service, download button #653, profile section #654, PDF-offline #655). PR: spikersoft-angular `feat/reader-offline-epub-read`.
Author
Owner

Verified complete: spikersoft-angular PR #229 merged ('read downloaded EPUBs offline + blob-URL resource rewriter'); epub-reader carries the offline/blob-URL handling on master. Closing.

Verified complete: spikersoft-angular PR #229 merged ('read downloaded EPUBs offline + blob-URL resource rewriter'); epub-reader carries the offline/blob-URL handling on master. Closing.
Sign in to join this conversation.