From 6a375cb218377c389ff1b4615f2f60f7b7e67000 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sun, 12 Jul 2020 18:58:38 -0400 Subject: [PATCH] add contact and feeds pages --- shell.nix | 1 + src/handlers/mod.rs | 8 ++++++++ src/main.rs | 13 +++++-------- templates/contact.rs.html | 39 +++++++++++++++++++++++++++++++++++++++ templates/feeds.rs.html | 15 +++++++++++++++ 5 files changed, 68 insertions(+), 8 deletions(-) create mode 100644 templates/contact.rs.html create mode 100644 templates/feeds.rs.html diff --git a/shell.nix b/shell.nix index f616a97..fcf0109 100644 --- a/shell.nix +++ b/shell.nix @@ -38,4 +38,5 @@ mkShell { ]; CLACK_SET = "Ashlynn,Terry Davis,Dennis Ritchie"; + RUST_LOG = "info"; } diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index e018bd8..06188f1 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -7,3 +7,11 @@ use warp::{ pub async fn index() -> Result { Response::builder().html(|o| templates::index_html(o)) } + +pub async fn contact() -> Result { + Response::builder().html(|o| templates::contact_html(o)) +} + +pub async fn feeds() -> Result { + Response::builder().html(|o| templates::feeds_html(o)) +} diff --git a/src/main.rs b/src/main.rs index 0ecdc5b..44cbca1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,19 +13,16 @@ async fn main() -> Result<()> { let state = app::init()?; - // GET /hello/warp => 200 OK with body "Hello, warp!" - let hello = warp::path!("hello" / String).map(|name| format!("Hello, {}!", name)); + let routes = warp::get() + .and(path::end().and_then(handlers::index)) + .or(warp::path!("contact").and_then(handlers::contact)) + .or(warp::path!("feeds").and_then(handlers::feeds)); let files = warp::path("static") .and(warp::fs::dir("./static")) .or(warp::path("css").and(warp::fs::dir("./css"))); - let site = warp::get() - .and(path::end()) - .and_then(handlers::index) - .or(hello) - .or(files) - .with(warp::log(APPLICATION_NAME)); + let site = routes.or(files).with(warp::log(APPLICATION_NAME)); warp::serve(site).run(([127, 0, 0, 1], 3030)).await; diff --git a/templates/contact.rs.html b/templates/contact.rs.html new file mode 100644 index 0000000..7d96cf1 --- /dev/null +++ b/templates/contact.rs.html @@ -0,0 +1,39 @@ +@use super::{header_html, footer_html}; + +@() + +@:header_html(Some("Contact"), None) + +

Contact Information

+
+
+

Email

+

me@@christine.website

+ +

My GPG fingerprint is 799F 9134 8118 1111. If you get an email that appears to be from me and the signature does not match that fingerprint, it is not from me. You may download a copy of my public key here.

+ +

Social Media

+ +
+
+

Other Information

+

I have a Patreon if you want to send donations, otherwise my Ko-Fi works too.

+ +

Telegram

+

@@miamorecadenza

+ +

Discord

+

Cadey~#1337

+
+
+ +@:footer_html() diff --git a/templates/feeds.rs.html b/templates/feeds.rs.html new file mode 100644 index 0000000..bb825a0 --- /dev/null +++ b/templates/feeds.rs.html @@ -0,0 +1,15 @@ +@use super::{header_html, footer_html}; + +@() + +@:header_html(Some("Feeds"), None) + +

Feeds

+ + + +@:footer_html()