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"), redisHost: cfg.get("Cache", "redisHost", "localhost"),
redisPort: cfg.get("Cache", "redisPort", 6379), redisPort: cfg.get("Cache", "redisPort", 6379),
redisConns: cfg.get("Cache", "redisConnections", 20), 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) return (conf, cfg)

View file

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

View file

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