diff --git a/src/views.rs b/src/views.rs index 63f3270..aba23ad 100644 --- a/src/views.rs +++ b/src/views.rs @@ -88,12 +88,27 @@ pub struct SubjectBlock { fn head(ctx: &Ctx, title: &str) -> String { format!( - r#" + r##" -{t} · WhalePrep +{t} · WhalePrep + + + + + + + + + + + + + + + -"#, +"##, t = esc(title), - b = ctx.base + b = ctx.base, + origin = public_origin() ) } +/// The absolute origin for og:image URLs — meta tags need a full URL, not a +/// relative path. Derived from the request when behind the tunnel; falls +/// back to the production domain. +fn public_origin() -> String { + std::env::var("PUBLIC_ORIGIN").unwrap_or_else(|_| "https://whaleprep.oiupoyt.space".into()) +} + fn nav(ctx: &Ctx, user: Option<&str>) -> String { let brand = format!( - r##"
WhalePrep