emit body and doctype on iframe embed endpoint (#640)
This commit is contained in:
parent
b398136742
commit
5e827c91aa
3 changed files with 15 additions and 6 deletions
|
@ -25,7 +25,7 @@ proc createEmbedRouter*(cfg: Config) =
|
||||||
if convo == nil or convo.tweet == nil:
|
if convo == nil or convo.tweet == nil:
|
||||||
resp Http404
|
resp Http404
|
||||||
|
|
||||||
resp $renderTweetEmbed(convo.tweet, path, prefs, cfg, request)
|
resp renderTweetEmbed(convo.tweet, path, prefs, cfg, request)
|
||||||
|
|
||||||
get "/embed/Tweet.html":
|
get "/embed/Tweet.html":
|
||||||
let id = @"id"
|
let id = @"id"
|
||||||
|
|
|
@ -15,6 +15,7 @@ proc renderVideoEmbed*(tweet: Tweet; cfg: Config; req: Request): string =
|
||||||
let node = buildHtml(html(lang="en")):
|
let node = buildHtml(html(lang="en")):
|
||||||
renderHead(prefs, cfg, req, video=vidUrl, images=(@[thumb]))
|
renderHead(prefs, cfg, req, video=vidUrl, images=(@[thumb]))
|
||||||
|
|
||||||
|
body:
|
||||||
tdiv(class="embed-video"):
|
tdiv(class="embed-video"):
|
||||||
renderVideo(get(tweet.video), prefs, "")
|
renderVideo(get(tweet.video), prefs, "")
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,9 @@ import renderutils
|
||||||
import ".."/[types, utils, formatters]
|
import ".."/[types, utils, formatters]
|
||||||
import general
|
import general
|
||||||
|
|
||||||
|
const
|
||||||
|
doctype = "<!DOCTYPE html>\n"
|
||||||
|
|
||||||
proc getSmallPic(url: string): string =
|
proc getSmallPic(url: string): string =
|
||||||
result = url
|
result = url
|
||||||
if "?" notin url and not url.endsWith("placeholder.png"):
|
if "?" notin url and not url.endsWith("placeholder.png"):
|
||||||
|
@ -364,7 +367,12 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class=""; index=0;
|
||||||
a(class="show-thread", href=("/i/status/" & $tweet.threadId)):
|
a(class="show-thread", href=("/i/status/" & $tweet.threadId)):
|
||||||
text "Show this thread"
|
text "Show this thread"
|
||||||
|
|
||||||
proc renderTweetEmbed*(tweet: Tweet; path: string; prefs: Prefs; cfg: Config; req: Request): VNode =
|
proc renderTweetEmbed*(tweet: Tweet; path: string; prefs: Prefs; cfg: Config; req: Request): string =
|
||||||
buildHtml(tdiv(class="tweet-embed")):
|
let node = buildHtml(html(lang="en")):
|
||||||
renderHead(prefs, cfg, req)
|
renderHead(prefs, cfg, req)
|
||||||
|
|
||||||
|
body:
|
||||||
|
tdiv(class="tweet-embed"):
|
||||||
renderTweet(tweet, prefs, path, mainTweet=true)
|
renderTweet(tweet, prefs, path, mainTweet=true)
|
||||||
|
|
||||||
|
result = doctype & $node
|
||||||
|
|
Loading…
Reference in a new issue