From 8557c7a8dccb1932092e417932ac579b303038b2 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Fri, 19 Apr 2024 15:33:15 -0300 Subject: [PATCH] policy to reject events with base64 media. --- policies/events.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/policies/events.go b/policies/events.go index 3269473..f76febc 100644 --- a/policies/events.go +++ b/policies/events.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "slices" + "strings" "github.com/nbd-wtf/go-nostr" ) @@ -116,3 +117,7 @@ func PreventTimestampsInTheFuture(thresholdSeconds nostr.Timestamp) func(context return false, "" } } + +func RejectEventsWithBase64Media(ctx context.Context, evt *nostr.Event) (bool, string) { + return strings.Contains(evt.Content, "data:image/") || strings.Contains(evt.Content, "data:video/"), "event with base64 media" +}