1
0
mirror of https://github.com/zedeus/nitter.git synced 2025-12-06 03:55:36 -05:00

Add enableRSS setting in config file

Useful for instance owners who want to disable the RSS endpoint for
reasons such as abuse and not enough server resources to handle heavy
network traffic through that endpoint.

Resolves #437
This commit is contained in:
Timothy Bautista
2021-10-02 13:15:52 -06:00
parent 5caf77481f
commit 2edf54d5b3
5 changed files with 11 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ const
doctype = "<!DOCTYPE html>\n"
lp = readFile("public/lp.svg")
proc renderNavbar*(title, rss: string; req: Request): VNode =
proc renderNavbar*(cfg: Config, rss: string; req: Request): VNode =
let twitterPath = getTwitterLink(req.path, req.params)
var path = $(parseUri(req.path) ? filterParams(req.params))
if "/status" in path: path.add "#m"
@@ -18,13 +18,13 @@ proc renderNavbar*(title, rss: string; req: Request): VNode =
buildHtml(nav):
tdiv(class="inner-nav"):
tdiv(class="nav-item"):
a(class="site-name", href="/"): text title
a(class="site-name", href="/"): text cfg.title
a(href="/"): img(class="site-logo", src="/logo.png")
tdiv(class="nav-item right"):
icon "search", title="Search", href="/search"
if rss.len > 0:
if cfg.enableRSS and rss.len > 0:
icon "rss-feed", title="RSS Feed", href=rss
icon "bird", title="Open in Twitter", href=twitterPath
a(href="https://liberapay.com/zedeus"): verbatim lp
@@ -57,7 +57,7 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
link(rel="search", type="application/opensearchdescription+xml", title=cfg.title,
href=opensearchUrl)
if rss.len > 0:
if cfg.enableRSS and rss.len > 0:
link(rel="alternate", type="application/rss+xml", href=rss, title="RSS feed")
if prefs.hlsPlayback:
@@ -119,7 +119,7 @@ proc renderMain*(body: VNode; req: Request; cfg: Config; prefs=defaultPrefs;
renderHead(prefs, cfg, titleText, desc, video, images, banner, ogTitle, theme, rss)
body:
renderNavbar(cfg.title, rss, req)
renderNavbar(cfg, rss, req)
tdiv(class="container"):
body