Browse Source

Fix IP cooldown not working

upstream-develop
poeti8 1 year ago
parent
commit
a0dd4f659c
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      server/db/ip.ts

+ 6
- 1
server/db/ip.ts View File

@ -24,9 +24,14 @@ export const addIP = async (ipToGet: string) => {
return ip;
};
export const getIP = async (ip: string) => {
const cooldownConfig = Number(process.env.NON_USER_COOLDOWN);
const matchedIp = await knex<IP>("ips")
.where({ ip: ip.toLowerCase() })
.andWhere("created_at", ">", new Date().toISOString())
.andWhere(
"created_at",
">",
subMinutes(new Date(), cooldownConfig).toISOString()
)
.first();
return matchedIp;


Loading…
Cancel
Save