summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@proton.me>2023-03-18 19:50:38 -0400
committerPuyodead1 <puyodead@proton.me>2023-03-18 19:50:38 -0400
commit5a7765c7dc6e0ee5c873625ef76b0ee9c4e12300 (patch)
tree576300cd87a4a84acf5580f412e49095eda071fb /src
parentfix a few linting errors (diff)
downloadserver-5a7765c7dc6e0ee5c873625ef76b0ee9c4e12300.tar.xz
prettier
Diffstat (limited to 'src')
-rw-r--r--src/api/Server.ts2
-rw-r--r--src/api/middlewares/Authentication.ts2
-rw-r--r--src/connections/Discord/DiscordSettings.ts2
-rw-r--r--src/gateway/opcodes/Identify.ts101
-rw-r--r--src/util/index.ts2
5 files changed, 58 insertions, 51 deletions
diff --git a/src/api/Server.ts b/src/api/Server.ts
index dc3b66ef..30f02e57 100644
--- a/src/api/Server.ts
+++ b/src/api/Server.ts
@@ -26,7 +26,7 @@ import {
 	Sentry,
 	WebAuthn,
 	ConnectionConfig,
-	ConnectionLoader
+	ConnectionLoader,
 } from "@fosscord/util";
 import { Request, Response, Router } from "express";
 import { Server, ServerOptions } from "lambert-server";
diff --git a/src/api/middlewares/Authentication.ts b/src/api/middlewares/Authentication.ts
index 55527984..7f008a39 100644
--- a/src/api/middlewares/Authentication.ts
+++ b/src/api/middlewares/Authentication.ts
@@ -53,7 +53,7 @@ export const NO_AUTHORIZATION_ROUTES = [
 	// Asset delivery
 	/\/guilds\/\d+\/widget\.(json|png)/,
 	// Connections
-	/\/connections\/\w+\/callback/
+	/\/connections\/\w+\/callback/,
 ];
 
 export const API_PREFIX = /^\/api(\/v\d+)?/;
diff --git a/src/connections/Discord/DiscordSettings.ts b/src/connections/Discord/DiscordSettings.ts
index a8976f12..3751b041 100644
--- a/src/connections/Discord/DiscordSettings.ts
+++ b/src/connections/Discord/DiscordSettings.ts
@@ -2,4 +2,4 @@ export class DiscordSettings {
 	enabled: boolean = false;
 	clientId: string | null = null;
 	clientSecret: string | null = null;
-}
\ No newline at end of file
+}
diff --git a/src/gateway/opcodes/Identify.ts b/src/gateway/opcodes/Identify.ts
index d1d15790..c2a12918 100644
--- a/src/gateway/opcodes/Identify.ts
+++ b/src/gateway/opcodes/Identify.ts
@@ -79,53 +79,60 @@ export async function onIdentify(this: WebSocket, data: Payload) {
 	this.user_id = decoded.id;
 	const session_id = this.session_id;
 
-	const [user, read_states, members, recipients, session, application, connected_accounts] =
-		await Promise.all([
-			User.findOneOrFail({
-				where: { id: this.user_id },
-				relations: ["relationships", "relationships.to", "settings"],
-				select: [...PrivateUserProjection, "relationships"],
-			}),
-			ReadState.find({ where: { user_id: this.user_id } }),
-			Member.find({
-				where: { id: this.user_id },
-				select: MemberPrivateProjection,
-				relations: [
-					"guild",
-					"guild.channels",
-					"guild.emojis",
-					"guild.roles",
-					"guild.stickers",
-					"user",
-					"roles",
-				],
-			}),
-			Recipient.find({
-				where: { user_id: this.user_id, closed: false },
-				relations: [
-					"channel",
-					"channel.recipients",
-					"channel.recipients.user",
-				],
-				// TODO: public user selection
-			}),
-			// save the session and delete it when the websocket is closed
-			Session.create({
-				user_id: this.user_id,
-				session_id: session_id,
-				// TODO: check if status is only one of: online, dnd, offline, idle
-				status: identify.presence?.status || "offline", //does the session always start as online?
-				client_info: {
-					//TODO read from identity
-					client: "desktop",
-					os: identify.properties?.os,
-					version: 0,
-				},
-				activities: [],
-			}).save(),
-			Application.findOne({ where: { id: this.user_id } }),
-			ConnectedAccount.find({ where: { user_id: this.user_id } })
-		]);
+	const [
+		user,
+		read_states,
+		members,
+		recipients,
+		session,
+		application,
+		connected_accounts,
+	] = await Promise.all([
+		User.findOneOrFail({
+			where: { id: this.user_id },
+			relations: ["relationships", "relationships.to", "settings"],
+			select: [...PrivateUserProjection, "relationships"],
+		}),
+		ReadState.find({ where: { user_id: this.user_id } }),
+		Member.find({
+			where: { id: this.user_id },
+			select: MemberPrivateProjection,
+			relations: [
+				"guild",
+				"guild.channels",
+				"guild.emojis",
+				"guild.roles",
+				"guild.stickers",
+				"user",
+				"roles",
+			],
+		}),
+		Recipient.find({
+			where: { user_id: this.user_id, closed: false },
+			relations: [
+				"channel",
+				"channel.recipients",
+				"channel.recipients.user",
+			],
+			// TODO: public user selection
+		}),
+		// save the session and delete it when the websocket is closed
+		Session.create({
+			user_id: this.user_id,
+			session_id: session_id,
+			// TODO: check if status is only one of: online, dnd, offline, idle
+			status: identify.presence?.status || "offline", //does the session always start as online?
+			client_info: {
+				//TODO read from identity
+				client: "desktop",
+				os: identify.properties?.os,
+				version: 0,
+			},
+			activities: [],
+		}).save(),
+		Application.findOne({ where: { id: this.user_id } }),
+		ConnectedAccount.find({ where: { user_id: this.user_id } }),
+	]);
 
 	if (!user) return this.close(CLOSECODES.Authentication_failed);
 	if (!user.settings) {
diff --git a/src/util/index.ts b/src/util/index.ts
index 9c0f7881..ef2671a5 100644
--- a/src/util/index.ts
+++ b/src/util/index.ts
@@ -25,4 +25,4 @@ export * from "./dtos/index";
 export * from "./schemas";
 export * from "./imports";
 export * from "./config";
-export * from "./connections"
+export * from "./connections";