mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-02 01:28:13 -05:00
fix: install host
This commit is contained in:
parent
1a21abddcf
commit
1395438dee
@ -20,11 +20,11 @@ import (
|
|||||||
// @Success 200 {object} model.CommonResponse[model.SettingResponse]
|
// @Success 200 {object} model.CommonResponse[model.SettingResponse]
|
||||||
// @Router /setting [get]
|
// @Router /setting [get]
|
||||||
func listConfig(c *gin.Context) (model.SettingResponse, error) {
|
func listConfig(c *gin.Context) (model.SettingResponse, error) {
|
||||||
u, ok := c.Get(model.CtxKeyAuthorizedUser)
|
u, authorized := c.Get(model.CtxKeyAuthorizedUser)
|
||||||
var authorized bool
|
var isAdmin bool
|
||||||
if ok {
|
if authorized {
|
||||||
user := u.(*model.User)
|
user := u.(*model.User)
|
||||||
authorized = user.Role == model.RoleAdmin
|
isAdmin = user.Role == model.RoleAdmin
|
||||||
}
|
}
|
||||||
|
|
||||||
conf := model.SettingResponse{
|
conf := model.SettingResponse{
|
||||||
@ -33,7 +33,7 @@ func listConfig(c *gin.Context) (model.SettingResponse, error) {
|
|||||||
FrontendTemplates: singleton.FrontendTemplates,
|
FrontendTemplates: singleton.FrontendTemplates,
|
||||||
}
|
}
|
||||||
|
|
||||||
if !authorized {
|
if !authorized || !isAdmin {
|
||||||
conf = model.SettingResponse{
|
conf = model.SettingResponse{
|
||||||
Config: model.Config{
|
Config: model.Config{
|
||||||
SiteName: conf.SiteName,
|
SiteName: conf.SiteName,
|
||||||
@ -44,6 +44,11 @@ func listConfig(c *gin.Context) (model.SettingResponse, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !isAdmin {
|
||||||
|
conf.Config.TLS = false
|
||||||
|
conf.Config.InstallHost = conf.InstallHost
|
||||||
|
}
|
||||||
|
|
||||||
conf.Config.Language = strings.Replace(conf.Config.Language, "_", "-", -1)
|
conf.Config.Language = strings.Replace(conf.Config.Language, "_", "-", -1)
|
||||||
|
|
||||||
return conf, nil
|
return conf, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user