Skip to content

Instantly share code, notes, and snippets.

@angdraug
Last active February 2, 2023 00:34
Show Gist options
  • Save angdraug/da8716259dbeb47fcae8ff93f2c0dbb1 to your computer and use it in GitHub Desktop.
Save angdraug/da8716259dbeb47fcae8ff93f2c0dbb1 to your computer and use it in GitHub Desktop.
Scan and import FediBlock domain block list
#!/bin/sh
# Set TOKEN following steps in https://docs.joinmastodon.org/client/authorized/
$SERVER=$1
tr , ' ' | \
while read DOMAIN SEVERITY COMMENT; do
curl -H "Authorization: Bearer $TOKEN" \
-F domain=$DOMAIN \
-F severity=$SEVERITY \
-F public_comment="$PUBLIC_COMMENT" \
https://$SERVER/api/v1/admin/domain_blocks
sleep 0.1
done
#!/bin/sh
curl -s https://joinfediverse.wiki/FediBlock | \
pup '.wikitable:nth-of-type(n+2) tr :nth-child(1) text{}' | \
fgrep . | \
while read DOMAIN; do
echo ${DOMAIN},suspend,Imported from FediBlock
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment