diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-26 22:29:30 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-26 22:41:21 +1000 |
commit | 99ee7e9400f06e8718612d8b52d15215dc620774 (patch) | |
tree | 08de8c5d3985b9c2eaa419f5198f891ecd82d012 /src/api/util/utility/captcha.ts | |
parent | Remove the cdn storage location log (diff) | |
download | server-99ee7e9400f06e8718612d8b52d15215dc620774.tar.xz |
Prettier
Diffstat (limited to 'src/api/util/utility/captcha.ts')
-rw-r--r-- | src/api/util/utility/captcha.ts | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/api/util/utility/captcha.ts b/src/api/util/utility/captcha.ts index 739647d2..50e2c91a 100644 --- a/src/api/util/utility/captcha.ts +++ b/src/api/util/utility/captcha.ts @@ -7,8 +7,8 @@ export interface hcaptchaResponse { hostname: string; credit: boolean; "error-codes": string[]; - score: number; // enterprise only - score_reason: string[]; // enterprise only + score: number; // enterprise only + score_reason: string[]; // enterprise only } export interface recaptchaResponse { @@ -23,7 +23,7 @@ export interface recaptchaResponse { const verifyEndpoints = { hcaptcha: "https://hcaptcha.com/siteverify", recaptcha: "https://www.google.com/recaptcha/api/siteverify", -} +}; export async function verifyCaptcha(response: string, ip?: string) { const { security } = Config.get(); @@ -36,11 +36,12 @@ export async function verifyCaptcha(response: string, ip?: string) { headers: { "Content-Type": "application/x-www-form-urlencoded", }, - body: `response=${encodeURIComponent(response)}` - + `&secret=${encodeURIComponent(secret!)}` - + `&sitekey=${encodeURIComponent(sitekey!)}` - + (ip ? `&remoteip=${encodeURIComponent(ip!)}` : ""), + body: + `response=${encodeURIComponent(response)}` + + `&secret=${encodeURIComponent(secret!)}` + + `&sitekey=${encodeURIComponent(sitekey!)}` + + (ip ? `&remoteip=${encodeURIComponent(ip!)}` : ""), }); - return await res.json() as hcaptchaResponse | recaptchaResponse; -} \ No newline at end of file + return (await res.json()) as hcaptchaResponse | recaptchaResponse; +} |