From 3ca5a3624011da1d6095051a57569009252decad Mon Sep 17 00:00:00 2001 From: MacRimi Date: Sat, 18 Apr 2026 01:13:13 +0200 Subject: [PATCH] Update config_menu.sh --- scripts/menus/config_menu.sh | 38 +++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/scripts/menus/config_menu.sh b/scripts/menus/config_menu.sh index 2a53e343..a2d24710 100644 --- a/scripts/menus/config_menu.sh +++ b/scripts/menus/config_menu.sh @@ -114,6 +114,33 @@ check_monitor_status() { fi } +is_beta_program_active() { + [[ -f "$CONFIG_FILE" ]] || return 1 + local flag + flag=$(jq -r '.beta_program.status // empty' "$CONFIG_FILE" 2>/dev/null) + [[ "$flag" == "active" ]] +} + +deactivate_beta_program() { + if dialog --clear --backtitle "ProxMenux Configuration" \ + --title "$(translate "Deactivate Beta Program")" \ + --yesno "\n$(translate "You will stop receiving beta update prompts. Stable updates continue normally.\n\nTo rejoin the beta program later, run the beta installer again.\n\nDeactivate now?")" 14 64; then + local tmp + tmp=$(mktemp) + if jq '.beta_program.status = "inactive"' "$CONFIG_FILE" > "$tmp" 2>/dev/null; then + mv "$tmp" "$CONFIG_FILE" + dialog --clear --backtitle "ProxMenux Configuration" \ + --title "$(translate "Beta Program Deactivated")" \ + --msgbox "\n\n$(translate "Beta program deactivated. You will now receive stable updates only.")" 10 60 + else + rm -f "$tmp" + dialog --clear --backtitle "ProxMenux Configuration" \ + --title "$(translate "Error")" \ + --msgbox "\n\n$(translate "Could not update config file.")" 10 50 + fi + fi +} + toggle_monitor_service() { local status=$(check_monitor_status) @@ -211,7 +238,13 @@ show_config_menu() { option_actions[$option_num]="show_monitor_status" ((option_num++)) fi - + + if is_beta_program_active; then + menu_options+=("$option_num" "$(translate "Deactivate Beta Program")") + option_actions[$option_num]="deactivate_beta" + ((option_num++)) + fi + # Build menu based on installation type if [ "$install_type" = "translation" ]; then menu_options+=("$option_num" "$(translate "Change Language")") @@ -256,6 +289,9 @@ show_config_menu() { "show_monitor_status") show_monitor_status ;; + "deactivate_beta") + deactivate_beta_program + ;; "change_language") change_language ;;