khatru: prevent large indexable tags doesn't make any sense anymore as we don't index tags verbatim, only hashes.
This commit is contained in:
@@ -52,20 +52,6 @@ func PreventTooManyIndexableTags(max int, ignoreKinds []nostr.Kind, onlyKinds []
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PreventLargeTags rejects events that have indexable tag values greater than maxTagValueLen.
|
|
||||||
func PreventLargeTags(maxTagValueLen int) func(context.Context, nostr.Event) (bool, string) {
|
|
||||||
return func(ctx context.Context, event nostr.Event) (reject bool, msg string) {
|
|
||||||
for _, tag := range event.Tags {
|
|
||||||
if len(tag) > 1 && len(tag[0]) == 1 {
|
|
||||||
if len(tag[1]) > maxTagValueLen {
|
|
||||||
return true, "event contains too large tags"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false, ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// PreventLargeContent rejects events with content too large
|
// PreventLargeContent rejects events with content too large
|
||||||
func PreventLargeContent(maxContent int) func(context.Context, nostr.Event) (bool, string) {
|
func PreventLargeContent(maxContent int) func(context.Context, nostr.Event) (bool, string) {
|
||||||
return func(ctx context.Context, event nostr.Event) (reject bool, msg string) {
|
return func(ctx context.Context, event nostr.Event) (reject bool, msg string) {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
|
|
||||||
var EventRejectionStrictDefaults = SeqEvent(
|
var EventRejectionStrictDefaults = SeqEvent(
|
||||||
RejectEventsWithBase64Media,
|
RejectEventsWithBase64Media,
|
||||||
PreventLargeTags(100),
|
|
||||||
PreventTooManyIndexableTags(12, []nostr.Kind{3}, nil),
|
PreventTooManyIndexableTags(12, []nostr.Kind{3}, nil),
|
||||||
PreventTooManyIndexableTags(1200, nil, []nostr.Kind{3}),
|
PreventTooManyIndexableTags(1200, nil, []nostr.Kind{3}),
|
||||||
PreventLargeContent(5000),
|
PreventLargeContent(5000),
|
||||||
|
|||||||
Reference in New Issue
Block a user