mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-25 23:15:51 +08:00
refactor: api cleanup (#7812)
* refactor(config): unify YAML persistence * refactor(config): remove redundant config APIs * refactor(config): remove unused config APIs * refactor(config): narrow profile APIs * fix(config): preserve profiles on invalid reorder * refactor(startup): narrow resolve helpers * refactor(config): unify mixed port defaults * refactor(network): simplify response APIs * refactor(config): make profile builders infallible * refactor(config): make profile activation infallible * refactor(api): simplify internal runtime APIs * refactor: consolidate internal config and window APIs
This commit is contained in:
@@ -54,21 +54,21 @@ impl AsyncChainItemFrom for Option<ChainItem> {
|
||||
data: ChainType::Merge(help::read_mapping(&path).await.ok()?),
|
||||
}),
|
||||
"rules" => {
|
||||
let seq_map = help::read_seq_map(&path).await.ok()?;
|
||||
let seq_map = help::read_yaml::<SeqMap>(&path).await.ok()?;
|
||||
Some(ChainItem {
|
||||
uid,
|
||||
data: ChainType::Rules(seq_map),
|
||||
})
|
||||
}
|
||||
"proxies" => {
|
||||
let seq_map = help::read_seq_map(&path).await.ok()?;
|
||||
let seq_map = help::read_yaml::<SeqMap>(&path).await.ok()?;
|
||||
Some(ChainItem {
|
||||
uid,
|
||||
data: ChainType::Proxies(seq_map),
|
||||
})
|
||||
}
|
||||
"groups" => {
|
||||
let seq_map = help::read_seq_map(&path).await.ok()?;
|
||||
let seq_map = help::read_yaml::<SeqMap>(&path).await.ok()?;
|
||||
Some(ChainItem {
|
||||
uid,
|
||||
data: ChainType::Groups(seq_map),
|
||||
|
||||
@@ -158,7 +158,7 @@ async fn get_config_values() -> ConfigValues {
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
async fn collect_profile_items(profiles: &IProfiles) -> Result<ProfileItems> {
|
||||
let current_profile_uid = match profiles.get_current().cloned() {
|
||||
let current_profile_uid = match profiles.current.clone() {
|
||||
Some(uid) => uid,
|
||||
None => return Ok(ProfileItems::default()),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user