diff options
Diffstat (limited to 'src/sub_commands')
| -rw-r--r-- | src/sub_commands/init.rs | 12 | ||||
| -rw-r--r-- | src/sub_commands/send.rs | 25 |
2 files changed, 24 insertions, 13 deletions
diff --git a/src/sub_commands/init.rs b/src/sub_commands/init.rs index a95021d..9fdcca5 100644 --- a/src/sub_commands/init.rs +++ b/src/sub_commands/init.rs | |||
| @@ -81,7 +81,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 81 | 81 | ||
| 82 | let mut maintainers = vec![keys.public_key()]; | 82 | let mut maintainers = vec![keys.public_key()]; |
| 83 | 83 | ||
| 84 | let mut repo_relays: Vec<String> = if !args.relays.is_empty() { | 84 | let repo_relays: Vec<String> = if !args.relays.is_empty() { |
| 85 | args.relays.clone() | 85 | args.relays.clone() |
| 86 | } else if let Ok(config) = &repo_config_result { | 86 | } else if let Ok(config) = &repo_config_result { |
| 87 | config.relays.clone() | 87 | config.relays.clone() |
| @@ -92,16 +92,6 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 92 | user_ref.relays.write() | 92 | user_ref.relays.write() |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | // TODO: add blaster for just repo event and don't add it to repo relays | ||
| 96 | // TODO: fix the tests to support blaster | ||
| 97 | if std::env::var("NGITTEST").is_err() | ||
| 98 | && !repo_relays | ||
| 99 | .iter() | ||
| 100 | .any(|s| s.contains("nostr.mutinywallet.com")) | ||
| 101 | { | ||
| 102 | repo_relays.push("wss://nostr.mutinywallet.com".to_string()); | ||
| 103 | } | ||
| 104 | |||
| 105 | if let Ok(config) = &repo_config_result { | 95 | if let Ok(config) = &repo_config_result { |
| 106 | maintainers = extract_pks(config.maintainers.clone())?; | 96 | maintainers = extract_pks(config.maintainers.clone())?; |
| 107 | } | 97 | } |
diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index 2c1dec8..b8cb271 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs | |||
| @@ -183,7 +183,23 @@ pub async fn send_events( | |||
| 183 | repo_read_relays: Vec<String>, | 183 | repo_read_relays: Vec<String>, |
| 184 | animate: bool, | 184 | animate: bool, |
| 185 | ) -> Result<()> { | 185 | ) -> Result<()> { |
| 186 | let (_, _, _, all) = unique_and_duplicate_all(&my_write_relays, &repo_read_relays); | 186 | let (_, _, _, mut all) = unique_and_duplicate_all(&my_write_relays, &repo_read_relays); |
| 187 | |||
| 188 | let mut fallback = client.get_fallback_relays().clone(); | ||
| 189 | |||
| 190 | // blast repo events | ||
| 191 | if events.iter().any(|e| e.kind().as_u64().eq(&REPO_REF_KIND)) { | ||
| 192 | for r in client.get_blaster_relays() { | ||
| 193 | fallback.push(r.to_string()); | ||
| 194 | } | ||
| 195 | } | ||
| 196 | |||
| 197 | // then remaining fallback list | ||
| 198 | for r in &fallback { | ||
| 199 | if !all.iter().any(|r2| r2.eq(&r)) { | ||
| 200 | all.push(r); | ||
| 201 | } | ||
| 202 | } | ||
| 187 | 203 | ||
| 188 | let m = MultiProgress::new(); | 204 | let m = MultiProgress::new(); |
| 189 | let pb_style = ProgressStyle::with_template(if animate { | 205 | let pb_style = ProgressStyle::with_template(if animate { |
| @@ -215,7 +231,7 @@ pub async fn send_events( | |||
| 215 | 231 | ||
| 216 | join_all(all.iter().map(|&relay| async { | 232 | join_all(all.iter().map(|&relay| async { |
| 217 | let details = format!( | 233 | let details = format!( |
| 218 | "{}{} {}", | 234 | "{}{}{} {}", |
| 219 | if my_write_relays.iter().any(|r| relay.eq(r)) { | 235 | if my_write_relays.iter().any(|r| relay.eq(r)) { |
| 220 | " [my-relay]" | 236 | " [my-relay]" |
| 221 | } else { | 237 | } else { |
| @@ -226,6 +242,11 @@ pub async fn send_events( | |||
| 226 | } else { | 242 | } else { |
| 227 | "" | 243 | "" |
| 228 | }, | 244 | }, |
| 245 | if fallback.iter().any(|r| relay.eq(r)) { | ||
| 246 | " [default]" | ||
| 247 | } else { | ||
| 248 | "" | ||
| 249 | }, | ||
| 229 | *relay, | 250 | *relay, |
| 230 | ); | 251 | ); |
| 231 | let pb = m.add( | 252 | let pb = m.add( |