diff options
Diffstat (limited to 'src/bin/git_remote_nostr/list.rs')
| -rw-r--r-- | src/bin/git_remote_nostr/list.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/bin/git_remote_nostr/list.rs b/src/bin/git_remote_nostr/list.rs index c27e4d2..b9fb0c0 100644 --- a/src/bin/git_remote_nostr/list.rs +++ b/src/bin/git_remote_nostr/list.rs | |||
| @@ -13,7 +13,7 @@ use ngit::{ | |||
| 13 | }, | 13 | }, |
| 14 | git_events::event_to_cover_letter, | 14 | git_events::event_to_cover_letter, |
| 15 | login::get_curent_user, | 15 | login::get_curent_user, |
| 16 | repo_ref::{self, is_ngit_relay}, | 16 | repo_ref::{self, is_grasp_server}, |
| 17 | }; | 17 | }; |
| 18 | use nostr_sdk::hashes::sha1::Hash as Sha1Hash; | 18 | use nostr_sdk::hashes::sha1::Hash as Sha1Hash; |
| 19 | use repo_ref::RepoRef; | 19 | use repo_ref::RepoRef; |
| @@ -41,12 +41,12 @@ pub async fn run_list( | |||
| 41 | git_repo, | 41 | git_repo, |
| 42 | &repo_ref.git_server, | 42 | &repo_ref.git_server, |
| 43 | &repo_ref.to_nostr_git_url(&None), | 43 | &repo_ref.to_nostr_git_url(&None), |
| 44 | &repo_ref.ngit_relays(), | 44 | &repo_ref.grasp_servers(), |
| 45 | ); | 45 | ); |
| 46 | 46 | ||
| 47 | let mut state = if let Some(nostr_state) = nostr_state { | 47 | let mut state = if let Some(nostr_state) = nostr_state { |
| 48 | for (name, value) in &nostr_state.state { | 48 | for (name, value) in &nostr_state.state { |
| 49 | for (url, (remote_state, _is_ngit_relay)) in &remote_states { | 49 | for (url, (remote_state, _is_grasp_server)) in &remote_states { |
| 50 | let remote_name = get_short_git_server_name(git_repo, url); | 50 | let remote_name = get_short_git_server_name(git_repo, url); |
| 51 | if let Some(remote_value) = remote_state.get(name) { | 51 | if let Some(remote_value) = remote_state.get(name) { |
| 52 | if value.ne(remote_value) { | 52 | if value.ne(remote_value) { |
| @@ -74,7 +74,7 @@ pub async fn run_list( | |||
| 74 | } | 74 | } |
| 75 | nostr_state.state | 75 | nostr_state.state |
| 76 | } else { | 76 | } else { |
| 77 | let (state, _is_ngit_relay) = repo_ref | 77 | let (state, _is_grasp_server) = repo_ref |
| 78 | .git_server | 78 | .git_server |
| 79 | .iter() | 79 | .iter() |
| 80 | .filter_map(|server| remote_states.get(server)) | 80 | .filter_map(|server| remote_states.get(server)) |
| @@ -122,7 +122,7 @@ async fn get_open_and_draft_proposals_state( | |||
| 122 | 122 | ||
| 123 | // without trusting commit_id we must apply each patch which requires the oid of | 123 | // without trusting commit_id we must apply each patch which requires the oid of |
| 124 | // the parent so we much do a fetch | 124 | // the parent so we much do a fetch |
| 125 | for (git_server_url, (oids_from_git_servers, is_ngit_relay)) in remote_states { | 125 | for (git_server_url, (oids_from_git_servers, is_grasp_server)) in remote_states { |
| 126 | if fetch_from_git_server( | 126 | if fetch_from_git_server( |
| 127 | git_repo, | 127 | git_repo, |
| 128 | &oids_from_git_servers | 128 | &oids_from_git_servers |
| @@ -133,7 +133,7 @@ async fn get_open_and_draft_proposals_state( | |||
| 133 | git_server_url, | 133 | git_server_url, |
| 134 | &repo_ref.to_nostr_git_url(&None), | 134 | &repo_ref.to_nostr_git_url(&None), |
| 135 | term, | 135 | term, |
| 136 | *is_ngit_relay, | 136 | *is_grasp_server, |
| 137 | ) | 137 | ) |
| 138 | .is_ok() | 138 | .is_ok() |
| 139 | { | 139 | { |
| @@ -178,18 +178,18 @@ pub fn list_from_remotes( | |||
| 178 | git_repo: &Repo, | 178 | git_repo: &Repo, |
| 179 | git_servers: &Vec<String>, | 179 | git_servers: &Vec<String>, |
| 180 | decoded_nostr_url: &NostrUrlDecoded, | 180 | decoded_nostr_url: &NostrUrlDecoded, |
| 181 | ngit_relays: &[String], | 181 | grasp_servers: &[String], |
| 182 | ) -> HashMap<String, (HashMap<String, String>, bool)> { | 182 | ) -> HashMap<String, (HashMap<String, String>, bool)> { |
| 183 | let mut remote_states = HashMap::new(); | 183 | let mut remote_states = HashMap::new(); |
| 184 | let mut errors = HashMap::new(); | 184 | let mut errors = HashMap::new(); |
| 185 | for url in git_servers { | 185 | for url in git_servers { |
| 186 | let is_ngit_relay = is_ngit_relay(url, ngit_relays); | 186 | let is_grasp_server = is_grasp_server(url, grasp_servers); |
| 187 | match list_from_remote(term, git_repo, url, decoded_nostr_url, is_ngit_relay) { | 187 | match list_from_remote(term, git_repo, url, decoded_nostr_url, is_grasp_server) { |
| 188 | Err(error) => { | 188 | Err(error) => { |
| 189 | errors.insert(url, error); | 189 | errors.insert(url, error); |
| 190 | } | 190 | } |
| 191 | Ok(state) => { | 191 | Ok(state) => { |
| 192 | remote_states.insert(url.to_string(), (state, is_ngit_relay)); | 192 | remote_states.insert(url.to_string(), (state, is_grasp_server)); |
| 193 | } | 193 | } |
| 194 | } | 194 | } |
| 195 | } | 195 | } |
| @@ -201,11 +201,11 @@ pub fn list_from_remote( | |||
| 201 | git_repo: &Repo, | 201 | git_repo: &Repo, |
| 202 | git_server_url: &str, | 202 | git_server_url: &str, |
| 203 | decoded_nostr_url: &NostrUrlDecoded, | 203 | decoded_nostr_url: &NostrUrlDecoded, |
| 204 | is_ngit_relay: bool, | 204 | is_grasp_server: bool, |
| 205 | ) -> Result<HashMap<String, String>> { | 205 | ) -> Result<HashMap<String, String>> { |
| 206 | let server_url = git_server_url.parse::<CloneUrl>()?; | 206 | let server_url = git_server_url.parse::<CloneUrl>()?; |
| 207 | let protocols_to_attempt = | 207 | let protocols_to_attempt = |
| 208 | get_read_protocols_to_try(git_repo, &server_url, decoded_nostr_url, is_ngit_relay); | 208 | get_read_protocols_to_try(git_repo, &server_url, decoded_nostr_url, is_grasp_server); |
| 209 | 209 | ||
| 210 | let mut failed_protocols = vec![]; | 210 | let mut failed_protocols = vec![]; |
| 211 | let mut remote_state: Option<HashMap<String, String>> = None; | 211 | let mut remote_state: Option<HashMap<String, String>> = None; |