mirror of
https://github.com/fiatjaf/nak.git
synced 2026-06-05 10:11:14 +02:00
convert tags to appropriate hex pubkeys, ids etc, even from nip05, but check the tag name first for better (hardcoded) context.
This commit is contained in:
12
req.go
12
req.go
@@ -468,19 +468,23 @@ func applyFlagsToFilter(c *cli.Command, filter *nostr.Filter) error {
|
||||
for _, tagFlag := range c.StringSlice("tag") {
|
||||
spl := strings.SplitN(tagFlag, "=", 2)
|
||||
if len(spl) == 2 {
|
||||
tags = append(tags, []string{spl[0], decodeTagValue(spl[1])})
|
||||
val := spl[1]
|
||||
if len(spl) == 1 {
|
||||
val = decodeTagValue(val, []rune(spl[0])[0])
|
||||
}
|
||||
tags = append(tags, []string{spl[0], val})
|
||||
} else {
|
||||
return fmt.Errorf("invalid --tag '%s'", tagFlag)
|
||||
}
|
||||
}
|
||||
for _, etag := range c.StringSlice("e") {
|
||||
tags = append(tags, []string{"e", decodeTagValue(etag)})
|
||||
tags = append(tags, []string{"e", decodeTagValue(etag, 'e')})
|
||||
}
|
||||
for _, ptag := range c.StringSlice("p") {
|
||||
tags = append(tags, []string{"p", decodeTagValue(ptag)})
|
||||
tags = append(tags, []string{"p", decodeTagValue(ptag, 'p')})
|
||||
}
|
||||
for _, dtag := range c.StringSlice("d") {
|
||||
tags = append(tags, []string{"d", decodeTagValue(dtag)})
|
||||
tags = append(tags, []string{"d", dtag})
|
||||
}
|
||||
|
||||
if len(tags) > 0 && filter.Tags == nil {
|
||||
|
||||
Reference in New Issue
Block a user