Enable additional NIP support, improve tag handling validation, and simplify WebSocket message processing.

This commit is contained in:
2025-09-30 18:07:42 +01:00
parent e58eb1d3e3
commit 45b4f82995
3 changed files with 15 additions and 6 deletions

View File

@@ -147,6 +147,9 @@ func (s *S) Unmarshal(b []byte) (r []byte, err error) {
// GetFirst returns the first tag.T that has the same Key as t.
func (s *S) GetFirst(t []byte) (first *T) {
if s == nil || len(*s) < 1 {
return
}
for _, tt := range *s {
if tt.Len() == 0 {
continue
@@ -159,7 +162,13 @@ func (s *S) GetFirst(t []byte) (first *T) {
}
func (s *S) GetAll(t []byte) (all []*T) {
if s == nil || len(*s) < 1 {
return
}
for _, tt := range *s {
if len(tt.T) < 1 {
continue
}
if utils.FastEqual(tt.T[0], t) {
all = append(all, tt)
}