diff --git a/flutter/lib/common/hbbs/hbbs.dart b/flutter/lib/common/hbbs/hbbs.dart index aab8ba597..f3b210184 100644 --- a/flutter/lib/common/hbbs/hbbs.dart +++ b/flutter/lib/common/hbbs/hbbs.dart @@ -25,6 +25,7 @@ enum UserStatus { kDisabled, kNormal, kUnverified } // Is all the fields of the user needed? class UserPayload { String name = ''; + String displayName = ''; String email = ''; String note = ''; String? verifier; @@ -33,6 +34,7 @@ class UserPayload { UserPayload.fromJson(Map json) : name = json['name'] ?? '', + displayName = json['display_name'] ?? '', email = json['email'] ?? '', note = json['note'] ?? '', verifier = json['verifier'], @@ -46,6 +48,7 @@ class UserPayload { Map toJson() { final Map map = { 'name': name, + 'display_name': displayName, 'status': status == UserStatus.kDisabled ? 0 : status == UserStatus.kUnverified @@ -58,9 +61,14 @@ class UserPayload { Map toGroupCacheJson() { final Map map = { 'name': name, + 'display_name': displayName, }; return map; } + + String get displayNameOrName { + return displayName.trim().isEmpty ? name : displayName; + } } class PeerPayload { diff --git a/flutter/lib/common/widgets/my_group.dart b/flutter/lib/common/widgets/my_group.dart index 6207a7363..74ce34e71 100644 --- a/flutter/lib/common/widgets/my_group.dart +++ b/flutter/lib/common/widgets/my_group.dart @@ -158,12 +158,18 @@ class _MyGroupState extends State { return Obx(() { final userItems = gFFI.groupModel.users.where((p0) { if (searchAccessibleItemNameText.isNotEmpty) { - return p0.name - .toLowerCase() - .contains(searchAccessibleItemNameText.value.toLowerCase()); + final search = searchAccessibleItemNameText.value.toLowerCase(); + return p0.name.toLowerCase().contains(search) || + p0.displayNameOrName.toLowerCase().contains(search); } return true; }).toList(); + // Count occurrences of each displayNameOrName to detect duplicates + final displayNameCount = {}; + for (final u in userItems) { + final dn = u.displayNameOrName; + displayNameCount[dn] = (displayNameCount[dn] ?? 0) + 1; + } final deviceGroupItems = gFFI.groupModel.deviceGroups.where((p0) { if (searchAccessibleItemNameText.isNotEmpty) { return p0.name @@ -177,7 +183,8 @@ class _MyGroupState extends State { itemCount: deviceGroupItems.length + userItems.length, itemBuilder: (context, index) => index < deviceGroupItems.length ? _buildDeviceGroupItem(deviceGroupItems[index]) - : _buildUserItem(userItems[index - deviceGroupItems.length])); + : _buildUserItem(userItems[index - deviceGroupItems.length], + displayNameCount)); var maxHeight = max(MediaQuery.of(context).size.height / 6, 100.0); return Obx(() => stateGlobal.isPortrait.isFalse ? listView(false) @@ -185,8 +192,14 @@ class _MyGroupState extends State { }); } - Widget _buildUserItem(UserPayload user) { + Widget _buildUserItem(UserPayload user, Map displayNameCount) { final username = user.name; + final dn = user.displayNameOrName; + final isDuplicate = (displayNameCount[dn] ?? 0) > 1; + final displayName = + isDuplicate && user.displayName.trim().isNotEmpty + ? '${user.displayName} (@$username)' + : dn; return InkWell(onTap: () { isSelectedDeviceGroup.value = false; if (selectedAccessibleItemName.value != username) { @@ -222,14 +235,14 @@ class _MyGroupState extends State { alignment: Alignment.center, child: Center( child: Text( - username.characters.first.toUpperCase(), + displayName.characters.first.toUpperCase(), style: TextStyle(color: Colors.white), textAlign: TextAlign.center, ), ), ), ).marginOnly(right: 4), - if (isMe) Flexible(child: Text(username)), + if (isMe) Flexible(child: Text(displayName)), if (isMe) Flexible( child: Container( @@ -246,7 +259,7 @@ class _MyGroupState extends State { ), ), ), - if (!isMe) Expanded(child: Text(username)), + if (!isMe) Expanded(child: Text(displayName)), ], ).paddingSymmetric(vertical: 4), ), diff --git a/flutter/lib/common/widgets/peers_view.dart b/flutter/lib/common/widgets/peers_view.dart index d81a095ca..5be5af272 100644 --- a/flutter/lib/common/widgets/peers_view.dart +++ b/flutter/lib/common/widgets/peers_view.dart @@ -570,11 +570,14 @@ class MyGroupPeerView extends BasePeersView { static bool filter(Peer peer) { final model = gFFI.groupModel; if (model.searchAccessibleItemNameText.isNotEmpty) { - final text = model.searchAccessibleItemNameText.value; - final searchPeersOfUser = peer.loginName.contains(text) && - model.users.any((user) => user.name == peer.loginName); - final searchPeersOfDeviceGroup = peer.device_group_name.contains(text) && - model.deviceGroups.any((g) => g.name == peer.device_group_name); + final text = model.searchAccessibleItemNameText.value.toLowerCase(); + final searchPeersOfUser = model.users.any((user) => + user.name == peer.loginName && + (user.name.toLowerCase().contains(text) || + user.displayNameOrName.toLowerCase().contains(text))); + final searchPeersOfDeviceGroup = + peer.device_group_name.toLowerCase().contains(text) && + model.deviceGroups.any((g) => g.name == peer.device_group_name); if (!searchPeersOfUser && !searchPeersOfDeviceGroup) { return false; } diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index b26d909cb..3314d82ab 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -2016,7 +2016,9 @@ class _AccountState extends State<_Account> { Widget accountAction() { return Obx(() => _Button( - gFFI.userModel.userName.value.isEmpty ? 'Login' : 'Logout', + gFFI.userModel.userName.value.isEmpty + ? 'Login' + : '${translate('Logout')} (${gFFI.userModel.accountLabelWithHandle})', () => { gFFI.userModel.userName.value.isEmpty ? loginDialog() @@ -2037,6 +2039,10 @@ class _AccountState extends State<_Account> { offstage: gFFI.userModel.userName.value.isEmpty, child: Column( children: [ + if (gFFI.userModel.displayName.value.trim().isNotEmpty && + gFFI.userModel.displayName.value.trim() != + gFFI.userModel.userName.value.trim()) + text('Display Name', gFFI.userModel.displayName.value.trim()), text('Username', gFFI.userModel.userName.value), // text('Group', gFFI.groupModel.groupName.value), ], @@ -2130,7 +2136,9 @@ class _PluginState extends State<_Plugin> { Widget accountAction() { return Obx(() => _Button( - gFFI.userModel.userName.value.isEmpty ? 'Login' : 'Logout', + gFFI.userModel.userName.value.isEmpty + ? 'Login' + : '${translate('Logout')} (${gFFI.userModel.accountLabelWithHandle})', () => { gFFI.userModel.userName.value.isEmpty ? loginDialog() diff --git a/flutter/lib/mobile/pages/settings_page.dart b/flutter/lib/mobile/pages/settings_page.dart index c2e2ef57d..afd3422d7 100644 --- a/flutter/lib/mobile/pages/settings_page.dart +++ b/flutter/lib/mobile/pages/settings_page.dart @@ -688,7 +688,7 @@ class _SettingsState extends State with WidgetsBindingObserver { SettingsTile( title: Obx(() => Text(gFFI.userModel.userName.value.isEmpty ? translate('Login') - : '${translate('Logout')} (${gFFI.userModel.userName.value})')), + : '${translate('Logout')} (${gFFI.userModel.accountLabelWithHandle})')), leading: Icon(Icons.person), onPressed: (context) { if (gFFI.userModel.userName.value.isEmpty) { diff --git a/flutter/lib/models/user_model.dart b/flutter/lib/models/user_model.dart index 217d74aee..c850c4cf6 100644 --- a/flutter/lib/models/user_model.dart +++ b/flutter/lib/models/user_model.dart @@ -16,9 +16,23 @@ bool refreshingUser = false; class UserModel { final RxString userName = ''.obs; + final RxString displayName = ''.obs; final RxBool isAdmin = false.obs; final RxString networkError = ''.obs; bool get isLogin => userName.isNotEmpty; + String get displayNameOrUserName => + displayName.value.trim().isEmpty ? userName.value : displayName.value; + String get accountLabelWithHandle { + final username = userName.value.trim(); + if (username.isEmpty) { + return ''; + } + final preferred = displayName.value.trim(); + if (preferred.isEmpty || preferred == username) { + return username; + } + return '$preferred (@$username)'; + } WeakReference parent; UserModel(this.parent) { @@ -98,7 +112,8 @@ class UserModel { _updateLocalUserInfo() { final userInfo = getLocalUserInfo(); if (userInfo != null) { - userName.value = userInfo['name']; + userName.value = (userInfo['name'] ?? '').toString(); + displayName.value = (userInfo['display_name'] ?? '').toString(); } } @@ -110,10 +125,12 @@ class UserModel { await gFFI.groupModel.reset(); } userName.value = ''; + displayName.value = ''; } _parseAndUpdateUser(UserPayload user) { userName.value = user.name; + displayName.value = user.displayName; isAdmin.value = user.isAdmin; bind.mainSetLocalOption(key: 'user_info', value: jsonEncode(user)); if (isWeb) { diff --git a/libs/hbb_common b/libs/hbb_common index da339dca6..0b60b9ffa 160000 --- a/libs/hbb_common +++ b/libs/hbb_common @@ -1 +1 @@ -Subproject commit da339dca64ecae3273838c0a1395c7fe2f1a1016 +Subproject commit 0b60b9ffa05259f72cd33e79010ef8e15d42b851 diff --git a/res/msi/preprocess.py b/res/msi/preprocess.py index cb2140d21..c590549f4 100644 --- a/res/msi/preprocess.py +++ b/res/msi/preprocess.py @@ -336,7 +336,9 @@ def gen_custom_ARPSYSTEMCOMPONENT_True(args, dist_dir): f'{indent}\n' ) - estimated_size = get_folder_size(dist_dir) + # EstimatedSize in uninstall registry must be in KB. + estimated_size_bytes = get_folder_size(dist_dir) + estimated_size = max(1, (estimated_size_bytes + 1023) // 1024) lines_new.append( f'{indent}\n' ) diff --git a/src/client.rs b/src/client.rs index a7b681ee1..cb4ed3a24 100644 --- a/src/client.rs +++ b/src/client.rs @@ -2630,10 +2630,13 @@ impl LoginConfigHandler { display_name = serde_json::from_str::(&LocalConfig::get_option("user_info")) .map(|x| { - x.get("name") - .map(|x| x.as_str().unwrap_or_default()) + x.get("display_name") + .and_then(|x| x.as_str()) + .map(|x| x.trim()) + .filter(|x| !x.is_empty()) + .or_else(|| x.get("name").and_then(|x| x.as_str())) + .map(|x| x.to_owned()) .unwrap_or_default() - .to_owned() }) .unwrap_or_default(); } diff --git a/src/hbbs_http/account.rs b/src/hbbs_http/account.rs index 6bdef6f06..6644aee28 100644 --- a/src/hbbs_http/account.rs +++ b/src/hbbs_http/account.rs @@ -80,6 +80,8 @@ pub enum UserStatus { pub struct UserPayload { pub name: String, #[serde(default)] + pub display_name: Option, + #[serde(default)] pub email: Option, #[serde(default)] pub note: Option, @@ -268,7 +270,12 @@ impl OidcSession { ); LocalConfig::set_option( "user_info".to_owned(), - serde_json::json!({ "name": auth_body.user.name, "status": auth_body.user.status }).to_string(), + serde_json::json!({ + "name": auth_body.user.name, + "display_name": auth_body.user.display_name, + "status": auth_body.user.status + }) + .to_string(), ); } } diff --git a/src/lang/ar.rs b/src/lang/ar.rs index 65853847a..fc1f79c38 100644 --- a/src/lang/ar.rs +++ b/src/lang/ar.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "متابعة مع {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/be.rs b/src/lang/be.rs index 0b8492e9c..a7656782d 100644 --- a/src/lang/be.rs +++ b/src/lang/be.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Працягнуць з {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/bg.rs b/src/lang/bg.rs index 986b7b1fb..3036e31b2 100644 --- a/src/lang/bg.rs +++ b/src/lang/bg.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Продължи с {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ca.rs b/src/lang/ca.rs index 3a7d5498e..05a7e7899 100644 --- a/src/lang/ca.rs +++ b/src/lang/ca.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Continua amb {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 516015390..5cb228a6e 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "使用 {} 登录"), + ("Display Name", "显示名称"), ].iter().cloned().collect(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 497af5cf1..944ee4b95 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Pokračovat s {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index 6505f2bdf..8140fcaec 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Fortsæt med {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index 5ada5b270..a518dd3c3 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", "Bildschirm während ausgehender Sitzungen aktiv halten"), ("keep-awake-during-incoming-sessions-label", "Bildschirm während eingehender Sitzungen aktiv halten"), ("Continue with {}", "Fortfahren mit {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/el.rs b/src/lang/el.rs index 1542a8ee1..8b02c3c89 100644 --- a/src/lang/el.rs +++ b/src/lang/el.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Συνέχεια με {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index 303fc45a8..3d6b6924f 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", ""), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index bceff6a56..8ad0c4cab 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Continuar con {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/et.rs b/src/lang/et.rs index 4d87490ac..def665ec5 100644 --- a/src/lang/et.rs +++ b/src/lang/et.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Jätka koos {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/eu.rs b/src/lang/eu.rs index ba0979fe7..2454dcb8a 100644 --- a/src/lang/eu.rs +++ b/src/lang/eu.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "{} honekin jarraitu"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fa.rs b/src/lang/fa.rs index 5fe019444..52be56c81 100644 --- a/src/lang/fa.rs +++ b/src/lang/fa.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "ادامه با {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fi.rs b/src/lang/fi.rs index 59f25538b..0d9b42ddd 100644 --- a/src/lang/fi.rs +++ b/src/lang/fi.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Jatka käyttäen {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index 9637233aa..1d54448c9 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", "Maintenir l’écran allumé lors des sessions sortantes"), ("keep-awake-during-incoming-sessions-label", "Maintenir l’écran allumé lors des sessions entrantes"), ("Continue with {}", "Continuer avec {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ge.rs b/src/lang/ge.rs index ffb9e351d..10b5e7f27 100644 --- a/src/lang/ge.rs +++ b/src/lang/ge.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "{}-ით გაგრძელება"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/he.rs b/src/lang/he.rs index 74b93c155..00999708f 100644 --- a/src/lang/he.rs +++ b/src/lang/he.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "המשך עם {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hr.rs b/src/lang/hr.rs index 8232b8635..d00fc56b9 100644 --- a/src/lang/hr.rs +++ b/src/lang/hr.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Nastavi sa {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index c9f5453b9..174cdb28b 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", "Képernyő aktív állapotban tartása a kimenő munkamenetek során"), ("keep-awake-during-incoming-sessions-label", "Képernyő aktív állapotban tartása a bejövő munkamenetek során"), ("Continue with {}", "Folytatás a következővel: {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index f7498dd99..f898c8bc4 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Lanjutkan dengan {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index eabfac559..28edb0e8a 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", "Mantieni lo schermo attivo durante le sessioni in uscita"), ("keep-awake-during-incoming-sessions-label", "Mantieni lo schermo attivo durante le sessioni in ingresso"), ("Continue with {}", "Continua con {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ja.rs b/src/lang/ja.rs index c89899469..e033de3b3 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "{} で続行"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ko.rs b/src/lang/ko.rs index d860af5ab..1e3d4f9b8 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", "발신 세션 중 화면 켜짐 유지"), ("keep-awake-during-incoming-sessions-label", "수신 세션 중 화면 켜짐 유지"), ("Continue with {}", "{}(으)로 계속"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/kz.rs b/src/lang/kz.rs index eaa0bb34d..c3715672d 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", ""), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/lt.rs b/src/lang/lt.rs index 18080ee77..91c76291a 100644 --- a/src/lang/lt.rs +++ b/src/lang/lt.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Tęsti su {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/lv.rs b/src/lang/lv.rs index 12b90d8f1..0c8ba694e 100644 --- a/src/lang/lv.rs +++ b/src/lang/lv.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Turpināt ar {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/nb.rs b/src/lang/nb.rs index b118a4b7c..9c38fcbb8 100644 --- a/src/lang/nb.rs +++ b/src/lang/nb.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Fortsett med {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/nl.rs b/src/lang/nl.rs index f952a844e..577f7487f 100644 --- a/src/lang/nl.rs +++ b/src/lang/nl.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", "Houd het scherm open tijdens de uitgaande sessies."), ("keep-awake-during-incoming-sessions-label", "Houd het scherm open tijdens de inkomende sessies."), ("Continue with {}", "Ga verder met {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index 6d2185e47..000c05921 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", "Utrzymuj urządzenie w stanie aktywnym podczas sesji wychodzących"), ("keep-awake-during-incoming-sessions-label", "Utrzymuj urządzenie w stanie aktywnym podczas sesji przychodzących"), ("Continue with {}", "Kontynuuj z {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index 6a3e49817..ccbdd574e 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", ""), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index e16f7ba61..a7a2f7db6 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", "Manter tela ativa durante sessões de saída"), ("keep-awake-during-incoming-sessions-label", "Manter tela ativa durante sessões de entrada"), ("Continue with {}", "Continuar com {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ro.rs b/src/lang/ro.rs index 9c21617d7..8917b2a46 100644 --- a/src/lang/ro.rs +++ b/src/lang/ro.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Continuă cu {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index f4ae05e99..344260d34 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", "Не отключать экран во время исходящих сеансов"), ("keep-awake-during-incoming-sessions-label", "Не отключать экран во время входящих сеансов"), ("Continue with {}", "Продолжить с {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sc.rs b/src/lang/sc.rs index 46c4c582e..2eef86908 100644 --- a/src/lang/sc.rs +++ b/src/lang/sc.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Sighi cun {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 85cd17594..0b45d7e12 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Pokračovať s {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sl.rs b/src/lang/sl.rs index 9c7dead43..d8e22a3c4 100755 --- a/src/lang/sl.rs +++ b/src/lang/sl.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Nadaljuj z {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sq.rs b/src/lang/sq.rs index b4f4fb694..b7b7321ab 100644 --- a/src/lang/sq.rs +++ b/src/lang/sq.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Vazhdo me {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sr.rs b/src/lang/sr.rs index a12fc3311..46cb14cdd 100644 --- a/src/lang/sr.rs +++ b/src/lang/sr.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Nastavi sa {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sv.rs b/src/lang/sv.rs index f85e88853..d2d1a3911 100644 --- a/src/lang/sv.rs +++ b/src/lang/sv.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Fortsätt med {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ta.rs b/src/lang/ta.rs index 4f545f055..7e3ae5cd0 100644 --- a/src/lang/ta.rs +++ b/src/lang/ta.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "{} உடன் தொடர்"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index c9aec1a3e..b21f64f14 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", ""), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/th.rs b/src/lang/th.rs index 6d66b44fd..dbfc1096c 100644 --- a/src/lang/th.rs +++ b/src/lang/th.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "ทำต่อด้วย {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 319b631cd..ac8b3d368 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", "Giden oturumlar süresince ekranı açık tutun"), ("keep-awake-during-incoming-sessions-label", "Gelen oturumlar süresince ekranı açık tutun"), ("Continue with {}", "{} ile devam et"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index b66567e43..0e01fcde5 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", "在連出工作階段期間保持螢幕喚醒"), ("keep-awake-during-incoming-sessions-label", "在連入工作階段期間保持螢幕喚醒"), ("Continue with {}", "使用 {} 登入"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/uk.rs b/src/lang/uk.rs index bf95a02f7..b49b2e5ae 100644 --- a/src/lang/uk.rs +++ b/src/lang/uk.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Продовжити з {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/lang/vi.rs b/src/lang/vi.rs index 1e64c6234..8f5888509 100644 --- a/src/lang/vi.rs +++ b/src/lang/vi.rs @@ -739,5 +739,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("keep-awake-during-outgoing-sessions-label", ""), ("keep-awake-during-incoming-sessions-label", ""), ("Continue with {}", "Tiếp tục với {}"), + ("Display Name", ""), ].iter().cloned().collect(); } diff --git a/src/ui/index.tis b/src/ui/index.tis index 09aa0c306..d4934ba0b 100644 --- a/src/ui/index.tis +++ b/src/ui/index.tis @@ -358,6 +358,22 @@ function getUserName() { return ''; } +function getAccountLabelWithHandle() { + try { + var user = JSON.parse(handler.get_local_option("user_info")); + var username = (user.name || '').trim(); + if (!username) { + return ''; + } + var displayName = (user.display_name || '').trim(); + if (!displayName || displayName == username) { + return username; + } + return displayName + " (@" + username + ")"; + } catch(e) {} + return ''; +} + // Shared dialog functions function open_custom_server_dialog() { var configOptions = handler.get_options(); @@ -493,7 +509,7 @@ class MyIdMenu: Reactor.Component { } function renderPop() { - var username = handler.get_local_option("access_token") ? getUserName() : ''; + var accountLabel = handler.get_local_option("access_token") ? getAccountLabelWithHandle() : ''; return {!disable_settings &&
  • {svg_checkmark}{translate('Enable keyboard/mouse')}
  • } @@ -521,8 +537,8 @@ class MyIdMenu: Reactor.Component { {!disable_settings && } {!disable_settings && false && handler.using_public_server() &&
  • {svg_checkmark}{translate('Always connect via relay')}
  • } {!disable_change_id && handler.is_ok_change_id() ?
    : ""} - {!disable_account && (username ? -
  • {translate('Logout')} ({username})
  • : + {!disable_account && (accountLabel ? +
  • {translate('Logout')} ({accountLabel})
  • :
  • {translate('Login')}
  • )} {!disable_change_id && !disable_settings && handler.is_ok_change_id() && key_confirmed && connect_status > 0 ?
  • {translate('Change ID')}
  • : ""}
    @@ -1430,6 +1446,9 @@ checkConnectStatus(); function set_local_user_info(user) { var user_info = {name: user.name}; + if (user.display_name) { + user_info.display_name = user.display_name; + } if (user.status) { user_info.status = user.status; }