diff --git a/cmd/dashboard/controller/setting.go b/cmd/dashboard/controller/setting.go index a8616a3..ccd536d 100644 --- a/cmd/dashboard/controller/setting.go +++ b/cmd/dashboard/controller/setting.go @@ -43,13 +43,15 @@ func listConfig(c *gin.Context) (*model.SettingResponse, error) { if !authorized || !isAdmin { configForGuests := config.ConfigForGuests + var configDashboard model.ConfigDashboard if authorized { - configForGuests.AgentTLS = singleton.Conf.AgentTLS - configForGuests.InstallHost = singleton.Conf.InstallHost + configDashboard.AgentTLS = singleton.Conf.AgentTLS + configDashboard.InstallHost = singleton.Conf.InstallHost } conf = model.SettingResponse{ Config: model.Setting{ ConfigForGuests: configForGuests, + ConfigDashboard: configDashboard, Oauth2Providers: config.Oauth2Providers, }, } diff --git a/go.mod b/go.mod index 77d5490..5e95c78 100644 --- a/go.mod +++ b/go.mod @@ -27,6 +27,7 @@ require ( github.com/robfig/cron/v3 v3.0.1 github.com/swaggo/files v1.0.1 github.com/swaggo/gin-swagger v1.6.0 + github.com/swaggo/swag v1.16.4 github.com/tidwall/gjson v1.18.0 golang.org/x/crypto v0.35.0 golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa @@ -73,7 +74,6 @@ require ( github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/swaggo/swag v1.16.4 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/tidwall/sjson v1.2.5 // indirect diff --git a/model/config.go b/model/config.go index ccd674c..a5ac08e 100644 --- a/model/config.go +++ b/model/config.go @@ -26,12 +26,12 @@ type ConfigForGuests struct { SiteName string `koanf:"site_name" json:"site_name"` CustomCode string `koanf:"custom_code" json:"custom_code,omitempty"` CustomCodeDashboard string `koanf:"custom_code_dashboard" json:"custom_code_dashboard,omitempty"` - - InstallHost string `koanf:"install_host" json:"install_host,omitempty"` - AgentTLS bool `koanf:"tls" json:"tls,omitempty"` // 用于前端判断生成的安装命令是否启用 TLS } type ConfigDashboard struct { + InstallHost string `koanf:"install_host" json:"install_host,omitempty"` + AgentTLS bool `koanf:"tls" json:"tls,omitempty"` // 用于前端判断生成的安装命令是否启用 TLS + RealIPHeader string `koanf:"real_ip_header" json:"real_ip_header,omitempty"` // 真实IP UserTemplate string `koanf:"user_template" json:"user_template,omitempty"` AdminTemplate string `koanf:"admin_template" json:"admin_template,omitempty"`