diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-04-01 14:31:34 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-04-01 14:35:50 +0100 |
| commit | 948fe972eb2bddf187b79f2673a091b6331cfd90 (patch) | |
| tree | ec1c538d28108b104b5a00afd673631538f9aa00 /src/bin | |
| parent | 70966d571fce16f707725c6b0af0fd585bfce607 (diff) | |
chore: bump rust-nostr v0.37 ~> v0.40
and fix all of the breaking changes
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/git_remote_nostr/fetch.rs | 2 | ||||
| -rw-r--r-- | src/bin/git_remote_nostr/main.rs | 4 | ||||
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 17 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/init.rs | 21 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/send.rs | 8 |
5 files changed, 34 insertions, 18 deletions
diff --git a/src/bin/git_remote_nostr/fetch.rs b/src/bin/git_remote_nostr/fetch.rs index 5ee4271..a7210d0 100644 --- a/src/bin/git_remote_nostr/fetch.rs +++ b/src/bin/git_remote_nostr/fetch.rs | |||
| @@ -115,7 +115,7 @@ pub fn make_commits_for_proposal( | |||
| 115 | author: Some(patch.pubkey), | 115 | author: Some(patch.pubkey), |
| 116 | kind: Some(patch.kind), | 116 | kind: Some(patch.kind), |
| 117 | relays: if let Some(relay) = repo_ref.relays.first() { | 117 | relays: if let Some(relay) = repo_ref.relays.first() { |
| 118 | vec![relay.to_string()] | 118 | vec![relay.to_owned()] |
| 119 | } else { | 119 | } else { |
| 120 | vec![] | 120 | vec![] |
| 121 | }, | 121 | }, |
diff --git a/src/bin/git_remote_nostr/main.rs b/src/bin/git_remote_nostr/main.rs index 44359dd..daa924f 100644 --- a/src/bin/git_remote_nostr/main.rs +++ b/src/bin/git_remote_nostr/main.rs | |||
| @@ -15,7 +15,7 @@ use anyhow::{Context, Result, bail}; | |||
| 15 | use client::{Connect, consolidate_fetch_reports, get_repo_ref_from_cache}; | 15 | use client::{Connect, consolidate_fetch_reports, get_repo_ref_from_cache}; |
| 16 | use git::{RepoActions, nostr_url::NostrUrlDecoded}; | 16 | use git::{RepoActions, nostr_url::NostrUrlDecoded}; |
| 17 | use ngit::{client, git, login::existing::load_existing_login}; | 17 | use ngit::{client, git, login::existing::load_existing_login}; |
| 18 | use nostr::nips::nip01::Coordinate; | 18 | use nostr::nips::nip19::Nip19Coordinate; |
| 19 | use utils::read_line; | 19 | use utils::read_line; |
| 20 | 20 | ||
| 21 | use crate::{client::Client, git::Repo}; | 21 | use crate::{client::Client, git::Repo}; |
| @@ -148,7 +148,7 @@ async fn process_args() -> Result<Option<(NostrUrlDecoded, Repo)>> { | |||
| 148 | async fn fetching_with_report_for_helper( | 148 | async fn fetching_with_report_for_helper( |
| 149 | git_repo_path: &Path, | 149 | git_repo_path: &Path, |
| 150 | client: &Client, | 150 | client: &Client, |
| 151 | trusted_maintainer_coordinate: &Coordinate, | 151 | trusted_maintainer_coordinate: &Nip19Coordinate, |
| 152 | ) -> Result<()> { | 152 | ) -> Result<()> { |
| 153 | let term = console::Term::stderr(); | 153 | let term = console::Term::stderr(); |
| 154 | term.write_line("nostr: fetching...")?; | 154 | term.write_line("nostr: fetching...")?; |
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index c0085bd..15adc13 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs | |||
| @@ -32,7 +32,7 @@ use ngit::{ | |||
| 32 | }; | 32 | }; |
| 33 | use nostr::nips::nip10::Marker; | 33 | use nostr::nips::nip10::Marker; |
| 34 | use nostr_sdk::{ | 34 | use nostr_sdk::{ |
| 35 | Event, EventBuilder, EventId, Kind, NostrSigner, PublicKey, RelayUrl, Tag, | 35 | Event, EventBuilder, EventId, Kind, NostrSigner, PublicKey, RelayUrl, Tag, TagStandard, |
| 36 | hashes::sha1::Hash as Sha1Hash, | 36 | hashes::sha1::Hash as Sha1Hash, |
| 37 | }; | 37 | }; |
| 38 | use repo_ref::RepoRef; | 38 | use repo_ref::RepoRef; |
| @@ -1312,7 +1312,13 @@ async fn create_merge_status( | |||
| 1312 | repo_ref | 1312 | repo_ref |
| 1313 | .coordinates() | 1313 | .coordinates() |
| 1314 | .iter() | 1314 | .iter() |
| 1315 | .map(|c| Tag::coordinate(c.clone())) | 1315 | .map(|c| { |
| 1316 | Tag::from_standardized(TagStandard::Coordinate { | ||
| 1317 | coordinate: c.coordinate.clone(), | ||
| 1318 | relay_url: c.relays.first().cloned(), | ||
| 1319 | uppercase: false, | ||
| 1320 | }) | ||
| 1321 | }) | ||
| 1316 | .collect::<Vec<Tag>>(), | 1322 | .collect::<Vec<Tag>>(), |
| 1317 | vec![ | 1323 | vec![ |
| 1318 | Tag::from_standardized(nostr::TagStandard::Reference( | 1324 | Tag::from_standardized(nostr::TagStandard::Reference( |
| @@ -1358,7 +1364,7 @@ async fn get_proposal_and_revision_root_from_patch( | |||
| 1358 | patch.clone() | 1364 | patch.clone() |
| 1359 | } else { | 1365 | } else { |
| 1360 | let proposal_or_revision_id = EventId::parse( | 1366 | let proposal_or_revision_id = EventId::parse( |
| 1361 | if let Some(t) = patch.tags.iter().find(|t| t.is_root()) { | 1367 | &if let Some(t) = patch.tags.iter().find(|t| t.is_root()) { |
| 1362 | t.clone() | 1368 | t.clone() |
| 1363 | } else if let Some(t) = patch.tags.iter().find(|t| t.is_reply()) { | 1369 | } else if let Some(t) = patch.tags.iter().find(|t| t.is_reply()) { |
| 1364 | t.clone() | 1370 | t.clone() |
| @@ -1389,13 +1395,12 @@ async fn get_proposal_and_revision_root_from_patch( | |||
| 1389 | { | 1395 | { |
| 1390 | Ok(( | 1396 | Ok(( |
| 1391 | EventId::parse( | 1397 | EventId::parse( |
| 1392 | proposal_or_revision | 1398 | &proposal_or_revision |
| 1393 | .tags | 1399 | .tags |
| 1394 | .iter() | 1400 | .iter() |
| 1395 | .find(|t| t.is_reply()) | 1401 | .find(|t| t.is_reply()) |
| 1396 | .unwrap() | 1402 | .unwrap() |
| 1397 | .as_slice()[1] | 1403 | .as_slice()[1], |
| 1398 | .clone(), | ||
| 1399 | )?, | 1404 | )?, |
| 1400 | Some(proposal_or_revision.id), | 1405 | Some(proposal_or_revision.id), |
| 1401 | )) | 1406 | )) |
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 4aa7ced..3731e3a 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs | |||
| @@ -11,6 +11,7 @@ use nostr::{ | |||
| 11 | nips::{ | 11 | nips::{ |
| 12 | nip01::Coordinate, | 12 | nip01::Coordinate, |
| 13 | nip05::{self}, | 13 | nip05::{self}, |
| 14 | nip19::Nip19Coordinate, | ||
| 14 | }, | 15 | }, |
| 15 | }; | 16 | }; |
| 16 | use nostr_sdk::{Kind, RelayUrl}; | 17 | use nostr_sdk::{Kind, RelayUrl}; |
| @@ -437,10 +438,12 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 437 | // TODO - does this git config item do more harm than good? | 438 | // TODO - does this git config item do more harm than good? |
| 438 | git_repo.save_git_config_item( | 439 | git_repo.save_git_config_item( |
| 439 | "nostr.repo", | 440 | "nostr.repo", |
| 440 | &Coordinate { | 441 | &Nip19Coordinate { |
| 441 | kind: Kind::GitRepoAnnouncement, | 442 | coordinate: Coordinate { |
| 442 | public_key: user_ref.public_key, | 443 | kind: Kind::GitRepoAnnouncement, |
| 443 | identifier: identifier.clone(), | 444 | public_key: user_ref.public_key, |
| 445 | identifier: identifier.clone(), | ||
| 446 | }, | ||
| 444 | relays: vec![], | 447 | relays: vec![], |
| 445 | } | 448 | } |
| 446 | .to_bech32()?, | 449 | .to_bech32()?, |
| @@ -471,10 +474,12 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 471 | repo_ref.set_nostr_git_url(NostrUrlDecoded { | 474 | repo_ref.set_nostr_git_url(NostrUrlDecoded { |
| 472 | original_string: String::new(), | 475 | original_string: String::new(), |
| 473 | nip05: Some(nip05.clone()), | 476 | nip05: Some(nip05.clone()), |
| 474 | coordinate: Coordinate { | 477 | coordinate: Nip19Coordinate { |
| 475 | kind: Kind::GitRepoAnnouncement, | 478 | coordinate: Coordinate { |
| 476 | public_key: user_ref.public_key, | 479 | kind: Kind::GitRepoAnnouncement, |
| 477 | identifier: repo_ref.identifier.clone(), | 480 | public_key: user_ref.public_key, |
| 481 | identifier: repo_ref.identifier.clone(), | ||
| 482 | }, | ||
| 478 | relays: if inter.next().is_some() || relays.is_empty() { | 483 | relays: if inter.next().is_some() || relays.is_empty() { |
| 479 | vec![] | 484 | vec![] |
| 480 | } else { | 485 | } else { |
diff --git a/src/bin/ngit/sub_commands/send.rs b/src/bin/ngit/sub_commands/send.rs index 7c898bc..9fc00d9 100644 --- a/src/bin/ngit/sub_commands/send.rs +++ b/src/bin/ngit/sub_commands/send.rs | |||
| @@ -238,7 +238,13 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re | |||
| 238 | if root_proposal_id.is_none() { | 238 | if root_proposal_id.is_none() { |
| 239 | if let Some(event) = events.first() { | 239 | if let Some(event) = events.first() { |
| 240 | let event_bech32 = if let Some(relay) = repo_ref.relays.first() { | 240 | let event_bech32 = if let Some(relay) = repo_ref.relays.first() { |
| 241 | Nip19Event::new(event.id, vec![relay.to_string()]).to_bech32()? | 241 | Nip19Event { |
| 242 | event_id: event.id, | ||
| 243 | relays: vec![relay.clone()], | ||
| 244 | author: None, | ||
| 245 | kind: None, | ||
| 246 | } | ||
| 247 | .to_bech32()? | ||
| 242 | } else { | 248 | } else { |
| 243 | event.id.to_bech32()? | 249 | event.id.to_bech32()? |
| 244 | }; | 250 | }; |