From dd5300b301292c3944aad4dcdecf4802307c7ea2 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 23 Jul 2025 13:53:18 +0100 Subject: refactor: add fallback grasp servers to client so that they can be used as part of push and send --- src/bin/ngit/sub_commands/init.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/bin') diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 86d7f8a..52e43e9 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs @@ -252,14 +252,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { args.blossoms.clone() }; - let fallback_grasp_servers = - if let Ok(Some(s)) = git_repo.get_git_config_item("nostr.grasp-default-set", None) { - s.split(';') - .filter_map(|url| normalize_grasp_server_url(url).ok()) // Attempt to parse and filter out errors - .collect() - } else { - vec!["relay.ngit.dev".to_string(), "gitnostr.com".to_string()] - }; + let fallback_grasp_servers = client.get_fallback_grasp_servers(); let selected_grasp_servers = if has_server_and_relay_flags { // ignore so a script running `ngit init` can contiue without prompts @@ -275,7 +268,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { let empty = options.is_empty(); for fallback in fallback_grasp_servers { // Check if any option contains the fallback as a substring - if !options.iter().any(|option| option.contains(&fallback)) { + if !options.iter().any(|option| option.contains(fallback)) { options.push(fallback.clone()); // Add fallback if not found selections.push(empty); // mark as selected if no existing ngit relay otherwise not } -- cgit v1.2.3