remove key_pair pub attr

This commit is contained in:
rustdesk 2022-07-30 02:27:03 +08:00
parent 125f6dd810
commit 040267e7f2
2 changed files with 6 additions and 2 deletions

View File

@ -89,7 +89,7 @@ pub struct Config {
#[serde(default)] #[serde(default)]
salt: String, salt: String,
#[serde(default)] #[serde(default)]
pub key_pair: (Vec<u8>, Vec<u8>), // sk, pk key_pair: (Vec<u8>, Vec<u8>), // sk, pk
#[serde(default)] #[serde(default)]
key_confirmed: bool, key_confirmed: bool,
#[serde(default)] #[serde(default)]
@ -321,6 +321,10 @@ impl Config {
Config::with_extension(Self::path(name)) Config::with_extension(Self::path(name))
} }
pub fn is_empty(&self) -> bool {
self.id.is_empty() || self.key_pair.0.is_empty()
}
pub fn get_home() -> PathBuf { pub fn get_home() -> PathBuf {
#[cfg(any(target_os = "android", target_os = "ios"))] #[cfg(any(target_os = "android", target_os = "ios"))]
return Self::path(APP_HOME_DIR.read().unwrap().as_str()); return Self::path(APP_HOME_DIR.read().unwrap().as_str());

View File

@ -172,7 +172,7 @@ fn import_config(path: &str) {
let path = std::path::Path::new(path); let path = std::path::Path::new(path);
log::info!("import config from {:?} and {:?}", path, path2); log::info!("import config from {:?} and {:?}", path, path2);
let config: Config = load_path(path.into()); let config: Config = load_path(path.into());
if config.id.is_empty() || config.key_pair.0.is_empty() { if config.is_empty() {
log::info!("Empty source config, skipped"); log::info!("Empty source config, skipped");
return; return;
} }