fix: Fix multiple bugs with new authentication flow
This commit is contained in:
@@ -41,6 +41,7 @@ import { SignalingManager } from './signaling/signaling.manager';
|
||||
import { SignalingTransportHandler } from './signaling/signaling-transport-handler';
|
||||
import { WebRtcStateController } from './state/webrtc-state-controller';
|
||||
import { AuthTokenStoreService } from '../../domains/authentication';
|
||||
import { ClientInstanceService } from '../../core/platform/client-instance.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -51,6 +52,7 @@ export class WebRTCService implements OnDestroy {
|
||||
private readonly screenShareSourcePicker = inject(ScreenShareSourcePickerService);
|
||||
private readonly iceServerSettings = inject(IceServerSettingsService);
|
||||
private readonly authTokenStore = inject(AuthTokenStoreService);
|
||||
private readonly clientInstance = inject(ClientInstanceService);
|
||||
|
||||
private readonly logger = new WebRTCLogger(() => this.debugging.enabled());
|
||||
private readonly state = new WebRtcStateController();
|
||||
@@ -161,7 +163,8 @@ export class WebRTCService implements OnDestroy {
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
},
|
||||
getClientInstanceId: () => this.clientInstance.getClientInstanceId()
|
||||
});
|
||||
|
||||
// Now wire up cross-references (all managers are instantiated)
|
||||
@@ -691,11 +694,17 @@ export class WebRTCService implements OnDestroy {
|
||||
}
|
||||
|
||||
private relayBroadcastEvent(event: ChatEvent): void {
|
||||
const clientInstanceId = this.clientInstance.getClientInstanceId();
|
||||
|
||||
if (event.type === 'chat-message' && event.message?.roomId) {
|
||||
this.signalingTransportHandler.sendRawMessage({
|
||||
type: 'chat_message',
|
||||
serverId: event.message.roomId,
|
||||
message: event.message
|
||||
message: {
|
||||
...event.message,
|
||||
clientInstanceId
|
||||
},
|
||||
clientInstanceId
|
||||
});
|
||||
|
||||
return;
|
||||
@@ -705,11 +714,27 @@ export class WebRTCService implements OnDestroy {
|
||||
this.signalingTransportHandler.sendRawMessage({
|
||||
...event,
|
||||
type: 'voice_state',
|
||||
serverId: event.voiceState.serverId
|
||||
serverId: event.voiceState.serverId,
|
||||
voiceState: {
|
||||
...event.voiceState,
|
||||
clientInstanceId
|
||||
},
|
||||
clientInstanceId
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
requestVoiceClientTakeover(): void {
|
||||
this.signalingTransportHandler.sendRawMessage({
|
||||
type: 'voice_client_takeover',
|
||||
clientInstanceId: this.clientInstance.getClientInstanceId()
|
||||
});
|
||||
}
|
||||
|
||||
getClientInstanceId(): string {
|
||||
return this.clientInstance.getClientInstanceId();
|
||||
}
|
||||
|
||||
/** Disconnect from the signaling server and clean up all state. */
|
||||
disconnect(): void {
|
||||
this.leaveRoom();
|
||||
|
||||
Reference in New Issue
Block a user