pub mod api;
pub mod llms;
pub mod sitemap;
pub mod void;
use std::borrow::Cow;
use axum::{
Router,
routing::{get, post},
};
pub fn routes() -> Router {
Router::new()
.route("/.well-known/api-catalog", get(api::catalog))
.route("/.well-known/dnt-policy.txt", get(dnt_policy))
.route("/.well-known/llms.md", get(llms::file))
.route("/.well-known/security.txt", get(security))
.route("/.well-known/time", get(time))
.route("/.well-known/void", get(void::file))
.route("/favicon.ico", post(favicon))
.route("/llms.txt", get(llms::file))
.route("/robots.txt", get(robots))
.route("/sitemap.xml", get(sitemap::file))
}
#[axum::debug_handler]
async fn dnt_policy() -> Cow<'static, str> {
Cow::from(include_str!("../../etc/dnt-policy.txt"))
}
#[axum::debug_handler]
async fn security() -> Cow<'static, str> {
Cow::from(include_str!("../../etc/security.txt"))
}
#[axum::debug_handler]
async fn time() -> String {
format!("The server time is now {}", jiff::Timestamp::now())
}
#[axum::debug_handler]
async fn favicon() -> Vec<u8> {
Vec::new()
}
#[axum::debug_handler]
async fn robots() -> Cow<'static, str> {
Cow::from(include_str!("../../etc/robots.txt"))
}