From 6105e00c808ebc5a5b2ff2a764aa121ed95d2be8 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 13 May 2024 12:43:01 -0500 Subject: [PATCH] pipeline: add a placeholder for custom policy --- src/pipeline.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/pipeline.ts b/src/pipeline.ts index c086c92..7da026f 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -1,5 +1,6 @@ import { NostrEvent, NSchema as n } from '@nostrify/nostrify'; import { LNURL } from '@nostrify/nostrify/ln'; +import { PipePolicy } from '@nostrify/nostrify/policies'; import Debug from '@soapbox/stickynotes/debug'; import { sql } from 'kysely'; @@ -33,9 +34,12 @@ async function handleEvent(event: DittoEvent, signal: AbortSignal): Promise ${event.id}`); - await hydrateEvent(event, signal); - await policyFilter(event); + if (event.kind !== 24133) { + await policyFilter(event); + } + + await hydrateEvent(event, signal); await Promise.all([ storeEvent(event, signal), @@ -51,9 +55,12 @@ async function handleEvent(event: DittoEvent, signal: AbortSignal): Promise { - const policy = new MuteListPolicy(Conf.pubkey, Storages.admin); - const result = await policy.call(event); + const policy = new PipePolicy([ + new MuteListPolicy(Conf.pubkey, Storages.admin), + // put custom policy here + ]); + const result = await policy.call(event); debug(JSON.stringify(result)); const [_, _eventId, ok, reason] = result;