Don't count users for options requests

This commit is contained in:
Ajay
2022-05-20 16:59:21 -04:00
parent f520e00ed4
commit 29660d998b

View File

@@ -6,8 +6,10 @@ import { getHash } from "../utils/getHash";
import { NextFunction, Request, Response } from "express";
export function userCounter(req: Request, res: Response, next: NextFunction): void {
axios.post(`${config.userCounterURL}/api/v1/addIP?hashedIP=${getHash(getIP(req), 1)}`)
.catch(() => Logger.debug(`Failing to connect to user counter at: ${config.userCounterURL}`));
if (req.method !== "OPTIONS") {
axios.post(`${config.userCounterURL}/api/v1/addIP?hashedIP=${getHash(getIP(req), 1)}`)
.catch(() => Logger.debug(`Failing to connect to user counter at: ${config.userCounterURL}`));
}
next();
}