diff --git a/src/main.rs b/src/main.rs index d9e2389..b637e01 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,6 +12,7 @@ mod sitemap; mod feed; mod webring; mod pgp; +mod ssh; async fn health() -> Html { Html(String::from("OK")) @@ -98,6 +99,7 @@ async fn main() { .route("/blog.atom", get(feed::blog_atom::get)) .route("/.well-known/openpgpkey/hu/policy", get(pgp::policy)) .route("/.well-known/openpgpkey/hu/15asjmkpucio5m8a7xznzcxqsqigumxt", get(pgp::pubkey)) + .route("/ssh", get(ssh::sshpub)) .fallback(site::not_found::not_found) .with_state(state); diff --git a/src/ssh.rs b/src/ssh.rs new file mode 100644 index 0000000..b447514 --- /dev/null +++ b/src/ssh.rs @@ -0,0 +1,12 @@ +use std::fs; +use axum::{ + http::HeaderMap, +}; + +pub async fn sshpub() -> (HeaderMap, String) { + let mut resp_header = HeaderMap::new(); + resp_header.insert("Content-Type", "text/plain".parse().unwrap()); + resp_header.insert("Access-Control-Allow-Origin", "*".parse().unwrap()); + let sshraw = fs::read_to_string("assets/files/ssh").unwrap(); + (resp_header, sshraw) +}