mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 15:08:24 +00:00
refactor: fix fmt and clippy
This commit is contained in:
@@ -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
@@ -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(),
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user