mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-25 06:01:00 +03:00
refactor avatar display: unify rendering and resolve at use time
- Extract buildAvatarWidget() in common.dart to share avatar rendering
logic across desktop settings, desktop CM and mobile CM
- Add resolve_avatar_url() in Rust, exposed via FFI (SyncReturn),
to resolve relative avatar paths (e.g. "/avatar/xxx") to absolute URLs
- Store avatar as-is in local config, only resolve when displaying
(settings page) or sending (LoginRequest)
- Resolve avatar in LoginRequest before sending to remote peer
- Add error handling for network image load failures
- Guard against empty client.name[0] crash
- Show avatar in mobile settings page account tile
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -34,6 +34,7 @@ class UserModel {
|
||||
}
|
||||
return '$preferred (@$username)';
|
||||
}
|
||||
|
||||
WeakReference<FFI> parent;
|
||||
|
||||
UserModel(this.parent) {
|
||||
@@ -88,7 +89,6 @@ class UserModel {
|
||||
}
|
||||
|
||||
final user = UserPayload.fromJson(data);
|
||||
user.avatar = _resolveAvatar(user.avatar, url);
|
||||
_parseAndUpdateUser(user);
|
||||
} catch (e) {
|
||||
debugPrint('Failed to refreshCurrentUser: $e');
|
||||
@@ -138,7 +138,6 @@ class UserModel {
|
||||
avatar.value = user.avatar;
|
||||
isAdmin.value = user.isAdmin;
|
||||
bind.mainSetLocalOption(key: 'user_info', value: jsonEncode(user));
|
||||
_updateLocalUserInfo();
|
||||
if (isWeb) {
|
||||
// ugly here, tmp solution
|
||||
bind.mainSetLocalOption(key: 'verifier', value: user.verifier ?? '');
|
||||
|
||||
Reference in New Issue
Block a user