nitter/src/routes/router_utils.nim

16 lines
471 B
Nim
Raw Normal View History

2019-12-04 04:58:18 +00:00
import strutils, sequtils
2019-09-20 23:08:30 +00:00
import ../utils, ../prefs
export utils, prefs
2019-09-20 13:03:18 +00:00
2019-09-06 00:42:35 +00:00
template cookiePrefs*(): untyped {.dirty.} =
2019-10-23 12:06:47 +00:00
getPrefs(request.cookies.getOrDefault("preferences"), cfg)
2019-09-06 00:42:35 +00:00
template getPath*(): untyped {.dirty.} =
$(parseUri(request.path) ? filterParams(request.params))
template refPath*(): untyped {.dirty.} =
if @"referer".len > 0: @"referer" else: "/"
2019-12-04 04:58:18 +00:00
proc getNames*(name: string): seq[string] =
name.strip(chars={'/'}).split(",").filterIt(it.len > 0)