mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
refactor: done
This commit is contained in:
@@ -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