diff options
author | John Olheiser <john.olheiser@gmail.com> | 2020-12-03 06:53:21 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-03 13:53:21 +0100 |
commit | e306c292ac478c0f09b2c02908e485132669aacb (patch) | |
tree | 8cd8718953a614577da00ee7be6bed0033e76f34 | |
parent | 056b8f5b52fc0e9ab32f99c016e1ee28975c4bcd (diff) | |
download | gitea-e306c292ac478c0f09b2c02908e485132669aacb.tar.gz gitea-e306c292ac478c0f09b2c02908e485132669aacb.zip |
Expose default theme in meta and API (#13809)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
-rw-r--r-- | modules/structs/settings.go | 1 | ||||
-rw-r--r-- | routers/api/v1/settings/settings.go | 1 | ||||
-rw-r--r-- | templates/base/head.tmpl | 1 | ||||
-rw-r--r-- | templates/swagger/v1_json.tmpl | 4 |
4 files changed, 7 insertions, 0 deletions
diff --git a/modules/structs/settings.go b/modules/structs/settings.go index 6874d6705b..0cb7b32841 100644 --- a/modules/structs/settings.go +++ b/modules/structs/settings.go @@ -12,6 +12,7 @@ type GeneralRepoSettings struct { // GeneralUISettings contains global ui settings exposed by API type GeneralUISettings struct { + DefaultTheme string `json:"default_theme"` AllowedReactions []string `json:"allowed_reactions"` } diff --git a/routers/api/v1/settings/settings.go b/routers/api/v1/settings/settings.go index 2b7b11bfd8..c94a3141e2 100644 --- a/routers/api/v1/settings/settings.go +++ b/routers/api/v1/settings/settings.go @@ -23,6 +23,7 @@ func GetGeneralUISettings(ctx *context.APIContext) { // "200": // "$ref": "#/responses/GeneralUISettings" ctx.JSON(http.StatusOK, api.GeneralUISettings{ + DefaultTheme: setting.UI.DefaultTheme, AllowedReactions: setting.UI.Reactions, }) } diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index c8e669387b..9536545041 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -7,6 +7,7 @@ <title>{{if .Title}}{{.Title | RenderEmojiPlain}} - {{end}} {{if .Repository.Name}}{{.Repository.Name}} - {{end}}{{AppName}} </title> <link rel="manifest" href="{{AppSubUrl}}/manifest.json" crossorigin="use-credentials"> <meta name="theme-color" content="{{ThemeColorMetaTag}}"> + <meta name="default-theme" content="{{DefaultTheme}}" /> <meta name="author" content="{{if .Repository}}{{.Owner.Name}}{{else}}{{MetaAuthor}}{{end}}" /> <meta name="description" content="{{if .Repository}}{{.Repository.Name}}{{if .Repository.Description}} - {{.Repository.Description}}{{end}}{{else}}{{MetaDescription}}{{end}}" /> <meta name="keywords" content="{{MetaKeywords}}"> diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index b121451ba6..bf8467ff27 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -13523,6 +13523,10 @@ "type": "string" }, "x-go-name": "AllowedReactions" + }, + "default_theme": { + "type": "string", + "x-go-name": "DefaultTheme" } }, "x-go-package": "code.gitea.io/gitea/modules/structs" |