Use replaceYouTube from config in rss

Fixes #372
This commit is contained in:
Zed 2021-07-18 02:20:17 +02:00
parent 2422a2b8b7
commit e183a9c789
3 changed files with 8 additions and 4 deletions

View File

@ -32,7 +32,9 @@ proc getConfig*(path: string): (Config, parseCfg.Config) =
redisHost: cfg.get("Cache", "redisHost", "localhost"),
redisPort: cfg.get("Cache", "redisPort", 6379),
redisConns: cfg.get("Cache", "redisConnections", 20),
redisMaxConns: cfg.get("Cache", "redisMaxConnections", 30)
redisMaxConns: cfg.get("Cache", "redisMaxConnections", 30),
replaceYouTube: cfg.get("Preferences", "replaceYouTube", "piped.kavin.rocks")
)
return (conf, cfg)

View File

@ -221,6 +221,8 @@ type
redisConns*: int
redisMaxConns*: int
replaceYouTube*: string
Rss* = object
feed*, cursor*: string

View File

@ -69,7 +69,7 @@ Twitter feed for: ${desc}. Generated by ${cfg.hostname}
#end proc
#
#proc renderTimelineRss*(timeline: Timeline; profile: Profile; cfg: Config; multi=false): string =
#let prefs = Prefs(replaceTwitter: cfg.hostname, replaceYouTube: "piped.kavin.rocks")
#let prefs = Prefs(replaceTwitter: cfg.hostname, replaceYouTube: cfg.replaceYouTube)
#let urlPrefix = getUrlPrefix(cfg)
#result = ""
#let user = (if multi: "" else: "@") & profile.username
@ -101,7 +101,7 @@ ${renderRssTweets(timeline.content, prefs, cfg)}
#end proc
#
#proc renderListRss*(tweets: seq[Tweet]; list: List; cfg: Config): string =
#let prefs = Prefs(replaceTwitter: cfg.hostname, replaceYouTube: "piped.kavin.rocks")
#let prefs = Prefs(replaceTwitter: cfg.hostname, replaceYouTube: cfg.replaceYouTube)
#let link = &"{getUrlPrefix(cfg)}/{list.username}/lists/{list.name}"
#result = ""
<?xml version="1.0" encoding="UTF-8"?>
@ -119,7 +119,7 @@ ${renderRssTweets(tweets, prefs, cfg)}
#end proc
#
#proc renderSearchRss*(tweets: seq[Tweet]; name, param: string; cfg: Config): string =
#let prefs = Prefs(replaceTwitter: cfg.hostname, replaceYouTube: "piped.kavin.rocks")
#let prefs = Prefs(replaceTwitter: cfg.hostname, replaceYouTube: cfg.replaceYouTube)
#let link = &"{getUrlPrefix(cfg)}/search"
#let escName = xmltree.escape(name)
#result = ""