fix: remove unnecessary allow_auto_update default value (#7697)

* fix: remove unnecessary allow_auto_update default value

* fix: normalize missing profile auto-update state

---------

Co-authored-by: wonfen <eiwonfen@gmail.com>
This commit is contained in:
StarsSail
2026-08-09 06:29:01 +00:00
committed by GitHub
co-authored by wonfen
parent 117bac8110
commit df7e52f25c
3 changed files with 12 additions and 8 deletions
-7
View File
@@ -109,7 +109,6 @@ pub struct PrfOption {
#[serde(skip_serializing_if = "Option::is_none")]
pub danger_accept_invalid_certs: Option<bool>,
#[serde(default = "default_allow_auto_update")]
#[serde(skip_serializing_if = "Option::is_none")]
pub allow_auto_update: Option<bool>,
@@ -579,12 +578,6 @@ impl PrfItem {
}
}
// 向前兼容,默认为订阅启用自动更新
#[allow(clippy::unnecessary_wraps)]
const fn default_allow_auto_update() -> Option<bool> {
Some(true)
}
fn allow_auto_update_enabled(option: Option<&PrfOption>) -> bool {
option.and_then(|o| o.allow_auto_update).unwrap_or(true)
}
+6
View File
@@ -138,6 +138,12 @@ impl IProfiles {
if item.uid.is_none() {
item.uid = Some(help::get_uid("d").into());
}
if item.itype.as_deref() == Some("remote") {
item.option
.get_or_insert_with(PrfOption::default)
.allow_auto_update
.get_or_insert(true);
}
}
profiles
}