diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-10-31 16:31:19 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-10-31 16:31:19 +0000 |
| commit | 5d6d2db3e6de2c4e1d1ebd6bde9bd02a889b4d09 (patch) | |
| tree | eb3e2fad090f8c04a4ceabc2c9e3427e56fdcab4 /src/bin/ngit/sub_commands | |
| parent | 8f6c8f6f148a108cbbe11892fffc5cef729526c4 (diff) | |
feat(init): support nostr state opt-out
when multiple maintainers enable opting out of storing state on nostr
this prevents other maintainers from pushing a state to the
git server which nostr servers wouldnt see because they are using the
nostr state.
Diffstat (limited to 'src/bin/ngit/sub_commands')
| -rw-r--r-- | src/bin/ngit/sub_commands/init.rs | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 05160a8..1d6d0e9 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs | |||
| @@ -252,19 +252,41 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 252 | .await? | 252 | .await? |
| 253 | .to_bech32()? | 253 | .to_bech32()? |
| 254 | .eq(&maintainers_string) | 254 | .eq(&maintainers_string) |
| 255 | && Interactor::default().confirm( | 255 | { |
| 256 | if Interactor::default().confirm( | ||
| 256 | PromptConfirmParms::default() | 257 | PromptConfirmParms::default() |
| 257 | .with_prompt("are you the only maintainer?") | 258 | .with_prompt("are you the only maintainer?") |
| 258 | .with_default(true), | 259 | .with_default(true), |
| 259 | )? | 260 | )? { |
| 260 | { | 261 | dont_ask = true; |
| 261 | dont_ask = true; | 262 | } else { |
| 263 | let mut opt_out_default = false; | ||
| 264 | if !Interactor::default().confirm( | ||
| 265 | PromptConfirmParms::default() | ||
| 266 | .with_prompt("are the other maintainers on nostr?") | ||
| 267 | .with_default(true), | ||
| 268 | )? { | ||
| 269 | opt_out_default = true; | ||
| 270 | dont_ask = true; | ||
| 271 | } | ||
| 272 | println!( | ||
| 273 | "nostr can reduce the trust placed in git servers by storing the state of git branches and tags. if you have other maintainers not using git via nostr, the verifiable state can fall behind the git server." | ||
| 274 | ); | ||
| 275 | |||
| 276 | if Interactor::default().confirm( | ||
| 277 | PromptConfirmParms::default() | ||
| 278 | .with_prompt("opt-out of storing git state on nostr and relay on git server for now? you will still receive PRs and issues via nostr") | ||
| 279 | .with_default(true), | ||
| 280 | )? { | ||
| 281 | git_repo.save_git_config_item("nostr.nostate", "true", opt_out_default)?; | ||
| 282 | } | ||
| 283 | } | ||
| 262 | } | 284 | } |
| 263 | if !dont_ask { | 285 | if !dont_ask { |
| 264 | println!("{}", &maintainers_string); | 286 | println!("{}", &maintainers_string); |
| 265 | maintainers_string = Interactor::default().input( | 287 | maintainers_string = Interactor::default().input( |
| 266 | PromptInputParms::default() | 288 | PromptInputParms::default() |
| 267 | .with_prompt("maintainers") | 289 | .with_prompt("maintainers - space seperated list of npubs") |
| 268 | .with_default(maintainers_string), | 290 | .with_default(maintainers_string), |
| 269 | )?; | 291 | )?; |
| 270 | } | 292 | } |
| @@ -273,7 +295,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 273 | if let Ok(m_pubkey) = PublicKey::from_bech32(m) { | 295 | if let Ok(m_pubkey) = PublicKey::from_bech32(m) { |
| 274 | maintainers.push(m_pubkey); | 296 | maintainers.push(m_pubkey); |
| 275 | } else { | 297 | } else { |
| 276 | println!("not a valid set of npubs seperated by a space"); | 298 | println!("not a valid set of space seperated npubs"); |
| 277 | dont_ask = false; | 299 | dont_ask = false; |
| 278 | continue 'outer; | 300 | continue 'outer; |
| 279 | } | 301 | } |