Fix: Update source files and fix notify dependency reference
All checks were successful
BotServer CI / build (push) Successful in 11m35s
All checks were successful
BotServer CI / build (push) Successful in 11m35s
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5ea171d126
commit
17cb4ef147
18 changed files with 38 additions and 75 deletions
|
|
@ -38,7 +38,7 @@ use diesel::prelude::*;
|
|||
use log::trace;
|
||||
use std::error::Error;
|
||||
|
||||
use super::basic_io::{execute_delete_file, execute_read, execute_write};
|
||||
use super::basic_io::execute_delete_file;
|
||||
|
||||
pub async fn execute_copy(
|
||||
state: &AppState,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::core::shared::models::UserSession;
|
||||
use crate::core::shared::state::AppState;
|
||||
use log::trace;
|
||||
use rhai::{Dynamic, Engine, EvalAltResult};
|
||||
use rhai::{Engine, EvalAltResult};
|
||||
use serde_json::json;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use super::types::{InputType, ValidationResult};
|
||||
use log::trace;
|
||||
use regex::Regex;
|
||||
use uuid::Uuid;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
// Bootstrap manager implementation
|
||||
use crate::core::bootstrap::bootstrap_types::{BootstrapManager, BootstrapProgress};
|
||||
use crate::core::bootstrap::bootstrap_utils::{safe_pkill, safe_pgrep, safe_sh_command, safe_curl, safe_fuser, dump_all_component_logs, vault_health_check};
|
||||
use crate::core::bootstrap::bootstrap_utils::{safe_pkill, vault_health_check};
|
||||
use crate::core::config::AppConfig;
|
||||
use crate::core::package_manager::{PackageManager, InstallMode};
|
||||
use anyhow::Result;
|
||||
use chrono::Utc;
|
||||
use log::{debug, error, info, warn};
|
||||
use rand::distr::Alphanumeric;
|
||||
use crate::core::package_manager::{InstallMode, PackageManager};
|
||||
use log::{info, warn};
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use tokio::time::{sleep, Duration};
|
||||
use uuid::Uuid;
|
||||
|
||||
impl BootstrapManager {
|
||||
pub fn new(mode: InstallMode, tenant: Option<String>) -> Self {
|
||||
|
|
@ -36,7 +32,7 @@ impl BootstrapManager {
|
|||
.to_string()
|
||||
}
|
||||
|
||||
pub async fn kill_stack_processes(&self) -> Result<()> {
|
||||
pub async fn kill_stack_processes(&self) -> anyhow::Result<()> {
|
||||
info!("Killing any existing stack processes...");
|
||||
|
||||
let processes = crate::core::bootstrap::bootstrap_utils::get_processes_to_kill();
|
||||
|
|
@ -52,7 +48,7 @@ impl BootstrapManager {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn start_all(&mut self) -> Result<()> {
|
||||
pub async fn start_all(&mut self) -> anyhow::Result<()> {
|
||||
let pm = PackageManager::new(self.install_mode.clone(), self.tenant.clone())?;
|
||||
|
||||
info!("Starting bootstrap process...");
|
||||
|
|
@ -67,7 +63,7 @@ impl BootstrapManager {
|
|||
Ok(_child) => {
|
||||
info!("Vault process started, waiting for initialization...");
|
||||
// Wait for vault to be ready
|
||||
for i in 0..10 {
|
||||
for _ in 0..10 {
|
||||
sleep(Duration::from_secs(1)).await;
|
||||
if vault_health_check() {
|
||||
info!("Vault is responding");
|
||||
|
|
@ -153,7 +149,7 @@ impl BootstrapManager {
|
|||
}
|
||||
|
||||
/// Run the bootstrap process
|
||||
pub async fn bootstrap(&mut self) -> Result<()> {
|
||||
pub async fn bootstrap(&mut self) -> anyhow::Result<()> {
|
||||
info!("Starting bootstrap process...");
|
||||
// Kill any existing processes
|
||||
self.kill_stack_processes().await?;
|
||||
|
|
@ -161,14 +157,14 @@ impl BootstrapManager {
|
|||
}
|
||||
|
||||
/// Sync templates to database
|
||||
pub fn sync_templates_to_database(&self) -> Result<()> {
|
||||
pub fn sync_templates_to_database(&self) -> anyhow::Result<()> {
|
||||
info!("Syncing templates to database...");
|
||||
// TODO: Implement actual template sync
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Upload templates to drive
|
||||
pub async fn upload_templates_to_drive(&self, _cfg: &AppConfig) -> Result<()> {
|
||||
pub async fn upload_templates_to_drive(&self, _cfg: &AppConfig) -> anyhow::Result<()> {
|
||||
info!("Uploading templates to drive...");
|
||||
// TODO: Implement actual template upload
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
// Bootstrap type definitions
|
||||
use crate::core::package_manager::InstallMode;
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,6 @@
|
|||
// Bootstrap utility functions
|
||||
use crate::core::config::AppConfig;
|
||||
use crate::core::package_manager::setup::{DirectorySetup, EmailSetup, VectorDbSetup};
|
||||
use crate::core::package_manager::{InstallMode, PackageManager};
|
||||
use crate::security::command_guard::SafeCommand;
|
||||
use crate::core::shared::utils::{establish_pg_connection, init_secrets_manager};
|
||||
use anyhow::Result;
|
||||
use log::{debug, error, info, warn};
|
||||
use rand::distr::Alphanumeric;
|
||||
use log::{debug, info, warn};
|
||||
use std::process::Command;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Get list of processes to kill
|
||||
pub fn get_processes_to_kill() -> Vec<(&'static str, Vec<&'static str>)> {
|
||||
|
|
@ -42,11 +34,7 @@ pub fn safe_pkill(pattern: &[&str], extra_args: &[&str]) {
|
|||
let mut args: Vec<&str> = extra_args.to_vec();
|
||||
args.extend(pattern);
|
||||
|
||||
let result = if cfg!(feature = "sigkill") {
|
||||
Command::new("killall").args(&args).output()
|
||||
} else {
|
||||
Command::new("pkill").args(&args).output()
|
||||
};
|
||||
let result = Command::new("pkill").args(&args).output();
|
||||
|
||||
match result {
|
||||
Ok(output) => {
|
||||
|
|
|
|||
|
|
@ -5,13 +5,12 @@ use axum::{
|
|||
http::StatusCode,
|
||||
response::{IntoResponse, Json},
|
||||
};
|
||||
use diesel::prelude::*;
|
||||
use log::info;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Get current configuration
|
||||
pub async fn get_config(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
) -> impl IntoResponse {
|
||||
// Return default empty config for now
|
||||
let configs = vec![
|
||||
|
|
@ -32,7 +31,7 @@ pub async fn get_config(
|
|||
|
||||
/// Update configuration
|
||||
pub async fn update_config(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Json(request): Json<UpdateConfigRequest>,
|
||||
) -> impl IntoResponse {
|
||||
info!("Updating config: {} = {}", request.key, request.value);
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ use lettre::{
|
|||
transport::smtp::authentication::Credentials,
|
||||
SmtpTransport, Transport,
|
||||
};
|
||||
use log::warn;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Send invitation email
|
||||
#[cfg(feature = "mail")]
|
||||
|
|
|
|||
|
|
@ -2,20 +2,18 @@
|
|||
use crate::core::shared::state::AppState;
|
||||
use crate::drive::drive_types::*;
|
||||
use axum::{
|
||||
extract::{Path, Query, State},
|
||||
extract::{Path, State},
|
||||
http::StatusCode,
|
||||
response::IntoResponse,
|
||||
Json,
|
||||
};
|
||||
use chrono::Utc;
|
||||
use log::{debug, error, info};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Open a file for editing
|
||||
pub async fn open_file(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Path(file_id): Path<String>,
|
||||
) -> Result<Json<FileItem>, (StatusCode, Json<serde_json::Value>)> {
|
||||
tracing::debug!("Opening file: {}", file_id);
|
||||
|
|
@ -42,7 +40,7 @@ pub async fn open_file(
|
|||
|
||||
/// List all buckets
|
||||
pub async fn list_buckets(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
) -> Result<Json<Vec<BucketInfo>>, (StatusCode, Json<serde_json::Value>)> {
|
||||
tracing::debug!("Listing buckets");
|
||||
|
||||
|
|
@ -54,7 +52,7 @@ pub async fn list_buckets(
|
|||
|
||||
/// List files in a bucket
|
||||
pub async fn list_files(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Json(req): Json<SearchQuery>,
|
||||
) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> {
|
||||
let query = req.query.clone().unwrap_or_default();
|
||||
|
|
@ -70,7 +68,7 @@ pub async fn list_files(
|
|||
|
||||
/// Read file content
|
||||
pub async fn read_file(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Path(file_id): Path<String>,
|
||||
) -> Result<Json<FileItem>, (StatusCode, Json<serde_json::Value>)> {
|
||||
tracing::debug!("Reading file: {}", file_id);
|
||||
|
|
@ -97,7 +95,7 @@ pub async fn read_file(
|
|||
|
||||
/// Write file content
|
||||
pub async fn write_file(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Json(req): Json<WriteRequest>,
|
||||
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
|
||||
let file_id = req.file_id.unwrap_or_else(|| Uuid::new_v4().to_string());
|
||||
|
|
@ -110,7 +108,7 @@ pub async fn write_file(
|
|||
|
||||
/// Delete a file
|
||||
pub async fn delete_file(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Path(file_id): Path<String>,
|
||||
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
|
||||
tracing::debug!("Deleting file: {}", file_id);
|
||||
|
|
@ -121,10 +119,10 @@ pub async fn delete_file(
|
|||
|
||||
/// Create a folder
|
||||
pub async fn create_folder(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Json(req): Json<CreateFolderRequest>,
|
||||
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
|
||||
let parent_id = req.parent_id.clone().unwrap_or_default();
|
||||
let _parent_id = req.parent_id.clone().unwrap_or_default();
|
||||
|
||||
tracing::debug!("Creating folder: {:?}", req.name);
|
||||
|
||||
|
|
@ -134,8 +132,8 @@ pub async fn create_folder(
|
|||
|
||||
/// Copy a file
|
||||
pub async fn copy_file(
|
||||
State(state): State<Arc<AppState>>,
|
||||
Json(req): Json<CopyFileRequest>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Json(_req): Json<CopyFileRequest>,
|
||||
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
|
||||
tracing::debug!("Copying file");
|
||||
|
||||
|
|
@ -145,8 +143,8 @@ pub async fn copy_file(
|
|||
|
||||
/// Upload file to drive
|
||||
pub async fn upload_file_to_drive(
|
||||
State(state): State<Arc<AppState>>,
|
||||
Json(req): Json<UploadRequest>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Json(_req): Json<UploadRequest>,
|
||||
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
|
||||
tracing::debug!("Uploading to drive");
|
||||
|
||||
|
|
@ -156,7 +154,7 @@ pub async fn upload_file_to_drive(
|
|||
|
||||
/// Download file
|
||||
pub async fn download_file(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Path(file_id): Path<String>,
|
||||
) -> Result<Json<FileItem>, (StatusCode, Json<serde_json::Value>)> {
|
||||
tracing::debug!("Downloading file: {}", file_id);
|
||||
|
|
@ -183,8 +181,8 @@ pub async fn download_file(
|
|||
|
||||
/// List folder contents
|
||||
pub async fn list_folder_contents(
|
||||
State(state): State<Arc<AppState>>,
|
||||
Json(req): Json<SearchQuery>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Json(_req): Json<SearchQuery>,
|
||||
) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> {
|
||||
tracing::debug!("Listing folder contents");
|
||||
|
||||
|
|
@ -196,7 +194,7 @@ pub async fn list_folder_contents(
|
|||
|
||||
/// Search files
|
||||
pub async fn search_files(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Json(req): Json<SearchQuery>,
|
||||
) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> {
|
||||
let query = req.query.clone().unwrap_or_default();
|
||||
|
|
@ -212,7 +210,7 @@ pub async fn search_files(
|
|||
|
||||
/// Get recent files
|
||||
pub async fn recent_files(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> {
|
||||
tracing::debug!("Getting recent files");
|
||||
|
||||
|
|
@ -224,7 +222,7 @@ pub async fn recent_files(
|
|||
|
||||
/// List favorites
|
||||
pub async fn list_favorites(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> {
|
||||
tracing::debug!("Listing favorites");
|
||||
|
||||
|
|
@ -236,8 +234,8 @@ pub async fn list_favorites(
|
|||
|
||||
/// Share folder
|
||||
pub async fn share_folder(
|
||||
State(state): State<Arc<AppState>>,
|
||||
Json(req): Json<ShareRequest>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Json(_req): Json<ShareRequest>,
|
||||
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
|
||||
tracing::debug!("Sharing folder");
|
||||
|
||||
|
|
@ -247,7 +245,7 @@ pub async fn share_folder(
|
|||
|
||||
/// List shared files/folders
|
||||
pub async fn list_shared(
|
||||
State(state): State<Arc<AppState>>,
|
||||
State(_state): State<Arc<AppState>>,
|
||||
) -> Result<Json<Vec<FileItem>>, (StatusCode, Json<serde_json::Value>)> {
|
||||
tracing::debug!("Listing shared resources");
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct FileItem {
|
||||
|
|
|
|||
|
|
@ -151,7 +151,6 @@ async fn main() -> std::io::Result<()> {
|
|||
init_database, init_logging_and_i18n, load_config, parse_cli_args, run_axum_server,
|
||||
run_bootstrap, start_background_services, BootstrapProgress,
|
||||
};
|
||||
use crate::core::package_manager::InstallMode;
|
||||
use crate::core::shared::memory_monitor::MemoryStats;
|
||||
use crate::core::shared::memory_monitor::register_thread;
|
||||
use crate::security::set_global_panic_hook;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ use crate::core::session::SessionManager;
|
|||
use crate::core::shared::state::AppState;
|
||||
use crate::core::shared::utils::create_conn;
|
||||
use crate::core::shared::utils::create_s3_operator;
|
||||
use crate::security::set_global_panic_hook;
|
||||
|
||||
use super::BootstrapProgress;
|
||||
|
||||
|
|
@ -682,9 +681,7 @@ pub async fn start_background_services(
|
|||
pool: &crate::core::shared::utils::DbPool,
|
||||
) {
|
||||
#[cfg(feature = "drive")]
|
||||
use crate::DriveMonitor;
|
||||
use crate::core::shared::memory_monitor::{log_process_memory, start_memory_monitor};
|
||||
use crate::core::shared::memory_monitor::register_thread;
|
||||
|
||||
// Resume workflows after server restart
|
||||
if let Err(e) =
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
//! HTTP server initialization and routing
|
||||
|
||||
use axum::extract::State;
|
||||
use axum::{
|
||||
routing::{get, post},
|
||||
Json, Router,
|
||||
};
|
||||
use log::{error, info, trace, warn};
|
||||
use log::{error, info, warn};
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
use tower_http::trace::TraceLayer;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use crate::security::auth_api::{config::AuthConfig, error::AuthError, types::AuthenticatedUser};
|
||||
use axum::body::Body;
|
||||
use std::sync::Arc;
|
||||
use tracing::{debug, warn};
|
||||
use uuid::Uuid;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,3 @@ pub mod types;
|
|||
// Re-export scheduler
|
||||
pub use scheduler::TaskScheduler;
|
||||
|
||||
// Import types from types module
|
||||
use crate::tasks::types::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
use crate::core::shared::utils::DbPool;
|
||||
use crate::tasks::types::*;
|
||||
use chrono::Utc;
|
||||
use diesel::prelude::*;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::RwLock;
|
||||
use uuid::Uuid;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
//! HTTP handlers for task API
|
||||
use crate::auto_task::TaskManifest;
|
||||
use crate::core::shared::state::AppState;
|
||||
use crate::tasks::task_api::{html_renderers, utils};
|
||||
use crate::tasks::types::TaskResponse;
|
||||
|
|
@ -8,7 +7,6 @@ use axum::http::StatusCode;
|
|||
use axum::response::{IntoResponse, Json};
|
||||
use axum::routing::{delete, get, post, put};
|
||||
use axum::Router;
|
||||
use chrono::Utc;
|
||||
use diesel::prelude::*;
|
||||
use log::{error, info, warn};
|
||||
use std::sync::Arc;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
//! Utility functions for task API
|
||||
use crate::auto_task::TaskManifest;
|
||||
use crate::core::shared::state::AppState;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue