adjust cd changes

This commit is contained in:
HF 2022-09-23 17:02:12 +02:00
parent a6b9c6099d
commit 08fef6f6dd

View File

@ -41,9 +41,13 @@ export default function allowPlace(
let idCdKey;
if (id) {
idCdKey = `${PREFIX}:${canvasId}:id:${id}`;
/*
* cooldown by subnet should be more restrictive
*
} else if (ip.includes('.')) {
const ips = ip.slice(0, ip.lastIndexOf('.'));
idCdKey = `${PREFIX}:${canvasId}:ips:${ips}`;
*/
} else {
idCdKey = 'nope';
}
@ -75,10 +79,14 @@ export async function getCoolDown(
if (id) {
const ttlid = await client.pTTL(`${PREFIX}:${canvasId}:id:${id}`);
ttl = Math.max(ttl, ttlid);
/*
* cooldown by subnet should be more restrictive
*
} else if (ip.includes('.')) {
const ips = ip.slice(0, ip.lastIndexOf('.'));
const ttlid = await client.pTTL(`${PREFIX}:${canvasId}:ips:${ips}`);
ttl = Math.max(ttl, ttlid);
*/
}
const cooldown = ttl < 0 ? 0 : ttl;
return cooldown;