feat(admin): add configurable footer powered by message
Some checks failed
Build and Release / Create Release (push) Successful in 0s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 2m47s
Build and Release / Unit Tests (push) Successful in 6m10s
Build and Release / Lint (push) Successful in 6m17s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Failing after 37s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Failing after 8h59m46s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Failing after 1m12s
Build and Release / Build Binary (linux/arm64) (push) Failing after 1m19s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Has been cancelled
Some checks failed
Build and Release / Create Release (push) Successful in 0s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 2m47s
Build and Release / Unit Tests (push) Successful in 6m10s
Build and Release / Lint (push) Successful in 6m17s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Failing after 37s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Failing after 8h59m46s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Failing after 1m12s
Build and Release / Build Binary (linux/arm64) (push) Failing after 1m19s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Has been cancelled
Move ShowFooterPoweredBy from static setting to dynamic theme configuration, allowing admins to toggle the "Powered by GitCaddy Server" footer message through the admin panel without restarting the server.
This commit is contained in:
@@ -69,6 +69,7 @@ type ThemeStruct struct {
|
||||
ExploreOrgDisplayFormat *config.Value[string]
|
||||
EnableBlogs *config.Value[bool]
|
||||
BlogsInTopNav *config.Value[bool]
|
||||
ShowFooterPoweredBy *config.Value[bool]
|
||||
}
|
||||
|
||||
type ConfigStruct struct {
|
||||
@@ -109,6 +110,7 @@ func initDefaultConfig() {
|
||||
ExploreOrgDisplayFormat: config.ValueJSON[string]("theme.explore_org_display_format").WithDefault("list"),
|
||||
EnableBlogs: config.ValueJSON[bool]("theme.enable_blogs").WithDefault(false),
|
||||
BlogsInTopNav: config.ValueJSON[bool]("theme.blogs_in_top_nav").WithDefault(false),
|
||||
ShowFooterPoweredBy: config.ValueJSON[bool]("theme.show_footer_powered_by").WithFileConfig(config.CfgSecKey{Sec: "other", Key: "SHOW_FOOTER_POWERED_BY"}).WithDefault(true),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,9 +127,6 @@ func NewFuncMap() template.FuncMap {
|
||||
"ShowFooterTemplateLoadTime": func() bool {
|
||||
return setting.Other.ShowFooterTemplateLoadTime
|
||||
},
|
||||
"ShowFooterPoweredBy": func() bool {
|
||||
return setting.Other.ShowFooterPoweredBy
|
||||
},
|
||||
"AllowedReactions": func() []string {
|
||||
return setting.UI.Reactions
|
||||
},
|
||||
|
||||
@@ -4244,6 +4244,8 @@
|
||||
"admin.config.enable_blogs_desc": "Enable the Blogs feature across the platform. Repos can publish blog posts visible under Explore > Blogs.",
|
||||
"admin.config.blogs_in_top_nav": "Blogs in Top Navigation",
|
||||
"admin.config.blogs_in_top_nav_desc": "Show a Blogs link in the site header navigation bar next to Explore",
|
||||
"admin.config.show_footer_powered_by": "Show Powered By",
|
||||
"admin.config.show_footer_powered_by_desc": "Show the \"Powered by GitCaddy Server\" message in the footer",
|
||||
"admin.config.custom_home_title": "Homepage Title",
|
||||
"admin.config.custom_home_title_placeholder": "Leave empty to use app name",
|
||||
"admin.config.custom_home_title_help": "Custom title displayed on the homepage. Leave empty to use the default app name.",
|
||||
|
||||
@@ -251,6 +251,7 @@ func ChangeConfig(ctx *context.Context) {
|
||||
cfg.Theme.ExploreOrgDisplayFormat.DynKey(): marshalString("list"),
|
||||
cfg.Theme.EnableBlogs.DynKey(): marshalBool,
|
||||
cfg.Theme.BlogsInTopNav.DynKey(): marshalBool,
|
||||
cfg.Theme.ShowFooterPoweredBy.DynKey(): marshalBool,
|
||||
}
|
||||
|
||||
_ = ctx.Req.ParseForm()
|
||||
|
||||
@@ -169,6 +169,13 @@
|
||||
</form>
|
||||
</dd>
|
||||
<div class="divider"></div>
|
||||
<dt>{{ctx.Locale.Tr "admin.config.show_footer_powered_by"}}</dt>
|
||||
<dd>
|
||||
<div class="ui toggle checkbox" data-tooltip-content="{{ctx.Locale.Tr "admin.config.show_footer_powered_by_desc"}}">
|
||||
<input type="checkbox" data-config-dyn-key="theme.show_footer_powered_by" {{if .SystemConfig.Theme.ShowFooterPoweredBy.Value ctx}}checked{{end}}><label></label>
|
||||
</div>
|
||||
</dd>
|
||||
<div class="divider"></div>
|
||||
<dt>{{ctx.Locale.Tr "admin.config.api_header_url"}}</dt>
|
||||
<dd>
|
||||
<form class="ui form form-fetch-action" method="post" action="{{AppSubUrl}}/-/admin/config">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<footer class="page-footer" role="group" aria-label="{{ctx.Locale.Tr "aria.footer"}}">
|
||||
<div class="left-links" role="contentinfo" aria-label="{{ctx.Locale.Tr "aria.footer.software"}}">
|
||||
{{if ShowFooterPoweredBy}}
|
||||
{{if .SystemConfig.Theme.ShowFooterPoweredBy.Value ctx}}
|
||||
<span>{{ctx.Locale.Tr "powered_by" "GitCaddy Server"}}</span>
|
||||
<span class="tw-text-secondary tw-text-12">{{ctx.Locale.Tr "based_on"}} <a target="_blank" rel="noopener noreferrer" href="https://about.gitea.com">Gitea</a></span>
|
||||
{{end}}
|
||||
@@ -30,8 +30,8 @@
|
||||
{{end -}}
|
||||
</div>
|
||||
</div>
|
||||
<a href="{{AssetUrlPrefix}}/licenses.txt">{{ctx.Locale.Tr "licenses"}}</a>
|
||||
{{if .EnableSwagger}}<a href="{{AppSubUrl}}/api/swagger">API</a>{{end}}
|
||||
<a href="{{AssetUrlPrefix}}/licenses.txt" rel="nofollow">{{ctx.Locale.Tr "licenses"}}</a>
|
||||
{{if .EnableSwagger}}<a href="{{AppSubUrl}}/api/swagger" rel="nofollow">API</a>{{end}}
|
||||
{{template "custom/extra_links_footer" .}}
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
Reference in New Issue
Block a user