Repository navigation
Port upstream owner deletions and admin console to fiatjaf.com/nostr - #4
Merged
Merged
Conversation
Pulls in three months of upstream library work, notably: - blossom moved from nipb0/ to nipb7/ (pure rename, identical API) - the only code change needed for the bump - websocket WriteWait deadlines: writes to stuck peers now time out instead of blocking a handler forever - nil-subscription guards in the listener path - NostrAddressesInTheText no longer flags npubs that are part of a URL - eventstore/mmm stats cursor key fixed (8+2+4, not 8+4+4) and stops early once the cursor leaves the author's prefix - new OverwriteSupportedMethods relay hook and assignmethod/ unassignmethod NIP-86 methods The lmdb CountEvents infinite-loop that upstream haven barrydeen#135 had to work around does not exist in this lineage - the monorepo lmdb backend already advances its cursor on every counting path. go build and go vet are clean. Co-Authored-By: Claude Code <noreply@anthropic.com>
Port of upstream barrydeen#133 (Barry Deen), adapted from nbd-wtf/go-nostr + fiatjaf/khatru to the fiatjaf.com/nostr monorepo. The owner (OWNER_NPUB) can now delete any event stored on the relay endpoint the request is sent to; authors keep deleting their own events and everybody else is unaffected: - OwnerCanDeleteAnyEvent is wired into AllowDeleting - the monorepo khatru hook that replaces the old OverwriteDeletionOutcome - on all four relays - the tombstone is stored: the owner's kind 5 passes the chat-relay kind policy, the inbox whitelist-tag policy and the blanket AUTH requirement in MustNotBeBlacklistedToPost (the event already carries the owner's signature) - deleted events don't come back: MustNotBeDeleted rejects a re-publish and the three import paths skip deleted events. The old khatru "#e"/"#a" filter bug this guarded against does not exist in the monorepo's handleDeleteRequest, but the import paths write to the databases directly and still need the check Only delete requests signed by an event's author or by the owner count as deletions, so nobody can tombstone an event the relay hasn't seen yet and block it from ever being stored. Co-Authored-By: Claude Code <noreply@anthropic.com>
Port of upstream haven barrydeen#135 onto the fiatjaf.com/nostr monorepo. Adds the NIP-86 management API on each of the four relay URIs, the /admin console that drives it, a read-only notes browser per relay, an analytics dashboard with persisted hourly history, blossom media management and the kind 10084 ban list. State lives in management.json and metrics.json. The NIP-86 dispatcher stays in haven rather than in khatru's RelayManagementAPI: nip86.DecodeRequest rejects unknown methods before the Generic hook runs, so the console's own methods could not be served, and khatru still answers auth failures with HTTP 200, skips the kind and method tag checks and reads the body unbounded. This replaces the earlier ManagementAPI hooks, whose ban, allow, stats and icon methods it covers. Adapted to the monorepo rather than copied: - policies compose into the single OnEvent/OnRequest/RejectConnection functions, and metrics wrap those hooks instead of appending to slices - the lmdb CountEvents infinite-loop workaround is gone; counts call db.CountEvents directly - events are walked through the iter.Seq QueryEvents with an explicit page size, deleted by id, and looked up with a full-id check because the store indexes only the first eight bytes - blob URLs use nipb7/blossom.GetExtension instead of a copied helper - deleteBlobs queries the x tag index directly instead of walking every index entry - the per-relay event rate limiter is built once per relay; built inside the hook it was a fresh bucket per event and never limited anything Tests load their settings from testdata/test.env (chosen by testing.Testing() in loadConfig), because config is loaded during package variable initialisation, before any test file can seed the environment. Co-Authored-By: Claude Code <noreply@anthropic.com>
BadgerDB support went away with the move to fiatjaf.com/nostr, whose eventstore has no badger backend: newDBBackend opens LMDB whatever DB_ENGINE says. The README, .env.example and backup docs still called BadgerDB the default, which sent new installs looking for a setting that does nothing. They now name LMDB as the only engine and point BadgerDB users at backup and restore to move their notes across. Co-Authored-By: Claude Code <noreply@anthropic.com>
http.Transport.Dial is deprecated and golangci-lint's staticcheck fails on it. The x/net SOCKS5 dialer implements proxy.ContextDialer, so the transport now uses DialContext and a dial is cancelled along with the request that started it. Co-Authored-By: Claude Code <noreply@anthropic.com>
blossomMigration.go was the only camelCase file name in the package; it is now blossom_migration.go, next to blossom.go. The event store walker and its tests move from eventscan*.go to events_scan*.go so the notes browser's files sort together with events.go. .env.example gains the trailing newline it was missing. No code changes. Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings upstream haven barrydeen#133 (owner deletions) and barrydeen#135 (admin console, notes browser, dashboard, ban list) onto our fiatjaf.com/nostr monorepo lineage, together with the library bump they needed.
chore(deps)bump fiatjaf.com/nostr to 2026-09-28 (blossom movednipb0→nipb7).feat(deletions)the relay owner can delete any event on any of the four relays, and deleted events cannot come back through a re-publish or an import.feat(admin)NIP-86 management API on every relay URI, the/adminconsole, per-relay notes browser, analytics dashboard with persisted history, blossom media management, and the kind 10084 ban list.docsLMDB is the only engine (BadgerDB went away with the monorepo); README,.env.exampleand backup docs said otherwise.fix(proxy)SOCKS5 transport usesDialContext(staticcheck failed on the deprecatedDial).choreconsistent file names:blossom_migration.go,events_scan*.go.Adapted, not copied
Upstream still runs on go-nostr/khatru/eventstore, so several of its workarounds don't apply here and were dropped:
CountEventsinfinite-loop workaround: counts calldb.CountEventsdirectly"#e"/"#a"deletion filter bug does not exist in the monorepo;MustNotBeDeletedand the import checks stay because imports bypass the relay pipelinegetExtensionhelper: replaced by the now-exportednipb7/blossom.GetExtensionblobIndexMaxLimitand the "quarter of MaxLimit" paging traps: the monorepo takes an explicit query limitWhat it takes advantage of in the monorepo:
OnEvent/OnRequest/RejectConnectionhooks, and metrics wrap themOverwriteRelayInformationapplies console renames to NIP-11 without racesAllowDeletingcarries the owner-deletion rulextag index directly instead of walking every index entryThe NIP-86 dispatcher stays in haven rather than in khatru's
RelayManagementAPI.nip86.DecodeRequestrejects unknown methods before theGenerichook runs, so the console's own methods could not be served. khatru also still answers auth failures with HTTP 200 and skips the kind and method tag checks. The new API supersedes our earlierManagementAPIhooks (ban, allow, stats, icon).Fixed on the way:
testdata/test.envviatesting.Testing(); upstream's file-ordering trick runs afterconfigis loaded undergo testTesting
go vet,gofmtand golangci-lint: 0 issuesgo test ./...passes with no local.env🤖 Generated with Claude Code