mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-23 19:49:05 +08:00
A=b, A case insensitive (#9976)
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
parent
d4cb7d68c5
commit
bc211c8031
@ -2245,7 +2245,10 @@ List<String>? urlLinkToCmdArgs(Uri uri) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var key = uri.queryParameters["key"];
|
var queryParameters =
|
||||||
|
uri.queryParameters.map((k, v) => MapEntry(k.toLowerCase(), v));
|
||||||
|
|
||||||
|
var key = queryParameters["key"];
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
id = "$id?key=$key";
|
id = "$id?key=$key";
|
||||||
@ -2254,7 +2257,7 @@ List<String>? urlLinkToCmdArgs(Uri uri) {
|
|||||||
|
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
final forceRelay = uri.queryParameters["relay"] != null;
|
final forceRelay = queryParameters["relay"] != null;
|
||||||
connect(Get.context!, id, forceRelay: forceRelay);
|
connect(Get.context!, id, forceRelay: forceRelay);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -2264,7 +2267,7 @@ List<String>? urlLinkToCmdArgs(Uri uri) {
|
|||||||
if (command != null && id != null) {
|
if (command != null && id != null) {
|
||||||
args.add(command);
|
args.add(command);
|
||||||
args.add(id);
|
args.add(id);
|
||||||
var param = uri.queryParameters;
|
var param = queryParameters;
|
||||||
String? password = param["password"];
|
String? password = param["password"];
|
||||||
if (password != null) args.addAll(['--password', password]);
|
if (password != null) args.addAll(['--password', password]);
|
||||||
String? switch_uuid = param["switch_uuid"];
|
String? switch_uuid = param["switch_uuid"];
|
||||||
@ -2510,7 +2513,8 @@ Future<void> onActiveWindowChanged() async {
|
|||||||
// embedder.cc (2672): 'FlutterEngineSendPlatformMessage' returned 'kInvalidArguments'. Invalid engine handle.
|
// embedder.cc (2672): 'FlutterEngineSendPlatformMessage' returned 'kInvalidArguments'. Invalid engine handle.
|
||||||
// 2024-11-11 11:41:11.565 RustDesk[90272:2567686] Failed to send message to Flutter engine on channel 'flutter/lifecycle' (2).
|
// 2024-11-11 11:41:11.565 RustDesk[90272:2567686] Failed to send message to Flutter engine on channel 'flutter/lifecycle' (2).
|
||||||
// ```
|
// ```
|
||||||
periodic_immediate(Duration(milliseconds: 30), RdPlatformChannel.instance.terminate);
|
periodic_immediate(
|
||||||
|
Duration(milliseconds: 30), RdPlatformChannel.instance.terminate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -745,10 +745,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: image_picker
|
name: image_picker
|
||||||
sha256: b6951e25b795d053a6ba03af5f710069c99349de9341af95155d52665cb4607c
|
sha256: "021834d9c0c3de46bf0fe40341fa07168407f694d9b2bb18d532dc1261867f7a"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.9"
|
version: "1.1.2"
|
||||||
image_picker_android:
|
image_picker_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -793,10 +793,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image_picker_platform_interface
|
name: image_picker_platform_interface
|
||||||
sha256: fa4e815e6fcada50e35718727d83ba1c92f1edf95c0b4436554cec301b56233b
|
sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.9.3"
|
version: "2.10.0"
|
||||||
image_picker_windows:
|
image_picker_windows:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -46,7 +46,7 @@ dependencies:
|
|||||||
http: ^1.1.0
|
http: ^1.1.0
|
||||||
qr_code_scanner: ^1.0.0
|
qr_code_scanner: ^1.0.0
|
||||||
zxing2: ^0.2.0
|
zxing2: ^0.2.0
|
||||||
image_picker: ^0.8.5
|
image_picker: ^1.1.2
|
||||||
image: ^4.0.17
|
image: ^4.0.17
|
||||||
back_button_interceptor: ^6.0.1
|
back_button_interceptor: ^6.0.1
|
||||||
flutter_rust_bridge: "1.80.1"
|
flutter_rust_bridge: "1.80.1"
|
||||||
|
@ -1408,18 +1408,18 @@ impl LoginConfigHandler {
|
|||||||
let server = server_key.next().unwrap_or_default();
|
let server = server_key.next().unwrap_or_default();
|
||||||
let args = server_key.next().unwrap_or_default();
|
let args = server_key.next().unwrap_or_default();
|
||||||
let key = if server == PUBLIC_SERVER {
|
let key = if server == PUBLIC_SERVER {
|
||||||
PUBLIC_RS_PUB_KEY
|
PUBLIC_RS_PUB_KEY.to_owned()
|
||||||
} else {
|
} else {
|
||||||
let mut args_map: HashMap<&str, &str> = HashMap::new();
|
let mut args_map: HashMap<String, &str> = HashMap::new();
|
||||||
for arg in args.split('&') {
|
for arg in args.split('&') {
|
||||||
if let Some(kv) = arg.find('=') {
|
if let Some(kv) = arg.find('=') {
|
||||||
let k = &arg[0..kv];
|
let k = arg[0..kv].to_lowercase();
|
||||||
let v = &arg[kv + 1..];
|
let v = &arg[kv + 1..];
|
||||||
args_map.insert(k, v);
|
args_map.insert(k, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let key = args_map.remove("key").unwrap_or_default();
|
let key = args_map.remove("key").unwrap_or_default();
|
||||||
key
|
key.to_owned()
|
||||||
};
|
};
|
||||||
|
|
||||||
// here we can check <id>/r@server
|
// here we can check <id>/r@server
|
||||||
@ -1427,7 +1427,7 @@ impl LoginConfigHandler {
|
|||||||
if real_id != raw_id {
|
if real_id != raw_id {
|
||||||
force_relay = true;
|
force_relay = true;
|
||||||
}
|
}
|
||||||
self.other_server = Some((real_id.clone(), server.to_owned(), key.to_owned()));
|
self.other_server = Some((real_id.clone(), server.to_owned(), key));
|
||||||
id = format!("{real_id}@{server}");
|
id = format!("{real_id}@{server}");
|
||||||
} else {
|
} else {
|
||||||
let real_id = crate::ui_interface::handle_relay_id(&id);
|
let real_id = crate::ui_interface::handle_relay_id(&id);
|
||||||
|
@ -56,8 +56,8 @@ pub fn get_custom_server_from_string(s: &str) -> ResultType<CustomServer> {
|
|||||||
*
|
*
|
||||||
* This allows using a ',' (comma) symbol as a final delimiter.
|
* This allows using a ',' (comma) symbol as a final delimiter.
|
||||||
*/
|
*/
|
||||||
if s.contains("host=") {
|
if s.to_lowercase().contains("host=") {
|
||||||
let stripped = &s[s.find("host=").unwrap_or(0)..s.len()];
|
let stripped = &s[s.to_lowercase().find("host=").unwrap_or(0)..s.len()];
|
||||||
let strs: Vec<&str> = stripped.split(",").collect();
|
let strs: Vec<&str> = stripped.split(",").collect();
|
||||||
let mut host = String::default();
|
let mut host = String::default();
|
||||||
let mut key = String::default();
|
let mut key = String::default();
|
||||||
@ -65,16 +65,17 @@ pub fn get_custom_server_from_string(s: &str) -> ResultType<CustomServer> {
|
|||||||
let mut relay = String::default();
|
let mut relay = String::default();
|
||||||
let strs_iter = strs.iter();
|
let strs_iter = strs.iter();
|
||||||
for el in strs_iter {
|
for el in strs_iter {
|
||||||
if el.starts_with("host=") {
|
let el_lower = el.to_lowercase();
|
||||||
|
if el_lower.starts_with("host=") {
|
||||||
host = el.chars().skip(5).collect();
|
host = el.chars().skip(5).collect();
|
||||||
}
|
}
|
||||||
if el.starts_with("key=") {
|
if el_lower.starts_with("key=") {
|
||||||
key = el.chars().skip(4).collect();
|
key = el.chars().skip(4).collect();
|
||||||
}
|
}
|
||||||
if el.starts_with("api=") {
|
if el_lower.starts_with("api=") {
|
||||||
api = el.chars().skip(4).collect();
|
api = el.chars().skip(4).collect();
|
||||||
}
|
}
|
||||||
if el.starts_with("relay=") {
|
if el_lower.starts_with("relay=") {
|
||||||
relay = el.chars().skip(6).collect();
|
relay = el.chars().skip(6).collect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,6 +170,18 @@ mod test {
|
|||||||
relay: "server.example.net".to_owned(),
|
relay: "server.example.net".to_owned(),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
get_custom_server_from_string(
|
||||||
|
"rustdesk-Host=server.example.net,Key=Zm9vYmFyLiwyCg==,RELAY=server.example.net.exe"
|
||||||
|
)
|
||||||
|
.unwrap(),
|
||||||
|
CustomServer {
|
||||||
|
host: "server.example.net".to_owned(),
|
||||||
|
key: "Zm9vYmFyLiwyCg==".to_owned(),
|
||||||
|
api: "".to_owned(),
|
||||||
|
relay: "server.example.net".to_owned(),
|
||||||
|
}
|
||||||
|
);
|
||||||
let lic = CustomServer {
|
let lic = CustomServer {
|
||||||
host: "1.1.1.1".to_owned(),
|
host: "1.1.1.1".to_owned(),
|
||||||
key: "5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=".to_owned(),
|
key: "5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=".to_owned(),
|
||||||
|
Loading…
Reference in New Issue
Block a user