upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/bin/git_remote_nostr/utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/git_remote_nostr/utils.rs')
-rw-r--r--src/bin/git_remote_nostr/utils.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/bin/git_remote_nostr/utils.rs b/src/bin/git_remote_nostr/utils.rs
index 3a9f07d..2c77baa 100644
--- a/src/bin/git_remote_nostr/utils.rs
+++ b/src/bin/git_remote_nostr/utils.rs
@@ -216,8 +216,15 @@ pub fn get_read_protocols_to_try(
216 git_repo: &Repo, 216 git_repo: &Repo,
217 server_url: &CloneUrl, 217 server_url: &CloneUrl,
218 decoded_nostr_url: &NostrUrlDecoded, 218 decoded_nostr_url: &NostrUrlDecoded,
219 is_ngit_relay: bool,
219) -> Vec<ServerProtocol> { 220) -> Vec<ServerProtocol> {
220 if server_url.protocol() == ServerProtocol::Filesystem { 221 if is_ngit_relay {
222 if server_url.protocol() == ServerProtocol::Http {
223 vec![(ServerProtocol::UnauthHttp)]
224 } else {
225 vec![(ServerProtocol::UnauthHttps)]
226 }
227 } else if server_url.protocol() == ServerProtocol::Filesystem {
221 vec![(ServerProtocol::Filesystem)] 228 vec![(ServerProtocol::Filesystem)]
222 } else if let Some(protocol) = &decoded_nostr_url.protocol { 229 } else if let Some(protocol) = &decoded_nostr_url.protocol {
223 vec![protocol.clone()] 230 vec![protocol.clone()]
@@ -254,8 +261,15 @@ pub fn get_write_protocols_to_try(
254 git_repo: &Repo, 261 git_repo: &Repo,
255 server_url: &CloneUrl, 262 server_url: &CloneUrl,
256 decoded_nostr_url: &NostrUrlDecoded, 263 decoded_nostr_url: &NostrUrlDecoded,
264 is_ngit_relay: bool,
257) -> Vec<ServerProtocol> { 265) -> Vec<ServerProtocol> {
258 if server_url.protocol() == ServerProtocol::Filesystem { 266 if is_ngit_relay {
267 if server_url.protocol() == ServerProtocol::Http {
268 vec![(ServerProtocol::UnauthHttp)]
269 } else {
270 vec![(ServerProtocol::UnauthHttps)]
271 }
272 } else if server_url.protocol() == ServerProtocol::Filesystem {
259 vec![(ServerProtocol::Filesystem)] 273 vec![(ServerProtocol::Filesystem)]
260 } else if let Some(protocol) = &decoded_nostr_url.protocol { 274 } else if let Some(protocol) = &decoded_nostr_url.protocol {
261 vec![protocol.clone()] 275 vec![protocol.clone()]