summary refs log tree commit diff
path: root/util/src/entities
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-20 23:35:32 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-20 23:35:32 +0200
commit022e82023d1a5a91e671eacf5ce054e097f379f7 (patch)
tree88bdc12deb06869457ceb9ce910d0d31623d3799 /util/src/entities
parent:bug: fix errror handler (diff)
downloadserver-022e82023d1a5a91e671eacf5ce054e097f379f7.tar.xz
:sparkles: add option to disable all rate limits
Diffstat (limited to 'util/src/entities')
-rw-r--r--util/src/entities/Config.ts2
-rw-r--r--util/src/entities/User.ts4
2 files changed, 3 insertions, 3 deletions
diff --git a/util/src/entities/Config.ts b/util/src/entities/Config.ts
index f969b6bb..a460b437 100644
--- a/util/src/entities/Config.ts
+++ b/util/src/entities/Config.ts
@@ -77,6 +77,7 @@ export interface ConfigValue {
 			maxWebhooks: number;
 		};
 		rate: {
+			disabled: boolean;
 			ip: Omit<RateLimitOptions, "bot_count">;
 			global: RateLimitOptions;
 			error: RateLimitOptions;
@@ -188,6 +189,7 @@ export const DefaultConfigOptions: ConfigValue = {
 			maxWebhooks: 10,
 		},
 		rate: {
+			disabled: true,
 			ip: {
 				count: 500,
 				window: 5,
diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts
index 4c86b2d8..b5c2c308 100644
--- a/util/src/entities/User.ts
+++ b/util/src/entities/User.ts
@@ -161,15 +161,13 @@ export class User extends BaseClass {
 	}
 
 	static async getPublicUser(user_id: string, opts?: FindOneOptions<User>) {
-		const user = await User.findOne(
+		return await User.findOneOrFail(
 			{ id: user_id },
 			{
 				...opts,
 				select: [...PublicUserProjection, ...(opts?.select || [])],
 			}
 		);
-		if (!user) throw new HTTPError("User not found", 404);
-		return user;
 	}
 }