mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
@@ -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;
|
||||
}
|
||||
@@ -1307,8 +1312,10 @@ bool callUniLinksUriHandler(Uri uri) {
|
||||
// new connection
|
||||
if (uri.authority == "connection" && uri.path.startsWith("/new/")) {
|
||||
final peerId = uri.path.substring("/new/".length);
|
||||
var param = uri.queryParameters;
|
||||
String? switch_uuid = param["switch_uuid"];
|
||||
Future.delayed(Duration.zero, () {
|
||||
rustDeskWinManager.newRemoteDesktop(peerId);
|
||||
rustDeskWinManager.newRemoteDesktop(peerId, switch_uuid: switch_uuid);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
@@ -1606,3 +1613,7 @@ Widget dialogButton(String text,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
int version_cmp(String v1, String v2) {
|
||||
return bind.versionToNumber(v: v1) - bind.versionToNumber(v: v2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user