2023-04-30 21:27:42 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# generate files
|
2023-05-01 00:18:07 +00:00
|
|
|
#exec > >(tee /opt/fediblockhole/logs/fedisync.log) 2>&1
|
|
|
|
exec 2> >(tee /opt/fediblockhole/logs/fedisync.log)
|
2023-04-30 21:27:42 +00:00
|
|
|
echo "Pulling down all blocklist sources..."
|
|
|
|
|
2023-05-01 00:18:07 +00:00
|
|
|
cd /opt/fediblockhole
|
2023-04-30 21:27:42 +00:00
|
|
|
|
|
|
|
GIT=`which git`
|
|
|
|
${GIT} fetch
|
|
|
|
#${GIT} fetchall
|
|
|
|
|
2023-05-11 19:53:02 +00:00
|
|
|
PULLCONFIG="/opt/fediblockhole/config/pull.conf.toml" # default, pull sources WITHOUT public_description
|
|
|
|
#PULLCONFIG="/opt/fediblockhole/config/pull.all.conf.toml" # pull down all sources WITH public_description
|
|
|
|
|
2023-04-30 21:27:42 +00:00
|
|
|
SYNC=`which fediblock-sync`
|
2023-05-11 19:53:02 +00:00
|
|
|
${SYNC} -c $PULLCONFIG # pull down all files, create max list
|
2023-04-30 21:27:42 +00:00
|
|
|
|
|
|
|
# rename and remove intermediate files
|
2023-05-01 00:18:07 +00:00
|
|
|
rm -f /opt/fediblockhole/blocklists/file:---opt-fediblockhole-blocklists-__allowlist.csv.csv
|
|
|
|
mv /opt/fediblockhole/blocklists/https:--seirdy.one-pb-tier0.csv.csv /opt/fediblockhole/blocklists/tier0.csv
|
|
|
|
mv /opt/fediblockhole/blocklists/https:--seirdy.one-pb-pleroma.envs.net.csv.csv /opt/fediblockhole/blocklists/pleroma.envs.net.csv
|
|
|
|
mv /opt/fediblockhole/blocklists/https:--raw.githubusercontent.com-gardenfence-blocklist-main-gardenfence-fediblocksync.csv.csv /opt/fediblockhole/blocklists/gardenfence.csv
|
|
|
|
mv /opt/fediblockhole/blocklists/https:--artisan.chat-api-v1-instance-domain_blocks.csv /opt/fediblockhole/blocklists/artisan.chat.csv
|
|
|
|
mv /opt/fediblockhole/blocklists/https:--mastodon.art-api-v1-instance-domain_blocks.csv /opt/fediblockhole/blocklists/mastodon.art.csv
|
|
|
|
mv /opt/fediblockhole/blocklists/https:--mastodon.online-api-v1-instance-domain_blocks.csv /opt/fediblockhole/blocklists/mastodon.online.csv
|
|
|
|
mv /opt/fediblockhole/blocklists/https:--mastodon.social-api-v1-instance-domain_blocks.csv /opt/fediblockhole/blocklists/mastodon.social.csv
|
|
|
|
mv /opt/fediblockhole/blocklists/https:--rage.love-api-v1-instance-domain_blocks.csv /opt/fediblockhole/blocklists/rage.love.csv
|
|
|
|
mv /opt/fediblockhole/blocklists/https:--sunny.garden-api-v1-instance-domain_blocks.csv /opt/fediblockhole/blocklists/sunny.garden.csv
|
|
|
|
mv /opt/fediblockhole/blocklists/https:--toot.wales-api-v1-instance-domain_blocks.csv /opt/fediblockhole/blocklists/toot.wales.csv
|
|
|
|
mv /opt/fediblockhole/blocklists/https:--union.place-api-v1-instance-domain_blocks.csv /opt/fediblockhole/blocklists/union.place.csv
|
|
|
|
mv /opt/fediblockhole/blocklists/https:--solarpunk.moe-api-v1-instance-domain_blocks.csv /opt/fediblockhole/blocklists/solarpunk.moe.csv
|
2023-04-30 21:27:42 +00:00
|
|
|
|
|
|
|
# destroy the 'max' list
|
2023-05-01 00:18:07 +00:00
|
|
|
rm -f /opt/fediblockhole/blocklists/_unified_max_blocklist.csv
|
2023-04-30 21:27:42 +00:00
|
|
|
|
|
|
|
# create fedi council tier0 file and 100% file
|
2023-05-01 00:18:07 +00:00
|
|
|
${SYNC} -c /opt/fediblockhole/config/council.tier0.conf.toml && \
|
|
|
|
${SYNC} -c /opt/fediblockhole/config/100.percent.conf.toml
|
2023-04-30 21:27:42 +00:00
|
|
|
|
|
|
|
# create unified tier0 file
|
2023-05-01 00:18:07 +00:00
|
|
|
${SYNC} -c /opt/fediblockhole/config/tier0.conf.toml
|
2023-04-30 21:27:42 +00:00
|
|
|
|
|
|
|
# create missing from mastodon.social blocklist file, and the inverse file
|
2023-05-01 15:40:39 +00:00
|
|
|
#${SYNC} -c /opt/fediblockhole/config/ms-noblock.conf.toml && \
|
|
|
|
#${SYNC} -c /opt/fediblockhole/config/ms-we-block.conf.toml
|
2023-04-30 21:27:42 +00:00
|
|
|
|
|
|
|
# create intermediate working tier files
|
2023-05-01 00:18:07 +00:00
|
|
|
${SYNC} -c /opt/fediblockhole/config/tier1-threshold.conf.toml -m min && \
|
|
|
|
${SYNC} -c /opt/fediblockhole/config/tier2-threshold.conf.toml -m min && \
|
|
|
|
${SYNC} -c /opt/fediblockhole/config/tier3-threshold.conf.toml -m min
|
2023-04-30 21:27:42 +00:00
|
|
|
|
|
|
|
# merge in associated tier file with tier0 blocks
|
2023-05-01 00:18:07 +00:00
|
|
|
${SYNC} -c /opt/fediblockhole/config/tier1.conf.toml -m min && \
|
|
|
|
${SYNC} -c /opt/fediblockhole/config/tier2.conf.toml -m min && \
|
|
|
|
${SYNC} -c /opt/fediblockhole/config/tier3.conf.toml -m min && \
|
|
|
|
cp /opt/fediblockhole/blocklists/_unified_tier0_blocklist.csv /opt/fediblockhole/blocklists/_unified_min_blocklist.csv
|
2023-04-30 21:27:42 +00:00
|
|
|
|
|
|
|
# cleanup working tier files
|
2023-05-01 00:18:07 +00:00
|
|
|
rm -f /opt/fediblockhole/blocklists/_working_*.csv
|
2023-04-30 21:27:42 +00:00
|
|
|
|
2023-05-11 17:58:20 +00:00
|
|
|
# copy all files to mastodon subfolder
|
2023-05-11 20:20:37 +00:00
|
|
|
cp /opt/fediblockhole/blocklists/*.csv /opt/fediblockhole/blocklists/mastodon/ && \
|
|
|
|
cp /opt/fediblockhole/blocklists/README.md /opt/fediblockhole/blocklists/mastodon/README.md
|
2023-05-11 17:58:20 +00:00
|
|
|
|
|
|
|
echo "Creating mastodon versions of files..."
|
|
|
|
|
|
|
|
# convert files to Mastodon header
|
|
|
|
cd /opt/fediblockhole/blocklists/mastodon
|
|
|
|
|
|
|
|
rm -f __allowlist.csv
|
|
|
|
|
|
|
|
# replace first line with mastodon-format header row
|
|
|
|
headerrow="#domain,#severity,#reject_media,#reject_reports,#public_comment,#obfuscate"
|
2023-07-29 18:07:06 +00:00
|
|
|
for file in *.csv; do
|
2023-05-11 17:58:20 +00:00
|
|
|
sed -i "1s/.*/$headerrow/" $file
|
2023-05-11 18:47:55 +00:00
|
|
|
# replace bad line terminators
|
|
|
|
sed -i "s/\r//g" $file
|
2023-07-29 18:07:06 +00:00
|
|
|
# lowercase file to fix booleans
|
|
|
|
sed -i "s/\(.*\)/\L\1/" $file
|
2023-05-11 17:58:20 +00:00
|
|
|
done
|
|
|
|
|
2023-04-30 21:27:42 +00:00
|
|
|
echo "Pull complete."
|