mirror of
https://github.com/fiatjaf/nak.git
synced 2024-11-22 08:19:06 -05:00
allow extra tag elements on event creation, separated by ";"
This commit is contained in:
parent
30c8eb83b2
commit
2b2018b742
10
event.go
10
event.go
|
@ -82,11 +82,17 @@ standalone:
|
||||||
Tags: make(nostr.Tags, 0, 3),
|
Tags: make(nostr.Tags, 0, 3),
|
||||||
}
|
}
|
||||||
|
|
||||||
tags := make([][]string, 0, 5)
|
tags := make(nostr.Tags, 0, 5)
|
||||||
for _, tagFlag := range c.StringSlice("tag") {
|
for _, tagFlag := range c.StringSlice("tag") {
|
||||||
|
// tags are in the format key=value
|
||||||
spl := strings.Split(tagFlag, "=")
|
spl := strings.Split(tagFlag, "=")
|
||||||
if len(spl) == 2 && len(spl[0]) > 0 {
|
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") {
|
for _, etag := range c.StringSlice("e") {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user