mirror of
https://github.com/house-of-vanity/khm.git
synced 2025-08-21 14:27:14 +00:00
Added web ui
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "khm"
|
name = "khm"
|
||||||
version = "0.8.0"
|
version = "0.8.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["AB <ab@hexor.cy>"]
|
authors = ["AB <ab@hexor.cy>"]
|
||||||
|
|
||||||
|
@@ -89,6 +89,7 @@ pub async fn get_keys(
|
|||||||
flow_id: web::Path<String>,
|
flow_id: web::Path<String>,
|
||||||
allowed_flows: web::Data<Vec<String>>,
|
allowed_flows: web::Data<Vec<String>>,
|
||||||
req: HttpRequest,
|
req: HttpRequest,
|
||||||
|
query: web::Query<std::collections::HashMap<String, String>>,
|
||||||
) -> impl Responder {
|
) -> impl Responder {
|
||||||
let client_hostname = get_client_hostname(&req);
|
let client_hostname = get_client_hostname(&req);
|
||||||
let flow_id_str = flow_id.into_inner();
|
let flow_id_str = flow_id.into_inner();
|
||||||
@@ -108,10 +109,24 @@ pub async fn get_keys(
|
|||||||
|
|
||||||
let flows = flows.lock().unwrap();
|
let flows = flows.lock().unwrap();
|
||||||
if let Some(flow) = flows.iter().find(|flow| flow.name == flow_id_str) {
|
if let Some(flow) = flows.iter().find(|flow| flow.name == flow_id_str) {
|
||||||
let servers: Vec<&SshKey> = flow.servers.iter().collect();
|
// Check if we should include deprecated keys (default: false for CLI clients)
|
||||||
|
let include_deprecated = query.get("include_deprecated")
|
||||||
|
.map(|v| v == "true")
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
|
let servers: Vec<&SshKey> = if include_deprecated {
|
||||||
|
// Return all keys (for web interface)
|
||||||
|
flow.servers.iter().collect()
|
||||||
|
} else {
|
||||||
|
// Return only active keys (for CLI clients)
|
||||||
|
flow.servers.iter().filter(|key| !key.deprecated).collect()
|
||||||
|
};
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
"Returning {} keys for flow '{}' to client '{}'",
|
"Returning {} keys ({} total, deprecated filtered: {}) for flow '{}' to client '{}'",
|
||||||
servers.len(),
|
servers.len(),
|
||||||
|
flow.servers.len(),
|
||||||
|
!include_deprecated,
|
||||||
flow_id_str,
|
flow_id_str,
|
||||||
client_hostname
|
client_hostname
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user