Fetch banners from the web into the image cache
The host banner (virtualserver_hostbanner_gfx_url) and TeamSpeak 6 channel banners are http(s) addresses on any host, not files on the server, so the voice file transfer that fetches avatars and icons cannot get them. A new engine path (web.rs) downloads them with the workspace's reqwest client (rustls, system proxies and certificate store) into the same cache, keyed by the MD5 of the address (pictures/<md5>), only for http and https, at most 4 MiB, with a 10 s connect and 30 s overall timeout, and keeps a download only if its content is a picture the UI decodes (PNG, JPEG, GIF, WebP, SVG), whatever the address or the server say; an error page is not cached as a banner. The session fetches the banners of the presence it shows, from any source, when cache.fetch_images allows (it contacts hosts the server chose, as the official client does), and reports each as PictureReady. When the server sets virtualserver_hostbanner_gfx_interval, a timer asks the session to fetch the host banner again (never more often than once a minute, as TeamSpeak 3 and 6 servers enforce) and the new file replaces the old one; Cache::fetch takes `fresh` for that. Tests: a local HTTP server on 127.0.0.1 for the download, the size cap (announced and unannounced), refused pages and the cache; the cache keys; a live test that sets both banners on the TeamSpeak 6 dev server through ServerQuery, sees them arrive and puts the server back. voelinctl engine prints the pictures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
04a6d1f931
commit
1318a9db3b
8 files changed
+486
-16
No files matched your search
Generated
+1
@@ -9480,6 +9480,7 @@ dependencies = [
|
||||
"futures",
|
||||
"hickory-resolver",
|
||||
"md5",
|
||||
"reqwest",
|
||||
"rusqlite",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
||||
Reference in new issue
Block a user