summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorEarl Warren <earl-warren@noreply.codeberg.org>2024-04-01 15:38:55 +0200
committerEarl Warren <earl-warren@noreply.codeberg.org>2024-04-01 15:38:55 +0200
commitb9a1d5c2bee6111c4decadc69ac5fc913355272c (patch)
treee5a8d0fe61b2b741407d450a36a88c1bcbad47bc /templates
parentMerge pull request '[TESTS] disable test failure on log.Error for now' (#2942... (diff)
parentAn integration test for SSH signed tags (diff)
downloadforgejo-b9a1d5c2bee6111c4decadc69ac5fc913355272c.tar.xz
forgejo-b9a1d5c2bee6111c4decadc69ac5fc913355272c.zip
Merge pull request 'Highlight signed tags like signed commits' (#2534) from algernon/forgejo:message-in-a-bottle-ctrl-w-tag into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2534
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/release/list.tmpl1
-rw-r--r--templates/repo/tag/list.tmpl3
-rw-r--r--templates/repo/tag/verification_box.tmpl27
-rw-r--r--templates/repo/tag/verification_line.tmpl80
4 files changed, 110 insertions, 1 deletions
diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl
index 5aa4e51f3b..f3b4bc8443 100644
--- a/templates/repo/release/list.tmpl
+++ b/templates/repo/release/list.tmpl
@@ -60,6 +60,7 @@
<div class="markup desc">
{{$release.RenderedNote}}
</div>
+ {{template "repo/tag/verification_line" (dict "ctxData" $ "release" $release)}}
<div class="divider"></div>
<details class="download" {{if eq $idx 0}}open{{end}}>
<summary class="tw-my-4">
diff --git a/templates/repo/tag/list.tmpl b/templates/repo/tag/list.tmpl
index 5378a8a322..82f3dc04a9 100644
--- a/templates/repo/tag/list.tmpl
+++ b/templates/repo/tag/list.tmpl
@@ -16,12 +16,13 @@
{{range $idx, $release := .Releases}}
<tr>
<td class="tag">
- <h3 class="release-tag-name tw-mb-2">
+ <h3 class="release-tag-name tw-mb-2 tw-flex">
{{if $canReadReleases}}
<a class="tw-flex tw-items-center" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a>
{{else}}
<a class="tw-flex tw-items-center" href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a>
{{end}}
+ {{template "repo/tag/verification_box" (dict "ctxData" $ "release" $release)}}
</h3>
<div class="download tw-flex tw-items-center">
{{if $.Permission.CanRead $.UnitTypeCode}}
diff --git a/templates/repo/tag/verification_box.tmpl b/templates/repo/tag/verification_box.tmpl
new file mode 100644
index 0000000000..3cf88ac23e
--- /dev/null
+++ b/templates/repo/tag/verification_box.tmpl
@@ -0,0 +1,27 @@
+{{$v := call .ctxData.VerifyTag .release}}
+{{if call .ctxData.HasSignature $v}}
+ {{$class := "isSigned"}}
+ {{$href := ""}}
+ {{if $v.Verified}}
+ {{$href = $v.SigningUser.HomeLink}}
+ {{$class = (print $class " isVerified")}}
+ {{else}}
+ {{$class = (print $class " isWarning")}}
+ {{end}}
+
+ <a {{if $href}}href="{{$href}}"{{end}} class="ui label tw-ml-2 {{$class}}">
+ {{if $v.Verified}}
+ <div title="{{$v.Reason}}">
+ {{if ne $v.SigningUser.ID 0}}
+ {{svg "gitea-lock"}}
+ {{ctx.AvatarUtils.Avatar $v.SigningUser 28 "signature"}}
+ {{else}}
+ <span title="{{ctx.Locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog"}}</span>
+ {{ctx.AvatarUtils.AvatarByEmail $v.Verification.SigningEmail "" 28 "signature"}}
+ {{end}}
+ </div>
+ {{else}}
+ <span title="{{ctx.Locale.Tr $v.Reason}}">{{svg "gitea-unlock"}}</span>
+ {{end}}
+ </a>
+{{end}}
diff --git a/templates/repo/tag/verification_line.tmpl b/templates/repo/tag/verification_line.tmpl
new file mode 100644
index 0000000000..f83719de23
--- /dev/null
+++ b/templates/repo/tag/verification_line.tmpl
@@ -0,0 +1,80 @@
+{{$v := call .ctxData.VerifyTag .release}}
+{{if call .ctxData.HasSignature $v}}
+ {{$class := "isSigned"}}
+ {{$href := ""}}
+ {{if $v.Verified}}
+ {{$href = $v.SigningUser.HomeLink}}
+ {{$class = (print $class " isVerified")}}
+ {{else}}
+ {{$class = (print $class " isWarning")}}
+ {{end}}
+
+ <div class="ui bottom attached message tw-text-left tw-flex tw-content-center tw-justify-between tag-signature-row tw-flex-wrap tw-mb-0 {{$class}}">
+ <div class="tw-flex tw-content-center">
+ {{if $v.Verified}}
+ {{if ne $v.SigningUser.ID 0}}
+ {{svg "gitea-lock" 16 "tw-mr-2"}}
+ <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}</span>
+ {{ctx.AvatarUtils.Avatar $v.SigningUser 28 "tw-mr-2"}}
+ <a href="{{$v.SigningUser.HomeLink}}"><strong>{{$v.SigningUser.GetDisplayName}}</strong></a>
+ {{else}}
+ <span title="{{ctx.Locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16 "tw-mr-2"}}</span>
+ <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span>
+ {{ctx.AvatarUtils.AvatarByEmail $v.SigningEmail "" 28 "tw-mr-2"}}
+ <strong>{{$v.SigningUser.GetDisplayName}}</strong>
+ {{end}}
+ {{else}}
+ {{svg "gitea-unlock" 16 "tw-mr-2"}}
+ <span class="ui text">{{ctx.Locale.Tr $v.Reason}}</span>
+ {{end}}
+ </div>
+
+ <div class="tw-flex tw-content-center">
+ {{if $v.Verified}}
+ {{if ne $v.SigningUser.ID 0}}
+ {{svg "octicon-verified" 16 "tw-mr-2"}}
+ {{if $v.SigningSSHKey}}
+ <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
+ {{$v.SigningSSHKey.Fingerprint}}
+ {{else}}
+ <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
+ {{$v.SigningKey.PaddedKeyID}}
+ {{end}}
+ {{else}}
+ {{svg "octicon-unverified" 16 "tw-mr-2"}}
+ {{if $v.SigningSSHKey}}
+ <span class="ui text tw-mr-2" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
+ {{$v.SigningSSHKey.Fingerprint}}
+ {{else}}
+ <span class="ui text tw-mr-2" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
+ {{$v.SigningKey.PaddedKeyID}}
+ {{end}}
+ {{end}}
+ {{else if $v.Warning}}
+ {{svg "octicon-unverified" 16 "tw-mr-2"}}
+ {{if $v.SigningSSHKey}}
+ <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
+ {{$v.SigningSSHKey.Fingerprint}}
+ {{else}}
+ <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
+ {{$v.SigningKey.PaddedKeyID}}
+ {{end}}
+ {{else}}
+ {{if $v.SigningKey}}
+ {{if ne $v.SigningKey.KeyID ""}}
+ {{svg "octicon-verified" 16 "tw-mr-2"}}
+ <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
+ {{$v.SigningKey.PaddedKeyID}}
+ {{end}}
+ {{end}}
+ {{if $v.SigningSSHKey}}
+ {{if ne $v.SigningSSHKey.Fingerprint ""}}
+ {{svg "octicon-verified" 16 "tw-mr-2"}}
+ <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
+ {{$v.SigningSSHKey.Fingerprint}}
+ {{end}}
+ {{end}}
+ {{end}}
+ </div>
+ </div>
+{{end}}