This commit is contained in:
rustdesk
2023-03-20 00:56:17 +08:00
parent 4d827708c3
commit 706e080071
4 changed files with 22 additions and 21 deletions

View File

@@ -799,3 +799,22 @@ pub fn decode64<T: AsRef<[u8]>>(input: T) -> Result<Vec<u8>, base64::DecodeError
#[allow(deprecated)]
base64::decode(input)
}
pub async fn get_key(sync: bool) -> String {
let mut key = if sync {
Config::get_option("key")
} else {
let mut options = crate::ipc::get_options_async().await;
options.remove("key").unwrap_or_default()
};
if key.is_empty() {
#[cfg(windows)]
if let Some(lic) = windows::get_license() {
return lic.key;
}
}
if key.is_empty() && !option_env!("RENDEZVOUS_SERVER").unwrap_or("").is_empty() {
key = config::RS_PUB_KEY.to_owned();
}
key
}