feat: pus_clash_profile support secret
field
This commit is contained in:
parent
0c23845970
commit
48f1b27d93
@ -98,12 +98,19 @@ pub async fn put_clash_profile(payload: &ClashInfoPayload) -> Result<(), String>
|
|||||||
}
|
}
|
||||||
fs::copy(file_path, temp_path.clone()).unwrap();
|
fs::copy(file_path, temp_path.clone()).unwrap();
|
||||||
|
|
||||||
let server = payload.controller.clone().unwrap().server.unwrap();
|
let ctrl = payload.controller.clone().unwrap();
|
||||||
let server = format!("http://{}/configs", server);
|
let server = format!("http://{}/configs", ctrl.server.unwrap());
|
||||||
|
|
||||||
let mut headers = HeaderMap::new();
|
let mut headers = HeaderMap::new();
|
||||||
headers.insert("Content-Type", "application/json".parse().unwrap());
|
headers.insert("Content-Type", "application/json".parse().unwrap());
|
||||||
|
|
||||||
|
if let Some(secret) = ctrl.secret {
|
||||||
|
headers.insert(
|
||||||
|
"Authorization",
|
||||||
|
format!("Bearer {}", secret).parse().unwrap(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let mut data = HashMap::new();
|
let mut data = HashMap::new();
|
||||||
data.insert("path", temp_path.as_os_str().to_str().unwrap());
|
data.insert("path", temp_path.as_os_str().to_str().unwrap());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user