mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 17:15:38 +08:00
fix: streamline verge configuration fetching and patching functions
This commit is contained in:
@@ -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配置
|
||||||
|
|||||||
@@ -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)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user