mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-06 17:12:07 +08:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user