cmd.rs 369 B

12345678910111213141516
  1. use crate::clash;
  2. use tauri::api::process::kill_children;
  3. #[tauri::command]
  4. pub fn restart_sidebar() {
  5. kill_children();
  6. clash::run_clash_bin();
  7. }
  8. #[tauri::command]
  9. pub async fn get_config_data(url: String) -> Result<String, String> {
  10. match clash::fetch_url(&url).await {
  11. Ok(_) => Ok(String::from("success")),
  12. Err(_) => Err(String::from("error")),
  13. }
  14. }