Update main_menu.sh

This commit is contained in:
MacRimi 2025-01-31 22:09:00 +01:00 committed by GitHub
parent f884272f3b
commit f448bad28b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,22 +11,20 @@
# ========================================================== # ==========================================================
# Configuration # Configuration ============================================
REPO_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main" REPO_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main"
UTILS_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main/scripts/utils.sh" UTILS_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main/scripts/utils.sh"
BASE_DIR="/usr/local/share/proxmenux" BASE_DIR="/usr/local/share/proxmenux"
CACHE_FILE="$BASE_DIR/cache.json" CACHE_FILE="$BASE_DIR/cache.json"
VENV_PATH="/opt/googletrans-env" VENV_PATH="/opt/googletrans-env"
LANGUAGE=$(jq -r '.language // "en"' "$BASE_DIR/config.json" 2>/dev/null) # 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 if ! source <(curl -sSf "$UTILS_URL"); then
echo "$(translate 'Error: Could not load utils.sh from') $UTILS_URL" echo "$(translate 'Error: Could not load utils.sh from') $UTILS_URL"
exit 1 exit 1
fi fi
# Initialize cache
initialize_cache() { initialize_cache() {
if [ ! -f "$CACHE_FILE" ]; then if [ ! -f "$CACHE_FILE" ]; then
echo "{}" > "$CACHE_FILE" echo "{}" > "$CACHE_FILE"
@ -34,12 +32,13 @@ initialize_cache() {
fi fi
} }
# Load language from JSON file
load_language() { load_language() {
if [ -f "$CONFIG_FILE" ]; then if [ -f "$CONFIG_FILE" ]; then
LANGUAGE=$(jq -r '.language' "$CONFIG_FILE") LANGUAGE=$(jq -r '.language' "$CONFIG_FILE")
fi fi
} }
# ==========================================================
show_menu() { show_menu() {
while true; do while true; do