mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-14 05:23:09 +00:00
show URI in scripts
This commit is contained in:
@@ -267,6 +267,9 @@ install_x-ui() {
|
|||||||
systemctl start x-ui
|
systemctl start x-ui
|
||||||
echo -e "${green}x-ui v${last_version}${plain} installation finished, it is up and running now..."
|
echo -e "${green}x-ui v${last_version}${plain} installation finished, it is up and running now..."
|
||||||
echo -e ""
|
echo -e ""
|
||||||
|
echo "You may access the Panel with following URL(s):"
|
||||||
|
/usr/local/x-ui/x-ui uri
|
||||||
|
echo -e ""
|
||||||
echo "X-UI Control Menu Usage"
|
echo "X-UI Control Menu Usage"
|
||||||
echo "------------------------------------------"
|
echo "------------------------------------------"
|
||||||
echo "SUBCOMMANDS:"
|
echo "SUBCOMMANDS:"
|
||||||
|
|||||||
42
x-ui.sh
42
x-ui.sh
@@ -218,7 +218,7 @@ reset_user() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
/usr/local/x-ui/x-ui setting -username admin -password admin
|
/usr/local/x-ui/x-ui setting -username admin -password admin
|
||||||
echo -e "Username and password have been reset to ${green}admin${plain},Please restart the panel now."
|
echo -e "Username and password have been reset to ${green}admin${plain}, Please restart the panel now."
|
||||||
confirm_restart
|
confirm_restart
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,7 +248,7 @@ reset_webbasepath() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reset_config() {
|
reset_config() {
|
||||||
confirm "Are you sure you want to reset all panel settings,Account data will not be lost,Username and password will not change" "n"
|
confirm "Are you sure you want to reset all panel settings? Account data will not be lost, Username and password will not change" "n"
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
if [[ $# == 0 ]]; then
|
if [[ $# == 0 ]]; then
|
||||||
show_menu
|
show_menu
|
||||||
@@ -256,19 +256,29 @@ reset_config() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
/usr/local/x-ui/x-ui setting -reset
|
/usr/local/x-ui/x-ui setting -reset
|
||||||
echo -e "All panel settings have been reset to default,Please restart the panel now,and use the default ${green}54321${plain} Port to Access the web Panel"
|
echo -e "All panel settings have been reset to default. Please restart the panel now, and use the default ${green}54321${plain} Port to Access the web Panel"
|
||||||
confirm_restart
|
confirm_restart
|
||||||
}
|
}
|
||||||
|
|
||||||
check_config() {
|
check_config() {
|
||||||
info=$(/usr/local/x-ui/x-ui setting -show true)
|
info=$(/usr/local/x-ui/x-ui setting -show true)
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
LOGE "get current settings error,please check logs"
|
LOGE "Get current settings error, please check logs"
|
||||||
show_menu
|
show_menu
|
||||||
fi
|
fi
|
||||||
LOGI "${info}"
|
LOGI "${info}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_uri() {
|
||||||
|
info=$(/usr/local/x-ui/x-ui uri)
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
LOGE "Get current uri error"
|
||||||
|
show_menu
|
||||||
|
fi
|
||||||
|
LOGI "You may access the Panel with following URL(s):"
|
||||||
|
echo -e "${yellow}${info}${reset}"
|
||||||
|
}
|
||||||
|
|
||||||
set_port() {
|
set_port() {
|
||||||
echo && echo -n -e "Enter port number[1-65535]: " && read port
|
echo && echo -n -e "Enter port number[1-65535]: " && read port
|
||||||
if [[ -z "${port}" ]]; then
|
if [[ -z "${port}" ]]; then
|
||||||
@@ -276,7 +286,7 @@ set_port() {
|
|||||||
before_show_menu
|
before_show_menu
|
||||||
else
|
else
|
||||||
/usr/local/x-ui/x-ui setting -port ${port}
|
/usr/local/x-ui/x-ui setting -port ${port}
|
||||||
echo -e "The port is set,Please restart the panel now,and use the new port ${green}${port}${plain} to access web panel"
|
echo -e "The port is set, Please restart the panel now, and use the new port ${green}${port}${plain} to access web panel"
|
||||||
confirm_restart
|
confirm_restart
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -285,7 +295,7 @@ start() {
|
|||||||
check_status
|
check_status
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
LOGI "Panel is running,No need to start again,If you need to restart, please select restart"
|
LOGI "Panel is running, No need to start again, If you need to restart, please select restart"
|
||||||
else
|
else
|
||||||
systemctl start x-ui
|
systemctl start x-ui
|
||||||
sleep 2
|
sleep 2
|
||||||
@@ -293,7 +303,7 @@ start() {
|
|||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
LOGI "x-ui Started Successfully"
|
LOGI "x-ui Started Successfully"
|
||||||
else
|
else
|
||||||
LOGE "panel Failed to start,Probably because it takes longer than two seconds to start,Please check the log information later"
|
LOGE "panel Failed to start, Probably because it takes longer than two seconds to start, Please check the log information later"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -306,7 +316,7 @@ stop() {
|
|||||||
check_status
|
check_status
|
||||||
if [[ $? == 1 ]]; then
|
if [[ $? == 1 ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
LOGI "Panel stopped,No need to stop again!"
|
LOGI "Panel stopped, No need to stop again!"
|
||||||
else
|
else
|
||||||
systemctl stop x-ui
|
systemctl stop x-ui
|
||||||
sleep 2
|
sleep 2
|
||||||
@@ -314,7 +324,7 @@ stop() {
|
|||||||
if [[ $? == 1 ]]; then
|
if [[ $? == 1 ]]; then
|
||||||
LOGI "x-ui and xray stopped successfully"
|
LOGI "x-ui and xray stopped successfully"
|
||||||
else
|
else
|
||||||
LOGE "Panel stop failed,Probably because the stop time exceeds two seconds,Please check the log information later"
|
LOGE "Panel stop failed, Probably because the stop time exceeds two seconds, Please check the log information later"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -330,7 +340,7 @@ restart() {
|
|||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
LOGI "x-ui and xray Restarted successfully"
|
LOGI "x-ui and xray Restarted successfully"
|
||||||
else
|
else
|
||||||
LOGE "Panel restart failed,Probably because it takes longer than two seconds to start,Please check the log information later"
|
LOGE "Panel restart failed, Probably because it takes longer than two seconds to start, Please check the log information later"
|
||||||
fi
|
fi
|
||||||
if [[ $# == 0 ]]; then
|
if [[ $# == 0 ]]; then
|
||||||
before_show_menu
|
before_show_menu
|
||||||
@@ -402,11 +412,11 @@ update_shell() {
|
|||||||
wget -O /usr/bin/x-ui -N --no-check-certificate https://github.com/alireza0/x-ui/raw/main/x-ui.sh
|
wget -O /usr/bin/x-ui -N --no-check-certificate https://github.com/alireza0/x-ui/raw/main/x-ui.sh
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
LOGE "Failed to download script,Please check whether the machine can connect Github"
|
LOGE "Failed to download script, Please check whether the machine can connect Github"
|
||||||
before_show_menu
|
before_show_menu
|
||||||
else
|
else
|
||||||
chmod +x /usr/bin/x-ui
|
chmod +x /usr/bin/x-ui
|
||||||
LOGI "Upgrade script succeeded,Please rerun the script" && exit 0
|
LOGI "Upgrade script succeeded, Please rerun the script" && exit 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +446,7 @@ check_uninstall() {
|
|||||||
check_status
|
check_status
|
||||||
if [[ $? != 2 ]]; then
|
if [[ $? != 2 ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
LOGE "Panel installed,Please do not reinstall"
|
LOGE "Panel installed, Please do not reinstall"
|
||||||
if [[ $# == 0 ]]; then
|
if [[ $# == 0 ]]; then
|
||||||
before_show_menu
|
before_show_menu
|
||||||
fi
|
fi
|
||||||
@@ -1150,7 +1160,7 @@ show_menu() {
|
|||||||
${green}22.${plain} Speedtest by Ookla
|
${green}22.${plain} Speedtest by Ookla
|
||||||
"
|
"
|
||||||
show_status
|
show_status
|
||||||
echo && read -p "Please enter your selection [0-21]: " num
|
echo && read -p "Please enter your selection [0-22]: " num
|
||||||
|
|
||||||
case "${num}" in
|
case "${num}" in
|
||||||
0)
|
0)
|
||||||
@@ -1181,7 +1191,7 @@ show_menu() {
|
|||||||
check_install && set_port
|
check_install && set_port
|
||||||
;;
|
;;
|
||||||
9)
|
9)
|
||||||
check_install && check_config
|
check_install && check_config && get_uri
|
||||||
;;
|
;;
|
||||||
10)
|
10)
|
||||||
check_install && start
|
check_install && start
|
||||||
@@ -1243,7 +1253,7 @@ if [[ $# > 0 ]]; then
|
|||||||
check_install 0 && status 0
|
check_install 0 && status 0
|
||||||
;;
|
;;
|
||||||
"settings")
|
"settings")
|
||||||
check_install 0 && check_config 0
|
check_install 0 && check_config 0 && get_uri 0
|
||||||
;;
|
;;
|
||||||
"enable")
|
"enable")
|
||||||
check_install 0 && enable 0
|
check_install 0 && enable 0
|
||||||
|
|||||||
Reference in New Issue
Block a user