A CLI tool to manage your Mastodon blocklist.
by @azcoigreach@stranger.social
This app is a Python CLI tools to manage your Mastodon Instance blocklist. It can be used to add, remove, and list domains on your blocklist. It can also be used to generate a blocklist from a list of domains.
There is also a currated list of domains that are known to be problematic. This list is maintained by @azcoigreach@stranger.social. If you would like to petition to have your server removed from the stranger.social blocklist, please contact me. A list of rules for the blocklist can be found in the /blocklist_domains/README.md
file.
Requires Python 3.8 or higher.
git clone https://github.com/azcoigreach/mastodon-blocklist-manager.git
cd mastodon-blocklist-manager
pip install . --editable
mbm uses a configuration file to store your Mastodon instance and credentials. Copy the example_settings.py
file to settings.py
and add your Instance API Token and Instance URL.
This app require admin:read:domain_blocks
and admin:write:domain_blocks
scopes.
mbm --help
The mbm
command will show you the available commands. You can use mbm <command> --help
or mbm <command> <sub-commnd> --help
to get more information about each command. The command below are examples of how to use the app and may not cover all of the features. Use the in-app help for more information.
mbm list merge list1.txt list2.txt output_list.txt
Will merge and sort the two lists into the output file. The output file will overwritten if it already exists.
mbm list merge list1.txt list2.txt output_list.txt -w whitelist.txt
Keep domains you don't want to block in the whitelist file. These will be removed from the output file.
mbm -v domain_blocks add blocklist.txt -s suspend -pub "Public reason" -priv "Private reason" -rm True -rr True -obf False
Add the domains in the blocklist file to the instance. The -s
option can be suspend
or silence
. The -pub
and -priv
options are the public and private reasons for the block. The -rm
option will remove the domain from the blocklist file if the block was successful. The -rr
option will remove the domain from the blocklist file if the block failed. The -obf
option will obfuscate the domain before adding it to the blocklist.
Adding the -v
option after mbm
command will enable verbose output.
mbm domain_blocks remove blocklist.txt
Will remove the domains in the blocklist file from the instance.
mbm domain_blocks purge
Will remove all domains from the instance domain_blocks database. Requires confirmation.
This project is licensed under the MIT License - see the LICENSE file for details