From 0a8515ee43e5cbbe23827b27460822ee3cdbc686 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 27 Apr 2024 17:17:52 +0200 Subject: bump deps, john and small refinements --- src/layout.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/layout.rs') 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 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 { } impl<'r, Main: Render> Responder<'r, 'static> for Scaffold
{ - 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(); -- cgit v1.2.3-70-g09d2