Enable additional NIP support, improve tag handling validation, and simplify WebSocket message processing.
This commit is contained in:
@@ -35,7 +35,7 @@ func (s *Server) HandleRelayInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
supportedNIPs := relayinfo.GetList(
|
supportedNIPs := relayinfo.GetList(
|
||||||
relayinfo.BasicProtocol,
|
relayinfo.BasicProtocol,
|
||||||
relayinfo.Authentication,
|
relayinfo.Authentication,
|
||||||
// relayinfo.EncryptedDirectMessage,
|
relayinfo.EncryptedDirectMessage,
|
||||||
relayinfo.EventDeletion,
|
relayinfo.EventDeletion,
|
||||||
relayinfo.RelayInformationDocument,
|
relayinfo.RelayInformationDocument,
|
||||||
relayinfo.GenericTagQueries,
|
relayinfo.GenericTagQueries,
|
||||||
@@ -43,7 +43,7 @@ func (s *Server) HandleRelayInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
relayinfo.EventTreatment,
|
relayinfo.EventTreatment,
|
||||||
// relayinfo.CommandResults,
|
// relayinfo.CommandResults,
|
||||||
relayinfo.ParameterizedReplaceableEvents,
|
relayinfo.ParameterizedReplaceableEvents,
|
||||||
// relayinfo.ExpirationTimestamp,
|
relayinfo.ExpirationTimestamp,
|
||||||
relayinfo.ProtectedEvents,
|
relayinfo.ProtectedEvents,
|
||||||
relayinfo.RelayListMetadata,
|
relayinfo.RelayListMetadata,
|
||||||
)
|
)
|
||||||
@@ -51,7 +51,7 @@ func (s *Server) HandleRelayInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
supportedNIPs = relayinfo.GetList(
|
supportedNIPs = relayinfo.GetList(
|
||||||
relayinfo.BasicProtocol,
|
relayinfo.BasicProtocol,
|
||||||
relayinfo.Authentication,
|
relayinfo.Authentication,
|
||||||
// relayinfo.EncryptedDirectMessage,
|
relayinfo.EncryptedDirectMessage,
|
||||||
relayinfo.EventDeletion,
|
relayinfo.EventDeletion,
|
||||||
relayinfo.RelayInformationDocument,
|
relayinfo.RelayInformationDocument,
|
||||||
relayinfo.GenericTagQueries,
|
relayinfo.GenericTagQueries,
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ whitelist:
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// log.T.F("received message from %s: %s", remote, string(msg))
|
// log.T.F("received message from %s: %s", remote, string(msg))
|
||||||
go listener.HandleMessage(msg, remote)
|
listener.HandleMessage(msg, remote)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
// GetFirst returns the first tag.T that has the same Key as t.
|
||||||
func (s *S) GetFirst(t []byte) (first *T) {
|
func (s *S) GetFirst(t []byte) (first *T) {
|
||||||
|
if s == nil || len(*s) < 1 {
|
||||||
|
return
|
||||||
|
}
|
||||||
for _, tt := range *s {
|
for _, tt := range *s {
|
||||||
if tt.Len() == 0 {
|
if tt.Len() == 0 {
|
||||||
continue
|
continue
|
||||||
@@ -159,7 +162,13 @@ func (s *S) GetFirst(t []byte) (first *T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *S) GetAll(t []byte) (all []*T) {
|
func (s *S) GetAll(t []byte) (all []*T) {
|
||||||
|
if s == nil || len(*s) < 1 {
|
||||||
|
return
|
||||||
|
}
|
||||||
for _, tt := range *s {
|
for _, tt := range *s {
|
||||||
|
if len(tt.T) < 1 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if utils.FastEqual(tt.T[0], t) {
|
if utils.FastEqual(tt.T[0], t) {
|
||||||
all = append(all, tt)
|
all = append(all, tt)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user