From 5bd8befb0f0d34c5f0ba866686a776520c17d0c8 Mon Sep 17 00:00:00 2001 From: 21pages Date: Tue, 16 May 2023 15:59:31 +0800 Subject: [PATCH] remove time check Signed-off-by: 21pages --- libs/hbb_common/src/config.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 132f27545..4890df1c5 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -143,7 +143,7 @@ pub enum NetworkType { #[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)] pub struct Config { - #[serde(default)] + #[serde(default, skip_serializing_if = "String::is_empty")] pub id: String, // use #[serde(default)] enc_id: String, // store @@ -434,11 +434,14 @@ impl Config { config.id = id; id_valid = true; store |= store2; - } else if crate::get_modified_time(&Self::file_("")) - .checked_sub(std::time::Duration::from_secs(30)) // allow modification during installation - .unwrap_or_else(crate::get_exe_time) - < crate::get_exe_time() - && !config.id.is_empty() + } else if + // Comment out for forward compatible + // crate::get_modified_time(&Self::file_("")) + // .checked_sub(std::time::Duration::from_secs(30)) // allow modification during installation + // .unwrap_or_else(crate::get_exe_time) + // < crate::get_exe_time() + // && + !config.id.is_empty() && config.enc_id.is_empty() && !decrypt_str_or_original(&config.id, PASSWORD_ENC_VERSION).1 {