use crate::layout::{DynScaffold, Scaffold}; use rocket::{ get, http::{ContentType, Cookie, CookieJar}, post, response::Redirect, uri, }; #[get("/")] pub fn r_root() -> Redirect { Redirect::to(uri!(r_about())) } #[get("/about")] pub fn r_about() -> DynScaffold<'static> { Scaffold { title: "about".to_string(), content: markup::new! { p { "Hi. I am a normal person from planet earth. " "I enjoy starting projects and never finishing them. " "I am also supporting the free software movement by writing exclusively free software in my spare time. " } h2 { "current interests" } ul { li { "development of a general-purpose systems programming language" } li { "replacing existing software with rust rewrites and rocket emotes" } li { "stuff" } } h2 { "languages I know" } ul { li { "Rust" } li { "English" } li { "Haskell" } li { "German" } li { "Typescript" } li { "C" } li { "toki pona" } li { "Python" } li { "Nim, Zig, some French and others that I don't really care about" } } }, } } #[get("/contact")] pub fn r_contact() -> DynScaffold<'static> { Scaffold { title: "contact".to_string(), content: markup::new! { p { "You can reach out to me in a bunch of ways. I am also generally looking for nice software ideas to implement." } ul { li { "matrix: " a[href="https://matrix.to/#/@metamuffin:metamuffin.org"]{"@metamuffin:metamuffin.org"} } li { "fedi: " a[href="https://social.metamuffin.org/@metamuffin"]{"@metamuffin@social.metamuffin.org"} } li { "electronic mail: " a[href="mailto:metamuffin@disroot.org"]{"metamuffin@disroot.org"} } li { "telepathy: come on, just try hard enough" } } }, } } #[get("/stuff")] pub fn r_stuff() -> DynScaffold<'static> { Scaffold { title: "stuff".to_string(), content: markup::new! { h1 { "Stuff" } p { "I use arch btw." } p { "The server uses arch btw." } p { "My raspberry pi uses arch btw." } p { "My router uses arch btw." } p { "One of my smartphones uses arch btw." } h2 { "Funny People" } ul { li { a[href="https://potatoxel.org"] { "Potatoxel" } } li { a[href="https://pixificial.xyz"] { "Pixificial" } } li { a[href="https://rustystriker.dev"] { "Rustystriker" } } } }, } } #[get("/favicon.ico")] pub fn r_favicon() {} #[get("/key.asc")] pub fn r_pgp_key() -> &'static str { include_str!("../assets/key.asc") } #[get("/style.css")] pub fn r_style() -> (ContentType, &'static str) { (ContentType::CSS, include_str!("../assets/style.css")) } #[post("/toggle_css")] pub fn r_toggle_css(jar: &CookieJar) -> Redirect { let has_css = jar.get("css").map(|v| v.value() == "yes").unwrap_or(false); jar.add( Cookie::build("css", if has_css { "no" } else { "yes" }) .permanent() .finish(), ); Redirect::to(rocket::uri!(r_root())) }