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

+14 -3
View File
@@ -58,7 +58,18 @@ type Index struct {
pb *pocketbase.Client
log *slog.Logger
mu sync.Mutex // serializes indexing passes
mu sync.Mutex // serializes indexing passes
track func(name string, fn func() error) error
}
// Track reports each indexing pass to fn (the admin panel's job list).
func (x *Index) Track(fn func(name string, run func() error) error) { x.track = fn }
func (x *Index) tracked(name string, fn func() error) error {
if x.track == nil {
return fn()
}
return x.track(name, fn)
}
const checkpointKey = "checkpoint"
@@ -136,11 +147,11 @@ func (x *Index) Run(ctx context.Context, interval, sweepEvery time.Duration) {
defer tick.Stop()
lastSweep := time.Time{}
for {
if err := x.CatchUp(ctx); err != nil && ctx.Err() == nil {
if err := x.tracked("search.index", func() error { return x.CatchUp(ctx) }); err != nil && ctx.Err() == nil {
x.log.Warn("search: indexing failed", "err", err)
}
if time.Since(lastSweep) >= sweepEvery {
if err := x.Sweep(ctx); err != nil && ctx.Err() == nil {
if err := x.tracked("search.sweep", func() error { return x.Sweep(ctx) }); err != nil && ctx.Err() == nil {
x.log.Warn("search: sweep failed", "err", err)
}
lastSweep = time.Now()