Use "q" instead of "text" for search compatibility

Fixes #49
This commit is contained in:
Zed
2019-09-30 22:24:01 +02:00
parent 53a7113905
commit 8cae23dc7e
4 changed files with 10 additions and 10 deletions

View File

@@ -20,7 +20,7 @@ template respRss*(rss: typed) =
proc createRssRouter*(cfg: Config) =
router rss:
get "/search/rss":
if @"text".len > 200:
if @"q".len > 200:
resp Http400, showError("Search input too long.", cfg.title)
let query = initQuery(params(request))

View File

@@ -11,7 +11,7 @@ export search
proc createSearchRouter*(cfg: Config) =
router search:
get "/search/?":
if @"text".len > 200:
if @"q".len > 200:
resp Http400, showError("Search input too long.", cfg.title)
let prefs = cookiePrefs()
@@ -19,8 +19,8 @@ proc createSearchRouter*(cfg: Config) =
case query.kind
of userSearch:
if "," in @"text":
redirect("/" & @"text")
if "," in @"q":
redirect("/" & @"q")
let users = await getSearch[Profile](query, @"after", getAgent())
resp renderMain(renderUserSearch(users, prefs), request, cfg.title)
of custom:
@@ -32,4 +32,4 @@ proc createSearchRouter*(cfg: Config) =
resp Http404, showError("Invalid search.", cfg.title)
get "/hashtag/@hash":
redirect("/search?text=" & encodeUrl("#" & @"hash"))
redirect("/search?q=" & encodeUrl("#" & @"hash"))