]> source.dussan.org Git - gitea.git/commitdiff
Expose default theme in meta and API (#13809)
authorJohn Olheiser <john.olheiser@gmail.com>
Thu, 3 Dec 2020 12:53:21 +0000 (06:53 -0600)
committerGitHub <noreply@github.com>
Thu, 3 Dec 2020 12:53:21 +0000 (13:53 +0100)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
modules/structs/settings.go
routers/api/v1/settings/settings.go
templates/base/head.tmpl
templates/swagger/v1_json.tmpl

index 6874d6705bf405a53f1ecf56aeb99268753a50e5..0cb7b3284158ddbc363dc3e42e84300b6fed83ab 100644 (file)
@@ -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"`
 }
 
index 2b7b11bfd8a844f2d5233d4a6a9e5ab019cbc181..c94a3141e2f8197ecd0ae45b3e00503c230e7f0a 100644 (file)
@@ -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,
        })
 }
index c8e669387b6dacf29d6ec3e1cc001e5db1614853..95365450412db842fd15ee7b70fc03d6a77f5653 100644 (file)
@@ -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}}">
index b121451ba6a8726f0ac66b15fdfa898ebad9ccd0..bf8467ff2743e18df6cd3ab5765327ada089218f 100644 (file)
             "type": "string"
           },
           "x-go-name": "AllowedReactions"
+        },
+        "default_theme": {
+          "type": "string",
+          "x-go-name": "DefaultTheme"
         }
       },
       "x-go-package": "code.gitea.io/gitea/modules/structs"