forked from ppfun/pixelplanet
adjust cd changes
This commit is contained in:
parent
a6b9c6099d
commit
08fef6f6dd
|
@ -41,9 +41,13 @@ export default function allowPlace(
|
||||||
let idCdKey;
|
let idCdKey;
|
||||||
if (id) {
|
if (id) {
|
||||||
idCdKey = `${PREFIX}:${canvasId}:id:${id}`;
|
idCdKey = `${PREFIX}:${canvasId}:id:${id}`;
|
||||||
|
/*
|
||||||
|
* cooldown by subnet should be more restrictive
|
||||||
|
*
|
||||||
} else if (ip.includes('.')) {
|
} else if (ip.includes('.')) {
|
||||||
const ips = ip.slice(0, ip.lastIndexOf('.'));
|
const ips = ip.slice(0, ip.lastIndexOf('.'));
|
||||||
idCdKey = `${PREFIX}:${canvasId}:ips:${ips}`;
|
idCdKey = `${PREFIX}:${canvasId}:ips:${ips}`;
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
idCdKey = 'nope';
|
idCdKey = 'nope';
|
||||||
}
|
}
|
||||||
|
@ -75,10 +79,14 @@ export async function getCoolDown(
|
||||||
if (id) {
|
if (id) {
|
||||||
const ttlid = await client.pTTL(`${PREFIX}:${canvasId}:id:${id}`);
|
const ttlid = await client.pTTL(`${PREFIX}:${canvasId}:id:${id}`);
|
||||||
ttl = Math.max(ttl, ttlid);
|
ttl = Math.max(ttl, ttlid);
|
||||||
|
/*
|
||||||
|
* cooldown by subnet should be more restrictive
|
||||||
|
*
|
||||||
} else if (ip.includes('.')) {
|
} else if (ip.includes('.')) {
|
||||||
const ips = ip.slice(0, ip.lastIndexOf('.'));
|
const ips = ip.slice(0, ip.lastIndexOf('.'));
|
||||||
const ttlid = await client.pTTL(`${PREFIX}:${canvasId}:ips:${ips}`);
|
const ttlid = await client.pTTL(`${PREFIX}:${canvasId}:ips:${ips}`);
|
||||||
ttl = Math.max(ttl, ttlid);
|
ttl = Math.max(ttl, ttlid);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
const cooldown = ttl < 0 ? 0 : ttl;
|
const cooldown = ttl < 0 ? 0 : ttl;
|
||||||
return cooldown;
|
return cooldown;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user