2023-04-09 19:02:06 +02:00
|
|
|
use actix_web::{web, HttpResponse, Responder};
|
2023-04-11 10:45:25 +02:00
|
|
|
use cached::proc_macro::once;
|
2023-02-08 22:27:40 +01:00
|
|
|
|
2023-04-11 10:03:22 +02:00
|
|
|
use crate::{config::Config, template::Infos};
|
2023-02-09 11:19:53 +01:00
|
|
|
|
2023-04-09 19:02:06 +02:00
|
|
|
pub async fn page(config: web::Data<Config>) -> impl Responder {
|
2023-04-20 15:43:25 +02:00
|
|
|
HttpResponse::NotFound().body(build_page(config.get_ref().clone()))
|
2023-02-09 10:55:49 +01:00
|
|
|
}
|
|
|
|
|
2023-04-11 10:45:25 +02:00
|
|
|
#[once(time = 60)]
|
2023-04-20 15:43:25 +02:00
|
|
|
pub fn build_page(config: Config) -> String {
|
2023-04-21 19:47:41 +02:00
|
|
|
config.tmpl.render("404.html", (), Infos::default())
|
2023-02-08 22:27:40 +01:00
|
|
|
}
|