From cab6efd92701f53dd41c5dbdf4d14651d78ad8d6 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sun, 16 Jul 2023 17:22:44 -0400 Subject: xedium groundwork Signed-off-by: Xe Iaso --- Cargo.lock | 129 ++++++++++++++++++++++++++++++++++++++-- Cargo.toml | 7 ++- lib/xesite_markdown/Cargo.toml | 5 +- lib/xesite_markdown/src/lib.rs | 6 +- lib/xesite_templates/Cargo.toml | 5 +- lib/xesite_templates/src/lib.rs | 6 +- src/handlers/mod.rs | 1 + src/handlers/tailwind.rs | 22 +++++++ src/main.rs | 2 + static/sussy/command.txt | 23 +++++++ 10 files changed, 189 insertions(+), 17 deletions(-) create mode 100644 src/handlers/tailwind.rs create mode 100644 static/sussy/command.txt diff --git a/Cargo.lock b/Cargo.lock index ee6d13b..5da015d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -744,6 +744,27 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "encre-css" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8811ccb8ae79a3952f254cf418b3791306933dff54049369fb0d7ba3f66c4479" +dependencies = [ + "phf 0.11.2", + "serde", + "thiserror", + "toml", +] + +[[package]] +name = "encre-css-typography" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee103fea83ca0cd45fc0c4acf01a35747ff1e839e33cb71cf9dce9b00690b17" +dependencies = [ + "encre-css", +] + [[package]] name = "entities" version = "1.0.1" @@ -1546,8 +1567,9 @@ checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" [[package]] name = "maud" -version = "0.24.0" -source = "git+https://github.com/Xe/maud?rev=a40596c42c7603cc4610bbeddea04c4bd8b312d9#a40596c42c7603cc4610bbeddea04c4bd8b312d9" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0bab19cef8a7fe1c18a43e881793bfc9d4ea984befec3ae5bd0415abf3ecf00" dependencies = [ "axum-core", "http", @@ -1557,8 +1579,9 @@ dependencies = [ [[package]] name = "maud_macros" -version = "0.24.0" -source = "git+https://github.com/Xe/maud?rev=a40596c42c7603cc4610bbeddea04c4bd8b312d9#a40596c42c7603cc4610bbeddea04c4bd8b312d9" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0be95d66c3024ffce639216058e5bae17a83ecaf266ffc6e4d060ad447c9eed2" dependencies = [ "proc-macro-error", "proc-macro2", @@ -1964,7 +1987,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" dependencies = [ - "phf_macros", + "phf_macros 0.8.0", "phf_shared 0.8.0", "proc-macro-hack", ] @@ -1978,6 +2001,16 @@ dependencies = [ "phf_shared 0.10.0", ] +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros 0.11.2", + "phf_shared 0.11.2", +] + [[package]] name = "phf_codegen" version = "0.8.0" @@ -2018,6 +2051,16 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared 0.11.2", + "rand 0.8.5", +] + [[package]] name = "phf_macros" version = "0.8.0" @@ -2032,6 +2075,19 @@ dependencies = [ "syn 1.0.107", ] +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator 0.11.2", + "phf_shared 0.11.2", + "proc-macro2", + "quote", + "syn 2.0.8", +] + [[package]] name = "phf_shared" version = "0.8.0" @@ -2050,6 +2106,15 @@ dependencies = [ "siphasher", ] +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" version = "1.0.12" @@ -2595,6 +2660,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3016,6 +3090,40 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +dependencies = [ + "indexmap 2.0.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tower" version = "0.4.13" @@ -3617,6 +3725,15 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +[[package]] +name = "winnow" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.10.1" @@ -3656,6 +3773,8 @@ dependencies = [ "color-eyre", "derive_more", "dirs 5.0.1", + "encre-css", + "encre-css-typography", "envy", "estimated_read_time", "eyre", diff --git a/Cargo.toml b/Cargo.toml index bf55702..7ee5004 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,10 +56,13 @@ xe_jsonfeed = { path = "./lib/jsonfeed" } xesite_markdown = { path = "./lib/xesite_markdown" } xesite_templates = { path = "./lib/xesite_templates" } xesite_types = { path = "./lib/xesite_types" } +encre-css = "0.10.1" +encre-css-typography = "0.1.1" [dependencies.maud] -git = "https://github.com/Xe/maud" -rev = "a40596c42c7603cc4610bbeddea04c4bd8b312d9" +version = "0.25" +#git = "https://github.com/Xe/maud" +#rev = "a40596c42c7603cc4610bbeddea04c4bd8b312d9" features = ["axum"] [dependencies.tower] diff --git a/lib/xesite_markdown/Cargo.toml b/lib/xesite_markdown/Cargo.toml index bc4abb5..ad84700 100644 --- a/lib/xesite_markdown/Cargo.toml +++ b/lib/xesite_markdown/Cargo.toml @@ -22,6 +22,7 @@ xesite_templates = { path = "../xesite_templates" } xesite_types = { path = "../xesite_types" } [dependencies.maud] -git = "https://github.com/Xe/maud" -rev = "a40596c42c7603cc4610bbeddea04c4bd8b312d9" +version = "0.25" +#git = "https://github.com/Xe/maud" +#rev = "a40596c42c7603cc4610bbeddea04c4bd8b312d9" features = ["axum"] diff --git a/lib/xesite_markdown/src/lib.rs b/lib/xesite_markdown/src/lib.rs index 40d85ab..96cdb09 100644 --- a/lib/xesite_markdown/src/lib.rs +++ b/lib/xesite_markdown/src/lib.rs @@ -121,11 +121,11 @@ pub fn render(inp: &str) -> Result { el.before( &format!( r#" -
-
+
+
{name} is {mood}
-
<{name}> "# +
<{name}> "# ), ContentType::Html, ); diff --git a/lib/xesite_templates/Cargo.toml b/lib/xesite_templates/Cargo.toml index dbfa1d3..eb7ba11 100644 --- a/lib/xesite_templates/Cargo.toml +++ b/lib/xesite_templates/Cargo.toml @@ -12,6 +12,7 @@ uuid = { version = "1", features = [ "v4" ] } xesite_types = { path = "../xesite_types" } [dependencies.maud] -git = "https://github.com/Xe/maud" -rev = "a40596c42c7603cc4610bbeddea04c4bd8b312d9" +version = "0.25" +#git = "https://github.com/Xe/maud" +#rev = "a40596c42c7603cc4610bbeddea04c4bd8b312d9" features = ["axum"] diff --git a/lib/xesite_templates/src/lib.rs b/lib/xesite_templates/src/lib.rs index f5219d9..e097136 100644 --- a/lib/xesite_templates/src/lib.rs +++ b/lib/xesite_templates/src/lib.rs @@ -60,15 +60,15 @@ pub fn conv(name: String, mood: String, body: Markup) -> Markup { let name = name.replace("_", " "); html! { - .conversation { - ."conversation-standalone" { + ."conversation my-4 flex space-x-4 rounded-md border border-solid border-gray-200 bg-gray-100 p-3 dark:border-gray-700 dark:bg-gray-800" { + ."conversation-standalone flex h-16 w-16 shrink-0 items-center justify-center self-center overflow-hidden rounded-lg bg-gray-200 dark:bg-gray-700" { picture { source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".avif"}; source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".webp"}; img style="max-height:4.5rem" alt={(name) " is " (mood)} loading="lazy" src={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".png"}; } } - ."conversation-chat" { + ."conversation-chat min-w-0 self-center" { "<" a href={"/characters#" (name_lower)} { b { (name) } } "> " diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index dba9275..01811e3 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -18,6 +18,7 @@ pub mod feeds; pub mod gallery; pub mod streams; pub mod talks; +pub mod tailwind; fn weekday_to_name(w: Weekday) -> &'static str { use Weekday::*; diff --git a/src/handlers/tailwind.rs b/src/handlers/tailwind.rs new file mode 100644 index 0000000..621565a --- /dev/null +++ b/src/handlers/tailwind.rs @@ -0,0 +1,22 @@ +use std::sync::Arc; +use axum::response::IntoResponse; +use axum::{Extension, extract::Path}; +use encre_css::Config; +use http::{HeaderMap, header}; +use crate::app::State; +use super::blog; + +#[instrument(skip(state, headers))] +pub async fn post_view( + Path(name): Path, + Extension(state): Extension>, + headers: HeaderMap, +) -> impl IntoResponse { + let mut config = Config::default(); + + encre_css_typography::register(&mut config); + + let (_code, body) = blog::post_view(Path(name), Extension(state), headers).await.unwrap(); + + ([(header::CONTENT_TYPE, "text/css")], encre_css::generate([body.0.as_str()], &config)) +} diff --git a/src/main.rs b/src/main.rs index 90f8fba..dbb7ab6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -169,6 +169,8 @@ async fn main() -> Result<()> { .route("/talks/:name", get(handlers::talks::post_view)) // junk google wants .route("/sitemap.xml", get(handlers::feeds::sitemap)) + // tailwind for Xedium + .route("/.within/css/blog/:name", get(handlers::tailwind::post_view)) // static files .nest_service("/static", files) .fallback(handlers::not_found) diff --git a/static/sussy/command.txt b/static/sussy/command.txt new file mode 100644 index 0000000..d9bc84e --- /dev/null +++ b/static/sussy/command.txt @@ -0,0 +1,23 @@ +dig TXT _i2p_irc_info.xeiaso.net + +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣤⣤⣤⣤⣤⣶⣦⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⡿⠛⠉⠙⠛⠛⠛⠛⠻⢿⣿⣷⣤⡀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⠈⢻⣿⣿⡄⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⣸⣿⡏⠀⠀⠀⣠⣶⣾⣿⣿⣿⠿⠿⠿⢿⣿⣿⣿⣄⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⣿⣿⠁⠀⠀⢰⣿⣿⣯⠁⠀⠀⠀⠀⠀⠀⠀⠈⠙⢿⣷⡄⠀ +⠀⠀⣀⣤⣴⣶⣶⣿⡟⠀⠀⠀⢸⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣷⠀ +⠀⢰⣿⡟⠋⠉⣹⣿⡇⠀⠀⠀⠘⣿⣿⣿⣿⣷⣦⣤⣤⣤⣶⣶⣶⣶⣿⣿⣿⠀ +⠀⢸⣿⡇⠀⠀⣿⣿⡇⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀ +⠀⣸⣿⡇⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠉⠻⠿⣿⣿⣿⣿⡿⠿⠿⠛⢻⣿⡇⠀⠀ +⠀⣿⣿⠁⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣧⠀⠀ +⠀⣿⣿⠀⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⠀⠀ +⠀⣿⣿⠀⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⠀⠀ +⠀⢿⣿⡆⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⡇⠀⠀ +⠀⠸⣿⣧⡀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠃⠀⠀ +⠀⠀⠛⢿⣿⣿⣿⣿⣇⠀⠀⠀⠀⠀⣰⣿⣿⣷⣶⣶⣶⣶⠶⠀⢠⣿⣿⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⣿⣿⡇⠀⣽⣿⡏⠁⠀⠀⢸⣿⡇⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⣿⣿⡇⠀⢹⣿⡆⠀⠀⠀⣸⣿⠇⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⢿⣿⣦⣄⣀⣠⣴⣿⣿⠁⠀⠈⠻⣿⣿⣿⣿⡿⠏⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠈⠛⠻⠿⠿⠿⠿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ + +An impostor remains. -- cgit v1.2.3