Add support for cap, a pow captcha, and implement on contact form
This commit is contained in:
parent
22c2bc1492
commit
bdf4f9a051
6 changed files with 172 additions and 8 deletions
14
src/pages/cap/redeem.ts
Normal file
14
src/pages/cap/redeem.ts
Normal 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 },
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue