mirror of
https://github.com/readest/readest.git
synced 2026-11-29 19:02:28 +00:00
12 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4023867745
|
test(kosync): check both xpointer forms against crengine at two DOM versions (#7178)
crengine 137cba4 writes [1] on every step only for books opened at DOM version 20260812 or later. Books KOReader opened before keep their older version and the unindexed form, so both forms stay in use. The oracle script takes the DOM version as a fourth argument and checks that crengine reads each pointer the same with its [1]s dropped, the form Readest writes. New fixtures for the four oracle books were dumped from the KOReader emulator with 137cba4 cherry-picked, at 20260812. The 20240114 dumps from the same build match the committed fixtures exactly. The EPUB oracle now pulls through getCFIFromXPointerRange, the path the sync hooks use. Verified: - oracle test with this PR's xcfi.ts: 8 passed - with main's xcfi.ts: the 4 new fixtures fail "KOReader -> Readest: 707/707, 108/108, 19/19, 160/160 mismatches"; the 4 old ones pass - unindexed_mismatches is empty in every new fixture - xcfi and kosyncProgress suites: 98 passed; pnpm lint and pnpm format:check clean Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
8005ff9af6
|
fix(kosync): send and read MOBI positions in crengine's HTML form (#6951)
* fix(kosync): send and read MOBI positions in crengine's HTML form
KOReader reads a MOBI book (the Mobipocket format, not KF8) with crengine
as one HTML document, so its positions look like
/html/body/body/div[8]/p[152]/text().596, with top-level elements numbered
across the whole book. foliate splits the same book into a section at each
<mbp:pagebreak>. Readest rejected KOReader's pointers ("Unsupported format
for spine index extraction"), so the Readest app showed "Sync failed" after
the KOReader plugin pushed, and it sent KOReader an EPUB-style
/body/DocFragment[N]/body/... pointer that crengine can't resolve, so
KOReader stayed put.
xcfi now maps MOBI both ways: the section is found by counting each
top-level tag across sections, the empty <a id="fileposN"> anchors foliate
adds are skipped, and the root is /html/body/body when a <guide> in <head>
made crengine open a body of its own (checked against crengine with HTML
files with and without one). A book foliate opens as KF8 keeps the
DocFragment form; crengine doesn't read KF8. isXPointerProgress accepts
/html pointers for KOSync.
Verified against crengine itself: xpointer-oracle.lua (now MOBI-aware) run
in the KOReader emulator on the reporter's book; 499 of its words convert
both ways exactly as crengine writes them, and 720 sampled words of
sample-war-peace.mobi (a flat calibre-style MOBI) too. A 160-word War and
Peace oracle is committed. Without the change the oracle test fails with
"KOReader -> Readest: 160/160 mismatches ... Unsupported format for spine
index extraction", xcfi.mobi.test.ts fails with "expected
'/body/DocFragment[2]/body/p[2]/font[1…' to be
'/html/body/body/p[3]/font[1]/text().0'", and kosyncProgress.test.ts fails
with "expected false to be true". Related xcfi, KOSync, progress and notes
sync suites pass (25 files, 286 tests); pnpm lint and pnpm format:check
pass. Not run: a sync round trip with the KOReader plugin on a device, and
a combined MOBI/KF8 file (foliate reads its KF8 part, crengine its MOBI
part, so those positions still can't be mapped).
Reported by D-Everden on GitHub.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(kosync): give the MOBI XPointer test room to open the 2.7 MB book
Opening sample-war-peace.mobi takes about 2.8 s on its own, so the
default 5 s timeout tripped under the full suite in the pre-push hook.
The crengine oracle test, which opens the same book, already allows
120 s; this one now allows 30 s.
Verified: the file passes alone (2 tests); the hook run that failed
with "Test timed out in 5000ms" is retried with this commit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf(kosync): parse MOBI sections one at a time for the layout pass
CodeRabbit on #6951: Promise.all kept every parsed section document
alive until all were counted. Each is now parsed, counted and dropped
before the next. Counts and the guide check are unchanged; the xcfi,
crengine oracle and KOSync suites (7 files, 45 tests) pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
2d37bbfc2e
|
fix(kosync): send and read FB2 positions in crengine's FictionBook form (#6905)
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
* fix(kosync): send and read FB2 positions in crengine's FictionBook form Readest sent KOReader an EPUB-style /body/DocFragment[N]/body/... XPointer for FB2 books. crengine reads FB2 natively and builds no DocFragments, so it couldn't resolve the pointer and KOReader went to the cover. The other direction rejected KOReader's /FictionBook/... pointers and fell back to the percentage. xcfi now maps FB2 both ways: foliate's section for each child of the first <body> (image, title, epigraph, section) to /FictionBook/body[1]/<tag>[N], counted per tag the way crengine does, each notes body to body[N], and foliate's renamed elements back to their FB2 tags (kept as each element's first class). The push sites (KOSync, Readest progress and notes sync, BookOrbit notes) pass the book format; range note pulls go through the new getCFIFromXPointerRange so FB2 highlights from KOReader resolve too. isXPointerProgress accepts /FictionBook pointers. Verified against crengine itself: xpointer-oracle.lua (now FB2-aware) run in the KOReader emulator on a new FB2 fixture dumped all 108 visible words; xcfi.crengine-oracle.test.ts converts every word both ways exactly as crengine writes it. Without the change xcfi.fb2.test.ts fails with "expected '/body/DocFragment[4]/body/section/p[1]/text().4' to be '/FictionBook/body[1]/section[1]/p[1]/text().4'", the notes-body pull throws "Unsupported format for spine index extraction", and kosyncProgress.test.ts fails with "expected false to be true". Related xcfi, KOSync, progress, notes and BookOrbit suites pass (333 tests); pnpm lint passes. Not run: a KOSync round trip on a device, and the reporter's book. Reported by email to support. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(kosync): cover one-body FB2 books and a leading body-level image CREngine in the KOReader emulator writes /FictionBook/body/... (no index) for an FB2 book with one body, and /FictionBook/body[1]/... when it also has a notes body. Either form resolves in either book. It puts a leading body-level image at /FictionBook/body/image.0. A new one-body fixture (an image and a title before two sections) and its oracle dump (19 words) add the following checks: - every word converts both ways exactly as CREngine writes it; - Readest writes body without an index for the one-body book; - the leading image is /FictionBook/body/image in the one-body book and /FictionBook/body[1]/image in the book with notes; - /FictionBook/body/image.0, /FictionBook/body[1]/image.0 and /FictionBook/body[1]/image[1] open section 0 in both books; - both body forms open the same paragraph in the one-body book. The code already did all of this, so nothing fails on this branch. With the body step forced to body[1], three tests fail, e.g. expected "/FictionBook/body/section[2]/p/text().2", received "/FictionBook/body[1]/section[2]/p/text().2", and the oracle reports "Readest -> KOReader: 19/19 mismatches". Related xcfi, KOSync, progress, notes and BookOrbit suites pass (164 tests), and pnpm lint passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ac42ae5dd4
|
feat(koreader): background sync, group downloads, and library controls (#6321)
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
* feat(koreader): keep sync and group downloads responsive in background * i18n(koreader): translate download controls and add Georgian |
||
|
|
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 |
||
|
|
049ed2cda6
|
fix(koplugin): honour BookDrop goodbyes and un-dangle the localsend pin (#6050)
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
|
||
|
|
b3626c2a15
|
chore(koplugin): build nightly plugin zip and default to device targets (#5699)
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 / rust_lint (push) Waiting to run
PR checks / koplugin_rust_lint (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
- add a build-koreader-plugin job to the nightly workflow that mirrors release.yml and uploads Readest-<version>-1.koplugin.zip to R2 under nightly/<version>/ next to the other nightly artifacts - build-localsend-bins.mjs now builds armv7 + arm64 by default; the macos target is opt-in via --only macos - fix the build-koplugin.mjs usage comment (.js -> .mjs) - update koplugin agent memories: LocalSend receive+send merge status and the Kindle SSH deploy/debug recipe Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
15b446dc75
|
feat(koplugin): LocalSend receive and send for KOReader devices (#5687)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
PR checks / test_web_app (1) (push) Waiting to run
PR checks / 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 (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(koplugin): scaffold localsend-ffi crate with start config Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): port localsend identity into ffi crate Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): add localsend ffi event queue and payloads Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(koplugin): fuse flaky event tests and add comprehensive wire-shape assertions Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): receive-only localsend service in ffi crate Ports the receive side of apps/readest-app/src-tauri/src/localsend/service.rs into the standalone localsend-ffi crate: the HTTPS server plus discovery bind, a staging-dir file pipeline that stages uploads under .localsend-inbox and renames them into download_dir on success, and an event pump that feeds the Task 3 event queue instead of emitting Tauri events. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(koplugin): sanitize peer-supplied file names before writing them handle_file_upload joined the wire-supplied file name straight into the staging and download paths. Protocol v2 allows directory components in that field, so a peer could send a traversal payload or an absolute path and write outside .localsend-inbox / download_dir. Add safe_file_name, which takes the last non-relative path segment and sanitizes it under the crate's strictest Rules::Universal set, falling back to received.bin when nothing safe survives (empty name, "..", or all separators). Use it for both the staging path and the final rename target. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): expose localsend ffi c abi with smoke test Adds the poll-based C ABI for KOReader's LuaJIT FFI: ls_version, ls_start, ls_stop, ls_status, ls_poll_event, ls_accept, ls_decline, and ls_string_free, all wrapped in catch_unwind with poison-safe locking around a process-global service handle. Adds an ignored smoke test that binds real ports and confirms a started event and running status. ls_string_free is marked unsafe extern C to satisfy clippy's not_unsafe_ptr_arg_deref lint; this only affects Rust-side callers, the exported C symbol is unchanged. Running cargo fmt with default settings also reformatted events.rs and identity.rs from earlier tasks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(koplugin): serialize event-queue tests and cover ffi idempotency Adds a test-only TEST_QUEUE_GUARD mutex in events.rs so event_queue_contract and ffi_surface_contract cannot interleave their clear/push/pop calls on the process-global EVENTS queue when the test runner uses parallel threads. Extends the ignored smoke test with assertions that a second ls_start while already running returns OK and leaves the service running, and that a second ls_stop after a real stop also returns OK, since neither idempotency contract had test coverage before. Also tightens the crate doc comment and ls_string_free's Safety doc to call out that ls_version's return value is a static string and must never be passed to ls_string_free. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): add localsend native lib build script Builds the LocalSend FFI crate into apps/readest.koplugin/libs/ for the KOReader plugin. Supports arm64-mac (plain cargo build, verified on this host) and armv7 (Kindle, via cargo-zigbuild, wired up in Task 7). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(koplugin): pin kindle glibc floor for armv7 localsend lib Empirically verified the kindle userland glibc floor against the koreader-kindle-v2026.07.1.zip release: every shipped .so and native binary tops out at GLIBC_2.12 (koreader/libs/libzmq.so.5), lower than the previously assumed 2.19, so lower KINDLE_GLIBC to match. Also fix the cargo-zigbuild availability check, which always failed because cargo forwards "zigbuild" as the subcommand name and that subcommand rejects --version; probe the cargo-zigbuild binary directly instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): localsend ffi loader with arch-keyed lib table Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): localsend receive service module with poll loop Adds readest_localsend.lua: the module singleton that owns the native LocalSend service lifecycle (start/stop/toggle), polls queued events on a 0.5s UIManager loop, and routes them to per-type handlers (receive request confirmation, file-done library registration, end-of-transfer summary, status text for the settings row). Also adds a ConfirmBox stub to koreader_stubs.lua and requires spec.koreader_stubs from localsend_spec.lua so its stubs (InfoMessage, ConfirmBox, NetworkMgr, UIManager) are registered before the new dispatch spec requires readest_localsend, regardless of spec file load order. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): wire localsend receive into menu and lifecycle Adds localsend_enabled/localsend_alias settings, initializes the readest_localsend singleton in init(), adds a toggle + status menu entry after Pull books now, forwards network connect/disconnect and suspend events to the service, and unschedules its poll task on onCloseWidget. addToReadest and _addLocalRow now take an opts table with a silent flag that suppresses every InfoMessage on that path, so LocalSend's onReceiveFileDone can register received files without popping messages over the transfer dialog. The default no-opts call path is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): bundle localsend libs in plugin zip and release ci Excludes native/ (Rust source) from the koplugin zip in both the local build script and the release workflow, and adds a release CI step that builds the armv7 LocalSend lib before zipping so libs/ ships in published releases. build-koplugin.mjs now warns when libs/ is empty so a local sideload build without prebuilt libs is not silent about losing LocalSend receive. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore(koplugin): extract localsend i18n strings Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): build kobo hard-float localsend lib Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): offer kobo hard-float localsend lib in loader Kobo devices are hard-float armv7 (gnueabihf), distinct from Kindle's soft-float armv7 (gnueabi). Key libNameFor on Device:isKobo() so Kobo loads liblocalsend-armv7hf.so instead of falling through unsupported; Kindle and Kobo are unambiguous device classes, so no try-load fallback is needed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * ci(koplugin): build kobo hard-float localsend lib in release The release workflow only built the Kindle softfp LocalSend lib, so release zips never shipped liblocalsend-armv7hf.so for Kobo devices. Add the armv7hf rustup target and a second build-localsend-libs.mjs invocation to the existing CI step. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(koplugin): start localsend off the ui thread and fix accept race ls_start ran identity keygen and socket bind synchronously on the LuaJIT UI thread, freezing KOReader for several seconds on first run. Move that work to a dedicated OS thread that owns the tokio runtime; ls_start now returns immediately and ls_status gains a starting field so Lua can poll for readiness. ls_stop likewise signals the worker thread and detaches instead of blocking on shutdown. Also fix service::accept registering the receiving session after sending the Accept decision, which could race the first FileUpload against its own session registration. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(koplugin): close identity keygen race and stale-failed start lockout Concurrency review of the previous commit found five reachability issues that only became possible once ls_start stopped blocking: - Two overlapping ls_start workers (e.g. screen sleep mid-keygen then a quick stop/start) could both generate an identity.pem and race on create_new(), leaving the loser stuck on a File exists error instead of adopting the winner's cert. - A failed start left STATE occupied by a dead LiveStatus::Failed entry forever, since ls_start's idempotent re-attach check never distinguished it from a genuinely running service, so retries (e.g. onNetworkConnected) could never restart the service. - service::start ran off the UI thread now but outside catch_unwind, so a panic there would strand the worker with no event and LiveStatus stuck at Starting forever. - The started event was pushed before LiveStatus flipped to Running, so a consumer reacting to it could still see running:false. Also drops the now-redundant Option around Running.stop_tx (state() already guarantees single consumption) and comments the narrow inbox/event-queue overlap window between a detached worker's teardown and the next ls_start. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(koplugin): harden localsend lua lifecycle and add crate ci The started/error event handlers took a first parameter named `_`, shadowing the module-level i18n function of the same name; the error handler crashed uncaught the first time an async ls_start failed. Also stop client-side polling on that failure so a later toggle can retry, restart localsend on device resume, guard the accept dialog against a stray tap dismissing it, normalize an empty download-dir setting, and show a "starting" status during the async keygen/bind window. apps/readest.koplugin/native/localsend-ffi had no PR-time CI at all; add a paths-filtered job mirroring the existing rust_lint job's toolchain setup and update the verification rules to match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): build arm64 linux localsend lib for remarkable Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): offer arm64 linux and remarkable localsend libs in loader Wires liblocalsend-arm64.so and the reMarkable device class into libNameFor: reMarkable 2 (hard-float armv7) maps to the same lib as Kobo, reMarkable Paper Pro and other arm64 Linux e-readers map to the new arm64 .so, and Android arm64 is excluded since its linker namespace forbids dlopen of a plugin-bundled .so. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * ci(koplugin): build arm64 linux localsend lib in release Extend the release workflow's LocalSend native lib build step to also build the arm64-linux target (reMarkable Paper Pro), alongside the existing armv7 and armv7hf targets. build-koplugin.mjs already globs libs/ so it ships the new .so without any change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore(koplugin): extract localsend arm64 and starting i18n strings Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(koplugin): harden localsend against suspend resume keygen races Three defensive fixes for the localsend suspend/resume-during-first-run keygen edge on slow e-readers: - identity.rs: retry the AlreadyExists recovery read a handful of times instead of once, so a loser worker does not fail on a winner's identity.pem write that has not finished landing yet. - lib.rs: spawn the ls_start worker via thread::Builder instead of thread::spawn, so an OS thread-creation failure surfaces as a queued Event::Error and ERR_START instead of a silent ERR_PANIC. - readest_localsend.lua: the error handler now checks ls_status before stopping the service, so a stale error from a superseded overlapping worker cannot tear down an already-healthy service. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): replace localsend ffi cdylib with a helper binary Old Kindles' glibc is missing symbols the precompiled Rust std pulls in as weak (getrandom, statx, clock_gettime64), so the cdylib segfaults on first call. A static-musl subprocess has no glibc dependency and was verified running on that hardware. This step replaces the C ABI with a localsend-helper binary that speaks newline-delimited JSON over a local TCP control socket: a start command plus accept/decline/status/stop, and started/receive_*/error/status events streamed back. lib.rs keeps only the reusable config/events/identity/service modules; the musl cross build, Lua spawn/socket glue, and packaging are follow-up work. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): build static musl localsend helper binaries Rewrite build-localsend-libs.mjs as build-localsend-bins.mjs: it now builds the localsend-helper standalone binary (static musl for armv7/arm64, plain cargo for macos) into apps/readest.koplugin/bin/ instead of the old FFI cdylib into libs/. Static musl has zero glibc dependency and no softfp/hardfloat split, so the four old glibc-pinned targets collapse into three binary targets with the exec bit set on the copied artifact. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): spawn localsend helper binary over a local socket Replace the FFI cdylib transport in the koplugin LocalSend integration (ffi.load + ls_* calls), which crashed on old-glibc Kindles, with the static-musl localsend-helper binary spawned as a background process and driven over a local TCP control socket speaking newline-delimited JSON. library/localsend_ffi.lua becomes library/localsend_helper.lua: pure binaryNameFor (device to binary filename) and parseLines (socket buffer to decoded events, no socket/os dependency) plus socket wrappers (pickPort, spawn, connect, send, recvChunk). readest_localsend.lua keeps its handlers/dialogs/lifecycle shape as a process-level singleton that owns the socket across KOReader context switches; only the FFI calls become socket sends and a non-blocking poll that frames and dispatches decoded events, adding a status handler that caches alias/port/localIps/multicastError for statusText(). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): package static musl helper binaries in plugin zip and ci build-koplugin.mjs and the release workflow still referenced the retired libs/ dir and build-localsend-libs.mjs script from the FFI cdylib era. Point both at bin/ and build-localsend-bins.mjs, and rebuild the release CI step around the two static-musl targets (armv7, arm64) instead of the old three-way gnueabi/gnueabihf/arm64-linux split. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): open the kindle firewall for localsend ports on start Kindle firmware runs iptables with INPUT policy DROP and only allow-lists explicit ports (KOReader's SSH plugin opens 2222 the same way), so LocalSend's TCP 53317-53327 server range and UDP 53317 multicast discovery were unreachable from other devices even though the service was running. Add library/localsend_firewall.lua, ACCEPT the LocalSend ports on service start and remove them on stop, matching kaikozlov's localsend_firewall.lua and KOReader's own SSHPlugin. Gated on iptables being present and working rather than Device:isKindle(), so it also covers other DROP-policy devices and safely no-ops where iptables is absent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(koplugin): keep localsend poll alive across context switches and refresh filemanager The receive event poll belonged to the singleton service but was torn down on a per-instance onCloseWidget, racing the next init's re-attach and stranding the service with no live poll (incoming transfers silently ignored). Make the poll service-lifecycle-owned. Also refresh the KOReader FileManager on receive completion so a received book appears without leaving and re-entering the folder. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): add send flow (list devices, send, cancel) to the helper Ports the send side of the desktop app's LocalSend service (device_payloads, run_send, and the cancel plumbing) onto the koplugin helper binary, which was receive-only. Adds three control-socket commands (list_devices, send, cancel_send) and three queued events (devices, send_progress, send_end). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(koplugin): add send with localsend file action and device picker Adds the SEND-side UI on top of S1's helper protocol: a "Send with LocalSend" file-menu button in FileManager (gated on supported book formats and helper availability), a ButtonDialog device picker driven by list_devices, and send progress/result InfoMessages driven by send_progress/send_end. Includes Helper.deviceLabel, a pure formatter for the picker's device rows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * build(koplugin): pin localsend fork to 3cae1825 for best-effort SO_REUSEPORT Older e-reader kernels (Kindle Voyage on 3.0.35) reject SO_REUSEPORT with ENOPROTOOPT, and the fork previously propagated that error, which disabled multicast discovery for the whole device. Bump the readest/localsend pin to 3cae1825 (set_reuse_port made best-effort) in both the koplugin helper crate and the src-tauri app, and drop the temporary local path override used while testing the patch. The app lockfile also refreshes some Windows-only transitive deps to their latest compatible versions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(koplugin): register HTTP peers so iOS and Android appear in localsend scan The helper no-oped ServerEventV2::Register, assuming the discovery crate added registered peers on its own. Peers that answer a scan over HTTP /register (iOS, which cannot multicast without the entitlement, and Android) were therefore never added to the device list, so KOReader only ever discovered multicast responders such as macOS. Intercept Register in the event pump and feed the peer into the discovery store via a ported register_peer(), skipping a device's own scan probes by fingerprint. Mirrors the Tauri app's src-tauri/src/localsend/service.rs. Verified on a Kindle: the Android peer now appears in list_devices. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * feat(koplugin): send from the library menu and tag devices by platform Add a "Send to nearby Readest devices" action to the Readest Library long-press menu (parity with the FileManager file dialog), gated on the book having a local copy and a helper binary being available. Show the peer platform (e.g. macOS, Android) as a tag in the device picker label, matching the app's device picker. Rename the FileManager actions to "Add to Readest library" and "Send to nearby Readest devices", and re-extract the koplugin translation catalogs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * refactor(koplugin): rename localsend-ffi crate to localsend-bin The crate stopped being an FFI cdylib when the transport moved to a static-musl helper binary reached over a local socket; there is no C ABI anymore, so "ffi" is a misnomer. Rename the crate and its lib, the directory, the build-script crate path, the koplugin_rust_lint working directories, the verification rule, and the gitignore target path. The produced binary is still localsend-helper, so nothing the plugin spawns or ships changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * i18n(koplugin): translate the LocalSend strings into all locales Fill the 31 previously-empty LocalSend msgstr entries (send/receive menu actions, device picker, and status/error messages) across every koplugin translation catalog. Product names (Readest, LocalSend, KOReader, Wi-Fi) stay in Latin script and the %1/%2/%3 placeholders are preserved verbatim. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
43f72720f2
|
feat(i18n): add Uzbek and Brazilian Portuguese translations (#4061)
* feat(i18n): add Uzbek (Oʻzbek) translation Adds `uz` as a first-class supported locale across the Readest app and the readest.koplugin companion. Also refactors the supported locale set to source from a single ground-truth file (`apps/readest-app/i18n-langs.json`) consumed by both the i18next runtime and the i18next-scanner config, and replaces a NUL-byte sentinel in `extract-i18n.js#unescapePo` with a single-pass regex so git no longer treats the script as binary. Closes #4053 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(i18n): add Brazilian Portuguese (pt-BR) translation Adds `pt-BR` as a regional variant supported alongside `pt`. Falls back to `pt` then `en` for any future missing keys, so European Portuguese gracefully covers gaps. Translations follow Brazilian conventions (arquivo / tela / excluir / salvar / baixar / senha, gerundive verb forms) rather than verbatim copying the European catalog. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
6d29814551
|
chore(koplugin): refresh i18n catalogs (#4058)
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
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
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
Run scripts/extract-i18n.js — adds 70 new msgids covering the Library view (View Mode / Group by / Sort by labels, action sheet entries, search dialog, error toasts) and drops 1 obsolete msgid removed during the picker rework. All 31 locales updated; new strings have empty msgstrs awaiting translation. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
ed8956e9ed
|
feat(koplugin): Readest Library view in KOReader (#4056)
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
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
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
* feat(koplugin/library): data layer + busted harness + design doc
- LibraryStore: per-user SQLite index merging cloud + local books by
partial-md5 hash. listBooks/listBookshelfBooks/listBookshelfGroups,
upsertBook with cloud_present/local_present OR-merge + _force/clear
sentinels, parseSyncRow, getChangedBooks for tombstone push.
- EXTS table mirroring web's document.ts.
- busted harness with KOReader stubs (G_reader_settings, DataStorage,
lua-ljsqlite3 against :memory:); spec_helper, exts_spec, smoke_spec,
librarystore_spec covering schema, sort, group nesting, dedupe.
- Library design doc + spec README.
- pnpm test:lua wired through root + app package.json; lint-koplugin
recurses into library/ + spec/.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(koplugin/library): cloud sync — push, pull, upload, delete, downloads
- Spore methods: pullBooks (incremental /sync), getDownloadUrl,
getUploadUrl, listFiles, deleteFile.
- syncbooks.lua: pushBook + pushChangedBooks (advances watermark to
max(updated_at, deleted_at)), syncBooks(opts, mode) for push/pull/both,
downloadBook + downloadCover (sync socket.http with file sink; cover
download via fork+poll with single-slot queue + visible-page filter +
coalesced refresh), uploadBook (presigned-PUT flow + best-effort
cover), deleteCloudFiles (list-then-delete-each, mirrors
cloudService.deleteBook).
- SyncAuth.withFreshToken wrapper resolves the ensureClient race; 401/403
unified across syncconfig + syncannotations.
- Cloud + local book covers shared by partial-md5 hash; cover.png cached
at <settings>/readest_covers/<hash>.png with sentinel for known 404s.
- syncbooks_spec covers row-to-wire conversion + file_key shape.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(koplugin/library): local discovery — sidecar scanner + cover provider
- localscanner.lightScan iterates ReadHistory entries, reads
partial_md5_checksum from .sdr sidecars, and upserts local rows.
Slow filesystem walks deferred to fullSidecarWalk (24h-gated).
- coverprovider wraps BookInfoManager:getBookInfo for local books with
graceful FakeCover fallback when coverbrowser is absent.
- localscanner_spec + coverprovider_spec.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(koplugin/library): UI — widget, item, view menu, FileManager hooks
- librarywidget: full-screen Menu mixed in with CoverMenu + Mosaic/List
per zen_ui's group_view pattern. Title-bar tap → view menu, search via
left icon, drill-in/back for grouping. Async cloud sync deferred via
scheduleIn so the menu paints before HTTP fires.
- libraryitem: BIM patch for cloud-only (readest-cloud://) and group
(readest-group://) URIs; group-cover composer (2x2 mosaic for grid,
same in list) with cache key derived from the actual first-N hashes
for content-based invalidation; ListMenuItem update + paintTo patches
for wider list-mode cover strip and cloud-up/down icon overlay.
- libraryviewmenu: ButtonDialog with View/Group by/Sort by/Actions.
Default Group by = Groups (parity with web), values authors/groups.
- librarypaint: partial-page e-ink repaint shim adapted from zen_ui.
- main.lua: Library menu entry, dispatcher actions (Open Library / Push
/ Pull as general; progress + annotations as reader-only),
"Add to Readest" button in FileManager's long-press file dialog
(dedupe by partial_md5; bumps updated_at when present, inserts a
fresh local-only row otherwise; un-tombstones via _clear_fields).
Push books on Library open when auto_sync is on, pull-only otherwise.
- Long-press action sheet with Readest BookDetailView parity:
Remove from Cloud & Device / Cloud Only / Device Only,
Upload to Cloud, Download Book / Cover / All.
- Cloud-down + cloud-up SVG icons (LiaCloudDownloadAltSolid /
LiaCloudUploadAltSolid) painted in the right-side wpageinfo slot.
- i18n catalog updated for new strings.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(koplugin/library): split libraryitem into focused modules
libraryitem.lua had grown to 1018 lines mixing five unrelated
concerns. Split along the natural seams:
cloud_covers — readest-cloud:// URI scheme, on-disk <hash>.png
cache, single-slot async download queue, visible-page
filter
group_covers — readest-group:// URI scheme, 2x2 mosaic composer with
content-derived cache key (first-N hashes), cell
layout table
cloud_icons — bundled cloud-up/cloud-down SVG loader, IconWidget
cache, paint-overlay positioning
list_strip — list-mode group row builder (4-cover wider strip
replacing ListMenu's square cover slot)
bim_patch — BookInfoManager:getBookInfo router (cloud / group /
local) + ListMenuItem update + paintTo patches; owns
the _library_local_paths set and orig BIM reference
libraryitem.lua is now 141 lines: just the entry-table constructors
(entry_from_row, entry_from_group, entry_back) plus thin install /
set_visible_hashes delegates. Each new module is 88-216 lines.
No behavior change — same 113 specs pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore(koplugin): co-locate dev tooling, ship-zip exclusions, CI job split
- apps/readest.koplugin/scripts/build-koplugin.mjs: local sideloading
build with the same exclusions the release workflow uses.
- Move lint-koplugin + test-koplugin from apps/readest-app/scripts/ to
apps/readest.koplugin/scripts/. All koplugin dev tooling now lives
with the koplugin and is excluded from the published release zip.
- Rename to .mjs so Node treats them as ESM without the reparse warning
(the i18n CommonJS scripts stay .js).
- Release workflow: zip -r exclusions for scripts/, docs/, spec/,
.busted so dev artifacts don't ship to end users.
- PR workflow: split build_web_app into build_web_app + test_web_app
for parallelism. The test job installs luarocks + busted +
lsqlite3complete and runs pnpm test:lua. test-koplugin.mjs now
hard-fails (instead of soft-skipping) when CI=true and a tool is
missing — a broken CI toolchain previously exited 0 silently.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|
|
c59097b0ac
|
feat(koplugin): add i18n catalog and sync info dialog (#4050)
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
PR checks / rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
- i18n loader at apps/readest.koplugin/i18n.lua: isolated callable,
falls back to KOReader's gettext when a string is untranslated
- Translation catalog at locales/<i18next-code>/translation.po for 31
languages, mirroring apps/readest-app/public/locales/
- scripts/extract-i18n.js (scan _("...") and _([[...]]); preserve
existing, drop obsolete, add new) and scripts/apply-translations.js
(bulk import from /tmp/koplugin-translations/<lang>.json)
- Mirror apps/readest-app SyncInfoDialog: rename showMetaHashInfo to
showSyncInfo, dialog title "Sync Info", new Last Synced row computed
as max(last_synced_at_config, last_synced_at_notes) from doc_settings
- syncconfig.lua / syncannotations.lua mark per-book sync timestamps
on push/pull success
- Rename "Meta Hash" -> "Book Fingerprint" in koplugin and
apps/readest-app SyncInfoDialog.tsx; translations propagated to
all readest-app locales
- "book config" -> "reading progress" wording across user-facing
strings (matches QiuYukang fork terminology)
- Replace "Log out as " / "Login failed: " concat prefixes with
T(_("...%1..."), arg) placeholder pattern (RTL / verb-final friendly)
- pnpm lint:lua: luajit -b syntax check across koplugin .lua files;
soft-skips when luajit is missing locally; CI installs luajit and
runs the check unconditionally
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|