mirror of
https://github.com/readest/readest.git
synced 2026-11-30 03:13:39 +00:00
* fix(tts): play stored narration audio in place instead of copying it An EPUB 3 book whose narration is one shared audio track (921 MB in the test book) waited ~72 s on the 0.12.16 Linux app, and ~16 s on the web, before the first word: the client inflated the whole zip entry into a Blob with zip.js before handing it to the media element. Audio entries are stored uncompressed, so their bytes are a contiguous window of the book file. BookDoc.getMediaSource() finds that window from the entry's local header. On the web the book is a plain File, so the client plays a lazy slice of it. In the Tauri app (NativeFile/RemoteFile, whose slices read into memory) the loopback media proxy now serves the window over HTTP with Range support: `get_media_file_url` registers a path in the asset scope under a random id, and `GET /<secret>/file/<id>` streams it. A custom scheme can't do this because CEF fails any Range request to one, so the element couldn't seek. Compressed entries, and the native narration players on Android and iOS, keep the blob path. Verified: - media-overlay-client.test.ts "plays a stored audio entry from a slice of the book file" and "... of a native book through the media proxy" fail on main: expected "vi.fn()" to not be called at all, but actually been called 1 times (loadBlob copied the entry). They pass now. - document-loader-media-source.test.ts (3 cases) is new API; on main it fails with "book.getMediaSource is not a function". - dev-web, Chromium, 921 MB single-track MP3 book: first audio 1.4 s after Read Aloud (16.6 s on main's copy path); chapter 2, 8 h into the track, 2.4 s; pause/resume; a 5 MB book still plays. - Linux CEF dev build (built and run inside org.gnome.Sdk//50, this host lacks GTK dev headers), same book: first audio 2.5 s through http://127.0.0.1:<port>/<secret>/file/<id> (~72 s on the 0.12.16 AppImage), 8 h seek 2.6 s, pause/resume, small book plays; app RSS +78 MB while playing. - Related vitest suites 563 passed; media_proxy Rust tests (21) and the full lib suite (198) pass; clippy -D warnings, cargo fmt --check, pnpm lint, pnpm format:check clean. Not run: macOS, Windows, Android, iOS; AAC (.m4a) narration still fails on Linux CEF (no decoder), unchanged here. Reported by DeathStroke19891 on GitHub Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(tts): serve only audio types from the media proxy file windows The content type of a file window came from the WebView unchecked, so the loopback proxy could have served any file in the asset scope as, say, text/html on 127.0.0.1. Registering a window now requires an audio/ type (case-insensitive, no CR/LF), and file responses carry X-Content-Type-Options: nosniff. Verified (Rust, inside org.gnome.Sdk//50): - registering_refuses_a_non_audio_type failed before with the panic message "text/html" (the window was registered); serves_file_windows_with_nosniff failed with: no entry found for key "x-content-type-options". Both pass now. - media_proxy tests 23 passed; cargo test -p Readest --lib 200 passed; cargo fmt --check and clippy -D warnings clean. - Related vitest suites (TTS, loader, media proxy, command ACL): 570 passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
57 lines
1.9 KiB
JSON
57 lines
1.9 KiB
JSON
{
|
|
"$schema": "../gen/schemas/desktop-schema.json",
|
|
"identifier": "webdriver-remote",
|
|
"description": "Grants the app commands to the vitest webdriver tester page, which tauri classifies as a remote origin (it is served from vitest's own port, not the devUrl). Not listed in app.security.capabilities, so it is inert in shipped builds; scripts/test-tauri.sh selects it via a --config override.",
|
|
"local": false,
|
|
"remote": {
|
|
"urls": ["http://localhost:*", "http://127.0.0.1:*"]
|
|
},
|
|
"windows": ["main"],
|
|
"permissions": [
|
|
"allow-start-server",
|
|
"allow-download-file",
|
|
"allow-upload-file",
|
|
"allow-get-environment-variable",
|
|
"allow-get-executable-dir",
|
|
"allow-set-webview-info",
|
|
"allow-get-webview-version",
|
|
"allow-is-updater-disabled",
|
|
"allow-allow-paths-in-scopes",
|
|
"allow-optimize-cover-thumbnails",
|
|
"allow-read-dir",
|
|
"allow-write-backup-zip",
|
|
"allow-extract-backup-zip",
|
|
"allow-parse-epub-metadata",
|
|
"allow-extract-epub-cover-full",
|
|
"allow-parse-epub-full",
|
|
"allow-get-comic-page-sizes",
|
|
"allow-parse-mobi-metadata",
|
|
"allow-extract-mobi-cover-full",
|
|
"allow-parse-pdf-metadata",
|
|
"allow-render-pdf-cover",
|
|
"allow-auth-with-safari",
|
|
"allow-start-apple-sign-in",
|
|
"allow-set-traffic-lights",
|
|
"allow-set-window-title",
|
|
"allow-show-lookup-popover",
|
|
"allow-update-book-presence",
|
|
"allow-clear-book-presence",
|
|
"allow-clip-url",
|
|
"allow-get-media-proxy-base",
|
|
"allow-get-media-file-url",
|
|
"allow-spawn-fresh-browser",
|
|
"allow-verify-update-signature",
|
|
"allow-install-nightly-update",
|
|
"allow-localsend-start",
|
|
"allow-localsend-stop",
|
|
"allow-localsend-get-status",
|
|
"allow-localsend-list-devices",
|
|
"allow-localsend-announce",
|
|
"allow-localsend-set-discoverable",
|
|
"allow-localsend-is-alive",
|
|
"allow-localsend-respond",
|
|
"allow-localsend-cancel-receive",
|
|
"allow-localsend-send-files",
|
|
"allow-localsend-cancel-send"
|
|
]
|
|
}
|