Skip to content

Commit

Permalink
crystal is confusing
Browse files Browse the repository at this point in the history
  • Loading branch information
lekma committed Oct 30, 2024
1 parent 75b49d4 commit cd36c49
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/invidious/routes/api/v1/authenticated.cr
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,16 @@ module Invidious::Routes::API::V1::Authenticated
callback_url = URI.parse(callback_url)
end

if sid = env.get?("sid").try &.as(String) && content_type != "application/json"
env.response.content_type = "text/html"
if content_type != "application/json"
if sid = env.get?("sid").try &.as(String)
env.response.content_type = "text/html"

csrf_token = generate_response(sid, {":authorize_token"}, HMAC_KEY, use_nonce: true)
return templated "user/authorize_token"
csrf_token = generate_response(sid, {":authorize_token"}, HMAC_KEY, use_nonce: true)
return templated "user/authorize_token"
else
# is it enough?
env.response.status_code = 403
end
else
env.response.content_type = "application/json"

Expand Down

0 comments on commit cd36c49

Please sign in to comment.