forked from Eeveid/lightOps
修复发布构建编译错误
This commit is contained in:
@@ -166,9 +166,11 @@ async fn system_snapshot() -> Result<Value> {
|
||||
)
|
||||
.await
|
||||
.unwrap_or_default();
|
||||
let ports = command_lines(Command::new("ss").args(["-H", "-tulpen"]), 8)
|
||||
.await
|
||||
.or_else(|_| command_lines(Command::new("netstat").args(["-tulpen"]), 8).await)
|
||||
let ports_result = match command_lines(Command::new("ss").args(["-H", "-tulpen"]), 8).await {
|
||||
Ok(lines) => Ok(lines),
|
||||
Err(_) => command_lines(Command::new("netstat").args(["-tulpen"]), 8).await,
|
||||
};
|
||||
let ports = ports_result
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.take(80)
|
||||
@@ -762,9 +764,14 @@ async fn nginx_ssl_status() -> Result<Value> {
|
||||
.unwrap_or(false);
|
||||
let version = certbot
|
||||
.as_ref()
|
||||
.map(stderr_text)
|
||||
.filter(|text| !text.trim().is_empty())
|
||||
.or_else(|| certbot.as_ref().map(stdout_text))
|
||||
.map(|output| {
|
||||
let stderr = stderr_text(output);
|
||||
if stderr.trim().is_empty() {
|
||||
stdout_text(output)
|
||||
} else {
|
||||
stderr
|
||||
}
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let certbot_timer = run_command(
|
||||
Command::new("systemctl").args(["is-enabled", "certbot.timer"]),
|
||||
@@ -1776,7 +1783,7 @@ fn push_unique_json_string(obj: &mut serde_json::Map<String, Value>, key: &str,
|
||||
if value.is_empty() {
|
||||
return;
|
||||
}
|
||||
let values = obj.entry(key.into()).or_insert_with(|| json!([]));
|
||||
let values = obj.entry(key.to_string()).or_insert_with(|| json!([]));
|
||||
if let Some(array) = values.as_array_mut() {
|
||||
if !array.iter().any(|item| item.as_str() == Some(value)) {
|
||||
array.push(json!(value));
|
||||
|
||||
Reference in New Issue
Block a user