3 Commits

Author SHA1 Message Date
mplorentz 662e7d271c Add KindSimpleGroupLiveKitParticipants (#1)
Add kind 39004 so that zooid can publish active livekit participants.

Co-authored-by: Matt Lorentz <mplorentz@noreply.coracle.social>
Co-committed-by: Matt Lorentz <mplorentz@noreply.coracle.social>
2026-03-13 09:49:27 -07:00
Jon Staab d6812c040a Add unbanpubkey and unallowpubkey 2026-02-25 19:31:37 -08:00
Jon Staab 43de47addb Switch supported_nips to strings 2026-02-09 14:40:37 -08:00
10 changed files with 236 additions and 162 deletions
+2 -2
View File
@@ -155,14 +155,14 @@ func (rl *Relay) StartExpirationManager(
} }
go rl.expirationManager.start(rl.ctx) go rl.expirationManager.start(rl.ctx)
rl.Info.AddSupportedNIP(40) rl.Info.AddSupportedNIP("40")
} }
func (rl *Relay) DisableExpirationManager() { func (rl *Relay) DisableExpirationManager() {
rl.expirationManager.stop() rl.expirationManager.stop()
rl.expirationManager = nil rl.expirationManager = nil
idx := slices.Index(rl.Info.SupportedNIPs, 40) idx := slices.Index(rl.Info.SupportedNIPs, "40")
if idx != -1 { if idx != -1 {
rl.Info.SupportedNIPs[idx] = rl.Info.SupportedNIPs[len(rl.Info.SupportedNIPs)-1] rl.Info.SupportedNIPs[idx] = rl.Info.SupportedNIPs[len(rl.Info.SupportedNIPs)-1]
rl.Info.SupportedNIPs = rl.Info.SupportedNIPs[0 : len(rl.Info.SupportedNIPs)-1] rl.Info.SupportedNIPs = rl.Info.SupportedNIPs[0 : len(rl.Info.SupportedNIPs)-1]
+1 -1
View File
@@ -31,7 +31,7 @@ func New(rl *khatru.Relay, repositoryDir string) *GraspServer {
}, },
} }
rl.Info.AddSupportedNIP(34) rl.Info.AddSupportedNIP("34")
rl.Info.SupportedGrasps = append(rl.Info.SupportedGrasps, "GRASP-01") rl.Info.SupportedGrasps = append(rl.Info.SupportedGrasps, "GRASP-01")
base := rl.Router() base := rl.Router()
+3 -3
View File
@@ -12,13 +12,13 @@ func (rl *Relay) HandleNIP11(w http.ResponseWriter, r *http.Request) {
info := *rl.Info info := *rl.Info
if nil != rl.DeleteEvent { if nil != rl.DeleteEvent {
info.AddSupportedNIP(9) info.AddSupportedNIP("9")
} }
if nil != rl.Count { if nil != rl.Count {
info.AddSupportedNIP(45) info.AddSupportedNIP("45")
} }
if rl.Negentropy { if rl.Negentropy {
info.AddSupportedNIP(77) info.AddSupportedNIP("77")
} }
// resolve relative icon and banner URLs against base URL // resolve relative icon and banner URLs against base URL
+18
View File
@@ -21,8 +21,10 @@ type RelayManagementAPI struct {
BanPubKey func(ctx context.Context, pubkey nostr.PubKey, reason string) error BanPubKey func(ctx context.Context, pubkey nostr.PubKey, reason string) error
ListBannedPubKeys func(ctx context.Context) ([]nip86.PubKeyReason, error) ListBannedPubKeys func(ctx context.Context) ([]nip86.PubKeyReason, error)
UnbanPubKey func(ctx context.Context, pubkey nostr.PubKey, reason string) error
AllowPubKey func(ctx context.Context, pubkey nostr.PubKey, reason string) error AllowPubKey func(ctx context.Context, pubkey nostr.PubKey, reason string) error
ListAllowedPubKeys func(ctx context.Context) ([]nip86.PubKeyReason, error) ListAllowedPubKeys func(ctx context.Context) ([]nip86.PubKeyReason, error)
UnallowPubKey func(ctx context.Context, pubkey nostr.PubKey, reason string) error
ListEventsNeedingModeration func(ctx context.Context) ([]nip86.IDReason, error) ListEventsNeedingModeration func(ctx context.Context) ([]nip86.IDReason, error)
AllowEvent func(ctx context.Context, id nostr.ID, reason string) error AllowEvent func(ctx context.Context, id nostr.ID, reason string) error
BanEvent func(ctx context.Context, id nostr.ID, reason string) error BanEvent func(ctx context.Context, id nostr.ID, reason string) error
@@ -168,6 +170,14 @@ func (rl *Relay) HandleNIP86(w http.ResponseWriter, r *http.Request) {
} else { } else {
resp.Result = result resp.Result = result
} }
case nip86.UnbanPubKey:
if rl.ManagementAPI.UnbanPubKey == nil {
resp.Error = fmt.Sprintf("method %s not supported", thing.MethodName())
} else if err := rl.ManagementAPI.UnbanPubKey(ctx, thing.PubKey, thing.Reason); err != nil {
resp.Error = err.Error()
} else {
resp.Result = true
}
case nip86.AllowPubKey: case nip86.AllowPubKey:
if rl.ManagementAPI.AllowPubKey == nil { if rl.ManagementAPI.AllowPubKey == nil {
resp.Error = fmt.Sprintf("method %s not supported", thing.MethodName()) resp.Error = fmt.Sprintf("method %s not supported", thing.MethodName())
@@ -184,6 +194,14 @@ func (rl *Relay) HandleNIP86(w http.ResponseWriter, r *http.Request) {
} else { } else {
resp.Result = result resp.Result = result
} }
case nip86.UnallowPubKey:
if rl.ManagementAPI.UnallowPubKey == nil {
resp.Error = fmt.Sprintf("method %s not supported", thing.MethodName())
} else if err := rl.ManagementAPI.UnallowPubKey(ctx, thing.PubKey, thing.Reason); err != nil {
resp.Error = err.Error()
} else {
resp.Result = true
}
case nip86.BanEvent: case nip86.BanEvent:
if rl.ManagementAPI.BanEvent == nil { if rl.ManagementAPI.BanEvent == nil {
resp.Error = fmt.Sprintf("method %s not supported", thing.MethodName()) resp.Error = fmt.Sprintf("method %s not supported", thing.MethodName())
+1 -1
View File
@@ -30,7 +30,7 @@ func NewRelay() *Relay {
Info: &nip11.RelayInformationDocument{ Info: &nip11.RelayInformationDocument{
Software: "https://pkg.go.dev/fiatjaf.com/nostr/khatru", Software: "https://pkg.go.dev/fiatjaf.com/nostr/khatru",
Version: "n/a", Version: "n/a",
SupportedNIPs: []any{1, 11, 42, 70, 86}, SupportedNIPs: []string{"1", "11", "42", "70", "86"},
}, },
upgrader: websocket.Upgrader{ upgrader: websocket.Upgrader{
+135 -132
View File
@@ -246,6 +246,8 @@ func (kind Kind) Name() string {
return "SimpleGroupMembers" return "SimpleGroupMembers"
case KindSimpleGroupRoles: case KindSimpleGroupRoles:
return "SimpleGroupRoles" return "SimpleGroupRoles"
case KindSimpleGroupLiveKitParticipants:
return "SimpleGroupLiveKitParticipants"
case KindWikiArticle: case KindWikiArticle:
return "WikiArticle" return "WikiArticle"
case KindRedirects: case KindRedirects:
@@ -277,138 +279,139 @@ func (kind Kind) Name() string {
} }
const ( const (
KindProfileMetadata Kind = 0 KindProfileMetadata Kind = 0
KindTextNote Kind = 1 KindTextNote Kind = 1
KindRecommendServer Kind = 2 KindRecommendServer Kind = 2
KindFollowList Kind = 3 KindFollowList Kind = 3
KindEncryptedDirectMessage Kind = 4 KindEncryptedDirectMessage Kind = 4
KindDeletion Kind = 5 KindDeletion Kind = 5
KindRepost Kind = 6 KindRepost Kind = 6
KindReaction Kind = 7 KindReaction Kind = 7
KindBadgeAward Kind = 8 KindBadgeAward Kind = 8
KindSimpleGroupChatMessage Kind = 9 KindSimpleGroupChatMessage Kind = 9
KindSimpleGroupThreadedReply Kind = 10 KindSimpleGroupThreadedReply Kind = 10
KindSimpleGroupThread Kind = 11 KindSimpleGroupThread Kind = 11
KindSimpleGroupReply Kind = 12 KindSimpleGroupReply Kind = 12
KindSeal Kind = 13 KindSeal Kind = 13
KindDirectMessage Kind = 14 KindDirectMessage Kind = 14
KindGenericRepost Kind = 16 KindGenericRepost Kind = 16
KindReactionToWebsite Kind = 17 KindReactionToWebsite Kind = 17
KindChannelCreation Kind = 40 KindChannelCreation Kind = 40
KindChannelMetadata Kind = 41 KindChannelMetadata Kind = 41
KindChannelMessage Kind = 42 KindChannelMessage Kind = 42
KindChannelHideMessage Kind = 43 KindChannelHideMessage Kind = 43
KindChannelMuteUser Kind = 44 KindChannelMuteUser Kind = 44
KindChess Kind = 64 KindChess Kind = 64
KindMergeRequests Kind = 818 KindMergeRequests Kind = 818
KindComment Kind = 1111 KindComment Kind = 1111
KindBid Kind = 1021 KindBid Kind = 1021
KindBidConfirmation Kind = 1022 KindBidConfirmation Kind = 1022
KindOpenTimestamps Kind = 1040 KindOpenTimestamps Kind = 1040
KindGiftWrap Kind = 1059 KindGiftWrap Kind = 1059
KindFileMetadata Kind = 1063 KindFileMetadata Kind = 1063
KindLiveChatMessage Kind = 1311 KindLiveChatMessage Kind = 1311
KindPatch Kind = 1617 KindPatch Kind = 1617
KindIssue Kind = 1621 KindIssue Kind = 1621
KindReply Kind = 1622 KindReply Kind = 1622
KindStatusOpen Kind = 1630 KindStatusOpen Kind = 1630
KindStatusApplied Kind = 1631 KindStatusApplied Kind = 1631
KindStatusClosed Kind = 1632 KindStatusClosed Kind = 1632
KindStatusDraft Kind = 1633 KindStatusDraft Kind = 1633
KindProblemTracker Kind = 1971 KindProblemTracker Kind = 1971
KindReporting Kind = 1984 KindReporting Kind = 1984
KindLabel Kind = 1985 KindLabel Kind = 1985
KindRelayReviews Kind = 1986 KindRelayReviews Kind = 1986
KindAIEmbeddings Kind = 1987 KindAIEmbeddings Kind = 1987
KindTorrent Kind = 2003 KindTorrent Kind = 2003
KindTorrentComment Kind = 2004 KindTorrentComment Kind = 2004
KindCoinjoinPool Kind = 2022 KindCoinjoinPool Kind = 2022
KindCommunityPostApproval Kind = 4550 KindCommunityPostApproval Kind = 4550
KindJobFeedback Kind = 7000 KindJobFeedback Kind = 7000
KindSimpleGroupPutUser Kind = 9000 KindSimpleGroupPutUser Kind = 9000
KindSimpleGroupRemoveUser Kind = 9001 KindSimpleGroupRemoveUser Kind = 9001
KindSimpleGroupEditMetadata Kind = 9002 KindSimpleGroupEditMetadata Kind = 9002
KindSimpleGroupDeleteEvent Kind = 9005 KindSimpleGroupDeleteEvent Kind = 9005
KindSimpleGroupCreateGroup Kind = 9007 KindSimpleGroupCreateGroup Kind = 9007
KindSimpleGroupDeleteGroup Kind = 9008 KindSimpleGroupDeleteGroup Kind = 9008
KindSimpleGroupCreateInvite Kind = 9009 KindSimpleGroupCreateInvite Kind = 9009
KindSimpleGroupJoinRequest Kind = 9021 KindSimpleGroupJoinRequest Kind = 9021
KindSimpleGroupLeaveRequest Kind = 9022 KindSimpleGroupLeaveRequest Kind = 9022
KindZapGoal Kind = 9041 KindZapGoal Kind = 9041
KindNutZap Kind = 9321 KindNutZap Kind = 9321
KindTidalLogin Kind = 9467 KindTidalLogin Kind = 9467
KindZapRequest Kind = 9734 KindZapRequest Kind = 9734
KindZap Kind = 9735 KindZap Kind = 9735
KindHighlights Kind = 9802 KindHighlights Kind = 9802
KindMuteList Kind = 10000 KindMuteList Kind = 10000
KindPinList Kind = 10001 KindPinList Kind = 10001
KindRelayListMetadata Kind = 10002 KindRelayListMetadata Kind = 10002
KindBookmarkList Kind = 10003 KindBookmarkList Kind = 10003
KindCommunityList Kind = 10004 KindCommunityList Kind = 10004
KindPublicChatList Kind = 10005 KindPublicChatList Kind = 10005
KindBlockedRelayList Kind = 10006 KindBlockedRelayList Kind = 10006
KindSearchRelayList Kind = 10007 KindSearchRelayList Kind = 10007
KindSimpleGroupList Kind = 10009 KindSimpleGroupList Kind = 10009
KindInterestList Kind = 10015 KindInterestList Kind = 10015
KindNutZapInfo Kind = 10019 KindNutZapInfo Kind = 10019
KindEmojiList Kind = 10030 KindEmojiList Kind = 10030
KindDMRelayList Kind = 10050 KindDMRelayList Kind = 10050
KindUserServerList Kind = 10063 KindUserServerList Kind = 10063
KindFileStorageServerList Kind = 10096 KindFileStorageServerList Kind = 10096
KindGoodWikiAuthorList Kind = 10101 KindGoodWikiAuthorList Kind = 10101
KindGoodWikiRelayList Kind = 10102 KindGoodWikiRelayList Kind = 10102
KindNWCWalletInfo Kind = 13194 KindNWCWalletInfo Kind = 13194
KindLightningPubRPC Kind = 21000 KindLightningPubRPC Kind = 21000
KindClientAuthentication Kind = 22242 KindClientAuthentication Kind = 22242
KindNWCWalletRequest Kind = 23194 KindNWCWalletRequest Kind = 23194
KindNWCWalletResponse Kind = 23195 KindNWCWalletResponse Kind = 23195
KindNostrConnect Kind = 24133 KindNostrConnect Kind = 24133
KindBlobs Kind = 24242 KindBlobs Kind = 24242
KindHTTPAuth Kind = 27235 KindHTTPAuth Kind = 27235
KindCategorizedPeopleList Kind = 30000 KindCategorizedPeopleList Kind = 30000
KindCategorizedBookmarksList Kind = 30001 KindCategorizedBookmarksList Kind = 30001
KindRelaySets Kind = 30002 KindRelaySets Kind = 30002
KindBookmarkSets Kind = 30003 KindBookmarkSets Kind = 30003
KindCuratedSets Kind = 30004 KindCuratedSets Kind = 30004
KindCuratedVideoSets Kind = 30005 KindCuratedVideoSets Kind = 30005
KindMuteSets Kind = 30007 KindMuteSets Kind = 30007
KindProfileBadges Kind = 30008 KindProfileBadges Kind = 30008
KindBadgeDefinition Kind = 30009 KindBadgeDefinition Kind = 30009
KindInterestSets Kind = 30015 KindInterestSets Kind = 30015
KindStallDefinition Kind = 30017 KindStallDefinition Kind = 30017
KindProductDefinition Kind = 30018 KindProductDefinition Kind = 30018
KindMarketplaceUI Kind = 30019 KindMarketplaceUI Kind = 30019
KindProductSoldAsAuction Kind = 30020 KindProductSoldAsAuction Kind = 30020
KindArticle Kind = 30023 KindArticle Kind = 30023
KindDraftArticle Kind = 30024 KindDraftArticle Kind = 30024
KindEmojiSets Kind = 30030 KindEmojiSets Kind = 30030
KindModularArticleHeader Kind = 30040 KindModularArticleHeader Kind = 30040
KindModularArticleContent Kind = 30041 KindModularArticleContent Kind = 30041
KindReleaseArtifactSets Kind = 30063 KindReleaseArtifactSets Kind = 30063
KindApplicationSpecificData Kind = 30078 KindApplicationSpecificData Kind = 30078
KindLiveEvent Kind = 30311 KindLiveEvent Kind = 30311
KindUserStatuses Kind = 30315 KindUserStatuses Kind = 30315
KindClassifiedListing Kind = 30402 KindClassifiedListing Kind = 30402
KindDraftClassifiedListing Kind = 30403 KindDraftClassifiedListing Kind = 30403
KindRepositoryAnnouncement Kind = 30617 KindRepositoryAnnouncement Kind = 30617
KindRepositoryState Kind = 30618 KindRepositoryState Kind = 30618
KindSimpleGroupMetadata Kind = 39000 KindSimpleGroupMetadata Kind = 39000
KindSimpleGroupAdmins Kind = 39001 KindSimpleGroupAdmins Kind = 39001
KindSimpleGroupMembers Kind = 39002 KindSimpleGroupMembers Kind = 39002
KindSimpleGroupRoles Kind = 39003 KindSimpleGroupRoles Kind = 39003
KindWikiArticle Kind = 30818 KindSimpleGroupLiveKitParticipants Kind = 39004
KindRedirects Kind = 30819 KindWikiArticle Kind = 30818
KindFeed Kind = 31890 KindRedirects Kind = 30819
KindDateCalendarEvent Kind = 31922 KindFeed Kind = 31890
KindTimeCalendarEvent Kind = 31923 KindDateCalendarEvent Kind = 31922
KindCalendar Kind = 31924 KindTimeCalendarEvent Kind = 31923
KindCalendarEventRSVP Kind = 31925 KindCalendar Kind = 31924
KindHandlerRecommendation Kind = 31989 KindCalendarEventRSVP Kind = 31925
KindHandlerInformation Kind = 31990 KindHandlerRecommendation Kind = 31989
KindVideoEvent Kind = 34235 KindHandlerInformation Kind = 31990
KindShortVideoEvent Kind = 34236 KindVideoEvent Kind = 34235
KindVideoViewEvent Kind = 34237 KindShortVideoEvent Kind = 34236
KindCommunityDefinition Kind = 34550 KindVideoViewEvent Kind = 34237
KindCommunityDefinition Kind = 34550
) )
func (kind Kind) IsRegular() bool { func (kind Kind) IsRegular() bool {
+18 -18
View File
@@ -9,30 +9,30 @@ import (
func TestAddSupportedNIP(t *testing.T) { func TestAddSupportedNIP(t *testing.T) {
info := RelayInformationDocument{} info := RelayInformationDocument{}
info.AddSupportedNIP(12) info.AddSupportedNIP("12")
info.AddSupportedNIP(12) info.AddSupportedNIP("12")
info.AddSupportedNIP(13) info.AddSupportedNIP("13")
info.AddSupportedNIP(1) info.AddSupportedNIP("1")
info.AddSupportedNIP(12) info.AddSupportedNIP("12")
info.AddSupportedNIP(44) info.AddSupportedNIP("44")
info.AddSupportedNIP(2) info.AddSupportedNIP("2")
info.AddSupportedNIP(13) info.AddSupportedNIP("13")
info.AddSupportedNIP(2) info.AddSupportedNIP("2")
info.AddSupportedNIP(13) info.AddSupportedNIP("13")
info.AddSupportedNIP(0) info.AddSupportedNIP("0")
info.AddSupportedNIP(17) info.AddSupportedNIP("17")
info.AddSupportedNIP(19) info.AddSupportedNIP("19")
info.AddSupportedNIP(1) info.AddSupportedNIP("1")
info.AddSupportedNIP(18) info.AddSupportedNIP("18")
assert.Contains(t, info.SupportedNIPs, 0, 1, 2, 12, 13, 17, 18, 19, 44) assert.Contains(t, info.SupportedNIPs, "0", "1", "2", "12", "13", "17", "18", "19", "44")
} }
func TestAddSupportedNIPs(t *testing.T) { func TestAddSupportedNIPs(t *testing.T) {
info := RelayInformationDocument{} info := RelayInformationDocument{}
info.AddSupportedNIPs([]int{0, 1, 2, 12, 13, 17, 18, 19, 44}) info.AddSupportedNIPs([]int{"0", "1", "2", "12", "13", "17", "18", "19", "44"})
assert.Contains(t, info.SupportedNIPs, 0, 1, 2, 12, 13, 17, 18, 19, 44) assert.Contains(t, info.SupportedNIPs, "0", "1", "2", "12", "13", "17", "18", "19", "44")
} }
func TestFetch(t *testing.T) { func TestFetch(t *testing.T) {
+5 -5
View File
@@ -14,7 +14,7 @@ type RelayInformationDocument struct {
PubKey *nostr.PubKey `json:"pubkey,omitempty"` PubKey *nostr.PubKey `json:"pubkey,omitempty"`
Self *nostr.PubKey `json:"self,omitempty"` Self *nostr.PubKey `json:"self,omitempty"`
Contact string `json:"contact,omitempty"` Contact string `json:"contact,omitempty"`
SupportedNIPs []any `json:"supported_nips,omitempty"` SupportedNIPs []string `json:"supported_nips,omitempty"`
Software string `json:"software,omitempty"` Software string `json:"software,omitempty"`
Version string `json:"version,omitempty"` Version string `json:"version,omitempty"`
@@ -33,16 +33,16 @@ type RelayInformationDocument struct {
SupportedGrasps []string `json:"supported_grasps,omitempty"` SupportedGrasps []string `json:"supported_grasps,omitempty"`
} }
func (info *RelayInformationDocument) AddSupportedNIP(number int) { func (info *RelayInformationDocument) AddSupportedNIP(nip string) {
idx := slices.IndexFunc(info.SupportedNIPs, func(n any) bool { return n == number }) idx := slices.IndexFunc(info.SupportedNIPs, func(n string) bool { return n == nip })
if idx != -1 { if idx != -1 {
return return
} }
info.SupportedNIPs = append(info.SupportedNIPs, number) info.SupportedNIPs = append(info.SupportedNIPs, nip)
} }
func (info *RelayInformationDocument) AddSupportedNIPs(numbers []int) { func (info *RelayInformationDocument) AddSupportedNIPs(numbers []string) {
for _, n := range numbers { for _, n := range numbers {
info.AddSupportedNIP(n) info.AddSupportedNIP(n)
} }
+1
View File
@@ -28,6 +28,7 @@ var MetadataEventKinds = KindRange{
nostr.KindSimpleGroupAdmins, nostr.KindSimpleGroupAdmins,
nostr.KindSimpleGroupMembers, nostr.KindSimpleGroupMembers,
nostr.KindSimpleGroupRoles, nostr.KindSimpleGroupRoles,
nostr.KindSimpleGroupLiveKitParticipants,
} }
func (kr KindRange) Includes(kind nostr.Kind) bool { func (kr KindRange) Includes(kind nostr.Kind) bool {
+52
View File
@@ -32,6 +32,24 @@ func DecodeRequest(req Request) (MethodParams, error) {
return BanPubKey{pk, reason}, nil return BanPubKey{pk, reason}, nil
case "listbannedpubkeys": case "listbannedpubkeys":
return ListBannedPubKeys{}, nil return ListBannedPubKeys{}, nil
case "unbanpubkey":
if len(req.Params) == 0 {
return nil, fmt.Errorf("invalid number of params for '%s'", req.Method)
}
pkh, ok := req.Params[0].(string)
if !ok {
return nil, fmt.Errorf("missing pubkey param for '%s'", req.Method)
}
pk, err := nostr.PubKeyFromHex(pkh)
if err != nil {
return nil, fmt.Errorf("invalid pubkey param for '%s'", req.Method)
}
var reason string
if len(req.Params) >= 2 {
reason, _ = req.Params[1].(string)
}
return UnbanPubKey{pk, reason}, nil
case "allowpubkey": case "allowpubkey":
if len(req.Params) == 0 { if len(req.Params) == 0 {
return nil, fmt.Errorf("invalid number of params for '%s'", req.Method) return nil, fmt.Errorf("invalid number of params for '%s'", req.Method)
@@ -52,6 +70,24 @@ func DecodeRequest(req Request) (MethodParams, error) {
return AllowPubKey{pk, reason}, nil return AllowPubKey{pk, reason}, nil
case "listallowedpubkeys": case "listallowedpubkeys":
return ListAllowedPubKeys{}, nil return ListAllowedPubKeys{}, nil
case "unallowpubkey":
if len(req.Params) == 0 {
return nil, fmt.Errorf("invalid number of params for '%s'", req.Method)
}
pkh, ok := req.Params[0].(string)
if !ok {
return nil, fmt.Errorf("missing pubkey param for '%s'", req.Method)
}
pk, err := nostr.PubKeyFromHex(pkh)
if err != nil {
return nil, fmt.Errorf("invalid pubkey param for '%s'", req.Method)
}
var reason string
if len(req.Params) >= 2 {
reason, _ = req.Params[1].(string)
}
return UnallowPubKey{pk, reason}, nil
case "listeventsneedingmoderation": case "listeventsneedingmoderation":
return ListEventsNeedingModeration{}, nil return ListEventsNeedingModeration{}, nil
case "allowevent": case "allowevent":
@@ -219,8 +255,10 @@ var (
_ MethodParams = (*SupportedMethods)(nil) _ MethodParams = (*SupportedMethods)(nil)
_ MethodParams = (*BanPubKey)(nil) _ MethodParams = (*BanPubKey)(nil)
_ MethodParams = (*ListBannedPubKeys)(nil) _ MethodParams = (*ListBannedPubKeys)(nil)
_ MethodParams = (*UnbanPubKey)(nil)
_ MethodParams = (*AllowPubKey)(nil) _ MethodParams = (*AllowPubKey)(nil)
_ MethodParams = (*ListAllowedPubKeys)(nil) _ MethodParams = (*ListAllowedPubKeys)(nil)
_ MethodParams = (*UnallowPubKey)(nil)
_ MethodParams = (*ListEventsNeedingModeration)(nil) _ MethodParams = (*ListEventsNeedingModeration)(nil)
_ MethodParams = (*AllowEvent)(nil) _ MethodParams = (*AllowEvent)(nil)
_ MethodParams = (*BanEvent)(nil) _ MethodParams = (*BanEvent)(nil)
@@ -256,6 +294,13 @@ type ListBannedPubKeys struct{}
func (ListBannedPubKeys) MethodName() string { return "listbannedpubkeys" } func (ListBannedPubKeys) MethodName() string { return "listbannedpubkeys" }
type UnbanPubKey struct {
PubKey nostr.PubKey
Reason string
}
func (UnbanPubKey) MethodName() string { return "unbanpubkey" }
type AllowPubKey struct { type AllowPubKey struct {
PubKey nostr.PubKey PubKey nostr.PubKey
Reason string Reason string
@@ -267,6 +312,13 @@ type ListAllowedPubKeys struct{}
func (ListAllowedPubKeys) MethodName() string { return "listallowedpubkeys" } func (ListAllowedPubKeys) MethodName() string { return "listallowedpubkeys" }
type UnallowPubKey struct {
PubKey nostr.PubKey
Reason string
}
func (UnallowPubKey) MethodName() string { return "unallowpubkey" }
type ListEventsNeedingModeration struct{} type ListEventsNeedingModeration struct{}
func (ListEventsNeedingModeration) MethodName() string { return "listeventsneedingmoderation" } func (ListEventsNeedingModeration) MethodName() string { return "listeventsneedingmoderation" }