From a63785a9ca6bf06b43ad87933a369880fcdebf26 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 4 May 2018 10:52:53 +0100 Subject: [PATCH] Pleroma option to disable routing through tor --- src/freedombone-app-pleroma | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/freedombone-app-pleroma b/src/freedombone-app-pleroma index b8b7c94c..aed1712c 100755 --- a/src/freedombone-app-pleroma +++ b/src/freedombone-app-pleroma @@ -733,15 +733,21 @@ function configure_interactive_pleroma { enablechatstr=$'Disable chat system' fi + pleromatorstr=$'Enable routing through Tor for onion addresses' + if grep -q '9050' $pleroma_secret; then + pleromatorstr=$'Disable routing through Tor' + fi + W=(1 $"Set a background image" 2 $"Set the title" 3 $"Disable new account registrations" 4 $"Add a custom emoji" 5 $"Set post expiry period (currently $PLEROMA_EXPIRE_MONTHS months)" - 6 "$enablechatstr") + 6 "$enablechatstr" + 7 "$pleromatorstr") # shellcheck disable=SC2068 - selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Pleroma" --menu $"Choose an operation, or ESC to exit:" 13 60 6 "${W[@]}" 3>&2 2>&1 1>&3) + selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Pleroma" --menu $"Choose an operation, or ESC to exit:" 14 60 7 "${W[@]}" 3>&2 2>&1 1>&3) if [ ! "$selection" ]; then break @@ -759,11 +765,24 @@ function configure_interactive_pleroma { pleroma_enable_chat true fi ;; + 7) if grep -q '9050' $pleroma_secret; then + pleroma_disable_tor + else + pleroma_enable_tor + fi + ;; esac done } -function pleroma_upgrade_tor { +function pleroma_disable_tor { + if grep -q '9050' $pleroma_secret; then + sed -i '/9050/d' $pleroma_secret + pleroma_recompile + fi +} + +function pleroma_enable_tor { pleroma_tor_update= if ! grep -q '{:socks5, :localhost, 9050}' $pleroma_secret; then @@ -806,7 +825,7 @@ function upgrade_pleroma { create_pleroma_blocklist fi - pleroma_upgrade_tor + #pleroma_enable_tor CURR_PLEROMA_COMMIT=$(get_completion_param "pleroma commit") if [[ "$CURR_PLEROMA_COMMIT" == "$PLEROMA_COMMIT" ]]; then