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

This commit is contained in:
Tunglies
2025-03-22 17:05:42 +08:00
parent 079591da59
commit b8161b01c1
4 changed files with 81 additions and 51 deletions
@@ -98,6 +98,12 @@ impl MihomoManager {
}
impl MihomoManager {
pub async fn is_mihomo_running(&self) -> Result<(), String> {
let url = format!("{}/version", self.mihomo_server);
let _response = self.send_request(Method::GET, url, None).await?;
Ok(())
}
pub async fn put_configs_force(&self, clash_config_path: &str) -> Result<(), String> {
let url = format!("{}/configs?force=true", self.mihomo_server);
let payload = serde_json::json!({