fix #616: make ?key and /r work in uri

This commit is contained in:
rustdesk 2023-12-03 22:18:11 +08:00
parent 9d0f8d9886
commit 7fe58afa9c

View File

@ -1994,15 +1994,30 @@ List<String>? urlLinkToCmdArgs(Uri uri) {
} }
return null; return null;
} }
} else if (uri.authority.length > 2 && uri.path.length <= 1) { } else if (uri.authority.length > 2 &&
(uri.path.length <= 1 ||
(uri.path == '/r' || uri.path.startsWith('/r@')))) {
// rustdesk://<connect-id> // rustdesk://<connect-id>
// rustdesk://<connect-id>/r
// rustdesk://<connect-id>/r@<server>
command = '--connect'; command = '--connect';
id = uri.authority; id = uri.authority;
if (uri.path.length > 1) {
id = id + uri.path;
}
}
var key = uri.queryParameters["key"];
if (id != null) {
if (key != null) {
id = "$id?key=$key";
}
} }
if (isMobile) { if (isMobile) {
if (id != null) { if (id != null) {
connect(Get.context!, id); final forceRelay = uri.queryParameters["relay"] != null;
connect(Get.context!, id, forceRelay: forceRelay);
return null; return null;
} }
} }
@ -2049,6 +2064,7 @@ connect(
bool isFileTransfer = false, bool isFileTransfer = false,
bool isTcpTunneling = false, bool isTcpTunneling = false,
bool isRDP = false, bool isRDP = false,
bool forceRelay = false,
}) async { }) async {
if (id == '') return; if (id == '') return;
if (!isDesktop || desktopType == DesktopType.main) { if (!isDesktop || desktopType == DesktopType.main) {
@ -2066,7 +2082,7 @@ connect(
id = id.replaceAll(' ', ''); id = id.replaceAll(' ', '');
final oldId = id; final oldId = id;
id = await bind.mainHandleRelayId(id: id); id = await bind.mainHandleRelayId(id: id);
final forceRelay = id != oldId; final forceRelay2 = id != oldId || forceRelay;
assert(!(isFileTransfer && isTcpTunneling && isRDP), assert(!(isFileTransfer && isTcpTunneling && isRDP),
"more than one connect type"); "more than one connect type");
@ -2077,7 +2093,7 @@ connect(
isFileTransfer: isFileTransfer, isFileTransfer: isFileTransfer,
isTcpTunneling: isTcpTunneling, isTcpTunneling: isTcpTunneling,
isRDP: isRDP, isRDP: isRDP,
forceRelay: forceRelay, forceRelay: forceRelay2,
); );
} else { } else {
await rustDeskWinManager.call(WindowType.Main, kWindowConnect, { await rustDeskWinManager.call(WindowType.Main, kWindowConnect, {