switch to mongoose
This commit is contained in:
@@ -6,6 +6,8 @@ import { db } from "fosscord-server-util";
|
||||
// TODO: increment count on serverside
|
||||
|
||||
export async function GlobalRateLimit(req: Request, res: Response, next: NextFunction) {
|
||||
return next();
|
||||
// TODO: use new db mongoose models
|
||||
if (!Config.get().limits.rate.ip.enabled) return next();
|
||||
|
||||
const ip = getIpAdress(req);
|
||||
|
||||
@@ -5,6 +5,9 @@ import { getIpAdress } from "./GlobalRateLimit";
|
||||
|
||||
export function RateLimit({ count = 10, timespan = 1000 * 5, name = "/" }) {
|
||||
return async (req: Request, res: Response, next: NextFunction) => {
|
||||
return next();
|
||||
// TODO: use new db mongoose models
|
||||
|
||||
let id = req.userid || getIpAdress(req);
|
||||
|
||||
const limit: { count: number; start: number } = (await db.data.ratelimit.routes[name][id].get()) || {
|
||||
|
||||
Reference in New Issue
Block a user