Fix recorder finalize path and add invite-gated login
这个提交包含在:
@@ -23,12 +23,30 @@ function getMediaBaseUrl() {
|
||||
return ENV.mediaServiceUrl.replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
export async function getRemoteMediaSession(sessionId: string) {
|
||||
const response = await fetch(`${getMediaBaseUrl()}/sessions/${sessionId}`);
|
||||
if (!response.ok) {
|
||||
const message = await response.text().catch(() => response.statusText);
|
||||
throw new Error(`Media service request failed (${response.status}): ${message}`);
|
||||
function getMediaCandidateUrls(path: string) {
|
||||
const baseUrl = getMediaBaseUrl();
|
||||
if (baseUrl.endsWith("/media")) {
|
||||
return [`${baseUrl}${path}`];
|
||||
}
|
||||
const payload = await response.json() as { session: RemoteMediaSession };
|
||||
return payload.session;
|
||||
return [`${baseUrl}${path}`, `${baseUrl}/media${path}`];
|
||||
}
|
||||
|
||||
export async function getRemoteMediaSession(sessionId: string) {
|
||||
let lastError: Error | null = null;
|
||||
|
||||
for (const url of getMediaCandidateUrls(`/sessions/${encodeURIComponent(sessionId)}`)) {
|
||||
const response = await fetch(url);
|
||||
if (response.ok) {
|
||||
const payload = await response.json() as { session: RemoteMediaSession };
|
||||
return payload.session;
|
||||
}
|
||||
|
||||
const message = await response.text().catch(() => response.statusText);
|
||||
lastError = new Error(`Media service request failed (${response.status}): ${message}`);
|
||||
if (response.status !== 404) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
throw lastError ?? new Error("Media service request failed");
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户