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:
1 parent
92cd81fd96
commit
ffc6cc4fbc
31 files changed
+2326
-134
No files matched your search
@@ -323,6 +323,34 @@ func (c *Client) OpenFile(ctx context.Context, collection, recordID, filename st
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// OpenBackup streams a PocketBase backup archive. The caller closes the body.
|
||||
func (c *Client) OpenBackup(ctx context.Context, key string) (*http.Response, error) {
|
||||
token, err := c.authToken(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var ft struct {
|
||||
Token string `json:"token"`
|
||||
}
|
||||
if err := c.send(ctx, http.MethodPost, "/api/files/token", token, nil, &ft); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet,
|
||||
c.baseURL+"/api/backups/"+url.PathEscape(key)+"?token="+url.QueryEscape(ft.Token), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp, err := (&http.Client{}).Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if resp.StatusCode >= 400 {
|
||||
defer resp.Body.Close()
|
||||
return nil, &Error{Status: resp.StatusCode, Message: "backup download failed"}
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// raw sends a request with a non-JSON body and returns the response for a
|
||||
// 2xx status; errors are decoded like send's.
|
||||
func (c *Client) raw(ctx context.Context, method, path, token string, body io.Reader, contentType string) (*http.Response, error) {
|
||||
|
||||
Reference in new issue
Block a user