Update config_menu.sh

This commit is contained in:
MacRimi 2025-05-05 11:33:47 +02:00
parent 9b5c605dec
commit f0dd00aa2c

View File

@ -93,28 +93,21 @@ change_language() {
# ========================================================== # ==========================================================
show_version_info() { show_version_info() {
local version info_message temp_file
local version
version=$(<"$LOCAL_VERSION_FILE") version=$(<"$LOCAL_VERSION_FILE")
# Prepare the information message info_message+="$(translate "Current ProxMenux version:") $version\n\n"
local info_message="$(translate "Current ProxMenux version:") $version\n\n"
info_message+="$(translate "Installed components:")\n" info_message+="$(translate "Installed components:")\n"
# Check and add information about installed components
if [ -f "$CONFIG_FILE" ]; then if [ -f "$CONFIG_FILE" ]; then
while IFS=': ' read -r component value; do while IFS=': ' read -r component value; do
if [ "$component" = "language" ]; then [ "$component" = "language" ] && continue
continue
fi
local status local status
if echo "$value" | jq -e '.status' >/dev/null 2>&1; then if echo "$value" | jq -e '.status' >/dev/null 2>&1; then
status=$(echo "$value" | jq -r '.status') status=$(echo "$value" | jq -r '.status')
else else
status="$value" status="$value"
fi fi
local translated_status=$(translate "$status") local translated_status=$(translate "$status")
case "$status" in case "$status" in
"installed"|"already_installed"|"created"|"already_exists"|"upgraded") "installed"|"already_installed"|"created"|"already_exists"|"upgraded")
@ -128,38 +121,34 @@ show_version_info() {
else else
info_message+="$(translate "No installation information available.")\n" info_message+="$(translate "No installation information available.")\n"
fi fi
# Add information about ProxMenu files with paths
info_message+="\n$(translate "ProxMenu files:")\n" info_message+="\n$(translate "ProxMenu files:")\n"
[ -f "$INSTALL_DIR/$MENU_SCRIPT" ] && info_message+="$MENU_SCRIPT$INSTALL_DIR/$MENU_SCRIPT\n" || info_message+="$MENU_SCRIPT\n" [ -f "$INSTALL_DIR/$MENU_SCRIPT" ] && info_message+="$MENU_SCRIPT$INSTALL_DIR/$MENU_SCRIPT\n" || info_message+="$MENU_SCRIPT\n"
[ -f "$CACHE_FILE" ] && info_message+="✓ cache.json → $CACHE_FILE\n" || info_message+="✗ cache.json\n" [ -f "$CACHE_FILE" ] && info_message+="✓ cache.json → $CACHE_FILE\n" || info_message+="✗ cache.json\n"
[ -f "$UTILS_FILE" ] && info_message+="✓ utils.sh → $UTILS_FILE\n" || info_message+="✗ utils.sh\n" [ -f "$UTILS_FILE" ] && info_message+="✓ utils.sh → $UTILS_FILE\n" || info_message+="✗ utils.sh\n"
[ -f "$CONFIG_FILE" ] && info_message+="✓ config.json → $CONFIG_FILE\n" || info_message+="✗ config.json\n" [ -f "$CONFIG_FILE" ] && info_message+="✓ config.json → $CONFIG_FILE\n" || info_message+="✗ config.json\n"
[ -f "$LOCAL_VERSION_FILE" ] && info_message+="✓ version.txt → $LOCAL_VERSION_FILE\n" || info_message+="✗ version.txt\n" [ -f "$LOCAL_VERSION_FILE" ] && info_message+="✓ version.txt → $LOCAL_VERSION_FILE\n" || info_message+="✗ version.txt\n"
# Add information about the virtual environment with path
info_message+="\n$(translate "Virtual Environment:")\n" info_message+="\n$(translate "Virtual Environment:")\n"
if [ -d "$VENV_PATH" ] && [ -f "$VENV_PATH/bin/activate" ]; then if [ -d "$VENV_PATH" ] && [ -f "$VENV_PATH/bin/activate" ]; then
info_message+="$(translate "Installed")$VENV_PATH\n" info_message+="$(translate "Installed")$VENV_PATH\n"
if [ -f "$VENV_PATH/bin/pip" ]; then [ -f "$VENV_PATH/bin/pip" ] && info_message+="✓ pip: $(translate "Installed")$VENV_PATH/bin/pip\n" || info_message+="✗ pip: $(translate "Not installed")\n"
info_message+="✓ pip: $(translate "Installed")$VENV_PATH/bin/pip\n"
else
info_message+="✗ pip: $(translate "Not installed")\n"
fi
else else
info_message+="$(translate "Virtual Environment"): $(translate "Not installed")\n" info_message+="$(translate "Virtual Environment"): $(translate "Not installed")\n"
info_message+="✗ pip: $(translate "Not installed")\n" info_message+="✗ pip: $(translate "Not installed")\n"
fi fi
# Display the current language (without path) current_language=$(jq -r '.language // "en"' "$CONFIG_FILE")
local current_language=$(jq -r '.language // "en"' "$CONFIG_FILE") info_message+="\n$(translate "Current language:")\n$current_language\n"
info_message+="\n$(translate "Current language:")\n"
info_message+="$current_language\n" # Mostrar con dialog usando un archivo temporal
if command -v dialog >/dev/null 2>&1; then
# Display the information using whiptail tmpfile=$(mktemp)
whiptail --title "$(translate "ProxMenux Information")" \ echo -e "$info_message" > "$tmpfile"
--scrolltext \ dialog --title "$(translate "ProxMenux Information")" --clear --textbox "$tmpfile" 20 70
--msgbox "$info_message" 20 70 rm -f "$tmpfile"
fi
show_proxmenux_logo
} }