update ws & settings api (#547)

This commit is contained in:
UUBulb
2024-12-04 20:00:18 +08:00
committed by GitHub
parent 6295371cac
commit 872002d938
4 changed files with 38 additions and 9 deletions

View File

@@ -127,6 +127,21 @@ func (h *Host) PB() *pb.Host {
}
}
// Filter returns a new instance of Host with some fields redacted.
func (h *Host) Filter() *Host {
return &Host{
Platform: h.Platform,
CPU: h.CPU,
MemTotal: h.MemTotal,
DiskTotal: h.DiskTotal,
SwapTotal: h.SwapTotal,
Arch: h.Arch,
Virtualization: h.Virtualization,
BootTime: h.BootTime,
GPU: h.GPU,
}
}
func PB2Host(h *pb.Host) Host {
return Host{
Platform: h.GetPlatform(),

View File

@@ -12,6 +12,13 @@ type SettingForm struct {
CustomCodeDashboard string `json:"custom_code_dashboard,omitempty" validate:"optional"`
RealIPHeader string `json:"real_ip_header,omitempty" validate:"optional"` // 真实IP
TLS bool `json:"tls,omitempty" validate:"optional"`
EnableIPChangeNotification bool `json:"enable_ip_change_notification,omitempty" validate:"optional"`
EnablePlainIPInNotification bool `json:"enable_plain_ip_in_notification,omitempty" validate:"optional"`
}
type SettingResponse struct {
Config
Version string `json:"version,omitempty"`
}