From a590d3a56e123cb78a79beda8c92f9f682482175 Mon Sep 17 00:00:00 2001 From: UUBulb <35923940+uubulb@users.noreply.github.com> Date: Sat, 23 Nov 2024 16:36:16 +0800 Subject: [PATCH] update setting api (#17) --- cmd/dashboard/controller/setting.go | 1 + model/setting_api.go | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/dashboard/controller/setting.go b/cmd/dashboard/controller/setting.go index ee0e1be..e05908c 100644 --- a/cmd/dashboard/controller/setting.go +++ b/cmd/dashboard/controller/setting.go @@ -61,6 +61,7 @@ func updateConfig(c *gin.Context) (any, error) { singleton.Conf.DNSServers = sf.CustomNameservers singleton.Conf.CustomCode = sf.CustomCode singleton.Conf.CustomCodeDashboard = sf.CustomCodeDashboard + singleton.Conf.RealIPHeader = sf.RealIPHeader if err := singleton.Conf.Save(); err != nil { return nil, newGormError("%v", err) diff --git a/model/setting_api.go b/model/setting_api.go index b48a8eb..92d66d9 100644 --- a/model/setting_api.go +++ b/model/setting_api.go @@ -5,11 +5,12 @@ type SettingForm struct { IgnoredIPNotification string `json:"ignored_ip_notification,omitempty" validate:"optional"` IPChangeNotificationGroupID uint64 `json:"ip_change_notification_group_id,omitempty"` // IP变更提醒的通知组 Cover uint8 `json:"cover,omitempty"` - SiteName string `json:"site_name,omitempty"` - Language string `json:"language,omitempty"` + SiteName string `json:"site_name,omitempty" minLength:"1"` + Language string `json:"language,omitempty" minLength:"2"` InstallHost string `json:"install_host,omitempty" validate:"optional"` CustomCode string `json:"custom_code,omitempty" validate:"optional"` CustomCodeDashboard string `json:"custom_code_dashboard,omitempty" validate:"optional"` + RealIPHeader string `json:"real_ip_header,omitempty" validate:"optional"` // 真实IP EnableIPChangeNotification bool `json:"enable_ip_change_notification,omitempty" validate:"optional"` EnablePlainIPInNotification bool `json:"enable_plain_ip_in_notification,omitempty" validate:"optional"`