summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/api/middlewares/TestClient.ts9
-rw-r--r--src/gateway/events/Message.ts1
-rw-r--r--src/gateway/opcodes/VoiceServerPing.ts9
-rw-r--r--src/gateway/opcodes/index.ts5
4 files changed, 23 insertions, 1 deletions
diff --git a/src/api/middlewares/TestClient.ts b/src/api/middlewares/TestClient.ts
index 3afd0339..480d7f0b 100644
--- a/src/api/middlewares/TestClient.ts
+++ b/src/api/middlewares/TestClient.ts
@@ -82,6 +82,15 @@ export default function TestClient(app: Application) {
 
 		res.send(fs.readFileSync(path.join(__dirname, "..", "..", "..", "assets", "developers.html"), { encoding: "utf8" }));
 	});
+	app.get("/popout", (_req: Request, res: Response) => {
+		const { useTestClient } = Config.get().client;
+		res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24);
+		res.set("content-type", "text/html");
+
+		if (!useTestClient) return res.send("Test client is disabled on this instance. Use a stand-alone client to connect this instance.");
+
+		res.send(fs.readFileSync(path.join(__dirname, "..", "..", "..", "assets", "popout.html"), { encoding: "utf8" }));
+	});
 	app.get("*", (req: Request, res: Response) => {
 		const { useTestClient } = Config.get().client;
 		res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24);
diff --git a/src/gateway/events/Message.ts b/src/gateway/events/Message.ts
index e5ee5828..d58db1c3 100644
--- a/src/gateway/events/Message.ts
+++ b/src/gateway/events/Message.ts
@@ -43,6 +43,7 @@ export async function Message(this: WebSocket, buffer: Buffer) {
 	const OPCodeHandler = OPCodeHandlers[data.op];
 	if (!OPCodeHandler) {
 		console.error("[Gateway] Unkown opcode " + data.op);
+		if(process.env.WS_VERBOSE_UNKNOWN) console.log(data);
 		// TODO: if all opcodes are implemented comment this out:
 		// this.close(CloseCodes.Unknown_opcode);
 		return;
diff --git a/src/gateway/opcodes/VoiceServerPing.ts b/src/gateway/opcodes/VoiceServerPing.ts
new file mode 100644
index 00000000..f684cb33
--- /dev/null
+++ b/src/gateway/opcodes/VoiceServerPing.ts
@@ -0,0 +1,9 @@
+import { Payload, WebSocket } from "@fosscord/gateway";
+import { Send } from "../util/Send";
+
+export async function onVoiceServerPing(this: WebSocket, data: Payload) {
+	console.log("Got voice server ping: ", data, "Doing a noop!");
+	
+
+	// return this.close(CloseCodes.Invalid_session);
+}
diff --git a/src/gateway/opcodes/index.ts b/src/gateway/opcodes/index.ts
index d5dc7de1..818d1597 100644
--- a/src/gateway/opcodes/index.ts
+++ b/src/gateway/opcodes/index.ts
@@ -6,6 +6,7 @@ import { onPresenceUpdate } from "./PresenceUpdate";
 import { onRequestGuildMembers } from "./RequestGuildMembers";
 import { onResume } from "./Resume";
 import { onVoiceStateUpdate } from "./VoiceStateUpdate";
+import { onVoiceServerPing } from "./VoiceServerPing";
 
 export type OPCodeHandler = (this: WebSocket, data: Payload) => any;
 
@@ -14,12 +15,14 @@ export default {
 	2: onIdentify,
 	3: onPresenceUpdate,
 	4: onVoiceStateUpdate,
-	// 5: Voice Server Ping
+	5: onVoiceServerPing, //Voice Server Ping
 	6: onResume,
 	// 7: Reconnect: You should attempt to reconnect and resume immediately.
 	8: onRequestGuildMembers,
 	// 9: Invalid Session
 	// 10: Hello
+	// 11: Heartbeat ACK
+	
 	// 13: Dm_update
 	14: onLazyRequest
 };