mirror of
https://github.com/fiatjaf/nak.git
synced 2024-10-30 00:59:07 -04:00
add all other relay management rpc methods.
This commit is contained in:
parent
5ee0036128
commit
79cb63a1b4
25
relay.go
25
relay.go
|
@ -47,7 +47,28 @@ var relay = &cli.Command{
|
||||||
for _, def := range []struct {
|
for _, def := range []struct {
|
||||||
method string
|
method string
|
||||||
args []string
|
args []string
|
||||||
}{{"allowpubkey", []string{"pubkey", "reason"}}} {
|
}{
|
||||||
|
{"allowpubkey", []string{"pubkey", "reason"}},
|
||||||
|
{"banpubkey", []string{"pubkey", "reason"}},
|
||||||
|
{"listallowedpubkeys", nil},
|
||||||
|
{"allowpubkey", []string{"pubkey", "reason"}},
|
||||||
|
{"listallowedpubkeys", nil},
|
||||||
|
{"listeventsneedingmoderation", nil},
|
||||||
|
{"allowevent", []string{"id", "reason"}},
|
||||||
|
{"banevent", []string{"id", "reason"}},
|
||||||
|
{"listbannedevents", nil},
|
||||||
|
{"changerelayname", []string{"name"}},
|
||||||
|
{"changerelaydescription", []string{"description"}},
|
||||||
|
{"changerelayicon", []string{"icon"}},
|
||||||
|
{"allowkind", []string{"kind"}},
|
||||||
|
{"disallowkind", []string{"kind"}},
|
||||||
|
{"listallowedkinds", nil},
|
||||||
|
{"blockip", []string{"ip", "reason"}},
|
||||||
|
{"unblockip", []string{"ip", "reason"}},
|
||||||
|
{"listblockedips", nil},
|
||||||
|
} {
|
||||||
|
def := def
|
||||||
|
|
||||||
flags := make([]cli.Flag, len(def.args), len(def.args)+4)
|
flags := make([]cli.Flag, len(def.args), len(def.args)+4)
|
||||||
for i, argName := range def.args {
|
for i, argName := range def.args {
|
||||||
flags[i] = declareFlag(argName)
|
flags[i] = declareFlag(argName)
|
||||||
|
@ -101,7 +122,7 @@ var relay = &cli.Command{
|
||||||
|
|
||||||
for _, relayUrl := range relayUrls {
|
for _, relayUrl := range relayUrls {
|
||||||
httpUrl := "http" + nostr.NormalizeURL(relayUrl)[2:]
|
httpUrl := "http" + nostr.NormalizeURL(relayUrl)[2:]
|
||||||
log("calling %s... ", httpUrl)
|
log("calling '%s' on %s... ", def.method, httpUrl)
|
||||||
body := bytes.NewBuffer(nil)
|
body := bytes.NewBuffer(nil)
|
||||||
body.Write(reqj)
|
body.Write(reqj)
|
||||||
req, err := http.NewRequestWithContext(ctx, "POST", httpUrl, body)
|
req, err := http.NewRequestWithContext(ctx, "POST", httpUrl, body)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user