diff options
Diffstat (limited to 'src/repo_ref.rs')
| -rw-r--r-- | src/repo_ref.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/repo_ref.rs b/src/repo_ref.rs index 2dab79c..3e8db64 100644 --- a/src/repo_ref.rs +++ b/src/repo_ref.rs | |||
| @@ -20,7 +20,7 @@ pub struct RepoRef { | |||
| 20 | pub description: String, | 20 | pub description: String, |
| 21 | pub identifier: String, | 21 | pub identifier: String, |
| 22 | pub root_commit: String, | 22 | pub root_commit: String, |
| 23 | pub git_server: String, | 23 | pub git_server: Vec<String>, |
| 24 | pub web: Vec<String>, | 24 | pub web: Vec<String>, |
| 25 | pub relays: Vec<String>, | 25 | pub relays: Vec<String>, |
| 26 | pub maintainers: Vec<PublicKey>, | 26 | pub maintainers: Vec<PublicKey>, |
| @@ -49,7 +49,8 @@ impl TryFrom<nostr::Event> for RepoRef { | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | if let Some(t) = event.tags.iter().find(|t| t.as_vec()[0].eq("clone")) { | 51 | if let Some(t) = event.tags.iter().find(|t| t.as_vec()[0].eq("clone")) { |
| 52 | r.git_server = t.as_vec()[1].clone(); | 52 | r.git_server = t.as_vec().clone(); |
| 53 | r.git_server.remove(0); | ||
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | if let Some(t) = event.tags.iter().find(|t| t.as_vec()[0].eq("web")) { | 56 | if let Some(t) = event.tags.iter().find(|t| t.as_vec()[0].eq("web")) { |
| @@ -121,7 +122,7 @@ impl RepoRef { | |||
| 121 | Tag::Description(self.description.clone()), | 122 | Tag::Description(self.description.clone()), |
| 122 | Tag::Generic( | 123 | Tag::Generic( |
| 123 | nostr::TagKind::Custom("clone".to_string()), | 124 | nostr::TagKind::Custom("clone".to_string()), |
| 124 | vec![self.git_server.clone()], | 125 | self.git_server.clone(), |
| 125 | ), | 126 | ), |
| 126 | Tag::Generic(nostr::TagKind::Custom("web".to_string()), self.web.clone()), | 127 | Tag::Generic(nostr::TagKind::Custom("web".to_string()), self.web.clone()), |
| 127 | Tag::Generic( | 128 | Tag::Generic( |
| @@ -303,7 +304,7 @@ mod tests { | |||
| 303 | name: "test name".to_string(), | 304 | name: "test name".to_string(), |
| 304 | description: "test description".to_string(), | 305 | description: "test description".to_string(), |
| 305 | root_commit: "5e664e5a7845cd1373c79f580ca4fe29ab5b34d2".to_string(), | 306 | root_commit: "5e664e5a7845cd1373c79f580ca4fe29ab5b34d2".to_string(), |
| 306 | git_server: "https://localhost:1000".to_string(), | 307 | git_server: vec!["https://localhost:1000".to_string()], |
| 307 | web: vec![ | 308 | web: vec![ |
| 308 | "https://exampleproject.xyz".to_string(), | 309 | "https://exampleproject.xyz".to_string(), |
| 309 | "https://gitworkshop.dev/123".to_string(), | 310 | "https://gitworkshop.dev/123".to_string(), |
| @@ -394,7 +395,7 @@ mod tests { | |||
| 394 | fn git_server() { | 395 | fn git_server() { |
| 395 | assert_eq!( | 396 | assert_eq!( |
| 396 | RepoRef::try_from(create()).unwrap().git_server, | 397 | RepoRef::try_from(create()).unwrap().git_server, |
| 397 | "https://localhost:1000", | 398 | vec!["https://localhost:1000"], |
| 398 | ) | 399 | ) |
| 399 | } | 400 | } |
| 400 | 401 | ||