POKI-Bike-Game / patch.js
shethjenil's picture
Upload 21 files
39dcf3b verified
// (function () {
// const allowedOrigin = window.location.origin;
// const originalAssign = window.location.assign;
// const originalReplace = window.location.replace;
// function isAllowed(url) {
// try {
// const u = new URL(url, window.location.href);
// return u.origin === allowedOrigin;
// } catch (e) {
// return false;
// }
// }
// window.location.assign = function (url) {
// if (isAllowed(url)) {
// originalAssign.call(window.location, url);
// } else {
// console.warn("Blocked redirect to:", url);
// }
// };
// window.location.replace = function (url) {
// if (isAllowed(url)) {
// originalReplace.call(window.location, url);
// } else {
// console.warn("Blocked redirect to:", url);
// }
// };
// })();
let lastSafeURL = location.href;
setInterval(() => {
if (location.href !== lastSafeURL) {
const newURL = new URL(location.href);
if (newURL.origin !== location.origin) {
console.warn("Redirect blocked:", location.href);
history.pushState(null, "", lastSafeURL);
} else {
lastSafeURL = location.href;
}
}
}, 50);