An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
default shared password (#12868)
21pages5c9b4abab2ed
diff --git a/flutter/lib/common/hbbs/hbbs.dart b/flutter/lib/common/hbbs/hbbs.dartindex 97baf546a..4fa985427 100644--- a/flutter/lib/common/hbbs/hbbs.dart+++ b/flutter/lib/common/hbbs/hbbs.dart@@ -248,15 +248,17 @@ class AbProfile {String name;String owner;String? note;+ dynamic info;int rule;- AbProfile(this.guid, this.name, this.owner, this.note, this.rule);+ AbProfile(this.guid, this.name, this.owner, this.note, this.rule, this.info);AbProfile.fromJson(Map<String, dynamic> json): guid = json['guid'] ?? '',name = json['name'] ?? '',owner = json['owner'] ?? '',note = json['note'] ?? '',+ info = json['info'],rule = json['rule'] ?? 0;}diff --git a/flutter/lib/common/widgets/peer_card.dart b/flutter/lib/common/widgets/peer_card.dartindex db9f7af00..5cc8dc862 100644--- a/flutter/lib/common/widgets/peer_card.dart+++ b/flutter/lib/common/widgets/peer_card.dart@@ -1491,6 +1491,13 @@ void connectInPeerTab(BuildContext context, Peer peer, PeerTabIndex tab,password = peer.password;isSharedPassword = true;}+ if (password.isEmpty) {+ final abPassword = gFFI.abModel.getdefaultSharedPassword();+ if (abPassword != null) {+ password = abPassword;+ isSharedPassword = true;+ }+ }}}connect(context, peer.id,diff --git a/flutter/lib/models/ab_model.dart b/flutter/lib/models/ab_model.dartindex 355e2fdab..4eb200004 100644--- a/flutter/lib/models/ab_model.dart+++ b/flutter/lib/models/ab_model.dart@@ -140,7 +140,7 @@ class AbModel {debugPrint("pull ab list");List<AbProfile> abProfiles = List.empty(growable: true);abProfiles.add(AbProfile(_personalAbGuid!, _personalAddressBookName,- gFFI.userModel.userName.value, null, ShareRule.read.value));+ gFFI.userModel.userName.value, null, ShareRule.read.value, null));// get all address book nameawait _getSharedAbProfiles(abProfiles);addressbooks.removeWhere((key, value) =>@@ -609,7 +609,7 @@ class AbModel {if (name == null || guid == null) {continue;}- ab = Ab(AbProfile(guid, name, '', '', ShareRule.read.value),+ ab = Ab(AbProfile(guid, name, '', '', ShareRule.read.value, null),name == _personalAddressBookName);}addressbooks[name] = ab;@@ -767,6 +767,28 @@ class AbModel {_peerIdUpdateListeners.remove(key);}+ String? getdefaultSharedPassword() {+ if (current.isPersonal()) {+ return null;+ }+ final profile = current.sharedProfile();+ if (profile == null) {+ return null;+ }+ try {+ if (profile.info is Map) {+ final password = (profile.info as Map)['password'];+ if (password is String && password.isNotEmpty) {+ return password;+ }+ }+ return null;+ } catch (e) {+ debugPrint("getdefaultSharedPassword: $e");+ return null;+ }+ }+// #endregion}