diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/layout.rs | 21 | ||||
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/pages.rs | 42 | ||||
-rw-r--r-- | src/projects/mod.rs | 4 |
4 files changed, 26 insertions, 43 deletions
diff --git a/src/layout.rs b/src/layout.rs index 3a9ca6c..359670d 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -7,13 +7,12 @@ Copyright (C) 2023 metamuffin <metamuffin.org> use crate::blog::rocket_uri_macro_r_blog; use crate::pages::{ rocket_uri_macro_r_about, rocket_uri_macro_r_contact, rocket_uri_macro_r_pgp_key, - rocket_uri_macro_r_stuff, rocket_uri_macro_r_toggle_css, + rocket_uri_macro_r_stuff, }; use crate::projects::rocket_uri_macro_r_projects; use crate::source::rocket_uri_macro_r_source; use crate::uri; -use markup::Render; -use rocket::http::CookieJar; +use markup::{raw, Render}; use rocket::{ http::ContentType, response::{self, Responder}, @@ -26,7 +25,6 @@ markup::define! { title: String, main: Main, noimg: bool, - include_css: bool ) { @markup::doctype() html[lang="en"] { @@ -34,7 +32,7 @@ markup::define! { title { @title " - " "metamuffin's website" } meta[name="viewport", content="width=device-width, initial-scale=1.0"]; meta[name="description", content="metamuffin's personal website"]; // TODO - @if *include_css { link[rel="stylesheet", href="/style.css"]; } + link[rel="stylesheet", href="/style.css"]; } body { @if !noimg { img[ @@ -64,10 +62,11 @@ markup::define! { "sources available on " a[href=uri!(r_source())] { "this page itself" } " and on " a[href="https://codeberg.org/metamuffin/website"] { "codeberg" } } - p { "In case you " i {"really"} " want to, you can enable stylesheets." } - form[action=uri!(r_toggle_css()), method="POST"] { - input[type="submit", value="Toggle CSS (uses a cookie)"]; - } + } + hr; + details.ad { summary { "Advertisement by a third-party" } + script { @raw("document.querySelector(\".ad\").open = true; // evil js enables ads hehe") } + iframe[loading="lazy", src="https://john.citrons.xyz/embed?ref=metamuffin.org", style="width:732px;height:94px;border:none;"]; } } } @@ -82,14 +81,12 @@ pub struct Scaffold<T> { } impl<'r, Main: Render> Responder<'r, 'static> for Scaffold<Main> { - fn respond_to(self, req: &'r Request<'_>) -> response::Result<'static> { - let jar = async_std::task::block_on(req.guard::<&CookieJar>()).unwrap(); + fn respond_to(self, _req: &'r Request<'_>) -> response::Result<'static> { let mut out = String::new(); ScaffoldImpl { main: self.content, noimg: self.title == "Source", title: self.title, - include_css: jar.get("css").map(|v| v.value() == "yes").unwrap_or(false), } .render(&mut out) .unwrap(); diff --git a/src/main.rs b/src/main.rs index ebe217c..c3ec938 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,12 +41,12 @@ async fn main() { r_source, r_blog, r_stuff, + r_hello, r_favicon, r_blog_index, r_blog_article, r_blog_atom, r_style, - r_toggle_css, r_wellknown_security, r_wellknown_matrix_server, r_wellknown_matrix_client, diff --git a/src/pages.rs b/src/pages.rs index a60941d..b9831cc 100644 --- a/src/pages.rs +++ b/src/pages.rs @@ -1,17 +1,16 @@ use crate::layout::{DynScaffold, Scaffold}; -use rocket::{ - get, - http::{ContentType, Cookie, CookieJar}, - post, - response::Redirect, - uri, -}; +use rocket::{get, http::ContentType, response::Redirect, uri}; #[get("/")] pub fn r_root() -> Redirect { Redirect::to(uri!(r_about())) } +#[get("/hello")] +pub fn r_hello() -> &'static str { + "Hello World!" +} + #[get("/about")] pub fn r_about() -> DynScaffold<'static> { Scaffold { @@ -20,26 +19,24 @@ pub fn r_about() -> DynScaffold<'static> { p { "Hi. I am a normal person from planet earth. " "I enjoy starting projects and never finishing them. " + "I do not know what to write here. " "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 { "development of multimedia processing and streaming applications" } li { "replacing existing software with rust rewrites and rocket emotes" } li { "stuff" } } - h2 { "languages I know" } + h2 { "links" } + p { "some of my projects if you are here because of boredom: " } 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" } + li { a[href="https://meet.metamuffin.org"] { "keks-meet" } } + li { a[href="https://s.metamuffin.org/projects/weakpoint/"] { "weakpoint" } } + li { a[href="https://meet.metamuffin.org"] { "keks-meet" } } } + }, } } @@ -94,14 +91,3 @@ pub fn r_pgp_key() -> &'static str { 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())) -} diff --git a/src/projects/mod.rs b/src/projects/mod.rs index d3ceb40..afb275f 100644 --- a/src/projects/mod.rs +++ b/src/projects/mod.rs @@ -12,8 +12,8 @@ pub fn r_projects() -> DynScaffold<'static> { content: markup::new! { p { "I am starting a lot of projects - this page lists some of them." } p { - "Starting so many means, that most of then are not maintained or not even properly developed." - "Here is a quick reference to what I define the status of a project to be:" + "Starting so many means, that most of then are not maintained or not even properly developed. " + "Here is a quick reference to what I define the status of a project to be: " } ol { li { @Status::Planned.render() ": No code has been written yet." } |