Einladungscodes: registration_mode open|invite|closed, Admin-API /api/invites, App mit Code-Feld und Code-Verwaltung; v0.3.2
This commit is contained in:
parent
d2658de099
commit
cf5e0b1ca7
38 changed files with 665 additions and 25 deletions
|
|
@ -37,6 +37,8 @@ type Server struct {
|
|||
Providers *providers.Manager
|
||||
// AllowRegistration enables POST /api/auth/register.
|
||||
AllowRegistration bool
|
||||
// RegistrationMode overrides AllowRegistration: "open", "invite" or "closed".
|
||||
RegistrationMode string
|
||||
// TokenTTL is the lifetime of user tokens (default 30 days).
|
||||
TokenTTL time.Duration
|
||||
// TrustedProxies whose X-Forwarded-For is honoured (empty = loopback only).
|
||||
|
|
@ -59,10 +61,16 @@ func (s *Server) Handler() http.Handler {
|
|||
s.initAuth()
|
||||
mux.HandleFunc("POST /api/auth/register", s.register)
|
||||
mux.HandleFunc("POST /api/auth/login", s.login)
|
||||
mux.HandleFunc("GET /api/auth/config", func(w http.ResponseWriter, _ *http.Request) {
|
||||
writeJSON(w, 200, map[string]string{"registration_mode": s.regMode()})
|
||||
})
|
||||
api := http.NewServeMux()
|
||||
api.HandleFunc("POST /api/auth/logout", s.logout)
|
||||
api.HandleFunc("GET /api/auth/me", s.me)
|
||||
api.HandleFunc("GET /api/info", s.info)
|
||||
api.HandleFunc("GET /api/invites", s.listInvites)
|
||||
api.HandleFunc("POST /api/invites", s.createInvite)
|
||||
api.HandleFunc("DELETE /api/invites/{code}", s.deleteInvite)
|
||||
api.HandleFunc("GET /api/providers", s.listProviders)
|
||||
api.HandleFunc("PUT /api/providers/active", s.setActiveProvider)
|
||||
api.HandleFunc("GET /api/providers/{name}/models", s.listModels)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue