Skip to content

Commit

Permalink
plain text /ssh route
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrizhu committed Nov 15, 2023
1 parent 90700a8 commit 6278f79
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod sitemap;
mod feed;
mod webring;
mod pgp;
mod ssh;

async fn health() -> Html<String> {
Html(String::from("OK"))
Expand Down Expand Up @@ -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);

Expand Down
12 changes: 12 additions & 0 deletions src/ssh.rs
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 6278f79

Please sign in to comment.