From af6c4d7e61860547329ba2778f2c35c110a0fb07 Mon Sep 17 00:00:00 2001 From: Ultradesu Date: Sun, 20 Jul 2025 17:37:46 +0300 Subject: [PATCH] Added auto deprecation feature --- Cargo.lock | 2 +- Cargo.toml | 4 +++- src/server.rs | 1 + src/web.rs | 7 +++++++ static/index.html | 5 ++++- static/script.js | 15 +++++++++++++++ static/style.css | 27 +++++++++++++++++++++++++++ 7 files changed, 58 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a102a5c..2ef5b11 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1139,7 +1139,7 @@ dependencies = [ [[package]] name = "khm" -version = "0.6.2" +version = "0.6.3" dependencies = [ "actix-web", "base64 0.21.7", diff --git a/Cargo.toml b/Cargo.toml index 6e1375a..503ba3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,11 +12,13 @@ env_logger = "0.11.3" log = "0.4" regex = "1.10.5" base64 = "0.21" -tokio = { version = "1", features = ["full"] } +tokio = { version = "1", features = ["full", "sync"] } tokio-postgres = { version = "0.7", features = ["with-chrono-0_4"] } tokio-util = { version = "0.7", features = ["codec"] } clap = { version = "4", features = ["derive"] } chrono = "0.4.38" reqwest = { version = "0.12", features = ["json"] } +trust-dns-resolver = "0.23" +futures = "0.3" hostname = "0.3" rust-embed = "8.0" diff --git a/src/server.rs b/src/server.rs index 0bf4d7d..3a75e23 100644 --- a/src/server.rs +++ b/src/server.rs @@ -305,6 +305,7 @@ pub async fn run_server(args: crate::Args) -> std::io::Result<()> { .app_data(web::Data::new(db_client.clone())) .app_data(allowed_flows.clone()) // API routes + .route("/api/version", web::get().to(crate::web::get_version_api)) .route("/api/flows", web::get().to(crate::web::get_flows_api)) .route( "/{flow_id}/scan-dns", diff --git a/src/web.rs b/src/web.rs index 47e85b1..7c9c043 100644 --- a/src/web.rs +++ b/src/web.rs @@ -67,6 +67,13 @@ async fn check_dns_resolution(hostname: String, semaphore: Arc) -> Dn } } +// API endpoint to get application version +pub async fn get_version_api() -> Result { + Ok(HttpResponse::Ok().json(json!({ + "version": env!("CARGO_PKG_VERSION") + }))) +} + // API endpoint to get list of available flows pub async fn get_flows_api(allowed_flows: web::Data>) -> Result { info!("API request for available flows"); diff --git a/static/index.html b/static/index.html index e296358..6954446 100644 --- a/static/index.html +++ b/static/index.html @@ -10,7 +10,10 @@
-

SSH Key Manager

+
+

SSH Key Manager

+ Loading... +