refactor(profile): separate subscription refresh and scheduling policy

Separate download and scheduling policy from the subscription use case while retaining the existing write path.
This commit is contained in:
Tunglies
2026-12-01 22:07:38 +08:00
parent 25750ae001
commit 33ce830c01
11 changed files with 407 additions and 306 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ use crate::core::notify::NoticeStatus;
use crate::utils::window_manager::WindowManager;
use crate::{
config::{
Config, IProfiles, PrfItem, PrfOption, fetch_remote_profile,
Config, IProfiles, PrfItem, PrfOption, build_remote_profile,
profiles::{
PROFILE_WRITE_LOCK, cleanup_profile_files, profiles_append_item_safe,
profiles_append_item_with_filedata_safe, profiles_patch_item_safe, profiles_reorder_safe,
@@ -72,7 +72,7 @@ pub async fn enhance_profiles() -> CmdResult<ValidationOutcome> {
#[tracing::instrument(skip_all, level = "info", fields(url = %help::mask_url(&url), uid = tracing::field::Empty))]
#[specta::specta]
pub async fn import_profile(url: std::string::String, option: Option<PrfOption>) -> CmdResult {
let item = &mut match fetch_remote_profile(&url, None, None, option.as_ref()).await {
let item = &mut match build_remote_profile(&url, None, None, option.as_ref()).await {
Ok(it) => it,
Err(e) => {
logging!(error, Type::Cmd, "[导入订阅] 下载失败: {e:#}");