summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-07-29 21:15:18 -0500
committerOmar Roth <omarroth@hotmail.com>2018-07-29 21:17:21 -0500
commit9a0996515f01d2233845acf002f78a65ff6c6c04 (patch)
treefa607a6bf8da602b579895bc2b4ed9d4e9573a91 /src
parentd201733756bc0eb1c04cf87e5fbd5b5f7d68e129 (diff)
downloadinvidious-9a0996515f01d2233845acf002f78a65ff6c6c04.tar.gz
invidious-9a0996515f01d2233845acf002f78a65ff6c6c04.tar.bz2
invidious-9a0996515f01d2233845acf002f78a65ff6c6c04.zip
Add fix for comments that don't have valid continuation
Diffstat (limited to 'src')
-rw-r--r--src/invidious.cr10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 1a739ae4..5d6a5e51 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -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 = JSON.parse(response)
+ env.response.content_type = "application/json"
+
+ if !response["response"]["continuationContents"]?
+ halt env, status_code: 401
+ end
+
response = response["response"]["continuationContents"]
if response["commentRepliesContinuation"]?
body = response["commentRepliesContinuation"]
@@ -566,8 +572,6 @@ get "/api/v1/comments/:id" do |env|
end
contents = body["contents"]?
if !contents
- env.response.content_type = "application/json"
-
if format == "json"
next {"comments" => [] of String}.to_json
else
@@ -649,7 +653,6 @@ get "/api/v1/comments/:id" do |env|
end
end
- env.response.content_type = "application/json"
if format == "json"
next comments
else
@@ -676,7 +679,6 @@ get "/api/v1/comments/:id" do |env|
halt env, status_code: 404
end
- env.response.content_type = "application/json"
{"title" => reddit_thread.title,
"permalink" => reddit_thread.permalink,
"content_html" => content_html}.to_json
>CalculationPaper Oh, it's handlers not helpers. 2022-08-12Add/Change Javascript license noticeCalculationPaper 2022-08-11Update Indonesian translationHosted Weblate Co-authored-by: Hosted Weblate <hosted@weblate.org> Co-authored-by: uwu as a service <okayokokay@protonmail.com> 2022-08-11Update Portuguese (Portugal) translationHosted Weblate Co-authored-by: Hosted Weblate <hosted@weblate.org> Co-authored-by: Tmpod <tmpod@pm.me> 2022-08-11Update German translationHosted Weblate Co-authored-by: Hosted Weblate <hosted@weblate.org> Co-authored-by: Pixelcode <pixelcode@dismail.de> 2022-08-11Update Greek translationHosted Weblate Co-authored-by: Hosted Weblate <hosted@weblate.org> Co-authored-by: THANOS SIOURDAKIS <siourdakisthanos@gmail.com> 2022-08-11Update Italian translationHosted Weblate Co-authored-by: atilluF <atilluf@outlook.com> 2022-08-11Update Norwegian Bokmål translationHosted Weblate Co-authored-by: Hosted Weblate <hosted@weblate.org> Co-authored-by: Petter Reinholdtsen <pere-weblate@hungry.com> 2022-08-11Update Arabic translationHosted Weblate Co-authored-by: Hosted Weblate <hosted@weblate.org> Co-authored-by: Rex_sa <rex.sa@pm.me> 2022-08-11Update Russian translationHosted Weblate Co-authored-by: Hosted Weblate <hosted@weblate.org> Co-authored-by: Егор Ермаков <eg.ermakov2016@yandex.ru>