(function(CONFIG) { /* PARSE CONFIG */ CONFIG = JSON.parse(CONFIG); /* HIDE CONSENT */ const styleSheet = [...document.styleSheets].filter((sheet) => sheet.href && sheet.href.includes("main.css"))[0]; if (styleSheet) { styleSheet.insertRule(` #onetrust-consent-sdk { display: none !important; } `); } /* CHANGE INSTRUCTION TEXT */ const updateInstructions = function(text) { const elm = document.getElementById("instructions"); if (elm) elm.innerText = text; } updateInstructions("FINDING OPTIMAL REGION..."); /* GET REGION */ const getRegion = function() { const failed = 0; return new Promise(function(resolve, reject) { /* PINGS EACH REGION PROXY */ for (const prefix in CONFIG.region.map) { fetch(`${CONFIG.protocol.http}//${prefix}.${location.hostname}/ping`) .then(() => { /* RESOLVE THE PREFIX OF WHICHEVER RESPONDS FIRST */ resolve(prefix); }) .catch(() => { failed++; if (failed >= Object.keys( CONFIG.region.map).length) { reject(); } }) } }); } getRegion() .then((prefix) => { location.href = `${CONFIG.protocol.http}//${prefix}.${location.hostname}` }) .catch(() => { updateInstructions("NO PROXY SERVERS AVAILABLE"); }) })('{"isProd":true,"port":443,"localhost":["localhost","127.0.0.1"],"hosts":{"http":["krunker.io","internal.krunker.io","127.0.0.1:8080"],"mm":["matchmaker.krunker.io","matchmaker_beta.krunker.io","127.0.0.1:5050"],"api":["api.krunker.io","api_beta.krunker.io","127.0.0.1:5080"],"social":["social.krunker.io","social_beta.krunker.io","127.0.0.1:5070"],"editor":["editor.krunker.io","editor_beta.krunker.io","127.0.0.1:5090"],"assets":["assets.krunker.io"],"userAssets":["user-assets.krunker.io"]},"region":{"default":"de-fra","map":{"fra":"de-fra","sv":"us-ca-sv","syd":"au-syd","tok":"jb-hnd","mia":"us-fl","sin":"sgp","ny":"us-nj"},"reverseMap":{"de-fra":"fra","us-ca-sv":"sv","au-syd":"syd","jb-hnd":"tok","us-fl":"mia","sgp":"sin","us-nj":"ny"}},"key":"MfFNnrttL2zWMZeZwmMY6RiNq5LCxhj0QFASBoKh1aujSpHwTRz2ytunxJHmcn23","isSSL":true,"protocol":{"http":"https:","ws":"wss:"}}');