feat: Make word highlighting enabled by default by inverting its environment variable logic, updating documentation, and removing NEXT_PUBLIC_NODE_ENV from Playwright tests.

This commit is contained in:
Richard R 2026-02-17 22:12:11 -07:00
parent 021533223b
commit 3ede092adc
5 changed files with 7 additions and 6 deletions

View file

@ -42,7 +42,6 @@ jobs:
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
env:
NEXT_PUBLIC_NODE_ENV: test
API_BASE: https://api.deepinfra.com/v1/openai
API_KEY: ${{ secrets.DEEPINFRA_API_KEY }}
run: pnpm exec playwright test --reporter=list,github,html

View file

@ -15,7 +15,7 @@ This is the single reference page for OpenReader WebUI environment variables.
| `NEXT_PUBLIC_DEFAULT_TTS_MODEL` | Client feature flags | `kokoro` | Override default TTS model |
| `NEXT_PUBLIC_SHOW_ALL_DEEPINFRA_MODELS` | Client feature flags | `true` unless set to `false` | Set `false` to restrict DeepInfra models |
| `NEXT_PUBLIC_ENABLE_AUDIOBOOK_EXPORT` | Client feature flags | `true` unless set to `false` | Set `false` to hide audiobook export UI |
| `NEXT_PUBLIC_ENABLE_WORD_HIGHLIGHT` | Client feature flags | `false` unless set to `true` | Set `true` to enable word highlight + alignment |
| `NEXT_PUBLIC_ENABLE_WORD_HIGHLIGHT` | Client feature flags | `true` unless set to `false` | Set `false` to disable word highlight + alignment |
| `API_BASE` | TTS provider | none | Point to your OpenAI-compatible TTS base URL |
| `API_KEY` | TTS provider | `none` fallback in TTS route | Set when provider requires auth |
| `TTS_CACHE_MAX_SIZE_BYTES` | TTS caching | `268435456` (256 MB) | Tune in-memory TTS cache size |
@ -387,7 +387,7 @@ Controls whether audiobook export UI/actions are shown in the client.
Controls word-by-word highlighting UI and timestamp-alignment behavior.
- Default behavior: disabled unless set to `true`
- Default behavior: enabled unless explicitly set to `false`
- Applies in both development and production
- Requires working timestamp generation (for example `WHISPER_CPP_BIN`)
- Affects:

View file

@ -12,7 +12,7 @@ import type { TTSAudiobookChapter } from '@/types/tts';
import type { AudiobookGenerationSettings } from '@/types/client';
const canExportAudiobook = process.env.NEXT_PUBLIC_ENABLE_AUDIOBOOK_EXPORT !== 'false';
const canWordHighlight = process.env.NEXT_PUBLIC_ENABLE_WORD_HIGHLIGHT === 'true';
const canWordHighlight = process.env.NEXT_PUBLIC_ENABLE_WORD_HIGHLIGHT?.toLowerCase() !== 'false';
const viewTypeTextMapping = [
{ id: 'single', name: 'Single Page' },

View file

@ -101,7 +101,8 @@ interface SetTextOptions {
const CONTINUATION_LOOKAHEAD = 600;
const SENTENCE_ENDING = /[.?!…]["'”’)\]]*\s*$/;
const wordHighlightFeatureEnabled = process.env.NEXT_PUBLIC_ENABLE_WORD_HIGHLIGHT === 'true';
const wordHighlightFeatureEnabled =
process.env.NEXT_PUBLIC_ENABLE_WORD_HIGHLIGHT?.toLowerCase() !== 'false';
// Tiny silent WAV used to unlock HTML5 audio on iOS/Safari.
const SILENT_WAV_DATA_URI =

View file

@ -1,7 +1,8 @@
import type { DocumentListState } from '@/types/documents';
const wordHighlightEnabledByDefault = process.env.NEXT_PUBLIC_ENABLE_WORD_HIGHLIGHT === 'true';
const wordHighlightEnabledByDefault =
process.env.NEXT_PUBLIC_ENABLE_WORD_HIGHLIGHT?.toLowerCase() !== 'false';
export type ViewType = 'single' | 'dual' | 'scroll';