nip86: fix kind type.
This commit is contained in:
@@ -31,10 +31,10 @@ type RelayManagementAPI struct {
|
|||||||
ChangeRelayName func(ctx context.Context, name string) error
|
ChangeRelayName func(ctx context.Context, name string) error
|
||||||
ChangeRelayDescription func(ctx context.Context, desc string) error
|
ChangeRelayDescription func(ctx context.Context, desc string) error
|
||||||
ChangeRelayIcon func(ctx context.Context, icon string) error
|
ChangeRelayIcon func(ctx context.Context, icon string) error
|
||||||
AllowKind func(ctx context.Context, kind int) error
|
AllowKind func(ctx context.Context, kind nostr.Kind) error
|
||||||
DisallowKind func(ctx context.Context, kind int) error
|
DisallowKind func(ctx context.Context, kind nostr.Kind) error
|
||||||
ListAllowedKinds func(ctx context.Context) ([]int, error)
|
ListAllowedKinds func(ctx context.Context) ([]nostr.Kind, error)
|
||||||
ListDisallowedKinds func(ctx context.Context) ([]int, error)
|
ListDisallowedKinds func(ctx context.Context) ([]nostr.Kind, error)
|
||||||
BlockIP func(ctx context.Context, ip net.IP, reason string) error
|
BlockIP func(ctx context.Context, ip net.IP, reason string) error
|
||||||
UnblockIP func(ctx context.Context, ip net.IP, reason string) error
|
UnblockIP func(ctx context.Context, ip net.IP, reason string) error
|
||||||
ListBlockedIPs func(ctx context.Context) ([]nip86.IPReason, error)
|
ListBlockedIPs func(ctx context.Context) ([]nip86.IPReason, error)
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ func DecodeRequest(req Request) (MethodParams, error) {
|
|||||||
if !ok || math.Trunc(kind) != kind {
|
if !ok || math.Trunc(kind) != kind {
|
||||||
return nil, fmt.Errorf("invalid kind '%v' for '%s'", req.Params[0], req.Method)
|
return nil, fmt.Errorf("invalid kind '%v' for '%s'", req.Params[0], req.Method)
|
||||||
}
|
}
|
||||||
return AllowKind{int(kind)}, nil
|
return AllowKind{nostr.Kind(kind)}, nil
|
||||||
case "disallowkind":
|
case "disallowkind":
|
||||||
if len(req.Params) == 0 {
|
if len(req.Params) == 0 {
|
||||||
return nil, fmt.Errorf("invalid number of params for '%s'", req.Method)
|
return nil, fmt.Errorf("invalid number of params for '%s'", req.Method)
|
||||||
@@ -131,7 +131,7 @@ func DecodeRequest(req Request) (MethodParams, error) {
|
|||||||
if !ok || math.Trunc(kind) != kind {
|
if !ok || math.Trunc(kind) != kind {
|
||||||
return nil, fmt.Errorf("invalid kind '%v' for '%s'", req.Params[0], req.Method)
|
return nil, fmt.Errorf("invalid kind '%v' for '%s'", req.Params[0], req.Method)
|
||||||
}
|
}
|
||||||
return DisallowKind{int(kind)}, nil
|
return DisallowKind{nostr.Kind(kind)}, nil
|
||||||
case "listallowedkinds":
|
case "listallowedkinds":
|
||||||
return ListAllowedKinds{}, nil
|
return ListAllowedKinds{}, nil
|
||||||
case "blockip":
|
case "blockip":
|
||||||
@@ -308,13 +308,13 @@ type ChangeRelayIcon struct {
|
|||||||
func (ChangeRelayIcon) MethodName() string { return "changerelayicon" }
|
func (ChangeRelayIcon) MethodName() string { return "changerelayicon" }
|
||||||
|
|
||||||
type AllowKind struct {
|
type AllowKind struct {
|
||||||
Kind int
|
Kind nostr.Kind
|
||||||
}
|
}
|
||||||
|
|
||||||
func (AllowKind) MethodName() string { return "allowkind" }
|
func (AllowKind) MethodName() string { return "allowkind" }
|
||||||
|
|
||||||
type DisallowKind struct {
|
type DisallowKind struct {
|
||||||
Kind int
|
Kind nostr.Kind
|
||||||
}
|
}
|
||||||
|
|
||||||
func (DisallowKind) MethodName() string { return "disallowkind" }
|
func (DisallowKind) MethodName() string { return "disallowkind" }
|
||||||
|
|||||||
Reference in New Issue
Block a user