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
27d0d950cb
commit
5f508bcc49
8 files changed
+486
-16
No files matched your search
@@ -476,6 +476,10 @@ impl Runner<'_> {
|
||||
println!("icon {icon} {}", path.display());
|
||||
return Ok(self.expected(&format!("icon {icon}")));
|
||||
}
|
||||
Event::PictureReady { url, path, .. } => {
|
||||
println!("picture {url} {}", path.display());
|
||||
return Ok(self.expected(&format!("picture {url}")));
|
||||
}
|
||||
Event::OfflineMessages { result, .. } => {
|
||||
let list = result.map_err(|e| anyhow::anyhow!("messagelist: {e}"))?;
|
||||
println!("offline inbox n={}", list.len());
|
||||
|
||||
Reference in new issue
Block a user