Skip to content

Commit e306c29

Browse files
jolheiser6543
andauthored
Expose default theme in meta and API (#13809)
Signed-off-by: jolheiser <[email protected]> Co-authored-by: 6543 <[email protected]>
1 parent 056b8f5 commit e306c29

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

modules/structs/settings.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type GeneralRepoSettings struct {
1212

1313
// GeneralUISettings contains global ui settings exposed by API
1414
type GeneralUISettings struct {
15+
DefaultTheme string `json:"default_theme"`
1516
AllowedReactions []string `json:"allowed_reactions"`
1617
}
1718

routers/api/v1/settings/settings.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ func GetGeneralUISettings(ctx *context.APIContext) {
2323
// "200":
2424
// "$ref": "#/responses/GeneralUISettings"
2525
ctx.JSON(http.StatusOK, api.GeneralUISettings{
26+
DefaultTheme: setting.UI.DefaultTheme,
2627
AllowedReactions: setting.UI.Reactions,
2728
})
2829
}

templates/base/head.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<title>{{if .Title}}{{.Title | RenderEmojiPlain}} - {{end}} {{if .Repository.Name}}{{.Repository.Name}} - {{end}}{{AppName}} </title>
88
<link rel="manifest" href="{{AppSubUrl}}/manifest.json" crossorigin="use-credentials">
99
<meta name="theme-color" content="{{ThemeColorMetaTag}}">
10+
<meta name="default-theme" content="{{DefaultTheme}}" />
1011
<meta name="author" content="{{if .Repository}}{{.Owner.Name}}{{else}}{{MetaAuthor}}{{end}}" />
1112
<meta name="description" content="{{if .Repository}}{{.Repository.Name}}{{if .Repository.Description}} - {{.Repository.Description}}{{end}}{{else}}{{MetaDescription}}{{end}}" />
1213
<meta name="keywords" content="{{MetaKeywords}}">

templates/swagger/v1_json.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13523,6 +13523,10 @@
1352313523
"type": "string"
1352413524
},
1352513525
"x-go-name": "AllowedReactions"
13526+
},
13527+
"default_theme": {
13528+
"type": "string",
13529+
"x-go-name": "DefaultTheme"
1352613530
}
1352713531
},
1352813532
"x-go-package": "code.gitea.io/gitea/modules/structs"

0 commit comments

Comments
 (0)