switch to v2/calling/relays endpoint
This commit is contained in:
parent
40ac288a3a
commit
251ffc289f
2 changed files with 19 additions and 35 deletions
|
@ -88,10 +88,7 @@ import * as durations from '../util/durations';
|
|||
import { clearTimeoutIfNecessary } from '../util/clearTimeoutIfNecessary';
|
||||
import { fetchMembershipProof, getMembershipList } from '../groups';
|
||||
import type { ProcessedEnvelope } from '../textsecure/Types.d';
|
||||
import type {
|
||||
GetIceServersResultType,
|
||||
IceServerGroupType,
|
||||
} from '../textsecure/WebAPI';
|
||||
import type { GetIceServersResultType } from '../textsecure/WebAPI';
|
||||
import { missingCaseError } from '../util/missingCaseError';
|
||||
import { normalizeGroupCallTimestamp } from '../util/ringrtc/normalizeGroupCallTimestamp';
|
||||
import {
|
||||
|
@ -3148,32 +3145,24 @@ export class CallingClass {
|
|||
function iceServerConfigToList(
|
||||
iceServerConfig: GetIceServersResultType
|
||||
): Array<IceServer> {
|
||||
function mapConfig(
|
||||
iceServerGroup: GetIceServersResultType | IceServerGroupType
|
||||
): Array<IceServer> {
|
||||
if (!iceServerGroup.username || !iceServerGroup.password) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
hostname: iceServerGroup.hostname ?? '',
|
||||
username: iceServerGroup.username,
|
||||
password: iceServerGroup.password,
|
||||
urls: (iceServerGroup.urlsWithIps ?? []).slice(),
|
||||
},
|
||||
{
|
||||
hostname: '',
|
||||
username: iceServerGroup.username,
|
||||
password: iceServerGroup.password,
|
||||
urls: (iceServerGroup.urls ?? []).slice(),
|
||||
},
|
||||
];
|
||||
if (!iceServerConfig.relays) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [iceServerConfig]
|
||||
.concat(iceServerConfig.iceServers ?? [])
|
||||
.flatMap(mapConfig);
|
||||
return iceServerConfig.relays.flatMap(iceServerGroup => [
|
||||
{
|
||||
hostname: iceServerGroup.hostname ?? '',
|
||||
username: iceServerGroup.username,
|
||||
password: iceServerGroup.password,
|
||||
urls: (iceServerGroup.urlsWithIps ?? []).slice(),
|
||||
},
|
||||
{
|
||||
hostname: '',
|
||||
username: iceServerGroup.username,
|
||||
password: iceServerGroup.password,
|
||||
urls: (iceServerGroup.urls ?? []).slice(),
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
if (!window.textsecure.messaging) {
|
||||
|
|
|
@ -626,7 +626,7 @@ const URL_CALLS = {
|
|||
discovery: 'v1/discovery',
|
||||
getGroupAvatarUpload: 'v1/groups/avatar/form',
|
||||
getGroupCredentials: 'v1/certificate/auth/group',
|
||||
getIceServers: 'v1/calling/relays',
|
||||
getIceServers: 'v2/calling/relays',
|
||||
getOnboardingStoryManifest:
|
||||
'dynamic/desktop/stories/onboarding/manifest.json',
|
||||
getStickerPackUpload: 'v1/sticker/pack/form',
|
||||
|
@ -902,12 +902,7 @@ export type GetAccountForUsernameResultType = z.infer<
|
|||
>;
|
||||
|
||||
export type GetIceServersResultType = Readonly<{
|
||||
username?: string;
|
||||
password?: string;
|
||||
urls?: ReadonlyArray<string>;
|
||||
urlsWithIps?: ReadonlyArray<string>;
|
||||
hostname?: string;
|
||||
iceServers?: ReadonlyArray<IceServerGroupType>;
|
||||
relays?: ReadonlyArray<IceServerGroupType>;
|
||||
}>;
|
||||
|
||||
export type IceServerGroupType = Readonly<{
|
||||
|
|
Loading…
Reference in a new issue