From 4522797a0cf378cc44485ed77a01dee9643b6ebe Mon Sep 17 00:00:00 2001 From: bndw Date: Sat, 7 Mar 2026 18:34:25 -0800 Subject: Make allowed event kinds configurable Replaces hardcoded kind allowlist in isAllowedKind with a configurable allowed_kinds list in relay config. Empty list allows all kinds. Default matches previous hardcoded list. Wired through SetAllowedKinds on the handler. --- internal/config/config.go | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'internal/config/config.go') diff --git a/internal/config/config.go b/internal/config/config.go index 36d3e1e..dc347d6 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -25,11 +25,12 @@ type Config struct { } type RelayConfig struct { - Name string `yaml:"name"` - Description string `yaml:"description"` - Pubkey string `yaml:"pubkey"` - Contact string `yaml:"contact"` - Icon string `yaml:"icon"` + Name string `yaml:"name"` + Description string `yaml:"description"` + Pubkey string `yaml:"pubkey"` + Contact string `yaml:"contact"` + Icon string `yaml:"icon"` + AllowedKinds []int32 `yaml:"allowed_kinds"` } type ServerConfig struct { @@ -102,6 +103,20 @@ func Default() *Config { Relay: RelayConfig{ Name: "muxstr relay", Description: "High-performance Nostr relay with gRPC, Connect, and WebSocket support", + AllowedKinds: []int32{ + 0, // Metadata/profile + 1, // Short text note + 3, // Contacts/following + 4, // Encrypted DM + 5, // Event deletion + 6, // Repost + 7, // Reaction + 9735, // Zap + 10000, 10001, 10002, // Mute/pin lists (NIP-51) + 10050, // Relay list metadata + 30023, // Long-form content (NIP-23) + 30078, // Application-specific data (NIP-78) + }, }, Server: ServerConfig{ GrpcAddr: ":50051", -- cgit v1.2.3