switch sides: linux dbus use uri as para like uni_links

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-01-18 13:54:56 +08:00
parent c25796e44d
commit b7844d1175
8 changed files with 45 additions and 38 deletions

View File

@@ -1261,23 +1261,28 @@ StreamSubscription? listenUniLinks() {
/// Returns true if we successfully handle the startup arguments.
bool checkArguments() {
// bootArgs:[--connect, 362587269, --switch_uuid, e3d531cc-5dce-41e0-bd06-5d4a2b1eec05]
// check connect args
final connectIndex = bootArgs.indexOf("--connect");
if (connectIndex == -1) {
return false;
}
String? arg =
String? id =
bootArgs.length < connectIndex + 1 ? null : bootArgs[connectIndex + 1];
if (arg != null) {
if (arg.startsWith(kUniLinksPrefix)) {
return parseRustdeskUri(arg);
final switchUuidIndex = bootArgs.indexOf("--switch_uuid");
String? switchUuid = bootArgs.length < switchUuidIndex + 1
? null
: bootArgs[switchUuidIndex + 1];
if (id != null) {
if (id.startsWith(kUniLinksPrefix)) {
return parseRustdeskUri(id);
} else {
// remove "--connect xxx" in the `bootArgs` array
bootArgs.removeAt(connectIndex);
bootArgs.removeAt(connectIndex);
// fallback to peer id
Future.delayed(Duration.zero, () {
rustDeskWinManager.newRemoteDesktop(arg);
rustDeskWinManager.newRemoteDesktop(id, switch_uuid: switchUuid);
});
return true;
}

View File

@@ -544,7 +544,7 @@ void setPasswordDialog() async {
final p1 = TextEditingController(text: pw);
var errMsg0 = "";
var errMsg1 = "";
final RxString rxPass = p0.text.obs;
final RxString rxPass = pw.trim().obs;
final rules = [
DigitValidationRule(),
UppercaseValidationRule(),
@@ -603,7 +603,7 @@ void setPasswordDialog() async {
controller: p0,
focusNode: FocusNode()..requestFocus(),
onChanged: (value) {
rxPass.value = value;
rxPass.value = value.trim();
},
),
),

View File

@@ -184,13 +184,9 @@ class FfiModel with ChangeNotifier {
} else if (name == 'update_privacy_mode') {
updatePrivacyMode(evt, peerId);
} else if (name == 'new_connection') {
var arg = evt['peer_id'].toString();
if (arg.startsWith(kUniLinksPrefix)) {
parseRustdeskUri(arg);
} else {
Future.delayed(Duration.zero, () {
rustDeskWinManager.newRemoteDesktop(arg);
});
var uni_links = evt['uni_links'].toString();
if (uni_links.startsWith(kUniLinksPrefix)) {
parseRustdeskUri(uni_links);
}
} else if (name == 'alias') {
handleAliasChanged(evt);