Update x-ui.sh

This commit is contained in:
MasoudKhz 2023-07-04 14:04:10 +03:30 committed by GitHub
parent 5659f5bc33
commit 4311adfd94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

20
x-ui.sh
View file

@ -87,7 +87,7 @@ before_show_menu() {
} }
install() { install() {
bash <(curl -Ls https://raw.githubusercontent.com/MasoudKhz/3x-ui/master/install.sh) bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/install.sh)
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
if [[ $# == 0 ]]; then if [[ $# == 0 ]]; then
start start
@ -106,7 +106,7 @@ update() {
fi fi
return 0 return 0
fi fi
bash <(curl -Ls https://raw.githubusercontent.com/MasoudKhz/3x-ui/master/install.sh) bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/install.sh)
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
LOGI "Update is complete, Panel has automatically restarted " LOGI "Update is complete, Panel has automatically restarted "
exit 0 exit 0
@ -127,7 +127,7 @@ uninstall() {
systemctl daemon-reload systemctl daemon-reload
systemctl reset-failed systemctl reset-failed
rm /etc/x-ui/ -rf rm /etc/x-ui/ -rf
rm /usr/local/3x-ui-p1/ -rf rm /usr/local/x-ui/ -rf
echo "" echo ""
echo -e "Uninstalled Successfully, If you want to remove this script, then after exiting the script run ${green}rm /usr/bin/x-ui -f${plain} to delete it." echo -e "Uninstalled Successfully, If you want to remove this script, then after exiting the script run ${green}rm /usr/bin/x-ui -f${plain} to delete it."
@ -150,8 +150,8 @@ reset_user() {
[[ -z $config_account ]] && config_account=$(date +%s%N | md5sum | cut -c 1-8) [[ -z $config_account ]] && config_account=$(date +%s%N | md5sum | cut -c 1-8)
read -rp "Please set the login password [default is a random password]: " config_password read -rp "Please set the login password [default is a random password]: " config_password
[[ -z $config_password ]] && config_password=$(date +%s%N | md5sum | cut -c 1-8) [[ -z $config_password ]] && config_password=$(date +%s%N | md5sum | cut -c 1-8)
/usr/local/3x-ui-p1/x-ui setting -username ${config_account} -password ${config_password} >/dev/null 2>&1 /usr/local/x-ui/x-ui setting -username ${config_account} -password ${config_password} >/dev/null 2>&1
/usr/local/3x-ui-p1/x-ui setting -remove_secret >/dev/null 2>&1 /usr/local/x-ui/x-ui setting -remove_secret >/dev/null 2>&1
echo -e "Panel login username has been reset to: ${green} ${config_account} ${plain}" echo -e "Panel login username has been reset to: ${green} ${config_account} ${plain}"
echo -e "Panel login password has been reset to: ${green} ${config_password} ${plain}" echo -e "Panel login password has been reset to: ${green} ${config_password} ${plain}"
echo -e "${yellow} Panel login secret token disabled ${plain}" echo -e "${yellow} Panel login secret token disabled ${plain}"
@ -167,13 +167,13 @@ reset_config() {
fi fi
return 0 return 0
fi fi
/usr/local/3x-ui-p1/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}2053${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}2053${plain} Port to Access the web Panel"
confirm_restart confirm_restart
} }
check_config() { check_config() {
info=$(/usr/local/3x-ui-p1/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
@ -187,7 +187,7 @@ set_port() {
LOGD "Cancelled" LOGD "Cancelled"
before_show_menu before_show_menu
else else
/usr/local/3x-ui-p1/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
@ -328,7 +328,7 @@ enable_bbr() {
} }
update_shell() { update_shell() {
wget -O /usr/bin/x-ui -N --no-check-certificate https://github.com/MasoudKhz/3x-ui/raw/master/x-ui.sh wget -O /usr/bin/x-ui -N --no-check-certificate https://github.com/MHSanaei/3x-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"
@ -487,7 +487,7 @@ open_ports() {
} }
update_geo() { update_geo() {
local defaultBinFolder="/usr/local/3x-ui-p1/bin" local defaultBinFolder="/usr/local/x-ui/bin"
read -p "Please enter x-ui bin folder path. Leave blank for default. (Default: '${defaultBinFolder}')" binFolder read -p "Please enter x-ui bin folder path. Leave blank for default. (Default: '${defaultBinFolder}')" binFolder
binFolder=${binFolder:-${defaultBinFolder}} binFolder=${binFolder:-${defaultBinFolder}}
if [[ ! -d ${binFolder} ]]; then if [[ ! -d ${binFolder} ]]; then