From 5dbac4d643f4dc5110bf9971e29598dfc30d75f0 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 28 Nov 2024 15:07:02 +0000 Subject: feat(init): user read or fallback relays as default instead of user write or none --- src/bin/ngit/sub_commands/init.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/bin') diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 1b9ba5e..3dc63ad 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs @@ -302,21 +302,25 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { args.clone_url.clone() }; - // TODO: check if relays are free to post to so contributors can submit patches - // TODO: recommend some reliable free ones + // TODO: when NIP-66 is functional, use this to reccommend relays and filter out + // relays that won't accept contributors events. NIP-11 'limitations' + // isn't widely used enough to be usedful. + let relays: Vec = { let mut default = if let Ok(config) = &repo_config_result { - config.relays.clone().join(" ") + config.relays.clone() } else if let Some(repo_ref) = &repo_ref { repo_ref .relays .iter() .map(std::string::ToString::to_string) .collect::>() - .join(" ") + } else if user_ref.relays.read().is_empty() { + client.get_fallback_relays().clone() } else { - user_ref.relays.write().join(" ") - }; + user_ref.relays.read().clone() + } + .join(" "); 'outer: loop { let relays: Vec = if args.relays.is_empty() { Interactor::default() -- cgit v1.2.3