Skip to content

Theorem v1.5.6

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 18 Sep 04:30
· 5 commits to main since this release

Fixed

  • Memory & CPU Spike on Book Opening — Eliminated excessive ~1.3GB memory consumption and CPU pegging when opening books:
    • In src/features/reader/Reader.tsx, decoupled tts_engine_preload from unconditional book open hooks so neural ONNX models are compiled only when Immersion Reading is actively enabled.
    • Added an unmount hook that triggers tts_engine_unload and a new native trim_memory command calling libc::malloc_trim(0), releasing dormant glibc thread arenas back to the OS kernel.
    • Reaped Linux spd-say and killall child processes in src-tauri/src/tts_linux.rs via detached wait threads, preventing <defunct> zombie process accumulation.
  • P2P Device Sync PDF & Non-Materialized On-Demand File Transfers — Fixed persistent "Book File Not Available" errors when attempting to open or download PDFs and EPUBs synced from paired devices:
    • SQLite Persistence Key Alignment: Fixed find_in_db in src-tauri/src/file_transfer.rs querying persist:theorem-library. Theorem stores state under zustand:theorem-library via SQLITE_PERSIST_KEY_PREFIX. Updated queries to check zustand:theorem-library (and fallback variations) to accurately extract desktop-imported book file paths (filePath, storagePath).
    • File Path Normalization & Percent-Decoding: Added normalize_candidate_path in file_transfer.rs handling file:// scheme prefixes, percent-encoded spaces and symbols (percent_decode_str), and Windows drive formats (/C:/... -> C:/...).
    • Direct LAN IP/Port Connection Fallback: Configured EndpointAddr with last_ip and last_port socket addresses in connect_and_request to ensure reliable direct peer connections on local networks when relays are delayed or unreachable. Refreshes and persists verified socket addresses upon successful transfers.
    • Two-Way Pairing Address Capture: Updated PairingProtocolHandler::accept in src-tauri/src/iroh_sync.rs to extract remote IP and port from conn.paths() and record them in PairedDevice, establishing direct LAN addressing immediately upon pairing.
    • Atomic Safe Downloads: Updated download_book_file to stream incoming bytes into a .download.tmp temporary file before atomically renaming to .book, cleaning up incomplete artifacts on network timeout or failure.
    • Immediate Progress & Reload Flow: Emitted an initial 0.0% event immediately upon connection in file_transfer.rs and attached the progress listener on mount in Reader.tsx. Cleared loadedBookIdRef.current upon transfer completion so the reader seamlessly mounts the newly acquired book without stalling on "Book File Not Available".
  • Mobile EPUB Navigation & Touch Gesture Handling — Restored smooth EPUB navigation and thumb gesture ergonomics:
    • In foliate-js-runtime/paginator.js, restored GPU-promoted 300ms CSS transform slide transitions for page turns and snap releases while keeping transitions cleanly disabled during finger drags and frame-by-frame JS interpolation.
    • Refined gesture axis arbitration (absDx > 16 && absDx > absDy * 1.3) so natural curved thumb swipes reliably turn pages without locking into vertical scroll.
    • Set touchAction: 'none' on paginated viewport containers in ReaderViewport.tsx, eliminating mobile WebView gesture arbitration delays.
  • Download Failure UI Polish — Removed the extraneous "Go to Sync Settings" button from the reader download failure modal, establishing a clean, unified two-button action group (Back to Library and Try Again).

Improved & Performance

  • Dependency Modernization
    • Removed deprecated @types/dompurify and @types/uuid (types are now bundled upstream).
    • Updated frontend dependencies to latest versions, including vitest & @vitest/coverage-v8 5.0.1, @tanstack/react-virtual 3.14.13, zod 4.6.5, react-i18next 17.0.14, lucide-react 1.47.0, and jsdom 30.1.0.
    • Updated 44 Rust crates via cargo update to latest compatible releases.
  • Dynamic Deferred Sentry Loading — Refactored src/core/lib/sentry.ts and src/main.tsx to dynamically import @sentry/react only when a valid Sentry DSN is resolved at runtime. Sheds 270 KB (88 KB gzip) from the synchronous critical startup path for local, offline, and dev instances.
  • React Re-render Isolation & Fine-Grained Selectors
    • In Library.tsx, extracted <DailyHighlightBanner /> as an isolated memoized component, removing the annotations array subscription from LibraryPage. Prevents full library re-renders (1,000+ cards) when annotations are created, updated, or synced.
    • In Sidebar.tsx, replaced whole-object stats subscriptions with primitive currentStreak selectors, preventing sidebar thrashing during background reading progress flushes.
    • In Reader.tsx, decoupled the feeds array subscription from the active book reader and isolated reader-specific settings via shallow derivation, ensuring background RSS feed refreshes and non-reader settings modifications never trigger reader viewport re-renders.
  • SQLite Composite Query Indexes — Added idx_rss_articles_feed_fetched ON rss_articles(feed_id, fetched_at DESC), idx_rss_articles_fetched_at ON rss_articles(fetched_at DESC), and idx_reading_sessions_date_created ON reading_sessions(session_date DESC, created_at DESC) in src-tauri/src/database.rs, converting in-memory sort scans into instant index lookups.
  • Zero-Allocation Rust Search & Clone Elimination
    • Replaced allocating string-lowercasing search in src-tauri/src/epub_rewriter.rs (find_ci) with zero-allocation byte window scanning (windows(len).position(|w| w.eq_ignore_ascii_case(...))), saving tens of 100KB–500KB OPF string allocations per metadata write.
    • In src-tauri/src/epub_parser.rs (prefetch_sync), moved owned EpubMeta fields directly, eliminating redundant heap string clones and pre-inflated chapter map duplication.
    • In src-tauri/src/batch_ingest.rs, moved base64 cover strings directly into NativeBookRecord without cloning.
  • Cloudflare DTO Data Layouts — Applied Box<str> and Box<[T]> across Rust DTOs (book_search.rs, opds_parser.rs, article_extractor.rs, mobi_parser.rs, audiobook.rs, mdict.rs, stardict.rs), shedding 8 bytes of excess allocator capacity per field.

Download & install

Platform Download
Windows (x64) Theorem_v1.5.6_x64-setup.exe
macOS (Apple Silicon) Theorem_v1.5.6_aarch64.dmg
macOS (Intel) Theorem_v1.5.6_x64.dmg
Linux (Debian/Ubuntu) Theorem_v1.5.6_amd64.deb
Linux (any) Theorem_v1.5.6_amd64.AppImage
Android (arm64) app-arm64-release.apk

Linux one-liner: curl -fsSL https://raw.githubusercontent.com/Fundaments-Work/Theorem/main/scripts/install-linux.sh | bash

Desktop builds auto-update in place (Settings → About → Check for Updates). Android updates are manual unless installed via F-Droid.