Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enableRSS configuration setting #448

Merged
merged 1 commit into from
Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nitter.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ tokenCount = 10
# the limit gets reset every 15 minutes, and the pool is filled up so there's
# always at least $tokenCount usable tokens. again, only increase this if
# you receive major bursts all the time
enableRSS = true # set this to false to disable RSS feeds

# Change default preferences here, see src/prefs_impl.nim for a complete list
[Preferences]
Expand Down
1 change: 1 addition & 0 deletions src/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ proc getConfig*(path: string): (Config, parseCfg.Config) =
hmacKey: cfg.get("Config", "hmacKey", "secretkey"),
base64Media: cfg.get("Config", "base64Media", false),
minTokens: cfg.get("Config", "tokenCount", 10),
enableRSS: cfg.get("Config", "enableRSS", true),

listCacheTime: cfg.get("Cache", "listMinutes", 120),
rssCacheTime: cfg.get("Cache", "rssMinutes", 10),
Expand Down
3 changes: 2 additions & 1 deletion src/nitter.nim
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ createStatusRouter(cfg)
createSearchRouter(cfg)
createMediaRouter(cfg)
createEmbedRouter(cfg)
createRssRouter(cfg)
if cfg.enableRSS:
createRssRouter(cfg)

settings:
port = Port(cfg.port)
Expand Down
3 changes: 2 additions & 1 deletion src/types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ type
videoDirectMessage = "video_direct_message"
imageDirectMessage = "image_direct_message"
audiospace = "audiospace"

Card* = object
kind*: CardKind
id*: string
Expand Down Expand Up @@ -212,6 +212,7 @@ type
hmacKey*: string
base64Media*: bool
minTokens*: int
enableRSS*: bool

rssCacheTime*: int
listCacheTime*: int
Expand Down
10 changes: 5 additions & 5 deletions src/views/general.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ 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"

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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down