From adf874ca2e65a2aff57fce2466aa74ae2548a8d9 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 8 May 2025 23:31:26 -0300 Subject: [PATCH] khatru: change name and signature of relay management main authorization hook. --- khatru/nip86.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/khatru/nip86.go b/khatru/nip86.go index 23e6628..f61a721 100644 --- a/khatru/nip86.go +++ b/khatru/nip86.go @@ -18,7 +18,7 @@ import ( ) type RelayManagementAPI struct { - RejectAPICall []func(ctx context.Context, mp nip86.MethodParams) (reject bool, msg string) + OnAPICall func(ctx context.Context, mp nip86.MethodParams) (reject bool, msg string) BanPubKey func(ctx context.Context, pubkey nostr.PubKey, reason string) error ListBannedPubKeys func(ctx context.Context) ([]nip86.PubKeyReason, error) @@ -110,8 +110,8 @@ func (rl *Relay) HandleNIP86(w http.ResponseWriter, r *http.Request) { } ctx = context.WithValue(ctx, nip86HeaderAuthKey, evt.PubKey) - for _, rac := range rl.ManagementAPI.RejectAPICall { - if reject, msg := rac(ctx, mp); reject { + if rl.ManagementAPI.OnAPICall != nil { + if reject, msg := rl.ManagementAPI.OnAPICall(ctx, mp); reject { resp.Error = msg goto respond }