chore(branding): strip metadata information from the footer

When the Forgejo version is displayed in the footer, the metadata
should not be displayed. It was once an indication that Forgejo
includes all of Gitea. But since the hard fork the codebase diverged
and this is no longer accurate.

The metadata is still displayed in the API, admin panels or headers
for the sake of backward compatibility.

Refs: https://codeberg.org/forgejo/discussions/issues/244
This commit is contained in:
Earl Warren 2024-12-29 15:54:12 +00:00
parent b74406d82c
commit 2c81893c76
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
3 changed files with 6 additions and 2 deletions

View file

@ -103,6 +103,10 @@ func NewFuncMap() template.FuncMap {
"AppVer": func() string { "AppVer": func() string {
return setting.AppVer return setting.AppVer
}, },
"AppVerNoMetadata": func() string {
version, _, _ := strings.Cut(setting.AppVer, "+")
return version
},
"AppDomain": func() string { // documented in mail-templates.md "AppDomain": func() string { // documented in mail-templates.md
return setting.Domain return setting.Domain
}, },

View file

@ -8,7 +8,7 @@
{{if .IsAdmin}} {{if .IsAdmin}}
<a href="{{AppSubUrl}}/admin/config">{{AppVer}}</a> <a href="{{AppSubUrl}}/admin/config">{{AppVer}}</a>
{{else}} {{else}}
{{AppVer}} {{AppVerNoMetadata}}
{{end}} {{end}}
{{end}} {{end}}
{{if and .TemplateLoadTimes ShowFooterTemplateLoadTime}} {{if and .TemplateLoadTimes ShowFooterTemplateLoadTime}}

View file

@ -8,7 +8,7 @@
<div class="divider"></div> <div class="divider"></div>
<br> <br>
{{if .ShowFooterVersion}}<p>{{ctx.Locale.Tr "admin.config.app_ver"}}: {{AppVer}}</p>{{end}} {{if .ShowFooterVersion}}<p>{{ctx.Locale.Tr "admin.config.app_ver"}}: {{AppVerNoMetadata}}</p>{{end}}
</div> </div>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}