Skip to content

Commit

Permalink
Merge branch 'rustdesk:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbo8418 authored Nov 20, 2024
2 parents 0d37f19 + d26fea4 commit aa9283a
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ fn install_android_deps() {
let target = format!("{}-android", target_arch);
let vcpkg_root = std::env::var("VCPKG_ROOT").unwrap();
let mut path: std::path::PathBuf = vcpkg_root.into();
path.push("installed");
if let Ok(vcpkg_root) = std::env::var("VCPKG_INSTALLED_ROOT") {
path = vcpkg_root.into();
} else {
path.push("installed");
}
path.push(target);
println!(
"{}",
Expand Down
12 changes: 8 additions & 4 deletions flutter/lib/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 (key != null) {
id = "$id?key=$key";
Expand All @@ -2254,7 +2257,7 @@ List<String>? urlLinkToCmdArgs(Uri uri) {

if (isMobile) {
if (id != null) {
final forceRelay = uri.queryParameters["relay"] != null;
final forceRelay = queryParameters["relay"] != null;
connect(Get.context!, id, forceRelay: forceRelay);
return null;
}
Expand All @@ -2264,7 +2267,7 @@ List<String>? urlLinkToCmdArgs(Uri uri) {
if (command != null && id != null) {
args.add(command);
args.add(id);
var param = uri.queryParameters;
var param = queryParameters;
String? password = param["password"];
if (password != null) args.addAll(['--password', password]);
String? switch_uuid = param["switch_uuid"];
Expand Down Expand Up @@ -2510,7 +2513,8 @@ Future<void> onActiveWindowChanged() async {
// 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).
// ```
periodic_immediate(Duration(milliseconds: 30), RdPlatformChannel.instance.terminate);
periodic_immediate(
Duration(milliseconds: 30), RdPlatformChannel.instance.terminate);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions flutter/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,10 @@ packages:
dependency: "direct main"
description:
name: image_picker
sha256: b6951e25b795d053a6ba03af5f710069c99349de9341af95155d52665cb4607c
sha256: "021834d9c0c3de46bf0fe40341fa07168407f694d9b2bb18d532dc1261867f7a"
url: "https://pub.dev"
source: hosted
version: "0.8.9"
version: "1.1.2"
image_picker_android:
dependency: transitive
description:
Expand Down Expand Up @@ -793,10 +793,10 @@ packages:
dependency: transitive
description:
name: image_picker_platform_interface
sha256: fa4e815e6fcada50e35718727d83ba1c92f1edf95c0b4436554cec301b56233b
sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80"
url: "https://pub.dev"
source: hosted
version: "2.9.3"
version: "2.10.0"
image_picker_windows:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies:
http: ^1.1.0
qr_code_scanner: ^1.0.0
zxing2: ^0.2.0
image_picker: ^0.8.5
image_picker: ^1.1.2
image: ^4.0.17
back_button_interceptor: ^6.0.1
flutter_rust_bridge: "1.80.1"
Expand Down
6 changes: 5 additions & 1 deletion libs/scrap/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ fn link_vcpkg(mut path: PathBuf, name: &str) -> PathBuf {
target = target.replace("x64", "x86");
}
println!("cargo:info={}", target);
path.push("installed");
if let Ok(vcpkg_root) = std::env::var("VCPKG_INSTALLED_ROOT") {
path = vcpkg_root.into();
} else {
path.push("installed");
}
path.push(target);
println!(
"{}",
Expand Down
10 changes: 5 additions & 5 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1408,26 +1408,26 @@ impl LoginConfigHandler {
let server = server_key.next().unwrap_or_default();
let args = server_key.next().unwrap_or_default();
let key = if server == PUBLIC_SERVER {
PUBLIC_RS_PUB_KEY
PUBLIC_RS_PUB_KEY.to_owned()
} else {
let mut args_map: HashMap<&str, &str> = HashMap::new();
let mut args_map: HashMap<String, &str> = HashMap::new();
for arg in args.split('&') {
if let Some(kv) = arg.find('=') {
let k = &arg[0..kv];
let k = arg[0..kv].to_lowercase();
let v = &arg[kv + 1..];
args_map.insert(k, v);
}
}
let key = args_map.remove("key").unwrap_or_default();
key
key.to_owned()
};

// here we can check <id>/r@server
let real_id = crate::ui_interface::handle_relay_id(raw_id).to_string();
if real_id != raw_id {
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}");
} else {
let real_id = crate::ui_interface::handle_relay_id(&id);
Expand Down
25 changes: 19 additions & 6 deletions src/custom_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,26 @@ pub fn get_custom_server_from_string(s: &str) -> ResultType<CustomServer> {
*
* This allows using a ',' (comma) symbol as a final delimiter.
*/
if s.contains("host=") {
let stripped = &s[s.find("host=").unwrap_or(0)..s.len()];
if s.to_lowercase().contains("host=") {
let stripped = &s[s.to_lowercase().find("host=").unwrap_or(0)..s.len()];
let strs: Vec<&str> = stripped.split(",").collect();
let mut host = String::default();
let mut key = String::default();
let mut api = String::default();
let mut relay = String::default();
let strs_iter = 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();
}
if el.starts_with("key=") {
if el_lower.starts_with("key=") {
key = el.chars().skip(4).collect();
}
if el.starts_with("api=") {
if el_lower.starts_with("api=") {
api = el.chars().skip(4).collect();
}
if el.starts_with("relay=") {
if el_lower.starts_with("relay=") {
relay = el.chars().skip(6).collect();
}
}
Expand Down Expand Up @@ -169,6 +170,18 @@ mod test {
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 {
host: "1.1.1.1".to_owned(),
key: "5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=".to_owned(),
Expand Down
4 changes: 2 additions & 2 deletions src/lang/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Recording", "Aufnahme"),
("Directory", "Verzeichnis"),
("Automatically record incoming sessions", "Eingehende Sitzungen automatisch aufzeichnen"),
("Automatically record outgoing sessions", ""),
("Automatically record outgoing sessions", "Ausgehende Sitzungen automatisch aufzeichnen"),
("Change", "Ändern"),
("Start session recording", "Sitzungsaufzeichnung starten"),
("Stop session recording", "Sitzungsaufzeichnung beenden"),
Expand Down Expand Up @@ -653,6 +653,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Upload folder", "Ordner hochladen"),
("Upload files", "Dateien hochladen"),
("Clipboard is synchronized", "Zwischenablage ist synchronisiert"),
("Update client clipboard", ""),
("Update client clipboard", "Client-Zwischenablage aktualisieren"),
].iter().cloned().collect();
}

0 comments on commit aa9283a

Please sign in to comment.