mirror of
https://github.com/iv-org/invidious.git
synced 2025-05-18 06:10:43 -04:00
Captcha Update
+ Scope parameter in captcha generation
This commit is contained in:
parent
9f2ba07367
commit
ae058da25c
2 changed files with 3 additions and 3 deletions
|
@ -36,7 +36,7 @@ module Invidious::Routes::API::V1::Authentication
|
|||
# send captcha if enabled
|
||||
if CONFIG.captcha_enabled
|
||||
# send captcha
|
||||
captcha = Invidious::User::Captcha.generate_text(HMAC_KEY)
|
||||
captcha = Invidious::User::Captcha.generate_text(HMAC_KEY, ":captcha")
|
||||
# puts captcha
|
||||
response = JSON.build do |json|
|
||||
json.object do
|
||||
|
|
|
@ -61,12 +61,12 @@ struct Invidious::User
|
|||
}
|
||||
end
|
||||
|
||||
def generate_text(key)
|
||||
def generate_text(key, scope = ":login")
|
||||
response = make_client(TEXTCAPTCHA_URL, &.get("/github.com/iv.org/invidious.json").body)
|
||||
response = JSON.parse(response)
|
||||
|
||||
tokens = response["a"].as_a.map do |answer|
|
||||
generate_response(answer.as_s, {":login"}, key, use_nonce: true)
|
||||
generate_response(answer.as_s, {scope}, key, use_nonce: true)
|
||||
end
|
||||
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue