mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-10 12:22:07 +08:00
feat: enhance profile update handling with manual trigger
This commit is contained in:
@@ -99,6 +99,7 @@ async fn perform_profile_update(
|
||||
url: &String,
|
||||
opt: Option<&PrfOption>,
|
||||
option: Option<&PrfOption>,
|
||||
is_mannual_trigger: bool,
|
||||
) -> Result<bool> {
|
||||
logging!(info, Type::Config, "[订阅更新] 开始下载新的订阅内容");
|
||||
let mut merged_opt = PrfOption::merge(opt, option);
|
||||
@@ -173,7 +174,9 @@ async fn perform_profile_update(
|
||||
}
|
||||
}
|
||||
|
||||
handle::Handle::notice_message("update_failed_even_with_clash", format!("{profile_name} - {last_err}"));
|
||||
if is_mannual_trigger {
|
||||
handle::Handle::notice_message("update_failed_even_with_clash", format!("{profile_name} - {last_err}"));
|
||||
}
|
||||
Ok(is_current)
|
||||
}
|
||||
|
||||
@@ -182,12 +185,15 @@ pub async fn update_profile(
|
||||
option: Option<&PrfOption>,
|
||||
auto_refresh: bool,
|
||||
ignore_auto_update: bool,
|
||||
is_mannual_trigger: bool,
|
||||
) -> Result<()> {
|
||||
logging!(info, Type::Config, "[订阅更新] 开始更新订阅 {}", uid);
|
||||
let url_opt = should_update_profile(uid, ignore_auto_update).await?;
|
||||
|
||||
let should_refresh = match url_opt {
|
||||
Some((url, opt)) => perform_profile_update(uid, &url, opt.as_ref(), option).await? && auto_refresh,
|
||||
Some((url, opt)) => {
|
||||
perform_profile_update(uid, &url, opt.as_ref(), option, is_mannual_trigger).await? && auto_refresh
|
||||
}
|
||||
None => auto_refresh,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user