Add self-info endpoint for ProjectConfigurator discovery, sync shared updates
GET /api/info reports name/tabs/mount types (empty - state lives in Postgres, no shared file mounts) so ProjectConfigurator's Projects workspace can register this instance from just a URL. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
557a61b4ee
commit
bbf5d8bb05
126 files changed
+2897
-8542
No files matched your search
@@ -1,4 +1,4 @@
|
||||
// Package auth is the media-collection family's /auth/... and /api/auth/...
|
||||
// Package auth is the shared media-backend family's /auth/... and /api/auth/...
|
||||
// handlers, proxied to AuthGuard.
|
||||
//
|
||||
// AuthGuard migration
|
||||
@@ -15,7 +15,7 @@
|
||||
// resolved through this module's own `repos.gfranz.ch/Gabriel20xx/shared/backend`
|
||||
// dependency - same module that already provided `sharedauth`). This
|
||||
// service's own /auth/... and /api/auth/... URL paths and JSON response
|
||||
// shapes are UNCHANGED - the frontend (media-webui) was not touched - only
|
||||
// shapes are UNCHANGED - the frontend (webui) was not touched - only
|
||||
// what backs them changed. This mirrors the migration
|
||||
// Original/GameStream/backend/cmd/gamestreamd/auth.go and
|
||||
// Forks/Bitmagnet/backend/internal/auth/service.go already did; read either
|
||||
@@ -44,7 +44,7 @@
|
||||
// the bearer token on its server-to-server calls to AuthGuard
|
||||
// (sessionToken/CurrentUser below). This service mints no session token of
|
||||
// its own any more. The pre-migration SESSION_COOKIE name (configurable,
|
||||
// default "mediacollection_session") is retained only as something Logout
|
||||
// default "session") is retained only as something Logout
|
||||
// additionally clears, so a browser that still holds one from before this
|
||||
// migration doesn't keep sending a now-meaningless cookie forever.
|
||||
//
|
||||
@@ -78,7 +78,7 @@
|
||||
// username/email/password via AuthGuard today; see UpdateMe.
|
||||
// - The `bio`/`avatarUrl` fields the pre-migration User type carried are
|
||||
// dropped entirely: AuthGuard has no such concept, and grepping the
|
||||
// frontend (media-webui) confirms neither field was ever actually read
|
||||
// frontend (webui) confirms neither field was ever actually read
|
||||
// or set by any UI - they were dead weight even before this migration.
|
||||
//
|
||||
// Auth-disabled mode (AUTHGUARD_URL unset)
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
|
||||
"mediacollection/internal/database"
|
||||
"repos.gfranz.ch/Gabriel20xx/shared/media-backend/internal/database"
|
||||
)
|
||||
|
||||
// testPool returns a connection pool against a real (throwaway) Postgres
|
||||
@@ -129,7 +129,7 @@ func newRequest(method, target string, body string) *http.Request {
|
||||
}
|
||||
|
||||
func TestCurrentUserDisabledModeReturnsLocalSuperadmin(t *testing.T) {
|
||||
svc := New(nil, "mediacollection_session", false, "")
|
||||
svc := New(nil, "session", false, "")
|
||||
user, err := svc.CurrentUser(httptest.NewRequest(http.MethodGet, "/", nil))
|
||||
if err != nil {
|
||||
t.Fatalf("CurrentUser() error = %v", err)
|
||||
@@ -143,7 +143,7 @@ func TestSignupLoginLogoutProxyToAuthGuard(t *testing.T) {
|
||||
pool := testPool(t)
|
||||
guard := newFakeAuthGuard()
|
||||
defer guard.close()
|
||||
svc := New(pool, "mediacollection_session", false, guard.server.URL)
|
||||
svc := New(pool, "session", false, guard.server.URL)
|
||||
ctx := context.Background()
|
||||
|
||||
// Signup
|
||||
@@ -207,7 +207,7 @@ func TestSecondProjectSetupIsRejectedWhenAuthGuardAlreadyHasAnAccount(t *testing
|
||||
guard.hasAccount = true // simulate a different project (or AuthGuard's own web UI) having already created one
|
||||
guard.username, guard.email, guard.role, guard.password = "existing", "existing@example.com", "superadmin", "hunter2!!"
|
||||
|
||||
svc := New(pool, "mediacollection_session", false, guard.server.URL)
|
||||
svc := New(pool, "session", false, guard.server.URL)
|
||||
req := newRequest(http.MethodPost, "/auth/signup", `{"email":"new@example.com","username":"new","password":"correct horse battery staple"}`)
|
||||
rec := httptest.NewRecorder()
|
||||
svc.Signup(rec, req)
|
||||
@@ -223,7 +223,7 @@ func TestSecondProjectSetupIsRejectedWhenAuthGuardAlreadyHasAnAccount(t *testing
|
||||
|
||||
func TestLoginRequiredToggleIsIndependentOfAuthGuard(t *testing.T) {
|
||||
pool := testPool(t)
|
||||
svc := New(pool, "mediacollection_session", false, "")
|
||||
svc := New(pool, "session", false, "")
|
||||
|
||||
required, err := svc.LoginRequired(context.Background())
|
||||
if err != nil || !required {
|
||||
|
||||
Reference in new issue
Block a user