summary refs log tree commit diff
path: root/src/api/util
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-09-04 10:44:33 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-09-04 10:44:33 +0200
commit3a3417cded637b8f582ebd04dedefc2c117d25cd (patch)
treeeb3b84ad66e246540ec06f9dfb2b9c322df7c635 /src/api/util
parentMerge pull request #873 from fosscord/dev/Maddy/fix/listeningAfterDb (diff)
downloadserver-3a3417cded637b8f582ebd04dedefc2c117d25cd.tar.xz
Prettier
Diffstat (limited to 'src/api/util')
-rw-r--r--src/api/util/index.ts2
-rw-r--r--src/api/util/utility/captcha.ts23
2 files changed, 13 insertions, 12 deletions
diff --git a/src/api/util/index.ts b/src/api/util/index.ts
index 31e75325..d06860cd 100644
--- a/src/api/util/index.ts
+++ b/src/api/util/index.ts
@@ -3,8 +3,8 @@ export * from "./handlers/Message";
 export * from "./handlers/route";
 export * from "./handlers/Voice";
 export * from "./utility/Base64";
+export * from "./utility/captcha";
 export * from "./utility/ipAddress";
 export * from "./utility/passwordStrength";
 export * from "./utility/RandomInviteID";
 export * from "./utility/String";
-export * from "./utility/captcha";
\ No newline at end of file
diff --git a/src/api/util/utility/captcha.ts b/src/api/util/utility/captcha.ts
index 739647d2..02983f3f 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 {
@@ -22,8 +22,8 @@ export interface recaptchaResponse {
 
 const verifyEndpoints = {
 	hcaptcha: "https://hcaptcha.com/siteverify",
-	recaptcha: "https://www.google.com/recaptcha/api/siteverify",
-}
+	recaptcha: "https://www.google.com/recaptcha/api/siteverify"
+};
 
 export async function verifyCaptcha(response: string, ip?: string) {
 	const { security } = Config.get();
@@ -34,13 +34,14 @@ export async function verifyCaptcha(response: string, ip?: string) {
 	const res = await fetch(verifyEndpoints[service], {
 		method: "POST",
 		headers: {
-			"Content-Type": "application/x-www-form-urlencoded",
+			"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;
+}