fix(proxy): preserve runtime proxy group order

This commit is contained in:
wonfen
2026-07-16 06:53:21 +08:00
parent d144e78aeb
commit f09aef170d
4 changed files with 48 additions and 4 deletions
+22
View File
@@ -12,6 +12,28 @@ pub async fn get_runtime_config() -> CmdResult<Option<Mapping>> {
Ok(Config::runtime().await.latest_arc().config.clone())
}
/// 获取运行时代理组顺序
#[tauri::command]
pub async fn get_runtime_proxy_group_order() -> CmdResult<Vec<String>> {
let runtime = Config::runtime().await;
let runtime = runtime.latest_arc();
Ok(runtime
.config
.as_ref()
.and_then(|config| config.get("proxy-groups"))
.and_then(|groups| groups.as_sequence())
.map(|groups| {
groups
.iter()
.filter_map(|group| group.get("name"))
.filter_map(|name| name.as_str())
.map(String::from)
.collect()
})
.unwrap_or_default())
}
/// 获取运行时YAML配置
#[tauri::command]
pub async fn get_runtime_yaml() -> CmdResult<String> {
+1
View File
@@ -163,6 +163,7 @@ mod app_init {
cmd::get_clash_mode,
cmd::change_clash_core,
cmd::get_runtime_config,
cmd::get_runtime_proxy_group_order,
cmd::get_runtime_yaml,
cmd::get_runtime_exists,
cmd::get_runtime_logs,