An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
fix https://github.com/rustdesk/rustdesk/issues/4863
rustdesk421ddc001603
diff --git a/src/core_main.rs b/src/core_main.rsindex bcd22aabe..902c816e5 100644--- a/src/core_main.rs+++ b/src/core_main.rs@@ -261,6 +261,16 @@ pub fn core_main() -> Option<Vec<String>> {return None;} else if args[0] == "--server" {log::info!("start --server with user {}", crate::username());+ #[cfg(target_os = "linux")]+ {+ hbb_common::allow_err!(crate::platform::check_autostart_config());+ std::process::Command::new("pkill")+ .arg("-f")+ .arg(&format!("%s --tray", crate::get_app_name().to_lowercase()))+ .status()+ .ok();+ allow_err!(crate::crate::platform::run_as_user(vec!["--tray"]));+ }#[cfg(windows)]crate::privacy_mode::restore_reg_connectivity(true);#[cfg(any(target_os = "linux", target_os = "windows"))]@@ -398,7 +408,8 @@ pub fn core_main() -> Option<Vec<String>> {"uuid": uuid,});let header = "Authorization: Bearer ".to_owned() + &token;- if user_name.is_none() && strategy_name.is_none() && address_book_name.is_none() {+ if user_name.is_none() && strategy_name.is_none() && address_book_name.is_none()+ {println!("--user_name or --strategy_name or --address_book_name is required!");diff --git a/src/platform/linux.rs b/src/platform/linux.rsindex f936bfb8c..90e2f52ca 100644--- a/src/platform/linux.rs+++ b/src/platform/linux.rs@@ -730,7 +730,8 @@ pub fn block_input(_v: bool) -> (bool, String) {pub fn is_installed() -> bool {if let Ok(p) = std::env::current_exe() {- p.to_str().unwrap_or_default().starts_with("/usr") || p.to_str().unwrap_or_default().starts_with("/nix/store")+ p.to_str().unwrap_or_default().starts_with("/usr")+ || p.to_str().unwrap_or_default().starts_with("/nix/store")} else {false}@@ -1413,22 +1414,26 @@ pub fn check_autostart_config() -> ResultType<()> {let app_name = crate::get_app_name().to_lowercase();let path = format!("{home}/.config/autostart");let file = format!("{path}/{app_name}.desktop");- std::fs::create_dir_all(&path).ok();- if !Path::new(&file).exists() {- // write text to the desktop file- let mut file = std::fs::File::create(&file)?;- file.write_all(- format!(- "-[Desktop Entry]-Type=Application-Exec={app_name} --tray-NoDisplay=false- "- )- .as_bytes(),- )?;- }+ // https://github.com/rustdesk/rustdesk/issues/4863+ std::fs::remove_file(&file).ok();+ /*+ std::fs::create_dir_all(&path).ok();+ if !Path::new(&file).exists() {+ // write text to the desktop file+ let mut file = std::fs::File::create(&file)?;+ file.write_all(+ format!(+ "+ [Desktop Entry]+ Type=Application+ Exec={app_name} --tray+ NoDisplay=false+ "+ )+ .as_bytes(),+ )?;+ }+ */Ok(())}