allow extra tag elements on event creation, separated by ";"

This commit is contained in:
fiatjaf 2023-06-26 20:52:12 -03:00
parent 30c8eb83b2
commit 2b2018b742
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1

View File

@ -82,11 +82,17 @@ standalone:
Tags: make(nostr.Tags, 0, 3),
}
tags := make([][]string, 0, 5)
tags := make(nostr.Tags, 0, 5)
for _, tagFlag := range c.StringSlice("tag") {
// tags are in the format key=value
spl := strings.Split(tagFlag, "=")
if len(spl) == 2 && len(spl[0]) > 0 {
tags = append(tags, spl)
tag := nostr.Tag{spl[0]}
// tags may also contain extra elements separated with a ";"
spl2 := strings.Split(spl[1], ";")
tag = append(tag, spl2...)
// ~
tags = append(tags, tag)
}
}
for _, etag := range c.StringSlice("e") {