修复发布构建编译错误

This commit is contained in:
2026-05-25 11:14:39 +08:00
parent 8ea2fd028e
commit 4b2b5a2df6
5 changed files with 26 additions and 18 deletions

1
.gitignore vendored
View File

@@ -6,6 +6,7 @@ node_modules/
.npm-cache/
.vfox/
.cargo-home/
.rustup-home/
.vfox-home/
.env
*.db

View File

@@ -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));

View File

@@ -41,8 +41,8 @@ pub fn open(
pixel_height: 0,
})?;
let shell = std::env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_string());
let mut cmd = CommandBuilder::new(shell);
open_with_command(stream_id, tx, pair, &mut cmd)
let cmd = CommandBuilder::new(shell);
open_with_command(stream_id, tx, pair, cmd)
}
pub fn open_docker_exec(
@@ -71,14 +71,14 @@ pub fn open_docker_exec(
cmd.arg("-it");
cmd.arg(container_id);
cmd.arg(shell);
open_with_command(stream_id, tx, pair, &mut cmd)
open_with_command(stream_id, tx, pair, cmd)
}
fn open_with_command(
stream_id: String,
tx: mpsc::UnboundedSender<AgentMessage>,
pair: portable_pty::PtyPair,
cmd: &mut CommandBuilder,
mut cmd: CommandBuilder,
) -> Result<TerminalHandle> {
cmd.env("TERM", "xterm-256color");
let mut child = pair.slave.spawn_command(cmd)?;

View File

@@ -2750,7 +2750,7 @@ async fn open_or_update_alert_event(
.bind(value)
.bind(threshold)
.bind(severity)
.bind(message)
.bind(&message)
.bind(now)
.bind(id)
.execute(&state.pool)
@@ -2768,7 +2768,7 @@ async fn open_or_update_alert_event(
.bind(value)
.bind(threshold)
.bind(severity)
.bind(message)
.bind(&message)
.bind(&now)
.bind(&now)
.execute(&state.pool)

View File

@@ -16,7 +16,7 @@ use lightops_common::api::ApiResponse;
use serde::Deserialize;
use serde_json::{json, Value};
use sqlx::Row;
use std::{fs, path::Path};
use std::{fs, path::Path as FsPath};
use uuid::Uuid;
const STORE_INSTALL_TIMEOUT_SECS: u64 = 600;
@@ -161,7 +161,7 @@ async fn list_store_apps(
.filter(|app| {
q.category
.as_ref()
.is_none_or(|category| app.category == category)
.is_none_or(|category| app.category == *category)
})
.filter(|app| {
q.q.as_ref().is_none_or(|keyword| {
@@ -760,14 +760,14 @@ fn render_compose(
}
fn catalog() -> Vec<StoreApp> {
let configured = load_catalog_from_dir(Path::new(STORE_CATALOG_DIR));
let configured = load_catalog_from_dir(FsPath::new(STORE_CATALOG_DIR));
if !configured.is_empty() {
return configured;
}
default_catalog()
}
fn load_catalog_from_dir(dir: &Path) -> Vec<StoreApp> {
fn load_catalog_from_dir(dir: &FsPath) -> Vec<StoreApp> {
let Ok(entries) = fs::read_dir(dir) else {
return Vec::new();
};
@@ -797,7 +797,7 @@ fn load_catalog_from_dir(dir: &Path) -> Vec<StoreApp> {
}
}
}
apps.sort_by(|left, right| left.name.cmp(&right.name));
apps.sort_by(|left: &StoreApp, right: &StoreApp| left.name.cmp(&right.name));
apps
}