修复发布构建编译错误
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,6 +6,7 @@ node_modules/
|
|||||||
.npm-cache/
|
.npm-cache/
|
||||||
.vfox/
|
.vfox/
|
||||||
.cargo-home/
|
.cargo-home/
|
||||||
|
.rustup-home/
|
||||||
.vfox-home/
|
.vfox-home/
|
||||||
.env
|
.env
|
||||||
*.db
|
*.db
|
||||||
|
|||||||
@@ -166,9 +166,11 @@ async fn system_snapshot() -> Result<Value> {
|
|||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let ports = command_lines(Command::new("ss").args(["-H", "-tulpen"]), 8)
|
let ports_result = match command_lines(Command::new("ss").args(["-H", "-tulpen"]), 8).await {
|
||||||
.await
|
Ok(lines) => Ok(lines),
|
||||||
.or_else(|_| command_lines(Command::new("netstat").args(["-tulpen"]), 8).await)
|
Err(_) => command_lines(Command::new("netstat").args(["-tulpen"]), 8).await,
|
||||||
|
};
|
||||||
|
let ports = ports_result
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.take(80)
|
.take(80)
|
||||||
@@ -762,9 +764,14 @@ async fn nginx_ssl_status() -> Result<Value> {
|
|||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
let version = certbot
|
let version = certbot
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(stderr_text)
|
.map(|output| {
|
||||||
.filter(|text| !text.trim().is_empty())
|
let stderr = stderr_text(output);
|
||||||
.or_else(|| certbot.as_ref().map(stdout_text))
|
if stderr.trim().is_empty() {
|
||||||
|
stdout_text(output)
|
||||||
|
} else {
|
||||||
|
stderr
|
||||||
|
}
|
||||||
|
})
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let certbot_timer = run_command(
|
let certbot_timer = run_command(
|
||||||
Command::new("systemctl").args(["is-enabled", "certbot.timer"]),
|
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() {
|
if value.is_empty() {
|
||||||
return;
|
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 let Some(array) = values.as_array_mut() {
|
||||||
if !array.iter().any(|item| item.as_str() == Some(value)) {
|
if !array.iter().any(|item| item.as_str() == Some(value)) {
|
||||||
array.push(json!(value));
|
array.push(json!(value));
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ pub fn open(
|
|||||||
pixel_height: 0,
|
pixel_height: 0,
|
||||||
})?;
|
})?;
|
||||||
let shell = std::env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_string());
|
let shell = std::env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_string());
|
||||||
let mut cmd = CommandBuilder::new(shell);
|
let cmd = CommandBuilder::new(shell);
|
||||||
open_with_command(stream_id, tx, pair, &mut cmd)
|
open_with_command(stream_id, tx, pair, cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn open_docker_exec(
|
pub fn open_docker_exec(
|
||||||
@@ -71,14 +71,14 @@ pub fn open_docker_exec(
|
|||||||
cmd.arg("-it");
|
cmd.arg("-it");
|
||||||
cmd.arg(container_id);
|
cmd.arg(container_id);
|
||||||
cmd.arg(shell);
|
cmd.arg(shell);
|
||||||
open_with_command(stream_id, tx, pair, &mut cmd)
|
open_with_command(stream_id, tx, pair, cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open_with_command(
|
fn open_with_command(
|
||||||
stream_id: String,
|
stream_id: String,
|
||||||
tx: mpsc::UnboundedSender<AgentMessage>,
|
tx: mpsc::UnboundedSender<AgentMessage>,
|
||||||
pair: portable_pty::PtyPair,
|
pair: portable_pty::PtyPair,
|
||||||
cmd: &mut CommandBuilder,
|
mut cmd: CommandBuilder,
|
||||||
) -> Result<TerminalHandle> {
|
) -> Result<TerminalHandle> {
|
||||||
cmd.env("TERM", "xterm-256color");
|
cmd.env("TERM", "xterm-256color");
|
||||||
let mut child = pair.slave.spawn_command(cmd)?;
|
let mut child = pair.slave.spawn_command(cmd)?;
|
||||||
|
|||||||
@@ -2750,7 +2750,7 @@ async fn open_or_update_alert_event(
|
|||||||
.bind(value)
|
.bind(value)
|
||||||
.bind(threshold)
|
.bind(threshold)
|
||||||
.bind(severity)
|
.bind(severity)
|
||||||
.bind(message)
|
.bind(&message)
|
||||||
.bind(now)
|
.bind(now)
|
||||||
.bind(id)
|
.bind(id)
|
||||||
.execute(&state.pool)
|
.execute(&state.pool)
|
||||||
@@ -2768,7 +2768,7 @@ async fn open_or_update_alert_event(
|
|||||||
.bind(value)
|
.bind(value)
|
||||||
.bind(threshold)
|
.bind(threshold)
|
||||||
.bind(severity)
|
.bind(severity)
|
||||||
.bind(message)
|
.bind(&message)
|
||||||
.bind(&now)
|
.bind(&now)
|
||||||
.bind(&now)
|
.bind(&now)
|
||||||
.execute(&state.pool)
|
.execute(&state.pool)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ use lightops_common::api::ApiResponse;
|
|||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
use sqlx::Row;
|
use sqlx::Row;
|
||||||
use std::{fs, path::Path};
|
use std::{fs, path::Path as FsPath};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
const STORE_INSTALL_TIMEOUT_SECS: u64 = 600;
|
const STORE_INSTALL_TIMEOUT_SECS: u64 = 600;
|
||||||
@@ -161,7 +161,7 @@ async fn list_store_apps(
|
|||||||
.filter(|app| {
|
.filter(|app| {
|
||||||
q.category
|
q.category
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.is_none_or(|category| app.category == category)
|
.is_none_or(|category| app.category == *category)
|
||||||
})
|
})
|
||||||
.filter(|app| {
|
.filter(|app| {
|
||||||
q.q.as_ref().is_none_or(|keyword| {
|
q.q.as_ref().is_none_or(|keyword| {
|
||||||
@@ -760,14 +760,14 @@ fn render_compose(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn catalog() -> Vec<StoreApp> {
|
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() {
|
if !configured.is_empty() {
|
||||||
return configured;
|
return configured;
|
||||||
}
|
}
|
||||||
default_catalog()
|
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 {
|
let Ok(entries) = fs::read_dir(dir) else {
|
||||||
return Vec::new();
|
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
|
apps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user