From e183a9c7892e7ece64dcfd170fdcb6e4ddb97da4 Mon Sep 17 00:00:00 2001 From: Zed Date: Sun, 18 Jul 2021 02:20:17 +0200 Subject: [PATCH] Use replaceYouTube from config in rss Fixes #372 --- src/config.nim | 4 +++- src/types.nim | 2 ++ src/views/rss.nimf | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/config.nim b/src/config.nim index 97a43d5..a1e4ab2 100644 --- a/src/config.nim +++ b/src/config.nim @@ -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) diff --git a/src/types.nim b/src/types.nim index de3d325..6be9c52 100644 --- a/src/types.nim +++ b/src/types.nim @@ -221,6 +221,8 @@ type redisConns*: int redisMaxConns*: int + replaceYouTube*: string + Rss* = object feed*, cursor*: string diff --git a/src/views/rss.nimf b/src/views/rss.nimf index c284db3..1728b02 100644 --- a/src/views/rss.nimf +++ b/src/views/rss.nimf @@ -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 = "" @@ -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 = ""