From 98da093ec2547f8520fc6fbf235cf7b60cf9ad93 Mon Sep 17 00:00:00 2001 From: slonkazoid Date: Tue, 11 Jun 2024 16:28:16 +0300 Subject: [PATCH] add more more --- src/config.rs | 2 ++ src/main.rs | 2 ++ templates/display_tweet.html | 13 +++++++++---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index 60dfc96..9c5608d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -17,6 +17,7 @@ pub struct Config { pub TWITTER_BASE_URL: Url, pub title: String, pub description: String, + pub color: String, pub db_url: Option, pub json: bool, } @@ -30,6 +31,7 @@ impl Default for Config { TWITTER_BASE_URL: Url::parse("https://x.com/").unwrap(), title: "biter".into(), description: "biter twitter proxy".into(), + color: "#f5c2e7".into(), db_url: None, json: false, } diff --git a/src/main.rs b/src/main.rs index d5b37a1..e752f75 100644 --- a/src/main.rs +++ b/src/main.rs @@ -59,6 +59,7 @@ struct IndexTemplate<'a> { #[template(path = "display_tweet.html")] struct TweetTemplate<'a> { title: &'a str, + color: &'a str, author: String, author_url: String, url: String, @@ -156,6 +157,7 @@ async fn tweet<'a>( Ok(TweetTemplate { title: &config.title, + color: &config.color, author: post.name, author_url: { let mut url = config.TWITTER_BASE_URL.clone(); diff --git a/templates/display_tweet.html b/templates/display_tweet.html index 81fafc3..da4cd2a 100644 --- a/templates/display_tweet.html +++ b/templates/display_tweet.html @@ -3,20 +3,25 @@ - + + {% match image %} {% when Some with (link) %} + + {% match alt %} {% when Some with (text) %} + {% when None %} {% endmatch %} {% when None %} {% endmatch %} + Tweet by {{ author }} - {{ title }}