refactor(profile): extract profile models and index rules

Move profile models and index rules into the crate, preserving serialization and returning a typed missing-profile error.
This commit is contained in:
Tunglies
2026-12-02 02:10:09 +08:00
committed by GitHub
parent 0605236489
commit 9de413db1e
19 changed files with 1018 additions and 856 deletions
+6 -3
View File
@@ -1,5 +1,8 @@
use crate::{
config::{Config, IClashTemp, IProfiles, IVerge},
config::{
Config, IClashTemp, IProfiles, IVerge,
profiles::{raise_short_update_intervals, save_profiles},
},
constants,
core::handle,
logging,
@@ -266,9 +269,9 @@ pub async fn migrate_short_update_intervals() -> Result<()> {
if profiles.items.is_none() {
anyhow::bail!("profiles.yaml was not loaded; refusing to record the migration as done");
}
let raised = profiles.raise_short_update_intervals(min);
let raised = raise_short_update_intervals(&mut profiles, min);
if raised > 0 {
profiles.save_file().await?;
save_profiles(&profiles).await?;
}
Ok((profiles, raised))
})