mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-03 20:30:11 +08:00
refactor(profile): call the core reload directly
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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::*;
|
||||
|
||||
Reference in New Issue
Block a user