mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 10:54:08 +01:00
Refactor setting.Other
and remove unused SHOW_FOOTER_BRANDING
(#24270)
The `SHOW_FOOTER_BRANDING` came from year 2015, and it seems nobody ever
uses it. It only shows an GitHub icon which seems unrelated to Gitea, it
doesn't do what document says. So, remove it.
## ⚠️ Breaking
Users can now remove the key `[other].SHOW_FOOTER_BRANDING` from their
app.ini.
This commit is contained in:
parent
f1173d6879
commit
d44e1565da
11 changed files with 25 additions and 28 deletions
|
@ -2340,7 +2340,6 @@ ROUTER = console
|
|||
;[other]
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;SHOW_FOOTER_BRANDING = false
|
||||
;; Show version information about Gitea and Go in the footer
|
||||
;SHOW_FOOTER_VERSION = true
|
||||
;; Show template execution time in the footer
|
||||
|
|
|
@ -1391,7 +1391,6 @@ although Github don't support this form.
|
|||
|
||||
## Other (`other`)
|
||||
|
||||
- `SHOW_FOOTER_BRANDING`: **false**: Show Gitea branding in the footer.
|
||||
- `SHOW_FOOTER_VERSION`: **true**: Show Gitea and Go version information in the footer.
|
||||
- `SHOW_FOOTER_TEMPLATE_LOAD_TIME`: **true**: Show time of template execution in the footer.
|
||||
- `ENABLE_SITEMAP`: **true**: Generate sitemap.
|
||||
|
|
|
@ -483,5 +483,4 @@ PROXY_HOSTS = *.github.com
|
|||
|
||||
## Other (`other`)
|
||||
|
||||
- `SHOW_FOOTER_BRANDING`: 为真则在页面底部显示Gitea的字样。
|
||||
- `SHOW_FOOTER_VERSION`: 为真则在页面底部显示Gitea的版本。
|
||||
|
|
|
@ -741,8 +741,7 @@ func Contexter(ctx context.Context) func(next http.Handler) http.Handler {
|
|||
|
||||
ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton
|
||||
ctx.Data["ShowMilestonesDashboardPage"] = setting.Service.ShowMilestonesDashboardPage
|
||||
ctx.Data["ShowFooterBranding"] = setting.ShowFooterBranding
|
||||
ctx.Data["ShowFooterVersion"] = setting.ShowFooterVersion
|
||||
ctx.Data["ShowFooterVersion"] = setting.Other.ShowFooterVersion
|
||||
|
||||
ctx.Data["EnableSwagger"] = setting.API.EnableSwagger
|
||||
ctx.Data["EnableOpenIDSignIn"] = setting.Service.EnableOpenIDSignIn
|
||||
|
|
|
@ -452,7 +452,7 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
|
|||
userName := ctx.Params(":username")
|
||||
repoName := ctx.Params(":reponame")
|
||||
repoName = strings.TrimSuffix(repoName, ".git")
|
||||
if setting.EnableFeed {
|
||||
if setting.Other.EnableFeed {
|
||||
repoName = strings.TrimSuffix(repoName, ".rss")
|
||||
repoName = strings.TrimSuffix(repoName, ".atom")
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
|
|||
ctx.Data["RepoLink"] = ctx.Repo.RepoLink
|
||||
ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name
|
||||
|
||||
if setting.EnableFeed {
|
||||
if setting.Other.EnableFeed {
|
||||
ctx.Data["EnableFeed"] = true
|
||||
ctx.Data["FeedURL"] = ctx.Repo.RepoLink
|
||||
}
|
||||
|
|
|
@ -3,20 +3,25 @@
|
|||
|
||||
package setting
|
||||
|
||||
var (
|
||||
// Other settings
|
||||
ShowFooterBranding bool
|
||||
import "code.gitea.io/gitea/modules/log"
|
||||
|
||||
type OtherConfig struct {
|
||||
ShowFooterVersion bool
|
||||
ShowFooterTemplateLoadTime bool
|
||||
EnableFeed bool
|
||||
EnableSitemap bool
|
||||
)
|
||||
}
|
||||
|
||||
var Other = OtherConfig{
|
||||
ShowFooterVersion: true,
|
||||
ShowFooterTemplateLoadTime: true,
|
||||
EnableSitemap: true,
|
||||
EnableFeed: true,
|
||||
}
|
||||
|
||||
func loadOtherFrom(rootCfg ConfigProvider) {
|
||||
sec := rootCfg.Section("other")
|
||||
ShowFooterBranding = sec.Key("SHOW_FOOTER_BRANDING").MustBool(false)
|
||||
ShowFooterVersion = sec.Key("SHOW_FOOTER_VERSION").MustBool(true)
|
||||
ShowFooterTemplateLoadTime = sec.Key("SHOW_FOOTER_TEMPLATE_LOAD_TIME").MustBool(true)
|
||||
EnableSitemap = sec.Key("ENABLE_SITEMAP").MustBool(true)
|
||||
EnableFeed = sec.Key("ENABLE_FEED").MustBool(true)
|
||||
if err := sec.MapTo(&Other); err != nil {
|
||||
log.Fatal("Failed to map [other] settings: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,7 @@ func BaseVars() Vars {
|
|||
|
||||
"ShowRegistrationButton": setting.Service.ShowRegistrationButton,
|
||||
"ShowMilestonesDashboardPage": setting.Service.ShowMilestonesDashboardPage,
|
||||
"ShowFooterBranding": setting.ShowFooterBranding,
|
||||
"ShowFooterVersion": setting.ShowFooterVersion,
|
||||
"ShowFooterVersion": setting.Other.ShowFooterVersion,
|
||||
"DisableDownloadSourceArchives": setting.Repository.DisableDownloadSourceArchives,
|
||||
|
||||
"EnableSwagger": setting.API.EnableSwagger,
|
||||
|
|
|
@ -181,7 +181,7 @@ func NewFuncMap() []template.FuncMap {
|
|||
return setting.UI.DefaultShowFullName
|
||||
},
|
||||
"ShowFooterTemplateLoadTime": func() bool {
|
||||
return setting.ShowFooterTemplateLoadTime
|
||||
return setting.Other.ShowFooterTemplateLoadTime
|
||||
},
|
||||
"AllowedReactions": func() []string {
|
||||
return setting.UI.Reactions
|
||||
|
|
|
@ -695,7 +695,7 @@ func checkCitationFile(ctx *context.Context, entry *git.TreeEntry) {
|
|||
|
||||
// Home render repository home page
|
||||
func Home(ctx *context.Context) {
|
||||
if setting.EnableFeed {
|
||||
if setting.Other.EnableFeed {
|
||||
isFeed, _, showFeedType := feed.GetFeedType(ctx.Params(":reponame"), ctx.Req)
|
||||
if isFeed {
|
||||
feed.ShowRepoFeed(ctx, ctx.Repo.Repository, showFeedType)
|
||||
|
|
|
@ -293,7 +293,7 @@ func RegisterRoutes(m *web.Route) {
|
|||
}
|
||||
|
||||
sitemapEnabled := func(ctx *context.Context) {
|
||||
if !setting.EnableSitemap {
|
||||
if !setting.Other.EnableSitemap {
|
||||
ctx.Error(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ func RegisterRoutes(m *web.Route) {
|
|||
}
|
||||
|
||||
feedEnabled := func(ctx *context.Context) {
|
||||
if !setting.EnableFeed {
|
||||
if !setting.Other.EnableFeed {
|
||||
ctx.Error(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
@ -706,7 +706,7 @@ func RegisterRoutes(m *web.Route) {
|
|||
default:
|
||||
context_service.UserAssignmentWeb()(ctx)
|
||||
if !ctx.Written() {
|
||||
ctx.Data["EnableFeed"] = setting.EnableFeed
|
||||
ctx.Data["EnableFeed"] = setting.Other.EnableFeed
|
||||
user.Profile(ctx)
|
||||
}
|
||||
}
|
||||
|
@ -1205,7 +1205,7 @@ func RegisterRoutes(m *web.Route) {
|
|||
m.Get(".rss", feedEnabled, repo.TagsListFeedRSS)
|
||||
m.Get(".atom", feedEnabled, repo.TagsListFeedAtom)
|
||||
}, func(ctx *context.Context) {
|
||||
ctx.Data["EnableFeed"] = setting.EnableFeed
|
||||
ctx.Data["EnableFeed"] = setting.Other.EnableFeed
|
||||
}, repo.MustBeNotEmpty, reqRepoCodeReader, context.RepoRefByType(context.RepoRefTag, true))
|
||||
m.Group("/releases", func() {
|
||||
m.Get("/", repo.Releases)
|
||||
|
@ -1214,7 +1214,7 @@ func RegisterRoutes(m *web.Route) {
|
|||
m.Get(".rss", feedEnabled, repo.ReleasesFeedRSS)
|
||||
m.Get(".atom", feedEnabled, repo.ReleasesFeedAtom)
|
||||
}, func(ctx *context.Context) {
|
||||
ctx.Data["EnableFeed"] = setting.EnableFeed
|
||||
ctx.Data["EnableFeed"] = setting.Other.EnableFeed
|
||||
}, repo.MustBeNotEmpty, reqRepoReleaseReader, context.RepoRefByType(context.RepoRefTag, true))
|
||||
m.Get("/releases/attachments/{uuid}", repo.GetAttachment, repo.MustBeNotEmpty, reqRepoReleaseReader)
|
||||
m.Group("/releases", func() {
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
{{end}}
|
||||
</div>
|
||||
<div class="ui right links" role="group" aria-label="{{.locale.Tr "aria.footer.links"}}">
|
||||
{{if .ShowFooterBranding}}
|
||||
<a target="_blank" rel="noopener noreferrer" href="https://github.com/go-gitea/gitea">{{svg "octicon-mark-github"}}<span class="sr-only">GitHub</span></a>
|
||||
{{end}}
|
||||
<div class="ui dropdown upward language">
|
||||
<span>{{svg "octicon-globe"}} {{.locale.LangName}}</span>
|
||||
<div class="menu language-menu">
|
||||
|
|
Loading…
Reference in a new issue