fix: streamline verge configuration fetching and patching functions

This commit is contained in:
Tunglies
2025-11-04 08:01:33 +08:00
parent b70d45b66a
commit b86ceb26f6
2 changed files with 9 additions and 9 deletions

View File

@@ -1,16 +1,10 @@
use super::CmdResult; use super::CmdResult;
use crate::{ use crate::{cmd::StringifyErr, config::IVerge, feat, utils::draft::SharedBox};
cmd::StringifyErr,
config::{Config, IVerge},
feat,
utils::draft::SharedBox,
};
/// 获取Verge配置 /// 获取Verge配置
#[tauri::command] #[tauri::command]
pub async fn get_verge_config() -> CmdResult<SharedBox<IVerge>> { pub async fn get_verge_config() -> CmdResult<SharedBox<IVerge>> {
let verge = Config::verge().await; feat::fetch_verge_config().await.stringify_err()
Ok(verge.latest_arc())
} }
/// 修改Verge配置 /// 修改Verge配置

View File

@@ -3,7 +3,7 @@ use crate::{
core::{CoreManager, handle, hotkey, sysopt, tray}, core::{CoreManager, handle, hotkey, sysopt, tray},
logging_error, logging_error,
module::lightweight, module::lightweight,
utils::logging::Type, utils::{draft::SharedBox, logging::Type},
}; };
use anyhow::Result; use anyhow::Result;
use serde_yaml_ng::Mapping; use serde_yaml_ng::Mapping;
@@ -250,3 +250,9 @@ pub async fn patch_verge(patch: &IVerge, not_save_file: bool) -> Result<()> {
} }
Ok(()) Ok(())
} }
pub async fn fetch_verge_config() -> Result<SharedBox<IVerge>> {
let draft = Config::verge().await;
let data = draft.data_arc();
Ok(data)
}