use actix_web::{get, web, HttpRequest, HttpResponse, Responder}; use cached::proc_macro::once; use crate::{config::Config, misc::utils::get_url, template::Infos}; #[get("/")] pub async fn page(req: HttpRequest, config: web::Data) -> impl Responder { HttpResponse::Ok().body(build_page( config.get_ref().to_owned(), get_url(req.connection_info()), )) } #[once(time = 60)] pub fn build_page(config: Config, url: String) -> String { println!("{url}"); config.tmpl.render( "index.html", (), Infos { page_title: config.fc.fullname, page_desc: Some("Page principale".into()), page_kw: None, url, }, ) }