diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index f126487..40144be 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,12 +11,13 @@ use markup::Render; use rocket::{ catch, catchers, fairing::AdHoc, + get, http::{ContentType, Header, Status}, response::{self, Responder}, routes, Request, Response, }; use state::{Config, Logic}; -use std::io::Cursor; +use std::{io::Cursor, net::IpAddr}; #[rocket::main] async fn main() { @@ -42,13 +43,18 @@ async fn main() { Box::pin(async {}) })) .manage(state) - .mount("/", routes![r_index, r_embed, r_style, r_image]) + .mount("/", routes![r_index, r_embed, r_style, r_image, r_iptest]) .register("/", catchers![r_catch]) .launch() .await .unwrap(); } +#[get("/myip")] +fn r_iptest(addr: IpAddr) -> String { + format!("{addr}") +} + pub struct Template<T>(pub T); impl<'r, T: Render> Responder<'r, 'static> for Template<T> { fn respond_to(self, _req: &'r Request<'_>) -> response::Result<'static> { |