upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/key_handling/users.rs6
-rw-r--r--src/repo_ref.rs5
-rw-r--r--src/sub_commands/list.rs12
-rw-r--r--src/sub_commands/send.rs31
4 files changed, 37 insertions, 17 deletions
diff --git a/src/key_handling/users.rs b/src/key_handling/users.rs
index 751c577..1dd75a8 100644
--- a/src/key_handling/users.rs
+++ b/src/key_handling/users.rs
@@ -249,7 +249,11 @@ impl UserManagement for UserManager {
249 relays: new_relays_event 249 relays: new_relays_event
250 .tags 250 .tags
251 .iter() 251 .iter()
252 .filter(|t| t.kind().eq(&nostr::TagKind::R)) 252 .filter(|t| {
253 t.kind().eq(&nostr::TagKind::SingleLetter(
254 SingleLetterTag::lowercase(Alphabet::R),
255 ))
256 })
253 .map(|t| UserRelayRef { 257 .map(|t| UserRelayRef {
254 url: t.as_vec()[1].clone(), 258 url: t.as_vec()[1].clone(),
255 read: t.as_vec().len() == 2 || t.as_vec()[2].eq("read"), 259 read: t.as_vec().len() == 2 || t.as_vec()[2].eq("read"),
diff --git a/src/repo_ref.rs b/src/repo_ref.rs
index 0a14005..2dab79c 100644
--- a/src/repo_ref.rs
+++ b/src/repo_ref.rs
@@ -200,8 +200,9 @@ pub async fn fetch(
200 nostr::Filter::default().kind(nostr::Kind::Custom(REPO_REF_KIND)); 200 nostr::Filter::default().kind(nostr::Kind::Custom(REPO_REF_KIND));
201 match nip19 { 201 match nip19 {
202 Nip19::Coordinate(c) => { 202 Nip19::Coordinate(c) => {
203 repo_event_filter = 203 repo_event_filter = repo_event_filter
204 repo_event_filter.identifier(c.identifier).author(c.pubkey); 204 .identifier(c.identifier)
205 .author(c.public_key);
205 for r in c.relays { 206 for r in c.relays {
206 relays.push(r); 207 relays.push(r);
207 } 208 }
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/send.rs b/src/sub_commands/send.rs
index cc182f1..91654d2 100644
--- a/src/sub_commands/send.rs
+++ b/src/sub_commands/send.rs
@@ -4,7 +4,10 @@ use anyhow::{bail, Context, Result};
4use console::Style; 4use console::Style;
5use futures::future::join_all; 5use futures::future::join_all;
6use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; 6use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
7use nostr::{nips::nip19::Nip19, EventBuilder, FromBech32, Marker, Tag, TagKind, UncheckedUrl}; 7use nostr::{
8 nips::{nip01::Coordinate, nip19::Nip19},
9 EventBuilder, FromBech32, Marker, Tag, TagKind, UncheckedUrl,
10};
8use nostr_sdk::hashes::sha1::Hash as Sha1Hash; 11use nostr_sdk::hashes::sha1::Hash as Sha1Hash;
9 12
10use super::list::tag_value; 13use super::list::tag_value;
@@ -539,11 +542,14 @@ pub fn generate_cover_letter_and_patch_events(
539 vec![ 542 vec![
540 // TODO: why not tag all maintainer identifiers? 543 // TODO: why not tag all maintainer identifiers?
541 Tag::A { 544 Tag::A {
542 kind: nostr::Kind::Custom(REPO_REF_KIND), 545 coordinate: Coordinate {
543 public_key: *repo_ref.maintainers.first() 546 kind: nostr::Kind::Custom(REPO_REF_KIND),
544 .context("repo reference should always have at least one maintainer - the issuer of the repo event") 547 public_key: *repo_ref.maintainers.first()
545 ?, 548 .context("repo reference should always have at least one maintainer - the issuer of the repo event")
546 identifier: repo_ref.identifier.to_string(), 549 ?,
550 identifier: repo_ref.identifier.to_string(),
551 relays: repo_ref.relays.clone(),
552 },
547 relay_url: repo_ref.relays.first().map(nostr::UncheckedUrl::from).clone(), 553 relay_url: repo_ref.relays.first().map(nostr::UncheckedUrl::from).clone(),
548 }, 554 },
549 Tag::Reference(format!("{root_commit}")), 555 Tag::Reference(format!("{root_commit}")),
@@ -795,11 +801,14 @@ pub fn generate_patch_event(
795 [ 801 [
796 vec![ 802 vec![
797 Tag::A { 803 Tag::A {
798 kind: nostr::Kind::Custom(REPO_REF_KIND), 804 coordinate: Coordinate {
799 public_key: *repo_ref.maintainers.first() 805 kind: nostr::Kind::Custom(REPO_REF_KIND),
800 .context("repo reference should always have at least one maintainer - the issuer of the repo event") 806 public_key: *repo_ref.maintainers.first()
801 ?, 807 .context("repo reference should always have at least one maintainer - the issuer of the repo event")
802 identifier: repo_ref.identifier.to_string(), 808 ?,
809 identifier: repo_ref.identifier.to_string(),
810 relays: repo_ref.relays.clone(),
811 },
803 relay_url: relay_hint.clone(), 812 relay_url: relay_hint.clone(),
804 }, 813 },
805 Tag::Reference(format!("{root_commit}")), 814 Tag::Reference(format!("{root_commit}")),