refactor: fix fmt and clippy

This commit is contained in:
DanConwayDev
2025-12-02 14:42:26 +00:00
parent 6fe9d3280e
commit c9b2e08552
3 changed files with 34 additions and 26 deletions
+3 -3
View File
@@ -230,7 +230,7 @@ pub enum FixtureKind {
///
/// Stages:
/// 1. **Generated**: Creates ValidRepo (owner's announcement with maintainer in maintainers tag)
/// + MaintainerState (maintainer's state event ONLY - no announcement)
/// + MaintainerState (maintainer's state event ONLY - no announcement)
/// 2. **Sent**: Sends events to relay
/// 3. **Verified**: Confirms events accepted by relay
/// 4. **DataPushed**: Clones repo, creates maintainer deterministic commit, pushes to relay
@@ -253,8 +253,8 @@ pub enum FixtureKind {
///
/// Stages:
/// 1. **Generated**: Creates MaintainerStateDataPushed (includes ValidRepo + OwnerStateDataPushed)
/// + MaintainerAnnouncement (maintainer's announcement listing recursive maintainer)
/// + RecursiveMaintainerState (recursive maintainer's state event)
/// + MaintainerAnnouncement (maintainer's announcement listing recursive maintainer)
/// + RecursiveMaintainerState (recursive maintainer's state event)
/// 2. **Sent**: Sends events to relay
/// 3. **Verified**: Confirms events accepted by relay
/// 4. **DataPushed**: Clones repo, creates recursive maintainer deterministic commit, pushes to relay
@@ -650,7 +650,7 @@ impl PushAuthorizationTests {
///
/// This test uses the MaintainerStateDataPushed fixture which handles all 4 stages:
/// 1. **Generated**: Creates ValidRepo (owner's announcement with maintainer in maintainers tag)
/// + MaintainerState (maintainer's state event ONLY - no announcement)
/// + MaintainerState (maintainer's state event ONLY - no announcement)
/// 2. **Sent**: Sends events to relay
/// 3. **Verified**: Confirms events accepted by relay
/// 4. **DataPushed**: Clones repo, creates maintainer deterministic commit, pushes to relay
@@ -692,8 +692,8 @@ impl PushAuthorizationTests {
///
/// This test uses the RecursiveMaintainerStateDataPushed fixture which handles all 4 stages:
/// 1. **Generated**: Creates MaintainerStateDataPushed (owner's + maintainer's data pushed)
/// + MaintainerAnnouncement (maintainer lists recursive maintainer)
/// + RecursiveMaintainerState (recursive maintainer's state event)
/// + MaintainerAnnouncement (maintainer lists recursive maintainer)
/// + RecursiveMaintainerState (recursive maintainer's state event)
/// 2. **Sent**: Sends events to relay
/// 3. **Verified**: Confirms events accepted by relay
/// 4. **DataPushed**: Clones repo, creates recursive maintainer deterministic commit, pushes to relay
+28 -20
View File
@@ -293,19 +293,23 @@ impl Service<Request<Incoming>> for HttpService {
if repo_path.exists() {
// Serve repository webpage
let html = landing::get_repo_html(&config, &npub, &identifier);
Ok(add_cors_headers(Response::builder().header("server", "ngit-grasp"))
.status(200)
.header("content-type", "text/html; charset=utf-8")
.body(Full::new(Bytes::from(html)))
.unwrap())
Ok(
add_cors_headers(Response::builder().header("server", "ngit-grasp"))
.status(200)
.header("content-type", "text/html; charset=utf-8")
.body(Full::new(Bytes::from(html)))
.unwrap(),
)
} else {
// Serve 404 page for non-existent repository
let html = landing::get_404_html(&config, &npub, &identifier);
Ok(add_cors_headers(Response::builder().header("server", "ngit-grasp"))
.status(404)
.header("content-type", "text/html; charset=utf-8")
.body(Full::new(Bytes::from(html)))
.unwrap())
Ok(
add_cors_headers(Response::builder().header("server", "ngit-grasp"))
.status(404)
.header("content-type", "text/html; charset=utf-8")
.body(Full::new(Bytes::from(html)))
.unwrap(),
)
}
});
}
@@ -361,19 +365,23 @@ impl Service<Request<Incoming>> for HttpService {
if path == "/" {
// Serve landing page for root
let html = landing::get_html(&config);
Ok(add_cors_headers(Response::builder().header("server", "ngit-grasp"))
.status(200)
.header("content-type", "text/html; charset=utf-8")
.body(Full::new(Bytes::from(html)))
.unwrap())
Ok(
add_cors_headers(Response::builder().header("server", "ngit-grasp"))
.status(200)
.header("content-type", "text/html; charset=utf-8")
.body(Full::new(Bytes::from(html)))
.unwrap(),
)
} else {
// Serve generic 404 for unknown paths
let html = landing::get_generic_404_html(&config, &path);
Ok(add_cors_headers(Response::builder().header("server", "ngit-grasp"))
.status(404)
.header("content-type", "text/html; charset=utf-8")
.body(Full::new(Bytes::from(html)))
.unwrap())
Ok(
add_cors_headers(Response::builder().header("server", "ngit-grasp"))
.status(404)
.header("content-type", "text/html; charset=utf-8")
.body(Full::new(Bytes::from(html)))
.unwrap(),
)
}
})
}