From d53543a757805a0e4a72956171a814138eea1f4f Mon Sep 17 00:00:00 2001 From: syeopite Date: Thu, 27 Jul 2023 12:27:42 -0700 Subject: [PATCH] Privatize methods to generate text/image captchas --- src/invidious/user/captcha.cr | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/invidious/user/captcha.cr b/src/invidious/user/captcha.cr index 2b873ae2..845168ae 100644 --- a/src/invidious/user/captcha.cr +++ b/src/invidious/user/captcha.cr @@ -6,7 +6,7 @@ struct Invidious::User private TEXTCAPTCHA_URL = URI.parse("https://textcaptcha.com") - def generate_image(key) + private def generate_image_captcha(key) second = Random::Secure.rand(12) second_angle = second * 30 second = second * 5 @@ -61,7 +61,7 @@ struct Invidious::User } end - def generate_text(key) + private def generate_text_captcha(key) response = make_client(TEXTCAPTCHA_URL, &.get("/github.com/iv.org/invidious.json").body) response = JSON.parse(response) @@ -82,9 +82,9 @@ struct Invidious::User captcha_type ||= "image" if captcha_type == "image" - captcha = Invidious::User::Captcha.generate_image(HMAC_KEY) + captcha = self.generate_image_captcha(HMAC_KEY) else - captcha = Invidious::User::Captcha.generate_text(HMAC_KEY) + captcha = self.generate_text_captcha(HMAC_KEY) end return captcha, captcha_type, change_type