Commit graph

334 commits

Author SHA1 Message Date
Huang Xin
3e6cb2bca9
fix(deps): resolve open Dependabot alerts (#5778)
* fix(deps): resolve open Dependabot alerts

* test: remove lockfile version assertions

* chore(deps): point Foliate at merged PDF.js fix
2026-08-18 20:22:38 +02:00
Huang Xin
89821136fb
fix(cbz): order split chapter folders base-first (#5762)
* fix(cbz): order split chapter folders base-first (#5745)

A CBZ chapter split across folders sharing a chapter number, such as
Chapter 0060/ and Chapter 0060 (2)/, rendered part 2 before part 1:
image paths were flattened and sorted as plain strings, and a space
sorts before a slash. Bump foliate-js to compare paths segment by
segment with a numeric collator so a folder that is a prefix of a
sibling sorts first, and add a regression test for the reported layout.

Fixes #5745

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: pin foliate-js to the squash-merged commit of readest/foliate-js#79

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump foliate-js to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 15:29:34 +02:00
Huang Xin
a193cbc35e
fix(reader): keep chapter images openable after repeated footnote popups (#5756)
In a novel whose notes and pictures share a chapter file, opening a footnote
popup and dismissing it twice made that chapter's illustrations impossible to
open until the book was closed and reopened. The pictures stayed on screen,
so only tapping one was broken.

The footnote popup opens a second foliate-view on the same book, so it loads
a section the reading view already holds and unloads it on dismiss. foliate-js
counted that second load in a shared bucket keyed by an absent parent, so the
reference was skipped while the dismiss still decremented, and the count
underflowed to zero and revoked the chapter's blob URLs, images included,
under the view still showing them. An img that has already decoded stays
painted after its blob URL is revoked, which is why the page looked fine and
only convertBlobUrlToDataUrl failed, leaving the image viewer unopened.

Bump foliate-js for the Loader refcount fix (readest/foliate-js#78) and cover
both halves of it: repeated popups must revoke nothing while the reader holds
the section, and a section must still be freed once its views close, since the
renderer reads a section's content in addition to loading it.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-17 09:35:58 +02:00
Huang Xin
631cd6454f
feat(annotator): support text selection tools in footnote popups (#5744)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
PR checks / rust_lint (push) Waiting to run
PR checks / koplugin_rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
* feat(annotator): support text selection tools in footnote popups

Selections inside the footnote popup window now surface the annotation
toolbar (closes #5646). The popup document is a mutated copy of the
section (foliate extracts the note fragment into an empty body), so a
new mapping utility translates selection ranges into CFIs that resolve
in the pristine section, using the extraction info the footnote handler
now emits. Highlights created from the popup are saved against the real
book position, drawn immediately inside the popup, redrawn when the
popup reopens, and removed when deleted. Clicking a drawn highlight in
the popup opens the toolbar in its annotated state (restyle or delete)
and a note bubble click opens the note view, like the same clicks in
the main view. Notes added from the popup merge into the existing
highlight record (the notebook save now uses the mapped CFI instead of
recomputing one from the popup range) and draw their bubble overlay in
the popup as well.

For popups whose text is synthesized from a data or alt attribute there
is no real text node to anchor to: the toolbar still opens for copy,
search, dictionary, and translate, while highlight, annotate, copylink,
and proofread are disabled. TTS is disabled for all popup selections
since it reads from the main view documents.

The Annotator now renders after FootnotePopup so the selection toolbar
stacks above the popup and its dismiss overlay.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump foliate-js to the merged extraction CFI mapping commit

Points the submodule at readest/foliate-js#77 as squash-merged on the
fork's main branch (57c9358), content-identical to the previous branch
head.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(annotator): address review findings on footnote popup selections

- Guard the popup selection handler with an epoch so a handler still
  awaiting getAnnotationText cannot overwrite a cleared or newer
  selection with stale state.
- Block the annotate keyboard shortcut for CFI-less popup selections,
  matching the disabled toolbar button; it opened the notebook against
  an anchor that could never save.
- Resolve and validate the CFI before the copy-to-notebook toast so an
  excerpt that cannot be anchored is not reported as saved.
- Normalize every element-container range boundary, not just ones on the
  popup body: CFI drops offsets on even element steps, so an inner
  boundary silently collapsed to the element start.
- Reject notes from other sections with a string spine-prefix compare
  before the parse and DOM work in getFootnoteLocalCfi; a heavy library
  re-mapped every annotation in the book on each store update.
- Extract the repeated popup reset into resetPopupAnnotationState, add a
  pointerup trigger to the host-document selection path for parity with
  the popup-document path, and rename the shadowing view binding in
  handleBeforeRender to popupView.
- Assert resolved node and offsets in the CFI round-trip tests, and cover
  the null paths of getFootnoteSelectionCfi.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-16 16:34:16 +02:00
Huang Xin
6f67be7030
fix(reader): restore scrolled PDF highlights (#5719)
* fix(reader): restore scrolled PDF highlights, closes #5586

* chore: point foliate-js to merged PDF fix

* test(reader): assert stale PDF overlayer is attached
2026-08-15 16:52:54 +02:00
Huang Xin
a6e6691c8d
feat(reader): right-to-left page order for fixed-layout books (#5712)
* fix(reader): target the active book when the settings shortcut opens the dialog

The Shift+F shortcut opened the settings dialog without setting its book
key, so the dialog ran in bookless mode: writing mode and other per-book
changes were saved under an empty key, nothing applied to the open book,
and recreateViewer('') threw Book not found. Pass the sidebar book key
like the view menu entry does.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(reader): right-to-left page order for fixed-layout books, closes #5591

Books bound right-to-left (Japanese photo books, manga, RTL PDFs) showed
two-page spreads paired and ordered left-to-right with no discoverable
way to fix it.

Add a Right-to-Left Pages toggle to the view menu's fixed-layout section
next to the spread controls. It drives the existing per-book writingMode
setting (horizontal-rl / horizontal-tb) so it stays consistent with the
Layout panel and persists like any view setting.

Auto-detect the binding for PDFs that declare it: makePDF now surfaces
the catalog's ViewerPreferences /Direction /R2L as book.dir, and the
viewSettings.rtl derivation considers the loaded document's dir so
page-turn taps and swipes follow the reading direction.

Mirror the @pdfjs alias into the browser vitest config so browser tests
can load foliate-js/pdf.js, and translate the new label across all
locales along with the previously untranslated Send Document Metadata
key that extraction surfaced.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(reader): bump foliate-js to the merged R2L direction commit

readest/foliate-js#75 was squash merged, so point the submodule at the
commit on main instead of the feature branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-15 10:40:39 +02:00
Huang Xin
c0b953db7b
feat(reader): scroll Auto Scroll smoothly at low speeds (#5679)
Auto Scroll stepped visibly instead of gliding, worst at the slow end. Scroll
offsets quantize to whole CSS pixels in both Blink and WebKit, so PacedScroller
could only ever emit whole pixels and carried the remainder between frames. At
the minimum speed of 5px/s that is one 1px jump every 200ms.

The scroller now reports the carried remainder every frame, and the session
renders it through the paginator's new subpixelOffset, a composited transform
on the scrollport of less than one pixel. Whole pixels stay in the scroll
position, so progress, relocate, preloading and annotations are unaffected, and
the offset is cleared when the session stops.

Measured on iPhone XR / iOS 18.5 at 5px/s over 2s: 11 distinct on screen
positions with a 1px largest jump before, 121 of 121 frames with a 0.105px
largest jump after, over the same distance. End to end in the web app under
WebKit: 150 of 150 frames distinct, largest jump 0.52px.

Bumps foliate-js for the subpixelOffset API.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 16:49:59 +02:00
Huang Xin
4d15efbe4a
fix(reader): reach the last page of the book on iOS, closes #5663 (#5678) 2026-08-13 19:20:09 +08:00
Huang Xin
124655e3ae
fix(reader): update progress during Auto Scroll and put slider overlay values on top (#5676)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
PR checks / rust_lint (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
* fix(reader): keep progress updating while auto scroll never pauses

The scrolled-mode relocate in foliate sits behind a 250ms trailing
debounce, and Auto Scroll steps the container every frame, so the timer
reset forever and percentage plus time remaining only updated when the
scrolling paused. Bump foliate-js so a continuous run of scroll events
relocates at most once per second while it lasts, and add a regression
test driving a 2.5s scroll burst.

Fixes item 2 of #5635.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(reader): show the slider overlay value above the track

While the swipe gesture adjusts speed or brightness the finger sits on
or below the edge capsule, hiding a readout placed under the slider.
Move the value label to the top and the icon to the bottom in both the
Auto Scroll speed overlay and the brightness overlay.

Fixes item 3 of #5635.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(submodule): point foliate-js at merged main for the relocate max-wait fix

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 12:10:16 +02:00
Huang Xin
709a39ff39
fix(reader): stop iOS 16 WebContent crash when opening a book (#5654)
* fix(reader): stop iOS 16 WebContent crash when opening a book

A supporter reported that Readest on iOS 16.7 (iPhone 8 Plus) crashes
back to the home screen the moment any EPUB is opened, with a
com.apple.WebKit.WebContent .ips generated on every attempt and no
jetsam events. The crash log shows a release assert (EXC_BREAKPOINT)
in DeferredPromise::callFunction resolving the FontFaceSet ready
promise under CSSFontSelector::buildStarted during style resolution.

Root cause: WebKit before Safari 17 resolves document.fonts.ready
synchronously when a style resolver rebuild purges still-loading
font faces, which is forbidden mid style resolution. Readest hits
this deterministically: foliate-js accesses doc.fonts.ready on
section load, the injected @font-face fonts are still loading when
the theme and view settings swap the stylesheets, and the next
style pass purges the old faces and resolves the promise. iOS 17
defers the resolution to a queued task, which is why newer devices
are unaffected.

Bump foliate-js so the paginator never touches fonts.ready on the
affected engines (AppleWebKit/605 without URL.canParse) and polls
fonts.status instead, and add a regression test for the helper.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(scripts): add standalone repro server for the iOS 16 fonts.ready crash

Serves a page that isolates the WebKit engine bug from app timing: a
font request that never completes, fonts.ready accessed inside the load
handler, then a stylesheet swap. Affected engines kill the WebContent
process on the next render tick; unaffected engines keep counting a
visible STILL ALIVE status. Useful for verifying which iOS versions
carry the fatal assert since shipped security trains diverge from the
public WebKit branches.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(deps): point foliate-js at merged main (foliate-js#71)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-12 18:16:48 +02:00
Huang Xin
474403e8fa
fix(sync): recover KOReader progress when a chapter is not well-formed XML (#5630)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
PR checks / rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
Reading progress pushed from the Readest KOReader plugin never moved the
reader, and roughly five seconds later the debounced auto-push overwrote
the newer remote position with the older local one.

The plugin sends `progress` + `xpointer` and never a `location`, so the
CREngine XPointer is the only precise handle on the remote position.
Converting it loads the target section through `Section.createDocument()`
whenever that section is not the rendered one. For a book whose chapters
declare `application/xhtml+xml` but are not well-formed XML, that returned
a `parsererror` document with a null body and the conversion threw
`TypeError: Cannot read properties of null (reading 'children')`.

foliate-js now retries such a section as HTML, matching what the render
path has always done. On top of that, `applyRemoteProgress`:

- wraps the conversion in try/catch, so one unconvertible XPointer can no
  longer reject the whole pull and skip the proofread rule merge
- feeds the KOReader page fraction in as the DocFragment drift anchor,
  which the KOSync path already did, and only for a config with no CFI of
  its own so a Readest-origin record is not re-anchored (#5109)
- falls back to that fraction when the XPointer will not convert at all,
  moving forward only, so an approximate jump cannot lose the place

Fixes #5625
2026-08-11 17:48:14 +02:00
Huang Xin
6756782726
fix(ios): App Review launch crash, CarPlay crash on connect, and main thread hangs (#5590)
* fix(ios): anchor the auth sheet to the app window

presentationAnchor returned UIApplication.shared.windows.first, which is
deprecated since iOS 15 and returns every window of every scene in an
arbitrary order. Whenever the keyboard is up the app also owns a
UIRemoteKeyboardWindow and a UITextEffectsWindow, which is exactly the
state the sign in screen is in when the user taps an OAuth provider after
typing credentials. Anchoring ASWebAuthenticationSession to one of those
leaves UIKit's remote view controller hosting without a process handle and
it aborts the app:

  EXC_BREAKPOINT: Invalid condition not satisfying: processHandle
  __85-[_UIRemoteViewControllerSceneHostingImpl
        _viewServiceHostSessionDidConnectToClient:]_block_invoke

The `?? UIWindow()` fallback was worse, since a window with no scene can
never host a remote view controller at all.

Resolve the anchor through connectedScenes instead, prefer the foreground
active scene, and keep only windows at UIWindow.Level.normal, which is the
public API discriminator that excludes the keyboard and text effects
windows. The remaining fallback stays attached to a scene.

Reported by App Review against 0.12.1 on iOS 26.6.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(ios): serve rangefile requests off the main thread

The handler responded inline behind a comment claiming it always runs off
the UI thread. That holds on Android, where shouldInterceptRequest is
called on a WebView worker, but not on iOS or macOS, where WKWebView
invokes WKURLSchemeHandler on the main thread. So the scope check and the
range read both blocked the UI:

  WebKit::WebURLSchemeHandlerCocoa::platformStartTask
  ...
  realpath$DARWIN_EXTSN
  __getattrlist

is_allowed canonicalizes every path component and the file read follows,
which on a large book or a not yet materialized iCloud file is easily past
the 2s app hang threshold. This was the largest hang group in production,
519 events across 138 users, plus about nine smaller sibling groups.

The scheme is registered with register_asynchronous_uri_scheme_protocol
precisely so the responder can outlive the call, so hand the blocking work
to the runtime blocking pool and return immediately.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(ios): bump tao so CarPlay stops crashing on connect

tao implements application:configurationForConnectingSceneSession:options:
whenever a scene manifest is present, which makes UIKit stop consulting
Info.plist. It then answered every session role with a hardcoded
UIWindowSceneSessionRoleApplication configuration and TaoSceneDelegate, so
the CarPlay scene never reached CarPlaySceneDelegate and
-[CPTemplateApplicationScene _deliverInterfaceControllerToDelegate] raised
NSGenericException the moment a user tapped Readest on the CarPlay home
screen. 726 crashes across 326 users on 0.11.20, spanning iOS 15.5 to
27.0.

Picks up readest/tao#1, which reads the connecting session role and lets
UIKit resolve non window roles from the manifest.

Verified on an iPhone 17 Pro simulator running iOS 26.3 with a CarPlay
external display. Before, tapping the icon terminated the app with the
exception above. After, the CPListTemplate renders with the book entry and
the process survives.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* chore: record the 0.12.1 App Review crash investigation

How to identify Apple's review device in Sentry, the CarPlay root cause and
its simulator repro recipe, the main thread hang, and the traps that cost
time along the way (stale build artifacts under gen/apple/build, build
script caches pinning deleted worktree paths, and pnpm piped into tail
hiding a failed build behind exit 0).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09 05:42:03 +02:00
Huang Xin
b1bafcaf4d
fix(reader): keep the cursor visible while text is selected (#5557)
Autohide blanked the pointer one second after the last mousemove regardless of
what the reader was doing, so it hid the cursor in the middle of a selection:
during a paused selection drag, and after a double-click word select, which
fires no mousemove at all and simply let the already armed timer run.

foliate-js now skips hiding while the element's document holds a non-collapsed
selection. The guard sits in hide() rather than at arm time, so it covers both
a selection made after the timer was armed and the timer re-armed while a
selection stands. ownerDocument resolves to the right scope for either
instance: the top document for the host element, and the section's iframe
document for the per-section clone, which is where reader selections live.

Autohide resumes as soon as the selection collapses, which any click does, and
the next mousemove re-arms the timer, so there is no stuck-visible state. The
lookup popups deliberately keep the selection live while open, so the cursor
now also stays visible for as long as the reader is aiming at one.

Bumps foliate-js to readest/foliate-js#68.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 16:34:43 +02:00
Huang Xin
22308485fc
feat(tts): speak Japanese ruby readings instead of the base kanji (#5546)
* feat(tts): speak Japanese ruby readings instead of the base kanji

Kanji readings are not derivable from the characters: most kanji have
several readings picked by context, proper names follow no rule at all, and
fiction authors deliberately assign readings (神聖文字 glossed as
ヒエログリフ). Skipping <rt> meant TTS spoke the base and let the engine
guess, discarding the one source of truth the book ships. Older Japanese
EPUBs are worse still -- they render rare kanji as an <img> inside the ruby,
so the word was read as nothing at all.

Ruby is now decided per base-run/reading pair instead of by tag name. When
the <rt> holds a kana reading it is spoken and the base it annotates is
muted; anything else keeps the previous behaviour, which is what leaves
emphasis dots, pinyin, zhuyin, latin glosses and injected WordLens glosses
reading their base as before. An empty <rt> padding okurigana keeps its
base, so 振り仮名 still reads ふりがな rather than ふがな.

The highlight follows: ranges anchored on a reading widen to the whole
<ruby> so the base is painted, and annotations no longer paint the furigana
floating above the text they cover.

Fixes #5539

* fix(tts): drop a cover that fails to load from the player layout

A book can carry a coverImageUrl that no longer resolves. The broken <img>
still occupied its box: a blank 128px band above the title in the player
sheet, and the browser's broken-image glyph in the mini player card.
2026-08-07 04:12:36 +02:00
Huang Xin
69985e5e5a
feat(reader): horizontal scrolling mode for fixed layout books (#5485)
* test: update scroll anchor tests to axis neutral helper API

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test: cover horizontal scroll mode layout and direction switching

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test: cover RTL horizontal scroll direction and anchor round trip

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test: cover horizontal scroll navigation, wheel translation, and container position

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(reader): persist scrolledDirection view setting and wire it to the renderer

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(reader): three way flow selector for fixed layout books

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(reader): horizontal scrolling mode for fixed layout books

Closes #4995

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test: cover wheel-over-page translation in horizontal scroll mode

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* refactor(reader): present fixed layout flow modes as icon buttons

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump foliate-js for horizontal scroll wheel fix

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(reader): keep scrolledDirection per book and gate line snap skip to fixed layout

scrolledDirection was saved with skipGlobal false, so picking Horizontal
on a PDF wrote into global view settings and bled into every other book,
including reflowable EPUBs whose line-snapped page turns then silently
disabled themselves. Save it per book like the other fixed-layout-only
settings (zoomMode, spreadMode, keepCoverSpread).

As defense in depth, gate the scrolled-mode snap skip on the book
actually being fixed-layout rather than on scrolledDirection alone, and
bump the foliate-js submodule for the matching fix that stops attaching
the scroll-mode wheel listener when scroll mode is vertical.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: point foliate-js at merged main for horizontal scroll (#65 squash)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-04 07:37:22 +02:00
Huang Xin
6469cbb5b5
fix(reader): fix duokan fullscreen cover rendering and swipe (#5263) (#5473)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / rust_lint (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
Bump foliate-js to merged main for the three cover-page fixes
(readest/foliate-js#63, readest/foliate-js#64):

- Fullscreen covers letterbox at their original aspect ratio with black
  bars, matching Duokan Reader, instead of stretching edge-to-edge.
- A positioned wrapper (from duokan-bleed handling) no longer collapses
  the pinned cover image to a blank page.
- Restoring at a cover whose anchor has no client rects now seeds the
  paginator scroll bounds, so swipe-to-paginate works on the first page
  right after opening (verified on a Xiaomi device with the reporter's
  book).

Update the duokan-cover browser tests to the letterbox expectations and
add a repro-5263.epub fixture covering the positioned-wrapper case.

Fixes #5263

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-03 19:52:20 +02:00
Huang Xin
3ca5d58798
fix(pdf): keep desktop PDF text sharp (#5251) (#5348)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
PR checks / rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
The iOS canvas memory budget from #5129 applied on every platform. Its
MAX_CANVAS_PIXELS ceiling is phone sized (3.1 Mpx) and a PDF page fitted to a
desktop window is several times that on its own, so the render dpr collapsed
below the screen's own: on a dpr 2 desktop a 1280x1578 CSS page rasterised to a
1597x1969 bitmap, a render dpr of 1.25. The canvas upscales that raster into its
CSS box, which is what made PDF glyph edges blurry in 0.11.20.

Bump foliate-js so the budget applies to mobile WebViews only, where the
WKWebView content process really is killed past its memory high water mark.
Desktop rasterises at the true devicePixelRatio again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 17:30:57 +02:00
Huang Xin
0e4272e4cc
fix(epub): fall back to cover-named zip entries (#5273) (#5339)
EPUBs that carry a cover.jpg in the container without declaring it in
the manifest (no properties="cover-image", no <meta name="cover">
target, no manifest item at all) showed up in the library with no
cover, even though every other reader finds the image.

Both parsers now scan the container's own entry names for one ending
in cover/couv plus an image extension once manifest resolution comes
up empty, matching what gnome-epub-thumbnailer falls back to. The Rust
importer and foliate-js apply the same rule so native and web imports
resolve the same image.
2026-07-26 16:19:22 +02:00
yum
ecd9fce65d
perf(reader): improve Slide/Curl gesture responsiveness (#5291)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
PR checks / rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
* feat(reader): improve captured page turn responsiveness

* perf(reader): prebuild page-turn surfaces
2026-07-25 17:38:46 +02:00
Huang Xin
a32646545d
Fix high-priority reader runtime errors (#5236)
* fix(reader): contain native runtime failures

Handle external opener rejections and pin the foliate paginator guards for invalidated sections and failed iframe documents.

Fixes READEST-G4

Fixes READEST-97

Fixes READEST-A7

Fixes READEST-V

Fixes READEST-1F

Fixes READEST-2Y

Fixes READEST-72

* chore: pin merged foliate-js paginator fix
2026-07-21 16:02:01 +02:00
yum
2aa044d273
fix(reader): keep captured turns aligned with the finger (#5217)
* fix(reader): keep captured turns aligned with the finger

* chore(foliate): point submodule to merged upstream commit

readest/foliate-js#58 landed on main as dd71f2b, a squash of the PR head
0b006a6 with an identical tree. Retarget the submodule from the PR-branch
commit to the official merged commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Huang Xin <chrox.huang@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 21:45:25 +02:00
yum
1680e53b1f
fix(reader): synchronize toolbar with layered page turns (#5179) 2026-07-19 05:57:33 +02:00
Huang Xin
bc5e6640b5
fix(reader): stop vertical swipes from turning or flashing the layered slide (#5185)
* fix(reader): stop vertical swipes from turning or flashing the layered slide

Bumps foliate-js to readest/foliate-js#57: with the layered slide/curl
turn styles, a vertical toolbar toggle swipe could randomly turn the page
forward or backward (a landing wobble started a view transition drag that
the release committed on lift off flick jitter, and snap() judged alignment
by last sample velocities), and on fractional device pixel ratio screens
every same page settle missed the exact equality short circuit and flashed
a full page view transition to the page it was already on. Reported on
Android 16 with WebView 148 and reproduced, bisected, and re-verified over
CDP on the device with a rebuilt build.

Adds browser regression tests for the three gestures against the real
paginator: a vertical swipe with a lift off hook, a wobble start vertical
swipe (asserting no view transition engages at all), and a sub pixel scroll
offset settle.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump foliate-js to the readest/foliate-js#57 merge commit

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 19:37:33 +02:00
Huang Xin
99931a9a3c
fix(pdf): prevent iOS WebContent OOM crash on PDF page turn and zoom (#5118) (#5129)
On iOS the WKWebView content process is killed by Jetsam when it exceeds
its per-process memory high-water limit (~2 GB); a device crash log shows
the foreground WebContent process reaching 2.10 GB while paging a PDF,
after which the web page reloads. render() rasterised each page at
zoom * devicePixelRatio (dpr 3 on phones) and fitted the device-resolution
canvas into its box with transform: scale(1/dpr): the bitmap grew with
dpr squared, and the transform (visual only, not layout) left WebKit
backing the whole device-oversampled page with a GPU IOSurface that grew
quadratically with zoom. macOS has no such per-process ceiling, so the
crash was iOS only.

Bump foliate-js (readest/foliate-js#55): clamp the render dpr and render
the DOM at display size, over-sampling only the canvas bitmap (no document
transform/zoom, so text selection and the annotation toolbar stay
correctly placed). Add a regression test and update the #4587 spread-seam
test for the display-size canvas box.

Closes #5118

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 20:25:28 +02:00
Huang Xin
a97e44bbd5
fix(epub): load chapters whose zip entry name needs percent-encoding (#5100)
A chapter stored in the zip as "a&b.html" is referenced from the manifest
as href="a%26b.html". foliate-js resolved that href with decodeURI(),
which by spec leaves the reserved set (; / ? : @ & = + $ , #) encoded, so
the href never matched the zip entry. The zip loader returns null for an
unknown entry, so the chapter rendered as a blank page rather than
raising an error.

Pick up the foliate-js fix and cover the regression: the reported "&"
chapter, its table of contents entry, and the rest of the reserved
characters that failed the same way.

Fixes #5097

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 16:02:15 +02:00
Huang Xin
58d4661b74
feat(ios): CarPlay support and native TTS playout with Now Playing integration (#5085)
* feat(ios): add CarPlay support for TTS

Surface active TTS sessions on Apple CarPlay, mirroring the Android Auto
integration. A CarPlaySceneDelegate presents a CPListTemplate root
showing the currently reading book (or a placeholder when idle) and
pushes the system Now Playing template. Transport and metadata ride the
existing MPNowPlayingInfoCenter / MPRemoteCommandCenter path, so no
CarPlay button is routed by hand. A new iOS-only update_carplay_state
command lets the media bridge report session start and stop, and TTS
autoplay deep links are consumed even when the target book is already
mounted, for example when the app cold restores straight into the
reader.

Registering the UIApplicationSceneManifest crashed the app at launch on
real devices: tao's configuration_for_connecting_scene_session returned
a raw borrow of a Retained UISceneConfiguration it immediately dropped,
so UIKit retained freed memory. Add the tao fork as the packages/tao
submodule (github.com/readest/tao, branch readest-0.35: tao 0.35.3 plus
only the callback returning an autoreleased strong reference) and patch
it in the workspace. Bump @tauri-apps/api to 2.11.1 and @tauri-apps/cli
to 2.11.4 for the tao 0.35/wry 0.55 stack, and advance the tauri fork
(branch readest-2.11) with a guard in the generated unlisten script
against already-removed listeners.

The tauri 2.11 stack needs two CI accommodations. First, the
build_tauri_app job overrides setup-rust-toolchain's default RUSTFLAGS
of -D warnings: cargo builds path-patched dependencies without
cap-lints, so upstream warnings in the tao fork (deprecated glib
channel calls in the Linux backend) would fail the app build; warnings
in our own crate stay enforced by the rust_lint job. Second, tauri 2.11
enforces ACL for IPC from remote origins even without an AppManifest
(upstream security fix #15266), and the webdriver harness serves the
vitest tester page from its own port, which is a remote origin, so
every custom app command was denied and 56 tauri tests failed.
Production is unaffected since real app pages are local origins.
Declare the app commands in the ACL app manifest in build.rs (generated
allow permissions committed under src-tauri/permissions/autogenerated),
grant them in capabilities/default.json for local windows, and add a
webdriver-remote capability for localhost remote origins that is pinned
out of shipped builds via app.security.capabilities in tauri.conf.json;
scripts/test-tauri.sh opts into it with a --config override. Verified
with pnpm test:tauri: 112 passed, 1 skipped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(android): handle audio focus properly for background TTS

Request focus with a modern AudioFocusRequest (USAGE_MEDIA,
CONTENT_TYPE_SPEECH) and pause instead of ducking, matching how spoken
audio should yield to navigation prompts. Resume after transient loss
only when the loss is what paused us, forward focus transitions to the
web side as media-session play/pause events, and pause on
ACTION_AUDIO_BECOMING_NOISY so unplugging headphones does not blast the
speaker.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(ios): native audio playout for Edge TTS with Now Playing support

WebAudio in WKWebView renders in WebKit's GPU process under an audio
session the app cannot own, which made every system media behavior
unreliable on device: no lock-screen card, the card vanished on pause,
AirPods resumed another app, and the mute switch silenced playback.

Play the Edge TTS utterances with an in-process AVPlayer instead. The
native-tts plugin gains a deliberately dumb playout engine
(playout_enqueue, playout_control, playout_position) and the new
NativeAudioPlayer mirrors the WebAudioPlayer session interface, so
EdgeTTSClient just picks the player per platform. Word highlighting
reads the player's media clock, which AVPlayer reports in item time and
is therefore unaffected by the playback rate; rate changes stay pitch
preserving via the timeDomain pitch algorithm and inter-sentence gaps
run on a native timer immune to background JS throttling.

With the audio in the app process the plugin claims a non-mixable
.playback session with .spokenAudio mode, so navigation prompts pause
instead of duck. Handle interruption began and ended with shouldResume,
pause on route change to the speaker, and bind an MPNowPlayingSession
to the playout player so the paused state is reported explicitly and
the Now Playing slot survives a pause. The silent keep-alive player
pauses in lockstep, KVC playback state writes are simulator only where
they are required and harmful on device, and the mixWithOthers
use_background_audio calls are removed. On the web side the composite
iOS media session mirrors metadata and position into
navigator.mediaSession, remote commands map to directional play and
pause plus a toggle, and the silent unblocker element is skipped on iOS
Tauri since a playing HTMLMediaElement makes WebKit register its own
competing now-playing client.

Volume-key page flip previously defeated all of this: its handler
unconditionally reconfigured the shared session with .mixWithOthers,
and a mixable session is ineligible for the Now Playing slot, so
pausing TTS dismissed the card and handed AirPod controls to another
app. The two plugins now coordinate through in-process notifications:
native-tts announces claim and release of the audio session, and the
volume key handler leaves the session untouched while TTS owns it, so
volume keys keep flipping pages during a pause without losing the card,
and re-owns the session after TTS teardown regardless of ordering.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 10:53:31 +02:00
Huang Xin
a9fb86ddc5
fix(reader): guard foliate paginator null-document crashes (#5020)
Bumps foliate-js to readest/foliate-js#53:
- setStyles no longer destructures `style` from a null doc.documentElement during
  columnize/render, which crashed while a view's document was blank/detached
  (READEST-1H, 11 users).
- getDirection / getBackground no longer call getComputedStyle on a null body
  during iframe load (READEST-2X).

Adds a getDirection regression test.

Fixes READEST-1H
Fixes READEST-2X

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 09:00:46 +02:00
Huang Xin
93048acda9
fix: Sentry high-priority crash batch (autoscroll, TTS, MOBI, book-open, PDF links) (#5012)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
PR checks / rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
* fix(tts): guard highlight-follow against empty contents and null range

handleHighlightMark runs as a synchronous 'tts-highlight-mark' listener, so
any exception it throws escapes dispatchSpeakMark's try/catch to window.onerror.

Two unguarded dereferences crashed there on Readest@0.11.18:
- getContents() is empty mid-relocate (section still loading, or the view was
  torn down), so `find(...) ?? [0]` is undefined and destructuring `doc` throws
  (READEST-19).
- resolveCFI's anchor(doc) can return null when the cfi does not resolve in the
  doc; the null range then crashed foliate's scrollToAnchor (it reads
  range.startContainer) or getBoundingClientRect in scrolled mode (READEST-21).

Bail out early in both cases. Adds three regression tests.

Fixes READEST-19
Fixes READEST-21

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(reader): handle book-open failures instead of leaking a rejection

appendBook and openBookInReader call initViewState fire-and-forget. When the
book is missing (initViewState rejects with "Book not found" after a library
reload dropped the in-memory entry) the rejection had no handler and surfaced as
an unhandled rejection (READEST-1V). ReaderContent already catches its own
initViewState call; mirror that here with a toast so the user learns the open
failed. Adds a regression test.

Fixes READEST-1V

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(reader): bump foliate-js for scrolled autoscroll and PDF link fixes

Bumps foliate-js to readest/foliate-js#52:
- FixedLayout exposes a writable containerPosition in scroll mode, so Auto
  Scroll (#4999) and middle-click autoscroll (#4951) stop crashing on PDF /
  CBZ / fixed-EPUB books read in scrolled mode (READEST-11).
- The pdf.js annotation linkService implements getAnchorUrl, so PDFs with
  named-action / GoTo link annotations no longer reject the render with
  "getAnchorUrl is not a function" (READEST-2M).

Adds a regression test asserting the FixedLayout containerPosition setter exists.

Fixes READEST-11
Fixes READEST-2M

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(mobi): contain panics from the mobi crate when reading a cover

mobi::Mobi::image_records() slices raw record bytes and panics on a truncated or
corrupt file whose PDB record offsets are inverted ("slice index starts at N but
ends at M", READEST-1Q / READEST-10). extract_cover ran it inside a
spawn_blocking task, so the panic unwound and failed the whole parse_mobi_metadata
import. Wrap the extraction in catch_unwind so a bad cover yields no thumbnail
instead of a failed import (and never unwinds across the task boundary). Adds
unit tests for the panic isolation.

Fixes READEST-1Q
Fixes READEST-10

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 15:08:24 +02:00
Huang Xin
a8d3411203
fix(reader): gate captured slide/curl turn on scrollLocked like push (#5000)
Instant Highlight engages after a 300ms still-hold on text and locks
scrolling (renderer.scrollLocked) so the finger extends the highlight
instead of turning the page. The push paginator honors that lock in its
native swipe, but slide and page curl run through the app-side captured
turn: applyPageTurnAttributes sets no-swipe, so the native swipe bows
out and the captured-turn touch interceptor drives the turn instead.
That interceptor started a page turn on any horizontal swipe without
checking the lock, so a hold-then-swipe paginated with the slide/curl
effect instead of extending the highlight.

Gate the interceptor on renderer.scrollLocked before it begins a drag,
mirroring the native swipe. Bump the foliate-js submodule
(readest/foliate-js#51) to expose scrollLocked via a getter (it was
write-only) and add a regression test.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 18:01:18 +02:00
Huang Xin
3ce5a5c8e3
fix(reader): center the lone PDF page in portrait auto-spread (#4984) (#4992)
In auto-spread mode a portrait viewport shows a single page of the
two-page spread, but the fixed-layout renderer kept the spread-centering
one-sided inline margin on the shown page. With no partner page to meet
at the spine, that margin stranded the lone page in one half of the
viewport whenever it was narrower than the viewport (any zoom below
100%, or a page whose fit-scaled width is less than the viewport width),
which also pushed the page over a page-turn tap zone so every tap turned
the page instead of opening the menu.

Bump the foliate-js submodule (readest/foliate-js#50) to center the lone
portrait page and add a regression test for computeSpreadInlineMargins.

Fixes #4984

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 11:43:15 +02:00
Huang Xin
2a837cb50d
fix(reader): fix PDF text selection misplaced by OS font scaling (#49) (#4960)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
PR checks / rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
Bumps foliate-js to include readest/foliate-js#49, which corrects PDF text
selection and highlighting drifting down and spilling into the margins when
the device's system font-size accessibility setting is larger than default.
Android scales the transparent text layer's glyphs but not the page canvas,
so the text layer now divides that scale back out of the glyph size.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 08:50:35 +02:00
Huang Xin
75f1fafe9f
feat(reader): slide and page curl turn animations (#555) (#4940)
* feat(reader): slide and page curl turn animations (#555)

Add an Animation Style setting (Push, Slide, Page Curl) next to the
Paging Animation switch. Slide moves the turning page over the still
previous or next page like the Apple Books slide; Page Curl folds it
open in 3D so the page underneath is partially visible as it turns.
Both styles track the finger: the page follows a horizontal drag and
commits past halfway or on a flick, or settles back. The page header
and footer stay in place while the page turns.

The styles layer a View Transitions snapshot of the outgoing page over
the live, stationary incoming page, since the pages of one section live
in a single iframe and can never be on screen twice. They work for all
writing modes including vertical-rl, and on engines without the View
Transitions API (older WebViews) the paginator falls back to the
existing push animation, so all platforms keep working page turns.

The paginator changes live in the foliate-js submodule; this bumps the
pointer, wires viewSettings.pageTurnStyle to the renderer turn-style
attribute, and adds browser tests covering slide layering, curl,
vertical-rl, finger tracking with commit and revert, and the push
fallback.

Fixes #555

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(reader): add WebGL page curl renderer for mesh turn animations (#555)

Grid mesh deformed around a cylinder: content past the fold wraps over
and lands mirrored on top with a whitened page back, transparent where
the page has curled away. Corner grabs start as a steep diagonal pinch
that straightens as the turn completes so the whole page clears by the
end. Groundwork for the Tauri mesh curl; capture and orchestration land
separately.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(native-bridge): capture webview region as PNG on macOS and iOS (#555)

New capture_webview_region plugin command returns a binary PNG snapshot
of the calling webview (tauri::ipc::Response, no JSON overhead) for the
mesh page-curl texture. macOS goes through WKWebView
takeSnapshotWithConfiguration via with_webview on the main thread with
a 500ms timeout; iOS snapshots in Swift and hands the PNG across the
JSON-only plugin boundary base64-encoded, decoded back to bytes in
mobile.rs. Windows, Linux, and Android reject for now so the JS side
falls back to the CSS curl.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(reader): drive the mesh page curl on Tauri platforms (#555)

Wire the WebGL curl renderer and the native webview capture into page
turns. A MeshCurlTurn controller runs the pipeline per turn: snapshot
the content box, overlay the captured page drawn flat, turn the live
view instantly underneath (the paginator's animated paths all gate on
the animated attribute), then curl the capture away. Backward turns
mirror the fold to the spine edge, matching the layered VT curl's
old-page-recedes choreography.

useMeshPageCurl wraps the view's prev/next so taps, keys, and wheel
turns all curl, and registers a touch interceptor (between the reading
ruler and the fixed-layout swipe) that scrubs the curl from the finger,
committing past halfway or on a flick and otherwise un-curling and
turning back under the overlay. The paginator stays out of the way via
no-swipe while the mesh is active; if the native capture ever fails the
session falls back to the paginator's CSS arc-fold curl and the shared
applyPageTurnAttributes helper restores turn-style.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(build): restore iOS builds on Xcode 26.2 with a vendored swift-rs

Swift 6.2's driver no longer honors swift-rs 1.0.7's cross-compilation
style (swift build --arch <host> with per-swiftc -target overrides and
an inherited SDKROOT): plugin sources compile against the wrong
platform's Swift overlays and fail with baffling errors like type
'Bundle' has no member 'main' and extra argument 'privacy' in call.
Upstream swift-rs is unmaintained, so vendor it under packages/swift-rs
via a crates-io patch and build with SPM's first-class --triple/--sdk
flags instead, dropping the leaked SDKROOT so the host-targeted
manifest compile stays clean. Artifacts land in the unversioned-triple
directory now, so the link search path follows.

With --triple, SPM enforces the deployment floor declared in
Package.swift (the old override bypassed it): bump native-bridge to
iOS 15.0, matching the app's deployment target, since StoreKit's
Storefront is used unguarded.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(native-bridge): capture webview region on Android via PixelCopy (#555)

Implements the Android side of capture_webview_region so the mesh page
curl works there too. The Kotlin command scales the CSS-pixel rect by
the display density, offsets it by the webview's window position, and
reads the pixels back from the window surface with PixelCopy (API 26+,
the app's minSdk), which includes the hardware-accelerated WebView that
View.draw would miss. PNG encoding runs off the main thread and the
result crosses the JSON plugin boundary base64-encoded, decoded back to
bytes in mobile.rs like iOS.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(reader): right the upside-down page curl on iOS (#555)

The renderer oriented its texture with UNPACK_FLIP_Y_WEBGL, which WebKit
ignores for ImageBitmap uploads: on iOS the captured page rendered
upside down, and the mirrored page back read as rotated 180 degrees
instead of the ink-through-paper horizontal mirror Apple Books shows.
Upload unflipped and sample page coordinates directly so no pixel-store
flag is involved.

The page texture in the browser test was only horizontally asymmetric,
which is how the flip slipped through; it now uses four quadrants fed
through the production PNG-blob-to-ImageBitmap path and pins the
vertical orientation. Verified red/green by running the suite on
Playwright WebKit, which reproduces the iOS behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(reader): curl the whole page including header, footer, and margins (#555)

The mesh curl captured only the margin-inset content box, leaving the
running header, footer, and page margins static while just the text
column turned. A physical page turn takes the whole sheet with it, as
Apple Books does, so the capture and overlay now span the full reader
cell. The overlay mounts above the in-cell header (z-10) and footer, so
the static copies never show through the turning page.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(reader): gate layered View Transition turns and slide from a capture instead (#555)

iOS 18 WebKit ships document.startViewTransition but crashes the WebContent
process when a page-turn transition snapshots the reader, so the mere
presence of the API is not enough for the layered slide/curl turns. Require
nested view-transition groups (Chrome/WebView 140+) as the marker of a
mature engine before setting turn-style on the renderer.

Engines that fail the check no longer lose the slide on Tauri: the mesh
curl's capture pipeline generalizes to CapturedPageTurn and now also drives
a flat slide overlay (capture the outgoing page, turn instantly underneath,
translate the captured page out toward the spine, mirrored for backward
turns), clipped to the content box with an edge shadow like the VT slide.
On the web, engines without full support fall back to push and the
Slide/Page Curl options are hidden from the Animation Style select; a
synced slide/curl setting from another device reads as Push there.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(reader): make the Android page curl start instantly (#555)

The Android capture encoded a full-density PNG: 1080x2400 on a 3x
Xiaomi 13 took ~1.5s per turn, so the page sat frozen long enough to
read as the curl not working at all. Encode JPEG instead (the page is
opaque) and cap the destination bitmap at 2x CSS pixels - PixelCopy
scales into a smaller bitmap for free and the moving page stays sharp.
Measured on device over CDP: the capture invoke drops from 1550ms to
34ms and the curl overlay mounts 132ms after the tap.

The JS side stops hardcoding an image/png blob type and lets the
decoder sniff the platform's actual format.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* perf(reader): encode iOS page-curl captures as capped JPEG (#555)

Apply the Android speedup to iOS: encode the snapshot as JPEG (the
page is opaque) off the main thread, and cap it at 2x CSS pixels via
WKSnapshotConfiguration.snapshotWidth on 3x screens, cutting both the
encode time and the base64 payload crossing the JSON plugin boundary.
The JS side already sniffs the image format from the bytes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 20:49:57 +02:00
Huang Xin
ec45a080fc
feat(metadata): surface calibre custom columns from EPUB metadata (#4939)
Parse calibre's embedded user metadata (custom columns) from the OPF
in foliate-js, store it on BookMetadata.calibreColumns, render the
columns in the book details view, and match column names and values
in the library search so a value like a recommends tag can be found
by typing it.

Closes #4811
2026-07-05 18:08:36 +02:00
Huang Xin
42f9b8fe3c
feat(tts): gapless Web Audio playback engine for Edge TTS with chapter timeline and seek (#4931)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
PR checks / rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
* feat(tts): add PCM speech-bounds detection for sentence audio trimming

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(tts): add WSOLA time-stretch for pitch-preserved playback rate

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(tts): add sentence duration store with per-voice speaking-rate calibration

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* refactor(tts): serve edge audio as ArrayBuffer with in-flight fetch dedup

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(tts): add WebAudioPlayer with gapless chunk scheduling and backpressure

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(tts): play edge TTS through gapless Web Audio pipeline

Replaces the per-sentence audio element with trimmed, time-stretched
buffers scheduled on the shared AudioContext. Marks dispatch at audible
time so schedule-ahead cannot run foliate's cursor past the voice; a
decode failure or missing audio skips the chunk instead of wedging the
session; pause and resume ride context suspend and resume with no iOS
rewind hack; the object-URL cache is gone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(tts): add section timeline with measured and estimated sentence durations

Includes the foliate-js submodule bump for the getSentences export
(fork branch feat/tts-get-sentences; fork PR must merge before this
lands so the pinned SHA resolves).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(tts): expose section playback position and sentence-snapped seeking

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(tts): surface playback position and seek in the media session

Position state is clamped, never skipped, so the lock-screen scrubber
stays live when estimates overshoot; seekto units map per backend
(native ms, web seconds). The AudioContext warms up in the tts-speak
gesture path before any await, and the silent keep-alive element now
runs on all platforms so desktop hardware media keys survive the
removal of the per-sentence audio element.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(tts): add seekable chapter progress bar to the TTS panel

The scrubber joins the transport cluster with a thin range-xs track and
flanking tabular time labels so it cannot be misgrabbed for the chunky
rate slider (which persists a global setting). States: reserved
disabled slot until the lazy timeline lands, persists across chapter
transitions, optimistic thumb with failure toast, monotonic position,
tilde-prefixed estimated totals, sentence-event updates under e-ink.
The popup grows only when a timeline-capable client is active.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs: record deferred TTS listening-engine follow-ups

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs: record background TTS decoupling design decisions

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(tts): slim the panel scrubber to a native track with remaining time

Match the footer Jump to Location slider (plain native range: thin
track, small thumb) instead of the chunky daisyUI pill, show remaining
time with a minus prefix on the right, and drop the This chapter
caption. Popup height shrinks accordingly. Verified live in Chrome.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: pin foliate-js to merged main with getSentences export

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(tts): catch autoplay rejection from the keep-alive element

Running the silent keep-alive on all platforms exposed an un-awaited
play() that headless Chromium rejects without a user gesture, failing
CI on unhandled rejections while every test passed. The keep-alive is
best-effort; the production path is gesture-qualified.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 10:50:22 +02:00
Huang Xin
c5304cd46c
fix(reader): turn pages horizontally for vertical-rl books (#624) (#4899)
Vertical-rl books paged along the vertical scroll axis: page turns slid
up/down and only vertical swipes turned pages. Vertical books read with
right-to-left page progression, so page turns now work horizontally,
matching printed vertical books:

- Swipes track the finger: the page follows a horizontal drag and the
  release commits the turn (past half a page width or a flick in the
  drag direction) or settles the page back.
- Arrow keys, tap zones, and the wheel follow the same rtl mapping that
  horizontal-rtl books use.
- Animated turns run a two-phase horizontal slide that continues from
  the dragged offset: the outgoing page exits along the page
  progression, the scroll jumps while off-screen, and the incoming page
  follows in from the opposite edge. A single-phase push is impossible
  because CSS multicol stacks vertical-rl pages along the vertical
  scroll axis inside one iframe, so the outgoing and incoming page can
  never be on screen side by side.
- With animation disabled (or e-ink), turns swap instantly as before.

The paginator changes live in the foliate-js submodule; this bumps the
pointer and adds browser tests with a vertical-rl EPUB fixture covering
direction detection, drag tracking, drag revert, horizontal swipe
mapping in both directions, the legacy vertical swipe, the horizontal
slide animation, the instant non-animated swap, and the unchanged
horizontal-ltr swipe behavior.

Fixes #624

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 20:51:36 +02:00
Huang Xin
17e60f1e49
fix(reader): fix fixed-layout spread spine seam and zoomed-out blank page (#4857) (#4873)
Bump foliate-js with two fixed-layout (EPUB and PDF) two-page spread fixes:

- Spine seam: overlap the two pages by one device pixel to hide the 1px white
  seam that appeared at the spine at a fractional devicePixelRatio (e.g.
  Windows 150% display scale).
- Zoomed-out blank page: keep non-PDF pages in block flow below 100% zoom; the
  PDF-only zoom-out centering was pushing the un-scaled iframe out of view and
  blanking the page.

Adds a unit test for the computeSpreadSpineOverlap helper.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 17:38:00 +02:00
Huang Xin
f8916e128e
fix(reader): smooth pinch-zoom and pan for scrolled-mode PDF (#4817)
Bumps foliate-js to readest/foliate-js#43. In scrolled-mode PDF the page now zooms live under a pinch and commits without a layout shift (the inter-page gap scales with the zoom so the committed layout matches the transform-scaled preview, and the centre page is restored to its pre-commit on-screen rect), a page zoomed wider than the viewport is pannable horizontally, and the page iframes stay interactive when idle so native text selection keeps working. readest already drives the renderer's pinchZoom on a two-finger gesture, so the only reader-side change is the submodule bump plus a unit test for the new scroll pinch transform.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27 11:15:33 +02:00
Huang Xin
580c5e5deb
fix(reader): eliminate PDF scrolled-mode rendering lag on mobile (#4795) (#4813)
PDF pages rendered blank while scrolling in scrolled mode (#4795,
resurfacing #4031). On-device profiling showed each page takes hundreds
of ms to render while the preload margin gave only about half a page of
lead, and loads were unbounded and unprioritized.

Bump the foliate-js submodule to widen the scrolled-mode preload margin
and drive page loading through a bounded, viewport-prioritized scheduler
(readest/foliate-js#40). Adds unit coverage for the new planScrollModePages
scheduler.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27 05:02:16 +02:00
Huang Xin
a0227f98e2
perf(reader): stop per-frame background reflow on swipe page turns (#4785) (#4814)
Fixes readest/readest#4785

Swipe page turns dropped frames, worst when crossing .xhtml section
boundaries. The paginator's #replaceBackground rebuilt its whole paint
context every animation frame (a getComputedStyle plus one
getBoundingClientRect per rendered view), and that per-frame cost scales
with the number of loaded views, which peaks at a boundary where adjacent
sections are preloaded.

Bumps the foliate-js submodule to 15fc999 (readest/foliate-js#41) to
snapshot the paint context once per gesture and reuse it on every frame,
and to defer the heavy mid-drag section preload off the active drag. The
bump also advances foliate-js to current main, picking up the
gpu-composite page-turn opt-in (readest/foliate-js#39).

Adds a real-browser test that drives an animated turn and a synthetic drag
and asserts the section <html> computed style is read a small constant
number of times instead of once per frame (snap 39 -> <=3, drag 7 -> <=1).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27 04:26:37 +02:00
Huang Xin
cd3a53f507
fix(sync): WebDAV Sync now pulls latest book metadata and merges config (#4756) (#4776)
* fix(sync): pull newer WebDAV book metadata to devices that already hold the book (#4756)

syncLibrary only pulled title/author/cover for books missing from the local
library. For a book a device already held it only pushed, so a peer's metadata
edit never propagated back, and the final library.json re-push clobbered the
peer's newer metadata with this device's stale copy.

Add a last-writer-wins reconciliation pass keyed on book.updatedAt: when the
shared index has a strictly newer copy of a locally-held book, merge its
metadata, re-pull the cover, persist it via a new updateBookMetadata callback,
and keep the merged copy authoritative for the index re-push so neither
direction loses the edit. Surface a "metadata updated" counter in the sync
toast and history, and translate the new strings across all locales.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(sync): merge remote config before pushing in WebDAV Sync now (#4756)

The manual library "Sync now" pushed each book's config.json blind, so it
could overwrite a peer's booknotes (element-set CRDT) or regress newer remote
progress (per-config LWW) that this device had not pulled yet. The reader hook
already pull-merges before pushing; the library path did not, so notes and
progress could diverge or regress on the remote until a device happened to open
the book.

Give syncLibrary's config push the same read-merge-write cycle: pull-merge then
push the merged superset, persisting it locally so the device converges too.
Gated on canPull so 'silent' converges while 'send' keeps the local copy
authoritative and 'receive' still never pushes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 06:50:34 +02:00
Huang Xin
0c7ffa9799
fix(reader): stop iOS page-turn animation stutter (#4768) (#4772)
* fix(reader): stop iOS page-turn animation stutter (#4768)

iOS users saw occasional page-turn animation stutter that was not present
on earlier 0.11.x builds. It traces to foliate-js commit c1c7315 (first
shipped in 0.11.4): the large-section rafAnimateScroll fallback and the
removal of persistent compositor-layer hints, both added to fix a ~1s
Blink freeze on Android Chromium at high DPR.

Apple WebKit composites those layers fine, so on iOS (notably 120Hz
ProMotion devices) the changes only cost smoothness: large-section turns
animate scroll on the main thread, and every turn promotes a layer
on-demand instead of using a persistent one.

Opt the iOS renderer into foliate-js's new gpu-composite path, which
restores persistent compositor layers and skips the main-thread
rafAnimateScroll fallback. Other platforms keep the Android freeze fix.
Bumps the foliate-js submodule.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(deps): repin foliate-js to merged gpu-composite commit (#4768)

readest/foliate-js#39 squash-merged to a new commit on main. Move the
submodule pin off the now-orphaned PR branch commit to the merged main
commit. No content change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 04:46:16 +02:00
Huang Xin
163487b5e3
feat(reader): add regex and nearby-words search modes (#4560) (#4764)
Add Calibre-parity search modes to the reader's full-text search. The
"Match Whole Words" toggle becomes a single-select mode group: Contains,
Whole Words, Regular Expression, Nearby Words.

- Regex and nearby-words matching live in the foliate-js submodule
  (bumped here); the sidebar threads `mode` and `nearbyWords` through.
- Nearby distance is chosen with a "within N words" control (5/10/20/50,
  default 10), not parsed from the query, so trailing numbers stay
  literal search words.
- Per-mode modifiers: Match Diacritics is greyed out for regex (no-op).
- Calm inline error for invalid regex / too-few nearby words, a
  no-results state, and a results-count footer.
- Nearby matches render a segmented excerpt emphasizing each matched
  word and highlight every word in the book.
- BookConfig schema v2 -> v3 migrates the deprecated `matchWholeWords`
  boolean to `mode` (still written for sync back-compat).

Also fix two search interactions:
- option changes (e.g. within-N-words) now take effect immediately by
  reading the latest config at search time instead of a stale closure.
- closing search from the results nav bar now exits the sidebar search
  mode, not just the results (search-bar visibility lifted to the store).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 17:23:09 +02:00
Huang Xin
428168ac91
fix(reader): show the centred section's chapter title in scrolled mode (#4739)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
PR checks / rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
In scrolled mode the header chapter title was wrong while transitioning
between sections, while paginated mode was correct (#4436). foliate-js
#getVisibleRange returned the first overlapping view (topmost in scroll
order), so when the tail of one section was a thin sliver at the top of
the viewport and the next section occupied the centre and most of the
screen, the relocate event reported the sliver's section — and its title
lagged behind what the reader was reading.

Bump foliate-js to prefer the view covering the viewport centre
(readest/foliate-js#37) and add a browser-lane regression test that
scrolls a sliver of section K to the top with K+1 across the centre and
asserts the relocate index is K+1.

Fixes #4436

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 01:56:10 +02:00
Huang Xin
1b44b95d3a
fix(reader): smooth single-notch wheel scroll over PDF pages in scrolled mode (#4727) (#4732)
Bumps foliate-js to drop the redundant manual `scrollBy` the scrolled-mode
page iframes ran on every wheel event. Because those iframes are
`scrolling="no"`, the browser already chains the wheel to the host scroller
natively; the extra scrollBy stacked on top, so wheeling over a page moved
it ~2x as far in an instant lurch while the margins scrolled smoothly by one
notch. Native scroll-chaining now provides the single smooth scroll over both
the page and the margins.

Adds a browser-lane regression test that mounts the real <foliate-fxl>
renderer in scrolled mode and asserts a wheel over a page does not
programmatically move the host scroller.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 17:17:24 +02:00
Huang Xin
a9c0f3d46d
fix(reader): remove 1px white seam in PDF spread at fractional DPI (#4587) (#4713)
In a PDF two-page spread at a fractional devicePixelRatio (Windows display
scale 150% -> dpr 1.5), a one-pixel white bar appeared at the spine on certain
zoom levels. foliate-js' pdf.js sized the page canvas only via its bitmap, so
the fractional viewport width was truncated and the canvas rendered up to ~1
device pixel narrower than the page box, exposing the background at the spine.

Bump the foliate-js submodule to the fix (readest/foliate-js#35) which pins an
explicit canvas CSS size to the un-truncated viewport dimensions, and add a
regression test that drives render() at dpr 1.5 and asserts the canvas fills
its box exactly.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 21:20:28 +02:00
Huang Xin
2153f7cc0c
fix(reader): reset scroll to top on paginated fit-width page turn (#4683) (#4695)
In paginated fixed-layout mode (PDF / fixed-layout EPUB) with fit-width zoom, a
page taller than the viewport makes the renderer host scroll vertically. Turning
the page kept the previous page's vertical offset, so the next page opened
scrolled to the end instead of the top. The bug only shows on WebKit
(Linux/iOS/macOS), which preserves the scroll offset across the page content
swap; Blink (Android/Chrome) resets it to zero.

Bump foliate-js to the fix (readest/foliate-js#34): reset scrollTop on a page
turn only. Add a unit test for the new computePaginatedScroll helper.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 07:46:33 +02:00
Huang Xin
a9526377a2
fix(reader): stretch Duokan fullscreen cover to fill the page (#4679)
Bump foliate-js so paginated Duokan full-page covers
(data-duokan-page-fullscreen) render with object-fit: fill instead of
contain. The cover now fills the whole page, distorting to fit when the
aspect ratio differs, matching Duokan's native full-page render. Adds a
browser test asserting the fullscreen cover computes object-fit: fill.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20 05:33:47 +02:00
Huang Xin
0ab8f6042f
fix(reader): keep cover background-image visible under a texture (#4675)
Bump foliate-js to the textureAwareBackground fix and add a regression
test. A cover page that paints its image via a body background-image
leaves background-color transparent, so the computed background shorthand
starts with "rgba(0, 0, 0, 0)" even though a real image follows. The
paginator misclassified it as transparent and, with a background texture
active (e.g. parchment), dropped the page background so the texture showed
on the first page instead of the cover. Verified on Android WebView.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20 04:13:28 +02:00
Huang Xin
6e9faaa874
fix(pdf): throttle PDF range reads to fix large-file OOM on Android/iOS (#3470) (#4670)
Large PDFs (50 MB+) crashed on import/open. pdf.js requests hundreds of
byte ranges in a burst while parsing the document structure, and
foliate-js makePDF dispatched them all concurrently. On Android each read
is served through the WebView's rangefile custom scheme
(shouldInterceptRequest); the flood of simultaneous native requests
exhausts the WebView's Java heap (OutOfMemoryError in handleRequest).

Bump foliate-js to cap in-flight range reads at 6 (the implicit per-host
limit a real HTTP transport already gets), and add a regression test
asserting makePDF keeps at most 6 range reads in flight.

Verified live on a Xiaomi 13 (Android 16 / WebView 147) via CDP: max
concurrent range reads drop from 753 to 6 with no change in open time.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20 02:00:44 +02:00
Huang Xin
6caa376f82
feat(reader): Webtoon Mode seamless continuous scroll for image books (#3647) (#4662)
* feat(reader): make fixed-layout scroll gap configurable (foliate-js bump) (#3647)

* feat(reader): add webtoonMode view setting + scroll-gap helper (#3647)

* feat(reader): Webtoon Mode toggle in the fixed-layout view menu (#3647)

* feat(reader): apply Webtoon Mode gap on fixed-layout book open (#3647)

* fix(reader): clear Webtoon Mode + reset gap when Shift+J leaves scrolled (#3647)

* chore(i18n): translate Webtoon Mode string across locales (#3647)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(deps): bump foliate-js to merged readest/foliate-js#30 (#3647)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 12:37:37 +02:00