refactor: organize Rust modules and simplify deployment README

This commit is contained in:
junior
2026-10-17 22:59:25 +08:00
parent 68c972dadd
commit ceb3e5e2b5
37 changed files with 1029 additions and 1225 deletions
+24
View File
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: GPL-2.0-only
use super::State;
use crate::error::Result;
use actix_web::HttpResponse;
pub(super) async fn status(state: State) -> Result<HttpResponse> {
let active = state.store.active_downloader_id().await?;
Ok(HttpResponse::Ok().json(serde_json::json!({
"downloader_configured": active.is_some(),
"active_downloader_id": active,
"active_destination_id": state.store.active_destination_id().await?,
"legacy_unassigned_jobs": state.store.legacy_unassigned_count().await?,
"version": env!("CARGO_PKG_VERSION")
})))
}
pub(super) async fn run(state: State) -> Result<HttpResponse> {
Ok(HttpResponse::Ok().json(state.cycle().await?))
}
pub(super) async fn health() -> HttpResponse {
HttpResponse::Ok()
.json(serde_json::json!({"status": "ok", "version": env!("CARGO_PKG_VERSION")}))
}