add more more

This commit is contained in:
slonkazoid 2024-06-11 16:28:16 +03:00
parent 8e4369fa99
commit 98da093ec2
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM
3 changed files with 13 additions and 4 deletions

View file

@ -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<String>,
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,
}

View file

@ -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();

View file

@ -3,20 +3,25 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="Tweet by {{ author }} - {{ title }}"
/>
<meta
property="og:title"
content="Tweet by {{ author }} - {{ title }}"
/>
<meta
property="twitter:title"
content="Tweet by {{ author }} - {{ title }}"
/>
<meta property="og:description" content="{{ content }}" />
<meta property="twitter:description" content="{{ content }}" />
{% match image %} {% when Some with (link) %}
<meta name="twitter:card" content="summary_large_image" />
<meta property="og:image" content="{{ link }}" />
<meta property="twitter:image:src" content="{{ link }}" />
{% match alt %} {% when Some with (text) %}
<meta property="og:image:alt" content="{{ text }}" />
<meta property="twitter:image:alt" content="{{ text }}" />
{% when None %} {% endmatch %} {% when None %} {% endmatch %}
<meta name="theme-color" content="{{ color }}" />
<title>Tweet by {{ author }} - {{ title }}</title>
<link rel="stylesheet" href="/static/style.css" />
<link rel="stylesheet" href="/static/tweet.css" />