update dependencies and minor tweaks.

This commit is contained in:
fiatjaf 2023-11-13 16:35:47 -03:00
parent e0e9b09608
commit c5b628ebf6
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
4 changed files with 10 additions and 8 deletions

4
go.mod
View File

@ -5,8 +5,8 @@ go 1.21.0
toolchain go1.21.3
require (
github.com/fiatjaf/eventstore v0.2.5
github.com/fiatjaf/khatru v0.0.8
github.com/fiatjaf/eventstore v0.2.9
github.com/fiatjaf/khatru v0.0.11
github.com/kelseyhightower/envconfig v1.4.0
github.com/nbd-wtf/go-nostr v0.25.3
github.com/nbd-wtf/nostr-sdk v0.0.2

8
go.sum
View File

@ -60,12 +60,12 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fasthttp/websocket v1.5.3 h1:TPpQuLwJYfd4LJPXvHDYPMFWbLjsT91n3GpWtCQtdek=
github.com/fasthttp/websocket v1.5.3/go.mod h1:46gg/UBmTU1kUaTcwQXpUxtRwG2PvIZYeA8oL6vF3Fs=
github.com/fiatjaf/eventstore v0.2.5 h1:vzXxfDoQ7taNGx8jgCHutAtzkz+36ZcMhKpbW7wtHfM=
github.com/fiatjaf/eventstore v0.2.5/go.mod h1:Zx1XqwICh7RxxKLkgc0aXlVo298ABs4W5awP/1/bYYs=
github.com/fiatjaf/eventstore v0.2.9 h1:59abPM1W9e2B3Nttl2xZA4WrN0RC0zJQBl8wuXc8wX0=
github.com/fiatjaf/eventstore v0.2.9/go.mod h1:Zx1XqwICh7RxxKLkgc0aXlVo298ABs4W5awP/1/bYYs=
github.com/fiatjaf/generic-ristretto v0.0.1 h1:LUJSU87X/QWFsBXTwnH3moFe4N8AjUxT+Rfa0+bo6YM=
github.com/fiatjaf/generic-ristretto v0.0.1/go.mod h1:cvV6ANHDA/GrfzVrig7N7i6l8CWnkVZvtQ2/wk9DPVE=
github.com/fiatjaf/khatru v0.0.8 h1:YhntzSHm8BB1cnkMiWrVgXVZm9ou9+ajsm2W9inOEeM=
github.com/fiatjaf/khatru v0.0.8/go.mod h1:gvfXhDel30t84mkWk5aDwBRD1N8py4RixIwGD0i+LMY=
github.com/fiatjaf/khatru v0.0.11 h1:YFU/QAyZ6KHb+0orHxT3ur9UY3WcM9aV9brmU2bIVXg=
github.com/fiatjaf/khatru v0.0.11/go.mod h1:gvfXhDel30t84mkWk5aDwBRD1N8py4RixIwGD0i+LMY=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU=

View File

@ -59,6 +59,8 @@ func main() {
relay.QueryEvents = append(relay.QueryEvents, db.QueryEvents)
relay.DeleteEvent = append(relay.DeleteEvent, db.DeleteEvent)
relay.RejectEvent = append(relay.RejectEvent,
plugins.PreventLargeTags(60),
plugins.PreventTooManyIndexableTags(6),
plugins.RestrictToSpecifiedKinds(supportedKinds...),
rejectEventsFromUsersNotInWhitelist,
validateAndFilterReports,

View File

@ -64,7 +64,7 @@ func validateAndFilterReports(ctx context.Context, event *nostr.Event) (reject b
func removeAuthorsNotWhitelisted(ctx context.Context, filter *nostr.Filter) {
if n := len(filter.Authors); n > len(whitelist)*11/10 {
// this query was clearly badly constructed, so we will not bother even looking
filter.Limit = 0 // this causes the query to be short cut
filter.Limit = -1 // this causes the query to be short cut
} else if n > 0 {
// otherwise we go through the authors list and remove the irrelevant ones
newAuthors := make([]string, 0, n)
@ -77,7 +77,7 @@ func removeAuthorsNotWhitelisted(ctx context.Context, filter *nostr.Filter) {
filter.Authors = newAuthors
if len(newAuthors) == 0 {
filter.Limit = 0 // this causes the query to be short cut
filter.Limit = -1 // this causes the query to be short cut
}
}
}