remove getAllowedKinds function and related logic for handling allowed kinds

This commit is contained in:
mr0x50 2025-02-07 22:54:11 +01:00
parent f2b1bd0a46
commit d9c82c6eee

22
main.go
View File

@ -4,8 +4,6 @@ import (
"fmt"
"net/http"
"os"
"strconv"
"strings"
"time"
"github.com/fiatjaf/eventstore/postgresql"
@ -20,23 +18,6 @@ func getEnv(key, fallback string) string {
return fallback
}
func getAllowedKinds() []uint16 {
allowedKindsStr := getEnv("ALLOWED_KINDS", "")
if allowedKindsStr == "" {
return nil // Allow all kinds
}
kindStrs := strings.Split(allowedKindsStr, ",")
kinds := make([]uint16, 0, len(kindStrs))
for _, k := range kindStrs {
if kind, err := strconv.ParseUint(strings.TrimSpace(k), 10, 16); err == nil {
kinds = append(kinds, uint16(kind))
}
}
return kinds
}
func main() {
// Print ASCII art banner
fmt.Print(`
@ -66,8 +47,6 @@ func main() {
panic(err)
}
allowedKinds := getAllowedKinds()
relay.StoreEvent = append(relay.StoreEvent, db.SaveEvent)
relay.QueryEvents = append(relay.QueryEvents, db.QueryEvents)
relay.DeleteEvent = append(relay.DeleteEvent, db.DeleteEvent)
@ -78,7 +57,6 @@ func main() {
policies.PreventLargeTags(120),
policies.PreventTimestampsInThePast(time.Hour*2),
policies.PreventTimestampsInTheFuture(time.Minute*30),
policies.RestrictToSpecifiedKinds(true, allowedKinds...),
)
fmt.Println("running on :3334")