From 5deca1d6a1b69883d94c5dcf861e48c41a3e05d6 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 4 Apr 2018 12:46:55 +0100 Subject: [PATCH] pleroma configuration menu style --- src/freedombone-app-pleroma | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/src/freedombone-app-pleroma b/src/freedombone-app-pleroma index db5130af..d32d3dfd 100755 --- a/src/freedombone-app-pleroma +++ b/src/freedombone-app-pleroma @@ -674,33 +674,26 @@ function configure_interactive_pleroma { read_config_param PLEROMA_EXPIRE_MONTHS while true do - data=$(mktemp 2>/dev/null) - dialog --backtitle $"Freedombone Control Panel" \ - --title $"Pleroma" \ - --radiolist $"Choose an operation:" 15 70 6 \ - 1 $"Set a background image" off \ - 2 $"Set the title" off \ - 3 $"Disable new account registrations" off \ - 4 $"Add a custom emoji" off \ - 5 $"Set post expiry period (currently $PLEROMA_EXPIRE_MONTHS months)" off \ - 6 $"Exit" on 2> "$data" - sel=$? - case $sel in - 1) rm -f "$data" - return;; - 255) rm -f "$data" - return;; - esac - case $(cat "$data") in + 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)") + + # shellcheck disable=SC2068 + selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Pleroma" --menu $"Choose an operation, or ESC to exit:" 14 60 5 "${W[@]}" 3>&2 2>&1 1>&3) + + if [ ! "$selection" ]; then + break + fi + + case $selection in 1) pleroma_set_background_image;; 2) pleroma_set_title;; 3) pleroma_disable_registrations;; 4) pleroma_add_emoji;; 5) pleroma_set_expire_months;; - 6) rm -f "$data" - break;; esac - rm -f "$data" done }