mirror of
https://github.com/readest/readest.git
synced 2026-11-29 19:02:28 +00:00
57 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
50c4ae8258
|
feat(tts): read aloud with Speech Dispatcher voices on Linux (#7314)
* feat(tts): read aloud with Speech Dispatcher voices on Linux
Read Aloud on Linux can now use the voices installed in Speech
Dispatcher (eSpeak NG, or Piper through a module) under System TTS.
The native-tts plugin speaks SSIP over the daemon's Unix socket with
no speech library linked, so the AppImage uses the host daemon and the
Flatpak needs --filesystem=xdg-run/speech-dispatcher:ro
(docs/linux-system-tts.md). Each reader window gets its own
connection, closed when the window is destroyed. If the daemon or its
voices are unavailable, the other engines remain.
- Voices keep their Speech Dispatcher names; eSpeak NG's per-variant
copies ("English (America)+Annie") are dropped, so English lists 9
voices instead of 945. The module is appended only when two modules
list voices.
- Pause stops the sentence and Play reads it again, as on Android. A
speechd PAUSE holds back the restarted SPEAK, and RESUME then
cancels it, so Play skipped the paused sentence.
- A closing window cancels its speech: speechd finishes a disconnected
client's message.
- Events that arrive before the speak reply are kept, and an aborted
utterance is canceled by ID so a late reply cannot stop its
replacement. Rates go to speechd as given, without the mobile
exponent.
Tests that fail without the change:
- Rust (plugin): pause_cancels_so_the_restarted_sentence_is_not_held_back
(left "PAUSE SELF\r\n", right "CANCEL SELF\r\n");
lists_each_espeak_voice_once_rather_than_once_per_variant (4 voices,
expected 2); closing_a_reader_window_silences_its_speech (left "",
right "CANCEL SELF\r\n").
- TS: 8 tests in native-tts-client.test.ts and tts-controller.test.ts
fail against the old NativeTTSClient/TTSController, 7 on assertions
(e.g. "expected [] to deeply equal [ 'boundary', 'end' ]",
"expected null not to be null" for the Linux system voices) and one
on its 5 s timeout (overlapping speak replies).
Real use, Linux CEF dev build, isolated HOME, host speech-dispatcher
0.12.1 with its eSpeak NG module:
- Pause/Play 3 of 3 re-read the paused sentence with no "Speech
interrupted"; before the fix 3 of 3 skipped it.
- Speak on a selection while paused speaks (before: silent).
- Picker lists 9 System TTS voices; choosing another voice and pressing
Play reads on in that voice.
- Speed: 2.7 s per sentence at 1.5x, 5.2 s at 0.95x.
- Closing the book at +1.4 s into a sentence: speech ends 1 s later;
without the cancel it ran 3.6 s to the sentence's end.
- SPEECHD_ADDRESS at a missing socket: "System TTS unavailable" is
logged and Read Aloud falls back to Edge TTS.
Checks: plugin cargo test (36 passed), pnpm test:rust (204 passed),
the two TS suites (171 passed), pnpm lint, pnpm fmt:check, pnpm
clippy:check, cargo check of the plugin for x86_64-pc-windows-gnu and
aarch64-linux-android.
Not run: the AppImage and Flatpak packages, two reader windows reading
at once, light/dark/e-ink (no UI changed). Chinese books get no System
TTS voice: eSpeak NG labels them cmn/yue and language matching expects
zh.
Closes #6805
Reported by ell1e on GitHub.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(tts): keep a slow Speech Dispatcher voice list from disabling System TTS
Every command waited at most 3 s, and a timeout closes the connection
because a late reply would answer the next command. eSpeak NG sends
about 15k voice rows for LIST SYNTHESIS_VOICES: 0.4 s here, warm or
cold, so a slow machine or module could run past 3 s. voices() then
took the dead connection for a module without voices and failed with
"Speech Dispatcher has no installed voices".
The voice list now gets 10 s, under the reader's 15 s engine init
limit. A lost connection ends the listing with its cause ("Speech
Dispatcher did not answer in time while listing piper voices"); a
module that answers with an error is still skipped.
Raised by CodeRabbit on #7314.
Tests that fail without the change:
- waits_for_a_slow_voice_list: the reply comes 3.5 s after the request;
fails at "a voice list slower than one command must still arrive".
- a_lost_connection_while_listing_voices_reports_the_cause: left
Some("Speech Dispatcher has no installed voices"), right
Some("Speech Dispatcher disconnected while listing espeak-ng voices").
Checks: plugin cargo test --lib (38 passed), pnpm test:rust (204
passed), pnpm fmt:check, pnpm clippy:check, cargo fmt --check in the
plugin. Real daemon (speech-dispatcher 0.12.1, eSpeak NG): init()
lists 141 voices in 0.43 s.
Not run: a real slow module (the delay is simulated in the test), and
the Tauri app after this change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(tts): give every reader speed its own Speech Dispatcher rate
The reader offers 0.5x to 3x (the speed ruler and RSVP's rate list),
but the Linux bridge sent (rate - 1) * 100 clamped to SSIP's -100..100,
so 2x, 2.5x and 3x all became 100 and sounded the same, and 0.5x only
reached -50. 0.5x-1x now spreads over -100..0 and 1x-3x over 0..100.
Raised by CodeRabbit on #7314.
Test that fails without the change:
every_reader_speed_has_its_own_ssip_rate, left
[-50, -25, 0, 50, 100, 100, 100], right [-100, -50, 0, 25, 50, 75, 100]
for 0.5, 0.75, 1, 1.5, 2, 2.5, 3.
Real daemon (speech-dispatcher 0.12.1, eSpeak NG), one sentence spoken
through SpeechDispatcher at each speed, begin to end: 0.5x 12.17 s,
1x 5.57 s, 1.5x 3.91 s, 2x 2.97 s, 2.5x 2.29 s, 3x 1.82 s (0.46x,
1.42x, 1.88x, 2.44x, 3.05x of 1x).
Checks: plugin cargo test --lib (39 passed), pnpm test:rust (204
passed), pnpm fmt:check, pnpm clippy:check, cargo fmt --check in the
plugin.
Not run: the speed ruler in the Tauri app after this change; the
mapping from the ruler to set_rate is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
477381c8ac
|
fix(tts): play local AAC narration natively on Linux (#7240)
* fix(tts): play local AAC narration natively on Linux Decode AAC-LC/ALAC MP4 narration with Symphonia 0.6.1 and send PCM to CPAL, with SoundTouch preserving pitch when playback speed changes. Read stored EPUB entries as byte windows and DEFLATE entries through a bounded in-memory checkpoint index, without extracting audio to cache. Reuse the native narration clock and controls; retain browser playback for remote audio and local MP3/Ogg/Opus/WebM sources. Cover source integrity, exact seeks and MP4 edit timing, bounded output, audible playback position, ordered controls and cancellation of pending loads. Run the native plugin and lifecycle regressions in PR CI. Regression evidence: without the Linux source-descriptor change, "hands Linux the raw compressed ZIP entry without reading its audio bytes" fails because getMediaSource returns null instead of the path and raw ZIP entry. Transport and device-stream lifecycle regressions were also verified to fail before their corresponding fixes. Verified on current origin/main: full Vitest suite (14687 passed, 16 skipped), lint, format check, web build, Rust formatting and CEF Clippy with warnings denied. CEF unit tests: 201 app + 24 plugin tests passed; 3 transport/device-stream lifecycle regressions passed. Nix cargoDeps realization and actionlint passed. Full Nix app build and mobile device tests not run. Linux CEF runtime with Symphonia 0.6.1: captured audible AAC, verified forward/backward seeks, rate, pause/frozen clock, abort, and compressed EPUB playback through all three paragraph highlights to completion. No reporter EPUB was supplied; used generated narration fixtures. One earlier app run exited SIGBUS during a shared-target rebuild; cause unconfirmed, fresh launch after checks passed the sequence. Reported by DeathStroke19891 on GitHub. Fixes #7084. Co-Authored-By: Claude Code <noreply@anthropic.com> * fix(tts): enqueue Linux controls before async dispatch Tauri schedules async command invocations independently, so pause/resume could reach the Linux worker in reverse order even when blocking reply waiters were kept separate. Dispatch Linux playout_control directly from the synchronous plugin handler, then resolve its worker reply off-thread. Retain the same IPC payload, ACL parsing, asset scope and non-Linux paths. This also allows abort to cancel a pending load without waiting for its reply, which a frontend promise chain would delay. Regression evidence: reverse the first polls of the old command futures and the ordering assertion fails with ["resume", "pause"] instead of ["pause", "resume"]. The updated production-handler regression asserts pause/resume/load/abort enqueue before any response future is polled, then runs response tasks and blocking waiters in reverse order. Verified Rust formatting, CEF Clippy with warnings denied, 201 app and 24 plugin unit tests, 3 lifecycle regressions, and a rebuilt CEF app. Runtime: 40 rapid pause/resume cycles preserved final state, pause froze the clock, and abort canceled a 226 MB compressed recording load in about 19 ms. Invalid payload and out-of-scope path rejections passed. Independent review verified ACL handling and non-Linux routing. Frontend checks are rerun by the repository's pre-push hook. Co-Authored-By: Claude Code <noreply@anthropic.com> * refactor(tts): hide narration platforms (owner: remove the linux flag) Move native source selection and backend capabilities into NativeNarrationPlayer. MediaOverlayClient retains one native flag and uses streaming, queueing, and cancellation capabilities without OS checks. Preserve local ZIP playback, browser fallbacks, and mobile staging. Validation: 93 focused tests passed; full Vitest suite passed 1,220 files and 14,691 tests (4 files and 16 tests skipped). TypeScript, Biome lint, format checking, and git diff --check passed. Lint reports one existing informational diagnostic in nativePageTurn.ts. New loadSource tests fail before delegation exists and pass afterward. In an isolated Linux CEF app, compressed AAC playback advanced through all three paragraph highlights using the native clock. Mobile device checks were not run. Co-Authored-By: Claude Code <noreply@anthropic.com> * fix(tts): finish canceled narration loads without errors A native load can be canceled independently of the speak signal. Suppress load failures when either signal was aborted, retaining the original playback signal across invalidation so Rust cancellation errors are also recognized. Other load failures still yield playback errors. Validation: eight regression cases fail without this guard, yielding an error instead of completing the generator. All 95 focused native/client/ player tests pass with the fix, including genuine load failures. TypeScript, Biome lint and formatting, and git diff --check pass. In isolated Linux CEF, stopping a large compressed recording during loading closes the player, leaves native playback stopped, and logs no playback error. Mobile device checks were not run. The pre-push hook runs the full frontend suite. Co-Authored-By: Claude Code <noreply@anthropic.com> --------- Co-authored-by: Claude Code <noreply@anthropic.com> |
||
|
|
4e65b420f3
|
test: use four workers for unit tests (#7242)
Match the existing PR CI worker budget in the default Vitest configuration
so the full pre-push suite does not oversubscribe shared CPUs. Document the
built-in CLI and environment overrides. Keep all timeouts and tests unchanged.
Verification on
|
||
|
|
f815ae6416
|
fix(android): continue recorded narration while screen locked (#7194)
* fix(android): recover missed narration end events When Android reaches the end of recorded narration while the WebView is suspended, its native ended event may not reach JavaScript. Treat the native no-current-item position as the same terminal event and deduplicate a delayed native callback so the controller can advance. Regression test: recovers an ended event missed while the WebView was suspended failed on upstream main with expected one call, received zero; it now passes. Checks: 78 focused narration tests passed; pnpm lint passed (one existing informational diagnostic); full suite reached 14,438 passed and 43 skipped, with one unrelated tts-paragraph-boundary Windows timeout that also repeats alone. The four initial PDF failures were corrected by restoring the worktree vendor assets and all four reruns passed. Reported by kelvinalfaro on GitHub in #7193. * fix(android): queue next narration file while locked * test(tts): preserve desktop media overlay capabilities * fix(android): rework the locked-screen narration handover The queued handover lost what it was meant to keep. The plugin's new load fields never reached JS (the Rust PlayoutControlResponse carries only `session`), so after a handover every block ended after one poll. On wake the next section sought back to 0 s and replayed audio heard under lock, and stanzas of the old file still behind were sought inside the new one. - The playlist follows rules that depend only on the order of loads and queues: `load` jumps to a file already in the playlist and drops the ones before it, `queue` keeps only the file it follows. JS mirrors them without any new response fields, and a rollover racing a load cannot split them. - When JS runs again, `NativeNarrationPlayer.sync()` reads where the player got to: clips of a file it played past are skipped, the next section joins the rolled-over file where it is, and a lost rollover or end of file is found from the position. - An `ended` that lands while no clip wait is listening still ends the block: this was the "playing" in silence, with Pause and Play doing nothing, after unlock. - Only while a section's last file plays is the next one queued, and never for multi-track audiobooks or on iOS. A queueing failure no longer drops the next section's opening preload. Staged copies are kept only while in the playlist. Verified on the Android emulator (API 35) with a six-poem narrated EPUB, freezing the WebView renderer (kill -STOP) to model the suspended WebView: - main: audio stopped at the end of poem 1; after the thaw stanzas 2-3 were replayed, then it stuck "playing" in silence, and Pause/Play did not resume. - this change, frozen 60 s: ExoPlayer rolled into poem 2; after the thaw poem 2 was passed over and poem 3 played. Frozen 10 s / awake 1 s for 90 s: one unbroken audio track through all six poems. Screen on: one continuous track, the highlight following; pause/resume and previous sentence across a boundary work. Not verified on a physical device or on iOS. Tests: media-overlay-android-handover.test.ts. Without each part of the change its tests fail on assertions: no rollover handling ("expected [ 'load poem2.mp3' ] to deeply equal []", "expected [ 'seek poem2.mp3 6s' ] to deeply equal []"), no end-of-file position read ("expected 'stuck' to deeply equal [ { code: 'end' } ]"), no ended check in the clip wait (same), no guard on a late rollover event ("expected [ { code: 'end' } ] to be 'stuck'"). The two ended tests fail the same way on main. Reported by kelvinalfaro on GitHub (#7193). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): keep offering the next narration file until it is queued The next section's file was offered to the client once per section, when the cached opening was built. In a section recorded across several files that offer comes while an earlier file plays, so it was declined and never made again: with the WebView suspended, narration stopped at the section's end. - The loaded next section is kept with the cached opening and offered on every preload; an offer for a file already queued does no work. - A section's own next file is queued too, while the one before it plays, so a boundary inside a section crosses without JS as well. Verified on the Android emulator with a narrated EPUB whose third stanza of each poem is its own file, freezing the WebView renderer: - 73590cbd0: frozen after the poem's last file started, it stopped at that file's end (poem 2 never queued); frozen inside the first file, it stopped at that file's end. - this change: the first case rolled on into poem 2, then after the thaw skipped the stanzas heard and rolled into poem 3; the second rolled into the third-stanza file. Tests: "offers the next section to the client on every preload, loading it once" fails without the change with "expected preloadSection to be called 2 times, but got 1 times"; "an offer repeated on every preload queues the file once" with "expected 4 to be 2"; "queues the section's own next file while an earlier one plays" with "expected [ 'load poem1.mp3' ] to include 'queue poem1-c.mp3'". Raised by CodeRabbit's review of 73590cbd0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): queue the next narrated section, and drop a queue that went stale - The file offered for queueing was the adjacent section's, so a section with no recording between two narrated ones (an interlude, a page the narrator skips) left nothing queued, though playback steps over it. The next narrated section is now found the way the section change finds it. The text opening still comes from the adjacent section. - A queue whose file was still resolving when another file loaded could land after the new file and play the old section's audio. The player now checks, with nothing awaited before the command, that the file the queued one follows is still the one playing. Verified on the Android emulator with a narrated EPUB that puts an unnarrated interlude page after each poem, freezing the WebView renderer 8 s into poem 1: - 9ed692479: poem 1 ended and the playlist ended with it; silent until the thaw. - this change: poem 1 rolled on into poem 2 across the interlude; after the thaw, poem 2's stanzas were passed over and poem 3 played. The split-file book from 9ed692479 behaves as before. The stale-queue race is covered by the unit test only. Tests: "offers the next narrated section, stepping over one without a recording" fails without the change with "expected preloadSection to be called once, but got 0 times"; "a queue still resolving when another file loads is dropped" with "expected [ 'queue poem2.mp3' ] to deeply equal []". Raised by CodeRabbit's review of 9ed692479. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(tts): reconcile Android narration ends and late rollovers by position Two follow-ups from CodeRabbit's review of b18827d30, both about matching JS to where ExoPlayer really is after the WebView slept. - When both the loaded file and the queued one finished under lock and every event was lost, the position read said only index -1, so JS still thought the first file was current and replayed the queued one. The plugin now keeps the item the playlist ended on and reports it as endedIndex once nothing is current; sync() rolls to it. - A late item-ended event named an index that a later queue had reused: after a position read found A -> B and C was queued, A's event (index 0) rolled JS on to C and ended B's stanza while B was still playing. The event now only prompts a position read, which rolls only when the player really moved. Verified: - "after a lock longer than the queued file, with every event lost" fails without the endedIndex change (expected 'stuck' not to be 'stuck'). - "a late rollover event from before the next queue does not end the file playing" fails without the event change (expected [{ code: 'end' }] to be 'stuck'). Both pass with it; src/__tests__/services/tts 920 passed. - pnpm lint, format:check, fmt:check, clippy:check, test:rust (201 passed). - Android emulator (API 35, x86_64 debug APK), split-narration book: screen on, one ExoPlayer track across four sections with the highlight following; renderer frozen 50 s and 12 s, narration continued into the next section on thaw with nothing replayed. The lost-event cases can't be produced there (SIGSTOP queues events, it doesn't drop them), so they are covered by the unit tests only. Reported by kelvinalfaro on GitHub (#7193). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(tts): drop narration end signals that belong to a replaced file Follow-ups from CodeRabbit's review of ce477e976. Since an end of file can now be found by polling, the `ended` event and a slow position read can both arrive after JS has moved on and loaded the next file, and each ended that new file's wait at once. - An `ended` event now only ends playback when a position read confirms the player is still at an end (both plugins clear the current item before they send it, iOS included). - A position read that overlapped a load is dropped: the player counts loads, and sync() ignores a reply when the count changed while it waited. The third finding, a queue that lands after the playlist ended, needed no change: the next run sees the player still on the old file and loads the queued one, which the plugin jumps to. A test now covers that. Verified: - "a late ended event does not end the file loaded since" and "a position read taken before a load does not end the file loaded" fail without the change (expected [{ code: 'end' }] to be 'stuck'); they pass with it. "a file queued after the playlist ended is loaded, not waited on" passes before and after. - src/__tests__/services/tts: 924 passed. pnpm lint, format:check. - Android emulator (API 35, x86_64 debug APK), split-narration book: played to the end of the book with the screen on, and TTS stopped 0.2 s after ExoPlayer ended. Renderer frozen 12 s: continued into the next section on the thaw. iOS not run: its plugin clears the index before `ended`, read from NativeTTSPlugin.swift only. Reported by kelvinalfaro on GitHub (#7193). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Kel <1563599+kelvinalfaro@users.noreply.github.com> Co-authored-by: Huang Xin <chrox.huang@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1166393eb9
|
fix(android): keep the page-turn cover below the keyboard, closes #7171 (#7191)
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
Build with Nix / tests (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / nix_flake_check (push) Waiting to run
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_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
With Curl or Page Flip on, keys on the on-screen keyboard did nothing while
the in-book settings were open. The native page cover is a not-focusable
PopupWindow, which Android stacks above the input method. Because the cover
belongs to a different app than the keyboard, InputDispatcher dropped every
key touch that passed through it ("Dropping untrusted touch event due to
com.bilingify.readest ... PopupWindow").
Both native cover popups (the paper-turn surface and the turn-time page
cover) now use INPUT_METHOD_NEEDED, which orders them below the IME, and
SOFT_INPUT_ADJUST_NOTHING so the keyboard never moves them.
Verified:
- Test that fails without the change: NativePaperTurnTest
keepsTheNativeCoverBelowTheKeyboard, on a Xiaomi 13 (Android 16). On the old
code it fails with "Cover is Z-ordered below the keyboard expected:<131072>
but was:<0>". With the fix it was not rerun on device (the run was stopped
at the phone); the real-app check below covers it.
- Real app, Xiaomi 13, release APK of this commit (md5 checked on device),
Sogou keyboard. Before: window stack PopupWindow above InputMethod, key taps
ignored, the untrusted-touch log line above. After, with Page Flip and with
Curl (fresh app start): InputMethod above the cover; typing in Default Font
Size gave "1" then "16" and typing in Custom Content CSS gave "p" and
Backspace cleared it; no untrusted-touch lines; forward and backward turns
still animate in place at full size.
- pnpm test (14411 passed), pnpm lint, pnpm format:check, pnpm fmt:check,
pnpm clippy:check, pnpm test:rust (203 passed).
- Not run: the turn-time page cover in NativeBridgePlugin has no test of its
own; it gets the same two flags.
Reported by lambda3141 on GitHub.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
454ae3cbb8
|
feat(ios): book mode on iPhone Duo's inner display (#7137)
* fix(ios): build Swift packages with SwiftPM's native build system on Xcode 27.1
Swift 6.4 (Xcode 27.1) builds packages with the Swift Build backend by
default. It writes the library under out/Products/<Config>-<platform>
instead of <triple>/<config>, so the tauri crate failed to link with
"could not find native static library Tauri". In release it also makes
the plugins' @_cdecl entry points (init_plugin_*) local to the prelinked
object, so the app link failed with undefined init_plugin_* symbols. Pass
--build-system native, which keeps the old layout and exported symbols.
* feat(ios): book mode on iPhone Duo's inner display
On the inner display in landscape the hinge runs down the middle and each
half is about the size of the cover display. Show a book there as two
pages, one either side of the hinge, or as one page:
- A `duoBookMode` view setting (default on) gives exactly two columns, or a
two-page spread for fixed layouts. Off, the page is one column at the
reader's own width. A header button, the View menu's spread choice and a
Layout panel row switch it; the button and row appear only on the Duo.
- `get_safe_area_insets` reports the hinge status and the `.division`
reserved region. While the device is part way folded the spine gap (and
the header/footer padding) widens to keep text out of the crease. A hinge
interaction tells JS to refetch, because folding part way does not resize
the web view. The hinge code compiles only against the iOS 27.1 SDK.
- The layout follows the pose as the device folds, unfolds or turns, and
the spine-centred insets now also apply to fixed-layout spreads.
Every other pose and device keeps the reader's own settings: the resolver
returns them unchanged (parity tests cover the doc's viewports) and the
re-layout effect runs only on the Duo. Scrolled flow is left alone.
* feat(ios): show two pages whenever iPhone Duo is part way folded
Holding the inner display part way open in landscape is the book pose, so
show two pages there by default, whatever the book-mode toggle says. Flat,
the toggle still decides. A Layout panel row ("Two Pages When Partly
Folded") turns it off. Part way folded is the hinge status `partial` or an
active vertical folding region, so it doesn't depend on either alone.
* fix(ios): address review on iPhone Duo book mode
- Forward hinge updates within one status too (the folding region can
change with the angle), at most every 250ms with a trailing update.
- Resolve the Duo layout after the book opens, so a pose that arrives
while it opens is not lost before the re-layout effect has a renderer.
- Keep the effective spread when Separate Cover Page changes.
* test(reader): give the image-gallery viewer test a themeStore getState
FoliateViewer now resolves the iPhone Duo layout through
useThemeStore.getState(). The image-gallery test landed on main after
this branch was cut and still mocked useThemeStore as a bare hook, so
the rebased suite reported 2 unhandled rejections. Same mock as the
relocate and transform-listener tests.
Verified: the file reports 2 errors before and none after;
full pnpm test passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(reader): keep the Duo page still while the toolbars show (owner: "since the header/footer toolbars are temporary it should never change the layout of the content")
Book mode sized its columns from the live safe-area insets. On iPhone
Duo the toolbar brings back the 84pt side status strip, so opening it in
inner landscape cut max-inline-size from 713px to 650px and re-paginated.
It now uses getReadingScreenInsets, the side insets the reading page
already keeps with the status bar hidden.
The Duo re-layout effect also ran on every safe-area refetch and hinge
update and re-applied margins and gap each time; foliate re-renders on
every such write, even with the same value. It is now keyed on the
resolved layout values, so it only writes when the layout changes.
Verified:
- useDuoPose.test.ts fails without the fix (maxInlineSize 650, expected
713) and passes with it.
- iPhone Duo simulator (iOS 27.1), with a MutationObserver on the
renderer: showing and hiding the toolbars in inner landscape writes no
layout attributes and leaves text edges and location unchanged; open <->
partial in inner portrait writes nothing; partial in landscape writes
once for the crease gap.
- pnpm test and pnpm lint pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(reader): apply the insets current when a book finishes opening
openBook runs once from the mount effect and applied the margins after
its awaits through the first render's closure. On iPhone Duo the book
opens while the status bar still shows (an 82pt top strip in inner
portrait); the reader hides it before the open finishes, and the inset
effect skips while there is no renderer, so the page kept a 126px top
margin until something else re-applied the margins. It now calls the
latest applyMarginAndGap through a ref.
Verified:
- foliate-viewer-open-margins.test.tsx fails without the fix
(expected '126px' to be '44px') and passes with it.
- iPhone Duo simulator (iOS 27.1): the book opens with margin-top 44px
in inner portrait; before, the top band stayed until a toolbar toggle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(reader): keep the Duo page and toolbars still while the toolbars toggle (owner: "since the header/footer toolbars are temporary it should never change the layout of the content")
On iPhone Duo the status strip comes and goes with the toolbars, and
its live inset lands a moment after each.
- The reading page kept only the side insets seen with the status bar
hidden; in inner portrait the strip is an 82pt top inset, so the top
margin went 44px <-> 126px on every toggle. The top is kept too.
- The toolbars followed the live insets, so they drew without the strip,
then re-spaced when it arrived (and again while hiding). They now use
the insets recorded while the status bar shows.
- Both records kept a single window size, so after a rotation the first
toggle had no record. They are kept per window size.
Verified:
- insets.test.ts (portrait top kept), useSafeAreaInsets.test.tsx (shown
insets recorded) and useDuoPose.test.ts (record kept per size: expected
650 to be 713) fail without the change and pass with it.
- iPhone Duo simulator (iOS 27.1), MutationObserver on the renderer plus
per-frame header/footer button positions: toggling the toolbars in
inner landscape, inner portrait, part way folded and on the cover
display writes no layout attribute, keeps the location, and the
header/footer buttons do not move sideways once shown. Not fixed: the
first toolbar show at a window size after launch, before any record
exists, still re-spaces the toolbars once.
- pnpm test and pnpm lint pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(reader): lay the Duo book out the same flat and part way open (owner: "Why partially open and fully open has layout shift, please don't do that.")
Two pages reserved the crease gutter only while the folding region was
active, so folding part way widened the spine gap from the derived ~32px
to 72px and re-paginated, and unfolding did it again. UIKit reports the
region while flat too (inactive), so two pages now always keep the gap
clear of it; being part way folded still needs the region active.
Verified:
- duo.test.ts "lays the book out the same flat and part way folded"
fails without the change (columnGapPx 0 flat vs 73 folded) and passes.
- iPhone Duo simulator (iOS 27.1): flat <-> part way open in inner
landscape, three times, writes no renderer attribute; text edges stay at
440/512px either side of the 455.5-495.5 region and the location holds.
- pnpm test and pnpm lint pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(reader): re-apply the Duo layout after every rotation
The Duo re-layout effect resolved the layout during render from the
window size and store snapshots, which React does not track: after a
rotation it sometimes committed the new values without running the
effect (its hook tag showed no HasEffect), so the page kept the other
orientation's column width until something unrelated, such as a toolbar
toggle, re-laid it out. The effect now resolves the layout when it runs,
keyed on the pose, fold, insets and settings, and writes only attributes
that change. It also waits 150ms for the window to settle: turning the
device passes through a 669x669 viewport for ~50ms, and a layout written
then (max-inline-size 576px) was an extra re-pagination, or stuck if no
later trigger came.
Verified on the iPhone Duo simulator (iOS 27.1), with a MutationObserver
on the renderer: four rotations each wrote one batch at the final size
(720px portrait, 713px landscape) and none at 669x669; before, a
rotation with the toolbars hidden wrote nothing and left 713px in
portrait. No unit test: the skipped effect depends on WebKit's
resize timing, which jsdom does not reproduce. pnpm test and pnpm lint
pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(ios): cancel the pending trailing hinge event before an immediate send
The trailing hinge update was a fire-and-forget asyncAfter guarded by a
flag. An immediate send cleared the flag but left the old callback
queued, so a second trailing update could be scheduled before the first
ran, sending duo-fold-changed closer than 250ms apart. The trailing
update is now a DispatchWorkItem that every send cancels, so at most one
is pending. Answers the CodeRabbit review on the hinge throttle.
Verified on the iPhone Duo simulator (iOS 27.1): flat <-> part way open
still reaches JS (fold status open / partial, region 455.5/40). No unit
test: the native bridge has no Swift test target; the JS side dedupes
fold and inset updates, and the Duo re-layout writes only changed
attributes, so extra events never re-laid out the page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(reader): drop the Duo two-page settings rows (owner: "They should be the default and it's not necessary for the option.")
Two pages either side of the hinge is how the Duo's inner display shows
a book in landscape, so the Layout panel's "Two Pages When Unfolded" and
"Two Pages When Partly Folded" rows and the duoFoldedBookMode setting are
removed, with their strings. Part way open no longer forces two pages:
the page is laid out the same flat and part way open whichever the
reader chose. The header button still switches to one page and back.
This also settles the CodeRabbit finding on the View menu's Single Page
while part way folded: nothing forces two pages any more.
Verified:
- duo.test.ts "keeps the page the reader chose, flat or part way open"
fails before the change (2 columns, expected 1) and passes after.
- iPhone Duo simulator (iOS 27.1): one page from the header writes one
batch (1 column, 720px); part way open and back write nothing and keep
the location; two pages again writes one batch (2 columns, 713px, gap
72px). The web bundle has no "Two Pages When" string.
- pnpm test (1206 files) and pnpm lint pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(reader): match the Duo inset and fold notes to the code
docs/safe-area-insets.md and the comments still described the earlier
behaviour: only side insets kept, toolbars on the live insets, hinge
events only on a status change, a re-layout on every change, and the
removed duoFoldedBookMode. They now say the reading page keeps the top
and sides recorded with the status bar hidden (one record per window
size), the toolbars use the insets recorded with it shown, hinge updates
are throttled with one cancellable trailing update, and FoliateViewer
writes only changed attributes once the window settles. "Part way" in
the doc is "partly" (CodeRabbit).
Checked by reading each statement against the code it names.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Huang Xin <chrox.huang@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
c811741af8
|
feat(ios): turn pages with the native paper curl (#7046)
Some checks failed
PR checks / test_web_app (1) (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL Advanced / Analyze (rust) (push) Has been cancelled
PR checks / test_web_app (2) (push) Has been cancelled
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Build with Nix / tests (push) Has been cancelled
PR checks / nix_flake_check (push) Has been cancelled
PR checks / rust_lint (push) Has been cancelled
PR checks / koplugin_rust_lint (push) Has been cancelled
PR checks / build_web_app (push) Has been cancelled
PR checks / test_extensions (push) Has been cancelled
PR checks / build_tauri_app (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Deploy to vercel on merge / build_and_deploy (push) Has been cancelled
Publish Docker image / merge (push) Has been cancelled
* fix(reader): give a reloaded page its own native paper owner
The native paper scene outlives a page reload (a WebContent crash or a
full navigation), but NativePageTurn numbered its readers from a module
counter that restarts at 0. A reloaded reader came back as owner 1, so
the native side kept the old page's generation and rejected every
capture with ready:false. Taps then did nothing until the app restarted.
Each page load now starts the counter at a random 30-bit value, which
stays within the Kotlin side's Int.
Found while bringing the native curl to iOS: after a page reload in the
iPhone 17 Pro simulator, a capture with owner 1 returned ready:false
while the same capture with a fresh owner returned the texture.
Verified:
- native-page-turn.test.ts 'gives a reader on a reloaded page a new
native owner' fails without the change ("expected 1 to be 2") and
passes with it.
- iOS simulator build with the change: two page reloads, each followed
by a native curl to the next page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(ios): turn pages with the native paper curl
#7001 gave Android a native paper curl; iOS kept the captured curl,
which snapshots each page as a 2x JPEG and turns spreads and PDFs less
cleanly. iOS now runs the same NativePageTurn commands against a Swift
twin of the Android renderer:
- NativePaperMesh.swift ports the 64-hinge mesh line for line.
- NativePaperTurn.swift keeps the Android command semantics (owners,
generations, turn ids, at most three resident pages, aborts, the
3 s request deadline). Pages come from WKWebView.takeSnapshot at full
screen scale, regions snapped to device pixels. A Metal sheet sits
above the web view, where takeSnapshot never sees it, and presents
with the Core Animation transaction that shows or hides it. Rendering
runs on the main thread, so a scene is ready when its command
returns. A passive gesture recognizer tracks the finger; CADisplayLink
settles a released sheet.
- Snapshots are redrawn as 8-bit BGRA before upload: MTKTextureLoader
failed on WebKit's snapshot images with "Image decoding failed".
- paper_curl is routed to iOS in Rust, and useCapturedTurn uses the
native controller and page buffer on iOS as on Android (one or two
columns, fixed layouts included).
Verified:
- useCapturedTurn-scrollLock.test.ts: the recovery-path cases now run on
iOS too. The three native iOS cases failed before the hook change
("expected invalidateNativePages to be called 1 times, but got 0").
- The Swift mesh, compiled with swiftc on macOS, matches the browser
fixtures the Android JVM test uses (396 and 402 vertices). With the
bend band changed from 0.7 to 0.69 it fails at component 0. The
landed spread leaf mirrors its column in LTR and RTL.
- iPhone 17 Pro simulator (iOS 26.3) on a devtools sim build, driven
over the WebKit inspector and recorded with simctl:
- Alice EPUB: tap forward and back, next/next/prev queued, slow drag,
flick and a drag pulled back (each lands on the expected page), and
a forced two-column spread. Only paper_curl IPC, no
capture_webview_region.
- Naval PDF, paginated at 100%: forward (captured, navigated under
the cover, captured again) and back (resident start).
- The flat cover matches the live page: pre-motion frames differ by
0.0-0.06 grey levels in light, Nord and dark Nord, with no step at
the hand-off back to the live page.
- pnpm test (14124 passed), pnpm lint, format:check, clippy:check,
fmt:check.
Not run: a physical iPhone or iPad; native finger tracking (simulated
touches never reach UIKit, so drags used the JS move path); RTL books;
CBZ. Once in the simulator, after an openurl import failure and a page
reload, every takeSnapshot stopped completing, including main's
capture_webview_region. A relaunch cleared it, and it didn't recur
across three reloads during turns. The 3 s deadline fails such a turn
instead of hanging it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(ios): drop the native paper scene when the page reloads
The native scene belongs to the plugin and outlives the page. If the
page reloaded during a turn (a WebContent crash mid-drag, which
WebViewLifecycleManager answers with a reload), the old page never sent
finish, cancel or dispose. The scene stayed active with its sheet over
the web view, and refused the reloaded reader's new owner, so the page
looked frozen and native turns stayed off until the app restarted.
WebViewLifecycleManager now reports a terminated WebContent process and
every committed main-frame navigation, and the plugin resets the native
scene on either. The page-curl doc also no longer says MTKTextureLoader
uploads the snapshots.
Verified on the iPhone 17 Pro simulator (iOS 26.3), Alice EPUB, with a
JS drag held mid-turn (start sent, no touchend):
- Before: after location.reload(), the half-turned sheet stayed over the
page, every capture returned ready:false and next() did not turn.
- After: the reload clears the sheet and next() curls natively to the
next page. Killing the WebContent process mid-turn does the same
after the web view recovers.
There are no Swift unit tests in this plugin, so the simulator runs
before and after are the check.
Reported by coderabbitai on GitHub.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
ca1a252664
|
fix(reader): add native Android paper curl and stabilize page turns (#7001)
* Fix paper curl rendering and backward page turns * Add native Android paper curl and stabilize page turns * Preserve active paper turns and scope capture failure recovery * Clarify frame timing fraction in page curl documentation * chore: point the foliate-js submodule back at readest/foliate-js The pointer (6381a92) is the head of readest/foliate-js#139 and is fetchable from readest/foliate-js through refs/pull/139/head. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Hide cancelled native paper scenes and document rendering lifecycle * fix(android): clip native paper regions to the WebView Chrome's CSS viewport can overhang the WebView: on a Pixel 7 the reader is 412.19 x 915.05 CSS px, 1082 x 2402 px at 2.625, on a 1080 x 2400 px WebView. PixelCopy clipped that request to the window and stretched the rest over the 1082 x 2402 bitmap, so the native sheet and the page cover drew about 2 px larger than the live page. The page appeared to shrink when the live WebView took over before and after a curl. The native page region, its capture and cover_webview_region now convert CSS px through webViewRegion(), which clips to the WebView bounds. Verified: - NativePaperRegionTest fails on the unclipped arithmetic ("arrays first differed at element [2]; expected:<1080> but was:<1082>") and passes with the clip; all 24 native-bridge JVM tests pass. - x86_64 debug APK on an API 35 emulator (Pixel 7 profile): in a screen recording, consecutive flat frames of the same page jumped by (2, 2) px 29 times before the fix and 0 times after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(android): turn two-column spreads with the native paper curl Landscape (two-column) EPUB spreads fell back to the captured curl, which captures at a 2x cap as JPEG and stretches the CSS viewport overhang into the bitmap, so the sheet looked soft and shifted by two pixels. The native scene now turns a spread too, modelled on the single-column path: the inner column stays flat, the outer column turns as a leaf hinged at the spine, and the leaf's back shows the facing page of the destination spread. Backward turns replay the previous spread's forward turn in reverse, as single-column does. The JS side passes the column count with `start` and enables the native path and page buffer for up to two columns on Android only. Verified: - NativePaperMeshTest: the spread mesh matches the browser mesh built by buildPageCurlMesh(..., 2), and a landed leaf mirrors its column (LTR and RTL). Both failed on the stub first ("expected:<2412> but was:<2376>"). - NativePaperTurnTest (API 35 emulator, 19/19): with the spread branch disabled the new spread test fails "Native frame at 4,320 expected:<-65536> but was:<-13121737>"; it passes with it. - native-page-turn.test.ts: 'tells the native scene how many columns the spread shows' failed first, passes now. - Emulator, landscape Alice in Wonderland: tap/drag forward and back, cancel, all land on the expected page; logcat shows paper_curl only, no capture_webview_region. During a slow drag the inner column differs from the live page by a mean 0.64 grey levels (6.13 with the captured curl) at the same sharpness, so no blur and no 2 px shift. - Not run: iOS (unchanged, still single-column only), a physical device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(android): turn PDF and fixed-layout pages with the native paper curl Fixed-layout books (PDF, CBZ, fixed EPUB) fell back to the captured curl, which grabs the page as a 2x JPEG. They now use the native scene too: - foliate-js: the fixed-layout renderer names its pages with getPageTurnKey(), including the side shown in a portrait spread. - NativePageTurn no longer requires previewPage. A renderer without it captures the current page, navigates under the native cover, then captures the destination. Pages already resident (turning back) start at once. - On Android the page buffer follows native eligibility, so PDF sheets cover only the renderer, as EPUB sheets do. - The capture subscription now ignores a view-state write that changes no field. The bookmark ribbon rewrites its unchanged visibility on every relocation; that dropped the current sheet between capture and start of every cold turn, so each PDF turn failed with "Native page textures are not ready" and fell back to an unanimated jump. Found with CDP logpoints on the emulator. Verified: - fixed-layout-page-turn-key.browser.test.ts walks LTR/RTL books in portrait, landscape and single-page spreads; without the portrait-side prediction it fails "expected '2:left' to be '1:right'". - native-page-turn.test.ts 'turns a renderer without page previews...' failed first ("JPEG path must not run"), passes now. - useCapturedTurn-scrollLock.test.ts 'keeps native book textures when a view state is rewritten unchanged' failed first ("expected invalidateNativePages to not be called at all, but actually been called 1 times"). The recovery-path cases for fixed curl and curl without preview now expect the native path. - Related unit suites (633 tests) and lint pass. Fixed-layout browser files pass one by one; run together they hit "Cannot connect to the iframe", which main does the same. - Android emulator (API 35), Alice PDF: portrait, landscape single page and landscape two-page spreads. Taps, slow drag, tap/swipe back and a cancelled drag all land on the right page with an animated curl; only paper_curl IPC, no capture_webview_region, no interrupted turns. - Not run: a physical device, iOS (unchanged), CBZ. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): keep a cancelled native paper cover hidden when its scene arrives The native scene is prepared on the GL thread. A cancel that reached the main thread first hid the cover, and the late start callback then set alpha back to 1 and resumed dragging, so the stale sheet covered the live page until finish. The callback now leaves a cancelled scene hidden and not dragging; animate settles it back and finish ends it. Verified with NativePaperTurnTest aCancelBeforeTheSceneIsReadyKeepsTheCoverHidden on the API 35 emulator: without the fix it fails "A cancelled scene must not restore its cover expected:<0.0> but was:<1.0>"; with it all 20 NativePaperTurnTest cases and the plugin JVM tests pass. Raised by CodeRabbit on PR 7001. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): keep the resident native page when its replacement upload turns stale Uploading a page that was already resident reused its texture id. If the request turned stale after texImage2D, the upload deleted that id and dropped the key, while JS, which only reads the bank on success, still counted the page as resident; the next scene failed with "Native page textures are not ready". The replacement now goes into a new texture; a stale one deletes only itself, and a valid one replaces the old. Verified with NativePaperTurnTest aStaleReplacementUploadKeepsTheResidentPage on the API 35 emulator: without the fix it fails "The resident page stays in the bank"; with it all 21 NativePaperTurnTest cases and the plugin JVM tests pass. Not run: the app on a device with this change. Raised by CodeRabbit on PR 7001. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(page-curl): describe native curl for spreads and fixed layouts The doc still limited the Android native path to single-column reflowable books. It now covers two-column spreads, fixed layouts without previews, capture clipping to the WebView and unchanged reader-state writes, and lists the fixed-layout page-key browser test. Docs only; checked against the code in useCapturedTurn.ts, nativePageTurn.ts and NativePaperTurn.kt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(foliate-js): point at the merged readest/foliate-js#139 foliate-js#139 was squash-merged as 4b6b9f8. Its tree is identical to the PR head 2610185 this branch tested, so no code changes; the submodule now resolves from readest/foliate-js main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Huang Xin <chrox.huang@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f4b0102ebd
|
chore(agent): maintenance loops with a Reply Desk, lessons and acceptance rules (#6796)
* chore(agent): add the maintenance loops, lessons and acceptance rules Reproduces the Magpie workflow: three /loop skills that run in parallel (triage-github for issues and PRs, watch-social for X/Discord/Reddit with a Haiku pre-filter, nightly-review for the retrospective), a LESSONS.md that every session imports, acceptance criteria that lessons seen on three days are promoted into, and a community-PR policy (harm first, close unreviewed, proposed blocks). LESSONS.md is seeded from a review of the 86 commits from 2026-10-04 to v0.12.16; three lessons seen on three days are already promoted. Verified: pnpm format:check passes; the triage step-0 query was run against the repo (needs --include-prs to see PRs). Not run: the loops themselves, which reply on GitHub, X and Discord. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): route triage replies through the Reply Desk for approval Drafts go to a private review page; the loop posts only approved replies, re-checks the thread first, and treats edits and notes as feedback. The window is threads created in the last 3 days. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): filter triage search by date; GitHub ignores timestamps Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): real timestamps on the Reply Desk; foliate-js fixes go first Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): the triage loop follows its own PRs: dependencies, CI, reviews, merge cards Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): edit PR bodies through the REST API Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): wake the triage loop on CI results and reviews watch-prs.py polls the loop's open PRs every minute and prints one line per event (CI finished green or red, CodeRabbit done, a new review or comment, merged or closed, a failed read) for a Monitor to deliver. The loop also checks a PR is still open before writing its merge card: the maintainer merges on GitHub too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): the loops only process the owner's own PRs The loops run unattended with the owner's credentials, so a PR from anyone else is skipped unread: its description, diff, comments and branch are never opened or run, and the loop never comments on, closes or merges it. On the owner's PRs they act only on CodeRabbit (login and type checked) and the owner, and stop on a commit the owner didn't author. The watcher enforces the same: it skips other people's PRs, reports foreign commits, and tags each review or comment trusted or untrusted. The nightly review reads only the merged code of community PRs and no longer proposes blocks; the social loop never fetches code a post links to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): propose English titles for non-English issues A non-English issue title gets an English newTitle on its Reply Desk card, applied when the card is approved; the reply stays in the reporter's language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): send approved Reply Desk cards within five minutes A light job checks the desk for approved cards every 5 minutes and runs only the send step; merges go through the REST merge endpoint pinned to the approved head. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): read the Reply Desk URL from local loop config Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): keep the PR watcher honest on a failed login or a null status The watcher now stops with WATCH_ERROR when it can't read the gh login, instead of treating every PR as foreign and later replaying old events. A CodeRabbit status with a null description no longer raises before the status is recorded. Verified: py_compile; a --once pass on #6796 against a scratch state dir; GH_TOKEN=invalid exits 1 with "WATCH_ERROR cannot read the gh login: gh: Bad credentials (HTTP 401)"; a stubbed status with description null emits CODERABBIT_DONE and records it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): tighten the send step, rules and checklists from review - Send step: drop a PR card whose PR is no longer open, keep other people's comments on owner PRs unread, claim a card as "sending" before any GitHub action, and send a failed action back as stale instead of retrying it; record prUrl, and open a fix PR only through its card. - Acceptance: the failing-test rule is for behavior changes; a red test on main is fixed in its own PR; reporters are credited by their public name only. - Nightly review: CI at merge is the runs that finished before mergedAt; "Fixed in" only when a fix exists. - Social loop: the filter agent reads only the collected file, and the loop acts only on items that match it. - Community PR checklist: run their code only in a credential-free sandbox. Verified: docs and agent files only; read through for consistency with the trust boundary and the Reply Desk flow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): write PR descriptions for GitHub, not from commit bodies The loop's PRs reused hard-wrapped commit bodies, which GitHub renders with a forced break at every line. PR descriptions now follow the format of the earlier Claude Code PRs: a Closes/Part of line, Problem, Fix and Verification sections, unwrapped lines and code in backticks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): the social loop posts only approved Reply Desk cards Replies on X, Discord and Reddit, and issues it opens, are now drafted as social cards and posted only after approval; the triage send step skips them. A post asking the loop to act gets nothing beyond a card. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): leave approved social cards to the social loop The triage send step now skips kind: social cards, as 7e87d684c described. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): fetch sending cards too, so a stopped send gets reported Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): give a follow-up draft its own card after a sent one Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2813ad7e6a
|
fix: iOS reader polish for drawing dock, short sheets, bookshelf header and read aloud (#6778)
* fix(reader): fill the drawing dock's bottom safe area with its own background The dock was lifted above the home indicator by the bottom inset, leaving a transparent gap where the reader footer showed through. It now sits at the bottom edge and pads the inset with its own background. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(library): title the bookshelf editor with the selected shelf on phones On phones the selected shelf's name becomes the page title beside the back button and the tabs, icons only, get a centered row of their own, so the built-in shelves and the add button fit on one line. Wrapped rows are now centered on the screen rather than within the slot beside the back button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(tts): keep a hidden mini player hidden through brief stalls between paragraphs The buffering probe catches the short wait while the next paragraph loads, which re-showed the card and re-armed its linger, and the end of buffering showed it again. A hidden card now comes back only when a stall lasts 500ms, and the end of buffering just restarts the countdown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ui): only full-height sheets clear the status bar and show a back button A content-height sheet such as a confirmation, or a sheet snapped short of the screen, rests at the bottom: it no longer pads its drag handle for the status bar or shows the back button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(tts): stop the word highlight stepping back at a sentence start on iOS chunk-start fires as the item is handed to AVPlayer, which can take a few hundred ms to open it. The media clock ran ahead from the event and lit the second word, then the next poll pulled it back to the first. The clock now holds until a poll sees the item playing, and the position reports playing from timeControlStatus rather than the rate, which is set while loading. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(tts): preload the next chapter's opening for Edge TTS and custom voices Only windowed engines carried preloads past a chapter end, so with Edge TTS or a custom service a chapter change started with nothing synthesized. A new preloadsAudio capability marks engines whose preloads keep the audio; they now fill their usual handful of paragraphs from the next chapter too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: run selected unit test files with pnpm test --run pnpm test -- <files> forwards the separator and runs more than the files asked for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(agent): update agent memories Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(tts): keep the iOS word clock from stepping back on pause or running ahead on resume Pausing froze the clock at the last poll, up to 250ms behind where it had got, so the highlight could step back a word. Resuming restarted it before AVPlayer was rendering again. Pause now freezes the extrapolated position, and resume polls and lets the player report when it is playing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(tts): preload the next chunk's opening at the end of a chunk A section over 512 KB of HTML is read in chunks, and the live document ends at each chunk's end. The cross-boundary preload took that for the chapter's end and preloaded the next section, so moving to the next chunk found nothing synthesized. It now starts a throwaway reader at the next chunk's anchor in a fresh copy of the section, and only goes on to the next section after the last chunk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(ui): drag a content-height sheet up instead of setting its height Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(tts): use the contrast button for play/pause in the full player Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(tts): preload the next section in the language it is read in, and more - A section file with only xml:lang is rendered with the book's language as its lang, which is what the live read speaks it in. The fresh copy used to preload the next section kept xml:lang (zh-CN vs zh), so its audio was cached under keys playback never looked up and each new section started with a wait. The fresh copy now takes the book's language the same way. - E-ink drops the tinted sentence under the word highlight in word mode. - The lyric sheet follows the document read, not only the section index, so a section read in chunks no longer shows the first chunk's lines under the next chunk's position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(tts): resize the full player on desktop and size the lyric text - A corner grip resizes the full Read Aloud player with the pointer on desktop, up to the whole window, and the size is kept for the next time it opens. Once sized, the lyric sheet takes the height it is given. - A−/A+ in the lyric view step the line size from 12 to 38px, kept per device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(tts): keep the lyric size and player size working when storage is blocked Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
cc4402a098
|
feat(tts): sentence-by-sentence mode and A-B repeat (#5233) (#6627)
Read Aloud gains two study modes in the player sheet: - Pause after each sentence: playback parks on the next sentence once one is read, and Play continues one sentence at a time. The setting persists as ttsPauseAfterSentence. - A-B repeat: the button marks the sentence being read as A, then B, then clears. B before A swaps them; the same sentence twice repeats it. The span is tinted in the book and marked in the lyric sheet. While either is on, each utterance is cut to one sentence so the engine stops exactly at its end. Turned on mid-paragraph, the mode takes effect at the next sentence boundary. Paired audiobooks, whose marks are chapters, hide both. Bumps foliate-js for the sentence segmentation fix: words such as "Hobbit." or "it." were taken for abbreviations, so two sentences were read and stepped as one. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3e1f410c61
|
fix(ios): hide the status bar through the view controller for Xcode 27 builds (#6508)
Apps built with the iOS 27 SDK can no longer hide the status bar with UIApplication.setStatusBarHidden (SDK 26 builds still can), so on Xcode 27 builds the reader never hid it. Hide it through the root view controller instead: tao's TaoUIViewController implements prefersStatusBarHidden and setPrefersStatusBarHidden:, with UIViewControllerBasedStatusBarAppearance on. This works for SDK 26 and SDK 27 builds and is the only change on devices other than iPhone Duo. With view-controller-based appearance the in-app browser's own preferredStatusBarStyle now applies. The bridge hides it through the webview's window, which exists before a CarPlay-first launch attaches a scene, resolves once the safe area has followed, and reports statusBarHidden with the insets. On iPhone Duo, hiding the status bar also removes the side strip's inset (84pt on the inner display). The reading page keeps the side insets recorded with the status bar hidden, so opening the toolbar does not re-paginate, while the header and footer bars follow the live insets; the insets are re-read after each show/hide, and the landscape status-bar rule is limited to compact-height windows on the Duo. Off the Duo none of this runs: no re-read, base's landscape rule, and page insets equal to the live ones. Claude-Session: https://claude.ai/code/session_01SEQcYorVTWVVeNkGLdJ8Jw Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
9928d6a70a
|
fix(ios): keep chrome and page content clear of iPhone Duo's side status strip (#6312)
On iPhone Duo (iOS 27.1) the status bar is a vertical strip along one long edge on the cover display and on the inner display in landscape, reported as a large left or right safe-area inset. Readest only applied top/bottom insets, so buttons, sheets, popups, the page and corner decorations sat under it. Everything here is gated on an explicit iPhone Duo flag so no other device changes: the native bridge reports isIPhoneDuo from the model identifier (iPhone19,4; SIMULATOR_MODEL_IDENTIFIER in the simulator), since iOS has no foldable API and viewport size cannot identify the device. On the Duo: - Bars, sheets, panels and pages are padded by the horizontal insets (a side panel only on its screen edge); edge-anchored controls, toasts and edge gestures are offset past the strip. - The viewer container is inset instead of folding the insets into the paginator margins, which put only part of them on the outer edge; a two-column spread spanning the full width is inset symmetrically so the spine lands on the fold. - Popups clamp to the safe region, with their points shifted back to the cell's coordinates (clamping alone moved them by the inset). - Every pose keeps the mobile bars. Off the Duo each path is main's code; every existing test passes unmodified, and new parity tests cover iPhone portrait/landscape, iPad, Android and desktop. Claude-Session: https://claude.ai/code/session_01SEQcYorVTWVVeNkGLdJ8Jw Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2ce0522743
|
chore(linux): catch up the CEF runtime with upstream feat/cef, closes #6397 (#6487)
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
Build with Nix / tests (push) Waiting to run
PR checks / nix_flake_check (push) Waiting to run
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
|
||
|
|
5d030abf32
|
fix(build): repair the Docker and Nix builds after #6368 (#6379)
* fix(build): repair the Docker and Nix builds after #6368
Two main-branch builds broke on
|
||
|
|
8750c31043
|
perf(android): cut the arm64 apk from 90MB to 57MB (#6368)
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
Build with Nix / tests (push) Waiting to run
PR checks / rust_lint (push) Waiting to run
PR checks / koplugin_rust_lint (push) Waiting to run
PR checks / nix_flake_check (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
* perf(android): cut the arm64 apk from 90MB to 57MB The Rust library is 95% of the APK, and most of what it carried was not code. Measured on an aarch64 release build: 89.7MB -> 57.5MB. - Build `release` with fat LTO and one codegen unit. Cross-crate inlining cuts .text by 5.2MB and the unwind/exception tables by 2.1MB, at the cost of a longer final link. - Strip the packaged library. AGP's own strip step only drops the .debug_* sections, so 22MB of symbol tables (10MB after LTO) reached every download. The strip runs on AGP's output, so `target/` keeps the unstripped copy, which the release and nightly workflows now upload to Sentry as debug files; Rust frames stay symbolicated. Android builds also link with a build id, which is how Sentry matches them, and the `debug-images` feature attaches the loaded modules to each event. - Stop shipping jieba's WASM twice (2.7MB). The wasm-bindgen glue defaults to the file the bundler already emits; pointing `init()` at a public/vendor copy embedded both. - Keep the browser-only turso WASM out of native builds (3.3MB). The alias that excluded it still named `@tursodatabase/database-wasm`, which the web database service stopped importing in #4086. simplecc is still embedded twice (0.4MB): its glue is imported through the `@simplecc/*` path alias out of public/vendor, so deduping it means moving that directory. Verified: the built APK's library carries no symbol tables and a build id; `target/` keeps its; the bundle requests exactly the one embedded jieba asset key and no /vendor/jieba path; the turso WASM is absent from `out/`. The APK installs and runs on a Xiaomi 2211133C, library and a Chinese book render, and RSVP runs on it. Whether jieba's WASM is actually fetched at runtime is NOT verified: release webviews are not inspectable and the fallback to Intl.Segmenter is silent. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * perf(android): drop fat LTO, codegen-units=1 is the whole win The previous commit credited the code-size saving to fat LTO. That was wrong. Measured on aarch64-linux-android with the flags rustc actually received (`cargo build -v`): codegen-units=16, lto=false .text 29.66MB .eh_frame 3.69 .except 2.51 codegen-units=1, lto=off .text 24.43MB .eh_frame 2.28 .except 1.84 codegen-units=1, lto=thin .text 24.43MB .eh_frame 2.28 .except 1.84 codegen-units=1, lto=fat .text 24.44MB .eh_frame 2.28 .except 1.84 One codegen unit accounts for all of it; LTO changes nothing once it is set, so fat LTO was buying only link time and peak memory on every release target. The rebuilt APK confirms it: 57.49MB without LTO against 57.50MB with it. What `codegen-units = 1` costs, from a clean aarch64 build on an M-series: 5m54s against 4m15s, and 3.3GB peak RSS against 2.9GB. That answers the review's question about the 75-minute Android and 45-minute desktop step limits in nightly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * perf: stop shipping vendored modules the bundler already embeds Tauri embeds every file under `out/`, and `public/` is copied there whole. So a module imported through a path alias that points into `public/` ships twice: once bundled into a chunk, once as a published file nobody fetches. jieba cost 2.7MB that way; `@pdfjs/*` and `@simplecc/*` had the same shape. Split the vendored assets by how they are loaded. What the reader fetches by URL at runtime stays in `public/vendor/pdfjs` — the worker, the WASM decoders, cmaps, standard fonts, the layer CSS, all built as runtime URLs in foliate-js/pdf.js, which is why the bundler never emitted copies of them. What the bundler imports moves to `vendor/` (outside `public/`): `pdf.min.mjs` + its types, and the simplecc glue and WASM. Measured on the embedded frontend, brotli as tauri compresses it: 23.7MB -> 16.96MB across this and the earlier jieba/turso fixes. That comes out of every Tauri target, not just the APK. The new test states the invariant that was broken rather than the three symptoms: no tsconfig path alias may resolve into `public/`. It failed on `@pdfjs/*` and `@simplecc/*` before this change. Desktop stripping was measured and deliberately NOT done. On macOS it saves 4.76MB in the binary but only 1.44MB of DMG (36.59 -> 35.15MB), because a DMG compresses symbol strings while an APK stores the .so uncompressed (verified: `Stored`, 0%) — which is why Android got the full 22MB. Buying 1.4MB would mean either a profile-level `strip`, which deletes the unstripped artifact Sentry symbolicates Rust panics from, or pulling the release job apart from tauri-action, which builds, bundles, signs and notarizes in one step. deb, rpm and AppImage are compressed too, and MSVC keeps symbols in the PDB. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: init simplecc from the emitted WASM, not a URL that no longer exists Moving the simplecc glue out of `public/` left `initSimpleCC` still asking for `/vendor/simplecc/simplecc_wasm_bg.wasm`, a URL nothing publishes any more, so Chinese variant conversion would fail to initialize at runtime. Caught in review of #6368. `init()` with no path uses the glue's default `new URL('simplecc_wasm_bg.wasm', import.meta.url)` — the copy the bundler emits and Tauri embeds — the same shape as the jieba fix. The existing WASM-init test covered jieba only, which is why this slipped through; it now covers both. Verified against a fresh build: the chunk references `static/media/simplecc_wasm_bg.<hash>.wasm` and no runtime `/vendor/simplecc` reference remains (the two textual hits left are the bundled package.json script strings and a source-map path, and maps are stripped before packaging). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
7b89602f78
|
fix(library): improve e-ink pagination and bookshelf sync (#6330)
* fix(library): make finished books exclusive by default * fix(sync): upload replica records in bounded batches * fix(library): discard unpublished anonymous bookshelves safely * feat(library): paginate grid and list shelves in e-ink mode * docs: describe e-ink paging and offline bookshelf cleanup Co-Authored-By: OpenAI Codex <noreply@openai.com> --------- Co-authored-by: OpenAI Codex <noreply@openai.com> |
||
|
|
63bb079760
|
feat(library): add configurable bookshelves (#6329)
* feat(library): add configurable bookshelves and migrate preferences * fix(bookshelves): harden offline persistence and replica sync * fix(library): refine bookshelf editing layout and selection * i18n: translate bookshelf management across all locales * docs: document bookshelf behavior and review fixes * docs: clarify missing values in bookshelf filters * fix(bookshelves): address CI and sync review feedback |
||
|
|
730f68a6c1
|
fix(abs): stream audiobook tracks through a loopback media proxy so self-signed servers play (#6216) (#6268)
* fix(abs): add a loopback media proxy that streams with the API client's TLS policy The ABS API client fetches through tauri-plugin-http with invalid certificates accepted, but the WebView's <audio> element enforces platform TLS trust, so a self-signed server syncs and then fails every track request in the handshake (#6216). A custom URI scheme cannot bridge this on Android (the WebView re-applies Range offsets to intercepted bodies and scheme responses are buffered whole), so this is a hyper server on 127.0.0.1 started lazily by the new get_media_proxy_base command: GET /<per-launch secret>/media?u=<track url> forwards Range, fetches with the same lenient reqwest policy, copies the content headers and streams the body. Wrong secret 404, non-http(s) or credentialed targets 400, non-GET 405, unreachable upstream 502, with Rust log lines (host and path only, never the token query) for upstream failures. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(abs): play audiobooks and paired tracks through the media proxy on native (#6216) openAudiobookSession resolves track URLs through the loopback media proxy on Tauri (null on the web and on iOS, whose AVPlayer clocks take the direct URL), with the server's current token still inside the wrapped upstream URL. The paired read-along tracks (absNarrationTracks via TTSController.resolveTracks) and the pairing wizard preview take the same base, so a self-signed Audiobookshelf server that synced also plays. getMediaProxyBase memoizes the command result for the session and degrades to direct streaming, retrying on the next open, if the proxy fails to start. Verified on a Xiaomi against a self-signed HTTPS reverse proxy: the player opens playing with no "Playback interrupted" toast, the upstream sees 206 range requests, seeks and chapter skips across files work. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * docs(memory): record the #6216 media proxy investigation Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * docs(agents): PR review workflow rule, trusted reviewers, social-engineering guard Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(abs): restrict the media proxy to configured server origins, add timeouts (#6216) Addresses the CodeRabbit and CodeQL review of the loopback media proxy. - SSRF (CWE-918): the proxy now takes a per-session origin allowlist and refuses (403) any u= target whose scheme://host:port is not one of the configured Audiobookshelf servers. The per-launch secret authenticates the caller; the allowlist authorizes the destination, so a leaked secret can no longer relay onto loopback or LAN services. get_media_proxy_base takes the origins and merges them each call, so a server added mid-session registers without restarting the proxy. - The origins come from the in-memory store AND persisted settings, mirroring findABSServerById: the player route opens before the store is hydrated from settings, so reading only the store left the allowlist empty and the proxy refused the just-opened track (Xiaomi-reproduced). - Disable redirects (Policy::none) so a hostile server cannot bounce a request past the allowlist. Bound the wait for a connection (connect_timeout) and for response headers (a 10s timeout around send() returning 504); the response body is never timed out so a long track stream is not cut. - Tighten the PR-review-workflow rule (AGENTS.md + memory) so acting on a review is bounded to verified, in-scope findings. Re-verified on a Xiaomi against a self-signed HTTPS server: 206 file requests across chapters, seeks and chapter skips, no "Playback interrupted" toast; an off-allowlist origin is refused with 403. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
d05fb5338a
|
fix(sync): closing unclosed void tags before XML re-parsing, closes #5271 (#6122)
* chore: update agent memories * chore: update agent memories * fix(sync): closing unclosed void tags before XML re-parsing, closes #5271 * chore(agent): update agent memories * fix(sync): preserve block starts for dropped XPointer whitespace * docs(agent): sanitize support notes and correct review findings |
||
|
|
7c8a0a468a
|
feat: support authenticated web novel imports (#6119)
* feat: reuse browser sessions for authenticated novel imports * fix: preserve Windows domain cookies during session renewal * docs: describe native browser session fetching * fix: keep web novel import progress steady between chapters * fix(test): hold curl overlay until capture assertions finish * fix: address authenticated novel import review findings |
||
|
|
32c42100d0
|
feat(linux): debug the CEF build over CDP, and three fixes it found (#6087)
* feat(linux): debug the CEF build over the DevTools protocol The Linux CEF runtime is Chromium, so the app window is a normal CDP target — the only way to inspect the running desktop app on Linux, since WebKitWebDriver (pnpm tauri:dev:test) drives the wry runtime instead. `READEST_CDP_PORT=9222` passes the port to CEF as `--remote-debugging-port` through the runtime's command-line args. CEF honours that switch straight off argv too, but tauri-plugin-cli parses the same argv for open-with paths and warns about the unknown argument on every launch, so the env var is the supported way in. It works on any CEF build — a packaged .deb or the Flatpak, not just `pnpm tauri:dev:cdp`. scripts/cdp.mjs is the client, dependency-free (node's global fetch and WebSocket): `pnpm cdp <targets|eval|click|screenshot|logs>`. The endpoint listens on loopback only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(desktop): open the first window at 1280x800 macOS has always opened at 1280x800; Windows and Linux opened at 800x600, which is cramped for the library grid and a two-page spread. Give every desktop platform the same default, and clamp it to 90% of the monitor's work area so it cannot open partly off-screen on a 1366x768 laptop — a window whose title bar lands past the bottom edge can be impossible to resize back. An unreported or empty work area keeps the default: a window that is too large stays reachable, one sized from a bogus zero-height screen does not. Only the first launch is affected; later ones restore the saved geometry through tauri_plugin_window_state. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(opds): size the add catalog dialog like the catalog manager The Add/Edit Catalog form took daisyUI's bare `modal-box` default: 512x889 against the 640x756 manager it opens on top of, so it sat narrower than the window behind it and ran 89px off the bottom of a 1280x800 window, putting its Cancel / Add Catalog row out of reach. Both now size from one exported class string, so they cannot drift apart again. `sm:max-h-full sm:max-w-full` is what defeats daisyUI's own max-w-lg and max-height caps; everything is sm:-prefixed, leaving each dialog's mobile treatment alone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(library): stop the native scrollbar flashing before OverlayScrollbars Reloading the library showed the platform scrollbar for ~1.8s and then lost it, shifting the grid 15px sideways as it went. Virtuoso owns the scroller inside the OverlayScrollbars root and gives it `overflow-y: auto` inline, so the native scrollbar paints for as long as OverlayScrollbars' deferred init takes, then vanishes when OS marks that same element `data-overlayscrollbars-viewport="scrollbarHidden ..."`. OverlayScrollbars ships hiding rules for `[data-overlayscrollbars-initialize]`, but that attribute sits on the root we hand it, never on the child that actually scrolls. Extend the same pre-init convention to the scroller child. Keyed on attributes Virtuoso and OS already set, so it also covers the reader sidebar's TOC and book-note lists, and `:not([data-overlayscrollbars])` scopes it to the pre-init window — once OS owns the root, its own viewport styling takes over. It lives in globals.css so it is there at first paint, unlike the overlayscrollbars.css import inside the component chunk. Measured on reload: scroller gutter went 0 -> 15 -> 0 before, and stays 0 throughout after. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(cdp): clear the request timeout so the client exits when it is done Every send() armed a 30s timer and nothing cleared it when the reply arrived. A pending timer keeps node's event loop alive, so `pnpm cdp eval` printed its answer and then sat there until the timer fired — 30.1s for a command whose work took 0.1s. Clear it on reply, and drop the pending entry when it does fire. Measured against a stub CDP endpoint: `eval` went from 30.143s to 0.124s, and a server that never answers still rejects with "timed out" at 30.1s. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
655c72ad5a
|
feat(linux): ship Readest on the tauri CEF runtime (#6074)
* feat(linux): build and ship Readest on the tauri CEF runtime Linux now builds against upstream tauri `feat/cef` (git) and the plugins on plugins-workspace `feat/cef`, while macOS/Windows/mobile keep the readest fork untouched: - `pnpm tauri:cef dev|build` (scripts/tauri-cef.mjs) runs @tauri-apps/cli-cef with `--features cef`, cargo `--no-default-features` and the Linux-only `[patch.crates-io]` in src-tauri/.cargo/cef.toml, swapping the committed Cargo.cef.lock in for the run so Cargo.lock stays in the fork state. - The fork crates are no longer workspace members (a member clashes on `links` with the git copy); the tauri-plugins fork carried no changes and is removed, tauri-plugin-fs comes from crates.io at 2.5.1. - App: `cef = ["tauri/cef"]` (the fork gets a no-op stub), explicit runtime type, `cef_entry_point`, `--no-first-run` for CEF, commands generic over the runtime, xdg-portal dialogs on Linux (rfd's GTK thread crashes CEF), rangefile reads and pointer-driven move/resize on the Linux CEF runtime, Chromium reported in the About dialog, deb/rpm depend on libwebkit2gtk while plugins still pull the wry runtime. - Build-generated permission files are untracked; turso registers `batch`. - CI Linux legs use `pnpm tauri:cef`. Submodules: packages/tauri -> feat/cef-feature-stub, tauri-plugin-turso -> fix/register-batch-command (both need pushing). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(linux): let the CEF wrapper run an unpacked tauri CLI for offline builds Flatpak builds have no network, so `TAURI_CEF_CLI` points scripts/tauri-cef.mjs at an unpacked copy of @tauri-apps/cli-cef instead of `pnpm dlx`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore(linux): take the CEF stack from the readest forks - src-tauri/.cargo/cef.toml: tauri and the plugins now come from the readest forks' feat/cef branches (upstream feat/cef plus the DevTools-close fix in tauri-runtime-cef); Cargo.cef.lock re-resolved against them. - tauri-plugin-turso: point at main, which merged the batch command fix. - CI: STRACE_MODE=0 for the Linux legs so the CEF AppImage bundler (quick-sharun) does not launch the app under Xvfb and hang (#4906). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(linux): make the CEF runtime the default tauri build on Linux `pnpm tauri` now goes through scripts/tauri.mjs (the former tauri-cef.mjs): on Linux its dev, build and bundle commands run the feat/cef tauri CLI with the CEF feature, cargo config and Cargo.cef.lock swap, and every other platform or command passes straight through to @tauri-apps/cli. The separate `tauri:cef` script goes away, so the release and nightly workflows, the local Linux build script and the docs use plain `pnpm tauri build` again. The tauri webdriver harness (scripts/test-tauri.sh) still calls the `tauri` binary directly and keeps the wry runtime on Linux, since tauri-driver needs WebKitWebDriver. Cargo.cef.lock picks up the quick-xml 0.41 bump from main. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore(nix): refresh cargoHash for the reshaped Cargo.lock Dropping the packages/tauri-plugins submodule and the tauri-plugin-fs path patch changed the vendored cargo dependency set, so the Nix fixed-output hash moves to the value the nix-deps-check job reported. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(linux): harden the CEF wrapper and pointer window drag Review follow-ups on the CEF runtime work: - scripts/tauri.mjs parks the wry Cargo.lock in Cargo.lock.wry, created exclusively, so two CEF commands in one checkout cannot swap lockfiles over each other, and a killed run leaves an obvious file to move back. - The CEF runtime alias, entry point and runtime attributes are gated on Linux as well as the `cef` feature; elsewhere the feature is a no-op. - Pointer-driven window move/resize applies the last pointer delta when the button is released before the pending animation frame, and does not start tracking when the button was already released while the window state was being read. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
c6a1901a53
|
fix(reader): move a paired audiobook by audio and decode WebP covers (#5863) (#5865)
* fix(reader): move a paired audiobook by audio and decode WebP covers (#5863) A paired audiobook has chapter-level text timing only, so its narration marks are whole chapters: the Next/Previous Sentence buttons (and the lock screen's seek actions) skipped an entire chapter, and audio chapters that had no EPUB chapter to map to (1.1, 1.2 ...) were never played at all. - An unmapped audio chapter now plays as the tail of the mapped chapter before it in the same file, so the recording is heard in full and the page keeps following it proportionally. - With a chapter-timed recording the transport moves by audio: the small step is the audiobook player's skip (30 seconds forward, 15 back, in recording time whatever the rate) and the large step walks the audiobook's own chapter list, restarting the current chapter on a late backward skip like every audiobook player. The page turns only when the target chapter is narrated by another mapped chapter. The mini player and player sheet swap in the player's glyphs and labels; the media session's seekforward/nexttrack handlers get this for free through forward()/backward(). The skip constants move to the PlaybackSource seam so both players share them. - The Rust cover thumbnailer could not decode WebP covers ("The image format WebP is not supported"): enable the image crate's pure-Rust webp decoder. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore(nix): bump cargoHash for the image-webp crate Cargo.lock gained image-webp with the image crate's webp feature, so the pinned cargo vendor hash went stale and the Nix dependency check failed. New value taken from that check's got: line. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(reader): describe chapter skips over the reachable audiobook chapters narratedAudioChapters leaves out audio before the first mapped chapter of a file, and adjacentAudioChapter never lands there, so the transport walks the reachable chapters rather than the audiobook's whole chapter list. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
a6c61c7364
|
feat(reader): pair an Audiobookshelf audiobook and read along (#5807) (#5856)
* feat(reader): pair an Audiobookshelf audiobook and read along (#5807) Let a reader pair an audiobook that lives on a configured Audiobookshelf server with an EPUB and hear it through the existing Read Aloud player (chapter sync, scrubber, sleep timer, lock screen), streamed from the server instead of copied to the device. Bridges the two halves that already existed: the local audiobook pairing wizard/player and the ABS client and store. An ABS pairing records the server, item and track list on PairedAudiobook.source and is one virtual file on the item's global timeline, because ABS times chapters globally and they routinely span media files. MultiTrackNarrationClock presents those files to MediaOverlayClient as one NarrationClock: a global seek lands on the file holding the position, a file running out rolls into the next, and only the last file's end surfaces as ended. It drives HtmlAudioClock on web and desktop and the existing native player, given track URLs, on mobile, selected through a new resolveTracks source hook. The pairing wizard gains a Choose from Audiobookshelf card when a server is configured, listing the library's live audiobooks. Streamed pairings skip the copy, delete and migrate disk paths, and token URLs are read live per load so a rotated token is picked up. The Android native player learns to stream http(s) track URLs, matching the existing iOS branch. Listening position is not reported back to the server yet; reading progress still syncs through Readest. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(reader): address review on the Audiobookshelf pairing (#5807) - compute the virtual audiobook duration from the maximum global track endpoint instead of the sum, so a gap or overlap between track offsets clamps chapter ends correctly (in both the pairing source and the multi-track clock) - cap a streamed chapter preview to the boundary of the track it starts in, so a chapter crossing into the next file does not run past the clip - wait out an in-flight track load before applying a same-track seek in MultiTrackNarrationClock, so scrubbing while a track is still loading is not overwritten by the load's own start position - url-encode the access token in the streamed media URL - give the Audiobookshelf picker's Back button an e-ink boundary - clarify in the docs that a streamed pairing stores no audio locally while its association metadata stays on the device Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(reader): follow the page through a chapter-only narrated pairing (#5807) Page-following across a page break needs the whole sounding sentence to know where the current page cuts it off. A chapter-only pairing (a local audiobook, or an Audiobookshelf stream) highlights a one-character reading dot instead of a sentence, and the view was handed that one-character range, so pageBreakFraction found nothing off the page and never turned it. The page then only moved when the audio crossed into the next section. The mark now carries the full sounding-sentence cfi alongside the one-character highlight cfi, and the view drives page-following from that range while still positioning the reading dot from the highlight. For synthesized voices and exact Media Overlays the two are the same range, so nothing changes there. Pre-existing since the local audiobook pairing landed (#5754); exact Media Overlay narration was unaffected because it reports the full par range. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
6834ee42ef
|
fix(stats): survive PostgREST's row cap when building archive segments (#5844)
* fix(stats): survive PostgREST's row cap when building archive segments stat_archive_rows is called through PostgREST, which caps every response at db-max-rows (1000 on Supabase). The LIMIT 10000 never survived the wire, so segments silently held 1000 rows, and the truncation could cut inside a run of rows sharing one updated_at (a push chunk shares one now()): the commit's range delete then removed rows that were never archived, surfacing as commit_mismatches during validation. Migration 021 makes the pair loss-proof under any proxy truncation: stat_archive_rows trims the trailing millisecond unless the page provably holds every row of it (whole-millisecond extension only for the single-millisecond page), so every result ends at a complete millisecond; and stat_archive_commit refuses with P0001, rolling back the manifest insert and the delete, when the range's delete count differs from the declared segment row count. The compact route now assembles each segment from sub-pages of at most 1000 rows, advancing p_from per sub-page until STATS_COMPACT_SEGMENT_ROWS or a drained user (only an empty page means drained; a short page can just mean the trailing millisecond was trimmed), writing one object and one commit per assembled segment, and counting a refused commit as a mismatch plus an error. The verification script applies 021 and asserts the trim, the equal-timestamp run, the covered-millisecond keep, the single-millisecond extension and the refusal rollback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(stats): keyset-paginate archive rows so no proxy row cap can wedge or lose data Review found the remaining hole in the trim design: a millisecond holding more rows than db-max-rows made the single-millisecond fallback return more than p_limit, PostgREST truncated it to the same first 1000 rows every time, the cursor stopped advancing and the sub-page loop repeated the identical page forever (or, cut differently, produced a refused commit). A restore can create such a millisecond: it re-inserts 500-row chunks, each stamping one now(). stat_archive_rows is now a plain keyset pager over (updated_at, book_hash, page, start_time) with three tie-cursor parameters (the 020 signature is dropped). Keyset pages are truncation-proof by construction: any cap only shortens a page, the cursor comes from rows actually received, and the tie columns paginate inside a millisecond of any size. The compaction route owns the boundary policy: assemble pages until the segment target plus a complete millisecond to cut at (or a drained user), trim the trailing millisecond unless it is provably closed (drained and ended at least 60 s before the window cutoff), defer a user whose only eligible rows sit in a still-fresh millisecond, and hard-stop a pathological millisecond beyond 50k rows. Regression tests: 1001 equal-timestamp rows in one millisecond become one segment with no repeated page and no refused commit; a mid-millisecond target cut trims and the next segment refetches the remainder; a still-fresh millisecond defers the user. The SQL script asserts keyset tiling, the tie-cursor resume inside an equal-timestamp run, and the refusal rollback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
9b33b52a40
|
feat(stats): tier stat_pages history into R2 segments behind a 7-day hot window (#5835)
* feat(stats): tier stat_pages history into R2 segments behind a 7-day hot window
stat_pages is an append-only per-user log of page events merged by longest
duration; the server never reads history for analytics and devices union-merge
everything locally, so keeping the whole history in Postgres is the most
expensive way to store it.
Migration 020 adds a second tier. Postgres keeps a hot window (updated_at
younger than 7 days by default); a cron job (POST /api/stats/compact, driven
by a scheduled() handler in a custom OpenNext worker entry) compacts older
rows per user into immutable JSON segments in R2, listed in the stat_archives
manifest. The commit RPC inserts the manifest row and deletes exactly the
archived (from, to] range in one transaction, compare-and-set on the user's
archived_to under a per-user advisory lock; segments never split a
millisecond, and objects are never deleted by the compaction path.
The stats pull composes pages server-side: hot rows are read before the
manifest (a concurrent commit can only duplicate, never lose), then the first
segment that still has rows past the cursor is served (paged, trailing
millisecond completed) or the hot rows; unpaginated pulls get every segment
then hot rows. The sync API, the app and the koplugin are unchanged.
Also: POST /api/stats/restore (rollback, re-inserts a user's segments through
upsert_stat_pages_as and drops the manifest rows; refuses while compaction is
enabled), account deletion removes the user's archive objects before the auth
user, a local PostgreSQL 15 verification script for the migration, and
docs/stats-archive.md. Ships disabled (STATS_COMPACT_ENABLED = "false").
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(stats): record one Analytics Engine point per archive-backed stats pull
Hot-only pulls write nothing; a pull that reads R2 segments writes one point
(indexes ['pull'], blobs ['paged'|'full'], doubles [segments_read, rows,
limit]) to STATS_COMPACT_AE. The share of pulls that reach the archive is the
number that should drive STATS_COMPACT_WINDOW_DAYS; we ship with 7 days.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(stats): targeted compaction run for one user, plus the deployment runbook
POST /api/stats/compact with a JSON body {"user_id"} compacts that user only:
no claiming, the enabled flag is ignored (operator action, usable while the
cron is off) and the batching thresholds are ignored (everything older than
the window is archived). Still token-guarded; malformed ids answer 400. This
is what lets the rollout validate on a known account in production before the
cron is enabled, and drain one heavy user by hand.
docs/stats-archive.md gains the step-by-step deployment guide: migration
check queries, bucket and secret creation, disabled deploy and its checks,
validation on one account (targeted run, manifest/object checks, fresh pull
on a device or through the API, optional restore), enabling the cron, the
Analytics Engine and Postgres checks to watch, the post-drain REINDEX, and
the window revisit.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(stats): address review on the archive tier
- Account deletion: delete the identity first, then queue the user id in a
new service-role-only stat_archive_orphans table and delete the R2 prefix
best-effort; batch compaction runs sweep the queue (kill switch on or off)
until each prefix lists empty. Deleting objects before a failed deleteUser
would have left an active account with its history gone.
- stat_archive_state and stat_archive_orphans: RLS enabled and privileges
revoked from PUBLIC/anon/authenticated so PostgREST does not expose them;
the verify script asserts relrowsecurity on all three tables and that
anon/authenticated cannot read the service-role-only ones.
- Compact route: only an empty body is the cron's batch request; every other
body must be a valid {user_id} targeted request or it is a 400, so a typo
never starts a batch run. Guard: 503 (no token/bucket), 401, then the
kill switch, applied by the route after the orphan sweep.
- Paged stats pull fills a page across tiers: segments are read lazily until
they fill the page, short archive pages are topped up with hot rows and
the page is cut at limit with the trailing millisecond kept, so a client
that stops on a short page (the koplugin) never stalls on a tier boundary.
- Restore reads the manifest page by page (PostgREST caps responses at 1000
rows) until it is empty.
- Config knobs reject digit strings beyond the safe integer range.
- worker.ts logs a rejected cron fetch; the [limits] cpu_ms block is dropped
(the job is I/O-bound and the ceiling would apply to every request).
- Tests: PostgREST mocks now apply eq/gt filters and honor range/delete so
the query contract is exercised; rpcMock is cleared between tests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs(stats): refresh the compact route header comment for the reworked guard order
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(stats): address review round 2 on the archive tier
- The stats pull reads the stat_archives manifest in range pages (PostgREST
caps a response at 1000 rows) and appends hot rows only once a short final
page proves no archived rows remain past the cursor; a paged pull stops
fetching manifest pages as soon as its response page is full. A truncated
manifest list could otherwise let a client cursor skip segments. Regression
test with 1001 single-row segments, unpaginated and paged.
- Account deletion writes the stat_archive_orphans tombstone BEFORE anything
destructive and stops with 500 (retryable) if even that fails; a failed
deleteUser compensates the tombstone; the orphan sweep additionally skips,
keeping the row, any queued user that still exists, so a stale tombstone can
never wipe a living account.
- The compaction loop asserts each segment boundary advances past the previous
millisecond before writing the object. stat_archive_rows extends every
segment to the end of its last millisecond, so consecutive segments cannot
share an ms-keyed object name; the assertion turns a future SQL regression
into a loud per-user error instead of a silent object overwrite.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
|
||
|
|
771b152e5b
|
feat(dictionaries): add bundled plugin and Yomitan support (#5764)
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: add bundled dictionary plugins and Yomitan support * fix: serve browser plugin workers with COEP * feat: add portable and batched Yomitan imports * feat: show dictionary import progress * fix: pre-landing review fixes * fix: pre-landing review fixes * fix: pre-landing review fixes * fix: isolate malformed portable dictionary rows * fix: bound and isolate portable plugin results * fix: harden plugin data boundaries * fix: isolate portable dictionary rows * fix: isolate dictionary plugin failures * fix: preserve dictionary rollback targets * fix: guard dictionary generation recovery * docs: document dictionary plugin architecture Co-Authored-By: OpenAI Codex <noreply@openai.com> --------- Co-authored-by: OpenAI Codex <noreply@openai.com> |
||
|
|
9dedaf8042
|
feat(reader): pair local audiobooks with ebooks (#5754)
* feat: pair local audiobooks with ebooks * refactor: use daisyui steps for audiobook pairing * fix(qa): #5741 seek within audiobook tracks * fix: #5741 align audiobook narration with reader location * fix: pre-landing review fixes * fix: pre-landing review fixes * fix: pre-landing review fixes * fix: release audiobook preview listeners * fix: serialize audiobook narration teardown * docs: document local audiobook pairing Co-Authored-By: OpenAI Codex <noreply@openai.com> --------- Co-authored-by: OpenAI Codex <noreply@openai.com> |
||
|
|
7fa3daa19d
|
feat(tts): queue chapter downloads with per-book persistence (#5690)
* feat(tts): queue chapter downloads with per-book persistence Replace the cancel-and-replace download flow with a persistent per-book download queue mirroring the cloud-sync transfer queue (transferStore + transferManager). - ttsDownloadStore: zustand queue of chapter rows (pending/in_progress/ failed) keyed by bookHash:chapterKey, with section-range snapshots so restored rows download without re-resolving the TOC; interrupted runs demote to pending on restore. - ttsDownloadManager: sequential single-slot processor bound to the live TTS session, per-item AbortController, batch priority for Download all, localStorage persistence, and removeBook cleanup on book deletion. - Player sheet: Spotify-style row badges (queued clock, active ring, failed/partial resume arc) and a Download all / Cancel all toggle. - Fixes a race where starting a second download left the first run's teardown resetting the shared progress state, silently stalling every subsequent download until restart. * fix(tts): make offline downloads durable and race-safe Use stable book identities and per-attempt ownership for the persistent queue. Pin explicit downloads in SQLite so cache eviction, cancellation, and restart recovery cannot discard them. * fix(tts): join playback teardown before deleting audio Centralize local-book cleanup in the app service and track controller shutdowns per book. Deletion now waits for active synthesis and cache handles to settle without clobbering replacement reader sessions. * feat(tts): finish persistent offline audio queue controls Key the reader UI by stable book hash, expose pending, active, failed, retry, cancel-all, and clear-all states, and prevent stale refreshes or clear/download races. * docs: document persistent offline audio downloads Co-Authored-By: OpenAI Codex <noreply@openai.com> * fix(i18n): add en plural forms for the Cancel all count key Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Huang Xin <chrox.huang@gmail.com> Co-authored-by: OpenAI Codex <noreply@openai.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
85deb8d357
|
feat(sync): add cloud shelves and safe provider deletion (#5701)
* feat(sync): preserve remote files and sync cloud shelves * docs: document third-party file sync behavior Co-Authored-By: OpenAI Codex <noreply@openai.com> --------- Co-authored-by: OpenAI Codex <noreply@openai.com> |
||
|
|
9b50ceeb9a
|
fix(tts): play Media Overlay narration via native AVPlayer on iOS (#5562)
* fix(tts): play Media Overlay narration via native AVPlayer on iOS HTMLAudioElement is interrupted when TTSMediaBridge claims the app's non-mixable .playback session. Route MO through the shared native playout path (load/seek), and fix voice-switch silence, live rate, Now Playing cover/title, and the Book narration i18n label. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(tts): use bracket access in native narration player tests Satisfy noPropertyAccessFromIndexSignature for the pre-push typecheck. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(tts): rename platform helper to avoid hooks lint false positive Biome treats identifiers starting with use as React hooks. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(tts): keep the media metadata setting and harden native narration Review follow-ups on the iOS Media Overlay playout change. Now Playing metadata goes back through buildTTSMediaMetadata. Hardcoding "title - chapter" left the Update Frequency setting rendered, persisted and completely inert on every platform, and turned chapter mode into one native metadata IPC per sentence. The artwork fixes are kept: the cover is pushed once after bind instead of sending artwork: '' on every speak mark. invalidatePlayback() now pauses the clock before dropping it. It also cancels the handover timer, whose only job is to silence a recording left rolling for the next block, so a voice switch landing inside the handover grace left the narration playing under the engine that took over. Native playback failures now reach JS. Swift observes the continuous item's status and AVPlayerItemFailedToPlayToEndTime and emits an error event, which NativeNarrationPlayer forwards to its error listeners. A staged file that could not be decoded used to leave speak() waiting on a clock that was never going to move: no error, no auto advance, no feedback. Also drop the write-only playoutContinuous flag, tear down the continuous item observers whenever the current item is replaced, await an in-flight start-session in ensureReady(), match NativeAudioPlayer's poll interval, and freeze the extrapolated clock when no item is current. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Huang Xin <chrox.huang@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
35450e965a
|
feat(tts): play a book's own recorded narration (EPUB 3 Media Overlays) (#5480)
* feat(tts): play a book's own recorded narration (EPUB 3 Media Overlays)
Read Aloud always synthesized speech, so a professionally narrated read-along
EPUB was read by a robot voice over a book that came with a human one. Play the
recording instead, keeping the entire existing Read Aloud experience: moving
highlight, page-following, sentence/paragraph skip, scrubber and seek, speed,
sleep timer, lock-screen/CarPlay, and background sessions.
This is the Kindle Immersion Reading / Audible Read & Listen experience built on
the open EPUB standard rather than a store-side pairing of two purchases: no
account, no matching entitlements, any narrated EPUB you own or generate.
The stack already had the two seams this needs. `TTSClient` abstracts where audio
comes from; foliate's `TTS` abstracts how text is cut into marks. Recorded
narration is exactly "a different audio source with a different segmentation", so
`src/services/tts/mediaOverlay/` swaps both and leaves the other ~25 files of the
subsystem untouched:
- `parseSmil.ts` parses SMIL clock values and walks <body>/<seq>/<par>.
- `MediaOverlaySection.ts` resolves each par's text fragment to a DOM Range,
groups pars into blocks by nearest block ancestor, and emits the SSML.
- `MediaOverlayTTS.ts` stands in for foliate's TTS with the same navigation
surface, driven by the par list.
- `MediaOverlayClient.ts` plays clips off one HTMLMediaElement, emitting a
boundary as each par becomes audible.
Marks are section-global par ordinals, so marks and audio clips are 1:1 by
construction and there is no text-to-audio matching anywhere in the feature. A
block plays as one continuous span, so a narrated sentence has no seam mid-way.
Selection reuses the Voice picker: the narrator leads the list for books that
carry overlays, and is preselected. `ttsUseNarration` on TTSConfig records the
per-book opt-out, separate from `ttsVoice` because that inherits the global
default. Offline Audio is hidden during narration, since the audio ships inside
the book. Narrated books get a headphones badge in the library, from a
`Book.hasNarration` flag cached at import time.
Highlighting follows the recording exactly rather than interpolating within a
clip, so it cannot drift. Sections the publisher left unnarrated are skipped.
Alignment stays out of scope: a bare MP3 carries no timings and generating them
would mean shipping a speech-recognition model. docs/read-along-narration.md
points at Storyteller for turning an ebook plus its audiobook into a Media
Overlays EPUB, and is honest about the evidence on reading-while-listening: the
comprehension benefit is trivial overall (g=0.18) and only appears when reading
is externally paced, which is why this is a preference and not a prescription.
Two supporting changes:
- `TimelineSentence.duration` carries the exact clip length and outranks the
measured/estimated tiers in SectionTimeline, so a narrated chapter's scrubber
reports the recording's real duration. Deliberately not routed through the
text-keyed cache in ttsDuration.ts, where two identical sentences collide.
- ensureTimeline/supportsPlaybackInfo/getPlaybackInfo now gate on
`TTSCapabilities.mediaClock` instead of comparing against the Edge client.
Verified end to end in a browser against the W3C Moby-Dick MO sample and a
330 MB Storyteller-generated novel: narration selected automatically, unnarrated
front matter skipped, real audio decoded and played at the user's rate with pitch
preserved, boundaries firing per par across block boundaries, the narrated
sentence visibly highlighted, and the scrubber showing the recording's exact
elapsed/remaining time. That pass found four defects no jsdom test could reach:
element-anchored ranges producing a degenerate CFI so the highlight never
painted, typeless container blobs failing to decode, five concurrent loads of the
same audio file revoking each other's URLs, and a WrongDocumentError that killed
the session whenever the first sections were unnarrated. All four are fixed and
covered by regression tests.
It also surfaced a pre-existing hang: WebSpeechClient.init() waited forever for a
'voiceschanged' event on a platform reporting zero speech voices, wedging
TTSController.init() and so blocking every engine, including narration, which
needs no system voice. It now gives up after a timeout.
* fix(tts): let recorded narration play on instead of re-seeking each paragraph
Media Overlay clips are contiguous and in document order, so sequential
narration needs no seeking at all: the element can simply keep rolling while
boundaries are reported as the clock passes each clip.
It was instead seeking to clipBegin at the start of every block, because the
controller drives one speak() per paragraph. Detecting a clip's end by polling
the media clock always lands a few milliseconds PAST clipEnd, so those
milliseconds of the next clip had already been heard; seeking back replayed
them, audible as a stutter on the paragraph's first word ("Me? ... Me?").
Now the playhead only moves for a genuine discontinuity (session start, a
sentence skip, a scrub, a new audio file), decided from the element's own
position rather than from bookkeeping. Measured over a minute of The Player of
Games: one seek, at startup, and none across four paragraph boundaries.
Also stop padding paragraph transitions for a continuous timeline. The new
TTSCapabilities.continuousTimeline says consecutive blocks are one recording,
so the controller's inter-paragraph delay would add silence the narrator never
left and push the highlight behind the voice.
* fix(tts): stop putting a gap between paragraphs of recorded narration
Every paragraph boundary was audible as a hiccup, most obviously on the short
"Me?" that opens a paragraph early in The Player of Games. The recording was
being silenced and restarted at each boundary: the client paused at its block's
last clip, and the controller's pre-speak stop() paused again, ~50ms before the
next block called play(). On Android that also costs a buffer flush.
Silencing the engine between utterances is right for synthesis, where each
utterance is separately rendered audio, and wrong for one continuous recording,
where the next utterance is the same audio playing on. So stop() now takes a
`handover` flag for the stop the controller performs between two utterances of
the same session: a continuous-timeline engine stays rolling through it, and
engines that synthesize per utterance ignore it and stop as before.
The narration client therefore leaves the element playing when a block ends and
lets the next block join it in progress. A watchdog covers the case where no
next block comes (a one-off selection read, or a session torn down without
stopping), so narration can never be left running unattended.
Measured over 80s of The Player of Games, sixteen sentences across five
paragraph boundaries: no seeks, no pauses, and no stall in the media clock.
* fix(tts): read a selection aloud from the recording when a book is narrated
Selecting text and pressing Read Aloud played for about a second and then
stopped the whole session. The selection path builds SSML from the raw selected
text, which is right for a synthesizer but meaningless to the narration client:
its marks are SMIL par ordinals, so raw text matched no clip, the utterance
ended immediately, and the one-shot callback stopped the session.
A recording has no audio for arbitrary text, only the clips the publisher timed,
so reading a selection from one means starting the narration where that passage
is narrated, via the same tts.from(range) used for any other jump. It is an
ordinary session from that point, not a one-shot utterance, so the one-time
callback no longer applies.
* docs(tts): update the narration notes for the playback fixes
The playback fixes changed how the client drives the media element, so the
"how it works" notes described behaviour that no longer exists: it no longer
seeks at the start of every block, and the capability object it reports gained
continuousTimeline. Record both, plus the handover seam on stop(), the two
defects that surfaced only by listening, and the selection-read fix.
* docs(tts): trim the narration notes to what the code needs
Drop two sections that had grown past the point of earning their place in a
feature doc. The reading-while-listening literature review was an argument about
whether the feature is worth having rather than documentation of how it works,
and the defect postmortem duplicated detail the commit messages already carry.
Keeps the paragraph describing the Media Overlays format itself, which is
reference material the rest of the document depends on.
* fix(tts): follow the reading position across a page break inside a sentence
A sentence laid out across a page break left the reader behind: its mark fires
once, on the page it starts on, and a phrase-timed recording reports no words in
between, so the view stayed put while the voice read the tail rendered on the
next page. Measured at 6.5 seconds on one sentence of The Player of Games.
Synthesized engines hide this by following each word.
What a recording does give is how far through the current phrase its audio is,
now exposed as TTSClient.getChunkProgress(). Where the page stops showing the
sentence cannot be assumed — the same sentence breaks at a different word on
another screen, at a larger font size, or in a narrower column — so it is
measured from the live layout: pageBreakFraction bisects the sentence, probing
characters through getTextSubRange, and returns the break as a fraction of the
sentence's text, which is the unit that tracks how long the narrator spends on
it. Bisection is not tidiness — every probe forces a reflow.
The page turns once audio progress passes that fraction, and the fraction is
re-measured after each turn, so a sentence spanning three pages advances one page
at a time. No word position is invented, so the highlight still follows the
recording exactly. Engines without a chunk clock report no progress and keep
their existing behaviour.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(tts): keep the back-to-position prompt down when the view follows the voice
Following the voice onto the next page moves the view past the *start* of the
sentence being read, and that start is what ttsLocation records. Judged on it
alone the reader looks like they navigated away, so the prompt appeared on every
page turn — while they were in fact looking at the words being spoken. Engines
that report words dodge this because their highlight cfi moves with the voice; a
phrase-timed recording has no such cfi.
So ask the layout instead: isSoundingSentenceOnScreen() reports whether any part
of the sentence now sounding is still on the visible page, and the prompt stays
down while it is. Paging away from the sentence entirely still raises it.
Also rename the prompt from "Back to TTS Location" to "Back to Read Aloud",
after the name the feature actually carries in the UI, and drop the "TTS" jargon
from all 33 locales — several of which had been carrying the acronym untranslated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Sacha Lastow <sacha.lastow@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
872e9b54dd
|
fix(android): keep All Files Access on the Play build (#5372) (#2862) (#5378)
The Play release script stripped MANAGE_EXTERNAL_STORAGE from the manifest, and the app gated every shared storage path behind the dist channel to match. On Play builds "Change Data Location" therefore listed only the app private Documents directory, which is the directory the app already uses, so the migration could never start. Keep the permission in the Play build and drop the playstore gates on external directory reads, on the data location shortcuts and on the Save Book Cover toggle. Add a "Choose a folder" entry that opens the system folder picker so any folder can become the data location, not just the presets. The release script now fails when the permission is missing and prints a reminder about the Play Console declaration form; the justification text to paste there lives in docs/google-play-all-files-access.md. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
fe1060845e
|
refactor: rename ColorPanel to ThemePanel (#5042) | ||
|
|
870a62e0e9
|
feat(sentry): upload browser source maps for symbolicated JS crashes (#5027)
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
Production JS crashes report minified chunk names with no source lines, which blocked triaging most reader/TTS Sentry issues. Generate browser source maps for the Tauri export build and upload them right after `next build`: - next.config: productionBrowserSourceMaps for the export build. - scripts/upload-sourcemaps.mjs: sentry-cli injects debug IDs + uploads the maps (release Readest@<version>, ~/_next/static url-prefix), then strips the .map files so they never ship in the app bundle. Token-gated; never fails the build. - CI (release.yml, nightly.yml): pass SENTRY_AUTH_TOKEN / SENTRY_ORG / SENTRY_PROJECT alongside SENTRY_DSN. - docs/sentry-symbolication.md: setup + required secret, and the native (Android ProGuard/.so, iOS dSYM) follow-up. Local and fork builds are unaffected: with no token the maps are stripped and the output is unchanged. Needs the SENTRY_AUTH_TOKEN GitHub secret to take effect. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
c2ac207945
|
refactor(wordlens): rename "Word Wise" to "Word Lens" (#4633)
"Word Wise" is a Kindle trademark, so rename the inline-gloss feature to
"Word Lens" throughout the product.
- User-facing strings → "Word Lens" across all 34 locales; brand translated
for Chinese (zh-CN 单词透镜, zh-TW 單詞透鏡) and German (Word-Lens-Daten).
- Code identifiers: WordWise→WordLens, wordWise→wordLens, WORD_WISE→WORD_LENS.
- Files/dirs: src/services/wordwise→wordlens, WordWisePanel→WordLensPanel,
wordwise{Ruby,Section}.ts, build/sync scripts, test dirs/fixtures,
data/wordwise→data/wordlens.
- Storage paths: CDN base, R2 key, on-device cache dir, WORDLENS_R2_BUCKET env,
pnpm wordlens:{manifest,sync}. manifest.json is path-agnostic so its
sha256/bytes stay valid (verified).
- biome.json: point the formatter-ignore at data/wordlens so the generated
one-line gloss packs aren't pretty-printed on commit.
Migration notes:
- Re-run `pnpm wordlens:sync` to upload packs to cdn.readest.com/wordlens/.
- Persisted view-settings keys renamed (wordWiseEnabled/Level/HintLang and
wordWiseAutoDownload) — saved values reset to defaults once on upgrade.
- Cached packs under the old Data/wordwise/ orphan (harmless re-download).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
||
|
|
480ab5b71e
|
feat(hardcover): automatically sync progress and notes (#4614)
Hardcover sync previously only ran when the user opened the reader menu and tapped "Push Progress" / "Push Notes". Add an opt-in Auto Sync toggle (default OFF) to the Hardcover settings so progress and notes are pushed automatically while reading. - useHardcoverSync: silent debounced (10s) auto-push of progress on page turns and of notes on annotation/excerpt changes, gated on enabled && autoSync === true; pending pushes flush on the existing sync-book-progress close event and cancel on unmount. Manual menu actions are unchanged (still loud). - HardcoverSettings.autoSync flag (default false); existing connected users stay manual until they opt in. - HardcoverForm: new "Auto Sync" toggle row. Also backfills two untranslated strings surfaced by i18n:extract from the reading-stats feature (#4606) across all locales, plus the new "Auto Sync" key. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
35b02c4efc
|
feat(statistics): KOReader-compatible reading stats with cross-device sync (#4606)
Supersedes #3156. Adds a reading-statistics system whose canonical data model is KOReader's own (book + page_stat_data), so stats round-trip losslessly between Readest and KOReader. - Storage: a cross-platform Turso statistics.db in KOReader's exact schema (web/Workers, desktop, iOS, Android) — replacing #3156's Node-only better-sqlite3 + statistics.json. - Tracking: per-page reading events (time-on-page, idle-capped) flushed on page-change/idle/hide/close — the KOReader model — not session aggregates. - Sync: legacy /api/sync extended with a stats type backed by self-contained Supabase tables (stat_books, stat_pages); union/longer-duration-wins merge keyed on book_hash. apps/readest.koplugin syncs through the same endpoint. - Scale & robustness: per-tab singleton connection (avoids OPFS lock conflicts) + explicit WAL checkpoint; transactional bulk apply; chunked resumable push; client-driven paged pull with trailing-ms completion; paginated/scoped server merge. Verified: 5668 unit tests, 155 koplugin busted tests, biome+tsgo + luacheck all green; web OPFS DB verified live. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
4908245042
|
feat(reader): Word Wise inline vocabulary hints (#4589)
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): Word Wise — inline native-language vocabulary hints Kindle-style Word Wise: a short native-language gloss renders above difficult words as you read (always-on ruby), gated by a CEFR vocabulary-level slider (A1–C2); tapping a glossed word opens the existing dictionary. - Pipeline: CEFR→frequency-rank difficulty, inflection-aware gloss index, pure offset-aware planner (EN regex + jieba for CJK). - Rendering: <ruby cfi-skip>…<rt cfi-inert> injected per occurrence — CFI-transparent (verified), so highlights/bookmarks/progress are unaffected; kept out of TTS word offsets and find-in-book. - Delivery: gloss packs are version-controlled in data/wordwise/, mirrored to R2, and downloaded on demand into local storage (sha-verified, single-flight) when enabled. - Settings: a Word Wise sub-page under Settings → Language (enable, level, hint language, per-pack download/manage, auto-download toggle). - Build tooling: scripts/build-wordwise-data.mjs (ECDICT / CC-CEDICT+HSK / WikDict + FrequencyWords, with lemmatization) and scripts/sync-wordwise-r2.mjs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * data(wordwise): bundled gloss packs + manifest + attribution 13 frequency-trimmed gloss packs (en↔中文 + es/fr/de/pt/it/ru↔en, ~19 MB) generated by build-wordwise-data.mjs from ECDICT (MIT), CC-CEDICT + HSK, and WikDict + FrequencyWords (CC-BY-SA). Source of truth, mirrored to the CDN via `pnpm wordwise:sync`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
57501cc520
|
feat(updater): nightly update channel (Android/Windows/macOS/Linux) (#4577)
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 / 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 / rust_lint (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
|
||
|
|
bfb85c2f68
|
feat(reader): sync paragraph mode & speed reader with TTS read-along (#3235) (#4576)
* docs(reader): TTS-sync design spec for paragraph mode + RSVP (#3235) Hardened via brainstorming + /autoplan (CEO/Design/Eng dual-voice review). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(tts): emit canonical tts-position event from TTSController (#3235) Controller emits { cfi, kind, sectionIndex, sequence } alongside the existing tts-highlight-mark/-word events. Monotonic sequence lets downstream consumers (paragraph mode, RSVP — later slices) drop out-of-order positions. Additive; existing events untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(reader): containment+cursor CFI->index mappers for TTS sync (#3235) RSVPController.syncToCfi + setExternallyDriven: containment match (fixes mid-token skip), monotonic cursor + binary search (avoids O(N)-per-word jank, no per-word getCFI), -1/no-op on no match (no silent jump to word 0), timer suspension while externally driven. ParagraphIterator.findIndexByRange: hinted + binary-search containment mapper returning -1 on no match (never first()). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(tts): forward tts-position + tts-playback-state onto the app bus (#3235) useTTSControl republishes the controller's canonical tts-position (tagged with bookKey) via a dedicated listener — NOT inside the suppression-gated highlight handlers, so page-follow suppression can't silently desync the modes. Adds tts-playback-state (playing/paused/stopped) so RSVP can track playback without the hook-local isPlaying. Verified by extending the real-foliate-view browser harness. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(reader): paragraph mode follows TTS playback (#3235) When paragraph mode + TTS are both active, the focused paragraph follows the spoken position (sentence granularity, all engines). Section-generation contract (stash cross-section position, apply after the iterator re-inits); sync-focus path that does NOT arm isFocusingRef (avoids the relocate-eaten wrong-section paragraph-0 bug); stale-sequence drop; decouple on manual nav, re-engage on next playing. Start-alignment + visible indicator deferred to later slices. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(rsvp): speed reader follows TTS playback (#3235) Edge word-boundary voices: RSVP shows the spoken word via syncToCfi. Non-Edge (sentence-only) voices: sentence-paced estimator (clamp 60..600 wpm from voice rate, hold at +60 words cap, snap to first word on each new sentence mark). RSVP auto-advance suspended while TTS-driven. Decouple on manual nav via a rsvp-manual-nav signal; re-engage on next playing. Cross-section positions re-extract then apply. Pure decideRsvpTtsPosition helper unit-tested. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(reader): fixed-layout gate + ttsSyncStatus for TTS sync (#3235) Gate sync to reflowable books (D7): fixed-layout reports 'unsupported' and never engages. Both modes expose ttsSyncStatus (idle/following/syncing/ decoupled/unsupported) as the data source for the upcoming indicator. RSVPControl now forwardRef-exposes the status via an imperative handle. Cross-bookKey events ignored (regression-tested). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(reader): 'following audio' indicator for TTS sync (#3235) 5-state pill (following/syncing/decoupled, idle+unsupported render null) shown top-center in the paragraph overlay and as a status row in the RSVP overlay. Decoupled state is the tap-to-resume control; first decouple fires a one-time toast. eink-bordered, glyph+text (no color-only), RTL logical props, touch targets, safe-area top inset. RSVP 'plain' variant matches its themed surface; non-Edge shows '· estimated'. New i18n keys need extraction before merge. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(rsvp): in-overlay TTS toggle + audio-paced speed control (#3235) Voice-glyph audio toggle in the RSVP control row (trailing, by the gear) starts/ stops read-along from inside the full-screen overlay, start-aligned to the current word (range validated against the live doc). While TTS-driven, the WPM control shows a locked 'Audio pace' affordance that opens a compact rate picker; rate changes go through a new tts-set-rate bus event reusing the existing throttled setRate path. Pure buildRsvpTtsSpeakDetail helper unit-tested. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(reader): e2e paragraph mode follows TTS across a section boundary (#3235) Real <foliate-view> browser e2e: with paragraph mode active, the focused paragraph follows the TTS walk and re-targets to the new section after a Ch4->Ch5 boundary (proves no stuck wrong-section paragraph-0 / isFocusingRef trap). Asserts on the owning section of the current range. Test-only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * i18n(reader): translate TTS-sync strings across 33 locales (#3235) Following audio / · estimated / Resume audio / Stopped following audio / Play audio / Pause audio / Audio pace / Speed follows audio. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(reader): resolve TTS CFI anchors across iframe realms (#3235) RSVP and paragraph follow silently failed to track the spoken word: the CFI anchor from view.resolveCFI(...).anchor(doc) is a Range created in the book iframe's realm, so 'anchor instanceof Range' (top realm) was always false (cross-realm instanceof) -> resolveCfiToRange/applySyncCfi returned null -> syncToCfi never advanced. Add isRangeLike() duck-type (cloneRange is unique to Range) and use it at all 4 CFI-resolution sites. Confirmed live via CDP: before = syncToCfi false (frozen); after = exact word map + RSVP follows Edge TTS at ~171 wpm (audio pace). Unit tests reproduce the cross-realm anchor (jsdom is single-realm so the old code passed there but died in the app). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(rsvp): stop estimator/word fight + map transport to TTS play/pause (#3235) Two read-along refinements (verified live via CDP with Edge TTS): 1. No more jump-ahead-then-snap-back flashing. Word-boundary engines (Edge) emit BOTH sentence marks and word boundaries; RSVP was routing sentence -> the estimator (self-paces ~190xrate, up to +60 words ahead) while word positions snapped it back. Now once a word position is seen, sentence positions are ignored and any running estimator is stopped, so words alone drive RSVP. 2. The RSVP transport (center play/pause, Space, center-tap) maps to TTS play/pause while read-along is engaged (tts-toggle-play), instead of RSVP's own suspended timer. Pausing TTS keeps RSVP suspended (no runaway); a full stop releases it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(rsvp): keep indicator on pause + reach dict management from RSVP (#3235) - Pausing read-along no longer dismisses the 'following audio' indicator / 'Audio pace' lock (layout shift). New 'paused' sync status keeps the indicator row and WPM lock present while TTS is engaged-but-paused; only a full stop clears them. Verified live via CDP: pause keeps the layout, no shift. - Dict management is reachable from RSVP: the settings dialog is z-50, far below the full-screen RSVP overlay (z-[10000]), so it opened invisibly behind it. handleManageDictionary now exits RSVP first (position saved/resumable) so management shows over the reader. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(rsvp): show dict management over RSVP instead of exiting it (#3235) Per feedback: opening dictionary management from the RSVP lookup popup no longer closes the speed reader. The settings dialog is raised above the full-screen RSVP overlay (z-[10000] -> SettingsDialog !z-[10050]) so it shows on top, and RSVP's capture-phase keyboard handler bails while the settings dialog is open so its inputs accept Space and Escape closes settings (not RSVP). Verified live via CDP: management opens over RSVP, RSVP stays active behind it, Escape returns to it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(dict): only apply drag-handle margin compensation when the handle shows (#3235) The dictionary sheet header used -mt-4 to compensate for Dialog's drag handle, but that handle is sm:hidden (shown only below sm). On sm+ the handle is display:none, so -mt-4 pulled the header up into the top edge (broken layout when the lookup renders as a sheet on a short/wide window). Mirror the handle's breakpoint: -mt-4 sm:mt-0. Verified live via CDP. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(reader): in-mode TTS audio toggle for paragraph mode (#3235) Paragraph mode already follows TTS, but there was no way to start read-along from inside it. Add an audio toggle to the ParagraphBar (mirroring RSVP's): it starts TTS start-aligned to the focused paragraph (range validated live, + section index) and stops it. Track session-active vs playing so a pause keeps the indicator ('paused' status) instead of collapsing to idle. Pure buildParagraphTtsSpeakDetail helper unit-tested. Verified live via CDP: tapping the icon starts audio from the focused paragraph and the focus follows speech. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(reader): highlight current TTS word/sentence in paragraph mode (#3235) Paragraph mode follows TTS by advancing the focused paragraph, but the spoken word wasn't highlighted within it like normal mode. The overlay renders a CLONE of the paragraph, so the iframe's TTS highlight isn't visible there — reproduce it on the clone with the CSS Custom Highlight API (no DOM mutation, spans inline boundaries natively, leaves the fade-in animation untouched). - TTSController already tags tts-position with kind word|sentence. The hook decides granularity: word boundaries (Edge) drive a per-word highlight; once seen, the coarse sentence event is skipped so the whole sentence doesn't flicker over the current word. Engines without word boundaries (WebSpeech/Native) fall back to the sentence highlight. - Offsets are computed relative to the paragraph start (so they map 1:1 onto the clone's text) and tagged with the paragraph index so a stale highlight never paints the wrong paragraph. Cleared on stop / section change / disabled. - The ::highlight() style mirrors the user's ttsHighlightOptions color+style. Pure helpers (offset math, word/sentence decision, css builder) unit-tested. Verified live via CDP: word highlight tracks Edge word-by-word and follows across paragraph boundaries (news -> ... -> ladies), matching the TTS color. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
67c22c770b
|
feat(reader): Share intent + customizable annotation toolbar (#4014) (#4570)
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_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
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
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
* docs(spec): annotation Share tool + customizable toolbar (#4014) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(plan): implementation plan for Share tool + customizable toolbar (#4014) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(annotator): add 'share' annotation tool type and button (#4014) * feat(annotator): add pure toolbar order/visibility helpers (#4014) * feat(annotator): add annotationToolbarItems view setting (#4014) * feat(annotator): add shareSelectedText ladder helper (#4014) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(annotator): render Share tool and honor toolbar order in selection popup (#4014) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(settings): add drag-and-drop annotation toolbar customizer (#4014) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(settings): open the toolbar customizer from the Behavior panel (#4014) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore(i18n): extract and translate annotation share/toolbar strings (#4014) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(annotator): extract canShareText helper, preserve hidden Share on cross-platform edit (#4014) Addresses final-review findings: de-duplicate the triplicated canShare definition into share.ts::canShareText, trim ShareCapableService to the fields actually read, and stop the toolbar customizer from dropping a synced 'share' tool when edited on a non-share-capable device. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(settings): WYSIWYG drag-and-drop toolbar customizer (#4014) Rework the customizer per live testing: - Render 'In toolbar' as a faithful, content-width, start-aligned preview of the real selection popup (gray bar, icon-only buttons); 'Available' tools show as labeled chips. - Multi-container dnd-kit pattern: in-place dragging (no DragOverlay, which a transformed modal offsets), pointerWithin collision so empty zones accept drops, live onDragOver reparent, itemsRef to dodge dnd-kit's drag-start handler-capture stale closure. - Add 'Add all' (canonical predefined order) and 'Clear all' shortcuts. - Align zone labels with the SubPageHeader breadcrumb. - Empty toolbar now suppresses the selection popup entirely (no empty bar), while still allowing highlight-edit/notes popups. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore(i18n): translate Add all / Clear all toolbar shortcuts (#4014) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(annotator): size selection popup to visible tool count (#4014) With the customizable toolbar a fixed-width popup looked sparse for a 2-3 tool toolbar (buttons spread to the corners). Size the popup to the number of visible tools (responsive) capped at the previous max; annotated selections keep the max width since they show highlight options / notes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(settings): reword empty-toolbar hint to 'No tools, drag one here' (#4014) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(annotator): render default tools (not Share) in popup layout screenshot (#4014) The visual regression test rendered every annotationToolButtons entry, so adding the Share tool shifted the toolbar to 9 buttons and broke the baselines. Share is hidden by default (added via Customize Toolbar), so the popup screenshot should mirror the default-enabled set — filter to DEFAULT_ANNOTATION_TOOLBAR_ITEMS, keeping the existing baselines valid. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
cfe2bb9116
|
fix(reader): Android text selection breaks on the first word of hyphenated paragraphs (#4545)
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 (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
|
||
|
|
ef603852b7
|
feat(tts): hotkey to highlight the currently-spoken sentence (#4085) (#4368)
Add a "Highlight Current Sentence" keyboard action (default Shift+M, in the Text to Speech shortcut section) that persists the sentence TTS is reading aloud as a normal highlight using the user's default style/color — no text selection, eyes-off, silent, and idempotent (a repeat press on the same sentence is a no-op rather than a duplicate). Flow: the shortcut handler in useBookShortcuts dispatches tts-highlight-sentence → useTTSControl (which owns the TTSController) resolves the current sentence via the new TTSController.getSpokenSentence() and relays create-tts-highlight → Annotator builds the BookNote with the pure, unit-tested buildTTSSentenceHighlight helper and persists/renders it like any other highlight. Closes #4085 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
f1ae050768
|
fix(ui): refine reader side panels and their empty states (#4361)
* docs(agent): add agent notes for cache, reading-ruler, foliate touch Add project-memory notes and index entries: - manage-cache-ios-layout: iOS container layout and what Manage Cache clears - reading-ruler-line-aware: line/column-aware reading ruler internals - foliate-touch-listener-capture-phase: capture-phase gesture suppression Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(reader): pad sidebar and notebook for the device status bar (#4089) Top-anchored slide-in panels (sidebar, notebook) only applied status-bar top padding when isFullHeightInMobile was true. On a tablet/desktop (isMobile === false) that gate collapsed the padding to 0, so a visible system status bar overlapped the panel's top toolbar and made its icons inaccessible. Extract the inset math into getPanelTopInset() and gate it on (!isMobile || isFullHeightInMobile) so non-mobile panels clear the status bar like the reader header, while a partial-height mobile bottom sheet (which doesn't reach the top of the screen) stays flush. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(reader): keep footer bar clear of the pinned sidebar On a mobile tablet in portrait, forceMobileLayout renders the footer bar with position: fixed, anchored to the viewport, so left-0 w-full spans the whole window and slides under a pinned sidebar — the progress / font / TTS controls end up obscured. Anchor the footer inside the book's grid cell (position: absolute) when the sidebar is pinned, mirroring the header bar. The flex layout already offsets the grid cell by the sidebar's real rendered width, which honors the sidebar's min-w-60 floor and 45% cap that a stored-width offset would miss. The slide-up panels are absolute within the footer container, so they shift and narrow with it and their animation is unchanged. The switch only happens when the sidebar is pinned, so phone (< 640px) and unpinned tablet-portrait class names stay identical. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(ui): refine reader side panels and their empty states Closes #4089 Add a shared EmptyState component (large muted icon, title, and an optional hint or action) and use it for the empty annotations, bookmarks, and notes panels in the sidebar and notebook, replacing the ad-hoc "No … yet" placeholders. Polish the surrounding chrome: switch the bookmark toggler to the Ri icon set with responsive sizing, crop the HighlighterIcon viewBox to its artwork to remove the asymmetric bottom padding, and tune mobile sizing and spacing across the panel headers, tab navigation, and footer nav bar. Translate the new empty-state strings (No Notes, No Annotations, No Bookmarks, and their hints/action) across all 33 locales and drop the obsolete "No … yet" keys. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
789d031222
|
feat(reader): line-aware reading ruler (#4358)
Snap the reading ruler to real rendered text lines instead of stepping by a fixed arithmetic height, so the band always frames whole lines. - Snap to actual line geometry from the relocate range; the band is sized dynamically to the text block plus symmetric padding (round(fontSize * lineHeight * 0.3)), capped at (lines + 1) line heights so a tall image inside a block can't expand it to cover the whole figure. - Drop block/container rects (Range.getClientRects aggregates multi-line element borders) so paragraphs aren't merged into one giant line and skipped. - Column-aware in multi-column layouts: the band spans one column at a time and advances column by column. - Confine the band to lines at least half visible within the viewport. - Scrolled mode: snap to lines, and at a view edge scroll the view and realign the band to the start/end of the new view (works for vertical-rl too, which scrolls horizontally); paging snaps the view edge between lines so text isn't cut or repeated. - Vertical writing mode: correct band centering and drag direction; Up/Down keys move the ruler while Left/Right turn pages (taps always move the ruler). - Page turns keep the first/last line: forward lands on the first line of the new page, backward on the last line; the relayout re-snap anchors on the band's leading edge so it never skips a line. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
36e11de332
|
feat(reader): swipe-to-adjust brightness gesture on mobile (#3021) (#4356)
* docs: design spec for gesture-based brightness control (#3021) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: revise brightness-gesture spec per /autoplan review (#3021) CEO+Design+Eng dual-voice review. Key fixes: capture-phase listener (bubble-phase could not suppress foliate paginator), opt-out toggle, 18px threshold, selection guard, brightness seed race, rAF teardown, e-ink stepped overlay, contrast capsule, perceptual curve reuse, listener-level test harness. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(reader): swipe-to-adjust brightness gesture on mobile (#3021) Left-edge vertical swipe adjusts screen brightness on iOS/Android, with a Sun-icon progress overlay. Capture-phase non-passive listener suppresses the foliate paginator / page-flip / UI-toggle handlers; selection guard, strip reservation in scrolled mode, eager brightness seed, rAF throttle + teardown. Opt-out toggle in Settings > Behavior > Device (default on). Perceptual curve shared with the menu slider. Pure-helper + listener-level tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(reader): detect brightness-swipe edge by screenX; i18n + shorter label (#3021) On-device fix: paginated mode lays the iframe doc out as wide side-by-side columns, so clientX/documentElement.clientWidth are document coordinates and a left-edge touch on a later page never fell inside the strip (armed stayed false). Detect with screenX against the parent window width, matching usePagination. Also: translate the two new setting strings across all locales and shorten the toggle description to 'Slide along the left edge'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
60203a8dc3
|
docs: add architecture and code-layout guides (#4265)
Add two complementary English documents under apps/readest-app/docs/ to help new contributors ramp up on the Readest codebase: - code-layout.md: directory-level inventory of the monorepo, covering apps/readest-app, packages/, the Tauri native shell, workers, and the conventions used for stores, services, and components. - architecture.md: high-level architecture with Mermaid diagrams. Maps the three runtimes (browser webview, Tauri Rust host, Next.js server), the dual API routers (pages/api legacy + app/api), Zustand stores, AppService / DatabaseService abstraction with its three backing implementations, foliate-js / pdfjs / simplecc / jieba integration, and cross-cutting subsystems (sync, cloud library, AI/RAG, translation, TTS, dictionaries, OPDS, Hardcover/Readwise, annotations, Send to Readest). Also documents the COOP/COEP middleware, allow_paths_in_scopes security gate, and the runtime re-config trick used for the single-image Docker deploy. No code changes; documentation only. |
||
|
|
0fba5b7054
|
feat(config): version book config schema (#4208) |