share cooldown of minimap with cooldown of earth

This commit is contained in:
HF 2024-02-22 17:21:28 +01:00
parent fb56278d13
commit 6aed8bbb94
3 changed files with 9 additions and 10 deletions

View File

@ -372,6 +372,7 @@
"bcd": 4000,
"pcd" : 7000,
"cds": 60000,
"ranked" : true,
"sd": "2024-02-22"
}
}

View File

@ -38,7 +38,7 @@ function getCanvases(t) {
7: t`Black and White canvas`,
8: t`A canvas for the most active players from the the previous day. Daily ranking updates at 00:00 UTC.`,
10: t`Only four colors. Same rules as moon.`,
11: t`Spam trash on a smaller earth with protected ocean`,
11: t`Spam trash on a smaller earth with protected ocean. Shares cooldown with earth canvas`,
};
/*
* no edit below here needed when adding/removing canvas

View File

@ -44,17 +44,15 @@ export default function allowPlace(
) {
const isalKey = `${ALLOWED_PREFIX}:${ip}`;
const captKey = (CAPTCHA_TIME >= 0) ? `${CAPTCHA_PREFIX}:${ip}` : 'nope';
const ipCdKey = `${PREFIX}:${canvasId}:ip:${ip}`;
// ATTENTION: HARDCODED LINKED COODLOWN OF MINIMAP AND EARTH CANVAS
let canvasCdId = canvasId;
if (canvasId === 11) {
canvasCdId = 0;
}
const ipCdKey = `${PREFIX}:${canvasCdId}:ip:${ip}`;
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}`;
*/
idCdKey = `${PREFIX}:${canvasCdId}:id:${id}`;
} else {
idCdKey = 'nope';
}