Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMHSanaei <ho3ein.sanaei@gmail.com>2023-04-24 16:25:29 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2023-04-24 16:25:29 +0300
commit04d85af40e9583cf52932350ab3976f392ea9fb6 (patch)
treed5ae8c15e9f91e0a3d92ba3b299f130aae4e452e /x-ui.sh
parentfca882ee31deacd9358d8a5ca846aa5ef639ef94 (diff)
undo changesv1.2.8
Diffstat (limited to 'x-ui.sh')
-rw-r--r--x-ui.sh61
1 files changed, 11 insertions, 50 deletions
diff --git a/x-ui.sh b/x-ui.sh
index bde6eefb..da6d11fc 100644
--- a/x-ui.sh
+++ b/x-ui.sh
@@ -56,14 +56,6 @@ elif [[ "${release}" == "debian" ]]; then
fi
fi
-arch3xui() {
- case "$(uname -m)" in
- x86_64 | x64 | amd64 ) echo 'amd64' ;;
- armv8 | arm64 | aarch64 ) echo 'arm64' ;;
- * ) echo -e "${red} Unsupported CPU architecture!${plain}" && exit 1 ;;
- esac
-}
-
confirm() {
if [[ $# > 1 ]]; then
echo && read -p "$1 [Default $2]: " temp
@@ -106,49 +98,18 @@ install() {
}
update() {
- read -rp "This function will update the X-UI panel to the latest version. Data will not be lost. Whether to continues? [Y/N]: " yn
- if [[ $yn =~ "Y"|"y" ]]; then
- systemctl stop x-ui
- if [[ -e /usr/local/x-ui/ ]]; then
- cd
- rm -rf /usr/local/x-ui/
- fi
-
- last_version=$(curl -Ls "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') || last_version=$(curl -sm8 https://raw.githubusercontent.com/MHSanaei/3x-ui/main/config/version)
- if [[ -z "$last_version" ]]; then
- echo -e "${red}Detecting the X-UI version failed, please make sure your server can connect to the GitHub API ${plain}"
- exit 1
- fi
-
- echo -e "${yellow}The latest version of X-UI is: ${last_version}, starting update...${plain}"
- wget -N --no-check-certificate -O /usr/local/x-ui-linux-$(arch3xui).tar.gz https://github.com/MHSanaei/3x-ui/releases/download/${last_version}/x-ui-linux-$(arch3xui).tar.gz
- if [[ $? -ne 0 ]]; then
- echo -e "${red}Download the X-UI failure, please make sure your server can connect and download the files from github ${plain}"
- exit 1
+ confirm "This function will forcefully reinstall the latest version, and the data will not be lost. Do you want to continue?" "n"
+ if [[ $? != 0 ]]; then
+ LOGE "Cancelled"
+ if [[ $# == 0 ]]; then
+ before_show_menu
fi
-
- cd /usr/local/
- tar zxvf x-ui-linux-$(arch3xui).tar.gz
- rm -f x-ui-linux-$(arch3xui).tar.gz
-
- cd x-ui
- chmod +x x-ui bin/xray-linux-$(arch3xui)
- cp -f x-ui.service /etc/systemd/system/
-
- wget -N --no-check-certificate https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh -O /usr/bin/x-ui
- chmod +x /usr/local/x-ui/x-ui.sh
- chmod +x /usr/bin/x-ui
-
- systemctl daemon-reload
- systemctl enable x-ui >/dev/null 2>&1
- systemctl start x-ui
- systemctl restart x-ui
-
- echo -e "${green}The update is completed, and the X-UI panel has been automatically restarted ${plain}"
- exit 1
- else
- echo -e "${red}The upgrade X-UI panel has been canceled! ${plain}"
- exit 1
+ return 0
+ fi
+ bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/install.sh)
+ if [[ $? == 0 ]]; then
+ LOGI "Update is complete, Panel has automatically restarted "
+ exit 0
fi
}