From 75e7624d2af45f297b9cb8cdda0af2d9cfb784dd Mon Sep 17 00:00:00 2001 From: MacRimi <123239993+MacRimi@users.noreply.github.com> Date: Fri, 31 Jan 2025 22:06:44 +0100 Subject: [PATCH] Update storage_menu.sh --- scripts/menus/storage_menu.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/menus/storage_menu.sh b/scripts/menus/storage_menu.sh index 7f6e4c0..115b3d4 100644 --- a/scripts/menus/storage_menu.sh +++ b/scripts/menus/storage_menu.sh @@ -11,7 +11,7 @@ # ========================================================== -# Configuration +# Configuration ============================================ REPO_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main" UTILS_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main/scripts/utils.sh" BASE_DIR="/usr/local/share/proxmenux" @@ -19,13 +19,25 @@ CACHE_FILE="$BASE_DIR/cache.json" VENV_PATH="/opt/googletrans-env" LANGUAGE=$(jq -r '.language // "en"' "$BASE_DIR/config.json" 2>/dev/null) - -# Try to load utils.sh from GitHub if ! source <(curl -sSf "$UTILS_URL"); then echo "$(translate 'Error: Could not load utils.sh from') $UTILS_URL" exit 1 fi +initialize_cache() { + if [ ! -f "$CACHE_FILE" ]; then + echo "{}" > "$CACHE_FILE" + return + fi +} + +load_language() { + if [ -f "$CONFIG_FILE" ]; then + LANGUAGE=$(jq -r '.language' "$CONFIG_FILE") + fi +} +# ========================================================== + while true; do OPTION=$(whiptail --title "$(translate "Disk and Storage Menu")" --menu "$(translate "Select an option:")" 15 60 3 \