diff options
| author | Your Name <you@example.com> | 2026-05-27 15:32:38 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-27 15:32:38 +0530 |
| commit | d889b890f9e63815c178853ed98a1e31f6cec7f8 (patch) | |
| tree | 3eda17e8edaf61cc6dba640ae12a24e90c9d8b8c /src | |
| parent | d60fa03de6edae0667a93ac36be4206e76255a2c (diff) | |
Fix compile issues for NIP-46 build
- nip46.rs: match on owned RelayPoolNotification (not .as_ref())
- git_mirror.rs: accept shared nostr_sdk::Client for state event publishing
- main.rs: pass nostr_client to mirror_repo_to_servers
- NIP46-PLAN.md: full implementation checklist and roadmap
- PLAN.md: updated
Diffstat (limited to 'src')
| -rw-r--r-- | src/git_mirror.rs | 12 | ||||
| -rw-r--r-- | src/main.rs | 2 | ||||
| -rw-r--r-- | src/nip46.rs | 4 |
3 files changed, 4 insertions, 14 deletions
diff --git a/src/git_mirror.rs b/src/git_mirror.rs index c486887..cdf853e 100644 --- a/src/git_mirror.rs +++ b/src/git_mirror.rs | |||
| @@ -31,6 +31,7 @@ impl GitMirror { | |||
| 31 | repo: &DiscoveredRepo, | 31 | repo: &DiscoveredRepo, |
| 32 | target_servers: &[GraspServer], | 32 | target_servers: &[GraspServer], |
| 33 | nip46_client: Option<&Arc<Nip46Client>>, | 33 | nip46_client: Option<&Arc<Nip46Client>>, |
| 34 | nostr_client: &nostr_sdk::Client, | ||
| 34 | ) -> Result<()> { | 35 | ) -> Result<()> { |
| 35 | if target_servers.is_empty() { | 36 | if target_servers.is_empty() { |
| 36 | tracing::debug!( | 37 | tracing::debug!( |
| @@ -80,17 +81,6 @@ impl GitMirror { | |||
| 80 | let relay_url = server.relay_url(); | 81 | let relay_url = server.relay_url(); |
| 81 | if let Ok(url) = RelayUrl::parse(&relay_url) { | 82 | if let Ok(url) = RelayUrl::parse(&relay_url) { |
| 82 | let urls = vec![url]; | 83 | let urls = vec![url]; |
| 83 | if let Err(e) = nip46_client | ||
| 84 | .map_or(Ok(()), |_| { | ||
| 85 | Err(anyhow::anyhow!("need nostr client to send state event")) | ||
| 86 | }) | ||
| 87 | { | ||
| 88 | let _ = e; | ||
| 89 | } | ||
| 90 | |||
| 91 | let nostr_client = nostr_sdk::Client::default(); | ||
| 92 | let _ = nostr_client.add_relay(&relay_url).await; | ||
| 93 | nostr_client.connect().await; | ||
| 94 | if let Err(e) = nostr_client.send_event_to(urls, event.clone()).await { | 84 | if let Err(e) = nostr_client.send_event_to(urls, event.clone()).await { |
| 95 | tracing::warn!( | 85 | tracing::warn!( |
| 96 | server = %server.domain, | 86 | server = %server.domain, |
diff --git a/src/main.rs b/src/main.rs index 8e1383e..974898f 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -231,7 +231,7 @@ async fn mirror_cycle( | |||
| 231 | "mirroring to missing servers" | 231 | "mirroring to missing servers" |
| 232 | ); | 232 | ); |
| 233 | 233 | ||
| 234 | if let Err(e) = mirror.mirror_repo_to_servers(db, repo, &missing, nip46_client).await { | 234 | if let Err(e) = mirror.mirror_repo_to_servers(db, repo, &missing, nip46_client, nostr_client).await { |
| 235 | tracing::error!(identifier = %repo.identifier, error = %e, "git mirror failed for repo, continuing"); | 235 | tracing::error!(identifier = %repo.identifier, error = %e, "git mirror failed for repo, continuing"); |
| 236 | } | 236 | } |
| 237 | 237 | ||
diff --git a/src/nip46.rs b/src/nip46.rs index bedc814..c3b1e86 100644 --- a/src/nip46.rs +++ b/src/nip46.rs | |||
| @@ -156,10 +156,10 @@ impl Nip46Client { | |||
| 156 | let db = db.clone(); | 156 | let db = db.clone(); |
| 157 | 157 | ||
| 158 | async move { | 158 | async move { |
| 159 | if let RelayPoolNotification::Event { event, .. } = notification.as_ref() { | 159 | if let RelayPoolNotification::Event { event, .. } = notification { |
| 160 | if event.kind == Kind::Custom(24133) { | 160 | if event.kind == Kind::Custom(24133) { |
| 161 | let _ = | 161 | let _ = |
| 162 | Self::handle_response(&sessions, &pending, &db, event).await; | 162 | Self::handle_response(&sessions, &pending, &db, &event).await; |
| 163 | } | 163 | } |
| 164 | } | 164 | } |
| 165 | Ok(false) | 165 | Ok(false) |