metamuffin's personal website


About 1751321295319 milliseconds have passed since midnight of the january the first in 1970.
------------------------------------------------------
    rocket_uri_macro_r_blog_article, ARTICLE_ROOT,
};
use chrono::{NaiveTime, Utc};
use rocket::{get, http::ContentType, response::Redirect};
use std::{path::PathBuf, str::FromStr};

#[get("/")]
pub fn r_root() -> Redirect {
    Redirect::to(rocket::uri!(r_about()))
}

#[get("/hello")]
pub fn r_hello() -> &'static str {
    "Hello World!"
}

#[get("/about")]
pub async fn r_about<'a>() -> DynScaffold<'a> {
    let articles = get_articles(&PathBuf::from_str(ARTICLE_ROOT).unwrap())
        .await
        .unwrap_or_default();
    let mut newest = articles.first().cloned();
    if let Some(n) = &newest {
        if n.date
            .into_naive()
            .unwrap()
            .and_time(NaiveTime::default())
            .and_utc()
            .signed_duration_since(Utc::now())
            .num_days()