mirror of
https://github.com/fiatjaf/nak.git
synced 2026-07-30 19:36:15 +00:00
admin: new nip86 "role" commands.
This commit is contained in:
@@ -47,6 +47,17 @@ var admin = &cli.Command{
|
||||
{"blockip", []string{"ip", "reason"}},
|
||||
{"unblockip", []string{"ip", "reason"}},
|
||||
{"listblockedips", nil},
|
||||
{"listallowedevents", nil},
|
||||
{"listdisallowedkinds", nil},
|
||||
{"supportedmethods", nil},
|
||||
{"stats", nil},
|
||||
{"grantadmin", []string{"pubkey", "methods"}},
|
||||
{"revokeadmin", []string{"pubkey", "methods"}},
|
||||
{"createrole", []string{"role_id", "label", "description", "color", "order"}},
|
||||
{"editrole", []string{"role_id", "label", "description", "color", "order"}},
|
||||
{"deleterole", []string{"role_id"}},
|
||||
{"assignrole", []string{"pubkey", "role_id"}},
|
||||
{"unassignrole", []string{"pubkey", "role_id"}},
|
||||
}
|
||||
|
||||
commands := make([]*cli.Command, 0, len(methods))
|
||||
@@ -166,10 +177,16 @@ var admin = &cli.Command{
|
||||
func declareFlag(argName string) cli.Flag {
|
||||
usage := "parameter for this management RPC call, see https://nips.nostr.com/86 for more information."
|
||||
switch argName {
|
||||
case "kind":
|
||||
case "pubkey":
|
||||
return &PubKeyFlag{Name: argName, Usage: usage}
|
||||
case "id":
|
||||
return &IDFlag{Name: argName, Usage: usage}
|
||||
case "kind", "order":
|
||||
return &cli.IntFlag{Name: argName, Required: true, Usage: usage}
|
||||
case "reason":
|
||||
return &cli.StringFlag{Name: argName, Usage: usage}
|
||||
case "methods":
|
||||
return &cli.StringSliceFlag{Name: argName, Required: true, Usage: usage}
|
||||
default:
|
||||
return &cli.StringFlag{Name: argName, Required: true, Usage: usage}
|
||||
}
|
||||
@@ -177,8 +194,14 @@ func declareFlag(argName string) cli.Flag {
|
||||
|
||||
func getArgument(c *cli.Command, argName string) any {
|
||||
switch argName {
|
||||
case "kind":
|
||||
case "pubkey":
|
||||
return getPubKey(c, argName)
|
||||
case "id":
|
||||
return getID(c, argName)
|
||||
case "kind", "order":
|
||||
return c.Int(argName)
|
||||
case "methods":
|
||||
return c.StringSlice(argName)
|
||||
default:
|
||||
return c.String(argName)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ module github.com/fiatjaf/nak
|
||||
go 1.25
|
||||
|
||||
require (
|
||||
fiatjaf.com/nostr v0.0.0-20260620232658-8389bac80c5f
|
||||
fiatjaf.com/nostr v0.0.0-20260625201206-404203b6ac1d
|
||||
github.com/AlecAivazis/survey/v2 v2.3.7
|
||||
github.com/bep/debounce v1.2.1
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.6
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
fiatjaf.com/lib v0.3.7 h1:mXZOn7NrUcjSdy4oNvwQyAmes7Ueb+Zr5hjqMIe2dxI=
|
||||
fiatjaf.com/lib v0.3.7/go.mod h1:UlHaZvPHj25PtKLh9GjZkUHRmQ2xZ8Jkoa4VRaLeeQ8=
|
||||
fiatjaf.com/nostr v0.0.0-20260620232658-8389bac80c5f h1:dl17ebu+HhtHTS9AdOc27TDUGfSjYVEO4qYLHEwjxOw=
|
||||
fiatjaf.com/nostr v0.0.0-20260620232658-8389bac80c5f/go.mod h1:b1EIUDnd133Ie8Pg8O/biaKdFyCMz28aD4n64g1GqvM=
|
||||
fiatjaf.com/nostr v0.0.0-20260625201206-404203b6ac1d h1:0Y+62o+HxN+SEF7btTHx9pkAU2A/tfgR4AFR1Emtl40=
|
||||
fiatjaf.com/nostr v0.0.0-20260625201206-404203b6ac1d/go.mod h1:b1EIUDnd133Ie8Pg8O/biaKdFyCMz28aD4n64g1GqvM=
|
||||
github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ=
|
||||
github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo=
|
||||
github.com/FastFilter/xorfilter v0.2.1 h1:lbdeLG9BdpquK64ZsleBS8B4xO/QW1IM0gMzF7KaBKc=
|
||||
|
||||
Reference in New Issue
Block a user