feat: Authentik login + switchable GPU prod target

Add OIDC auth for Command Center and runtime GPU endpoint selection
pointed at atc-gpu-prod (10.0.10.106), matching what is currently deployed.
This commit is contained in:
mo
2026-07-21 23:20:24 +00:00
parent f36c8906bc
commit 9008fbd512
31 changed files with 4667 additions and 139 deletions
+42
View File
@@ -0,0 +1,42 @@
import { useCallback, useEffect, useState } from 'react'
export type AuthUser = {
user?: string
email?: string
name?: string
preferred_username?: string
auth_enabled?: boolean
}
type AuthState =
| { status: 'loading'; user: null }
| { status: 'anon'; user: null }
| { status: 'authed'; user: AuthUser }
export function useAuth(): AuthState & { refresh: () => Promise<void> } {
const [state, setState] = useState<AuthState>({ status: 'loading', user: null })
const refresh = useCallback(async () => {
try {
const r = await fetch('/api/auth/me', { credentials: 'same-origin' })
if (r.status === 401) {
setState({ status: 'anon', user: null })
return
}
if (!r.ok) {
setState({ status: 'anon', user: null })
return
}
const me = (await r.json()) as AuthUser
setState({ status: 'authed', user: me })
} catch {
setState({ status: 'anon', user: null })
}
}, [])
useEffect(() => {
void refresh()
}, [refresh])
return { ...state, refresh }
}