Style rework #35

Merged
Anri merged 70 commits from rework into main 2023-10-15 20:58:23 +02:00
15 changed files with 26 additions and 26 deletions
Showing only changes of commit df7e9d068b - Show all commits

View file

@ -86,7 +86,7 @@ pub fn get_options() -> ComrakOptions {
} }
/// Transform markdown string to File structure /// Transform markdown string to File structure
pub fn read(raw_text: &str) -> File { fn read(raw_text: &str) -> File {
let arena = Arena::new(); let arena = Arena::new();
let options = get_options(); let options = get_options();

View file

@ -6,7 +6,7 @@ use ramhorns::Content;
#[routes] #[routes]
#[get("/.well-known/security.txt")] #[get("/.well-known/security.txt")]
#[get("/security.txt")] #[get("/security.txt")]
pub async fn security(req: HttpRequest, config: web::Data<Config>) -> impl Responder { async fn security(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
HttpResponse::Ok().body(build_securitytxt( HttpResponse::Ok().body(build_securitytxt(
config.get_ref().to_owned(), config.get_ref().to_owned(),
get_url(req.connection_info()), get_url(req.connection_info()),
@ -34,7 +34,7 @@ fn build_securitytxt(config: Config, url: String) -> String {
} }
#[get("/humans.txt")] #[get("/humans.txt")]
pub async fn humans(config: web::Data<Config>) -> impl Responder { async fn humans(config: web::Data<Config>) -> impl Responder {
HttpResponse::Ok().body(build_humanstxt(config.get_ref().to_owned())) HttpResponse::Ok().body(build_humanstxt(config.get_ref().to_owned()))
} }
@ -59,7 +59,7 @@ fn build_humanstxt(config: Config) -> String {
} }
#[get("/robots.txt")] #[get("/robots.txt")]
pub async fn robots() -> impl Responder { async fn robots() -> impl Responder {
HttpResponse::Ok().body(build_robotstxt()) HttpResponse::Ok().body(build_robotstxt())
} }
@ -69,7 +69,7 @@ fn build_robotstxt() -> String {
} }
#[get("/sitemap.xml")] #[get("/sitemap.xml")]
pub async fn sitemap() -> impl Responder { async fn sitemap() -> impl Responder {
// TODO // TODO
actix_web::web::Redirect::to("/") actix_web::web::Redirect::to("/")
} }

View file

@ -7,7 +7,7 @@ struct Info {
} }
#[get("/love")] #[get("/love")]
pub async fn love() -> impl Responder { async fn love() -> impl Responder {
HttpResponse::Ok().json(Info { HttpResponse::Ok().json(Info {
unix_epoch: 1605576600, unix_epoch: 1605576600,
}) })

View file

@ -27,7 +27,7 @@ use crate::{
const MIME_TYPE_RSS: &str = "application/rss+xml"; const MIME_TYPE_RSS: &str = "application/rss+xml";
#[get("/blog")] #[get("/blog")]
pub async fn index(req: HttpRequest, config: web::Data<Config>) -> impl Responder { async fn index(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
HttpResponse::Ok().body(build_index( HttpResponse::Ok().body(build_index(
config.get_ref().to_owned(), config.get_ref().to_owned(),
get_url(req.connection_info()), get_url(req.connection_info()),
@ -41,7 +41,7 @@ struct BlogIndexTemplate {
} }
#[once(time = 120)] #[once(time = 120)]
pub fn build_index(config: Config, url: String) -> String { fn build_index(config: Config, url: String) -> String {
let mut posts = get_posts("data/blog"); let mut posts = get_posts("data/blog");
// Sort from newest to oldest // Sort from newest to oldest
@ -177,7 +177,7 @@ struct BlogPostTemplate {
} }
#[get("/blog/p/{id}")] #[get("/blog/p/{id}")]
pub async fn page( async fn page(
req: HttpRequest, req: HttpRequest,
path: web::Path<(String,)>, path: web::Path<(String,)>,
config: web::Data<Config>, config: web::Data<Config>,
@ -248,7 +248,7 @@ fn get_post(
} }
#[get("/blog/rss")] #[get("/blog/rss")]
pub async fn rss(req: HttpRequest, config: web::Data<Config>) -> impl Responder { async fn rss(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
HttpResponse::Ok() HttpResponse::Ok()
.append_header(("content-type", MIME_TYPE_RSS)) .append_header(("content-type", MIME_TYPE_RSS))
.body(build_rss( .body(build_rss(

View file

@ -9,7 +9,7 @@ use crate::{
}; };
#[get("/contact")] #[get("/contact")]
pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder { async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
HttpResponse::Ok().body(build_page( HttpResponse::Ok().body(build_page(
config.get_ref().to_owned(), config.get_ref().to_owned(),
get_url(req.connection_info()), get_url(req.connection_info()),
@ -22,7 +22,7 @@ struct NetworksTemplate {
} }
#[once(time = 60)] #[once(time = 60)]
pub fn build_page(config: Config, url: String) -> String { fn build_page(config: Config, url: String) -> String {
config.tmpl.render( config.tmpl.render(
"contact.html", "contact.html",
NetworksTemplate { NetworksTemplate {

View file

@ -13,7 +13,7 @@ use cached::proc_macro::once;
use ramhorns::Content; use ramhorns::Content;
#[get("/contrib")] #[get("/contrib")]
pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder { async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
let url = get_url(req.connection_info()); let url = get_url(req.connection_info());
HttpResponse::Ok().body(build_page(config.get_ref().to_owned(), url).await) HttpResponse::Ok().body(build_page(config.get_ref().to_owned(), url).await)
} }
@ -46,7 +46,7 @@ struct Pull {
} }
#[once(time = 120)] #[once(time = 120)]
pub async fn build_page(config: Config, url: String) -> String { async fn build_page(config: Config, url: String) -> String {
let navbar = NavBar { let navbar = NavBar {
contrib: true, contrib: true,
..NavBar::default() ..NavBar::default()

View file

@ -1,7 +1,7 @@
use actix_web::{get, Responder}; use actix_web::{get, Responder};
#[get("/cours")] #[get("/cours")]
pub async fn page() -> impl Responder { async fn page() -> impl Responder {
// TODO // TODO
actix_web::web::Redirect::to("/") actix_web::web::Redirect::to("/")
} }

View file

@ -1,7 +1,7 @@
use actix_web::{get, Responder}; use actix_web::{get, Responder};
#[get("/cv")] #[get("/cv")]
pub async fn page() -> impl Responder { async fn page() -> impl Responder {
// TODO // TODO
actix_web::web::Redirect::to("/") actix_web::web::Redirect::to("/")
} }

View file

@ -1,7 +1,7 @@
use actix_web::{get, Responder}; use actix_web::{get, Responder};
#[get("/gaming")] #[get("/gaming")]
pub async fn page() -> impl Responder { async fn page() -> impl Responder {
// TODO // TODO
actix_web::web::Redirect::to("/") actix_web::web::Redirect::to("/")
} }

View file

@ -9,7 +9,7 @@ use crate::{
}; };
#[get("/")] #[get("/")]
pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder { async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
HttpResponse::Ok().body(build_page( HttpResponse::Ok().body(build_page(
config.get_ref().to_owned(), config.get_ref().to_owned(),
get_url(req.connection_info()), get_url(req.connection_info()),
@ -23,7 +23,7 @@ struct IndexTemplate {
} }
#[once(time = 60)] #[once(time = 60)]
pub fn build_page(config: Config, url: String) -> String { fn build_page(config: Config, url: String) -> String {
config.tmpl.render( config.tmpl.render(
"index.html", "index.html",
IndexTemplate { IndexTemplate {

View file

@ -1,7 +1,7 @@
use actix_web::{get, Responder}; use actix_web::{get, Responder};
#[get("/memorial")] #[get("/memorial")]
pub async fn page() -> impl Responder { async fn page() -> impl Responder {
// Memorial? J'espere ne jamais faire cette page lol // Memorial? J'espere ne jamais faire cette page lol
actix_web::web::Redirect::to("/") actix_web::web::Redirect::to("/")
} }

View file

@ -17,7 +17,7 @@ struct NotFoundTemplate {
} }
#[once(time = 60)] #[once(time = 60)]
pub fn build_page(config: Config) -> String { fn build_page(config: Config) -> String {
config.tmpl.render( config.tmpl.render(
"404.html", "404.html",
NotFoundTemplate { NotFoundTemplate {

View file

@ -13,7 +13,7 @@ use crate::{
}; };
#[get("/portfolio")] #[get("/portfolio")]
pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder { async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
HttpResponse::Ok().body(build_page( HttpResponse::Ok().body(build_page(
config.get_ref().to_owned(), config.get_ref().to_owned(),
get_url(req.connection_info()), get_url(req.connection_info()),
@ -33,7 +33,7 @@ struct PortfolioTemplate<'a> {
} }
#[once(time = 60)] #[once(time = 60)]
pub fn build_page(config: Config, url: String) -> String { fn build_page(config: Config, url: String) -> String {
let projects_dir = "data/projects"; let projects_dir = "data/projects";
let ext = ".md"; let ext = ".md";

View file

@ -1,7 +1,7 @@
use actix_web::{get, Responder}; use actix_web::{get, Responder};
#[get("/setup")] #[get("/setup")]
pub async fn page() -> impl Responder { async fn page() -> impl Responder {
// Explication de l'histoire de par exemple wiki/cat et le follow up // Explication de l'histoire de par exemple wiki/cat et le follow up
// avec les futures video youtube probablement un shortcut // avec les futures video youtube probablement un shortcut
// vers un billet de blog // vers un billet de blog

View file

@ -4,7 +4,7 @@ use cached::proc_macro::once;
use crate::{config::Config, misc::utils::get_url, template::Infos}; use crate::{config::Config, misc::utils::get_url, template::Infos};
#[get("/web3")] #[get("/web3")]
pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder { async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
HttpResponse::Ok().body(build_page( HttpResponse::Ok().body(build_page(
config.get_ref().to_owned(), config.get_ref().to_owned(),
get_url(req.connection_info()), get_url(req.connection_info()),
@ -12,7 +12,7 @@ pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder
} }
#[once(time = 60)] #[once(time = 60)]
pub fn build_page(config: Config, url: String) -> String { fn build_page(config: Config, url: String) -> String {
config.tmpl.render( config.tmpl.render(
"web3.html", "web3.html",
(), (),