From b3c13ca72ef52d92c2cb2176e76c5810b53195e1 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 28 Feb 2023 20:35:03 -0600 Subject: [PATCH] hellthread: only apply to event1 --- hellthread-policy.ts | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/hellthread-policy.ts b/hellthread-policy.ts index 1f67eb7..bed7114 100755 --- a/hellthread-policy.ts +++ b/hellthread-policy.ts @@ -28,21 +28,23 @@ interface Event { } function handleMessage(msg: InputMessage): OutputMessage { - const p = msg.event.tags.filter((tag) => tag[0] === 'p'); + if (msg.event.kind === 1) { + const p = msg.event.tags.filter((tag) => tag[0] === 'p'); - if (p.length > HELLTHREAD_LIMIT) { - return { - id: msg.event.id, - action: 'reject', - msg: `Event rejected due to ${p.length} "p" tags (${HELLTHREAD_LIMIT} is the limit).`, - }; - } else { - return { - id: msg.event.id, - action: 'accept', - msg: '', - }; + if (p.length > HELLTHREAD_LIMIT) { + return { + id: msg.event.id, + action: 'reject', + msg: `Event rejected due to ${p.length} "p" tags (${HELLTHREAD_LIMIT} is the limit).`, + }; + } } + + return { + id: msg.event.id, + action: 'accept', + msg: '', + }; } for await (const line of readLines(Deno.stdin)) {