upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/lib/git_events.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-04-01 14:31:34 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-04-01 14:35:50 +0100
commit948fe972eb2bddf187b79f2673a091b6331cfd90 (patch)
treeec1c538d28108b104b5a00afd673631538f9aa00 /src/lib/git_events.rs
parent70966d571fce16f707725c6b0af0fd585bfce607 (diff)
chore: bump rust-nostr v0.37 ~> v0.40
and fix all of the breaking changes
Diffstat (limited to 'src/lib/git_events.rs')
-rw-r--r--src/lib/git_events.rs42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/lib/git_events.rs b/src/lib/git_events.rs
index 559155a..2b3df42 100644
--- a/src/lib/git_events.rs
+++ b/src/lib/git_events.rs
@@ -3,7 +3,7 @@ use std::{str::FromStr, sync::Arc};
3use anyhow::{Context, Result, bail}; 3use anyhow::{Context, Result, bail};
4use nostr::nips::{nip01::Coordinate, nip10::Marker, nip19::Nip19}; 4use nostr::nips::{nip01::Coordinate, nip10::Marker, nip19::Nip19};
5use nostr_sdk::{ 5use nostr_sdk::{
6 Event, EventBuilder, EventId, FromBech32, Kind, NostrSigner, PublicKey, RelayUrl, Tag, TagKind, 6 Event, EventBuilder, EventId, FromBech32, Kind, NostrSigner, PublicKey, Tag, TagKind,
7 TagStandard, hashes::sha1::Hash as Sha1Hash, 7 TagStandard, hashes::sha1::Hash as Sha1Hash,
8}; 8};
9 9
@@ -115,11 +115,14 @@ pub async fn generate_patch_event(
115 .maintainers 115 .maintainers
116 .iter() 116 .iter()
117 .map(|m| { 117 .map(|m| {
118 Tag::coordinate(Coordinate { 118 Tag::from_standardized(TagStandard::Coordinate {
119 kind: nostr::Kind::GitRepoAnnouncement, 119 coordinate: Coordinate {
120 public_key: *m, 120 kind: nostr::Kind::GitRepoAnnouncement,
121 identifier: repo_ref.identifier.to_string(), 121 public_key: *m,
122 relays: repo_ref.relays.clone(), 122 identifier: repo_ref.identifier.to_string(),
123 },
124 relay_url: repo_ref.relays.first().cloned(),
125 uppercase: false,
123 }) 126 })
124 }) 127 })
125 .collect::<Vec<Tag>>(), 128 .collect::<Vec<Tag>>(),
@@ -257,12 +260,12 @@ pub fn event_tag_from_nip19_or_hex(
257 PromptInputParms::default().with_prompt(format!("{reference_name} reference")), 260 PromptInputParms::default().with_prompt(format!("{reference_name} reference")),
258 )?; 261 )?;
259 } 262 }
260 if let Ok(nip19) = Nip19::from_bech32(bech32.clone()) { 263 if let Ok(nip19) = Nip19::from_bech32(&bech32) {
261 match nip19 { 264 match nip19 {
262 Nip19::Event(n) => { 265 Nip19::Event(n) => {
263 break Ok(Tag::from_standardized(nostr_sdk::TagStandard::Event { 266 break Ok(Tag::from_standardized(nostr_sdk::TagStandard::Event {
264 event_id: n.event_id, 267 event_id: n.event_id,
265 relay_url: n.relays.first().and_then(|url| RelayUrl::parse(url).ok()), 268 relay_url: n.relays.first().cloned(),
266 marker: Some(marker), 269 marker: Some(marker),
267 public_key: None, 270 public_key: None,
268 uppercase: false, 271 uppercase: false,
@@ -278,7 +281,11 @@ pub fn event_tag_from_nip19_or_hex(
278 })); 281 }));
279 } 282 }
280 Nip19::Coordinate(coordinate) => { 283 Nip19::Coordinate(coordinate) => {
281 break Ok(Tag::coordinate(coordinate)); 284 break Ok(Tag::from_standardized(TagStandard::Coordinate {
285 coordinate: coordinate.coordinate,
286 relay_url: coordinate.relays.first().cloned(),
287 uppercase: false,
288 }));
282 } 289 }
283 Nip19::Profile(profile) => { 290 Nip19::Profile(profile) => {
284 if allow_npub_reference { 291 if allow_npub_reference {
@@ -338,12 +345,17 @@ pub async fn generate_cover_letter_and_patch_events(
338 )) 345 ))
339 .tags( 346 .tags(
340 [ 347 [
341 repo_ref.maintainers.iter().map(|m| Tag::coordinate(Coordinate { 348 repo_ref.maintainers.iter().map(|m|
342 kind: nostr::Kind::GitRepoAnnouncement, 349 Tag::from_standardized(TagStandard::Coordinate {
343 public_key: *m, 350 coordinate: Coordinate {
344 identifier: repo_ref.identifier.to_string(), 351 kind: nostr::Kind::GitRepoAnnouncement,
345 relays: repo_ref.relays.clone(), 352 public_key: *m,
346 })).collect::<Vec<Tag>>(), 353 identifier: repo_ref.identifier.to_string(),
354 },
355 relay_url: repo_ref.relays.first().cloned(),
356 uppercase: false,
357 })
358 ).collect::<Vec<Tag>>(),
347 vec![ 359 vec![
348 Tag::from_standardized(TagStandard::Reference(format!("{root_commit}"))), 360 Tag::from_standardized(TagStandard::Reference(format!("{root_commit}"))),
349 Tag::hashtag("cover-letter"), 361 Tag::hashtag("cover-letter"),