Add support for cap, a pow captcha, and implement on contact form

This commit is contained in:
badblocks 2026-01-06 19:55:56 -08:00
parent 22c2bc1492
commit bdf4f9a051
No known key found for this signature in database
6 changed files with 172 additions and 8 deletions

14
src/pages/cap/redeem.ts Normal file
View file

@ -0,0 +1,14 @@
import type { APIRoute } from "astro";
import cap from "@lib/cap";
export const prerender = false;
export const POST: APIRoute = async ({ request }) => {
const { token, solutions } = await request.json();
if (!token || !solutions) {
return new Response(JSON.stringify({ success: false }), { status: 400 });
}
return new Response(
JSON.stringify(await cap.redeemChallenge({ token, solutions })),
{ status: 200 },
);
};