This commit is contained in:
vumanhhy97 2023-12-25 11:25:22 +07:00 committed by GitHub
parent 49d247706b
commit f6c9ffd09f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

129
x-ui.sh
View file

@ -54,16 +54,8 @@ elif [[ "${release}" == "debian" ]]; then
if [[ ${os_version} -lt 10 ]]; then if [[ ${os_version} -lt 10 ]]; then
echo -e "${red} Please use Debian 10 or higher ${plain}\n" && exit 1 echo -e "${red} Please use Debian 10 or higher ${plain}\n" && exit 1
fi fi
elif [[ "${release}" == "almalinux" ]]; then
if [[ ${os_version} -lt 9 ]]; then
echo -e "${red} Please use Almalinux 9 or higher ${plain}\n" && exit 1
fi
elif [[ "${release}" == "arch" ]]; then elif [[ "${release}" == "arch" ]]; then
echo "Your OS is ArchLinux" echo "OS is ArchLinux"
elif [[ "${release}" == "manjaro" ]]; then
echo "Your OS is Manjaro"
elif [[ "${release}" == "armbian" ]]; then
echo "Your OS is Armbian"
fi fi
@ -130,24 +122,6 @@ update() {
fi fi
} }
custom_version() {
echo "Enter the panel version (like 2.0.0):"
read panel_version
if [ -z "$panel_version" ]; then
echo "Panel version cannot be empty. Exiting."
exit 1
fi
download_link="https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh"
# Use the entered panel version in the download link
install_command="bash <(curl -Ls $download_link) v$panel_version"
echo "Downloading and installing panel version $panel_version..."
eval $install_command
}
uninstall() { uninstall() {
confirm "Are you sure you want to uninstall the panel? xray will also uninstalled!" "n" confirm "Are you sure you want to uninstall the panel? xray will also uninstalled!" "n"
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
@ -545,15 +519,12 @@ update_geo() {
systemctl stop x-ui systemctl stop x-ui
cd ${binFolder} cd ${binFolder}
rm -f geoip.dat geosite.dat geoip_IR.dat geosite_IR.dat geoip_VN.dat geosite_VN.dat rm -f geoip.dat geosite.dat iran.dat
wget -N https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat wget -N https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
wget -N https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat wget -N https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
wget -O geoip_IR.dat -N https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat wget -N https://github.com/MasterKia/iran-hosted-domains/releases/latest/download/iran.dat
wget -O geosite_IR.dat -N https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
wget -O geoip_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geoip.dat
wget -O geosite_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geosite.dat
systemctl start x-ui systemctl start x-ui
echo -e "${green}Geosite.dat + Geoip.dat + geoip_IR.dat + geosite_IR.dat have been updated successfully in bin folder '${binfolder}'!${plain}" echo -e "${green}Geosite.dat + Geoip.dat + Iran.dat have been updated successfully in bin folder '${binfolder}'!${plain}"
before_show_menu before_show_menu
} }
@ -607,7 +578,7 @@ ssl_cert_issue() {
fi fi
# install socat second # install socat second
case "${release}" in case "${release}" in
ubuntu|debian|armbian) ubuntu|debian)
apt update && apt install socat -y ;; apt update && apt install socat -y ;;
centos) centos)
yum -y update && yum -y install socat ;; yum -y update && yum -y install socat ;;
@ -1057,37 +1028,36 @@ show_menu() {
${green}3X-ui Panel Management Script${plain} ${green}3X-ui Panel Management Script${plain}
${green}0.${plain} Exit Script ${green}0.${plain} Exit Script
———————————————— ————————————————
${green}1.${plain} Install ${green}1.${plain} Install x-ui
${green}2.${plain} Update ${green}2.${plain} Update x-ui
${green}3.${plain} Custom Version ${green}3.${plain} Uninstall x-ui
${green}4.${plain} Uninstall
———————————————— ————————————————
${green}5.${plain} Reset Username & Password & Secret Token ${green}4.${plain} Reset Username & Password & Secret Token
${green}6.${plain} Reset Settings ${green}5.${plain} Reset Panel Settings
${green}7.${plain} Change Port ${green}6.${plain} Change Panel Port
${green}8.${plain} View Current Settings ${green}7.${plain} View Current Panel Settings
———————————————— ————————————————
${green}9.${plain} Start ${green}8.${plain} Start x-ui
${green}10.${plain} Stop ${green}9.${plain} Stop x-ui
${green}11.${plain} Restart ${green}10.${plain} Restart x-ui
${green}12.${plain} Check Status ${green}11.${plain} Check x-ui Status
${green}13.${plain} Check Logs ${green}12.${plain} Check x-ui Logs
———————————————— ————————————————
${green}14.${plain} Enable x-ui On System Startup ${green}13.${plain} Enable x-ui On System Startup
${green}15.${plain} Disable x-ui On System Startup ${green}14.${plain} Disable x-ui On System Startup
———————————————— ————————————————
${green}16.${plain} SSL Certificate Management ${green}15.${plain} SSL Certificate Management
${green}17.${plain} Cloudflare SSL Certificate ${green}16.${plain} Cloudflare SSL Certificate
${green}18.${plain} IP Limit Management ${green}17.${plain} IP Limit Management
${green}19.${plain} WARP Management ${green}18.${plain} WARP Management
———————————————— ————————————————
${green}20.${plain} Enable BBR ${green}19.${plain} Enable BBR
${green}21.${plain} Update Geo Files ${green}20.${plain} Update Geo Files
${green}22.${plain} Active Firewall and open ports ${green}21.${plain} Active Firewall and open ports
${green}23.${plain} Speedtest by Ookla ${green}22.${plain} Speedtest by Ookla
" "
show_status show_status
echo && read -p "Please enter your selection [0-23]: " num echo && read -p "Please enter your selection [0-22]: " num
case "${num}" in case "${num}" in
0) 0)
@ -1100,70 +1070,67 @@ show_menu() {
check_install && update check_install && update
;; ;;
3) 3)
check_install && custom_version
;;
4)
check_install && uninstall check_install && uninstall
;; ;;
5) 4)
check_install && reset_user check_install && reset_user
;; ;;
6) 5)
check_install && reset_config check_install && reset_config
;; ;;
7) 6)
check_install && set_port check_install && set_port
;; ;;
8) 7)
check_install && check_config check_install && check_config
;; ;;
9) 8)
check_install && start check_install && start
;; ;;
10) 9)
check_install && stop check_install && stop
;; ;;
11) 10)
check_install && restart check_install && restart
;; ;;
12) 11)
check_install && status check_install && status
;; ;;
13) 12)
check_install && show_log check_install && show_log
;; ;;
14) 13)
check_install && enable check_install && enable
;; ;;
15) 14)
check_install && disable check_install && disable
;; ;;
16) 15)
ssl_cert_issue_main ssl_cert_issue_main
;; ;;
17) 16)
ssl_cert_issue_CF ssl_cert_issue_CF
;; ;;
18) 17)
iplimit_main iplimit_main
;; ;;
19) 18)
warp_cloudflare warp_cloudflare
;; ;;
20) 19)
enable_bbr enable_bbr
;; ;;
21) 20)
update_geo update_geo
;; ;;
22) 21)
open_ports open_ports
;; ;;
23) 22)
run_speedtest run_speedtest
;; ;;
*) *)
LOGE "Please enter the correct number [0-23]" LOGE "Please enter the correct number [0-22]"
;; ;;
esac esac
} }