lan discovery almost done

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2021-12-21 00:10:14 +08:00
parent 5682b088de
commit d00352f4e4
9 changed files with 93 additions and 47 deletions

View File

@@ -389,6 +389,22 @@ pub fn get_id() -> String {
}
}
pub async fn get_id_async() -> String {
if let Ok(Some(v)) = get_config_async("id", 1_000).await {
// update salt also, so that next time reinstallation not causing first-time auto-login failure
if let Ok(Some(v2)) = get_config_async("salt", 1_000).await {
Config::set_salt(&v2);
}
if v != Config::get_id() {
Config::set_key_confirmed(false);
Config::set_id(&v);
}
v
} else {
Config::get_id()
}
}
pub fn get_password() -> String {
if let Ok(Some(v)) = get_config("password") {
Config::set_password(&v);