Christmas Eve just got a whole lot more magical. While kids across the globe tuck themselves into bed with one eye on the door, parents everywhere fa…
MongoDB has rushed patches for a high-severity vulnerability that transforms the database giant's compression feature into an open door for memor…
Security researchers have uncovered a security bug with three successive patches for same vulnerability in W3 Total Cache—one of WordPress's most…
Modern businesses and organizations move towards gaining more control over their infrastructure, including the security aspect of it. Using self-host…
Data security whiplash has become a C-suite symptom. One quarter, the headlines trumpet an AI-fueled breakthrough; the next, they groan under the wei…
A severe security vulnerability in n8n, the rapidly growing open-source automation platform, has left thousands of self-hosted servers vulnerable to …
The fight over who owns search data just got serious. Google filed a federal lawsuit on December 19 against SerpApi, accusing the Texas company of de…
The rise of cryptocurrencies and blockchain technology has had a significant impact on various industries, and the online gambling sector is no excep…
IT administrators managing HPE infrastructure just got an urgent wakeup call. A vulnerability in HPE OneView—the centralized dashboard that controls …
Building a website used to be a technical task reserved for developers. Now, almost anyone can put something online in a weekend. That’s a good thing…
const config = {
safeID = 'safelink',
safeURL: ['/p/safelink.html'],
timer: 15,
redirect: true,
text: {
wait: 'The link will appear in 0 second',
direct: 'You’ll be redirected to the download link in 0 second',
shifted: 'Redirecting... [link] if you’re not redirected automatically.',
click: 'Click here',
btn: 'Direct to link.'
}
};
(() => {
const randomURL = url => url[Math.floor(Math.random() * url.length)];
const safeLink = () => config.safeURL.some(path => location.pathname.endsWith(path));
const safeMessage = (text, time) => {
const [start, end] = text.split('0');
return `${start} ${time} ${end}.
`;
};
const outboundLinks = () => {
const links = document.querySelectorAll('a.safeurl[href]');
if (!links.length) return;
links.forEach(anchor => {
const encoded = encodeURIComponent(btoa(anchor.href));
Object.assign(anchor, {
href: `${location.origin}${randomURL(config.safeURL)}?go=${encoded}`,
target: '_self',
rel: 'noopener'
})
})
};
const handleLink = () => {
const params = new URLSearchParams(location.search);
const encoded = params.get('go');
if (!encoded) return;
const link = atob(decodeURIComponent(encoded))
params.delete('go');
history.replaceState({}, '', location.pathname + (params.toString() ? '?' + params : ''));
let counter = config.timer;
const label = config.redirect ? config.text.direct : config.text.wait;
const box = document.getElementById(config.safeID);
if (!box) return;
box.removeAttribute('hidden');
box.innerHTML = safeMessage(label, counter);
const countdown = setInterval(() => {
counter--;
box.innerHTML = safeMessage(label, counter);
if (counter > 0) return;
clearInterval(countdown);
if (config.redirect) {
box.innerHTML = `${config.text.shifted.replace('[link]', `${config.text.click}`)}
`;
location.href = link;
} else {
box.innerHTML = '';
const btn = document.createElement('a');
//btn.className = 'btn';
btn.href = link;
btn.target = '_blank';
btn.rel = 'nofollow noopener noreferrer';
btn.innerHTML = `${config.text.btn}`;
box.appendChild(btn);
}
}, 1000)
};
safeLink() ? handleLink() : outboundLinks();
})();