-
Notifications
You must be signed in to change notification settings - Fork 5
feat: upgrade to upstream rust-nostr PR #1156 for relay provenance #53
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
base: master
Are you sure you want to change the base?
feat: upgrade to upstream rust-nostr PR #1156 for relay provenance #53
Conversation
Adds comprehensive rendering for additional nostr event types: NIP-84 Highlights (kind:9802): - Extract highlight metadata (context, comment, source references) - Render highlighted text with blockquote styling - Support source attribution for web URLs, notes, and articles - Preserve relay hints via bech32 parsing for nevent/naddr NIP-18 Quote Embeds (q tags and inline mentions): - Parse q tags and inline nostr:nevent/note mentions for quote references - Rich embedded quotes with author avatar, name, @username - Relative timestamps (e.g., "7h", "2d") with full date on hover - "Show more" link for truncated content - NIP-10 reply detection via e-tag "reply" marker NIP-23 Draft Badge: - Visual indicator for unpublished articles (kind:30024) Human-readable mentions: - Resolve @npub profile mentions to display names when available - Show abbreviated bech32 as fallback when profile not cached Helper functions for clean code organization: - parse_hex_id(): hex string to 32-byte array - detect_reply_author(): NIP-10 compliant reply detection - lookup_profile_handle(): profile name resolution 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixes 404 errors when Ubuntu package versions change on mirrors. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add @username handle below author name in note/article/highlight headers - Fix profile name lookup to filter out empty strings (prevents showing just "@" when profile has empty display_name/name fields) - Add CSS styling for .damus-note-handle 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Show "Article" badge for kind 30023 embedded quotes - Show "Draft" badge (orange) for kind 30024 embedded quotes - Show "Highlight" badge for kind 9802 embedded quotes - Fix empty string filtering in embedded quote profile extraction 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add support for highlight (kind 9802) references in naddr mentions - Style embedded highlights with left purple border instead of tag - Remove quotation marks from highlight content - Filter empty strings in embedded quote profile extraction 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Embedded article quotes now display as cards matching iOS Damus: - Hero image (if available) - Bold article title - Summary text (if available) - Word count - DRAFT badge via CSS for kind 30024 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Integrate relay provenance tracking from rust-nostr PR #1172 to enable proper NIP-19 bech32 links with relay hints for better content discoverability. Changes: - Update nostr-sdk to alltheseas/rust-nostr relay-provenance-tracking branch - RelayPool::stream_events returns BoxedStream<RelayEvent> with source relay URL - NoteAndProfileRenderData stores source_relays captured during fetch - Generate bech32 links with relay hints for all event types (notes, articles, highlights) - Filter profile (kind 0) relays from note hints - Prioritize default relays in source_relays for reliability - Preserve author/kind fields when rebuilding nevent bech32 - Graceful fallback to original nip19 on encoding failure with metric - Add bech32_with_relays() helper with 8 unit tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Switch from alltheseas/rust-nostr fork (PR #1172) to upstream rust-nostr/nostr with merged PR #1156 relay provenance support. API changes: - stream_events returns (RelayUrl, Result<Event, Error>) tuples - Removed RelayEvent wrapper type - RelayUrl now always present (previously Optional) Error handling: - Track success/error relays separately per stream - Only fail when ALL distinct targeted relays error - Dedupe relay targets before comparison (handles duplicate bech32 hints) - Use early returns with combined conditions (nevernesting) Relay provenance preserved: - Source relay URLs collected for NIP-19 bech32 hints - Event deduplication across relays maintained 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@coderabbitai review please |
|
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughThis PR adds comprehensive support for NIP-18 (quotes) and NIP-84 (highlights) with rich HTML rendering, introduces relay URL support in bech32 encoding, refactors to use git-sourced dependencies, simplifies the RelayPool API by removing timeout parameters, and expands relay discovery with source relay tracking. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant RelayPool as Relay Pool
participant Database as NostrDB
participant HTMLRenderer as HTML Renderer
Client->>RelayPool: Request note rendering
RelayPool->>Database: Query note by NIP19
Database-->>RelayPool: Return note + metadata
RelayPool->>RelayPool: Extract quote references (q-tags)
RelayPool->>Database: Lookup quoted note/article
Database-->>RelayPool: Return quoted content
RelayPool->>Database: Lookup author profile
Database-->>RelayPool: Return profile (name, avatar)
RelayPool->>HTMLRenderer: Pass note + quotes + profiles
HTMLRenderer->>HTMLRenderer: Extract highlight metadata (NIP-84)
HTMLRenderer->>HTMLRenderer: Build article source links
HTMLRenderer->>HTMLRenderer: Render quote containers with author info
HTMLRenderer->>HTMLRenderer: Assemble embedded_quotes_html
HTMLRenderer-->>Client: Return rich HTML with quotes/highlights
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (14)
📒 Files selected for processing (8)
💤 Files with no reviewable changes (1)
🧰 Additional context used🧬 Code graph analysis (3)src/html.rs (1)
src/nip19.rs (2)
src/render.rs (1)
🔇 Additional comments (36)
✏️ Tip: You can disable this entire section by setting Comment |
Summary
Upgrade from
alltheseas/rust-nostrfork (PR #1172) to upstreamrust-nostr/nostrwith merged PR #1156 for relay provenance tracking.Changes
Dependencies
nostr-sdkandnostr: now point to upstreamrust-nostr/nostr@1ecd7161API Migration
BoxedStream<RelayEvent>BoxedStream<(RelayUrl, Result<Event, Error>)>.relay_url()→Option<&RelayUrl>.eventvia DerefResultError Handling
success_relaysanderror_relaysper streamFiles Changed
Cargo.toml/Cargo.lock: Updated dependenciessrc/relay_pool.rs: New return type and method namessrc/render.rs: HandleResultwrapper, per-relay error trackingRelay Provenance Preserved
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.