Skip to content

Pass through the voice pack list and packages for the app's Language page - #261

Open
virtitnerd wants to merge 1 commit into
Python-roborock:mainfrom
virtitnerd:work/voice-packages
Open

virtitnerd wants to merge 1 commit into
Python-roborock:mainfrom
virtitnerd:work/voice-packages

Conversation

@virtitnerd

@virtitnerd virtitnerd commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What and why The official app's voice Language page lists the robot's voice packs and installs one by sending the robot a package URL. With the robot on the local server, the app's list request and the robot's download both go to cloud hosts that the local setup either answers with nothing or does not resolve, so the page is empty and no pack can be installed. This PR lets the server fetch the list from Roborock, point every package URL at itself, and serve the packages to the robot. ### How it works - GET /voice-pkg/info?model=<model> maps the model to the plugin's product bucket (for example roborock.vacuum.a245 to beryllite) and builds the same info path the official plugin uses (/app/<bucket>/voice-pkg/info, the older /<bucket>/app/voice-pkg/info layout for four buckets, and debug/ for v2 to v5 models). The model to bucket table comes from the plugin's device configs. An unknown model gets a 404. - The plugin's own path (/app/<bucket>/voice-pkg/info, with or without debug/) is answered the same way, so a request that reaches the server under the cloud path also works. - The list is fetched from the region's app host first (us-app.roborock.com, eu-app.roborock.com, cn-app.roborock.com), then the region's FDS host, in the order of the plugin's areaServerMap. For the a245 the list is only on the app host; the FDS host does not have it. - Each voice_pkg_url in voice_list, special_voice_list and factory_test_list is rewritten to <api_url>/voice-pkg/files/<host>/<path>.pkg, using the host the list came from (the plugin rehosts the package path the same way). The original is kept in voice_pkg_source_url, and voice_pkg_md5 is left as is. - GET /voice-pkg/files/<host>/<path>.pkg downloads the package from that host once, stores it under <runtime_dir>/voice_pkg_cache/, and serves it to the robot from there afterwards. - This hooks into dispatch_plugin_zip_request: a path that is not a plugin zip is offered to the voice handler. Upstream failures become the existing 502 response with route voice_pkg_proxy. ### Safety - Allowed hosts only. The list is fetched only from the fixed per-region hosts above. Packages are fetched only from the three Roborock app hosts or *.fds.api.xiaomi.com / *.fds.api.mi-img.com, and the path must contain /voice-pkg/, end in .pkg and not contain ... Anything else gets a 403 without a request upstream. Redirects are not followed, so an allowed host cannot send the server somewhere else. - Size cap. Lists over 2 MB and packages over 64 MB are refused and not cached. A declared Content-Length over the cap is refused before reading, and the body is read in chunks that stop at the cap. - Loop guard. Upstream requests carry X-RR-Voice-Proxy: 1. If DNS sends the cloud host back to this server, the request with that header gets a 508 instead of being fetched again. - Cache. Packages are cached by source URL and written through a temp file, so a failed download leaves nothing behind. The last good list is kept per path and served (header X-RR-Voice-Cache: stale) when every upstream host fails. Responses carry X-RR-Voice-Cache: hit, miss or stale. - A failure answers 502 with voice_pkg_proxy_failed (the plugin proxy keeps plugin_proxy_failed). - Like the existing plugin zip proxy, the routes are unauthenticated, and the upstream requests send no account data (no token, no cookies, only a generic User-Agent). ### Testing - New tests/test_voice_pkg_routes.py: model to path mapping (including the ppscouple, rubysc1 and rubyse special cases and an unknown model), list fetched from the region host with URLs rewritten to this server, fallback to the FDS host and then to the cached copy, 502 with no upstream, 404 for an unknown model, a package proxied once and then served from the cache, a package from an unknown host refused, the loop guard, a redirect not followed, and the size cap enforced while streaming and from Content-Length. Full suite on this branch: 468 passed. - Live on 2026-11-14 with a Qrevo Curv 2 Flow (roborock.vacuum.a245): - The official app reads https://us-app.roborock.com/app/beryllite/voice-pkg/info. Through this route the server returned more than 20 packs with the URLs rewritten to <api_url>/voice-pkg/files/.... - The German pack (5.7 MB) downloaded through the server, and its md5 matched the list. - The robot accepted dnld_install_sound with the server URL, reported progress 100, state 3 and sid_in_use 103 within about 4 seconds, and then switched back to English (sid 3) the same way. ### Related LocalRock PR: DonSidro/LocalRock#119 (the app side of the Language page).

…page

GET /voice-pkg/info?model=<model> (and the plugin's own
/app/<bucket>/voice-pkg/info path) fetches the official plugin's voice
pack info file from the region's cosHost, falling back to its FDS host,
and serves the last good copy when both fail. Each voice_pkg_url is
rewritten to /voice-pkg/files/<host>/<path>.pkg on this server, which
downloads the pack once, caches it, and serves it to the robot, so the
robot never needs to reach the cloud host itself.

Model to bucket follows the plugin's device configs. Upstream requests
carry X-RR-Voice-Proxy so a DNS loop back to this server answers 508
instead of recursing. Only allowlisted Roborock and Xiaomi FDS hosts
are fetched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Lash-L Lash-L added area: official-app Official Roborock Android/iOS apps, login and plugins. feature PR adding capability; under this two-type scheme also covers additive documentation. labels Nov 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: official-app Official Roborock Android/iOS apps, login and plugins. feature PR adding capability; under this two-type scheme also covers additive documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants