send country code in ws, update profile api (#22)

* send country code in ws

* make ddns_profiles optional field

* update profile api
This commit is contained in:
UUBulb
2024-11-26 21:30:56 +08:00
committed by GitHub
parent 07989705d2
commit e90941f52b
6 changed files with 62 additions and 10 deletions

View File

@@ -23,7 +23,7 @@ type Server struct {
EnableDDNS bool `json:"enable_ddns,omitempty"` // 启用DDNS
DDNSProfilesRaw string `gorm:"default:'[]';column:ddns_profiles_raw" json:"-"`
DDNSProfiles []uint64 `gorm:"-" json:"ddns_profiles"` // DDNS配置
DDNSProfiles []uint64 `gorm:"-" json:"ddns_profiles,omitempty"` // DDNS配置
Host *Host `gorm:"-" json:"host,omitempty"`
State *HostState `gorm:"-" json:"state,omitempty"`

View File

@@ -8,9 +8,10 @@ type StreamServer struct {
PublicNote string `json:"public_note,omitempty"` // 公开备注,只第一个数据包有值
DisplayIndex int `json:"display_index,omitempty"` // 展示排序,越大越靠前
Host *Host `json:"host,omitempty"`
State *HostState `json:"state,omitempty"`
LastActive time.Time `json:"last_active,omitempty"`
Host *Host `json:"host,omitempty"`
State *HostState `json:"state,omitempty"`
CountryCode string `json:"country_code,omitempty"`
LastActive time.Time `json:"last_active,omitempty"`
}
type StreamServerData struct {
@@ -20,12 +21,12 @@ type StreamServerData struct {
type ServerForm struct {
Name string `json:"name,omitempty"`
Note string `json:"note,omitempty" validate:"optional"` // 管理员可见备注
PublicNote string `json:"public_note,omitempty" validate:"optional"` // 公开备注
DisplayIndex int `json:"display_index,omitempty" default:"0"` // 展示排序,越大越靠前
HideForGuest bool `json:"hide_for_guest,omitempty" validate:"optional"` // 对游客隐藏
EnableDDNS bool `json:"enable_ddns,omitempty" validate:"optional"` // 启用DDNS
DDNSProfiles []uint64 `gorm:"-" json:"ddns_profiles,omitempty"` // DDNS配置
Note string `json:"note,omitempty" validate:"optional"` // 管理员可见备注
PublicNote string `json:"public_note,omitempty" validate:"optional"` // 公开备注
DisplayIndex int `json:"display_index,omitempty" default:"0"` // 展示排序,越大越靠前
HideForGuest bool `json:"hide_for_guest,omitempty" validate:"optional"` // 对游客隐藏
EnableDDNS bool `json:"enable_ddns,omitempty" validate:"optional"` // 启用DDNS
DDNSProfiles []uint64 `gorm:"-" json:"ddns_profiles,omitempty" validate:"optional"` // DDNS配置
}
type ForceUpdateResponse struct {

View File

@@ -4,3 +4,8 @@ type UserForm struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty" gorm:"type:char(72)"`
}
type ProfileForm struct {
OriginalPassword string `json:"original_password,omitempty"`
NewPassword string `json:"new_password,omitempty"`
}