fix comments

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-11-08 20:55:38 +01:00
parent 310a867cfa
commit ed8deeec3c
11 changed files with 148 additions and 141 deletions

View File

@@ -8,12 +8,19 @@ export async function duplicateHook(
}>,
reply: FastifyReply,
) {
const isDuplicate = await isDuplicatedEvent({
ip: req.clientIp ?? '',
origin: req.headers.origin ?? '',
payload: req.body,
projectId: (req.headers['openpanel-client-id'] as string) || '',
});
const ip = req.clientIp;
const origin = req.headers.origin;
const clientId = req.headers['openpanel-client-id'];
const shouldCheck = ip && origin && clientId;
const isDuplicate = shouldCheck
? await isDuplicatedEvent({
ip,
origin,
payload: req.body,
projectId: clientId as string,
})
: false;
if (isDuplicate) {
return reply.status(200).send('Duplicate event');