//! nested `/.me` //! //! Routes that return a 307 Temporary Redirect to information about me. These //! routes use different schemes to open the email application or phone dailer etc. etc. use axum::{Extension, Router, body::Body, http::StatusCode, response::Response, routing::get}; use crate::{RuntimeError, config::Settings, state::SplormState}; /// Routes nested under /.me pub fn routes() -> Router { Router::new().route("/email", get(email)) } async fn email(Extension(settings): Extension) -> Result { Response::builder() .status(StatusCode::TEMPORARY_REDIRECT) .header("Location", format!("mailto:{}", settings.me_email())) .body(Body::empty()) .map_err(|_| RuntimeError::Unknown) }