upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-12-09 15:35:18 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2024-12-09 15:35:18 +0000
commitd8f4f7641312bff32f772cbc070b3f99ced0c8fe (patch)
tree0ca4db7b41d7c191eb91ceb1c8124b5e659a3566 /src/bin
parentf0d0e1ba1cba11d3a98a5ab0c7f1dc72b6bc4e17 (diff)
fix: fetch user relays for `send`,`push` & `init`
get the latest user relay list before pushing patches and repo announcement events
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/git_remote_nostr/main.rs13
-rw-r--r--src/bin/git_remote_nostr/push.rs2
-rw-r--r--src/bin/ngit/sub_commands/export_keys.rs1
-rw-r--r--src/bin/ngit/sub_commands/init.rs1
-rw-r--r--src/bin/ngit/sub_commands/login.rs13
-rw-r--r--src/bin/ngit/sub_commands/logout.rs13
-rw-r--r--src/bin/ngit/sub_commands/send.rs1
7 files changed, 37 insertions, 7 deletions
diff --git a/src/bin/git_remote_nostr/main.rs b/src/bin/git_remote_nostr/main.rs
index 8e12d68..5f9f712 100644
--- a/src/bin/git_remote_nostr/main.rs
+++ b/src/bin/git_remote_nostr/main.rs
@@ -36,8 +36,17 @@ async fn main() -> Result<()> {
36 36
37 let mut client = Client::default(); 37 let mut client = Client::default();
38 38
39 if let Ok((signer, _, _)) = 39 if let Ok((signer, _, _)) = load_existing_login(
40 load_existing_login(&Some(&git_repo), &None, &None, &None, None, true, false).await 40 &Some(&git_repo),
41 &None,
42 &None,
43 &None,
44 None,
45 true,
46 false,
47 false,
48 )
49 .await
41 { 50 {
42 // signer for to respond to relay auth request 51 // signer for to respond to relay auth request
43 client.set_signer(signer).await; 52 client.set_signer(signer).await;
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs
index 40e9584..6116fe2 100644
--- a/src/bin/git_remote_nostr/push.rs
+++ b/src/bin/git_remote_nostr/push.rs
@@ -127,7 +127,7 @@ pub async fn run_push(
127 } 127 }
128 128
129 let (signer, user_ref, _) = 129 let (signer, user_ref, _) =
130 login::login_or_signup(&Some(git_repo), &None, &None, Some(client)).await?; 130 login::login_or_signup(&Some(git_repo), &None, &None, Some(client), true).await?;
131 131
132 if !repo_ref.maintainers.contains(&user_ref.public_key) { 132 if !repo_ref.maintainers.contains(&user_ref.public_key) {
133 for refspec in &git_server_refspecs { 133 for refspec in &git_server_refspecs {
diff --git a/src/bin/ngit/sub_commands/export_keys.rs b/src/bin/ngit/sub_commands/export_keys.rs
index 12fc380..54a716f 100644
--- a/src/bin/ngit/sub_commands/export_keys.rs
+++ b/src/bin/ngit/sub_commands/export_keys.rs
@@ -28,6 +28,7 @@ pub async fn launch() -> Result<()> {
28 None, 28 None,
29 true, 29 true,
30 false, 30 false,
31 false,
31 ) 32 )
32 .await 33 .await
33 { 34 {
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs
index 6fc1ec4..7ed98f5 100644
--- a/src/bin/ngit/sub_commands/init.rs
+++ b/src/bin/ngit/sub_commands/init.rs
@@ -84,6 +84,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
84 &extract_signer_cli_arguments(cli_args).unwrap_or(None), 84 &extract_signer_cli_arguments(cli_args).unwrap_or(None),
85 &cli_args.password, 85 &cli_args.password,
86 Some(&client), 86 Some(&client),
87 true,
87 ) 88 )
88 .await?; 89 .await?;
89 90
diff --git a/src/bin/ngit/sub_commands/login.rs b/src/bin/ngit/sub_commands/login.rs
index 7670bc3..ccbdf01 100644
--- a/src/bin/ngit/sub_commands/login.rs
+++ b/src/bin/ngit/sub_commands/login.rs
@@ -64,8 +64,17 @@ async fn logout(git_repo: Option<&Repo>, local_only: bool) -> Result<(bool, bool
64 } else { 64 } else {
65 vec![SignerInfoSource::GitLocal, SignerInfoSource::GitGlobal] 65 vec![SignerInfoSource::GitLocal, SignerInfoSource::GitGlobal]
66 } { 66 } {
67 if let Ok((_, user_ref, source)) = 67 if let Ok((_, user_ref, source)) = load_existing_login(
68 load_existing_login(&git_repo, &None, &None, &Some(source), None, true, false).await 68 &git_repo,
69 &None,
70 &None,
71 &Some(source),
72 None,
73 true,
74 false,
75 false,
76 )
77 .await
69 { 78 {
70 match Interactor::default().choice( 79 match Interactor::default().choice(
71 PromptChoiceParms::default() 80 PromptChoiceParms::default()
diff --git a/src/bin/ngit/sub_commands/logout.rs b/src/bin/ngit/sub_commands/logout.rs
index 682c017..f3f9620 100644
--- a/src/bin/ngit/sub_commands/logout.rs
+++ b/src/bin/ngit/sub_commands/logout.rs
@@ -26,8 +26,17 @@ async fn logout(git_repo: Option<&Repo>) -> Result<()> {
26 } else { 26 } else {
27 vec![SignerInfoSource::GitLocal, SignerInfoSource::GitGlobal] 27 vec![SignerInfoSource::GitLocal, SignerInfoSource::GitGlobal]
28 } { 28 } {
29 if let Ok((_, user_ref, source)) = 29 if let Ok((_, user_ref, source)) = load_existing_login(
30 load_existing_login(&git_repo, &None, &None, &Some(source), None, true, false).await 30 &git_repo,
31 &None,
32 &None,
33 &Some(source),
34 None,
35 true,
36 false,
37 false,
38 )
39 .await
31 { 40 {
32 for item in [ 41 for item in [
33 "nostr.nsec", 42 "nostr.nsec",
diff --git a/src/bin/ngit/sub_commands/send.rs b/src/bin/ngit/sub_commands/send.rs
index e19c38b..c6c75c9 100644
--- a/src/bin/ngit/sub_commands/send.rs
+++ b/src/bin/ngit/sub_commands/send.rs
@@ -181,6 +181,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re
181 &extract_signer_cli_arguments(cli_args).unwrap_or(None), 181 &extract_signer_cli_arguments(cli_args).unwrap_or(None),
182 &cli_args.password, 182 &cli_args.password,
183 Some(&client), 183 Some(&client),
184 true,
184 ) 185 )
185 .await?; 186 .await?;
186 187