|
|
|
|
@ -14,12 +14,19 @@ import (
@@ -14,12 +14,19 @@ import (
|
|
|
|
|
"sync" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
"git.mleku.dev/mleku/nostr/encoders/event" |
|
|
|
|
"git.mleku.dev/mleku/nostr/encoders/filter" |
|
|
|
|
"git.mleku.dev/mleku/nostr/encoders/hex" |
|
|
|
|
"git.mleku.dev/mleku/nostr/encoders/tag" |
|
|
|
|
"git.mleku.dev/mleku/nostr/httpauth" |
|
|
|
|
"git.mleku.dev/mleku/nostr/protocol/auth" |
|
|
|
|
"lol.mleku.dev/chk" |
|
|
|
|
"next.orly.dev/app/branding" |
|
|
|
|
"next.orly.dev/app/config" |
|
|
|
|
"next.orly.dev/pkg/acl" |
|
|
|
|
acliface "next.orly.dev/pkg/interfaces/acl" |
|
|
|
|
"next.orly.dev/pkg/archive" |
|
|
|
|
"next.orly.dev/pkg/blossom" |
|
|
|
|
"next.orly.dev/pkg/bunker" |
|
|
|
|
"next.orly.dev/pkg/database" |
|
|
|
|
domainevents "next.orly.dev/pkg/domain/events" |
|
|
|
|
"next.orly.dev/pkg/domain/events/subscribers" |
|
|
|
|
@ -29,25 +36,18 @@ import (
@@ -29,25 +36,18 @@ import (
|
|
|
|
|
"next.orly.dev/pkg/event/routing" |
|
|
|
|
"next.orly.dev/pkg/event/specialkinds" |
|
|
|
|
"next.orly.dev/pkg/event/validation" |
|
|
|
|
"git.mleku.dev/mleku/nostr/encoders/event" |
|
|
|
|
"git.mleku.dev/mleku/nostr/encoders/filter" |
|
|
|
|
"git.mleku.dev/mleku/nostr/encoders/hex" |
|
|
|
|
"git.mleku.dev/mleku/nostr/encoders/tag" |
|
|
|
|
acliface "next.orly.dev/pkg/interfaces/acl" |
|
|
|
|
"next.orly.dev/pkg/policy" |
|
|
|
|
"git.mleku.dev/mleku/nostr/protocol/auth" |
|
|
|
|
"git.mleku.dev/mleku/nostr/httpauth" |
|
|
|
|
"next.orly.dev/pkg/protocol/graph" |
|
|
|
|
"next.orly.dev/pkg/protocol/nip43" |
|
|
|
|
"next.orly.dev/pkg/protocol/publish" |
|
|
|
|
"next.orly.dev/pkg/bunker" |
|
|
|
|
"next.orly.dev/pkg/protocol/nrc" |
|
|
|
|
"next.orly.dev/pkg/protocol/publish" |
|
|
|
|
"next.orly.dev/pkg/ratelimit" |
|
|
|
|
"next.orly.dev/pkg/spider" |
|
|
|
|
"next.orly.dev/pkg/storage" |
|
|
|
|
dsync "next.orly.dev/pkg/sync" |
|
|
|
|
"next.orly.dev/pkg/wireguard" |
|
|
|
|
"next.orly.dev/pkg/archive" |
|
|
|
|
"next.orly.dev/pkg/tor" |
|
|
|
|
"next.orly.dev/pkg/wireguard" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
type Server struct { |
|
|
|
|
@ -1118,7 +1118,7 @@ func (s *Server) handleEventsMine(w http.ResponseWriter, r *http.Request) {
@@ -1118,7 +1118,7 @@ func (s *Server) handleEventsMine(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
w.Write(jsonData) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// handleImport receives a JSONL/NDJSON file or body and enqueues an async import using NIP-98 authentication. Admins only.
|
|
|
|
|
// handleImport receives a JSONL/NDJSON file or body and enqueues an async import using NIP-98 authentication. Write, admin, or owner roles required.
|
|
|
|
|
func (s *Server) handleImport(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
if r.Method != http.MethodPost { |
|
|
|
|
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) |
|
|
|
|
@ -1138,11 +1138,11 @@ func (s *Server) handleImport(w http.ResponseWriter, r *http.Request) {
@@ -1138,11 +1138,11 @@ func (s *Server) handleImport(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Check permissions - require admin or owner level
|
|
|
|
|
// Check permissions - require write, admin, or owner level
|
|
|
|
|
accessLevel := acl.Registry.GetAccessLevel(pubkey, r.RemoteAddr) |
|
|
|
|
if accessLevel != "admin" && accessLevel != "owner" { |
|
|
|
|
if accessLevel != "write" && accessLevel != "admin" && accessLevel != "owner" { |
|
|
|
|
http.Error( |
|
|
|
|
w, "Admin or owner permission required", http.StatusForbidden, |
|
|
|
|
w, "Write, admin, or owner permission required", http.StatusForbidden, |
|
|
|
|
) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|