Merge pull request #5219 from dignow/fix/check_main_args

Fix/check main args
This commit is contained in:
RustDesk 2023-08-01 17:27:22 +08:00 committed by GitHub
commit 11595be199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 /// shared by flutter and sciter main function
/// ///
/// [Note] /// [Note]
@ -141,13 +149,15 @@ pub fn core_main() -> Option<Vec<String>> {
} }
#[cfg(windows)] #[cfg(windows)]
if !crate::platform::is_installed() && (_is_elevate || _is_run_as_system) { 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); crate::platform::elevate_or_run_as_system(click_setup, _is_elevate, _is_run_as_system);
return None; return None;
} }
#[cfg(all(feature = "flutter", feature = "plugin_framework"))] #[cfg(all(feature = "flutter", feature = "plugin_framework"))]
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
init_plugins(&args); init_plugins(&args);
if args.is_empty() { log::info!("main start args:{:?}", args);
if args.is_empty() || is_empty_uni_link(&args[0]) {
#[cfg(windows)] #[cfg(windows)]
clipboard::ContextSend::enable(true); clipboard::ContextSend::enable(true);
std::thread::spawn(move || crate::start_server(false)); std::thread::spawn(move || crate::start_server(false));