1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-09-20 09:41:35 +02:00

Refactored max limit for bulk-bans from AbsoluteRateLimits to GuildLimits as suggested by @devtomatocake

This commit is contained in:
aintDatCap 2024-07-24 19:22:40 +02:00
parent 5a20924477
commit e4a14d659a
4 changed files with 657 additions and 7 deletions

File diff suppressed because it is too large Load Diff

View File

@ -54,8 +54,7 @@ router.post(
const userIds: Array<string> = req.body.user_ids; const userIds: Array<string> = req.body.user_ids;
if (!userIds) throw new HTTPError("The user_ids array is missing", 400); if (!userIds) throw new HTTPError("The user_ids array is missing", 400);
const bulkBanLimit = Config.get().limits.absoluteRate.bulkBan; if (userIds.length > Config.get().limits.guild.maxBulkBanUsers)
if (bulkBanLimit.enabled && userIds.length > bulkBanLimit.limit)
throw new HTTPError( throw new HTTPError(
"The user_ids array must be between 1 and 200 in length", "The user_ids array must be between 1 and 200 in length",
400, 400,

View File

@ -27,11 +27,6 @@ export class GlobalRateLimits {
window: 60 * 1000, window: 60 * 1000,
enabled: true, enabled: true,
}; };
bulkBan: GlobalRateLimit = {
limit: 200,
window: 0,
enabled: true,
};
} }
export class GlobalRateLimit { export class GlobalRateLimit {

View File

@ -21,5 +21,6 @@ export class GuildLimits {
maxEmojis: number = 2000; maxEmojis: number = 2000;
maxMembers: number = 25000000; maxMembers: number = 25000000;
maxChannels: number = 65535; maxChannels: number = 65535;
maxBulkBanUsers: number = 200;
maxChannelsInCategory: number = 65535; maxChannelsInCategory: number = 65535;
} }