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>2025-04-28 08:00:09 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-04-28 08:04:35 +0100
commit0f3969325385f2707e359cb28d9c49c509310452 (patch)
treea164acf2aaf5ae01a6e1156f1490e5e953f3b595 /src/bin
parent29688c2cfe32a27dd9faabd66691f6db1cd4818a (diff)
fix(init): replace legacy gitworkshop url
with new format. but both default option and when previous web string used legacy format
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/ngit/sub_commands/init.rs36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs
index 3731e3a..9c544d6 100644
--- a/src/bin/ngit/sub_commands/init.rs
+++ b/src/bin/ngit/sub_commands/init.rs
@@ -356,15 +356,47 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
356 }; 356 };
357 357
358 let web: Vec<String> = if args.web.is_empty() { 358 let web: Vec<String> = if args.web.is_empty() {
359 let gitworkshop_url = NostrUrlDecoded {
360 original_string: String::new(),
361 coordinate: Nip19Coordinate {
362 coordinate: Coordinate {
363 public_key: user_ref.public_key,
364 kind: Kind::GitRepoAnnouncement,
365 identifier: identifier.clone(),
366 },
367 relays: if let Some(relay) = relays.first() {
368 vec![relay.clone()]
369 } else {
370 vec![]
371 },
372 },
373 protocol: None,
374 user: None,
375 nip05: None,
376 }
377 .to_string()
378 .replace("nostr://", "https://gitworkshop.dev/");
359 Interactor::default() 379 Interactor::default()
360 .input( 380 .input(
361 PromptInputParms::default() 381 PromptInputParms::default()
362 .with_prompt("repo website") 382 .with_prompt("repo website")
363 .optional() 383 .optional()
364 .with_default(if let Some(repo_ref) = &repo_ref { 384 .with_default(if let Some(repo_ref) = &repo_ref {
365 repo_ref.web.clone().join(" ") 385 if repo_ref
386 .web
387 .clone()
388 .join(" ")
389 // replace legacy gitworkshop.dev url format with new one
390 .contains(
391 format!("https://gitworkshop.dev/repo/{}", &identifier).as_str(),
392 )
393 {
394 gitworkshop_url
395 } else {
396 repo_ref.web.clone().join(" ")
397 }
366 } else { 398 } else {
367 format!("https://gitworkshop.dev/repo/{}", &identifier) 399 gitworkshop_url
368 }), 400 }),
369 )? 401 )?
370 .split(' ') 402 .split(' ')