webClient.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package api
  2. import (
  3. "Gwen/model"
  4. "time"
  5. )
  6. // type T struct {
  7. // Field1 struct {
  8. // ViewStyle string `json:"view-style"`
  9. // Tm int64 `json:"tm"`
  10. // Info struct {
  11. // Username string `json:"username"`
  12. // Hostname string `json:"hostname"`
  13. // Platform string `json:"platform"`
  14. // Displays []struct {
  15. // X int `json:"x"`
  16. // Y int `json:"y"`
  17. // Width int `json:"width"`
  18. // Height int `json:"height"`
  19. // Name string `json:"name"`
  20. // Online bool `json:"online"`
  21. // } `json:"displays"`
  22. // CurrentDisplay int `json:"current_display"`
  23. // SasEnabled bool `json:"sas_enabled"`
  24. // Version string `json:"version"`
  25. // ConnId int `json:"conn_id"`
  26. // Features struct {
  27. // PrivacyMode bool `json:"privacy_mode"`
  28. // } `json:"features"`
  29. // } `json:"info"`
  30. // } `json:"1799928825"`
  31. // }
  32. type WebClientPeerPayload struct {
  33. ViewStyle string `json:"view-style"`
  34. Tm int64 `json:"tm"`
  35. Info WebClientPeerInfoPayload `json:"info"`
  36. }
  37. type WebClientPeerInfoPayload struct {
  38. Username string `json:"username"`
  39. Hostname string `json:"hostname"`
  40. Platform string `json:"platform"`
  41. }
  42. func (wcpp *WebClientPeerPayload) FromAddressBook(a *model.AddressBook) {
  43. wcpp.ViewStyle = "shrink"
  44. wcpp.Tm = time.Now().UnixNano()
  45. wcpp.Info = WebClientPeerInfoPayload{
  46. Username: a.Username,
  47. Hostname: a.Hostname,
  48. Platform: a.Platform,
  49. }
  50. }