Pleroma option to disable routing through tor

This commit is contained in:
Bob Mottram 2018-05-04 10:52:53 +01:00
parent c6fd0d43c8
commit a63785a9ca
1 changed files with 23 additions and 4 deletions

View File

@ -733,15 +733,21 @@ function configure_interactive_pleroma {
enablechatstr=$'Disable chat system' enablechatstr=$'Disable chat system'
fi 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" W=(1 $"Set a background image"
2 $"Set the title" 2 $"Set the title"
3 $"Disable new account registrations" 3 $"Disable new account registrations"
4 $"Add a custom emoji" 4 $"Add a custom emoji"
5 $"Set post expiry period (currently $PLEROMA_EXPIRE_MONTHS months)" 5 $"Set post expiry period (currently $PLEROMA_EXPIRE_MONTHS months)"
6 "$enablechatstr") 6 "$enablechatstr"
7 "$pleromatorstr")
# shellcheck disable=SC2068 # 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 if [ ! "$selection" ]; then
break break
@ -759,11 +765,24 @@ function configure_interactive_pleroma {
pleroma_enable_chat true pleroma_enable_chat true
fi fi
;; ;;
7) if grep -q '9050' $pleroma_secret; then
pleroma_disable_tor
else
pleroma_enable_tor
fi
;;
esac esac
done 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= pleroma_tor_update=
if ! grep -q '{:socks5, :localhost, 9050}' $pleroma_secret; then if ! grep -q '{:socks5, :localhost, 9050}' $pleroma_secret; then
@ -806,7 +825,7 @@ function upgrade_pleroma {
create_pleroma_blocklist create_pleroma_blocklist
fi fi
pleroma_upgrade_tor #pleroma_enable_tor
CURR_PLEROMA_COMMIT=$(get_completion_param "pleroma commit") CURR_PLEROMA_COMMIT=$(get_completion_param "pleroma commit")
if [[ "$CURR_PLEROMA_COMMIT" == "$PLEROMA_COMMIT" ]]; then if [[ "$CURR_PLEROMA_COMMIT" == "$PLEROMA_COMMIT" ]]; then