mirror of
https://github.com/fiatjaf/nak.git
synced 2024-11-22 08:19:06 -05:00
disallow negative kinds and limits.
This commit is contained in:
parent
8f51fe757b
commit
a5013c513d
4
event.go
4
event.go
|
@ -89,7 +89,7 @@ example:
|
||||||
Name: "nevent",
|
Name: "nevent",
|
||||||
Usage: "print the nevent code (to stderr) after the event is published",
|
Usage: "print the nevent code (to stderr) after the event is published",
|
||||||
},
|
},
|
||||||
&cli.IntFlag{
|
&cli.UintFlag{
|
||||||
Name: "kind",
|
Name: "kind",
|
||||||
Aliases: []string{"k"},
|
Aliases: []string{"k"},
|
||||||
Usage: "event kind",
|
Usage: "event kind",
|
||||||
|
@ -177,7 +177,7 @@ example:
|
||||||
kindWasSupplied = strings.Contains(stdinEvent, `"kind"`)
|
kindWasSupplied = strings.Contains(stdinEvent, `"kind"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if kind := c.Int("kind"); slices.Contains(c.FlagNames(), "kind") {
|
if kind := c.Uint("kind"); slices.Contains(c.FlagNames(), "kind") {
|
||||||
evt.Kind = int(kind)
|
evt.Kind = int(kind)
|
||||||
mustRehashAndResign = true
|
mustRehashAndResign = true
|
||||||
} else if !kindWasSupplied {
|
} else if !kindWasSupplied {
|
||||||
|
|
4
req.go
4
req.go
|
@ -80,7 +80,7 @@ example:
|
||||||
Usage: "only accept events older than this (unix timestamp)",
|
Usage: "only accept events older than this (unix timestamp)",
|
||||||
Category: CATEGORY_FILTER_ATTRIBUTES,
|
Category: CATEGORY_FILTER_ATTRIBUTES,
|
||||||
},
|
},
|
||||||
&cli.IntFlag{
|
&cli.UintFlag{
|
||||||
Name: "limit",
|
Name: "limit",
|
||||||
Aliases: []string{"l"},
|
Aliases: []string{"l"},
|
||||||
Usage: "only accept up to this number of events",
|
Usage: "only accept up to this number of events",
|
||||||
|
@ -251,7 +251,7 @@ example:
|
||||||
return fmt.Errorf("parse error: Invalid numeric literal %q", until)
|
return fmt.Errorf("parse error: Invalid numeric literal %q", until)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if limit := c.Int("limit"); limit != 0 {
|
if limit := c.Uint("limit"); limit != 0 {
|
||||||
filter.Limit = int(limit)
|
filter.Limit = int(limit)
|
||||||
} else if c.IsSet("limit") || c.Bool("stream") {
|
} else if c.IsSet("limit") || c.Bool("stream") {
|
||||||
filter.LimitZero = true
|
filter.LimitZero = true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user