diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-25 14:26:21 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-25 14:26:21 +0000 |
| commit | 7197b0a446686e325e473c2121ede672b8348bdd (patch) | |
| tree | 637a54167cd48b695e6f424e1eecfc1481f4c7be /grasp-audit/src/probe.rs | |
| parent | 82b85ebfd097d46d8fa7de77a81aa6e1c020df29 (diff) | |
show software and version in nip11_fetch detail
Diffstat (limited to 'grasp-audit/src/probe.rs')
| -rw-r--r-- | grasp-audit/src/probe.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/grasp-audit/src/probe.rs b/grasp-audit/src/probe.rs index 1a8687e..ecbbcc9 100644 --- a/grasp-audit/src/probe.rs +++ b/grasp-audit/src/probe.rs | |||
| @@ -447,7 +447,20 @@ pub async fn run_probe( | |||
| 447 | .json::<serde_json::Value>() | 447 | .json::<serde_json::Value>() |
| 448 | .await | 448 | .await |
| 449 | .ok() | 449 | .ok() |
| 450 | .and_then(|v| v.get("name").and_then(|n| n.as_str()).map(|s| s.to_string())); | 450 | .map(|v| { |
| 451 | let name = v.get("name").and_then(|n| n.as_str()).unwrap_or("unknown"); | ||
| 452 | // software is typically a repo URL; take the last path segment | ||
| 453 | let software = v | ||
| 454 | .get("software") | ||
| 455 | .and_then(|s| s.as_str()) | ||
| 456 | .map(|s| s.trim_end_matches('/').rsplit('/').next().unwrap_or(s)) | ||
| 457 | .unwrap_or("unknown"); | ||
| 458 | let version = v | ||
| 459 | .get("version") | ||
| 460 | .and_then(|ver| ver.as_str()) | ||
| 461 | .unwrap_or("unknown"); | ||
| 462 | format!("{} ({} v{})", name, software, version) | ||
| 463 | }); | ||
| 451 | checks.push(ProbeCheck { | 464 | checks.push(ProbeCheck { |
| 452 | name: "nip11_fetch", | 465 | name: "nip11_fetch", |
| 453 | passed: true, | 466 | passed: true, |