-
Notifications
You must be signed in to change notification settings - Fork 20
Feat: Add kind 0 metadata fetching for Mostro nodes (P2) #437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fetch Nostr kind 0 profile metadata (name, picture, website, about) for each Mostro node, giving users meaningful names and avatars instead of raw pubkeys. - Add fetchAllNodeMetadata() for batch fetching in a single round trip - Add fetchNodeMetadata() for per-node refresh - Deduplicate events across relays, keeping latest by createdAt - Verify event signatures before applying metadata - Sanitize picture/website URLs (https-only) - Guard against disposed notifier after async gaps - Fire-and-forget on startup via unawaited(), never blocks init - Add MostroNode.clear sentinel for explicit field clearing - Add 12 new tests (49 total across P1+P2) - Update MULTI_MOSTRO_SUPPORT.md with phase status and implementation details
WalkthroughThe changes introduce metadata fetching capabilities for Mostro nodes via Nostr Kind 0 events, adding batch and single-node methods to MostroNodesNotifier with verification, sanitization, and in-memory storage. A new MostroNode.clear sentinel enables explicit field clearing in withMetadata(). Metadata fetching is triggered asynchronously during app initialization without blocking. Phase 2 implementation details are documented with comprehensive test coverage. Changes
Sequence Diagram(s)sequenceDiagram
participant App as App Initialization
participant Notifier as MostroNodesNotifier
participant NostrService as NostrService
participant NostrNetwork as Nostr Network
participant State as In-Memory State
App->>Notifier: fetchAllNodeMetadata() [fire-and-forget]
Notifier->>NostrService: subscribe to Kind 0 events
NostrService->>NostrNetwork: fetch metadata for all node pubkeys
NostrNetwork-->>NostrService: Kind 0 events
Notifier->>Notifier: verify event signature
Notifier->>Notifier: parse JSON metadata
Notifier->>Notifier: sanitize URLs (https only)
Notifier->>State: updateNodes() with withMetadata()
Note over State: Merge metadata into existing nodes<br/>or clear fields via MostroNode.clear
Notifier-->>App: complete (async, non-blocking)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Catrya
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK
Fetch Nostr kind 0 profile metadata (name, picture, website, about) for each Mostro node, giving users meaningful names and avatars instead of raw pubkeys.
Summary by CodeRabbit
Release Notes
New Features
Improvements