Support video embeds

Fixes #66
This commit is contained in:
Zed
2019-12-06 15:15:56 +01:00
parent f9c4acabf8
commit ebd7afe464
10 changed files with 98 additions and 37 deletions

16
src/routes/embed.nim Normal file
View File

@@ -0,0 +1,16 @@
import asyncdispatch, strutils, sequtils, uri, options
import jester
import router_utils
import ".."/[api, types, agents]
import ../views/[embed]
export embed
proc createEmbedRouter*(cfg: Config) =
router embed:
get "/i/videos/tweet/@id":
let tweet = Tweet(id: @"id".parseInt, video: some Video())
await getVideo(tweet, getAgent(), "")
resp renderVideoEmbed(cfg, tweet)

View File

@@ -31,7 +31,7 @@ proc createStatusRouter*(cfg: Config) =
if conversation.tweet.video.isSome():
let thumb = get(conversation.tweet.video).thumb
let vidUrl = getVideoEmbed(conversation.tweet.id)
let vidUrl = getVideoEmbed(cfg, conversation.tweet.id)
resp renderMain(html, request, cfg, title, desc, images = @[thumb],
`type`="video", video=vidUrl)
elif conversation.tweet.gif.isSome():