Why Nostr? What is Njump?
2024-07-03 00:50:47

npub1l0…8893x on Nostr: commit dcbd8f8ea0c44254b46bedf3727dbf1449ce4a48 Author: randymcmillan ...

commit dcbd8f8ea0c44254b46bedf3727dbf1449ce4a48
Author: randymcmillan <[email protected]>
Date: Sat May 4 22:28:51 2024 -0400

gnostr-fetc-watch-list-iterator.rs use src/watch_list.rs

diff --git a/bins/src/bin/gnostr-fetch-watch-list-iterator.rs b/bins/src/bin/gnostr-fetch-watch-list-iterator.rs
index 272d6d22e..5963f03e0 100644
--- a/bins/src/bin/gnostr-fetch-watch-list-iterator.rs
+++ b/bins/src/bin/gnostr-fetch-watch-list-iterator.rs
@@ -1,36 +1,8 @@
use futures::executor::block_on;
-use url::Url;
-use gnostr_bins::watch_list;
-async fn parse_urls(urls_str: &str) -> Result<Vec<String>, url::ParseError> {
- let mut urls: Vec<String> = Vec::new();
- let mut part = String::new();
- let mut collected = Vec::new();
- let mut char_iter = urls_str.chars();
- for url_str in urls_str.chars() {
- if char_iter.next() == Some('[') {}
- loop {
- match char_iter.next() {
- Some(']') => {
- return std::result::Result::Ok(collected);
- }
- Some(',') | Some(' ') => {
- if !part.is_empty() {
- collected.push(part.clone());
- print!("{}\n", format!("{}",part.clone().replace("\"", "")));
- part = String::new();
- }
- }
- x => part.push(x.expect("REASON")),
- }
- } //end loop
- }
- Ok(urls)
-}
-
-async fn print_relay_list() {
- let vec_relay_list = parse_urls(&gnostr_bins::get_relays_public().unwrap().as_str()).await;
-}
+use gnostr_bins::print_watch_list;
fn main() {
- let future = print_relay_list(); // Nothing is printed
+
+ let future = print_watch_list(); // Nothing is printed
block_on(future);
+
}
diff --git a/bins/src/watch_list.rs b/bins/src/watch_list.rs
index 381548381..a3ebd5dbe 100644
--- a/bins/src/watch_list.rs
+++ b/bins/src/watch_list.rs
@@ -27,11 +27,7 @@ pub async fn parse_urls(urls_str: &str) -> Result<Vec<String>, url::ParseError>
Ok(urls)
}

-pub async fn watch_list() {
+pub async fn print_watch_list() -> Result<Vec<String>, url::ParseError> {
let vec_relay_list = parse_urls(&get_relays_public().unwrap().as_str()).await;
+ vec_relay_list//.expect("REASON")
}
-//pub async fn watch_list() -> Result<Vec<String>, url::ParseError> {
-// let future = watch_list(); // Nothing is printed
-// let list = block_on(future);
-// Ok(list)
-//}
Author Public Key
npub1l054yz65lm652zmg7qfsdc7dam6e0adcf28u58eg8sae97866l6s58893x