refactor(profile): call the core reload directly

This commit is contained in:
Tunglies
2026-12-03 19:38:46 +08:00
parent 651f297785
commit 35dbb3716d
3 changed files with 8 additions and 9 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ pub async fn get_profiles() -> CmdResult<SharedDraft<IProfiles>> {
#[tauri::command]
#[specta::specta]
pub async fn enhance_profiles() -> CmdResult<ValidationOutcome> {
match feat::enhance_profiles().await {
match CoreManager::global().update_config_forced().await {
Ok(outcome) if outcome.is_valid() => {
handle::Handle::refresh_clash();
Ok(outcome)
+6 -2
View File
@@ -3,7 +3,11 @@ use crate::process::AsyncHandler;
use crate::singleton;
use crate::utils::notification::{NotificationEvent, notify_event};
use crate::utils::window_manager::WindowManager;
use crate::{config::Config, core::handle, core::lightweight::entry_lightweight_mode, feat};
use crate::{
config::Config,
core::{CoreManager, handle, lightweight::entry_lightweight_mode},
feat,
};
use anyhow::{Result, bail};
use arc_swap::ArcSwap;
use clash_verge_logging::{Type, logging};
@@ -165,7 +169,7 @@ impl Hotkey {
});
}
HotkeyFunction::ReactivateProfiles => {
AsyncHandler::spawn(async move || match feat::enhance_profiles().await {
AsyncHandler::spawn(async move || match CoreManager::global().update_config_forced().await {
Ok(outcome) if outcome.is_valid() => {
handle::Handle::refresh_clash();
notify_event(NotificationEvent::ProfilesReactivated).await;
+1 -6
View File
@@ -2,7 +2,7 @@ use crate::core::notify::{Refresh, announce};
use crate::{
cmd,
config::Config,
core::{CoreManager, handle, tray, validate::ValidationOutcome},
core::{handle, tray},
process::AsyncHandler,
};
use anyhow::Result;
@@ -199,11 +199,6 @@ async fn finish_proxy_switch(stale_proxies: Vec<std::string::String>) {
}
}
/// 增强配置
pub async fn enhance_profiles() -> Result<ValidationOutcome> {
CoreManager::global().update_config_forced().await
}
#[cfg(test)]
mod tests {
use super::*;