Last active
July 22, 2024 12:36
-
-
Save EldonMcGuinness/4068f8523b480802bfff210e5a5010ec to your computer and use it in GitHub Desktop.
nextDNS Block TLDs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script is to be used on nextdns.io => Security => Block Top-Level Domains (TLDs) => Add a TLD | |
# Once the modal window is open, in the console you can run the below code to block all TLDs that are | |
# not in the validTLD array. | |
const delay = ms => new Promise(res => setTimeout(res, ms)); | |
const blocker = async () => { | |
// List of TLDs that should not be blocked | |
let validTLD = [ | |
'com', | |
'net', | |
'org' | |
] | |
// Use this line to unblock domains | |
//for (let item of document.querySelectorAll("body > div.modal.show > div > div > div.p-0.modal-body button.btn-danger")){ | |
// Use this line to block domains | |
for (let item of document.querySelectorAll("body > div.modal.show > div > div > div.p-0.modal-body button.btn-primary")){ | |
await delay(250); | |
let tld = item.parentElement.previousSibling.firstChild.firstChild.innerText.substring(1); | |
if ( validTLD.includes( tld ) ){ | |
// console.log(tld+" Skipped"); | |
continue; | |
} | |
console.log(tld+" Blocked"); | |
item.click(); | |
} | |
console.log("Done!"); | |
} | |
blocker(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment