From 231fdc6aa9eea1efc65219eef1c5a18b3a54e574 Mon Sep 17 00:00:00 2001 From: 0ceanSlim Date: Wed, 24 Jul 2024 16:54:11 -0400 Subject: [PATCH] handle kind 4-45 and kind2 --- relay/handlers/event.go | 6 ++++++ relay/kinds/kind2.go | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 relay/kinds/kind2.go diff --git a/relay/handlers/event.go b/relay/handlers/event.go index 77d7eb3..ebcd67e 100644 --- a/relay/handlers/event.go +++ b/relay/handlers/event.go @@ -57,8 +57,14 @@ func HandleKind(ctx context.Context, evt relay.Event, ws *websocket.Conn) { err = kinds.HandleKind0(ctx, evt, collection, ws) case evt.Kind == 1: err = kinds.HandleKind1(ctx, evt, collection) + case evt.Kind == 2: + err = kinds.HandleKind2Deprecated(ctx, evt, ws) case evt.Kind == 3: err = kinds.HandleReplaceableKind(ctx, evt, collection, ws) + case evt.Kind >= 4 && evt.Kind < 45: + err = kinds.HandleRegularKind(ctx, evt, collection) + case evt.Kind >= 1000 && evt.Kind < 10000: + err = kinds.HandleRegularKind(ctx, evt, collection) case evt.Kind >= 10000 && evt.Kind < 20000: err = kinds.HandleReplaceableKind(ctx, evt, collection, ws) case evt.Kind >= 20000 && evt.Kind < 30000: diff --git a/relay/kinds/kind2.go b/relay/kinds/kind2.go new file mode 100644 index 0000000..f7acc45 --- /dev/null +++ b/relay/kinds/kind2.go @@ -0,0 +1,12 @@ +package kinds + +import ( + "context" + relay "grain/relay/types" + + "golang.org/x/net/websocket" +) +func HandleKind2Deprecated(ctx context.Context, evt relay.Event, ws *websocket.Conn) error { + sendNotice(ws, evt.PubKey, "kind 2 is deprecated, event not accepted to the relay, please use kind 10002 as defined in NIP-65") + return nil +} \ No newline at end of file