Support ?theme= url parameter

Fixes #84
This commit is contained in:
Zed 2019-12-06 08:21:37 +01:00
parent 397471f8f4
commit fddf1d510a
2 changed files with 8 additions and 2 deletions

View File

@ -44,3 +44,10 @@ proc createPrefRouter*(cfg: Config) =
cache(prefs)
savePrefs()
redirect(refPath())
before:
if @"theme".len > 0:
var prefs = cookiePrefs()
prefs.theme = @"theme".capitalizeAscii.replace("_", " ")
cache(prefs)
savePrefs()

View File

@ -47,8 +47,7 @@ proc fetchMultiTimeline*(names: seq[string]; after, agent: string; query: Query;
return await getSearch[Tweet](q, after, agent, media)
proc get*(req: Request; key: string): string =
if key in params(req): params(req)[key]
else: ""
params(req).getOrDefault(key)
proc showTimeline*(request: Request; query: Query; cfg: Config; rss: string): Future[string] {.async.} =
let