Add robots.txt #9

This commit is contained in:
Mylloon 2023-02-09 12:01:35 +01:00
parent 6f3beb6368
commit 81a50a237d
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -19,7 +19,7 @@ struct SecurityTemplate {
url: String,
}
fn get_security(config: Config, addr: Option<SocketAddr>) -> std::string::String {
fn get_security(config: Config, addr: Option<SocketAddr>) -> String {
let data = SecurityTemplate {
contact: config.mail.unwrap_or_default(),
pref_lang: config.lang.unwrap_or_default(),
@ -31,14 +31,18 @@ fn get_security(config: Config, addr: Option<SocketAddr>) -> std::string::String
#[get("/humans.txt")]
pub async fn humans() -> impl Responder {
// TODO
// TODO, see https://humanstxt.org/humans.txt
actix_web::web::Redirect::to("/")
}
#[get("/robots.txt")]
pub async fn robots() -> impl Responder {
// TODO
actix_web::web::Redirect::to("/")
HttpResponse::Ok().body(get_robots())
}
fn get_robots() -> String {
// TODO, see https://www.robotstxt.org/orig.html
"User-agent: * Allow: /".to_string()
}
#[get("/sitemap.xml")]