refactor: Support more than one naddr instead of one
This commit supports multiple naddrs for sending issues to and searching for repositories by extracting the embedded relays, and appending to the address file instead of overwriting its previous contents. A header has also been added to the `nostr-address` file to clarify its purpose. This enhancement accommodates maintainers who distribute issue tracking across multiple repositories, preventing confusion if the primary maintainer steps down. Now, issues and patches will reference all relevant repositories, not just one. Note that repositories won't automatically include all maintainers' addresses unless explicitly specified. Maintainers may manage a repository under a project-specific public key rather than individual keys. Addresses are only added to issues and patches when explicitly provided via the command or written to the address file. This prevents unintended inclusions and ensures clarity. Suggested-by: DanConwayDev <DanConwayDev@protonmail.com> Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
@@ -20,6 +20,7 @@ use nostr::{
|
||||
key::PublicKey,
|
||||
nips::{
|
||||
nip01::Coordinate,
|
||||
nip19::Nip19Coordinate,
|
||||
nip21::Nip21,
|
||||
nip34::{GitIssue, GitRepositoryAnnouncement},
|
||||
},
|
||||
@@ -164,3 +165,26 @@ impl Token<'_> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Utility functions for working with lists of NIP-19 coordinates
|
||||
#[easy_ext::ext(NaddrsUtils)]
|
||||
impl Vec<Nip19Coordinate> {
|
||||
/// Converts these coordinate addresses to basic coordinates
|
||||
pub fn into_coordinates(self) -> Vec<Coordinate> {
|
||||
self.into_iter().map(|n| n.coordinate).collect()
|
||||
}
|
||||
|
||||
/// Extracts all relay URLs from these coordinates
|
||||
pub fn extract_relays(&self) -> Vec<RelayUrl> {
|
||||
self.iter().flat_map(|n| n.relays.clone()).collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// Utility functions for working with lists of repository announcement
|
||||
#[easy_ext::ext(ReposUtils)]
|
||||
impl Vec<GitRepositoryAnnouncement> {
|
||||
/// Extracts all relay URLs from these reposotoies
|
||||
pub fn extract_relays(&self) -> Vec<RelayUrl> {
|
||||
self.iter().flat_map(|n| n.relays.clone()).collect()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user