If you're a Mastodon moderator looking to quickly suspend a bunch of other instances from federation, here's some code that'll let you do it as a batch. It requires interating with your browser's Javascript console.
- Open your web browser to your Mastodon instance and log in
- Open your browser's Javascript console.
- Safari: command-option-c
- Firefox: command-option-k
- Chrome: command-option-j
- Copy
block.js
below, edit lines 5 and 27 to point to your own instance (replace[your-instance-domain]
), and then paste that into the console and press enter. (There should be an input box at the bottom of the console window.)- You can also edit line 22 if you want to add an internal-only message about why the domains are being blocked. If you don't want a message, change line 22 to just
""
.
- You can also edit line 22 if you want to add an internal-only message about why the domains are being blocked. If you don't want a message, change line 22 to just
- Turn your list of domains to block into a JSON array
- It should look like this:
["domain 1", "domain 2", "domain 3", etc.]
- The list begins with a
[
and ends with a]
- The items in the list are separated by commas
- Each item in the list must be quoted
- It should look like this:
- Run the blocker by typing into your browser console:
block(["domain 1", "domain 2", "domain 3", etc.])
- You can copy+paste your list from step 5 in between the
(
and)
above
- You can copy+paste your list from step 5 in between the
- Wait. It'll print out each domain as it gets blocked, and it'll print
done
when it has finished them all. Don't close or reload the page while it's working!