Add join token TTL policy and Live Show link sharing
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-05 21:11:36 +01:00
parent 3f3061a899
commit 88012c35bd
18 changed files with 636 additions and 9 deletions

View File

@@ -72,6 +72,13 @@ export type LiveShowSettings = {
background_mode?: 'blur_last' | 'gradient' | 'solid' | 'brand';
};
export type LiveShowLink = {
token: string;
url: string;
qr_code_data_url: string | null;
rotated_at: string | null;
};
export type TenantEvent = {
id: number;
name: string | Record<string, string>;
@@ -1521,6 +1528,42 @@ export type GetLiveShowQueueOptions = {
liveStatus?: LiveShowQueueStatus;
};
function normalizeLiveShowLink(payload: JsonValue | LiveShowLink | null | undefined): LiveShowLink {
if (!payload || typeof payload !== 'object') {
return {
token: '',
url: '',
qr_code_data_url: null,
rotated_at: null,
};
}
const record = payload as Record<string, JsonValue>;
return {
token: typeof record.token === 'string' ? record.token : '',
url: typeof record.url === 'string' ? record.url : '',
qr_code_data_url: typeof record.qr_code_data_url === 'string' ? record.qr_code_data_url : null,
rotated_at: typeof record.rotated_at === 'string' ? record.rotated_at : null,
};
}
export async function getLiveShowLink(slug: string): Promise<LiveShowLink> {
const response = await authorizedFetch(`${eventEndpoint(slug)}/live-show/link`);
const data = await jsonOrThrow<{ data?: JsonValue }>(response, 'Failed to load live show link');
return normalizeLiveShowLink(data.data);
}
export async function rotateLiveShowLink(slug: string): Promise<LiveShowLink> {
const response = await authorizedFetch(`${eventEndpoint(slug)}/live-show/link/rotate`, {
method: 'POST',
});
const data = await jsonOrThrow<{ data?: JsonValue }>(response, 'Failed to rotate live show link');
return normalizeLiveShowLink(data.data);
}
export async function getEventPhotos(
slug: string,
options: GetEventPhotosOptions = {}