feat: ensure Mihomo and Verge services are running before executing commands

This commit is contained in:
Tunglies
2025-03-22 16:59:32 +08:00
parent 86f69fd574
commit 1d88d98ea1
4 changed files with 81 additions and 51 deletions

View File

@@ -1,8 +1,9 @@
use super::CmdResult;
use crate::module::mihomo::MihomoManager;
use crate::{core::CoreManager, module::mihomo::MihomoManager};
#[tauri::command]
pub async fn get_proxies() -> CmdResult<serde_json::Value> {
CoreManager::global().ensure_running_core().await;
let mannager = MihomoManager::global();
let proxies = mannager
.refresh_proxies()
@@ -14,6 +15,7 @@ pub async fn get_proxies() -> CmdResult<serde_json::Value> {
#[tauri::command]
pub async fn get_providers_proxies() -> CmdResult<serde_json::Value> {
CoreManager::global().ensure_running_core().await;
let mannager = MihomoManager::global();
let providers = mannager
.refresh_providers_proxies()