NIP-50 search filter on req.

This commit is contained in:
fiatjaf 2023-10-08 15:49:11 -03:00
parent 8d111e556e
commit 455ec79e58
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1

9
req.go
View File

@ -73,6 +73,11 @@ standalone:
Usage: "only accept up to this number of events",
Category: CATEGORY_FILTER_ATTRIBUTES,
},
&cli.StringFlag{
Name: "search",
Usage: "a NIP-50 search query, use it only with relays that explicitly support it",
Category: CATEGORY_FILTER_ATTRIBUTES,
},
&cli.BoolFlag{
Name: "bare",
Usage: "when printing the filter, print just the filter, not enveloped in a [\"REQ\", ...] array",
@ -96,7 +101,9 @@ standalone:
if kinds := c.IntSlice("kind"); len(kinds) > 0 {
filter.Kinds = kinds
}
if search := c.String("search"); search != "" {
filter.Search = search
}
tags := make([][]string, 0, 5)
for _, tagFlag := range c.StringSlice("tag") {
spl := strings.Split(tagFlag, "=")