|
@@ -7,6 +7,13 @@ use crate::client::request_texture;
|
|
|
pub struct User {
|
|
|
pub finger: String,
|
|
|
pub avatar: Texture2D,
|
|
|
+ pub avatar_link: String,
|
|
|
+}
|
|
|
+
|
|
|
+impl User {
|
|
|
+ pub async fn request_texture(&mut self) {
|
|
|
+ self.avatar = request_texture(&self.avatar_link).unwrap_or_else(|_| no_avatar());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
pub struct UserCache {
|
|
@@ -32,17 +39,11 @@ impl UserCache {
|
|
|
if !res.finger_exists(&acc.acct) {
|
|
|
res.users.push(User {
|
|
|
finger: acc.acct.clone(),
|
|
|
- avatar: request_texture(&acc.avatar_static).unwrap_or_else(|_| no_avatar()),
|
|
|
+ avatar: no_avatar(),
|
|
|
+ avatar_link: acc.avatar_static.clone(),
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- res.users.push(User {
|
|
|
- finger: "@houkime@mastodon.technology".to_string(),
|
|
|
- avatar: Texture2D::from_file_with_format(
|
|
|
- include_bytes!("../h.png"),
|
|
|
- Some(ImageFormat::Png),
|
|
|
- ),
|
|
|
- });
|
|
|
return res;
|
|
|
}
|
|
|
}
|