From 5195d8031b7930069ba5441a6cd1e7a59c21c546 Mon Sep 17 00:00:00 2001 From: Clawd Date: Sun, 22 Feb 2026 14:08:54 -0800 Subject: NIP-11: make relay info configurable - Add relay config section (name, description, pubkey, contact, icon) - Wire config to NIP-11 handler - AuthRequired/RestrictedWrites now reflect actual auth config - Add NIP-42 to supported_nips list - Update example config --- internal/handler/websocket/handler.go | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'internal/handler/websocket/handler.go') diff --git a/internal/handler/websocket/handler.go b/internal/handler/websocket/handler.go index 6eb8763..b11171d 100644 --- a/internal/handler/websocket/handler.go +++ b/internal/handler/websocket/handler.go @@ -49,6 +49,14 @@ type AuthConfig struct { WriteAllowedPubkeys []string } +type RelayInfoConfig struct { + Name string + Description string + Pubkey string + Contact string + Icon string +} + type connState struct { authenticatedPubkey string authChallenge string @@ -56,13 +64,14 @@ type connState struct { } type Handler struct { - store EventStore - auth AuthStore - subs *subscription.Manager - metrics MetricsRecorder - limiter RateLimiter - authConfig *AuthConfig - indexData IndexData + store EventStore + auth AuthStore + subs *subscription.Manager + metrics MetricsRecorder + limiter RateLimiter + authConfig *AuthConfig + relayConfig *RelayInfoConfig + indexData IndexData } func NewHandler(store EventStore, subs *subscription.Manager) *Handler { @@ -88,6 +97,10 @@ func (h *Handler) SetAuthConfig(cfg *AuthConfig) { h.authConfig = cfg } +func (h *Handler) SetRelayConfig(cfg *RelayInfoConfig) { + h.relayConfig = cfg +} + // SetIndexData sets the addresses for the index page func (h *Handler) SetIndexData(grpcAddr, httpAddr, wsAddr string) { h.indexData = IndexData{ -- cgit v1.2.3