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

+8 -1
View File
@@ -21,6 +21,8 @@ import (
"docwell/server/internal/config"
"docwell/server/internal/directory"
"docwell/server/internal/httpapi"
"docwell/server/internal/instance"
"docwell/server/internal/jobs"
"docwell/server/internal/mail"
"docwell/server/internal/search"
"docwell/server/internal/settings"
@@ -72,6 +74,11 @@ func run(log *slog.Logger) error {
return err
}
defer index.Close()
reg := jobs.New()
reg.Register("search.index", "Adds changed pages to the search index", 3*time.Second, nil)
reg.Register("search.sweep", "Removes deleted pages from the search index", 10*time.Minute, index.Sweep)
reg.Register("search.rebuild", "Rebuilds the whole search index from the database", 0, index.Rebuild)
index.Track(reg.Track)
indexCtx, stopIndex := context.WithCancel(context.Background())
defer stopIndex()
go index.Run(indexCtx, 3*time.Second, 10*time.Minute)
@@ -96,7 +103,7 @@ func run(log *slog.Logger) error {
// without another secret to configure.
FileTokens: auth.NewFileTokens(cfg.PocketBasePassword, time.Hour),
MaxUpload: int64(cfg.MaxUploadMB) << 20,
Search: index,
Instance: instance.New(db, Version, hub, index, reg),
Collab: hub,
Admin: admin.Handler("/admin"),
Log: log,