mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-22 23:45:30 +00:00
parent
096d44856f
commit
78b6877b02
|
@ -14,25 +14,27 @@ export search
|
|||
proc createSearchRouter*(cfg: Config) =
|
||||
router search:
|
||||
get "/search/?":
|
||||
if @"q".len > 500:
|
||||
let q = @"q"
|
||||
if q.len > 500:
|
||||
resp Http400, showError("Search input too long.", cfg)
|
||||
|
||||
let
|
||||
prefs = cookiePrefs()
|
||||
query = initQuery(params(request))
|
||||
title = "Search" & (if q.len > 0: " (" & q & ")" else: "")
|
||||
|
||||
case query.kind
|
||||
of users:
|
||||
if "," in @"q":
|
||||
redirect("/" & @"q")
|
||||
if "," in q:
|
||||
redirect("/" & q)
|
||||
let users = await getSearch[User](query, getCursor())
|
||||
resp renderMain(renderUserSearch(users, prefs), request, cfg, prefs)
|
||||
resp renderMain(renderUserSearch(users, prefs), request, cfg, prefs, title)
|
||||
of tweets:
|
||||
let
|
||||
tweets = await getSearch[Tweet](query, getCursor())
|
||||
rss = "/search/rss?" & genQueryUrl(query)
|
||||
resp renderMain(renderTweetSearch(tweets, prefs, getPath()),
|
||||
request, cfg, prefs, rss=rss)
|
||||
request, cfg, prefs, title, rss=rss)
|
||||
else:
|
||||
resp Http404, showError("Invalid search", cfg)
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ proc renderUserCard*(user: User; prefs: Prefs): VNode =
|
|||
span:
|
||||
let url = replaceUrls(user.website, prefs)
|
||||
icon "link"
|
||||
a(href=url): text shortLink(url)
|
||||
a(href=url): text url.shortLink
|
||||
|
||||
tdiv(class="profile-joindate"):
|
||||
span(title=getJoinDateFull(user)):
|
||||
|
|
Loading…
Reference in a new issue