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

View File

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

View File

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

View File

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