From ae058da25c2036b84bd9990d27b4131acd274b50 Mon Sep 17 00:00:00 2001 From: Ryan G <78384369+SpongeManiac@users.noreply.github.com> Date: Mon, 12 Jun 2023 23:31:40 -0700 Subject: [PATCH] Captcha Update + Scope parameter in captcha generation --- src/invidious/routes/api/v1/authentication.cr | 2 +- src/invidious/user/captcha.cr | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/invidious/routes/api/v1/authentication.cr b/src/invidious/routes/api/v1/authentication.cr index b0cb9e00..2a0e4e58 100644 --- a/src/invidious/routes/api/v1/authentication.cr +++ b/src/invidious/routes/api/v1/authentication.cr @@ -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 diff --git a/src/invidious/user/captcha.cr b/src/invidious/user/captcha.cr index 8a0f67e5..b1f5c5d6 100644 --- a/src/invidious/user/captcha.cr +++ b/src/invidious/user/captcha.cr @@ -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 {