Commit graph

178 commits

Author SHA1 Message Date
Richard Roberson
ff150eec01 refactor(audiobook): standardize chapter regeneration APIs and UX
- Removed `onProgress` callback from `regenerateChapter` and related functions across `TTS`, `EPUB`, and `PDF` contexts to simplify the chapter regeneration API.
- Updated `AudiobookExportModal` to align with the refined regeneration API, including removing granular chapter progress display and adding a hint about TTS caching behavior.
- Introduced `TTSAudiobookChapter` interface and renamed `ContinuationMergeResult` to `TTSSmartMergeResult` and `PageTurnEstimate` to `TTSPageTurnEstimate` for better type consistency and clarity.
- Applied minor styling adjustments to buttons and listbox components in modals for visual consistency.
- Added `'use client'` directive to several client-side components for Next.js 13+ compatibility.
- Updated Dockerfile build command from `pnpm run build` to `pnpm build`.
- Added Playwright tests to verify backend chapter state after regeneration.
2025-11-16 21:10:32 -07:00
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
d7ef0fa8bb feat(api): implement concurrency control and request de-duplication for TTS audio processing 2025-11-13 00:27:04 -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
21870ed576 fix(api): stabilize DOCX to PDF conversion and cleanup
- Isolate concurrent LibreOffice runs with per-job profile directories
  (soffice -env:UserInstallation) and per-job temp folders
- Poll for generated PDF and verify stable file size before reading
- Consolidate temp artifacts under docstore/tmp and clean up via rm -r
- Add headless/nologo flags and improve error handling

ui(accessibility):
- ConfirmDialog exposes proper dialog roles
- DocumentFolder toggle adds type, aria-expanded, aria-controls, and title;
  associate content panel with an id
- HTMLViewer wraps content in .html-container for HTML/TXT views

test: add comprehensive Playwright specs and helpers
- Accessibility, API health, deletion flows, folders, navigation, playback,
  and upload scenarios
- Add sample.md and unsupported.xyz; update sample.pdf; extend helpers

ci: run Playwright workflow on version1.0.0 branch
2025-11-12 16:21:11 -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
Richard Roberson
77c955bfae fix(settings): restrict model selection for Deepinfra in production without API key 2025-11-09 17:19:37 -07:00
Richard Roberson
4d3c2cf3cf fix(settings): adjust Deepinfra options and placeholder text based on prod or not 2025-11-09 17:16:12 -07:00
Richard Roberson
4050170160 fix(footer): update Deepinfra link in footer component 2025-11-09 17:09:50 -07:00
Richard Roberson
a54d83eda5 fix(settings): set default TTS provider to Deepinfra in production 2025-11-09 17:05:23 -07:00
Richard Roberson
1614bf46bc fix(tts): add missing ttsProvider dependency to useCallback hooks
Some checks failed
Build and Publish Docker Image / build (push) Has been cancelled
2025-11-09 16:43:13 -07:00
Richard Roberson
b21bdb3a21 feat(tts): add multi-provider TTS support with Deepinfra and custom OpenAI-compatible endpoints
Add comprehensive multi-provider TTS support enabling users to choose between OpenAI, Deepinfra, and custom OpenAI-compatible endpoints. Implement provider-specific voice management with automatic voice restoration per provider-model combination, and migrate package manager to pnpm for improved dependency handling.

Key changes:
- Add TTS provider selection (OpenAI, Deepinfra, custom-openai) in settings UI
- Implement provider-specific model and voice lists with dynamic fetching
- Add voice persistence per provider-model combination in savedVoices
- Support Deepinfra models: Kokoro-82M, Orpheus-3B, Sesame-1B with their voice libraries
- Migrate to pnpm with frozen lockfile for reproducible builds
- Update Docker configuration to use pnpm and Deepinfra API defaults
- Add migration logic for existing users to infer provider from stored baseUrl
- Update test helpers and Playwright configuration for Deepinfra API
- Add example docker-compose.yml with Kokoro-FastAPI integration

BREAKING CHANGE: Voice selection is now provider-model specific. Previously saved voices will be migrated to the new savedVoices structure, but users may need to reselect voices if switching providers.
2025-11-09 15:47:17 -07:00
Richard Roberson
d2477dc9d8
Merge pull request #58 from RobbyV2/feat/SaveLoadProgress
Some checks failed
Build and Publish Docker Image / build (push) Has been cancelled
2025-07-20 12:13:07 -06:00
RobbyV2
7b703f015f Add cancelText parameter 2025-07-19 21:19:12 -07:00
RobbyV2
32f5cdc494 Saving and Loading Progress Bar 2025-07-19 20:22:50 -07:00
Richard Roberson
f5776e5494
Merge pull request #56 from RobbyV2/DocSelectLoad 2025-07-19 21:16:41 -06:00
RobbyV2
772aa83f6a Upload multiple files 2025-07-19 19:22:21 -07:00
RobbyV2
0bcae0dee7 Add document selection loading icon 2025-07-19 18:58:08 -07:00
Richard Roberson
593dd7d1a1
Merge pull request #55 from RobbyV2/AutoSelect
Auto select page number when navigating
2025-07-19 13:53:45 -06:00
RobbyV2
12e30f4ecf Allow clicking of internal links 2025-07-19 12:46:05 -07:00
RobbyV2
41ea2cdc52 Auto select navigation 2025-07-19 12:40:01 -07:00
RobbyV2
0aac3f4816 Move button closure higher in SettingsModal 2025-07-17 16:49:52 -07:00
Richard Roberson
b56584cbed Change go to page + add Vercel Analytics integration 2025-06-30 12:10:56 -06:00
Richard Roberson
08480f07ed
Merge pull request #52 from thepycoder/feature/better-speed-control 2025-06-29 15:09:05 -06:00
Victor Sonck
89833d596b Allow for player speed changes as well as native voice speed changes. Kokoro for example swallows parts of words when asked to go faster than maybe 1.3x. This fixes that, by simply speeding up the player instead. Since we're already using the html5 version of howler, by default it will pitch-correct the audio and it sounds quite good! 2025-06-23 14:09:51 +02:00
Victor Sonck
ece8bcd35a Added saving and restoring last location in PDFs 2025-06-23 13:57:27 +02: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
Richard Roberson
8cf685633d Merge branch 'feature/merge_nlp_implementations' of https://github.com/thepycoder/OpenReader-WebUI into thepycoder-feature/merge_nlp_implementations 2025-06-22 13:23:46 -06:00
Richard Roberson
8d17c69374 Change width and text color 2025-06-22 13:17:26 -06:00
Victor Sonck
4c92b9875c Remove the NLP route, since it is no longer used. 2025-06-22 15:48:33 +02:00
Victor Sonck
740c5e17d3 Add editable page number in PDF navigator view, to make it much easier to jump to specific pages 2025-06-20 08:32:53 +02: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
a1465f1680 Increase size of .md viewer 2025-04-15 11:47:35 -06:00
Richard Roberson
5892383a61 Fix mardown viewer text color
Some checks failed
Build and Publish Docker Image / build (push) Has been cancelled
2025-04-15 11:41:26 -06: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
fc780746aa Bug fixes and readme update 2025-03-30 21:17:16 -06:00
Richard Roberson
7ba807fd95 Pause on page changes + Fix ePub bug when reloading 2025-03-23 17:18:21 -06:00
Richard Roberson
1bbd77f93b Improve space detection logic in PDF text extraction 2025-03-22 12:10:17 -06:00
Richard Roberson
4ed6b17e98 Support gpt-4o-mini-tts with instructions
Some checks failed
Build and Publish Docker Image / build (push) Has been cancelled
2025-03-21 11:32:42 -06:00
Richard Roberson
f464b059e4 Update API settings 2025-03-13 21:00:34 -06:00
Richard Roberson
520236b95c add DOCX support (requires libreoffice) + upload test 2025-03-04 22:47:37 -07: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