Add event rebroadcasting feature to send stored events to external relays#179
Open
greenart7c3 wants to merge 2 commits into
Open
Add event rebroadcasting feature to send stored events to external relays#179greenart7c3 wants to merge 2 commits into
greenart7c3 wants to merge 2 commits into
Conversation
Adds a new Rebroadcast screen (reachable from the Home screen) that publishes events already stored in the local database to one or more user-selected external relays, so historical events (old zap receipts, notes, etc.) can be discovered again by standard Nostr relays and clients without custom import scripts. Features: - Rebroadcast all stored events or only those authored by a selected account (npub or hex pubkey) - Filter by event kind (comma-separated list) and by date range - Select one or multiple destination relays - Private/sensitive event kinds (NIP-04 DMs, gift wraps, app-specific data) are excluded by default, with an explicit opt-in checkbox - Live progress with per event/relay counts of accepted, duplicate, rejected, and unanswered publishes, plus recent rejection reasons - Duplicates are detected via the relay's "duplicate" OK reason and reported separately instead of as new acceptances - Relays that repeatedly fail to connect are skipped, and the run can be cancelled from the screen or the progress notification - A warning dialog explains that relays may reject old, replaceable, deleted, private, or unsupported events before anything is sent The publishing pipeline (EventRebroadcaster) batches events, waits for NIP-01 OK responses through a NostrClient connection listener, and never modifies the local database. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017T5Y5yTGa6KuT1UodGdec4
When an author is set on the Rebroadcast screen, a new "Add author's relays" button fills the destination list with the author's NIP-65 write relays (from the local database when stored, otherwise fetched from the indexer relays), falling back to the kind-3 contact list relays when no advertised relay list exists. Local/private addresses are filtered out so the relay never rebroadcasts to itself. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017T5Y5yTGa6KuT1UodGdec4
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
Adds a new rebroadcasting feature that allows users to publish events already stored in the local database to a set of user-selected external relays. This enables clients and relays to discover events that may have been missed or lost.
Key Changes
New
EventRebroadcasterservice (service/EventRebroadcaster.kt):MutableStateFlow<State>New
RebroadcastScreenUI (ui/RebroadcastScreen.kt):Navigation integration:
Route.Rebroadcastto navigation routesCitrineScaffoldcomposableHomeScreenCitrineTopAppBarto display title for rebroadcast routeString resources (
strings.xml):Implementation Details
includePrivateKindsflag to avoid sending sensitive events to untrusted relaysCitrine.client(NostrClient) for publishing and integrates with the app's job cancellation systemEventDownloader.setProgress()for consistency with other long-running operationshttps://claude.ai/code/session_017T5Y5yTGa6KuT1UodGdec4