2024-09-17 01:01:42 +00:00
|
|
|
package khatru
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (rl *Relay) HandleNIP11(w http.ResponseWriter, r *http.Request) {
|
|
|
|
w.Header().Set("Content-Type", "application/nostr+json")
|
|
|
|
|
|
|
|
info := *rl.Info
|
|
|
|
|
|
|
|
if len(rl.DeleteEvent) > 0 {
|
2024-10-29 00:11:29 +00:00
|
|
|
info.AddSupportedNIP(9)
|
2024-09-17 01:01:42 +00:00
|
|
|
}
|
|
|
|
if len(rl.CountEvents) > 0 {
|
2024-10-29 00:11:29 +00:00
|
|
|
info.AddSupportedNIP(45)
|
|
|
|
}
|
|
|
|
if rl.Negentropy {
|
|
|
|
info.AddSupportedNIP(77)
|
2024-09-17 01:01:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for _, ovw := range rl.OverwriteRelayInformation {
|
|
|
|
info = ovw(r.Context(), r, info)
|
|
|
|
}
|
|
|
|
|
|
|
|
json.NewEncoder(w).Encode(info)
|
|
|
|
}
|