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
pub fn read(raw_text: &str) -> File {
fn read(raw_text: &str) -> File {
let arena = Arena::new();
let options = get_options();

View file

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

View file

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

View file

@ -27,7 +27,7 @@ use crate::{
const MIME_TYPE_RSS: &str = "application/rss+xml";
#[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(
config.get_ref().to_owned(),
get_url(req.connection_info()),
@ -41,7 +41,7 @@ struct BlogIndexTemplate {
}
#[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");
// Sort from newest to oldest
@ -177,7 +177,7 @@ struct BlogPostTemplate {
}
#[get("/blog/p/{id}")]
pub async fn page(
async fn page(
req: HttpRequest,
path: web::Path<(String,)>,
config: web::Data<Config>,
@ -248,7 +248,7 @@ fn get_post(
}
#[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()
.append_header(("content-type", MIME_TYPE_RSS))
.body(build_rss(

View file

@ -9,7 +9,7 @@ use crate::{
};
#[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(
config.get_ref().to_owned(),
get_url(req.connection_info()),
@ -22,7 +22,7 @@ struct NetworksTemplate {
}
#[once(time = 60)]
pub fn build_page(config: Config, url: String) -> String {
fn build_page(config: Config, url: String) -> String {
config.tmpl.render(
"contact.html",
NetworksTemplate {

View file

@ -13,7 +13,7 @@ use cached::proc_macro::once;
use ramhorns::Content;
#[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());
HttpResponse::Ok().body(build_page(config.get_ref().to_owned(), url).await)
}
@ -46,7 +46,7 @@ struct Pull {
}
#[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 {
contrib: true,
..NavBar::default()

View file

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

View file

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

View file

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

View file

@ -9,7 +9,7 @@ use crate::{
};
#[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(
config.get_ref().to_owned(),
get_url(req.connection_info()),
@ -23,7 +23,7 @@ struct IndexTemplate {
}
#[once(time = 60)]
pub fn build_page(config: Config, url: String) -> String {
fn build_page(config: Config, url: String) -> String {
config.tmpl.render(
"index.html",
IndexTemplate {

View file

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

View file

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

View file

@ -13,7 +13,7 @@ use crate::{
};
#[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(
config.get_ref().to_owned(),
get_url(req.connection_info()),
@ -33,7 +33,7 @@ struct PortfolioTemplate<'a> {
}
#[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 ext = ".md";

View file

@ -1,7 +1,7 @@
use actix_web::{get, Responder};
#[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
// avec les futures video youtube probablement un shortcut
// 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};
#[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(
config.get_ref().to_owned(),
get_url(req.connection_info()),
@ -12,7 +12,7 @@ pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder
}
#[once(time = 60)]
pub fn build_page(config: Config, url: String) -> String {
fn build_page(config: Config, url: String) -> String {
config.tmpl.render(
"web3.html",
(),