Commit graph

43 commits

Author SHA1 Message Date
Richard Roberson
04def62ff5 refactor(core): standardize module structure and enhance TTS types
- Reorganized utility modules from `src/utils` to `src/lib` for clearer separation of concerns.
- Introduced new, dedicated type definitions in `src/types` for improved type safety in configuration and TTS API interactions.
  - Replaced `src/types/appConfig.ts` with `src/types/config.ts`.
  - Added `src/types/tts.ts` for TTS request payloads, error structures, and retry options.
- Updated module imports across several contexts (`Config`, `EPUB`, `HTML`, `PDF`, `TTS`) and components to reflect the new `lib` and `types` locations.
- Enhanced TTS API request and error handling in `src/app/api/tts/route.ts` and TTS-consuming contexts with explicit types.
- Simplified `ProgressCard`, `ProgressPopup`, and `AudiobookExportModal` components by removing the `isProcessing` prop, centralizing processing state management.
- Streamlined `HTMLContext` by removing `createFullAudioBook` and `isAudioCombining` properties, focusing its scope.
2025-11-16 15:12:35 -07:00
Richard Roberson
7271afa2f5 refactor(config): centralize app config in Dexie
Migrates scattered configuration items and last document locations
from the legacy `config` table to new, dedicated Dexie stores.

- Introduces a singleton `app-config` table (`AppConfigRow`) to standardize
  and structure all application settings in a single object.
- Creates a `last-locations` table for efficient storage of document read positions.
- Updates `ConfigContext` to utilize `dexie-react-hooks`' `useLiveQuery`
  for reactive and simplified state management.
- Implements a database upgrade path (from DB_VERSION 4 to 5) to migrate
  all existing user settings seamlessly.
- Simplifies config access and updates with new `getAppConfig` and `updateAppConfig`
  utility functions.
- Removes the deprecated `config` table after successful migration.
- Updates consumers like `SettingsModal` and test helpers to align with
  the new config structure.
2025-11-15 17:29:56 -07:00
Richard Roberson
071d967f8f feat(pdf): modernize text highlighting and parsing for fluidity
- Offload computationally intensive text matching for real-time highlighting to a dedicated Web Worker, ensuring the main thread remains responsive during playback.
- Implement a new overlay-based highlighting system that renders independently of the PDF's text layer, providing smoother and more reliable visual feedback without interfering with document rendering.
- Introduce a new setting allowing users to enable or disable real-time text highlighting in PDFs, offering personalized control over the reading interface.
- Upgrade the underlying text comparison algorithm to Dice similarity for more accurate and context-aware matching of spoken words to on-screen text, improving synchronization precision.
- Improve sentence boundary detection, especially for quoted dialogue and complex structures, by enhancing the NLP processing logic, leading to a more natural audio-text flow.
2025-11-15 14:06:44 -07:00
Richard Roberson
2f39e8f014 perf(test): optimize test execution and error handling
- Reduce Playwright worker allocation from 75% to 50% for better resource management
- Disable parallel test execution temporarily to isolate flaky test behavior
- Enhance audio utility to fail fast on user cancellation, preventing unnecessary retries
- Consolidate test-specific utilities within individual test suites for better isolation
- Introduce export functionality test coverage with new export.spec.ts suite
2025-11-14 18:52:49 -07:00
Richard Roberson
5316596a1b refactor(db): migrate to Dexie with reactive queries and simplify data layer
Replaces custom IndexedDB implementation with Dexie ORM, eliminating 850+ lines of
boilerplate code and introducing reactive live queries across all document types.
Transforms document management from imperative refresh patterns to automatic
reactive updates using dexie-react-hooks.

Simplifies TTS backend by removing concurrency semaphore while maintaining
request de-duplication through in-flight tracking. Streamlines document hooks
by removing manual state management and refresh methods.

Updates package dependencies and type definitions to support new database
architecture while maintaining full backward compatibility for existing
documents and settings.

BREAKING CHANGE: Document hooks no longer expose refresh() methods as updates
are now reactive through live queries.
2025-11-14 16:14:00 -07:00
Richard Roberson
e3799e40aa feat(tts): add smart sentence continuation
introduce configurable smart sentence splitting with persisted state,
UI toggle, and EPUB/PDF contexts that send continuation metadata.
enhance TTS pipeline to merge cross-page sentences, manage carryover,
and trigger visual page changes during playback for smoother narration.

update README with kokoro quick-start guidance, remove the legacy
issues mapping doc, and add deterministic TTS mocks plus sample audio
for Playwright tests.
2025-11-14 12:00:03 -07:00
Richard Roberson
70723f4c1d perf(api): add LRU cache for TTS audio responses
Introduce an in-memory LRU cache for TTS audio with configurable
size and TTL via TTS_CACHE_MAX_SIZE_BYTES and TTS_CACHE_TTL_MS.
Return X-Cache headers (HIT/MISS) and set route runtime to nodejs.
Cache key includes provider, model, voice, speed, format, text,
and optional instructions.

Normalize non-Kokoro multi-voice input to the first token while
preserving full voice string in the cache key. Default Deepinfra
model to hexgrad/Kokoro-82M when none is provided.

Fix Deepinfra Kokoro behavior by enforcing single-voice selection:
- ui: only enable multi-select when provider supports >1 voices
- voice utils: Deepinfra max voices set to 1
- tests: gate provider selection and multi-voice tests by CI and
  increase timeout for stability
2025-11-12 23:28:05 -07:00
Richard Roberson
1dcffc82d8 feat(tts,ui,api): add Kokoro multi-voice selection and SDK support
- Introduce voice utils (model detection, voice parsing/weights, limits)
- Enable Kokoro multi-voice strings across OpenAI/Deepinfra/custom providers
- Normalize non-Kokoro voices to single token for SDK calls
- Expose full Kokoro voice list for custom-openai Kokoro models
- Update TTS API to return audio as ArrayBuffer and improve logging
- Add multi-select UI for Kokoro voices with provider-based clamping
- Preserve Kokoro voice strings in TTSContext and coalesce restarts
- Merge multi-sentence quoted dialogue in NLP sentence splitter
- Update tests for single and multi-voice selection flows
2025-11-12 20:46:45 -07:00
Richard Roberson
42665884d7 feat(audiobook): add chapter-based export with UI and API
Introduce end-to-end chapterized audiobook generation with persistent
storage, resumable workflows, and MP3/M4B support.

API:
- add /api/audio/convert/chapter (GET/DELETE) for per-chapter ops
- add /api/audio/convert/chapters (GET/DELETE) for listing/reset
- enhance /api/audio/convert:
  - accept mp3|m4b, stream combined file, cache complete output
  - robust chapter indexing, docstore persistence, list concat
  - AbortSignal-aware ffmpeg/ffprobe, 499 on cancel

UI/UX:
- add AudiobookExportModal with progress, resume, regenerate, download
- add ProgressCard, enhance ProgressPopup (click-to-focus, richer info)
- add Header, ZoomControl; move TTSPlayer to sticky bottom bar
- redesign EPUB/HTML/PDF pages for full-height layout and controls
- add HomeContent; compact uploader variant; document list polish

TTS/Contexts:
- EPUB/PDF contexts now generate per-chapter to disk, return bookId
- support chapter regeneration; progress/cancel propagation
- pass provider/model/instructions; standardize MP3 TTS output
- HTML context updates for model/instructions

Styling:
- globals: overlay-dim, scrollbar styles, prism gradient utilities
- theme vars: secondary-accent, prism-gradient; tailwind color addition

Misc:
- fix PDF scale calc to use container height
- EPUB theme reader area fills height
- time estimation update cadence stab
- audio util passes format to combine endpoint
2025-11-11 13:32:30 -07:00
Richard Roberson
452bc2adfe feat: Add issue triage and mapping documentation for OpenReader v1
- Created `issues-to-components.md` to summarize open issues and their mappings to components for v1 development.
- Documented key features, bugs, and proposed solutions for issues #59, #48, #47, #44, and #40.
- Outlined global guardrails and cross-cutting improvements for the v1 architecture.

chore: Establish v1 todo and planning framework

- Created `todo.md` to capture the 1.0 rewrite plan, including scope, architecture overview, phased milestones, and a master checklist.
- Defined action items, dependency ordering, and issue mapping alignment for efficient development.

chore: Update pnpm workspace configuration

- Added `ignoredBuiltDependencies` for `canvas` in `pnpm-workspace.yaml` to prevent build issues.
2025-11-10 13:19:45 -07:00
RobbyV2
32f5cdc494 Saving and Loading Progress Bar 2025-07-19 20:22:50 -07:00
Richard Roberson
e6cd1d0264 Bump version + fix build error
Some checks failed
Build and Publish Docker Image / build (push) Has been cancelled
2025-06-22 13:47:23 -06:00
Victor Sonck
f594ca836b Refactored NLP into a single, shared function for splitting to sentences.
now both handleClick and global sentences are the exact same, so the sentenceIndex will always be correct.
2025-06-20 08:25:29 +02:00
Richard Roberson
82bb91a850 Add TXT and MD support with and HTML viewer with react markdown + many refactors to support it 2025-04-15 02:28:51 -06:00
Richard Roberson
1bbd77f93b Improve space detection logic in PDF text extraction 2025-03-22 12:10:17 -06:00
Richard Roberson
4c5866c02b Add core-js for promise-with-resolvers support and update version to 0.2.4-patch.4
Some checks failed
Build and Publish Docker Image / build (push) Has been cancelled
2025-03-04 18:49:08 -07:00
Richard Roberson
d10d4410e2 Update PDF worker paths and remove setup script 2025-03-04 17:10:57 -07:00
Richard Roberson
4e857a75f0 withResolvers() try again
Some checks failed
Build and Publish Docker Image / build (push) Has been cancelled
2025-03-04 14:27:05 -07:00
Richard Roberson
50877d6543 Use legacy PDF worker for lower Safari versions
Some checks failed
Build and Publish Docker Image / build (push) Has been cancelled
2025-03-04 13:37:41 -07:00
Richard Roberson
ce9df9a5ab implement retry logic for TTS API calls and clean up code 2025-03-03 23:03:52 -07:00
Richard Roberson
4e07e737f0 Stop using audio blobs 2025-03-02 21:16:24 -07:00
Richard Roberson
136fdb9652 Fix Apple WebKit PDF Upload 2025-03-01 23:36:25 -07:00
Richard Roberson
b89d1700e9 Fix for longer audiobooks 2025-03-01 18:21:51 -07:00
Richard Roberson
92220de5ea Refactor PDF text extraction to support configurable margins for header, footer, left, and right 2025-02-25 15:53:45 -07:00
Richard Roberson
f948601e70 Add configurable text extraction margin for PDF processing 2025-02-25 03:26:37 -07:00
Richard Roberson
96376e2324 Environment changes, set in Docker run 2025-02-23 13:20:42 -07:00
Richard Roberson
9d6632d2d0 Use server instead of client for open ai request + large refactors and bug fixes 2025-02-21 11:24:07 -07:00
Richard Roberson
737cf5c9f5 Fix + debounce epub text extraction on window resize 2025-02-17 11:14:00 -07:00
Richard Roberson
36fdbc276d Debounce PDF scale and extraction 2025-02-17 10:57:39 -07:00
Richard Roberson
cc654f5f1d Save document list state to confid db + add unified document types 2025-02-12 20:49:37 -07:00
Richard Roberson
f16116cab4 Huge PDF text extraction optimization 2025-02-12 02:15:21 -07:00
Richard Roberson
521eda6cff Move nlp processing to next server 2025-02-12 02:14:56 -07:00
Richard Roberson
d839d3cfa4 App settings upgrade + new themes 2025-02-11 14:16:47 -07:00
Richard Roberson
4bd443aea4 Add server side document store 2025-02-11 01:29:02 -07:00
Richard Roberson
297396579b Better nlp + refactors 2025-02-11 00:12:31 -07:00
Richard Roberson
01ba8d57ba Update sentence processing to using max sentence blocks of 250 chars 2025-02-10 19:58:14 -07:00
Richard Roberson
e8008b68ab Save last EPUB location 2025-02-10 11:49:49 -07:00
Richard Roberson
707dd9261a EPUB Working Well 2025-02-09 11:52:42 -07:00
Richard Roberson
25f3375b2f Chapter by chapter auto-play 2025-02-09 02:55:49 -07:00
Richard Roberson
fd6a370bce WIP 2025-02-08 21:43:39 -07:00
Richard Roberson
2fa91a2448 Working epub viewer 2025-02-08 15:55:31 -07:00
Richard Roberson
7d667b2114 Prepare epub work 2025-02-08 13:07:36 -07:00
Richard Roberson
d025227518 More refactors 2025-01-29 22:04:11 -07:00