feat(client): add cookie-backed authentication UI
- Add session-aware login, logout and protected navigation. - Send cookie credentials for API and run-event requests with localized UI stories.
This commit is contained in:
1 parent
9e4b692444
commit
92141a25fb
26 files changed
+1191
-12
No files matched your search
@@ -8,12 +8,16 @@ export interface Manifest {
|
||||
runLogs: {
|
||||
dataLimits: LogDataLimits;
|
||||
};
|
||||
auth: {
|
||||
enabled: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export const DEFAULT_MANIFEST: Manifest = {
|
||||
name: 'liqa',
|
||||
version: __APP_VERSION__,
|
||||
runLogs: { dataLimits: DEFAULT_LOG_DATA_LIMITS },
|
||||
auth: { enabled: false },
|
||||
};
|
||||
|
||||
const STORAGE_KEY = 'liqa-manifest';
|
||||
@@ -39,6 +43,7 @@ function normalize(raw: unknown): Manifest | null {
|
||||
return {
|
||||
name: typeof m.name === 'string' ? m.name : DEFAULT_MANIFEST.name,
|
||||
version: typeof m.version === 'string' ? m.version : DEFAULT_MANIFEST.version,
|
||||
auth: { enabled: m.auth?.enabled === true },
|
||||
runLogs: {
|
||||
dataLimits: {
|
||||
bytes: num(limits.bytes, DEFAULT_LOG_DATA_LIMITS.bytes),
|
||||
@@ -77,7 +82,10 @@ const listeners = new Set<() => void>();
|
||||
* silent: the cached (or default) manifest stays in use.
|
||||
*/
|
||||
export function refreshManifest(): Promise<void> {
|
||||
inFlight ??= fetch(MANIFEST_URL, { headers: { Accept: 'application/json' } })
|
||||
inFlight ??= fetch(MANIFEST_URL, {
|
||||
headers: { Accept: 'application/json' },
|
||||
credentials: 'include',
|
||||
})
|
||||
.then((res) => (res.ok ? res.json() : null))
|
||||
.then((raw: unknown) => {
|
||||
const next = normalize(raw);
|
||||
|
||||
Reference in new issue
Block a user