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
|
# send captcha if enabled
|
||||||
if CONFIG.captcha_enabled
|
if CONFIG.captcha_enabled
|
||||||
# send captcha
|
# send captcha
|
||||||
captcha = Invidious::User::Captcha.generate_text(HMAC_KEY)
|
captcha = Invidious::User::Captcha.generate_text(HMAC_KEY, ":captcha")
|
||||||
# puts captcha
|
# puts captcha
|
||||||
response = JSON.build do |json|
|
response = JSON.build do |json|
|
||||||
json.object do
|
json.object do
|
||||||
|
|
|
@ -61,12 +61,12 @@ struct Invidious::User
|
||||||
}
|
}
|
||||||
end
|
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 = make_client(TEXTCAPTCHA_URL, &.get("/github.com/iv.org/invidious.json").body)
|
||||||
response = JSON.parse(response)
|
response = JSON.parse(response)
|
||||||
|
|
||||||
tokens = response["a"].as_a.map do |answer|
|
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
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue