This commit is contained in:
Mylloon 2023-02-08 22:22:20 +01:00
parent d7ee3f903f
commit 9b75dbb7d2
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 24 additions and 4 deletions

View file

@ -19,6 +19,9 @@ async fn main() -> std::io::Result<()> {
.app_data(web::Data::new(config.clone())) .app_data(web::Data::new(config.clone()))
.service(index::page) .service(index::page)
.service(agreements::security) .service(agreements::security)
.service(agreements::humans)
.service(agreements::robots)
.service(agreements::sitemap)
}) })
.bind(addr)? .bind(addr)?
.run() .run()

View file

@ -1,7 +1,6 @@
use std::net::SocketAddr; use actix_web::{get, routes, web, HttpRequest, HttpResponse, Responder};
use actix_web::{routes, web, HttpRequest, HttpResponse, Responder};
use askama::Template; use askama::Template;
use std::net::SocketAddr;
use crate::config::Config; use crate::config::Config;
@ -20,7 +19,7 @@ struct SecurityTemplate {
url: String, url: String,
} }
pub fn get_security(config: Config, addr: Option<SocketAddr>) -> std::string::String { fn get_security(config: Config, addr: Option<SocketAddr>) -> std::string::String {
let data = SecurityTemplate { let data = SecurityTemplate {
contact: config.mail.unwrap_or_default(), contact: config.mail.unwrap_or_default(),
pref_lang: config.lang.unwrap_or_default(), pref_lang: config.lang.unwrap_or_default(),
@ -29,3 +28,21 @@ pub fn get_security(config: Config, addr: Option<SocketAddr>) -> std::string::St
data.render().unwrap() data.render().unwrap()
} }
#[get("/humans.txt")]
pub async fn humans() -> impl Responder {
// TODO
actix_web::web::Redirect::to("/")
}
#[get("/robots.txt")]
pub async fn robots() -> impl Responder {
// TODO
actix_web::web::Redirect::to("/")
}
#[get("/sitemap.xml")]
pub async fn sitemap() -> impl Responder {
// TODO
actix_web::web::Redirect::to("/")
}