Get service url when handling auth rather than mutating the relay, allow user to override service url via env var

This commit is contained in:
Jon Staab
2024-12-30 16:20:15 -08:00
committed by fiatjaf_
parent 4dba9376a0
commit 5b9b89543f
3 changed files with 6 additions and 8 deletions

View File

@@ -80,7 +80,7 @@ func (rl *Relay) HandleNIP86(w http.ResponseWriter, r *http.Request) {
goto respond
}
if uTag := evt.Tags.GetFirst([]string{"u", ""}); uTag == nil || rl.ServiceURL != (*uTag)[1] {
if uTag := evt.Tags.GetFirst([]string{"u", ""}); uTag == nil || getServiceBaseURL(r) != (*uTag)[1] {
resp.Error = "invalid 'u' tag"
goto respond
} else if pht := evt.Tags.GetFirst([]string{"payload", hex.EncodeToString(payloadHash[:])}); pht == nil {