Skip to content
Snippets Groups Projects
Unverified Commit 6d0625c4 authored by GyDi's avatar GyDi
Browse files

fix: improve external-controller parse and log

parent 2f1ea08b
No related branches found
No related tags found
No related merge requests found
...@@ -49,15 +49,16 @@ impl ClashInfo { ...@@ -49,15 +49,16 @@ impl ClashInfo {
// `external-controller` could be // `external-controller` could be
// "127.0.0.1:9090" or ":9090" // "127.0.0.1:9090" or ":9090"
// "9090" or 9090 (clash do not support this)
let server = match config.get(&key_server) { let server = match config.get(&key_server) {
Some(value) => match value { Some(value) => {
Value::String(val_str) => match val_str.starts_with(":") { let val_str = value.as_str().unwrap_or("");
true => Some(format!("127.0.0.1{val_str}")),
false => Some(val_str.clone()), if val_str.starts_with(":") {
}, Some(format!("127.0.0.1{val_str}"))
_ => None, } else {
}, Some(val_str.into())
}
}
_ => None, _ => None,
}; };
......
...@@ -139,7 +139,11 @@ impl Service { ...@@ -139,7 +139,11 @@ impl Service {
config::save_yaml(temp_path.clone(), &config, Some("# Clash Verge Temp File"))?; config::save_yaml(temp_path.clone(), &config, Some("# Clash Verge Temp File"))?;
if info.server.is_none() { if info.server.is_none() {
bail!("failed to parse the server"); if info.port.is_none() {
bail!("failed to parse config.yaml file");
} else {
bail!("failed to parse the server");
}
} }
let server = info.server.unwrap(); let server = info.server.unwrap();
......
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