This commit is contained in:
ljw
2024-09-13 15:57:29 +08:00
commit c53df223d1
112 changed files with 14353 additions and 0 deletions

37
http/request/api/peer.go Normal file
View File

@@ -0,0 +1,37 @@
package api
import "Gwen/model"
type AddressBookFormData struct {
Tags []string `json:"tags"`
Peers []*model.AddressBook `json:"peers"`
TagColors string `json:"tag_colors"`
}
type AddressBookForm struct {
Data string `json:"data" example:"{\"tags\":[\"tag1\",\"tag2\",\"tag3\"],\"peers\":[{\"id\":\"abc\",\"username\":\"abv-l\",\"hostname\":\"\",\"platform\":\"Windows\",\"alias\":\"\",\"tags\":[\"tag1\",\"tag2\"],\"hash\":\"hash\"}],\"tag_colors\":\"{\\\"tag1\\\":4288585374,\\\"tag2\\\":4278238420,\\\"tag3\\\":4291681337}\"}"`
}
type PeerForm struct {
Cpu string `json:"cpu"`
Hostname string `json:"hostname"`
Id string `json:"id"`
Memory string `json:"memory"`
Os string `json:"os"`
Username string `json:"username"`
Uuid string `json:"uuid"`
Version string `json:"version"`
}
func (pf *PeerForm) ToPeer() *model.Peer {
return &model.Peer{
Cpu: pf.Cpu,
Hostname: pf.Hostname,
Id: pf.Id,
Memory: pf.Memory,
Os: pf.Os,
Username: pf.Username,
Uuid: pf.Uuid,
Version: pf.Version,
}
}

41
http/request/api/user.go Normal file
View File

@@ -0,0 +1,41 @@
package api
/*
*
message LoginRequest {
string username = 1;
bytes password = 2;
string my_id = 4;
string my_name = 5;
OptionMessage option = 6;
oneof union {
FileTransfer file_transfer = 7;
PortForward port_forward = 8;
}
bool video_ack_required = 9;
uint64 session_id = 10;
string version = 11;
OSLogin os_login = 12;
string my_platform = 13;
bytes hwid = 14;
}
*/
type LoginForm struct {
Username string `json:"username" validate:"required,gte=4,lte=10" label:"用户名"`
Password string `json:"password,omitempty" validate:"gte=4,lte=20" label:"密码"`
}
type UserListQuery struct {
Page uint `json:"page" form:"page" validate:"required" label:"页码"`
PageSize uint `json:"page_size" form:"page_size" validate:"required" label:"每页数量"`
Status int `json:"status" form:"status" label:"状态"`
Accessible string `json:"accessible" form:"accessible"`
}
type PeerListQuery struct {
Page uint `json:"page" form:"page" validate:"required" label:"页码"`
PageSize uint `json:"page_size" form:"page_size" validate:"required" label:"每页数量"`
Status int `json:"status" form:"status" label:"状态"`
Accessible string `json:"accessible" form:"accessible"`
}