summary refs log tree commit diff
path: root/src/gateway/events
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-26 22:29:30 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-26 22:41:21 +1000
commit99ee7e9400f06e8718612d8b52d15215dc620774 (patch)
tree08de8c5d3985b9c2eaa419f5198f891ecd82d012 /src/gateway/events
parentRemove the cdn storage location log (diff)
downloadserver-99ee7e9400f06e8718612d8b52d15215dc620774.tar.xz
Prettier
Diffstat (limited to 'src/gateway/events')
-rw-r--r--src/gateway/events/Connection.ts12
-rw-r--r--src/gateway/events/Message.ts8
2 files changed, 11 insertions, 9 deletions
diff --git a/src/gateway/events/Connection.ts b/src/gateway/events/Connection.ts
index bed3cf44..8747e3ad 100644
--- a/src/gateway/events/Connection.ts
+++ b/src/gateway/events/Connection.ts
@@ -21,10 +21,12 @@ try {
 export async function Connection(
 	this: WS.Server,
 	socket: WebSocket,
-	request: IncomingMessage
+	request: IncomingMessage,
 ) {
 	const forwardedFor = Config.get().security.forwadedFor;
-	const ipAddress = forwardedFor ? request.headers[forwardedFor] as string : request.socket.remoteAddress;
+	const ipAddress = forwardedFor
+		? (request.headers[forwardedFor] as string)
+		: request.socket.remoteAddress;
 
 	socket.ipAddress = ipAddress;
 
@@ -33,7 +35,9 @@ export async function Connection(
 		socket.on("close", Close);
 		// @ts-ignore
 		socket.on("message", Message);
-		console.log(`[Gateway] New connection from ${socket.ipAddress}, total ${this.clients.size}`);
+		console.log(
+			`[Gateway] New connection from ${socket.ipAddress}, total ${this.clients.size}`,
+		);
 
 		const { searchParams } = new URL(`http://localhost${request.url}`);
 		// @ts-ignore
@@ -41,7 +45,7 @@ export async function Connection(
 		if (!["json", "etf"].includes(socket.encoding)) {
 			if (socket.encoding === "etf" && erlpack) {
 				throw new Error(
-					"Erlpack is not installed: 'npm i @yukikaze-bot/erlpack'"
+					"Erlpack is not installed: 'npm i @yukikaze-bot/erlpack'",
 				);
 			}
 			return socket.close(CLOSECODES.Decode_error);
diff --git a/src/gateway/events/Message.ts b/src/gateway/events/Message.ts
index 4699f1af..603f68fa 100644
--- a/src/gateway/events/Message.ts
+++ b/src/gateway/events/Message.ts
@@ -3,7 +3,7 @@ import { WebSocket, Payload } from "@fosscord/gateway";
 var erlpack: any;
 try {
 	erlpack = require("@yukikaze-bot/erlpack");
-} catch (error) { }
+} catch (error) {}
 import OPCodeHandlers from "../opcodes";
 import { Tuple } from "lambert-server";
 import { check } from "../opcodes/instanceOf";
@@ -34,11 +34,9 @@ export async function Message(this: WebSocket, buffer: WS.Data) {
 			}
 		}
 		data = bigIntJson.parse(buffer as string);
-	}
-	else if (typeof buffer == "string") {
+	} else if (typeof buffer == "string") {
 		data = bigIntJson.parse(buffer as string);
-	}
-	else return;
+	} else return;
 
 	check.call(this, PayloadSchema, data);