Skip to content
Snippets Groups Projects
Unverified Commit 5504994c authored by GyDi's avatar GyDi Committed by GitHub
Browse files

feat: check remote profile field

parent acff6d04
No related branches found
No related tags found
No related merge requests found
...@@ -282,8 +282,11 @@ impl PrfItem { ...@@ -282,8 +282,11 @@ impl PrfItem {
let data = resp.text_with_charset("utf-8").await?; let data = resp.text_with_charset("utf-8").await?;
// check the data whether the valid yaml format // check the data whether the valid yaml format
if !serde_yaml::from_str::<Mapping>(&data).is_ok() { let yaml = serde_yaml::from_str::<Mapping>(&data) //
bail!("the remote profile data is invalid yaml"); .context("the remote profile data is invalid yaml")?;
if !yaml.contains_key("proxies") || !yaml.contains_key("proxy-providers") {
bail!("profile does not contain `proxies` or `proxy-providers`");
} }
Ok(PrfItem { Ok(PrfItem {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment