gitea源码

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright 2021 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package structs
  4. // NodeInfo contains standardized way of exposing metadata about a server running one of the distributed social networks
  5. type NodeInfo struct {
  6. // Version specifies the schema version
  7. Version string `json:"version"`
  8. // Software contains information about the server software
  9. Software NodeInfoSoftware `json:"software"`
  10. // Protocols lists the protocols supported by this server
  11. Protocols []string `json:"protocols"`
  12. // Services contains third party services this server can connect to
  13. Services NodeInfoServices `json:"services"`
  14. // OpenRegistrations indicates if new user registrations are accepted
  15. OpenRegistrations bool `json:"openRegistrations"`
  16. // Usage contains server usage statistics
  17. Usage NodeInfoUsage `json:"usage"`
  18. // Metadata contains free form key value pairs for software specific values
  19. Metadata struct{} `json:"metadata"`
  20. }
  21. // NodeInfoSoftware contains Metadata about server software in use
  22. type NodeInfoSoftware struct {
  23. // Name is the canonical name of this server software
  24. Name string `json:"name"`
  25. // Version is the version of this server software
  26. Version string `json:"version"`
  27. // Repository is the URL to the source code repository
  28. Repository string `json:"repository"`
  29. // Homepage is the URL to the homepage of this server software
  30. Homepage string `json:"homepage"`
  31. }
  32. // NodeInfoServices contains the third party sites this server can connect to via their application API
  33. type NodeInfoServices struct {
  34. // Inbound lists services that can deliver content to this server
  35. Inbound []string `json:"inbound"`
  36. // Outbound lists services this server can deliver content to
  37. Outbound []string `json:"outbound"`
  38. }
  39. // NodeInfoUsage contains usage statistics for this server
  40. type NodeInfoUsage struct {
  41. // Users contains user statistics
  42. Users NodeInfoUsageUsers `json:"users"`
  43. // LocalPosts is the total amount of posts made by users local to this server
  44. LocalPosts int `json:"localPosts,omitempty"`
  45. // LocalComments is the total amount of comments made by users local to this server
  46. LocalComments int `json:"localComments,omitempty"`
  47. }
  48. // NodeInfoUsageUsers contains statistics about the users of this server
  49. type NodeInfoUsageUsers struct {
  50. // Total is the total amount of users on this server
  51. Total int `json:"total,omitempty"`
  52. // ActiveHalfyear is the amount of users that signed in at least once in the last 180 days
  53. ActiveHalfyear int `json:"activeHalfyear,omitempty"`
  54. // ActiveMonth is the amount of users that signed in at least once in the last 30 days
  55. ActiveMonth int `json:"activeMonth,omitempty"`
  56. }