mirror of
https://github.com/CrazyJasonwell/clash-verge-rev.git
synced 2026-10-20 14:38:32 +08:00
refactor: done
This commit is contained in:
1 parent
ce2d4498e1
commit
bedd3abf8a
24 files changed
+343
-341
No files matched your search
@@ -1,19 +1,17 @@
|
||||
use crate::{config::Config, utils::dirs};
|
||||
use crate::config::Config;
|
||||
use anyhow::{bail, Result};
|
||||
use reqwest::header::HeaderMap;
|
||||
use serde_yaml::Mapping;
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// PUT /configs
|
||||
pub async fn put_configs() -> Result<()> {
|
||||
/// path 是绝对路径
|
||||
pub async fn put_configs(path: &str) -> Result<()> {
|
||||
let (url, headers) = clash_client_info()?;
|
||||
let url = format!("{url}/configs");
|
||||
|
||||
let runtime_yaml = dirs::clash_runtime_yaml()?;
|
||||
let runtime_yaml = dirs::path_to_str(&runtime_yaml)?;
|
||||
|
||||
let mut data = HashMap::new();
|
||||
data.insert("path", runtime_yaml);
|
||||
data.insert("path", path);
|
||||
|
||||
let client = reqwest::ClientBuilder::new().no_proxy().build()?;
|
||||
let builder = client.put(&url).headers(headers).json(&data);
|
||||
|
||||
Reference in new issue
Block a user