mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-05-13 17:13:15 +00:00
wss on voice conditionally
This commit is contained in:
@@ -322,11 +322,15 @@ class Localuser {
|
||||
|
||||
this.mdBox();
|
||||
|
||||
this.voiceFactory = new VoiceFactory({id: this.user.id}, (g) => {
|
||||
if (this.ws) {
|
||||
this.ws.send(JSON.stringify(g));
|
||||
}
|
||||
});
|
||||
this.voiceFactory = new VoiceFactory(
|
||||
{id: this.user.id},
|
||||
(g) => {
|
||||
if (this.ws) {
|
||||
this.ws.send(JSON.stringify(g));
|
||||
}
|
||||
},
|
||||
this.info.api.startsWith("https://"),
|
||||
);
|
||||
this.handleVoice();
|
||||
this.mfa_enabled = ready.d.user.mfa_enabled as boolean;
|
||||
this.userinfo.username = this.user.username;
|
||||
|
||||
@@ -15,10 +15,13 @@ function forceVideo(video: HTMLVideoElement) {
|
||||
class VoiceFactory {
|
||||
settings: {id: string};
|
||||
handleGateway: (obj: Object) => void;
|
||||
secure: boolean;
|
||||
constructor(
|
||||
usersettings: VoiceFactory["settings"],
|
||||
handleGateway: VoiceFactory["handleGateway"],
|
||||
secure: boolean,
|
||||
) {
|
||||
this.secure = secure;
|
||||
this.settings = usersettings;
|
||||
this.handleGateway = handleGateway;
|
||||
}
|
||||
@@ -1312,7 +1315,9 @@ a=rtcp-mux\r`;
|
||||
}
|
||||
}
|
||||
|
||||
const ws = new WebSocket(("wss://" + this.urlobj.url) as string);
|
||||
const ws = new WebSocket(
|
||||
((this.owner.secure ? "wss://" : "ws://") + this.urlobj.url) as string,
|
||||
);
|
||||
this.ws = ws;
|
||||
ws.onclose = () => {
|
||||
this.leave();
|
||||
|
||||
Reference in New Issue
Block a user