diff --git a/go.mod b/go.mod index d194010..bca0305 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.21.3 require ( github.com/fiatjaf/eventstore v0.2.9 - github.com/fiatjaf/khatru v0.0.12 + github.com/fiatjaf/khatru v0.1.0 github.com/kelseyhightower/envconfig v1.4.0 github.com/nbd-wtf/go-nostr v0.25.7 github.com/nbd-wtf/nostr-sdk v0.0.2 diff --git a/main.go b/main.go index 942e48c..65502bd 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( "github.com/fiatjaf/eventstore/badger" "github.com/fiatjaf/khatru" - "github.com/fiatjaf/khatru/plugins" + "github.com/fiatjaf/khatru/policies" "github.com/kelseyhightower/envconfig" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip11" @@ -63,19 +63,21 @@ func main() { relay.QueryEvents = append(relay.QueryEvents, db.QueryEvents) relay.DeleteEvent = append(relay.DeleteEvent, db.DeleteEvent) relay.RejectEvent = append(relay.RejectEvent, - plugins.PreventLargeTags(64), - plugins.PreventTooManyIndexableTags(8, []int{3, 10002}, nil), - plugins.PreventTooManyIndexableTags(1000, nil, []int{3, 10002}), - plugins.RestrictToSpecifiedKinds(supportedKinds...), + policies.PreventLargeTags(100), + policies.PreventTooManyIndexableTags(8, []int{3, 10002}, nil), + policies.PreventTooManyIndexableTags(1000, nil, []int{3, 10002}), + policies.RestrictToSpecifiedKinds(supportedKinds...), rejectEventsFromUsersNotInWhitelist, validateAndFilterReports, ) relay.OverwriteFilter = append(relay.OverwriteFilter, - plugins.RemoveAllButKinds(supportedKinds...), + policies.RemoveAllButKinds(supportedKinds...), removeAuthorsNotWhitelisted, ) relay.RejectFilter = append(relay.RejectFilter, - plugins.NoSearchQueries, + policies.NoSearchQueries, + policies.NoEmptyFilters, + policies.AntiSyncBots, ) // load users registry diff --git a/relay.go b/relay.go index 584fcd8..7fb8603 100644 --- a/relay.go +++ b/relay.go @@ -31,8 +31,22 @@ var supportedKinds = []uint16{ 10000, 10001, 10002, + 10003, + 10004, + 10005, + 10006, + 10007, + 10015, + 10030, + 30000, + 30002, + 30003, + 30004, 30008, 30009, + 30015, + 30030, + 30078, 30311, 31922, 31923,