diff --git a/src-tauri/src/config/prfitem.rs b/src-tauri/src/config/prfitem.rs index 88ff36da9..162afaa3d 100644 --- a/src-tauri/src/config/prfitem.rs +++ b/src-tauri/src/config/prfitem.rs @@ -109,7 +109,6 @@ pub struct PrfOption { #[serde(skip_serializing_if = "Option::is_none")] pub danger_accept_invalid_certs: Option, - #[serde(default = "default_allow_auto_update")] #[serde(skip_serializing_if = "Option::is_none")] pub allow_auto_update: Option, @@ -579,12 +578,6 @@ impl PrfItem { } } -// 向前兼容,默认为订阅启用自动更新 -#[allow(clippy::unnecessary_wraps)] -const fn default_allow_auto_update() -> Option { - Some(true) -} - fn allow_auto_update_enabled(option: Option<&PrfOption>) -> bool { option.and_then(|o| o.allow_auto_update).unwrap_or(true) } diff --git a/src-tauri/src/config/profiles.rs b/src-tauri/src/config/profiles.rs index a91cfd68e..b1d067008 100644 --- a/src-tauri/src/config/profiles.rs +++ b/src-tauri/src/config/profiles.rs @@ -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 } diff --git a/src/components/profile/profile-viewer.tsx b/src/components/profile/profile-viewer.tsx index c55928577..8ab7c4f5e 100644 --- a/src/components/profile/profile-viewer.tsx +++ b/src/components/profile/profile-viewer.tsx @@ -55,6 +55,7 @@ export function ProfileViewer({ onChange, ref }: ProfileViewerProps) { option: { with_proxy: false, self_proxy: false, + allow_auto_update: true, }, }, }) @@ -418,7 +419,11 @@ export function ProfileViewer({ onChange, ref }: ProfileViewerProps) { {t('profiles.modals.profileForm.fields.allowAutoUpdate')} - + )} />