summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-21 14:29:18 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-21 14:29:18 +1000
commit86511a0a703de4eb57e2604af9a4ba35ac474b7c (patch)
tree8a7c83dc274cda7a9c77ef15eb7c0ec20def59ce
parentSentry route filtering (diff)
downloadserver-86511a0a703de4eb57e2604af9a4ba35ac474b7c.tar.xz
Random webrtc crap
-rw-r--r--webrtc/src/opcodes/Identify.ts6
-rw-r--r--webrtc/src/opcodes/SelectProtocol.ts20
2 files changed, 13 insertions, 13 deletions
diff --git a/webrtc/src/opcodes/Identify.ts b/webrtc/src/opcodes/Identify.ts
index 7e579027..19a575ab 100644
--- a/webrtc/src/opcodes/Identify.ts
+++ b/webrtc/src/opcodes/Identify.ts
@@ -1,6 +1,6 @@
 import { CLOSECODES, Payload, Send, WebSocket } from "@fosscord/gateway";
 import { validateSchema, VoiceIdentifySchema, VoiceState } from "@fosscord/util";
-import { endpoint, getClients, VoiceOPCodes } from "@fosscord/webrtc";
+import { endpoint, getClients, VoiceOPCodes, PublicIP } from "@fosscord/webrtc";
 import SemanticSDP from "semantic-sdp";
 const defaultSDP = require("./sdp.json");
 
@@ -8,7 +8,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
 	clearTimeout(this.readyTimeout);
 	const { server_id, user_id, session_id, token, streams, video } = validateSchema("VoiceIdentifySchema", data.d) as VoiceIdentifySchema;
 
-	const voiceState = await VoiceState.findOne({ guild_id: server_id, user_id, token, session_id });
+	const voiceState = await VoiceState.findOne({ where: { guild_id: server_id, user_id, token, session_id } });
 	if (!voiceState) return this.close(CLOSECODES.Authentication_failed);
 
 	this.user_id = user_id;
@@ -53,7 +53,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
 				"xsalsa20_poly1305_suffix",
 				"xsalsa20_poly1305"
 			],
-			ip: "127.0.0.1",
+			ip: PublicIP,
 			experiments: []
 		}
 	});
diff --git a/webrtc/src/opcodes/SelectProtocol.ts b/webrtc/src/opcodes/SelectProtocol.ts
index c660c8e2..a3579b34 100644
--- a/webrtc/src/opcodes/SelectProtocol.ts
+++ b/webrtc/src/opcodes/SelectProtocol.ts
@@ -1,7 +1,7 @@
 import { Payload, Send, WebSocket } from "@fosscord/gateway";
 import { SelectProtocolSchema, validateSchema } from "@fosscord/util";
 import { endpoint, PublicIP, VoiceOPCodes } from "@fosscord/webrtc";
-import SemanticSDP from "semantic-sdp";
+import SemanticSDP, { MediaInfo, SDPInfo } from "semantic-sdp";
 
 export async function onSelectProtocol(this: WebSocket, payload: Payload) {
 	if (!this.client) return;
@@ -24,15 +24,15 @@ export async function onSelectProtocol(this: WebSocket, payload: Payload) {
 	const candidates = transport.getLocalCandidates();
 	const candidate = candidates[0];
 
-	const answer = `m=audio ${port} ICE/SDP
-a=fingerprint:${fingerprint}
-c=IN IP4 ${PublicIP}
-a=rtcp:${port}
-a=ice-ufrag:${ice.getUfrag()}
-a=ice-pwd:${ice.getPwd()}
-a=fingerprint:${fingerprint}
-a=candidate:1 1 ${candidate.getTransport()} ${candidate.getFoundation()} ${candidate.getAddress()} ${candidate.getPort()} typ host
-`;
+	const answer =
+		`m=audio ${port} ICE/SDP`
+		+ `a=fingerprint:${fingerprint}`
+		+ `c=IN IP4 ${PublicIP}`
+		+ `a=rtcp:${port}`
+		+ `a=ice-ufrag:${ice.getUfrag()}`
+		+ `a=ice-pwd:${ice.getPwd()}`
+		+ `a=fingerprint:${fingerprint}`
+		+ `a=candidate:1 1 ${candidate.getTransport()} ${candidate.getFoundation()} ${candidate.getAddress()} ${candidate.getPort()} typ host`;
 
 	await Send(this, {
 		op: VoiceOPCodes.SELECT_PROTOCOL_ACK,