diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index f9f207522c7df..29ebb4699bc17 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -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 diff --git a/docs/content/doc/administration/config-cheat-sheet.en-us.md b/docs/content/doc/administration/config-cheat-sheet.en-us.md index f26e7eaa085ab..772e0535e91ec 100644 --- a/docs/content/doc/administration/config-cheat-sheet.en-us.md +++ b/docs/content/doc/administration/config-cheat-sheet.en-us.md @@ -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. diff --git a/docs/content/doc/administration/config-cheat-sheet.zh-cn.md b/docs/content/doc/administration/config-cheat-sheet.zh-cn.md index 83e212f32b84a..485d106234698 100644 --- a/docs/content/doc/administration/config-cheat-sheet.zh-cn.md +++ b/docs/content/doc/administration/config-cheat-sheet.zh-cn.md @@ -483,5 +483,4 @@ PROXY_HOSTS = *.github.com ## Other (`other`) -- `SHOW_FOOTER_BRANDING`: 为真则在页面底部显示Gitea的字样。 - `SHOW_FOOTER_VERSION`: 为真则在页面底部显示Gitea的版本。 diff --git a/modules/context/context.go b/modules/context/context.go index 7e986b0119e25..f262c7cce7cbc 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -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 diff --git a/modules/context/repo.go b/modules/context/repo.go index 1736de2e4bad2..6b811054c2313 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -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 } diff --git a/modules/setting/other.go b/modules/setting/other.go index 4fba754a08487..706cb1e3d9b8e 100644 --- a/modules/setting/other.go +++ b/modules/setting/other.go @@ -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) + } } diff --git a/modules/templates/base.go b/modules/templates/base.go index e95ce31cfcab0..4254a569764ee 100644 --- a/modules/templates/base.go +++ b/modules/templates/base.go @@ -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, diff --git a/modules/templates/helper.go b/modules/templates/helper.go index c5b77989be24e..c82f88a42f2a0 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -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 diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 5a11073ba9a44..63e534fec0fb6 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -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) diff --git a/routers/web/web.go b/routers/web/web.go index fc484eed4cb7c..49ea63b191ecb 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -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() { diff --git a/templates/base/footer_content.tmpl b/templates/base/footer_content.tmpl index f282083d65d6c..17c75c6874052 100644 --- a/templates/base/footer_content.tmpl +++ b/templates/base/footer_content.tmpl @@ -15,9 +15,6 @@ {{end}}