aboutsummaryrefslogtreecommitdiff
path: root/src/app/config.rs
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2023-02-02 08:05:34 -0500
committerXe Iaso <me@christine.website>2023-02-02 08:05:34 -0500
commitc117eae7c5af977d0299d34169e4a403f77e2afa (patch)
tree83438cf5abc605e0ec174aa4a3f0e4b91b640008 /src/app/config.rs
parent757cee6fdd13502eb62305f77e73698878b01aa2 (diff)
downloadxesite-c117eae7c5af977d0299d34169e4a403f77e2afa.tar.xz
xesite-c117eae7c5af977d0299d34169e4a403f77e2afa.zip
add stream VOD page
Signed-off-by: Xe Iaso <me@christine.website>
Diffstat (limited to 'src/app/config.rs')
-rw-r--r--src/app/config.rs60
1 files changed, 59 insertions, 1 deletions
diff --git a/src/app/config.rs b/src/app/config.rs
index 7ea46fd..8c7d64d 100644
--- a/src/app/config.rs
+++ b/src/app/config.rs
@@ -1,11 +1,15 @@
use crate::signalboost::Person;
-use maud::{html, Markup, Render};
+use chrono::prelude::*;
+use maud::{html, Markup, PreEscaped, Render};
use serde::{Deserialize, Serialize};
use std::{
collections::HashMap,
fmt::{self, Display},
};
+mod markdown_string;
+use markdown_string::MarkdownString;
+
#[derive(Clone, Deserialize, Default)]
pub struct Config {
pub signalboost: Vec<Person>,
@@ -29,6 +33,7 @@ pub struct Config {
pub contact_links: Vec<Link>,
pub pronouns: Vec<PronounSet>,
pub characters: Vec<Character>,
+ pub vods: Vec<VOD>,
}
#[derive(Clone, Deserialize, Serialize, Default)]
@@ -336,3 +341,56 @@ impl Render for Job {
}
}
}
+
+#[derive(Clone, Deserialize, Serialize, Default)]
+pub struct VOD {
+ pub title: String,
+ pub slug: String,
+ pub date: NaiveDate,
+ pub description: MarkdownString,
+ #[serde(rename = "cdnPath")]
+ pub cdn_path: String,
+ pub tags: Vec<String>,
+}
+
+impl VOD {
+ pub fn detri(&self) -> String {
+ self.date.format("M%m %d %Y").to_string()
+ }
+}
+
+impl Render for VOD {
+ fn render(&self) -> Markup {
+ html! {
+ meta name="twitter:card" content="summary";
+ meta name="twitter:site" content="@theprincessxena";
+ meta name="twitter:title" content={(self.title)};
+ meta property="og:type" content="website";
+ meta property="og:title" content={(self.title)};
+ meta property="og:site_name" content="Xe's Blog";
+ meta name="description" content={(self.title) " - Xe's Blog"};
+ meta name="author" content="Xe Iaso";
+
+ h1 {(self.title)}
+ small {"Streamed on " (self.detri())}
+
+ (xesite_templates::advertiser_nag(Some(html!{
+ (xesite_templates::conv("Cadey".into(), "coffee".into(), html!{
+ "Hi. This page embeds a video file that is potentially multiple hours long. Hosting this stuff is not free. Bandwidth in particular is expensive. If you really want to continue to block ads, please consider donating via "
+ a href="https://patreon.com/cadey" {"Patreon"}
+ " because servers and bandwidth do not grow on trees."
+ }))
+ })))
+
+ (xesite_templates::video(self.cdn_path.clone()))
+ (self.description)
+ p {
+ "Tags: "
+ @for tag in &self.tags {
+ code{(tag)}
+ " "
+ }
+ }
+ }
+ }
+}