summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-29 17:12:46 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-29 17:12:46 +0200
commitd0292ef96bedde2dd23962c15b2a0446b8492fb0 (patch)
tree3cd962d1ca42d4bb7f8f71bc8f8e919eb397f5a8
parentfixed tests for cdn (diff)
downloadserver-d0292ef96bedde2dd23962c15b2a0446b8492fb0.tar.xz
:bug: convert bigint -> string
-rw-r--r--api/src/middlewares/RateLimit.ts4
-rw-r--r--api/src/routes/channels/#channel_id/messages/index.ts2
-rw-r--r--api/src/routes/guilds/index.ts2
-rw-r--r--api/src/schema/Guild.ts2
-rw-r--r--bundle/database.dbbin225280 -> 225280 bytes
-rw-r--r--gateway/src/opcodes/Identify.ts2
-rw-r--r--gateway/src/schema/Activity.ts4
-rw-r--r--util/src/entities/Application.ts2
-rw-r--r--util/src/interfaces/Event.ts6
9 files changed, 12 insertions, 12 deletions
diff --git a/api/src/middlewares/RateLimit.ts b/api/src/middlewares/RateLimit.ts
index e0cf103a..ed6b951a 100644
--- a/api/src/middlewares/RateLimit.ts
+++ b/api/src/middlewares/RateLimit.ts
@@ -1,6 +1,6 @@
 import { Config, listenEvent, emitEvent, RateLimit } from "@fosscord/util";
 import { NextFunction, Request, Response, Router } from "express";
-import { LessThan } from "typeorm";
+import { LessThan, MoreThan } from "typeorm";
 import { getIpAdress } from "../util/ipAddress";
 import { API_PREFIX_TRAILING_SLASH } from "./Authentication";
 
@@ -100,7 +100,7 @@ export async function initRateLimits(app: Router) {
 		Cache.set(event.channel_id as string, event.data);
 		event.acknowledge?.();
 	});
-	await RateLimit.delete({ expires_at: LessThan(new Date()) }); // clean up if not already deleted
+	await RateLimit.delete({ expires_at: MoreThan(new Date()) }); // cleans up if not already deleted, morethan -> older date
 	const limits = await RateLimit.find({ blocked: true });
 	limits.forEach((limit) => {
 		Cache.set(limit.executor_id, limit);
diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts
index 6307c022..17944548 100644
--- a/api/src/routes/channels/#channel_id/messages/index.ts
+++ b/api/src/routes/channels/#channel_id/messages/index.ts
@@ -77,7 +77,7 @@ router.get("/", async (req: Request, res: Response) => {
 			delete x.user_ids;
 		});
 		// @ts-ignore
-		if (!x.author) x.author = { discriminator: "0000", username: "Deleted User", public_flags: 0n, avatar: null };
+		if (!x.author) x.author = { discriminator: "0000", username: "Deleted User", public_flags: "0", avatar: null };
 
 		return x;
 	});
diff --git a/api/src/routes/guilds/index.ts b/api/src/routes/guilds/index.ts
index c158c7d4..1e83cf13 100644
--- a/api/src/routes/guilds/index.ts
+++ b/api/src/routes/guilds/index.ts
@@ -47,7 +47,7 @@ router.post("/", check(GuildCreateSchema), async (req: Request, res: Response) =
 		premium_tier: 0,
 		public_updates_channel_id: undefined,
 		rules_channel_id: undefined,
-		system_channel_flags: 0,
+		system_channel_flags: "0",
 		system_channel_id: undefined,
 		unavailable: false,
 		vanity_url_code: undefined,
diff --git a/api/src/schema/Guild.ts b/api/src/schema/Guild.ts
index 01690ae9..3e98fe76 100644
--- a/api/src/schema/Guild.ts
+++ b/api/src/schema/Guild.ts
@@ -33,7 +33,7 @@ export const GuildUpdateSchema = {
 	$icon: String,
 	$verification_level: Number,
 	$default_message_notifications: Number,
-	$system_channel_flags: Number,
+	$system_channel_flags: String,
 	$system_channel_id: String,
 	$explicit_content_filter: Number,
 	$public_updates_channel_id: String,
diff --git a/bundle/database.db b/bundle/database.db
index 9572c45e..2d4abd49 100644
--- a/bundle/database.db
+++ b/bundle/database.db
Binary files differdiff --git a/gateway/src/opcodes/Identify.ts b/gateway/src/opcodes/Identify.ts
index 5be2acce..87008998 100644
--- a/gateway/src/opcodes/Identify.ts
+++ b/gateway/src/opcodes/Identify.ts
@@ -42,7 +42,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
 		}
 	}
 
-	const members = await Member.find({ where: { id: this.user_id }, relations: ["guilds"] });
+	const members = await Member.find({ where: { id: this.user_id }, relations: ["guild"] });
 	const merged_members = members.map((x: any) => {
 		const y = { ...x, user_id: x.id };
 		delete y.settings;
diff --git a/gateway/src/schema/Activity.ts b/gateway/src/schema/Activity.ts
index 0fd0592f..f1665efd 100644
--- a/gateway/src/schema/Activity.ts
+++ b/gateway/src/schema/Activity.ts
@@ -39,7 +39,7 @@ export const ActivitySchema = {
 				$match: String,
 			},
 			$instance: Boolean,
-			$flags: BigInt,
+			$flags: String,
 		},
 	],
 	$since: Number, // unix time (in milliseconds) of when the client went idle, or null if the client is not idle
@@ -79,7 +79,7 @@ export interface ActivitySchema {
 				match?: string; // the secret for a specific instanced match
 			};
 			instance?: boolean;
-			flags: bigint; // activity flags OR d together, describes what the payload includes
+			flags: string; // activity flags OR d together, describes what the payload includes
 		}
 	];
 	since?: number; // unix time (in milliseconds) of when the client went idle, or null if the client is not idle
diff --git a/util/src/entities/Application.ts b/util/src/entities/Application.ts
index a87b5cea..b179d171 100644
--- a/util/src/entities/Application.ts
+++ b/util/src/entities/Application.ts
@@ -62,7 +62,7 @@ export class Application extends BaseClass {
 	cover_image?: string; // the application's default rich presence invite cover image hash
 
 	@Column()
-	flags: number; // the application's public flags
+	flags: string; // the application's public flags
 }
 
 export interface ApplicationCommand {
diff --git a/util/src/interfaces/Event.ts b/util/src/interfaces/Event.ts
index 0de55f71..814a8beb 100644
--- a/util/src/interfaces/Event.ts
+++ b/util/src/interfaces/Event.ts
@@ -36,7 +36,7 @@ export interface ReadyEventData {
 		mobile: boolean;
 		desktop: boolean;
 		email: string | undefined;
-		flags: bigint;
+		flags: string;
 		mfa_enabled: boolean;
 		nsfw_allowed: boolean;
 		phone: string | undefined;
@@ -85,7 +85,7 @@ export interface ReadyEventData {
 	};
 	application?: {
 		id: string;
-		flags: bigint;
+		flags: string;
 	};
 	merged_members?: Omit<Member, "settings" | "user">[][];
 	// probably all users who the user is in contact with
@@ -95,7 +95,7 @@ export interface ReadyEventData {
 		id: string;
 		username: string;
 		bot: boolean;
-		public_flags: bigint;
+		public_flags: string;
 	}[];
 }