Handle ip auth for report recall endpoint

This commit is contained in:
regalijan 2023-10-19 16:50:17 -04:00
parent cd420eabcc
commit 45e05d78c7
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

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