fix: streamline verge configuration fetching and patching functions

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

View File

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

View File

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