Add partial report information to d1

This commit is contained in:
2023-10-19 16:49:30 -04:00
parent 7774a04c86
commit d659a8122f
2 changed files with 24 additions and 9 deletions

View File

@ -9,9 +9,14 @@ export async function onRequestPost(context: RequestContext) {
status: 400,
});
const userId = await context.env.DATA.get(`reportprocessing_${id}`);
const user = await context.env.DATA.get(`reportprocessing_${id}`);
if (!userId || userId !== context.data.current_user.id)
if (
!user ||
(context.data.current_user
? user !== context.data.current_user.id
: user !== context.request.headers.get("CF-Connecting-IP"))
)
return new Response('{"error":"No report with that ID is processing"}', {
headers: {
"content-type": "application/json",