diff options
Diffstat (limited to 'src/sub_commands')
| -rw-r--r-- | src/sub_commands/init.rs | 10 | ||||
| -rw-r--r-- | src/sub_commands/list.rs | 12 | ||||
| -rw-r--r-- | src/sub_commands/push.rs | 2 | ||||
| -rw-r--r-- | src/sub_commands/send.rs | 30 |
4 files changed, 33 insertions, 21 deletions
diff --git a/src/sub_commands/init.rs b/src/sub_commands/init.rs index 4f098c0..56129a6 100644 --- a/src/sub_commands/init.rs +++ b/src/sub_commands/init.rs | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | use anyhow::{Context, Result}; | 1 | use anyhow::{Context, Result}; |
| 2 | use nostr::{secp256k1::XOnlyPublicKey, FromBech32, ToBech32}; | 2 | use nostr::{FromBech32, PublicKey, ToBech32}; |
| 3 | 3 | ||
| 4 | use super::send::send_events; | 4 | use super::send::send_events; |
| 5 | #[cfg(not(test))] | 5 | #[cfg(not(test))] |
| @@ -163,7 +163,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 163 | args.web.clone() | 163 | args.web.clone() |
| 164 | }; | 164 | }; |
| 165 | 165 | ||
| 166 | let maintainers: Vec<XOnlyPublicKey> = { | 166 | let maintainers: Vec<PublicKey> = { |
| 167 | let mut dont_ask = !args.other_maintainers.is_empty(); | 167 | let mut dont_ask = !args.other_maintainers.is_empty(); |
| 168 | let mut maintainers_string = if !args.other_maintainers.is_empty() { | 168 | let mut maintainers_string = if !args.other_maintainers.is_empty() { |
| 169 | [args.other_maintainers.clone()].concat().join(" ") | 169 | [args.other_maintainers.clone()].concat().join(" ") |
| @@ -185,7 +185,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 185 | }; | 185 | }; |
| 186 | // add current user if not present | 186 | // add current user if not present |
| 187 | if maintainers.iter().any(|m| { | 187 | if maintainers.iter().any(|m| { |
| 188 | if let Ok(m_pubkey) = XOnlyPublicKey::from_bech32(m) { | 188 | if let Ok(m_pubkey) = PublicKey::from_bech32(m) { |
| 189 | user_ref.public_key.eq(&m_pubkey) | 189 | user_ref.public_key.eq(&m_pubkey) |
| 190 | } else { | 190 | } else { |
| 191 | false | 191 | false |
| @@ -210,9 +210,9 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 210 | .map(std::string::ToString::to_string) | 210 | .map(std::string::ToString::to_string) |
| 211 | .collect(); | 211 | .collect(); |
| 212 | } | 212 | } |
| 213 | let mut maintainers: Vec<XOnlyPublicKey> = vec![]; | 213 | let mut maintainers: Vec<PublicKey> = vec![]; |
| 214 | for m in maintainers_string.split(' ') { | 214 | for m in maintainers_string.split(' ') { |
| 215 | if let Ok(m_pubkey) = XOnlyPublicKey::from_bech32(m) { | 215 | if let Ok(m_pubkey) = PublicKey::from_bech32(m) { |
| 216 | maintainers.push(m_pubkey); | 216 | maintainers.push(m_pubkey); |
| 217 | } else { | 217 | } else { |
| 218 | println!("not a valid set of npubs seperated by a space"); | 218 | println!("not a valid set of npubs seperated by a space"); |
diff --git a/src/sub_commands/list.rs b/src/sub_commands/list.rs index 2d81164..1a30b9b 100644 --- a/src/sub_commands/list.rs +++ b/src/sub_commands/list.rs | |||
| @@ -730,9 +730,12 @@ pub async fn find_proposal_events( | |||
| 730 | vec![ | 730 | vec![ |
| 731 | nostr::Filter::default() | 731 | nostr::Filter::default() |
| 732 | .kind(nostr::Kind::Custom(PATCH_KIND)) | 732 | .kind(nostr::Kind::Custom(PATCH_KIND)) |
| 733 | .custom_tag(nostr::Alphabet::T, vec!["root"]) | ||
| 734 | .custom_tag( | 733 | .custom_tag( |
| 735 | nostr::Alphabet::A, | 734 | nostr::SingleLetterTag::lowercase(nostr::Alphabet::T), |
| 735 | vec!["root"], | ||
| 736 | ) | ||
| 737 | .custom_tag( | ||
| 738 | nostr::SingleLetterTag::lowercase(nostr::Alphabet::A), | ||
| 736 | repo_ref | 739 | repo_ref |
| 737 | .maintainers | 740 | .maintainers |
| 738 | .iter() | 741 | .iter() |
| @@ -742,7 +745,10 @@ pub async fn find_proposal_events( | |||
| 742 | // events | 745 | // events |
| 743 | nostr::Filter::default() | 746 | nostr::Filter::default() |
| 744 | .kind(nostr::Kind::Custom(PATCH_KIND)) | 747 | .kind(nostr::Kind::Custom(PATCH_KIND)) |
| 745 | .custom_tag(nostr::Alphabet::T, vec!["root"]) | 748 | .custom_tag( |
| 749 | nostr::SingleLetterTag::lowercase(nostr::Alphabet::T), | ||
| 750 | vec!["root"], | ||
| 751 | ) | ||
| 746 | .reference(root_commit), | 752 | .reference(root_commit), |
| 747 | ], | 753 | ], |
| 748 | ) | 754 | ) |
diff --git a/src/sub_commands/push.rs b/src/sub_commands/push.rs index 651b250..bb50ee2 100644 --- a/src/sub_commands/push.rs +++ b/src/sub_commands/push.rs | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | use anyhow::{bail, Context, Result}; | 1 | use anyhow::{bail, Context, Result}; |
| 2 | use nostr::prelude::sha1::Hash as Sha1Hash; | 2 | use nostr_sdk::hashes::sha1::Hash as Sha1Hash; |
| 3 | 3 | ||
| 4 | #[cfg(not(test))] | 4 | #[cfg(not(test))] |
| 5 | use crate::client::Client; | 5 | use crate::client::Client; |
diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index 35c2c81..d9caf9b 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs | |||
| @@ -5,9 +5,10 @@ use console::Style; | |||
| 5 | use futures::future::join_all; | 5 | use futures::future::join_all; |
| 6 | use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; | 6 | use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; |
| 7 | use nostr::{ | 7 | use nostr::{ |
| 8 | nips::nip19::Nip19, prelude::sha1::Hash as Sha1Hash, EventBuilder, FromBech32, Marker, Tag, | 8 | nips::{nip01::Coordinate, nip19::Nip19}, |
| 9 | TagKind, UncheckedUrl, | 9 | EventBuilder, FromBech32, Marker, Tag, TagKind, UncheckedUrl, |
| 10 | }; | 10 | }; |
| 11 | use nostr_sdk::hashes::sha1::Hash as Sha1Hash; | ||
| 11 | 12 | ||
| 12 | use super::list::tag_value; | 13 | use super::list::tag_value; |
| 13 | #[cfg(not(test))] | 14 | #[cfg(not(test))] |
| @@ -541,11 +542,13 @@ pub fn generate_cover_letter_and_patch_events( | |||
| 541 | vec![ | 542 | vec![ |
| 542 | // TODO: why not tag all maintainer identifiers? | 543 | // TODO: why not tag all maintainer identifiers? |
| 543 | Tag::A { | 544 | Tag::A { |
| 544 | kind: nostr::Kind::Custom(REPO_REF_KIND), | 545 | coordinate: Coordinate { |
| 545 | public_key: *repo_ref.maintainers.first() | 546 | kind: nostr::Kind::Custom(REPO_REF_KIND), |
| 546 | .context("repo reference should always have at least one maintainer - the issuer of the repo event") | 547 | public_key: *repo_ref.maintainers.first() |
| 547 | ?, | 548 | .context("repo reference should always have at least one maintainer")?, |
| 548 | identifier: repo_ref.identifier.to_string(), | 549 | identifier: repo_ref.identifier.to_string(), |
| 550 | relays: repo_ref.relays.clone(), | ||
| 551 | }, | ||
| 549 | relay_url: repo_ref.relays.first().map(nostr::UncheckedUrl::from).clone(), | 552 | relay_url: repo_ref.relays.first().map(nostr::UncheckedUrl::from).clone(), |
| 550 | }, | 553 | }, |
| 551 | Tag::Reference(format!("{root_commit}")), | 554 | Tag::Reference(format!("{root_commit}")), |
| @@ -797,11 +800,14 @@ pub fn generate_patch_event( | |||
| 797 | [ | 800 | [ |
| 798 | vec![ | 801 | vec![ |
| 799 | Tag::A { | 802 | Tag::A { |
| 800 | kind: nostr::Kind::Custom(REPO_REF_KIND), | 803 | coordinate: Coordinate { |
| 801 | public_key: *repo_ref.maintainers.first() | 804 | kind: nostr::Kind::Custom(REPO_REF_KIND), |
| 802 | .context("repo reference should always have at least one maintainer - the issuer of the repo event") | 805 | public_key: *repo_ref.maintainers.first() |
| 803 | ?, | 806 | .context("repo reference should always have at least one maintainer - the issuer of the repo event") |
| 804 | identifier: repo_ref.identifier.to_string(), | 807 | ?, |
| 808 | identifier: repo_ref.identifier.to_string(), | ||
| 809 | relays: repo_ref.relays.clone(), | ||
| 810 | }, | ||
| 805 | relay_url: relay_hint.clone(), | 811 | relay_url: relay_hint.clone(), |
| 806 | }, | 812 | }, |
| 807 | Tag::Reference(format!("{root_commit}")), | 813 | Tag::Reference(format!("{root_commit}")), |