From 80978aac0aecef9aef09f0c07e74a505a9f6d960 Mon Sep 17 00:00:00 2001 From: Orual Date: Mon, 13 Apr 2026 09:31:32 -0400 Subject: [PATCH] better opengraph stuff --- src/main.rs | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/main.rs b/src/main.rs index e47f26e..6cfdc90 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,9 +65,7 @@ fn main() { "debug,vodplace=trace,jacquard_identity=info,jacquard_common=info,reqwest=warn", ); - let reg = Registry::default() - .with(filter) - .with(wasm_layer); + let reg = Registry::default().with(filter).with(wasm_layer); let _ = set_global_default(reg); } @@ -131,17 +129,18 @@ fn Home(q: Option) -> Element { }) .unwrap_or_default(); + let site_og_image = format!("https://vod.place{OG_SITE_IMAGE}"); rsx! { document::Title { "vodplace" } document::Meta { property: "og:title", content: "vod.place" } document::Meta { property: "og:description", content: "the place for VODs" } - document::Meta { property: "og:image", content: "{OG_SITE_IMAGE}" } + document::Meta { property: "og:image", content: "{site_og_image}" } document::Meta { property: "og:type", content: "website" } document::Meta { property: "og:url", content: "https://vod.place" } document::Meta { name: "twitter:card", content: "summary_large_image" } document::Meta { name: "twitter:title", content: "vod.place" } document::Meta { name: "twitter:description", content: "the place for VODs" } - document::Meta { name: "twitter:image", content: "{OG_SITE_IMAGE}" } + document::Meta { name: "twitter:image", content: "{site_og_image}" } div { class: "browse-page", div { class: "browse-header", h1 { "vodplace" } @@ -228,7 +227,8 @@ fn Watch(uri: SmolStr) -> Element { mql.unchecked_ref::(), "change", move |event| { - if let Ok(mql_event) = event.clone().dyn_into::() { + if let Ok(mql_event) = event.clone().dyn_into::() + { let _ = is_narrow.try_write().map(|mut v| *v = mql_event.matches()); } }, @@ -367,7 +367,9 @@ fn Watch(uri: SmolStr) -> Element { } // 1920×1080 is the canonical PlayRes reference resolution. // The renderer scales to actual display dimensions via SubtitleResize. - if let Ok(ass_text) = vodplace_subtitle::ionosphere_to_ass(&input, 1920, 1080) { + if let Ok(ass_text) = + vodplace_subtitle::ionosphere_to_ass(&input, 1920, 1080) + { subtitle_request.set(Some(player::component::SubtitleRequest { ass_text, source: player::component::SubtitleSource::Ionosphere, @@ -414,13 +416,9 @@ fn Watch(uri: SmolStr) -> Element { let comments = comment_data.read(); let transcript = transcript_data.read(); let comments = comments.as_ref()?; - Some(build_comment_tree( - comments, - transcript.as_ref(), - )) + Some(build_comment_tree(comments, transcript.as_ref())) }); - // Seek callback for transcript panel — directly sets video currentTime. #[allow(unused_variables)] let on_transcript_seek = { @@ -449,17 +447,27 @@ fn Watch(uri: SmolStr) -> Element { Stylesheet { href: COMMENTS_CSS } Stylesheet { href: TABS_CSS } if let Some(Some(ref meta)) = *metadata.read() { - document::Title { "{meta.title} — vodplace" } + document::Title { "{meta.title} - vodplace" } { - let description = if meta.speakers.is_empty() { - format!("Watch on vod.place") - } else { - let names: Vec<&str> = meta.speakers.iter().map(|s| s.name.as_ref()).collect(); - format!("{} — vod.place", names.join(", ")) + let description = { + let speakers = if meta.speakers.is_empty() { + None + } else { + let names: Vec<&str> = meta.speakers.iter().map(|s| s.name.as_ref()).collect(); + Some(names.join(", ")) + }; + let talk_desc: Option<&str> = meta.talk.as_ref().and_then(|t| t.description.as_ref()).map(|d| d.as_ref()); + match (speakers, talk_desc) { + (Some(s), Some(d)) => format!("By {s} - {d}"), + (Some(s), None) => s, + (None, Some(d)) => d.to_string(), + (None, None) => "Watch on vod.place".to_string(), + } }; let og_image = match &meta.thumbnail_url { - Some(url) => url.to_string(), - None => OG_SITE_IMAGE.to_string(), + Some(url) if url.starts_with("http") => url.to_string(), + Some(url) => format!("https://vod.place{url}"), + None => format!("https://vod.place{OG_SITE_IMAGE}"), }; let watch_url = format!("https://vod.place/watch?uri={}", meta.at_uri.as_str()); rsx! { -- 2.51.2