Enable or disable pleroma registrations

This commit is contained in:
Bob Mottram 2017-11-06 19:41:06 +00:00
parent 99fddf5f21
commit c1ef4567bf
1 changed files with 31 additions and 5 deletions

View File

@ -62,6 +62,17 @@ pleroma_variables=(ONION_ONLY
MY_EMAIL_ADDRESS MY_EMAIL_ADDRESS
MY_USERNAME) MY_USERNAME)
function pleroma_recompile {
# necessary after parameter changes
sudo -u pleroma mix clean
sudo -u pleroma mix deps.compile
sudo -u pleroma mix compile
if [ -f /etc/systemd/system/pleroma.service ]; then
systemctl restart pleroma
fi
}
function logging_on_pleroma { function logging_on_pleroma {
echo -n '' echo -n ''
} }
@ -344,6 +355,19 @@ function pleroma_set_expire_months {
rm $data rm $data
} }
function pleroma_disable_registrations {
dialog --title $"Disable new Pleroma user registrations" \
--backtitle $"Freedombone Control Panel" \
--yesno $"\nDo you wish to disable new registrations?" 10 60
sel=$?
case $sel in
0) sed -i 's|registrations_open:.*|registrations_open: false|g' $PLEROMA_DIR/config/config.exs;;
1) sed -i 's|registrations_open:.*|registrations_open: true|g' $PLEROMA_DIR/config/config.exs;;
255) return;;
esac
pleroma_recompile
}
function configure_interactive_pleroma { function configure_interactive_pleroma {
read_config_param PLEROMA_EXPIRE_MONTHS read_config_param PLEROMA_EXPIRE_MONTHS
while true while true
@ -352,11 +376,12 @@ function configure_interactive_pleroma {
trap "rm -f $data" 0 1 2 5 15 trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \ dialog --backtitle $"Freedombone Control Panel" \
--title $"Pleroma" \ --title $"Pleroma" \
--radiolist $"Choose an operation:" 13 70 4 \ --radiolist $"Choose an operation:" 14 70 5 \
1 $"Set a background image" off \ 1 $"Set a background image" off \
2 $"Set the title" off \ 2 $"Set the title" off \
3 $"Set post expiry period (currently $PLEROMA_EXPIRE_MONTHS months)" off \ 3 $"Disable new account registrations" off \
4 $"Exit" on 2> $data 4 $"Set post expiry period (currently $PLEROMA_EXPIRE_MONTHS months)" off \
5 $"Exit" on 2> $data
sel=$? sel=$?
case $sel in case $sel in
1) return;; 1) return;;
@ -365,8 +390,9 @@ function configure_interactive_pleroma {
case $(cat $data) in case $(cat $data) in
1) pleroma_set_background_image;; 1) pleroma_set_background_image;;
2) pleroma_set_title;; 2) pleroma_set_title;;
3) pleroma_set_expire_months;; 3) pleroma_disable_registrations;;
4) break;; 4) pleroma_set_expire_months;;
5) break;;
esac esac
rm $data rm $data
done done