Add theme option
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import strutils, uri
|
||||
import strutils, uri, os
|
||||
|
||||
import jester
|
||||
|
||||
@@ -8,13 +8,17 @@ import ../views/[general, preferences]
|
||||
|
||||
export preferences
|
||||
|
||||
proc findThemes*(dir: string): seq[string] =
|
||||
for kind, path in walkDir(dir / "css" / "themes"):
|
||||
result.add path.splitFile.name.capitalizeAscii
|
||||
|
||||
proc createPrefRouter*(cfg: Config) =
|
||||
router preferences:
|
||||
template savePrefs(): untyped =
|
||||
setCookie("preferences", $prefs.id, daysForward(360), httpOnly=true, secure=cfg.useHttps)
|
||||
|
||||
get "/settings":
|
||||
let html = renderPreferences(cookiePrefs(), refPath())
|
||||
let html = renderPreferences(cookiePrefs(), refPath(), findThemes(cfg.staticDir))
|
||||
resp renderMain(html, request, cfg, "Preferences")
|
||||
|
||||
get "/settings/@i?":
|
||||
|
||||
Reference in New Issue
Block a user