fix(ebook): load the full Edge TTS voice list - #1409
Closed
kalashnikxvxiii wants to merge 1 commit into
Closed
kalashnikxvxiii wants to merge 1 commit into
kalashnikxvxiii wants to merge 1 commit into
Conversation
The reader only ever offered the 21 built-in voices, all English or Arabic, so no other language could be picked. kothok-edge-tts reads the voice list response until the socket closes and lets the read error escape. Microsoft closes without a TLS close_notify, so rustls reports UnexpectedEof and list_voices() fails every time, even though the body already arrived intact. Checked against the endpoint directly: 200, 167 KB, 322 voices across 75 locales. Fetch the list with reqwest, which ends the body on Content-Length, and keep the crate call as a fallback. http_client_builder becomes pub(crate) so the timeouts and pool settings stay in one place.
Collaborator
|
Release tracking: this work was integrated through our experimental/beta release branch and is carried in Beta 0.9.126 (published build e758926), with integration adjustments where needed. Closing the PR as already incorporated into the release build; this does not indicate a new merge into the upstream beta branch. Thank you for the contribution. |
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The eBook reader only ever offered the 21 built-in voices, all English or Arabic, so no other language could be selected. It now loads the full, 300+ voices across 75 locales.
Why
kothok-edge-ttsreads the voice list response until the socket closes and lets the read error escape:Microsoft closes the connection without a TLS
close_notify, so rustls reportsUnexpectedEofrather than a cleanOk(0).list_voices()fails every single time even though the body already arrived intact, and the reader silently keeps its built-in table.I checked the endpoint directly with the same token and parameters: HTTP 200, 167 KB, 322 voices across 75 locales, italian included. So nothing is wrong with the request itself, only with how the response is read.
The fix belongs upstream, but 0.2.10 is the newest release and the crate is unchanged since July, so this works around it on our side: fetch the list with reqwest, which ends the body on
Content-length, and keep the crate call as a fallback if the direct fetch fails or comes back empty.Two things worth flagging for review:
TRUSTED_CLIENT_TOKENandSEC_MS_GEC_VERSIONhad to be redeclared here because the arepub(crate)in the crate. They are public protocol constants, identical in every edge-tts implementation, but it is duplication.sec_ms_gec()is re-exported by the crate but marked#[doc(hidden)], so it works yet is not guaranteed API.http_client_builderbecomespub(crate)so the shared timeouts and pool settings are reused instead of duplicated.Verification
cargo check --manifest-path src-tauri/Cargo.toml- clean, no new warnings (17 before and after, all pre-existing elsewhere)cargo test --manifest-path src-tauri/Cargo.toml- 180 passed, 0 failed, 2 ignoredPlatform Impact
Verified on Linux (WebKitGTK). The change sits in the shared HTTP path rather than in anything platform-specific, so it should behave the same everywhere.
The crate fallback keeps the previous behaviour if the direct fetch ever fails.
Checklist
vp checkfor the changed files. (n/a, Rust only)vp run typecheckafter TypeScript changes. (n/a, no TypeScript)