mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-07 19:32:34 +01:00
✏️ fix RateLimit onlyIp typo
This commit is contained in:
parent
99cb4c048b
commit
a67880b371
@ -86,7 +86,7 @@ export class FosscordServer extends Server {
|
||||
// @ts-ignore
|
||||
this.app = api;
|
||||
api.use(RateLimit({ bucket: "global", count: 10, window: 5, bot: 250 }));
|
||||
api.use(RateLimit({ bucket: "error", count: 5, error: true, window: 5, bot: 15, onylIp: true }));
|
||||
api.use(RateLimit({ bucket: "error", count: 5, error: true, window: 5, bot: 15, onlyIp: true }));
|
||||
api.use("/guilds/:id", RateLimit({ count: 5, window: 5 }));
|
||||
api.use("/webhooks/:id", RateLimit({ count: 5, window: 5 }));
|
||||
api.use("/channels/:id", RateLimit({ count: 5, window: 5 }));
|
||||
|
@ -42,14 +42,14 @@ export default function RateLimit(opts: {
|
||||
MODIFY?: number;
|
||||
error?: boolean;
|
||||
success?: boolean;
|
||||
onylIp?: boolean;
|
||||
onlyIp?: boolean;
|
||||
}): any {
|
||||
Cache.init(); // will only initalize it once
|
||||
|
||||
return async (req: Request, res: Response, next: NextFunction): Promise<any> => {
|
||||
const bucket_id = opts.bucket || req.originalUrl.replace(API_PREFIX_TRAILING_SLASH, "");
|
||||
var user_id = getIpAdress(req);
|
||||
if (!opts.onylIp && req.user_id) user_id = req.user_id;
|
||||
if (!opts.onlyIp && req.user_id) user_id = req.user_id;
|
||||
|
||||
var max_hits = opts.count;
|
||||
if (opts.bot && req.user_bot) max_hits = opts.bot;
|
||||
|
Loading…
Reference in New Issue
Block a user