2021-12-27 01:37:38 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
2019-12-06 14:15:56 +00:00
|
|
|
import options
|
|
|
|
import karax/[karaxdsl, vdom]
|
2022-01-14 17:34:10 +00:00
|
|
|
from jester import Request
|
2019-12-06 14:15:56 +00:00
|
|
|
|
|
|
|
import ".."/[types, formatters]
|
|
|
|
import general, tweet
|
|
|
|
|
|
|
|
const doctype = "<!DOCTYPE html>\n"
|
|
|
|
|
2022-01-14 18:45:02 +00:00
|
|
|
proc renderVideoEmbed*(tweet: Tweet; cfg: Config; req: Request): string =
|
2019-12-06 14:15:56 +00:00
|
|
|
let thumb = get(tweet.video).thumb
|
|
|
|
let vidUrl = getVideoEmbed(cfg, tweet.id)
|
|
|
|
let prefs = Prefs(hlsPlayback: true)
|
|
|
|
let node = buildHtml(html(lang="en")):
|
2022-01-14 17:34:10 +00:00
|
|
|
renderHead(prefs, cfg, req, video=vidUrl, images=(@[thumb]))
|
2019-12-06 14:15:56 +00:00
|
|
|
|
2022-06-16 16:46:41 +00:00
|
|
|
body:
|
|
|
|
tdiv(class="embed-video"):
|
|
|
|
renderVideo(get(tweet.video), prefs, "")
|
2019-12-06 14:15:56 +00:00
|
|
|
|
|
|
|
result = doctype & $node
|