nitter/src/routes/embed.nim
2021-12-20 04:18:44 +01:00

15 lines
382 B
Nim

import asyncdispatch, strutils, options
import jester
import ".."/[types, api], ../views/embed
export api, embed
proc createEmbedRouter*(cfg: Config) =
router embed:
get "/i/videos/tweet/@id":
let convo = await getTweet(@"id")
if convo == nil or convo.tweet == nil or convo.tweet.video.isNone:
resp Http404
resp renderVideoEmbed(cfg, convo.tweet)