This commit is contained in:
badblocks 2026-07-10 00:21:45 -07:00
parent 6e7977997e
commit 79c783c8c1
Signed by: badblocks
SSH key fingerprint: SHA256:hEcM6BP4hKm9F7WsomNuXSBpPn2BSDnFzPSl3y1NerQ
20 changed files with 279 additions and 196 deletions

View file

@ -10,8 +10,21 @@ export const POST: APIRoute = async (context) => {
);
}
const { token, solutions } = await context.request.json();
if (!token || !solutions) {
let body: { token?: unknown; solutions?: unknown };
try {
body = await context.request.json();
} catch {
return new Response(JSON.stringify({ success: false }), { status: 400 });
}
const { token, solutions } = body ?? {};
if (
typeof token !== "string" ||
token.length > 256 ||
!Array.isArray(solutions) ||
solutions.length > 128 ||
!solutions.every((s) => typeof s === "number")
) {
return new Response(JSON.stringify({ success: false }), { status: 400 });
}