khatru: optional ChallengePrefix.

This commit is contained in:
fiatjaf
2025-07-17 16:46:44 -03:00
parent 840e2846ed
commit 33838a4801
2 changed files with 4 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request) {
ws := &WebSocket{ ws := &WebSocket{
conn: conn, conn: conn,
Request: r, Request: r,
Challenge: hex.EncodeToString(challenge), Challenge: rl.ChallengePrefix + hex.EncodeToString(challenge),
negentropySessions: xsync.NewMapOf[string, *NegentropySession](), negentropySessions: xsync.NewMapOf[string, *NegentropySession](),
} }
ws.Context, ws.cancel = context.WithCancel(context.Background()) ws.Context, ws.cancel = context.WithCancel(context.Background())

View File

@@ -75,6 +75,9 @@ type Relay struct {
OverwriteRelayInformation func(ctx context.Context, r *http.Request, info nip11.RelayInformationDocument) nip11.RelayInformationDocument OverwriteRelayInformation func(ctx context.Context, r *http.Request, info nip11.RelayInformationDocument) nip11.RelayInformationDocument
PreventBroadcast func(ws *WebSocket, event nostr.Event) bool PreventBroadcast func(ws *WebSocket, event nostr.Event) bool
// this can be ignored unless you know what you're doing
ChallengePrefix string
// these are used when this relays acts as a router // these are used when this relays acts as a router
routes []Route routes []Route
getSubRelayFromEvent func(*nostr.Event) *Relay // used for handling EVENTs getSubRelayFromEvent func(*nostr.Event) *Relay // used for handling EVENTs