FIX: Add error handling to standalone domain discovery and remove color codes

FIXES:
1. Added error handling (|| true) to get_standalone_user_domains()
   - Prevents script crash with set -eo pipefail on standalone servers
   - Function now always succeeds even if find fails
   - Prevents tmux session crashes

2. Removed all ANSI color codes from launcher output
   - Color codes were showing as raw \033[0;36m instead of rendering
   - Simplified output without color variables
   - Better compatibility with different terminal types
   - Cleaner output on all systems

Changes:
- lib/user-manager.sh: Added || true to prevent failures
- launcher.sh: Removed , , , etc. from output
  - show_banner(): Removed color codes
  - show_system_overview(): Removed color codes
  - show_main_menu(): Removed color codes

Impact:
- Standalone servers no longer crash when building reference database
- Output is clean and readable on all terminal types
- Detection/database building now completes successfully

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Developer
2026-03-19 22:00:22 -04:00
parent 7bf42ee2f7
commit a30fc46f07
2 changed files with 31 additions and 31 deletions
+30 -30
View File
@@ -37,12 +37,12 @@ NC='\033[0m'
# Banner
show_banner() {
clear
echo -e "${YELLOW}═══════════════════════════════════════════════════════════════${NC}"
echo -e "${YELLOW} ⚠️ Server Management Toolkit v${SUITE_VERSION}${NC}"
echo -e "${YELLOW} 🧪 BETA/DEV VERSION - Testing & Development${NC}"
echo -e "${YELLOW} Complete cPanel/Linux Server Administration Suite${NC}"
echo -e "${YELLOW}═══════════════════════════════════════════════════════════════${NC}"
echo -e "${MAGENTA} ⚠️ This is a SEPARATE INSTANCE from production${NC}"
echo "═══════════════════════════════════════════════════════════════"
echo " ⚠️ Server Management Toolkit v${SUITE_VERSION}"
echo " 🧪 BETA/DEV VERSION - Testing & Development"
echo " Complete cPanel/Linux Server Administration Suite"
echo "═══════════════════════════════════════════════════════════════"
echo " ⚠️ This is a SEPARATE INSTANCE from production"
echo ""
}
@@ -91,46 +91,46 @@ show_system_overview() {
fi
echo ""
echo -e "${BOLD}🖥️ System Information:${NC}"
echo "🖥️ System Information:"
# Control Panel
if [ "$SYS_CONTROL_PANEL" != "none" ]; then
echo -n " Control Panel: ${CYAN}${SYS_CONTROL_PANEL^^}${NC}"
echo -n " Control Panel: ${SYS_CONTROL_PANEL^^}"
[ -n "$SYS_CONTROL_PANEL_VERSION" ] && echo -n " v${SYS_CONTROL_PANEL_VERSION}" || echo -n " (version unknown)"
echo ""
else
echo " Control Panel: ${CYAN}Standalone${NC} (no control panel)"
echo " Control Panel: Standalone (no control panel)"
fi
# OS
echo " OS: ${CYAN}${SYS_OS_TYPE^^}${NC} ${SYS_OS_VERSION}"
[ "${SYS_CLOUDLINUX:-}" = "yes" ] && echo -e " ${CYAN}${NC} CloudLinux detected"
echo " OS: ${SYS_OS_TYPE^^} ${SYS_OS_VERSION}"
[ "${SYS_CLOUDLINUX:-}" = "yes" ] && echo " ➜ CloudLinux detected"
# Web Server
echo -n " Web Server: ${CYAN}${SYS_WEB_SERVER^^}${NC}"
echo -n " Web Server: ${SYS_WEB_SERVER^^}"
[ -n "$SYS_WEB_SERVER_VERSION" ] && echo " v${SYS_WEB_SERVER_VERSION}" || echo ""
# Database
if [ "$SYS_DB_TYPE" != "none" ]; then
echo -n " Database: ${CYAN}${SYS_DB_TYPE^^}${NC}"
echo -n " Database: ${SYS_DB_TYPE^^}"
[ -n "$SYS_DB_VERSION" ] && echo " v${SYS_DB_VERSION}" || echo ""
fi
# PHP Versions
if [ ${#SYS_PHP_VERSIONS[@]} -gt 0 ]; then
echo -n " PHP Versions: ${CYAN}"
echo -n " PHP Versions: "
printf '%s, ' "${SYS_PHP_VERSIONS[@]}" | sed 's/, $//'
echo "${NC}"
echo ""
fi
# Firewall
if [ "$SYS_FIREWALL" != "none" ]; then
echo -n " Firewall: ${CYAN}${SYS_FIREWALL^^}${NC}"
[ "$SYS_FIREWALL_ACTIVE" = "yes" ] && echo " (${GREEN}active${NC})" || echo " (${YELLOW}inactive${NC})"
echo -n " Firewall: ${SYS_FIREWALL^^}"
[ "$SYS_FIREWALL_ACTIVE" = "yes" ] && echo " (active)" || echo " (inactive)"
fi
# Cloudflare
[ "$SYS_CLOUDFLARE_ACTIVE" = "yes" ] && echo " Cloudflare: ${YELLOW}Detected${NC}"
[ "$SYS_CLOUDFLARE_ACTIVE" = "yes" ] && echo " Cloudflare: Detected"
echo ""
}
@@ -145,25 +145,25 @@ show_main_menu() {
# Show quick system overview if detection is complete
[ -n "${SYS_DETECTION_COMPLETE:-}" ] && show_system_overview
echo -e "${BOLD}Quick Diagnostics:${NC}"
echo "Quick Diagnostics:"
echo ""
echo -e " ${MAGENTA}1)${NC} 🏥 System Health Check - Full server diagnostics"
echo " 1) 🏥 System Health Check - Full server diagnostics"
echo ""
echo -e "${BOLD}Main Categories:${NC}"
echo "Main Categories:"
echo ""
echo -e " ${GREEN}2)${NC} 🛡️ Security & Monitoring"
echo -e " ${BLUE}3)${NC} 🌐 Website Diagnostics"
echo -e " ${MAGENTA}4)${NC} 🔧 Performance & Maintenance"
echo -e " ${YELLOW}5)${NC} 💾 Backup & Recovery"
echo -e " ${CYAN}6)${NC} 📧 Email Troubleshooting"
echo " 2) 🛡️ Security & Monitoring"
echo " 3) 🌐 Website Diagnostics"
echo " 4) 🔧 Performance & Maintenance"
echo " 5) 💾 Backup & Recovery"
echo " 6) 📧 Email Troubleshooting"
echo ""
echo -e "${BOLD}System:${NC}"
echo "System:"
echo ""
echo -e " ${YELLOW}7)${NC} 🗑️ Cleanup Toolkit Data - Clear cached data"
echo " 7) 🗑️ Cleanup Toolkit Data - Clear cached data"
echo ""
echo -e " ${RED}0)${NC} Exit"
echo " 0) Exit"
echo ""
echo -e "${CYAN}═══════════════════════════════════════════════════════════════${NC}"
echo "═══════════════════════════════════════════════════════════════"
echo -n "Select option: "
}