pass url to oembed and some cleanup

This commit is contained in:
Cynthia Foxwell 2024-07-13 17:10:46 -06:00
parent 819efc6d93
commit 379baa679d

View file

@ -88,13 +88,15 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc="";
else:
text cfg.title
let finalizedTitleText = (if ogTitle.len > 0: ogTitle else: titleText)
meta(name="viewport", content="width=device-width, initial-scale=1.0")
meta(name="theme-color", content="#1F1F1F")
meta(property="og:type", content=ogType)
if video.len > 0:
meta(property="og:title", content=stripHtml(desc))
else:
meta(property="og:title", content=(if ogTitle.len > 0: ogTitle else: titleText))
meta(property="og:title", content=finalizedTitleText)
meta(property="og:description", content=stripHtml(desc))
meta(property="og:site_name", content="Nitter")
meta(property="og:locale", content="en_US")
@ -122,9 +124,9 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc="";
meta(property="og:video:url", content=video)
meta(property="og:video:secure_url", content=video)
meta(property="og:video:type", content="video/mp4")
verbatim &"<link rel=\"alternate\" href=\"{getUrlPrefix(cfg)}/oembed.json?type=video&title={encodeUrl(stripHtml(desc))}&user={encodeUrl(if ogTitle.len > 0: ogTitle else: titleText)}\" type=\"application/json+oembed\" />"
verbatim &"<link rel=\"alternate\" href=\"{getUrlPrefix(cfg)}/oembed.json?type=video&title={encodeUrl(stripHtml(desc))}&user={encodeUrl(finalizedTitleText)}&url={encodeUrl(req.path)}\" type=\"application/json+oembed\" />"
#link(rel="alternate",
# href=getUrlPrefix(cfg) & "/oembed.json?type=video&title=" & encodeUrl(stripHtml(desc)) & "&user=" & encodeUrl(if ogTitle.len > 0: ogTitle else: titleText),
# href=&"{getUrlPrefix(cfg)}/oembed.json?type=video&title={encodeUrl(stripHtml(desc))}&user={encodeUrl(finalizedTitleText)}&url={encodeUrl(req.path)}",
# `type`="application/json+oembed")
# this is last so images are also preloaded