mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-14 14:20:34 +05:30
Add fix for comments that don't have valid continuation
This commit is contained in:
parent
d201733756
commit
9a0996515f
@ -558,6 +558,12 @@ get "/api/v1/comments/:id" do |env|
|
|||||||
response = client.post("/comment_service_ajax?action_get_comments=1&pbj=1&ctoken=#{ctoken}&continuation=#{continuation}&itct=#{itct}", headers, post_req).body
|
response = client.post("/comment_service_ajax?action_get_comments=1&pbj=1&ctoken=#{ctoken}&continuation=#{continuation}&itct=#{itct}", headers, post_req).body
|
||||||
response = JSON.parse(response)
|
response = JSON.parse(response)
|
||||||
|
|
||||||
|
env.response.content_type = "application/json"
|
||||||
|
|
||||||
|
if !response["response"]["continuationContents"]?
|
||||||
|
halt env, status_code: 401
|
||||||
|
end
|
||||||
|
|
||||||
response = response["response"]["continuationContents"]
|
response = response["response"]["continuationContents"]
|
||||||
if response["commentRepliesContinuation"]?
|
if response["commentRepliesContinuation"]?
|
||||||
body = response["commentRepliesContinuation"]
|
body = response["commentRepliesContinuation"]
|
||||||
@ -566,8 +572,6 @@ get "/api/v1/comments/:id" do |env|
|
|||||||
end
|
end
|
||||||
contents = body["contents"]?
|
contents = body["contents"]?
|
||||||
if !contents
|
if !contents
|
||||||
env.response.content_type = "application/json"
|
|
||||||
|
|
||||||
if format == "json"
|
if format == "json"
|
||||||
next {"comments" => [] of String}.to_json
|
next {"comments" => [] of String}.to_json
|
||||||
else
|
else
|
||||||
@ -649,7 +653,6 @@ get "/api/v1/comments/:id" do |env|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
env.response.content_type = "application/json"
|
|
||||||
if format == "json"
|
if format == "json"
|
||||||
next comments
|
next comments
|
||||||
else
|
else
|
||||||
@ -676,7 +679,6 @@ get "/api/v1/comments/:id" do |env|
|
|||||||
halt env, status_code: 404
|
halt env, status_code: 404
|
||||||
end
|
end
|
||||||
|
|
||||||
env.response.content_type = "application/json"
|
|
||||||
{"title" => reddit_thread.title,
|
{"title" => reddit_thread.title,
|
||||||
"permalink" => reddit_thread.permalink,
|
"permalink" => reddit_thread.permalink,
|
||||||
"content_html" => content_html}.to_json
|
"content_html" => content_html}.to_json
|
||||||
|
Loading…
Reference in New Issue
Block a user