This commit is contained in:
parent
2662abc5a3
commit
421ddc0016
@ -261,6 +261,16 @@ pub fn core_main() -> Option<Vec<String>> {
|
|||||||
return None;
|
return None;
|
||||||
} else if args[0] == "--server" {
|
} else if args[0] == "--server" {
|
||||||
log::info!("start --server with user {}", crate::username());
|
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)]
|
#[cfg(windows)]
|
||||||
crate::privacy_mode::restore_reg_connectivity(true);
|
crate::privacy_mode::restore_reg_connectivity(true);
|
||||||
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
||||||
@ -398,7 +408,8 @@ pub fn core_main() -> Option<Vec<String>> {
|
|||||||
"uuid": uuid,
|
"uuid": uuid,
|
||||||
});
|
});
|
||||||
let header = "Authorization: Bearer ".to_owned() + &token;
|
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!(
|
println!(
|
||||||
"--user_name or --strategy_name or --address_book_name is required!"
|
"--user_name or --strategy_name or --address_book_name is required!"
|
||||||
);
|
);
|
||||||
|
@ -730,7 +730,8 @@ pub fn block_input(_v: bool) -> (bool, String) {
|
|||||||
|
|
||||||
pub fn is_installed() -> bool {
|
pub fn is_installed() -> bool {
|
||||||
if let Ok(p) = std::env::current_exe() {
|
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 {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
@ -1413,6 +1414,9 @@ pub fn check_autostart_config() -> ResultType<()> {
|
|||||||
let app_name = crate::get_app_name().to_lowercase();
|
let app_name = crate::get_app_name().to_lowercase();
|
||||||
let path = format!("{home}/.config/autostart");
|
let path = format!("{home}/.config/autostart");
|
||||||
let file = format!("{path}/{app_name}.desktop");
|
let file = format!("{path}/{app_name}.desktop");
|
||||||
|
// https://github.com/rustdesk/rustdesk/issues/4863
|
||||||
|
std::fs::remove_file(&file).ok();
|
||||||
|
/*
|
||||||
std::fs::create_dir_all(&path).ok();
|
std::fs::create_dir_all(&path).ok();
|
||||||
if !Path::new(&file).exists() {
|
if !Path::new(&file).exists() {
|
||||||
// write text to the desktop file
|
// write text to the desktop file
|
||||||
@ -1420,15 +1424,16 @@ pub fn check_autostart_config() -> ResultType<()> {
|
|||||||
file.write_all(
|
file.write_all(
|
||||||
format!(
|
format!(
|
||||||
"
|
"
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Exec={app_name} --tray
|
Exec={app_name} --tray
|
||||||
NoDisplay=false
|
NoDisplay=false
|
||||||
"
|
"
|
||||||
)
|
)
|
||||||
.as_bytes(),
|
.as_bytes(),
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user