kitgit

tirbofish/kitgit · commit

03480d94a8d5b8cc81b1d452701f5aa014b465ce

feat: polish signed commit verification badges

Verified

Thribhu K <4tkbytes@pm.me> · 2026-07-28 15:12

view full diff

diff --git a/src/web/routes.rs b/src/web/routes.rs
index c080f6f..66cf2f9 100644
--- a/src/web/routes.rs
+++ b/src/web/routes.rs
@@ -2491,6 +2491,7 @@ async fn commit_view(
     c: git::CommitInfo,
     extracted: Option<(String, Vec<u8>)>,
 ) -> CommitView {
+    let signed = extracted.is_some();
     let verification = match extracted {
         Some((sig, payload)) => {
             git::verify_commit_signature(
@@ -2525,6 +2526,7 @@ async fn commit_view(
         author: c.author,
         email: c.email,
         time: c.time,
+        signed,
         verified,
         verify_kind,
         verify_fingerprint,
diff --git a/src/web/templates.rs b/src/web/templates.rs
index a2932d4..2f5c47a 100644
--- a/src/web/templates.rs
+++ b/src/web/templates.rs
@@ -65,6 +65,8 @@ pub struct CommitView {
     pub author: String,
     pub email: String,
     pub time: i64,
+    /// True when a signature blob was present on the commit (SSH or GPG).
+    pub signed: bool,
     pub verified: bool,
     pub verify_kind: String,
     pub verify_fingerprint: String,
@@ -72,6 +74,16 @@ pub struct CommitView {
     pub verified_at: String,
 }
 
+impl CommitView {
+    pub fn verify_kind_label(&self) -> &'static str {
+        match self.verify_kind.as_str() {
+            "gpg" => "GPG",
+            "ssh" => "SSH",
+            _ => "Unknown",
+        }
+    }
+}
+
 pub struct CollaboratorView {
     pub user: User,
     pub role: String,

Large diffs are not rendered by default. Showing the first 50 of 307 lines. Show full diff