diff --git a/src/routes/preferences.nim b/src/routes/preferences.nim index 7af67ae..08600d9 100644 --- a/src/routes/preferences.nim +++ b/src/routes/preferences.nim @@ -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() diff --git a/src/routes/timeline.nim b/src/routes/timeline.nim index 3b6b954..c7d8fc2 100644 --- a/src/routes/timeline.nim +++ b/src/routes/timeline.nim @@ -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