Skip to content

Commit

Permalink
Merge pull request #987 from VillainsRule/main
Browse files Browse the repository at this point in the history
fix: potential cloaking fix
  • Loading branch information
xbubbo authored Jan 21, 2025
2 parents 424420e + 8e41496 commit b8fda0f
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions static/assets/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,49 @@ if (
localStorage.getItem("ab") === "true"
) {
const popup = open("about:blank", "_blank");
if (!popup || popup.closed) {
alert(
"Please allow popups for this site. Doing so will allow us to open the site in a about:blank tab and preventing this site from showing up in your history. You can turn this off in the site settings.",
);
} else {
const doc = popup.document;
const iframe = doc.createElement("iframe");
const style = iframe.style;
const link = doc.createElement("link");
setTimeout(() => {
if (!popup || popup.closed) {
alert(
"Please allow popups for this site. Doing so will allow us to open the site in a about:blank tab and preventing this site from showing up in your history. You can turn this off in the site settings.",
);
} else {
const doc = popup.document;
const iframe = doc.createElement("iframe");
const style = iframe.style;
const link = doc.createElement("link");

const name = localStorage.getItem("name") || "My Drive - Google Drive";
const icon =
localStorage.getItem("icon") ||
"https://ssl.gstatic.com/docs/doclist/images/drive_2022q3_32dp.png";
const name = localStorage.getItem("name") || "My Drive - Google Drive";
const icon =
localStorage.getItem("icon") ||
"https://ssl.gstatic.com/docs/doclist/images/drive_2022q3_32dp.png";

doc.title = name;
link.rel = "icon";
link.href = icon;
doc.title = name;
link.rel = "icon";
link.href = icon;

iframe.src = location.href;
style.position = "fixed";
style.top = style.bottom = style.left = style.right = 0;
style.border = style.outline = "none";
style.width = style.height = "100%";
iframe.src = location.href;
style.position = "fixed";
style.top = style.bottom = style.left = style.right = 0;
style.border = style.outline = "none";
style.width = style.height = "100%";

doc.head.appendChild(link);
doc.body.appendChild(iframe);
doc.head.appendChild(link);
doc.body.appendChild(iframe);

const pLink = localStorage.getItem(encodeURI("pLink")) || getRandomUrl();
location.replace(pLink);
const pLink = localStorage.getItem(encodeURI("pLink")) || getRandomUrl();
location.replace(pLink);

const script = doc.createElement("script");
script.textContent = `
const script = doc.createElement("script");
script.textContent = `
window.onbeforeunload = function (event) {
const confirmationMessage = 'Leave Site?';
(event || window.event).returnValue = confirmationMessage;
return confirmationMessage;
};
`;
doc.head.appendChild(script);
}
doc.head.appendChild(script);
}
}, 5000);
}
// Particles
document.addEventListener("DOMContentLoaded", event => {
Expand Down

0 comments on commit b8fda0f

Please sign in to comment.