mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 12:48:14 -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]
|
||||
// @Router /setting [get]
|
||||
func listConfig(c *gin.Context) (model.SettingResponse, error) {
|
||||
u, ok := c.Get(model.CtxKeyAuthorizedUser)
|
||||
var authorized bool
|
||||
if ok {
|
||||
u, authorized := c.Get(model.CtxKeyAuthorizedUser)
|
||||
var isAdmin bool
|
||||
if authorized {
|
||||
user := u.(*model.User)
|
||||
authorized = user.Role == model.RoleAdmin
|
||||
isAdmin = user.Role == model.RoleAdmin
|
||||
}
|
||||
|
||||
conf := model.SettingResponse{
|
||||
@ -33,7 +33,7 @@ func listConfig(c *gin.Context) (model.SettingResponse, error) {
|
||||
FrontendTemplates: singleton.FrontendTemplates,
|
||||
}
|
||||
|
||||
if !authorized {
|
||||
if !authorized || !isAdmin {
|
||||
conf = model.SettingResponse{
|
||||
Config: model.Config{
|
||||
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)
|
||||
|
||||
return conf, nil
|
||||
|
Loading…
Reference in New Issue
Block a user