From d59be68e52f6eaa492679fcdf3258b55058c6fd6 Mon Sep 17 00:00:00 2001 From: dignow Date: Tue, 1 Aug 2023 15:57:38 +0800 Subject: [PATCH 1/2] Fix check main args Signed-off-by: dignow --- src/core_main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core_main.rs b/src/core_main.rs index a1f0edecd..cbcb0b474 100644 --- a/src/core_main.rs +++ b/src/core_main.rs @@ -147,7 +147,9 @@ pub fn core_main() -> Option> { #[cfg(all(feature = "flutter", feature = "plugin_framework"))] #[cfg(not(any(target_os = "android", target_os = "ios")))] init_plugins(&args); - if args.is_empty() { + log::info!("main start args:{:?}", args); + let empty_uni_link = "rustdesk:///"; + if args.is_empty() || args[0] == empty_uni_link { #[cfg(windows)] clipboard::ContextSend::enable(true); std::thread::spawn(move || crate::start_server(false)); From 7640a51726ca6c1a91f911b0858faf88f50ea78c Mon Sep 17 00:00:00 2001 From: dignow Date: Tue, 1 Aug 2023 17:10:21 +0800 Subject: [PATCH 2/2] check empty uni link arg Signed-off-by: dignow --- src/core_main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core_main.rs b/src/core_main.rs index cbcb0b474..cf66255ca 100644 --- a/src/core_main.rs +++ b/src/core_main.rs @@ -18,6 +18,14 @@ macro_rules! my_println{ }; } +#[inline] +fn is_empty_uni_link(arg: &str) -> bool { + if !arg.starts_with("rustdesk://") { + return false; + } + arg["rustdesk://".len()..].chars().all(|c| c == '/') +} + /// shared by flutter and sciter main function /// /// [Note] @@ -141,6 +149,7 @@ pub fn core_main() -> Option> { } #[cfg(windows)] if !crate::platform::is_installed() && (_is_elevate || _is_run_as_system) { + clipboard::ContextSend::enable(true); crate::platform::elevate_or_run_as_system(click_setup, _is_elevate, _is_run_as_system); return None; } @@ -148,8 +157,7 @@ pub fn core_main() -> Option> { #[cfg(not(any(target_os = "android", target_os = "ios")))] init_plugins(&args); log::info!("main start args:{:?}", args); - let empty_uni_link = "rustdesk:///"; - if args.is_empty() || args[0] == empty_uni_link { + if args.is_empty() || is_empty_uni_link(&args[0]) { #[cfg(windows)] clipboard::ContextSend::enable(true); std::thread::spawn(move || crate::start_server(false));