mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-14 00:28:31 +00:00
Move page verification to inner function
This commit is contained in:
parent
c972647ae7
commit
53cdee2c08
@ -2521,7 +2521,7 @@ get "/api/v1/channels/search/:ucid" do |env|
|
|||||||
query ||= ""
|
query ||= ""
|
||||||
|
|
||||||
page = env.params.query["page"]?.try &.to_i?
|
page = env.params.query["page"]?.try &.to_i?
|
||||||
page = 1 if !page || page <= 0
|
page ||= 1
|
||||||
|
|
||||||
count, search_results = channel_search(query, page, ucid)
|
count, search_results = channel_search(query, page, ucid)
|
||||||
JSON.build do |json|
|
JSON.build do |json|
|
||||||
|
@ -369,6 +369,12 @@ def produce_search_params(page = 1, sort : String = "relevance", date : String =
|
|||||||
end
|
end
|
||||||
|
|
||||||
def produce_channel_search_continuation(ucid, query, page)
|
def produce_channel_search_continuation(ucid, query, page)
|
||||||
|
if page <= 1
|
||||||
|
idx = 0_i64
|
||||||
|
else
|
||||||
|
idx = 30_i64 * (page - 1)
|
||||||
|
end
|
||||||
|
|
||||||
object = {
|
object = {
|
||||||
"80226972:embedded" => {
|
"80226972:embedded" => {
|
||||||
"2:string" => ucid,
|
"2:string" => ucid,
|
||||||
@ -378,7 +384,7 @@ def produce_channel_search_continuation(ucid, query, page)
|
|||||||
"7:varint" => 1_i64,
|
"7:varint" => 1_i64,
|
||||||
"12:varint" => 1_i64,
|
"12:varint" => 1_i64,
|
||||||
"15:base64" => {
|
"15:base64" => {
|
||||||
"3:varint" => 30_i64 * (page - 1),
|
"3:varint" => idx,
|
||||||
},
|
},
|
||||||
"23:varint" => 0_i64
|
"23:varint" => 0_i64
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user