mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
--set-id and --config, not tested yet
This commit is contained in:
@@ -257,6 +257,45 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
my_println!("Installation and administrative privileges required!");
|
||||
}
|
||||
return None;
|
||||
} else if args[0] == "--set-id" {
|
||||
if args.len() == 2 {
|
||||
if crate::platform::is_installed()
|
||||
&& crate::platform::check_super_user_permission().unwrap_or_default()
|
||||
{
|
||||
let old_id = crate::ipc::get_id();
|
||||
let mut res = crate::ui_interface::change_id_shared(args[1].to_owned(), old_id);
|
||||
if res.is_empty() {
|
||||
res = "Done!".to_owned();
|
||||
}
|
||||
my_println!("{}", res);
|
||||
} else {
|
||||
my_println!("Installation and administrative privileges required!");
|
||||
}
|
||||
}
|
||||
return None;
|
||||
} else if args[0] == "--config" {
|
||||
if args.len() == 2 {
|
||||
if crate::platform::is_installed()
|
||||
&& crate::platform::check_super_user_permission().unwrap_or_default()
|
||||
{
|
||||
// arg: starting with `host=`, e.g. `host=127.0.0.1,api=https://test.com,key=asfs`,
|
||||
// or the filename (without ext) used in renaming exe.
|
||||
let name = format!("{}.exe", args[1]);
|
||||
if let Ok(lic) = crate::license::get_license_from_string(&name) {
|
||||
if !lic.host.is_empty() {
|
||||
crate::ui_interface::set_option("key".into(), lic.key);
|
||||
crate::ui_interface::set_option(
|
||||
"custom-rendezvous-server".into(),
|
||||
lic.host,
|
||||
);
|
||||
crate::ui_interface::set_option("api-server".into(), lic.api);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
my_println!("Installation and administrative privileges required!");
|
||||
}
|
||||
}
|
||||
return None;
|
||||
} else if args[0] == "--check-hwcodec-config" {
|
||||
#[cfg(feature = "hwcodec")]
|
||||
scrap::hwcodec::check_config();
|
||||
|
||||
Reference in New Issue
Block a user