mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-15 13:21:27 +03:00
feat, update, win, macos (#11618)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#[cfg(windows)]
|
||||
#[cfg(any(target_os = "windows", target_os = "macos"))]
|
||||
use crate::client::translate;
|
||||
#[cfg(not(debug_assertions))]
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
@@ -189,6 +189,26 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
log::error!("Failed to uninstall: {}", err);
|
||||
}
|
||||
return None;
|
||||
} else if args[0] == "--update" {
|
||||
if config::is_disable_installation() {
|
||||
return None;
|
||||
}
|
||||
let res = platform::update_me(false);
|
||||
let text = match res {
|
||||
Ok(_) => translate("Update successfully!".to_string()),
|
||||
Err(err) => {
|
||||
log::error!("Failed with error: {err}");
|
||||
translate("Update failed!".to_string())
|
||||
}
|
||||
};
|
||||
Toast::new(Toast::POWERSHELL_APP_ID)
|
||||
.title(&config::APP_NAME.read().unwrap())
|
||||
.text1(&text)
|
||||
.sound(Some(Sound::Default))
|
||||
.duration(Duration::Short)
|
||||
.show()
|
||||
.ok();
|
||||
return None;
|
||||
} else if args[0] == "--after-install" {
|
||||
if let Err(err) = platform::run_after_install() {
|
||||
log::error!("Failed to after-install: {}", err);
|
||||
@@ -250,6 +270,21 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
use crate::platform;
|
||||
if args[0] == "--update" {
|
||||
let _text = match platform::update_me() {
|
||||
Ok(_) => {
|
||||
log::info!("{}", translate("Update successfully!".to_string()));
|
||||
}
|
||||
Err(err) => {
|
||||
log::error!("Update failed with error: {err}");
|
||||
}
|
||||
};
|
||||
return None;
|
||||
}
|
||||
}
|
||||
if args[0] == "--remove" {
|
||||
if args.len() == 2 {
|
||||
// sleep a while so that process of removed exe exit
|
||||
@@ -592,7 +627,8 @@ fn core_main_invoke_new_connection(mut args: std::env::Args) -> Option<Vec<Strin
|
||||
let mut param_array = vec![];
|
||||
while let Some(arg) = args.next() {
|
||||
match arg.as_str() {
|
||||
"--connect" | "--play" | "--file-transfer" | "--view-camera" | "--port-forward" | "--rdp" => {
|
||||
"--connect" | "--play" | "--file-transfer" | "--view-camera" | "--port-forward"
|
||||
| "--rdp" => {
|
||||
authority = Some((&arg.to_string()[2..]).to_owned());
|
||||
id = args.next();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user