Przeglądaj źródła

Limit search length

Zed 7 lat temu
rodzic
commit
f707826241
3 zmienionych plików z 5 dodań i 2 usunięć
  1. 1 1
      src/routes/rss.nim
  2. 3 0
      src/routes/search.nim
  3. 1 1
      src/routes/timeline.nim

+ 1 - 1
src/routes/rss.nim

@@ -3,7 +3,7 @@ import asyncdispatch, strutils
 import jester
 
 import router_utils, timeline
-import ".."/[cache, agents, search]
+import ".."/[cache, agents, query]
 import ../views/general
 
 include "../views/rss.nimf"

+ 3 - 0
src/routes/search.nim

@@ -14,6 +14,9 @@ proc createSearchRouter*(cfg: Config) =
       if @"text".len == 0 or "." in @"text":
         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":
         redirect("/" & @"text")
 

+ 1 - 1
src/routes/timeline.nim

@@ -64,7 +64,7 @@ proc showTimeline*(name, after: string; query: Option[Query];
   else:
     let
       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")
 
 template respTimeline*(timeline: typed) =