From 1a6e28505a4d9957605496afe3cc8583305c3fc3 Mon Sep 17 00:00:00 2001 From: sxlmnwb Date: Fri, 18 Oct 2024 10:22:29 +0700 Subject: [PATCH] x-ui: improve [Logs Management] if exit on Debug Log with ctrl+c auto back to main menu install: recheck webBasePath on config_after_install Co-authored-by: mhsanaei Signed-off-by: Salman Wahib --- install.sh | 2 +- x-ui.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 80a0943c..876d25a3 100644 --- a/install.sh +++ b/install.sh @@ -143,7 +143,7 @@ config_after_install() { local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}') # Check if username and password exist - if [[ -n "$existing_username" && -n "$existing_password" ]]; then + if [[ -n "$existing_username" && -n "$existing_password" && -n "$existing_webBasePath" ]]; then # If webBasePath is missing, generate a new one if [[ ${#existing_webBasePath} -lt 4 ]]; then local config_webBasePath=$(gen_random_string 15) diff --git a/x-ui.sh b/x-ui.sh index 52674f48..49115673 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -467,13 +467,14 @@ show_log() { case "$choice" in 0) - return + show_menu ;; 1) + # Set trap to catch Ctrl+C and return to the menu + trap 'before_show_menu' SIGINT journalctl -u x-ui -e --no-pager -f -p debug - if [[ $# == 0 ]]; then + # After exiting journalctl, return to the menu before_show_menu - fi ;; 2) sudo journalctl --rotate