+5
-10
@@ -1,5 +1,5 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
import tables, strutils, base64
|
||||
import tables, strutils
|
||||
import types, prefs_impl
|
||||
from config import get
|
||||
from parsecfg import nil
|
||||
@@ -11,17 +11,12 @@ var defaultPrefs*: Prefs
|
||||
proc updateDefaultPrefs*(cfg: parsecfg.Config) =
|
||||
genDefaultPrefs()
|
||||
|
||||
proc getPrefs*(cookies: Table[string, string]): Prefs =
|
||||
proc getPrefs*(cookies, params: Table[string, string]): Prefs =
|
||||
result = defaultPrefs
|
||||
genCookiePrefs(cookies)
|
||||
|
||||
template getPref*(cookies: Table[string, string], pref): untyped =
|
||||
bind genCookiePref
|
||||
var res = defaultPrefs.`pref`
|
||||
genCookiePref(cookies, pref, res)
|
||||
res
|
||||
genParsePrefs(cookies)
|
||||
genParsePrefs(params)
|
||||
|
||||
proc encodePrefs*(prefs: Prefs): string =
|
||||
var encPairs: seq[string]
|
||||
genEncodePrefs(prefs)
|
||||
encode(encPairs.join("&"), safe=true)
|
||||
encPairs.join(",")
|
||||
|
||||
Reference in New Issue
Block a user