mirror of
https://github.com/zedeus/nitter.git
synced 2026-04-12 08:42:17 -04:00
Fix search repeating when the end has been reached
This commit is contained in:
@@ -168,6 +168,11 @@ proc getGraphTweetSearch*(query: Query; after=""): Future[Timeline] {.async.} =
|
||||
result = parseGraphSearch[Tweets](js, after)
|
||||
result.query = query
|
||||
|
||||
# when no more items are available the API just returns the last page in
|
||||
# full. this detects that and clears the page instead.
|
||||
if after.len > 0 and after[0..<64] == result.bottom[0..<64]:
|
||||
result.content.setLen(0)
|
||||
|
||||
proc getGraphUserSearch*(query: Query; after=""): Future[Result[User]] {.async.} =
|
||||
if query.text.len == 0:
|
||||
return Result[User](query: query, beginning: true)
|
||||
|
||||
@@ -27,7 +27,7 @@ proc createStatusRouter*(cfg: Config) =
|
||||
if @"scroll".len > 0:
|
||||
let replies = await getReplies(id, getCursor())
|
||||
if replies.content.len == 0:
|
||||
resp Http404, ""
|
||||
resp Http204
|
||||
resp $renderReplies(replies, prefs, getPath())
|
||||
|
||||
let conv = await getTweet(id, getCursor())
|
||||
|
||||
@@ -129,7 +129,8 @@ proc createTimelineRouter*(cfg: Config) =
|
||||
if @"scroll".len > 0:
|
||||
if query.fromUser.len != 1:
|
||||
var timeline = await getGraphTweetSearch(query, after)
|
||||
if timeline.content.len == 0: resp Http404
|
||||
if timeline.content.len == 0:
|
||||
resp Http204
|
||||
timeline.beginning = true
|
||||
resp $renderTweetSearch(timeline, prefs, getPath())
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user