fix(auth): update PocketBase v0.23+ auth endpoint and rename users collection
- Replace deprecated /api/admins/auth-with-password with /api/collections/_superusers/auth-with-password in both the SvelteKit UI (pocketbase.ts) and Go scraper (pocketbase.go) - Rename custom users collection to app_users to avoid name clash with PocketBase's built-in users auth collection - Fix docker-compose volume mount path pb/pb_data -> pb_data so persisted data matches the entrypoint --dir flag - Add PB_ADMIN_EMAIL/PB_ADMIN_PASSWORD env vars to pocketbase service so the superuser is auto-created on first boot
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
// ranking_html — page(number,unique), html(text), updated(date)
|
||||
// progress — session_id(text), slug(text), chapter(number), updated(date)
|
||||
// audio_cache — cache_key(text,unique), filename(text), updated(date)
|
||||
// users — username(text,unique), password_hash(text), role(text), created(date)
|
||||
// app_users — username(text,unique), password_hash(text), role(text), created(date)
|
||||
package storage
|
||||
|
||||
import (
|
||||
@@ -60,7 +60,7 @@ func (p *pbClient) authenticate(ctx context.Context) error {
|
||||
"password": p.cfg.AdminPassword,
|
||||
})
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost,
|
||||
p.cfg.BaseURL+"/api/admins/auth-with-password", bytes.NewReader(body))
|
||||
p.cfg.BaseURL+"/api/collections/_superusers/auth-with-password", bytes.NewReader(body))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -314,7 +314,7 @@ func (s *PocketBaseStore) EnsureCollections(ctx context.Context) error {
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "users",
|
||||
"name": "app_users",
|
||||
"type": "base",
|
||||
"schema": []map[string]interface{}{
|
||||
{"name": "username", "type": "text", "required": true, "options": map[string]interface{}{"min": 3, "max": 32}},
|
||||
|
||||
Reference in New Issue
Block a user