An atproto PDS written in Go
at main 1.5 kB view raw
1package server 2 3import "github.com/labstack/echo/v4" 4 5type ComAtprotoServerDescribeServerResponseLinks struct { 6 PrivacyPolicy *string `json:"privacyPolicy,omitempty"` 7 TermsOfService *string `json:"termsOfService,omitempty"` 8} 9 10type ComAtprotoServerDescribeServerResponseContact struct { 11 Email string `json:"email"` 12} 13 14type ComAtprotoServerDescribeServerResponse struct { 15 InviteCodeRequired bool `json:"inviteCodeRequired"` 16 PhoneVerificationRequired bool `json:"phoneVerificationRequired"` 17 AvailableUserDomains []string `json:"availableUserDomains"` 18 Links ComAtprotoServerDescribeServerResponseLinks `json:"links"` 19 Contact ComAtprotoServerDescribeServerResponseContact `json:"contact"` 20 Did string `json:"did"` 21} 22 23func (s *Server) handleDescribeServer(e echo.Context) error { 24 return e.JSON(200, ComAtprotoServerDescribeServerResponse{ 25 InviteCodeRequired: s.config.RequireInvite, 26 PhoneVerificationRequired: false, 27 AvailableUserDomains: []string{"." + s.config.Hostname}, // TODO: more 28 Links: ComAtprotoServerDescribeServerResponseLinks{ 29 PrivacyPolicy: nil, 30 TermsOfService: nil, 31 }, 32 Contact: ComAtprotoServerDescribeServerResponseContact{ 33 Email: s.config.ContactEmail, 34 }, 35 Did: s.config.Did, 36 }) 37}