feat: import profile support

This commit is contained in:
GyDi
2021-12-13 02:29:48 +08:00
parent 5b826a3767
commit b0dabbe55a
5 changed files with 110 additions and 21 deletions

View File

@@ -1,15 +1,16 @@
use crate::clash;
use crate::profiles;
use tauri::api::process::kill_children;
#[tauri::command]
pub fn restart_sidebar() {
pub fn cmd_restart_sidebar() {
kill_children();
clash::run_clash_bin();
}
#[tauri::command]
pub async fn get_config_data(url: String) -> Result<String, String> {
match clash::fetch_url(&url).await {
pub async fn cmd_import_profile(url: String) -> Result<String, String> {
match profiles::import_profile(&url).await {
Ok(_) => Ok(String::from("success")),
Err(_) => Err(String::from("error")),
}