Files
forge/templates/repo/commit_sign_badge.tmpl
zeekayandHanzo Dev 412997543a rebrand(rel): rip ALL remaining gitea internals from rendered surfaces
- svg icon set: gitea-* → hanzo-* (60 icons — the names render into the DOM
  as class attributes on every page); webhook-type icon content replaced:
  the white Gitea TEACUP → the Hanzo mark (currentColor).
- Actions bot identity: gitea-actions / 'Gitea Actions' / [email protected] →
  hanzo-actions / 'Hanzo Actions' / [email protected] — this signs every
  Actions-generated commit. Virtual user (id -2, no DB row) so no migration;
  old git commits keep their historical author. Legacy name stays reserved
  so nobody can squat it.
- emoji defaults: :gitea:/:gogs:/:codeberg: ripped (pngs deleted); kept
  git/github/gitlab (real interop marks).
- external-render seam tokens (script#, query params, data-attr, CSS var),
  EasyMDE toolbar keys, theme meta-info marker gitea-theme-meta-info →
  hanzo-theme-meta-info (parser + all 9 theme files + tests).
- meta keywords default → git,self-hosted,hanzo; update-checker cron now
  DISABLED by default + pointed at hanzoai/git releases (was phoning
  dl.gitea.com weekly and comparing against the wrong product's versions).
- user-visible snippets/links: cargo registry name, debian keyring paths,
  LDAP filter placeholders, install placeholders, home/appearance/admin
  links, swagger profile-URL description, oauth2 modal DOM ids,
  web_src module gitea-actions.ts → actions-types.ts.
- KEPT (functional, not brand): webhook TYPE key 'gitea' + /gitea/new route
  (existing hooks), ssh-keygen -n gitea signing namespace (verification
  compat), 'gitea doctor' CLI examples (actual binary name), migrate-from-
  Gitea interop naming, swagger enum values.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-24 12:45:20 -07:00

82 lines
3.5 KiB
Handlebars

{{/* Template attributes:
* Commit
* CommitBaseLink
* CommitSignVerification
If you'd like to modify this template, you could test it on the devtest page.
ATTENTION: this template could be re-rendered many times (on the graph and commit list page),
so this template should be kept as small as possible, DO NOT put large components like modal/dialog into it.
*/}}
{{- $commit := $.Commit -}}
{{- $commitBaseLink := $.CommitBaseLink -}}
{{- $verification := $.CommitSignVerification -}}{{- /* asymkey.CommitVerification */ -}}
{{- $extraClass := "" -}}
{{- $verified := false -}}
{{- $signingUser := NIL -}}
{{- $signingEmail := "" -}}
{{- $msgReasonPrefix := "" -}}
{{- $msgReason := "" -}}
{{- $msgSigningKey := "" -}}
{{- if $verification -}}
{{- $signingUser = $verification.SigningUser -}}
{{- $signingEmail = $verification.SigningEmail -}}
{{- $extraClass = print $extraClass " commit-is-signed" -}}
{{- if $verification.Verified -}}
{{- /* reason is "{name} / {key-id}" */ -}}
{{- $msgReason = $verification.Reason -}}
{{- $verified = true -}}
{{- if eq $verification.TrustStatus "trusted" -}}
{{- $extraClass = print $extraClass " sign-trusted" -}}
{{- else if eq $verification.TrustStatus "untrusted" -}}
{{- $extraClass = print $extraClass " sign-untrusted" -}}
{{- $msgReasonPrefix = ctx.Locale.Tr "repo.commits.signed_by_untrusted_user" -}}
{{- else -}}
{{- $extraClass = print $extraClass " sign-unmatched" -}}
{{- $msgReasonPrefix = ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched" -}}
{{- end -}}
{{- else -}}
{{- if $verification.Warning -}}
{{- $extraClass = print $extraClass " sign-warning" -}}
{{- else -}}
{{- $extraClass = "" -}}{{/* the commit is not signed */}}
{{- end -}}
{{- $msgReason = ctx.Locale.Tr $verification.Reason -}}{{- /* dirty part: it is the translation key ..... */ -}}
{{- end -}}
{{- if $msgReasonPrefix -}}
{{- $msgReason = print $msgReasonPrefix ": " $msgReason -}}
{{- end -}}
{{- if $verification.SigningSSHKey -}}
{{- $msgSigningKey = print (ctx.Locale.Tr "repo.commits.ssh_key_fingerprint") ": " $verification.SigningSSHKey.Fingerprint -}}
{{- else if $verification.SigningKey -}}{{- /* asymkey.GPGKey */ -}}
{{- $msgSigningKey = print (ctx.Locale.Tr "repo.commits.gpg_key_id") ": " $verification.SigningKey.PaddedKeyID -}}
{{- end -}}
{{- end -}}
{{- if $commit -}}
<a {{if $commitBaseLink}}href="{{$commitBaseLink}}/{{$commit.ID}}"{{end}} class="ui label commit-id-short {{$extraClass}}" rel="nofollow">
{{- ShortSha $commit.ID.String -}}
{{- end -}}
{{- if or (not $commit) $extraClass}}{{/* only show the lock icon if there is no commit info (icon only) or the commit is really signed */}}
<span class="ui label commit-sign-badge {{$extraClass}}">
{{- if $verified -}}
{{- if and $signingUser $signingUser.ID -}}
<span data-tooltip-content="{{$msgReason}}">{{svg "hanzo-lock"}}</span>
<span data-tooltip-content="{{$msgSigningKey}}">{{ctx.AvatarUtils.Avatar $signingUser 20}}</span>
{{- else -}}
<span data-tooltip-content="{{$msgReason}}">{{svg "hanzo-lock-cog"}}</span>
<span data-tooltip-content="{{$msgSigningKey}}">{{ctx.AvatarUtils.AvatarByEmail $signingEmail "" 20}}</span>
{{- end -}}
{{- else -}}
<span data-tooltip-content="{{$msgReason}}">{{svg "hanzo-unlock"}}</span>
{{- end -}}
</span>
{{- end -}}
{{- if $commit -}}
</a>
{{- end -}}
{{- /* This template should be kept as small as possible, DO NOT put large components like modal/dialog into it. */ -}}