nitter/src/routes/embed.nim

16 lines
423 B
Nim
Raw Normal View History

2021-12-27 01:37:38 +00:00
# SPDX-License-Identifier: AGPL-3.0-only
2021-12-20 02:11:12 +00:00
import asyncdispatch, strutils, options
2019-12-06 14:15:56 +00:00
import jester
2020-06-01 00:22:56 +00:00
import ".."/[types, api], ../views/embed
2019-12-06 14:15:56 +00:00
2021-12-20 02:11:12 +00:00
export api, embed
2019-12-06 14:15:56 +00:00
proc createEmbedRouter*(cfg: Config) =
router embed:
get "/i/videos/tweet/@id":
2020-06-01 00:22:56 +00:00
let convo = await getTweet(@"id")
if convo == nil or convo.tweet == nil or convo.tweet.video.isNone:
resp Http404
resp renderVideoEmbed(cfg, convo.tweet)