diff --git a/.gitignore b/.gitignore index ea8c4bf..fedaa2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +.env diff --git a/Cargo.lock b/Cargo.lock index 370c052..6bc995f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -389,6 +389,7 @@ dependencies = [ "gray_matter", "notify", "serde", + "serde_json", "syntect", "tokio", "tower 0.5.1", @@ -1438,11 +1439,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] diff --git a/Cargo.toml b/Cargo.toml index 7e04cee..3989b30 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ comrak = "0.29.0" gray_matter = "0.2.8" notify = "6.1.1" serde = { version = "1.0.213", features = ["derive"] } +serde_json = "1.0.132" syntect = "5.2.0" tokio = { version = "1.41.0", features = ["full"] } tower = "0.5.1" diff --git a/src/main.rs b/src/main.rs index e4909fe..dc61931 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,7 @@ use comrak::{markdown_to_html_with_plugins, Options, Plugins}; use gray_matter::engine::YAML; use gray_matter::Matter; use notify::{RecursiveMode, Watcher}; +use serde::{Deserialize, Serialize}; use tower::ServiceBuilder; use tower_http::services::ServeDir; use tower_http::trace::TraceLayer; @@ -36,12 +37,11 @@ pub struct Post { body: String, } -/*#[derive(Template)] -#[template(path = "includes/head.html", escape = "none")] -struct HeadTemplate { - styles: String, - meta: Meta, -}*/ +#[derive(Clone, Deserialize, Serialize)] +pub struct Button { + path: String, + location: String, +} #[derive(Template)] #[template(path = "base.html", escape = "none")] @@ -53,7 +53,9 @@ struct BaseTemplate { #[derive(Template)] #[template(path = "index.html", escape = "none")] struct IndexTemplate { + _parent: BaseTemplate, styles: String, + meta: Meta, } #[derive(Template)] @@ -62,6 +64,15 @@ struct HomelabTemplate { styles: String, } +#[derive(Template)] +#[template(path = "buttons.html", escape = "none")] +struct ButtonsTemplate { + _parent: BaseTemplate, + styles: String, + meta: Meta, + buttons: Vec + CBAX.DEV + Blog