diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-02 14:42:26 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-02 14:42:26 +0000 |
| commit | c9b2e08552642bbdb67255782307abf1e7eb78d0 (patch) | |
| tree | 41d41169ac617fde9bc74dff6e334c5622e60943 | |
| parent | 6fe9d3280e2d675726c9d5c09538354992049b5d (diff) | |
refactor: fix fmt and clippy
| -rw-r--r-- | grasp-audit/src/fixtures.rs | 6 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/push_authorization.rs | 6 | ||||
| -rw-r--r-- | src/http/mod.rs | 48 |
3 files changed, 34 insertions, 26 deletions
diff --git a/grasp-audit/src/fixtures.rs b/grasp-audit/src/fixtures.rs index e48f6b9..e5a80d7 100644 --- a/grasp-audit/src/fixtures.rs +++ b/grasp-audit/src/fixtures.rs | |||
| @@ -230,7 +230,7 @@ pub enum FixtureKind { | |||
| 230 | /// | 230 | /// |
| 231 | /// Stages: | 231 | /// Stages: |
| 232 | /// 1. **Generated**: Creates ValidRepo (owner's announcement with maintainer in maintainers tag) | 232 | /// 1. **Generated**: Creates ValidRepo (owner's announcement with maintainer in maintainers tag) |
| 233 | /// + MaintainerState (maintainer's state event ONLY - no announcement) | 233 | /// + MaintainerState (maintainer's state event ONLY - no announcement) |
| 234 | /// 2. **Sent**: Sends events to relay | 234 | /// 2. **Sent**: Sends events to relay |
| 235 | /// 3. **Verified**: Confirms events accepted by relay | 235 | /// 3. **Verified**: Confirms events accepted by relay |
| 236 | /// 4. **DataPushed**: Clones repo, creates maintainer deterministic commit, pushes to relay | 236 | /// 4. **DataPushed**: Clones repo, creates maintainer deterministic commit, pushes to relay |
| @@ -253,8 +253,8 @@ pub enum FixtureKind { | |||
| 253 | /// | 253 | /// |
| 254 | /// Stages: | 254 | /// Stages: |
| 255 | /// 1. **Generated**: Creates MaintainerStateDataPushed (includes ValidRepo + OwnerStateDataPushed) | 255 | /// 1. **Generated**: Creates MaintainerStateDataPushed (includes ValidRepo + OwnerStateDataPushed) |
| 256 | /// + MaintainerAnnouncement (maintainer's announcement listing recursive maintainer) | 256 | /// + MaintainerAnnouncement (maintainer's announcement listing recursive maintainer) |
| 257 | /// + RecursiveMaintainerState (recursive maintainer's state event) | 257 | /// + RecursiveMaintainerState (recursive maintainer's state event) |
| 258 | /// 2. **Sent**: Sends events to relay | 258 | /// 2. **Sent**: Sends events to relay |
| 259 | /// 3. **Verified**: Confirms events accepted by relay | 259 | /// 3. **Verified**: Confirms events accepted by relay |
| 260 | /// 4. **DataPushed**: Clones repo, creates recursive maintainer deterministic commit, pushes to relay | 260 | /// 4. **DataPushed**: Clones repo, creates recursive maintainer deterministic commit, pushes to relay |
diff --git a/grasp-audit/src/specs/grasp01/push_authorization.rs b/grasp-audit/src/specs/grasp01/push_authorization.rs index 00b8ae9..af6247f 100644 --- a/grasp-audit/src/specs/grasp01/push_authorization.rs +++ b/grasp-audit/src/specs/grasp01/push_authorization.rs | |||
| @@ -650,7 +650,7 @@ impl PushAuthorizationTests { | |||
| 650 | /// | 650 | /// |
| 651 | /// This test uses the MaintainerStateDataPushed fixture which handles all 4 stages: | 651 | /// This test uses the MaintainerStateDataPushed fixture which handles all 4 stages: |
| 652 | /// 1. **Generated**: Creates ValidRepo (owner's announcement with maintainer in maintainers tag) | 652 | /// 1. **Generated**: Creates ValidRepo (owner's announcement with maintainer in maintainers tag) |
| 653 | /// + MaintainerState (maintainer's state event ONLY - no announcement) | 653 | /// + MaintainerState (maintainer's state event ONLY - no announcement) |
| 654 | /// 2. **Sent**: Sends events to relay | 654 | /// 2. **Sent**: Sends events to relay |
| 655 | /// 3. **Verified**: Confirms events accepted by relay | 655 | /// 3. **Verified**: Confirms events accepted by relay |
| 656 | /// 4. **DataPushed**: Clones repo, creates maintainer deterministic commit, pushes to relay | 656 | /// 4. **DataPushed**: Clones repo, creates maintainer deterministic commit, pushes to relay |
| @@ -692,8 +692,8 @@ impl PushAuthorizationTests { | |||
| 692 | /// | 692 | /// |
| 693 | /// This test uses the RecursiveMaintainerStateDataPushed fixture which handles all 4 stages: | 693 | /// This test uses the RecursiveMaintainerStateDataPushed fixture which handles all 4 stages: |
| 694 | /// 1. **Generated**: Creates MaintainerStateDataPushed (owner's + maintainer's data pushed) | 694 | /// 1. **Generated**: Creates MaintainerStateDataPushed (owner's + maintainer's data pushed) |
| 695 | /// + MaintainerAnnouncement (maintainer lists recursive maintainer) | 695 | /// + MaintainerAnnouncement (maintainer lists recursive maintainer) |
| 696 | /// + RecursiveMaintainerState (recursive maintainer's state event) | 696 | /// + RecursiveMaintainerState (recursive maintainer's state event) |
| 697 | /// 2. **Sent**: Sends events to relay | 697 | /// 2. **Sent**: Sends events to relay |
| 698 | /// 3. **Verified**: Confirms events accepted by relay | 698 | /// 3. **Verified**: Confirms events accepted by relay |
| 699 | /// 4. **DataPushed**: Clones repo, creates recursive maintainer deterministic commit, pushes to relay | 699 | /// 4. **DataPushed**: Clones repo, creates recursive maintainer deterministic commit, pushes to relay |
diff --git a/src/http/mod.rs b/src/http/mod.rs index 6da027c..c47c374 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs | |||
| @@ -293,19 +293,23 @@ impl Service<Request<Incoming>> for HttpService { | |||
| 293 | if repo_path.exists() { | 293 | if repo_path.exists() { |
| 294 | // Serve repository webpage | 294 | // Serve repository webpage |
| 295 | let html = landing::get_repo_html(&config, &npub, &identifier); | 295 | let html = landing::get_repo_html(&config, &npub, &identifier); |
| 296 | Ok(add_cors_headers(Response::builder().header("server", "ngit-grasp")) | 296 | Ok( |
| 297 | .status(200) | 297 | add_cors_headers(Response::builder().header("server", "ngit-grasp")) |
| 298 | .header("content-type", "text/html; charset=utf-8") | 298 | .status(200) |
| 299 | .body(Full::new(Bytes::from(html))) | 299 | .header("content-type", "text/html; charset=utf-8") |
| 300 | .unwrap()) | 300 | .body(Full::new(Bytes::from(html))) |
| 301 | .unwrap(), | ||
| 302 | ) | ||
| 301 | } else { | 303 | } else { |
| 302 | // Serve 404 page for non-existent repository | 304 | // Serve 404 page for non-existent repository |
| 303 | let html = landing::get_404_html(&config, &npub, &identifier); | 305 | let html = landing::get_404_html(&config, &npub, &identifier); |
| 304 | Ok(add_cors_headers(Response::builder().header("server", "ngit-grasp")) | 306 | Ok( |
| 305 | .status(404) | 307 | add_cors_headers(Response::builder().header("server", "ngit-grasp")) |
| 306 | .header("content-type", "text/html; charset=utf-8") | 308 | .status(404) |
| 307 | .body(Full::new(Bytes::from(html))) | 309 | .header("content-type", "text/html; charset=utf-8") |
| 308 | .unwrap()) | 310 | .body(Full::new(Bytes::from(html))) |
| 311 | .unwrap(), | ||
| 312 | ) | ||
| 309 | } | 313 | } |
| 310 | }); | 314 | }); |
| 311 | } | 315 | } |
| @@ -361,19 +365,23 @@ impl Service<Request<Incoming>> for HttpService { | |||
| 361 | if path == "/" { | 365 | if path == "/" { |
| 362 | // Serve landing page for root | 366 | // Serve landing page for root |
| 363 | let html = landing::get_html(&config); | 367 | let html = landing::get_html(&config); |
| 364 | Ok(add_cors_headers(Response::builder().header("server", "ngit-grasp")) | 368 | Ok( |
| 365 | .status(200) | 369 | add_cors_headers(Response::builder().header("server", "ngit-grasp")) |
| 366 | .header("content-type", "text/html; charset=utf-8") | 370 | .status(200) |
| 367 | .body(Full::new(Bytes::from(html))) | 371 | .header("content-type", "text/html; charset=utf-8") |
| 368 | .unwrap()) | 372 | .body(Full::new(Bytes::from(html))) |
| 373 | .unwrap(), | ||
| 374 | ) | ||
| 369 | } else { | 375 | } else { |
| 370 | // Serve generic 404 for unknown paths | 376 | // Serve generic 404 for unknown paths |
| 371 | let html = landing::get_generic_404_html(&config, &path); | 377 | let html = landing::get_generic_404_html(&config, &path); |
| 372 | Ok(add_cors_headers(Response::builder().header("server", "ngit-grasp")) | 378 | Ok( |
| 373 | .status(404) | 379 | add_cors_headers(Response::builder().header("server", "ngit-grasp")) |
| 374 | .header("content-type", "text/html; charset=utf-8") | 380 | .status(404) |
| 375 | .body(Full::new(Bytes::from(html))) | 381 | .header("content-type", "text/html; charset=utf-8") |
| 376 | .unwrap()) | 382 | .body(Full::new(Bytes::from(html))) |
| 383 | .unwrap(), | ||
| 384 | ) | ||
| 377 | } | 385 | } |
| 378 | }) | 386 | }) |
| 379 | } | 387 | } |