diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-03 15:30:37 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-03 15:30:37 +0100 |
| commit | a825311f2c55661aaab3a163bda9109295c96044 (patch) | |
| tree | af56db8858187a540ae90c38998a5222c8cc1f01 /src/repo_ref.rs | |
| parent | a0fdc17426afa0e55a2a3b733983bab763226e5a (diff) | |
feat(remote): enhance nostr url format
add protocol and user parameters so that users can overide the
protcol in the clone url and use specific protocols for
fetch and push. see:
nostr:nevent1qvzqqqqqqypzpgqgmmc409hm4xsdd74sf68a2uyf9pwel4g9mfdg8l5244t6x4jdqyxhwumn8ghj7mn0wvhxcmmvqqsp6a5ck6grd9lq0nu25dcfzggxde67erut76w0ucal5rcfq4y5gzc7gmpzm
the override feature hasn't been implemented yet but
this is an enabler.
also added a new format so that macos (zsh) users don't
have to use quotes:
nostr://<optional-protocol>/npub123/<optional-relay>/identifer
Diffstat (limited to 'src/repo_ref.rs')
| -rw-r--r-- | src/repo_ref.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/repo_ref.rs b/src/repo_ref.rs index 94af864..0e57d96 100644 --- a/src/repo_ref.rs +++ b/src/repo_ref.rs | |||
| @@ -16,7 +16,7 @@ use crate::client::Client; | |||
| 16 | use crate::{ | 16 | use crate::{ |
| 17 | cli_interactor::{Interactor, InteractorPrompt, PromptInputParms}, | 17 | cli_interactor::{Interactor, InteractorPrompt, PromptInputParms}, |
| 18 | client::{get_event_from_global_cache, get_events_from_cache, sign_event, Connect}, | 18 | client::{get_event_from_global_cache, get_events_from_cache, sign_event, Connect}, |
| 19 | git::{nostr_git_url_to_repo_coordinates, Repo, RepoActions}, | 19 | git::{NostrUrlDecoded, Repo, RepoActions}, |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | #[derive(Default)] | 22 | #[derive(Default)] |
| @@ -263,8 +263,8 @@ fn get_repo_coordinates_from_nostr_remotes(git_repo: &Repo) -> Result<HashSet<Co | |||
| 263 | let mut repo_coordinates = HashSet::new(); | 263 | let mut repo_coordinates = HashSet::new(); |
| 264 | for remote_name in git_repo.git_repo.remotes()?.iter().flatten() { | 264 | for remote_name in git_repo.git_repo.remotes()?.iter().flatten() { |
| 265 | if let Some(remote_url) = git_repo.git_repo.find_remote(remote_name)?.url() { | 265 | if let Some(remote_url) = git_repo.git_repo.find_remote(remote_name)?.url() { |
| 266 | if let Ok(coordinates) = nostr_git_url_to_repo_coordinates(remote_url) { | 266 | if let Ok(nostr_url_decoded) = NostrUrlDecoded::from_str(remote_url) { |
| 267 | for c in coordinates { | 267 | for c in nostr_url_decoded.coordinates { |
| 268 | repo_coordinates.insert(c); | 268 | repo_coordinates.insert(c); |
| 269 | } | 269 | } |
| 270 | } | 270 | } |