mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-22 23:45:30 +00:00
crude implementation of embedding tweets
This commit is contained in:
parent
888e965f41
commit
7f15993a74
|
@ -10,7 +10,7 @@ import types, config, prefs, formatters, redis_cache, http_pool, tokens
|
|||
import views/[general, about]
|
||||
import routes/[
|
||||
preferences, timeline, status, media, search, rss, list, debug,
|
||||
unsupported, embed, resolver, router_utils]
|
||||
unsupported, embed, resolver, router_utils, embedtweet]
|
||||
|
||||
const instancesUrl = "https://github.com/zedeus/nitter/wiki/Instances"
|
||||
const issuesUrl = "https://github.com/zedeus/nitter/issues"
|
||||
|
@ -51,6 +51,7 @@ createMediaRouter(cfg)
|
|||
createEmbedRouter(cfg)
|
||||
createRssRouter(cfg)
|
||||
createDebugRouter(cfg)
|
||||
createEmbedTweetRouter(cfg)
|
||||
|
||||
settings:
|
||||
port = Port(cfg.port)
|
||||
|
@ -101,3 +102,4 @@ routes:
|
|||
extend media, ""
|
||||
extend embed, ""
|
||||
extend debug, ""
|
||||
extend embedtweet, ""
|
||||
|
|
22
src/routes/embedtweet.nim
Normal file
22
src/routes/embedtweet.nim
Normal file
|
@ -0,0 +1,22 @@
|
|||
import asyncdispatch, strutils, uri, options
|
||||
import jester, karax/vdom
|
||||
|
||||
import router_utils
|
||||
import ".."/views/[general, tweet]
|
||||
import ".."/[types, api]
|
||||
|
||||
export vdom
|
||||
export router_utils
|
||||
export api, tweet, general
|
||||
|
||||
proc createEmbedTweetRouter*(cfg: Config) =
|
||||
router embedtweet:
|
||||
get "/embed/Tweet.html":
|
||||
let
|
||||
prefs = cookiePrefs()
|
||||
t = (await getTweet(@"id")).tweet
|
||||
|
||||
resp ($renderHead(prefs, cfg) & $renderTweet(t, prefs, getPath(), mainTweet=true))
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue