Build out the admin panel

- Overview: users, organizations, workspaces, spaces, pages, files and
  storage (org admins see their organization), plus pages open right now,
  the search index size, and version, uptime and database health.
- Users: invite people by email (with resend, revoke and a copyable link
  when mail fails) and send a password-reset email.
- Authentication: sign-up on or off, the email-domain allow-list, and
  sign-in links by email.
- Branding: instance name, accent colour and logo. The web app shows them
  on the sign-in pages and applies the accent colour everywhere.
- Email and Storage: SMTP and S3 settings with test buttons.
- Maintenance: create, download and delete database backups, and a view
  of the background jobs with their last run, duration and errors.

On the server, a small jobs registry records each search-indexing pass,
and "search.rebuild" replaces the separate reindex endpoint. A new
instance package serves the dashboard numbers, health and backups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tajniak81andClaude Opus 5.5 committed 2026-10-31 17:34:48 +01:00
1 parent 92cd81fd96
commit ffc6cc4fbc
31 files changed
+2326 -134

No files matched your search

+92
View File
@@ -4,9 +4,29 @@
package api
import (
"time"
openapi_types "github.com/oapi-codegen/runtime/types"
)
// Defines values for AdminStatsScope.
const (
AdminStatsScopeInstance AdminStatsScope = "instance"
AdminStatsScopeOrganization AdminStatsScope = "organization"
)
// Valid indicates whether the value is a known member of the AdminStatsScope enum.
func (e AdminStatsScope) Valid() bool {
switch e {
case AdminStatsScopeInstance:
return true
case AdminStatsScopeOrganization:
return true
default:
return false
}
}
// Defines values for InviteStatus.
const (
Added InviteStatus = "added"
@@ -214,6 +234,49 @@ func (e ExportPageParamsFormat) Valid() bool {
}
}
// AdminHealth defines model for AdminHealth.
type AdminHealth struct {
Database struct {
Error *string `json:"error,omitempty"`
LatencyMs int `json:"latencyMs"`
Ok bool `json:"ok"`
} `json:"database"`
GoVersion string `json:"goVersion"`
Goroutines int `json:"goroutines"`
MemoryMb int `json:"memoryMb"`
Started time.Time `json:"started"`
UptimeSeconds int `json:"uptimeSeconds"`
Version string `json:"version"`
}
// AdminStats defines model for AdminStats.
type AdminStats struct {
Attachments int `json:"attachments"`
// Editors People connected to those pages (instance scope only)
Editors int `json:"editors"`
// Indexed Pages in the search index (instance scope only)
Indexed int `json:"indexed"`
Organizations int `json:"organizations"`
// Pages Pages outside the trash
Pages int `json:"pages"`
// Rooms Pages open for editing now (instance scope only)
Rooms int `json:"rooms"`
Scope AdminStatsScope `json:"scope"`
Spaces int `json:"spaces"`
// StorageBytes Total size of attachments
StorageBytes int `json:"storageBytes"`
Users int `json:"users"`
Workspaces int `json:"workspaces"`
}
// AdminStatsScope defines model for AdminStats.Scope.
type AdminStatsScope string
// Attachment defines model for Attachment.
type Attachment struct {
Created string `json:"created"`
@@ -246,6 +309,13 @@ type AuthSettings struct {
MagicLink bool `json:"magicLink"`
}
// Backup defines model for Backup.
type Backup struct {
Key string `json:"key"`
Modified string `json:"modified"`
Size int `json:"size"`
}
// BrandingSettings defines model for BrandingSettings.
type BrandingSettings struct {
AccentColor string `json:"accentColor"`
@@ -391,6 +461,28 @@ type InviteInfo struct {
WorkspaceName string `json:"workspaceName"`
}
// Job defines model for Job.
type Job struct {
Description string `json:"description"`
// Every How often it runs on its own (Go duration); empty when only on demand
Every string `json:"every"`
Failures int `json:"failures"`
LastDurationMs int `json:"lastDurationMs"`
LastError string `json:"lastError"`
// LastStarted RFC 3339; empty before the first run
LastStarted string `json:"lastStarted"`
Name string `json:"name"`
// Runnable Can be started by hand
Runnable bool `json:"runnable"`
Running bool `json:"running"`
// Runs Runs since the server started
Runs int `json:"runs"`
}
// LoginRequest defines model for LoginRequest.
type LoginRequest struct {
Email openapi_types.Email `json:"email"`