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

Store preferences in cookies, add config defaults

This commit is contained in:
Zed
2020-05-08 02:48:47 +02:00
parent 517d9144f6
commit 312ff78628
9 changed files with 109 additions and 109 deletions

View File

@@ -82,8 +82,10 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
proc renderMain*(body: VNode; req: Request; cfg: Config; titleText=""; desc="";
rss=""; video=""; images: seq[string] = @[]; ogTitle=""): string =
let prefs = getPrefs(req.cookies.getOrDefault("preferences"), cfg)
let theme = toLowerAscii(prefs.theme).replace(" ", "_")
let prefs = getPrefs(req.cookies)
var theme = toLowerAscii(prefs.theme).replace(" ", "_")
if "theme" in req.params:
theme = toLowerAscii(req.params["theme"]).replace(" ", "_")
let node = buildHtml(html(lang="en")):
renderHead(prefs, cfg, titleText, desc, video, images, ogTitle):