Why Nostr? What is Njump?
2024-07-03 00:49:41

npub1u2…scsea on Nostr: commit fafa565b91993937993bb0cc91f701182c5a8f03 Author: randymcmillan ...

commit fafa565b91993937993bb0cc91f701182c5a8f03
Author: randymcmillan <[email protected]>
Date: Tue May 14 13:32:40 2024 -0400

src/watch_list.rs:clean up:remove

let mut urls: Vec<String> = Vec::new();

diff --git a/bins/src/watch_list.rs b/bins/src/watch_list.rs
index 395596a24..8a69b1f0e 100644
--- a/bins/src/watch_list.rs
+++ b/bins/src/watch_list.rs
@@ -12,7 +12,6 @@ struct Relay {
}

pub async fn parse_json(urls_str: &str) -> Result<Vec<String>> {
- let mut urls: Vec<String> = Vec::new();
let mut part = String::new();
let mut collected = Vec::new();
let mut char_iter = urls_str.chars();
@@ -29,11 +28,12 @@ pub async fn parse_json(urls_str: &str) -> Result<Vec<String>> {
}
Some(',') | Some(' ') => {
if !part.is_empty() {
- let relay = Relay {
- url: part.to_owned(),
- };
- let j = serde_json::to_string(&relay)?;
- print!("{},", format!("{}", j.clone().replace("\\\"", "")));
+ collected.push(part.clone());
+ let relay = Relay {
+ url: part.to_owned(),
+ };
+ let j = serde_json::to_string(&relay)?;
+ print!("{},", format!("{}", j.clone().replace("\\\"", "")));
collected.push(part.clone());
part = String::new();
} //end if !part.is_empty()
@@ -42,10 +42,9 @@ pub async fn parse_json(urls_str: &str) -> Result<Vec<String>> {
} //end match
} //end loop
}
- Ok(urls)
+ Ok(collected)
}
pub async fn parse_urls(urls_str: &str) -> Result<Vec<String>> {
- let mut urls: Vec<String> = Vec::new();
let mut part = String::new();
let mut collected = Vec::new();
let mut char_iter = urls_str.chars();
@@ -68,10 +67,9 @@ pub async fn parse_urls(urls_str: &str) -> Result<Vec<String>> {
}
} //end loop
}
- Ok(urls)
+ Ok(collected)
}
pub async fn stripped_urls(urls_str: &str) -> Result<Vec<String>> {
- let mut urls: Vec<String> = Vec::new();
let mut part = String::new();
let mut collected = Vec::new();
let mut char_iter = urls_str.chars();
@@ -86,6 +84,7 @@ pub async fn stripped_urls(urls_str: &str) -> Result<Vec<String>> {
Some(' ') | Some(',') => {
if !part.is_empty() {
collected.push(part.clone());
+ //print!("{}:{}",collected.len(),collected[collected.len()-1]);
print!("{} ",
format!("{}",
part.clone()
@@ -102,7 +101,7 @@ pub async fn stripped_urls(urls_str: &str) -> Result<Vec<String>> {
}
} //end loop
}
- Ok(urls)
+ Ok(collected)
}

pub async fn print_watch_list() -> Result<Vec<String>> {
Author Public Key
npub1u22dcs9my85nvypqe7d6cdz0s45spyyc7enyccgswd9ew8lhvhrq0scsea