win, install cert
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
79934d006b
commit
c0257bff52
@ -143,6 +143,10 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
#[cfg(feature = "with_rc")]
|
||||
hbb_common::allow_err!(crate::rc::extract_resources(&args[1]));
|
||||
return None;
|
||||
} else if args[0] == "--install-cert" {
|
||||
#[cfg(windows)]
|
||||
hbb_common::allow_err!(crate::platform::windows::install_cert(&args[1]));
|
||||
return None;
|
||||
} else if args[0] == "--portable-service" {
|
||||
crate::platform::elevate_or_run_as_system(
|
||||
click_setup,
|
||||
|
@ -461,5 +461,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Resolution", "Auflösung"),
|
||||
("No transfers in progress", "Keine Übertragungen im Gange"),
|
||||
("Set one-time password length", "Länge des Einmalpassworts festlegen"),
|
||||
("Install driver cert(test cert)", ""),
|
||||
("Virtual display requirement", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -461,5 +461,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Resolution", "وضوح"),
|
||||
("No transfers in progress", "هیچ انتقالی در حال انجام نیست"),
|
||||
("Set one-time password length", "طول رمز یکبار مصرف را تعیین کنید"),
|
||||
("Install driver cert(test cert)", ""),
|
||||
("Virtual display requirement", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -461,5 +461,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Resolution", "Разрешение"),
|
||||
("No transfers in progress", "Передача не осуществляется"),
|
||||
("Set one-time password length", "Установить длину одноразового пароля"),
|
||||
("Install driver cert(test cert)", ""),
|
||||
("Virtual display requirement", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -1108,6 +1108,12 @@ if exist \"{tmp_path}\\{app_name} Tray.lnk\" del /f /q \"{tmp_path}\\{app_name}
|
||||
);
|
||||
let src_exe = std::env::current_exe()?.to_str().unwrap_or("").to_string();
|
||||
|
||||
let install_cert = if options.contains("driverCert") {
|
||||
format!("\"{}\" --install-cert \"RustDeskIddDriver.cer\"", src_exe)
|
||||
} else {
|
||||
"".to_owned()
|
||||
};
|
||||
|
||||
let cmds = format!(
|
||||
"
|
||||
{uninstall_str}
|
||||
@ -1139,6 +1145,7 @@ sc create {app_name} binpath= \"\\\"{exe}\\\" --import-config \\\"{config_path}\
|
||||
sc start {app_name}
|
||||
sc stop {app_name}
|
||||
sc delete {app_name}
|
||||
{install_cert}
|
||||
{after_install}
|
||||
{sleep}
|
||||
",
|
||||
@ -1159,6 +1166,7 @@ sc delete {app_name}
|
||||
shortcuts=shortcuts,
|
||||
config_path=Config::file().to_str().unwrap_or(""),
|
||||
lic=register_licence(),
|
||||
install_cert=install_cert,
|
||||
after_install=get_after_install(&exe),
|
||||
sleep=if debug {
|
||||
"timeout 300"
|
||||
@ -1174,9 +1182,6 @@ sc delete {app_name}
|
||||
);
|
||||
run_cmds(cmds, debug, "install")?;
|
||||
std::thread::sleep(std::time::Duration::from_millis(2000));
|
||||
if options.contains("driverCert") {
|
||||
allow_err!(cert::install_cert(std::path::Path::new(&path).join("RustDeskIddDriver.cer")));
|
||||
}
|
||||
if !silent {
|
||||
std::process::Command::new(&exe).spawn()?;
|
||||
std::process::Command::new(&exe).arg("--tray").spawn()?;
|
||||
@ -1907,6 +1912,20 @@ pub fn user_accessible_folder() -> ResultType<PathBuf> {
|
||||
Ok(dir)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn install_cert(cert_file: &str) -> ResultType<()> {
|
||||
let exe_file = std::env::current_exe()?;
|
||||
if let Some(cur_dir) = exe_file.parent() {
|
||||
allow_err!(cert::install_cert(cur_dir.join(cert_file)));
|
||||
} else {
|
||||
bail!(
|
||||
"Invalid exe parent for {}",
|
||||
exe_file.to_string_lossy().as_ref()
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
mod cert {
|
||||
use hbb_common::{allow_err, bail, log, ResultType};
|
||||
use std::{path::Path, str::from_utf8};
|
||||
|
Loading…
Reference in New Issue
Block a user