Add rate limit for unban and fix admin rate limits

This commit is contained in:
Hri7566 2024-07-13 00:32:39 -04:00
parent 06f6413945
commit 4b70bb0e79
5 changed files with 23 additions and 16 deletions

View File

@ -4,6 +4,7 @@ user:
m: 50
ch: 1000
kickban: 125
unban: 125
t: 7.8125
+ls: 16.666666666666668
-ls: 16.666666666666668
@ -11,7 +12,6 @@ user:
hi: 50
bye: 50
devices: 50
admin_message: 50
admin message: 50
chains:
userset:
@ -29,6 +29,7 @@ crown:
m: 50
ch: 1000
kickban: 125
unban: 125
t: 7.8125
+ls: 16.666666666666668
-ls: 16.666666666666668
@ -36,7 +37,6 @@ crown:
hi: 50
bye: 50
devices: 50
admin_message: 50
admin message: 50
chains:
userset:
@ -54,6 +54,7 @@ admin:
m: 16.666666666666668
ch: 100
kickban: 16.666666666666668
unban: 125
t: 3.90625
+ls: 16.666666666666668
-ls: 16.666666666666668
@ -61,7 +62,6 @@ admin:
hi: 50
bye: 50
devices: 50
admin_message: 16.666666666666668
admin message: 16.666666666666668
chains:
userset:

View File

@ -11,6 +11,7 @@ export interface RateLimitConfigList<
m: RL;
ch: RL;
kickban: RL;
unban: RL;
t: RL;
"+ls": RL;
"-ls": RL;
@ -50,6 +51,7 @@ export const config = loadConfig<RateLimitsConfig>("config/ratelimits.yml", {
m: 1000 / 20,
ch: 1000 / 1,
kickban: 1000 / 8,
unban: 1000 / 8,
t: 1000 / 128,
"+ls": 1000 / 60,
"-ls": 1000 / 60,
@ -81,6 +83,7 @@ export const config = loadConfig<RateLimitsConfig>("config/ratelimits.yml", {
m: 1000 / 20,
ch: 1000 / 1,
kickban: 1000 / 8,
unban: 1000 / 8,
t: 1000 / 128,
"+ls": 1000 / 60,
"-ls": 1000 / 60,
@ -112,6 +115,7 @@ export const config = loadConfig<RateLimitsConfig>("config/ratelimits.yml", {
m: 1000 / 60,
ch: 1000 / 10,
kickban: 1000 / 60,
unban: 1000 / 8,
t: 1000 / 256,
"+ls": 1000 / 60,
"-ls": 1000 / 60,

View File

@ -7,16 +7,17 @@ export const adminLimits: RateLimitConstructorList = {
a: () => new RateLimit(config.admin.normal.a),
m: () => new RateLimit(config.admin.normal.m),
ch: () => new RateLimit(config.admin.normal.ch),
kickban: () => new RateLimit(config.crown.normal.kickban),
t: () => new RateLimit(config.crown.normal.t),
"+ls": () => new RateLimit(config.crown.normal["+ls"]),
"-ls": () => new RateLimit(config.crown.normal["-ls"]),
chown: () => new RateLimit(config.crown.normal.chown),
kickban: () => new RateLimit(config.admin.normal.kickban),
unban: () => new RateLimit(config.admin.normal.unban),
t: () => new RateLimit(config.admin.normal.t),
"+ls": () => new RateLimit(config.admin.normal["+ls"]),
"-ls": () => new RateLimit(config.admin.normal["-ls"]),
chown: () => new RateLimit(config.admin.normal.chown),
hi: () => new RateLimit(config.crown.normal.hi),
bye: () => new RateLimit(config.crown.normal.bye),
devices: () => new RateLimit(config.crown.normal.devices),
"admin message": () => new RateLimit(config.crown.normal["admin message"])
hi: () => new RateLimit(config.admin.normal.hi),
bye: () => new RateLimit(config.admin.normal.bye),
devices: () => new RateLimit(config.admin.normal.devices),
"admin message": () => new RateLimit(config.admin.normal["admin message"])
},
chains: {
userset: () =>
@ -26,13 +27,13 @@ export const adminLimits: RateLimitConstructorList = {
),
chset: () =>
new RateLimitChain(
config.crown.chains.chset.interval,
config.crown.chains.userset.num
config.admin.chains.chset.interval,
config.admin.chains.userset.num
),
n: () =>
new RateLimitChain(
config.crown.chains.n.interval,
config.crown.chains.userset.num
config.admin.chains.n.interval,
config.admin.chains.userset.num
)
}
};

View File

@ -8,6 +8,7 @@ export const crownLimits: RateLimitConstructorList = {
m: () => new RateLimit(config.crown.normal.m),
ch: () => new RateLimit(config.crown.normal.ch),
kickban: () => new RateLimit(config.crown.normal.kickban),
unban: () => new RateLimit(config.crown.normal.unban),
t: () => new RateLimit(config.crown.normal.t),
"+ls": () => new RateLimit(config.crown.normal["+ls"]),
"-ls": () => new RateLimit(config.crown.normal["-ls"]),

View File

@ -8,6 +8,7 @@ export const userLimits: RateLimitConstructorList = {
m: () => new RateLimit(config.user.normal.m),
ch: () => new RateLimit(config.user.normal.ch),
kickban: () => new RateLimit(config.user.normal.kickban),
unban: () => new RateLimit(config.user.normal.unban),
t: () => new RateLimit(config.user.normal.t),
"+ls": () => new RateLimit(config.user.normal["+ls"]),
"-ls": () => new RateLimit(config.user.normal["-ls"]),