Expose default theme in meta and API (#13809)
Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
		
							parent
							
								
									056b8f5b52
								
							
						
					
					
						commit
						e306c292ac
					
				| 
						 | 
					@ -12,6 +12,7 @@ type GeneralRepoSettings struct {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GeneralUISettings contains global ui settings exposed by API
 | 
					// GeneralUISettings contains global ui settings exposed by API
 | 
				
			||||||
type GeneralUISettings struct {
 | 
					type GeneralUISettings struct {
 | 
				
			||||||
 | 
						DefaultTheme     string   `json:"default_theme"`
 | 
				
			||||||
	AllowedReactions []string `json:"allowed_reactions"`
 | 
						AllowedReactions []string `json:"allowed_reactions"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,6 +23,7 @@ func GetGeneralUISettings(ctx *context.APIContext) {
 | 
				
			||||||
	//   "200":
 | 
						//   "200":
 | 
				
			||||||
	//     "$ref": "#/responses/GeneralUISettings"
 | 
						//     "$ref": "#/responses/GeneralUISettings"
 | 
				
			||||||
	ctx.JSON(http.StatusOK, api.GeneralUISettings{
 | 
						ctx.JSON(http.StatusOK, api.GeneralUISettings{
 | 
				
			||||||
 | 
							DefaultTheme:     setting.UI.DefaultTheme,
 | 
				
			||||||
		AllowedReactions: setting.UI.Reactions,
 | 
							AllowedReactions: setting.UI.Reactions,
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,6 +7,7 @@
 | 
				
			||||||
	<title>{{if .Title}}{{.Title | RenderEmojiPlain}} - {{end}} {{if .Repository.Name}}{{.Repository.Name}} - {{end}}{{AppName}} </title>
 | 
						<title>{{if .Title}}{{.Title | RenderEmojiPlain}} - {{end}} {{if .Repository.Name}}{{.Repository.Name}} - {{end}}{{AppName}} </title>
 | 
				
			||||||
	<link rel="manifest" href="{{AppSubUrl}}/manifest.json" crossorigin="use-credentials">
 | 
						<link rel="manifest" href="{{AppSubUrl}}/manifest.json" crossorigin="use-credentials">
 | 
				
			||||||
	<meta name="theme-color" content="{{ThemeColorMetaTag}}">
 | 
						<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="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="description" content="{{if .Repository}}{{.Repository.Name}}{{if .Repository.Description}} - {{.Repository.Description}}{{end}}{{else}}{{MetaDescription}}{{end}}" />
 | 
				
			||||||
	<meta name="keywords" content="{{MetaKeywords}}">
 | 
						<meta name="keywords" content="{{MetaKeywords}}">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13523,6 +13523,10 @@
 | 
				
			||||||
            "type": "string"
 | 
					            "type": "string"
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "x-go-name": "AllowedReactions"
 | 
					          "x-go-name": "AllowedReactions"
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "default_theme": {
 | 
				
			||||||
 | 
					          "type": "string",
 | 
				
			||||||
 | 
					          "x-go-name": "DefaultTheme"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "x-go-package": "code.gitea.io/gitea/modules/structs"
 | 
					      "x-go-package": "code.gitea.io/gitea/modules/structs"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue