feat: add invites page

This commit is contained in:
Sam 2023-03-14 00:16:19 +01:00
parent fb10f29e2b
commit 1647ec16a4
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
8 changed files with 141 additions and 7 deletions

View file

@ -11,7 +11,7 @@ import (
)
type inviteResponse struct {
Code string `json:"string"`
Code string `json:"code"`
Created time.Time `json:"created"`
Used bool `json:"used"`
}

View file

@ -2,6 +2,7 @@ package meta
import (
"net/http"
"os"
"codeberg.org/u1f320/pronouns.cc/backend/server"
"emperror.dev/errors"
@ -24,6 +25,7 @@ type MetaResponse struct {
GitCommit string `json:"git_commit"`
Users int64 `json:"users"`
Members int64 `json:"members"`
RequireInvite bool `json:"require_invite"`
}
func (s *Server) meta(w http.ResponseWriter, r *http.Request) error {
@ -45,6 +47,7 @@ func (s *Server) meta(w http.ResponseWriter, r *http.Request) error {
GitCommit: server.Revision,
Users: numUsers,
Members: numMembers,
RequireInvite: os.Getenv("REQUIRE_INVITE") == "true",
})
return nil
}