Add blocked domains to /etc/hosts
This commit is contained in:
parent
578af997ca
commit
a0a3d9f9a5
|
@ -93,19 +93,22 @@ function create_pleroma_blocklist {
|
||||||
echo 'while read blocked; do' >> $blocking_script_file
|
echo 'while read blocked; do' >> $blocking_script_file
|
||||||
echo ' if [[ "$blocked" == *"."* || "$blocked" == *"@"* ]]; then' >> $blocking_script_file
|
echo ' if [[ "$blocked" == *"."* || "$blocked" == *"@"* ]]; then' >> $blocking_script_file
|
||||||
echo ' if [ ${#blocked} -gt 4 ]; then' >> $blocking_script_file
|
echo ' if [ ${#blocked} -gt 4 ]; then' >> $blocking_script_file
|
||||||
echo ' if [ $objects_updated ]; then' >> $blocking_script_file
|
echo ' if [ $objects_updated ]; then' >> $blocking_script_file
|
||||||
echo ' objects_query="${objects_query} or"' >> $blocking_script_file
|
echo ' objects_query="${objects_query} or"' >> $blocking_script_file
|
||||||
echo ' users_query="${users_query} or"' >> $blocking_script_file
|
echo ' users_query="${users_query} or"' >> $blocking_script_file
|
||||||
echo ' fi' >> $blocking_script_file
|
echo ' fi' >> $blocking_script_file
|
||||||
echo " objects_query=\"\${objects_query} data->>'content' ilike '%\${blocked}%' or data->>'actor' ilike '%\${blocked}%' or data->>'to' ilike '%\${blocked}%' or data->>'id' ilike '%\${blocked}%' or data->>'external_url' ilike '%\${blocked}%'\"" >> $blocking_script_file
|
echo " objects_query=\"\${objects_query} data->>'content' ilike '%\${blocked}%' or data->>'actor' ilike '%\${blocked}%' or data->>'to' ilike '%\${blocked}%' or data->>'id' ilike '%\${blocked}%' or data->>'external_url' ilike '%\${blocked}%'\"" >> $blocking_script_file
|
||||||
echo " users_query=\"\${users_query} nickname ilike '%\${blocked}%'\"" >> $blocking_script_file
|
echo " users_query=\"\${users_query} nickname ilike '%\${blocked}%'\"" >> $blocking_script_file
|
||||||
echo ' objects_updated=1' >> $blocking_script_file
|
echo ' objects_updated=1' >> $blocking_script_file
|
||||||
echo ' if [[ "$blocked" != *"@"* ]]; then' >> $blocking_script_file
|
echo ' if [[ "$blocked" != *"@"* ]]; then' >> $blocking_script_file
|
||||||
echo ' if [ $websub_server_subscriptions_updated ]; then' >> $blocking_script_file
|
echo ' if ! grep -q "$blocked" /etc/hosts; then' >> $blocking_script_file
|
||||||
echo ' websub_server_subscriptions_query="${websub_server_subscriptions_query} or"' >> $blocking_script_file
|
echo ' echo "127.0.0.1 $blocked" >> /etc/hosts' >> $blocking_script_file
|
||||||
echo ' fi' >> $blocking_script_file
|
echo ' fi' >> $blocking_script_file
|
||||||
echo " websub_server_subscriptions_query=\"\${websub_server_subscriptions_query} callback like '%\${blocked}%'\"" >> $blocking_script_file
|
echo ' if [ $websub_server_subscriptions_updated ]; then' >> $blocking_script_file
|
||||||
echo ' websub_server_subscriptions_updated=1' >> $blocking_script_file
|
echo ' websub_server_subscriptions_query="${websub_server_subscriptions_query} or"' >> $blocking_script_file
|
||||||
|
echo ' fi' >> $blocking_script_file
|
||||||
|
echo " websub_server_subscriptions_query=\"\${websub_server_subscriptions_query} callback like '%\${blocked}%'\"" >> $blocking_script_file
|
||||||
|
echo ' websub_server_subscriptions_updated=1' >> $blocking_script_file
|
||||||
echo ' fi' >> $blocking_script_file
|
echo ' fi' >> $blocking_script_file
|
||||||
echo ' fi' >> $blocking_script_file
|
echo ' fi' >> $blocking_script_file
|
||||||
echo ' fi' >> $blocking_script_file
|
echo ' fi' >> $blocking_script_file
|
||||||
|
|
|
@ -63,6 +63,7 @@ function install_i2p {
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_i2p {
|
function remove_i2p {
|
||||||
|
service i2p stop
|
||||||
apt-get -yq remove i2p-router --purge
|
apt-get -yq remove i2p-router --purge
|
||||||
apt-get -yq remove i2p --purge
|
apt-get -yq remove i2p --purge
|
||||||
apt-get -yq remove i2p-keyring --purge
|
apt-get -yq remove i2p-keyring --purge
|
||||||
|
@ -89,6 +90,8 @@ function remove_i2p {
|
||||||
|
|
||||||
function i2p_enable_sam {
|
function i2p_enable_sam {
|
||||||
if [ ! -f /var/lib/i2p/i2p-config/clients.config ]; then
|
if [ ! -f /var/lib/i2p/i2p-config/clients.config ]; then
|
||||||
|
service i2p stop
|
||||||
|
|
||||||
apt-get -yq remove i2p --purge
|
apt-get -yq remove i2p --purge
|
||||||
apt-get -yq remove i2p-router --purge
|
apt-get -yq remove i2p-router --purge
|
||||||
if [ -d /var/lib/i2p ]; then
|
if [ -d /var/lib/i2p ]; then
|
||||||
|
|
Loading…
Reference in New Issue