Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
48 lines
1.4 KiB
Rust
48 lines
1.4 KiB
Rust
use axum::{
|
|
extract::State,
|
|
http::StatusCode,
|
|
response::Json,
|
|
};
|
|
|
|
use crate::modes::server::common::{AppState, ApiResponse};
|
|
use crate::common::status::StatusInfo;
|
|
|
|
#[utoipa::path(
|
|
get,
|
|
path = "/api/status",
|
|
operation_id = "keep_status",
|
|
summary = "Get system status",
|
|
description = "Retrieve system status including database info, storage paths, compression engines, and metadata plugins.",
|
|
responses(
|
|
(status = 200, description = "System status retrieved", body = StatusInfoResponse),
|
|
(status = 401, description = "Unauthorized"),
|
|
(status = 500, description = "Internal server error")
|
|
),
|
|
security(
|
|
("bearerAuth" = [])
|
|
),
|
|
tag = "status"
|
|
)]
|
|
pub async fn handle_status(
|
|
State(state): State<AppState>,
|
|
) -> Result<Json<ApiResponse<StatusInfo>>, StatusCode> {
|
|
|
|
// Get database path
|
|
let db_path = state.db.lock().await.path().unwrap_or("unknown").to_string();
|
|
|
|
// Use the status service to generate status info showing all supported plugins
|
|
let status_service = crate::services::status_service::StatusService::new();
|
|
let status_info = status_service.generate_supported_status(
|
|
state.data_dir.clone(),
|
|
db_path.into(),
|
|
);
|
|
|
|
let response = ApiResponse {
|
|
success: true,
|
|
data: Some(status_info),
|
|
error: None,
|
|
};
|
|
|
|
Ok(Json(response))
|
|
}
|