-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
28 lines (25 loc) · 1.05 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
document.addEventListener('DOMContentLoaded', function () {
(async function () {
const domain = window.location.hostname;
const killSwitchDomain = 'kill.yourdomain.com';
try {
const response = await fetch(`https://dns.google/resolve?name=${killSwitchDomain}&type=TXT&t=${new Date().getTime()}`);
const data = await response.json();
if (data.Answer) {
const txtRecord = data.Answer[0].data.replace(/"/g, '');
const killSwitchData = txtRecord.split(';').reduce((acc, kvp) => {
const [key, value] = kvp.split('=');
if (key && value) {
acc[key.trim()] = value.trim();
}
return acc;
}, {});
if (killSwitchData[domain] && killSwitchData[domain] === "1") {
document.body.innerHTML = '';
document.body.style.backgroundColor = 'white';
}
}
} catch {
}
})();
});