package main import ( "encoding/json" "net/http" ) func handleWebpage(w http.ResponseWriter, rq *http.Request) { w.Header().Set("Content-Type", "text/html") w.Write([]byte(` expensive relay

expensive relay

https://github.com/fiatjaf/expensive-relay

this is a nostr relay that only accepts events published from keys that pay a registration fee. this is an antispam measure. you can still be banned if you're spamming or doing something bad.

to register your nostr public key, type it below and click the button.

`)) } func handleInvoice(w http.ResponseWriter, rq *http.Request, r *Relay) { w.Header().Set("Content-Type", "application/json") invoice, err := generateInvoice(r, rq.URL.Query().Get("pubkey")) if err != nil { json.NewEncoder(w).Encode(struct { Error string `json:"error"` }{err.Error()}) } else { json.NewEncoder(w).Encode(struct { Invoice string `json:"bolt11"` }{invoice}) } }