diff --git a/static/assets/scripts/frame.js b/static/assets/scripts/frame.js index 0fdc27734..bb3e70d45 100644 --- a/static/assets/scripts/frame.js +++ b/static/assets/scripts/frame.js @@ -22,14 +22,17 @@ function iframeLoad() { const website = iframe.contentWindow?.location.href.replace(window.location.origin, '').replace('/a/', '') document.getElementById('is').value = decodeXor(website) localStorage.setItem('decoded', decodeXor(website)); + window.parent.postMessage({ decodedSet: true }, '*'); } else if (website.includes('/a/q/')) { const website = iframe.contentWindow?.location.href.replace(window.location.origin, '').replace('/a/q/', '') document.getElementById('is').value = decodeXor(website) localStorage.setItem('decoded', decodeXor(website)); + window.parent.postMessage({ decodedSet: true }, '*'); } } } + // Reload function reload() { if (iframe) { @@ -141,43 +144,58 @@ document.addEventListener('fullscreenchange', function () { // Now const key = ['nowgg', 'now.gg']; const decoded = localStorage.getItem('decoded'); +let decodedSet = false; + +window.addEventListener('message', function(event) { + if (event.data && event.data.decodedSet === true) { + decodedSet = true; + console.log('Starting process.'); + now(); + } +}); -if (decoded) { +function now() { + if (decoded) { let found = false; for (const keyword of key) { - if (decoded.includes(keyword)) { - console.log(`${keyword} found`); - found = true; - break; - } + if (decoded.includes(keyword)) { + console.log(`${keyword} found`); + found = true; + break; + } } if (found) { - let count = 0; - let notfound = 0; - const limit = 10; - const max = 35; - const reloadInterval = setInterval(() => { - if (count < limit && iframe) { - const iframeDocument = iframe.contentDocument || iframe.contentWindow.document; - const element = iframeDocument.querySelector('.sc-hGPBjI.gGkQpt'); - if (element) { - console.log("Unsafe proxy or VPN detected. Reloading..."); - iframe.contentWindow.location.reload(); - count++; - notfound = 0; - } else { - console.log("Class not found inside the iframe."); - notfound++; - if (notfound >= max) { - console.log(`Class not found for ${max} consecutive checks. Stopping.`); - clearInterval(reloadInterval); - } - } - } else { - clearInterval(reloadInterval); + let count = 0; + let notfound = 0; + const limit = 10; + const max = 35; + const reloadInterval = setInterval(() => { + if (count < limit && iframe) { + const iframeDocument = iframe.contentDocument || iframe.contentWindow.document; + const element = iframeDocument.querySelector('.sc-hGPBjI.gGkQpt'); + if (element) { + console.log("Unsafe proxy or VPN detected. Reloading..."); + iframe.contentWindow.location.reload(); + count += 1; + notfound = 0; + } else { + console.log("Class not found inside the iframe."); + notfound += 1; + if (notfound >= max) { + console.log(`Class not found for ${max} consecutive checks. Stopping.`); + clearInterval(reloadInterval); } - }, 500); + } + } else { + clearInterval(reloadInterval); + } + }, 500); } -} else { + } else { console.log('Decoded not found in localStorage.'); + } +} + +if (decodedSet) { + now(); } diff --git a/static/go.html b/static/go.html index 0d7d88f0c..740a13630 100644 --- a/static/go.html +++ b/static/go.html @@ -56,11 +56,9 @@ height="100%" width="100%" allowfullscreen - sandbox="allow-scripts allow-same-origin"> - ></iframe - > + sandbox="allow-forms allow-scripts allow-same-origin"></iframe> <script src="assets/scripts/index.js?v=9"></script> - <script src="assets/scripts/frame.js?v=20"></script> + <script src="assets/scripts/frame.js?v=22"></script> <script src="./m/bundle.js?v=4"></script> <script src="./m/config.js?v=3"></script> <script src="https://kit.fontawesome.com/1237c86ba0.js" crossorigin="anonymous"></script>