添加win 系统托盘显示代理节点

且gui和托盘刷新机制
This commit is contained in:
Kasserrr
2025-08-29 23:44:50 +08:00
Unverified
parent 2934a2b7f2
commit cc6a1144dc
24 changed files with 851 additions and 982 deletions

View File

@@ -2,10 +2,10 @@ use super::CmdResult;
use crate::{
config::{
profiles::{
profiles_append_item_safe, profiles_delete_item_safe, profiles_patch_item_safe,
profiles_reorder_safe, profiles_save_file_safe,
profiles_append_item_with_filedata_safe, profiles_delete_item_safe,
profiles_patch_item_safe, profiles_reorder_safe, profiles_save_file_safe,
},
Config, IProfiles, PrfItem, PrfOption,
profiles_append_item_safe, Config, IProfiles, PrfItem, PrfOption,
},
core::{handle, timer::Timer, tray::Tray, CoreManager},
feat, logging,
@@ -225,8 +225,8 @@ pub async fn reorder_profile(active_id: String, over_id: String) -> CmdResult {
/// 创建新的profile
/// 创建一个新的配置文件
#[tauri::command]
pub async fn create_profile(item: PrfItem, _file_data: Option<String>) -> CmdResult {
match profiles_append_item_safe(item).await {
pub async fn create_profile(item: PrfItem, file_data: Option<String>) -> CmdResult {
match profiles_append_item_with_filedata_safe(item, file_data).await {
Ok(_) => Ok(()),
Err(err) => match err.to_string().as_str() {
"the file already exists" => Err("the file already exists".into()),
@@ -253,10 +253,6 @@ pub async fn delete_profile(index: String) -> CmdResult {
// 使用Send-safe helper函数
let should_update = wrap_err!(profiles_delete_item_safe(index).await)?;
// 删除后自动清理冗余文件
let profiles = Config::profiles().await;
let _ = profiles.latest_ref().auto_cleanup();
if should_update {
match CoreManager::global().update_config().await {
Ok(_) => {