mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-13 03:26:30 +00:00
Limit search length
This commit is contained in:
parent
5510330f70
commit
f707826241
3 changed files with 5 additions and 2 deletions
|
@ -3,7 +3,7 @@ import asyncdispatch, strutils
|
||||||
import jester
|
import jester
|
||||||
|
|
||||||
import router_utils, timeline
|
import router_utils, timeline
|
||||||
import ".."/[cache, agents, search]
|
import ".."/[cache, agents, query]
|
||||||
import ../views/general
|
import ../views/general
|
||||||
|
|
||||||
include "../views/rss.nimf"
|
include "../views/rss.nimf"
|
||||||
|
|
|
@ -14,6 +14,9 @@ proc createSearchRouter*(cfg: Config) =
|
||||||
if @"text".len == 0 or "." in @"text":
|
if @"text".len == 0 or "." in @"text":
|
||||||
resp Http404, showError("Please enter a valid username.", cfg.title)
|
resp Http404, showError("Please enter a valid username.", cfg.title)
|
||||||
|
|
||||||
|
if @"text".len > 200:
|
||||||
|
resp Http400, showError("Search input too long.", cfg.title)
|
||||||
|
|
||||||
if "," in @"text":
|
if "," in @"text":
|
||||||
redirect("/" & @"text")
|
redirect("/" & @"text")
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ proc showTimeline*(name, after: string; query: Option[Query];
|
||||||
else:
|
else:
|
||||||
let
|
let
|
||||||
timeline = await fetchMultiTimeline(names, after, agent, query)
|
timeline = await fetchMultiTimeline(names, after, agent, query)
|
||||||
html = renderMulti(timeline, names.join(","), prefs, path)
|
html = renderTweetSearch(timeline, prefs, path)
|
||||||
return renderMain(html, prefs, title, "Multi")
|
return renderMain(html, prefs, title, "Multi")
|
||||||
|
|
||||||
template respTimeline*(timeline: typed) =
|
template respTimeline*(timeline: typed) =
|
||||||
|
|
Loading…
Reference in a new issue