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:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-07-22 13:47:28 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-07-22 13:47:28 +0100
commitd1283a6b55826175423bd382a859928e0f92ffe7 (patch)
tree7542e5ceb6bdf3b1359a85511edb72b8cdc7c7da /src
parenta3d4c8eaa263f4adb174ac81c4248fa200e1857e (diff)
fix: remove blossom from grasp server detection
a grasp server doesnt need to appear in repo announcement event `blossoms` tag as blossom has been removed from the grasp spec
Diffstat (limited to 'src')
-rw-r--r--src/bin/ngit/sub_commands/init.rs1
-rw-r--r--src/lib/repo_ref.rs23
2 files changed, 1 insertions, 23 deletions
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs
index 1242e45..86d7f8a 100644
--- a/src/bin/ngit/sub_commands/init.rs
+++ b/src/bin/ngit/sub_commands/init.rs
@@ -269,7 +269,6 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
269 repo_ref.as_ref(), 269 repo_ref.as_ref(),
270 &args.relays, 270 &args.relays,
271 &args.clone_url, 271 &args.clone_url,
272 &args.blossoms,
273 &identifier, 272 &identifier,
274 ); 273 );
275 let mut selections: Vec<bool> = vec![true; options.len()]; // Initialize selections based on existing options 274 let mut selections: Vec<bool> = vec![true; options.len()]; // Initialize selections based on existing options
diff --git a/src/lib/repo_ref.rs b/src/lib/repo_ref.rs
index 0236e34..bca4a3b 100644
--- a/src/lib/repo_ref.rs
+++ b/src/lib/repo_ref.rs
@@ -309,7 +309,7 @@ impl RepoRef {
309 } 309 }
310 310
311 pub fn grasp_servers(&self) -> Vec<String> { 311 pub fn grasp_servers(&self) -> Vec<String> {
312 detect_existing_grasp_servers(Some(self), &[], &[], &[], &self.identifier) 312 detect_existing_grasp_servers(Some(self), &[], &[], &self.identifier)
313 } 313 }
314} 314}
315 315
@@ -593,7 +593,6 @@ pub fn detect_existing_grasp_servers(
593 repo_ref: Option<&RepoRef>, 593 repo_ref: Option<&RepoRef>,
594 args_relays: &[String], 594 args_relays: &[String],
595 args_clone_url: &[String], 595 args_clone_url: &[String],
596 args_blossoms: &[String],
597 identifier: &str, 596 identifier: &str,
598) -> Vec<String> { 597) -> Vec<String> {
599 // Collect clone URLs from arguments or repo_ref 598 // Collect clone URLs from arguments or repo_ref
@@ -617,18 +616,6 @@ pub fn detect_existing_grasp_servers(
617 Vec::new() 616 Vec::new()
618 }; 617 };
619 618
620 // Collect blossom server URLs from arguments or repo_ref
621 let blossoms: Vec<Url> = if !args_blossoms.is_empty() {
622 args_blossoms
623 .iter()
624 .filter_map(|r| Url::parse(r).ok())
625 .collect()
626 } else if let Some(repo) = repo_ref {
627 repo.blossoms.clone()
628 } else {
629 Vec::new()
630 };
631
632 let mut existing_grasp_servers = Vec::new(); 619 let mut existing_grasp_servers = Vec::new();
633 for url in &clone_urls { 620 for url in &clone_urls {
634 let Ok(formatted_as_grasp_server_url) = normalize_grasp_server_url(url) else { 621 let Ok(formatted_as_grasp_server_url) = normalize_grasp_server_url(url) else {
@@ -655,14 +642,6 @@ pub fn detect_existing_grasp_servers(
655 continue; 642 continue;
656 } 643 }
657 644
658 let matches_blossoms = blossoms.iter().any(|r| {
659 normalize_grasp_server_url(r.as_str())
660 .is_ok_and(|r| r.eq(&formatted_as_grasp_server_url))
661 });
662 if !matches_blossoms {
663 continue;
664 }
665
666 existing_grasp_servers.push(formatted_as_grasp_server_url); 645 existing_grasp_servers.push(formatted_as_grasp_server_url);
667 } 646 }
668 existing_grasp_servers 647 existing_grasp_servers