diff --git a/api/rate-limit.ts b/api/rate-limit.ts index d6667073..92c8faa5 100644 --- a/api/rate-limit.ts +++ b/api/rate-limit.ts @@ -89,9 +89,9 @@ export default async function handler(request: any, response: any) { const verificationUrl = `https://www.google.com/recaptcha/api/siteverify?secret=${secretKey}&response=${token}`; if (!secretKey || !process.env.FAUCET_AUTH_TOKEN) { + console.log(`secret key not set`); return request.status(500).json({error: "reCAPTCHA secret key not set"}); } - console.log(`keys exist`); const ip = ips(request) ?? "127.0.0.1"; // const score = await createAssessment("movement-faucet-1722352143785", "6LdVjR0qAAAAAFSjzYqyRFsnUDn-iRrzQmv0nnp3", "", token); @@ -111,14 +111,15 @@ export default async function handler(request: any, response: any) { ); if (!success) { + console.log(`ip rate limit`); return response.status(429).json({success: false, error: "IP rate limited"}); } if (!addressSuccess) { + console.log(`address rate limit`); return response.status(429).json({success: false, error: "Address rate limited"}); } - console.log(`successful rate limit`); const verification = await fetch(verificationUrl, {method: "POST"}); try { const data = await verification.json(); @@ -127,7 +128,6 @@ export default async function handler(request: any, response: any) { .status(400) .json({success: false, error: "Invalid reCAPTCHA token"}); } - console.log(`successful recaptcha`); const HEADERS = { authorization: `Bearer ${process.env.FAUCET_AUTH_TOKEN}`, }; @@ -145,11 +145,11 @@ export default async function handler(request: any, response: any) { amount: 1000000000, }); if (!fund.success) { + console.log(`failed to fund account`); return response .status(400) .json({success: false, error: "Failed to fund account"}); } - console.log(`successful funding`); return response .status(200)