From 250680a989410f04b95f120a4e2fb3b924742ade Mon Sep 17 00:00:00 2001 From: Asara Date: Mon, 23 Sep 2024 21:49:34 -0400 Subject: [PATCH] add reactions to allowed list --- nostr/policies.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nostr/policies.go b/nostr/policies.go index 2c4785e..dcfb177 100644 --- a/nostr/policies.go +++ b/nostr/policies.go @@ -11,7 +11,6 @@ import ( ) func RejectUnregisteredNpubs(ctx context.Context, event *nostr.Event) (reject bool, msg string) { - var err error l := gologger.Get(config.GetConfig().LogLevel).With().Caller().Logger() // always allow the following kinds @@ -37,11 +36,12 @@ func RejectUnregisteredNpubs(ctx context.Context, event *nostr.Event) (reject bo // in addition to the registered users, others can use the relay for the following kinds // as long as a registered user is tagged in the `p` tag // 4: nip-04 encrypted dms + // 7: nip-25 reactions // 14: nip-17 private dms // 1059: nip-59 gift wraps // 24133: nip-46 nostr connect switch event.Kind { - case 4, 14, 1059, 24133: + case 4, 7, 14, 1059, 24133: for _, npub := range event.Tags.GetAll([]string{"p"}) { npubs = append(npubs, npub.Value()) } @@ -49,8 +49,8 @@ func RejectUnregisteredNpubs(ctx context.Context, event *nostr.Event) (reject bo // check if npubs are registered if authz := checknPubsInDb(npubs); authz == false { - l.Debug().Msgf("kind: %v, pubkey: %s, error: %s", event.Kind, event.PubKey, err.Error()) - return true, fmt.Sprintf("restricted: pubkey %s is not registered to any users", authenticatedUser) + l.Debug().Msgf("kind: %v, pubkey: %s, unauthorized", event.Kind, event.PubKey) + return true, fmt.Sprintf("restricted: this event is not from or to any registered users/npubs") } return false, "" }