mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-13 21:13:09 +00:00
Translate x-ui.sh into English (#57)
This commit is contained in:
196
x-ui.sh
196
x-ui.sh
@@ -18,7 +18,7 @@ function LOGI() {
|
||||
echo -e "${green}[INF] $* ${plain}"
|
||||
}
|
||||
# check root
|
||||
[[ $EUID -ne 0 ]] && LOGE "错误: 必须使用root用户运行此脚本!\n" && exit 1
|
||||
[[ $EUID -ne 0 ]] && LOGE "ERROR: You must be root to run this script! \n" && exit 1
|
||||
|
||||
# check os
|
||||
if [[ -f /etc/redhat-release ]]; then
|
||||
@@ -36,7 +36,7 @@ elif cat /proc/version | grep -Eqi "ubuntu"; then
|
||||
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
|
||||
release="centos"
|
||||
else
|
||||
LOGE "未检测到系统版本,请联系脚本作者!\n" && exit 1
|
||||
LOGE "check system OS failed,please contact with author! \n" && exit 1
|
||||
fi
|
||||
|
||||
os_version=""
|
||||
@@ -51,21 +51,21 @@ fi
|
||||
|
||||
if [[ x"${release}" == x"centos" ]]; then
|
||||
if [[ ${os_version} -le 6 ]]; then
|
||||
LOGE "请使用 CentOS 7 或更高版本的系统!\n" && exit 1
|
||||
LOGE "please use CentOS 7 or higher version! \n" && exit 1
|
||||
fi
|
||||
elif [[ x"${release}" == x"ubuntu" ]]; then
|
||||
if [[ ${os_version} -lt 16 ]]; then
|
||||
LOGE "请使用 Ubuntu 16 或更高版本的系统!\n" && exit 1
|
||||
LOGE "please use Ubuntu 16 or higher version!\n" && exit 1
|
||||
fi
|
||||
elif [[ x"${release}" == x"debian" ]]; then
|
||||
if [[ ${os_version} -lt 8 ]]; then
|
||||
LOGE "请使用 Debian 8 或更高版本的系统!\n" && exit 1
|
||||
LOGE "please use Debian 8 or higher version!\n" && exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
confirm() {
|
||||
if [[ $# > 1 ]]; then
|
||||
echo && read -p "$1 [默认$2]: " temp
|
||||
echo && read -p "$1 [Default$2]: " temp
|
||||
if [[ x"${temp}" == x"" ]]; then
|
||||
temp=$2
|
||||
fi
|
||||
@@ -80,7 +80,7 @@ confirm() {
|
||||
}
|
||||
|
||||
confirm_restart() {
|
||||
confirm "是否重启面板,重启面板也会重启 xray" "y"
|
||||
confirm "Restart the panel, Attention: Restarting the panel will also restart xray" "y"
|
||||
if [[ $? == 0 ]]; then
|
||||
restart
|
||||
else
|
||||
@@ -89,7 +89,7 @@ confirm_restart() {
|
||||
}
|
||||
|
||||
before_show_menu() {
|
||||
echo && echo -n -e "${yellow}按回车返回主菜单: ${plain}" && read temp
|
||||
echo && echo -n -e "${yellow}Press enter to return to the main menu: ${plain}" && read temp
|
||||
show_menu
|
||||
}
|
||||
|
||||
@@ -105,9 +105,9 @@ install() {
|
||||
}
|
||||
|
||||
update() {
|
||||
confirm "本功能会强制重装当前最新版,数据不会丢失,是否继续?" "n"
|
||||
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 "已取消"
|
||||
LOGE "Cancelled"
|
||||
if [[ $# == 0 ]]; then
|
||||
before_show_menu
|
||||
fi
|
||||
@@ -115,13 +115,13 @@ update() {
|
||||
fi
|
||||
bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/main/install.sh)
|
||||
if [[ $? == 0 ]]; then
|
||||
LOGI "更新完成,已自动重启面板 "
|
||||
LOGI "Update is complete, Panel has automatically restarted "
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
uninstall() {
|
||||
confirm "确定要卸载面板吗,xray 也会卸载?" "n"
|
||||
confirm "Are you sure you want to uninstall the panel? xray will also uninstalled!" "n"
|
||||
if [[ $? != 0 ]]; then
|
||||
if [[ $# == 0 ]]; then
|
||||
show_menu
|
||||
@@ -137,7 +137,7 @@ uninstall() {
|
||||
rm /usr/local/x-ui/ -rf
|
||||
|
||||
echo ""
|
||||
echo -e "卸载成功,如果你想删除此脚本,则退出脚本后运行 ${green}rm /usr/bin/x-ui -f${plain} 进行删除"
|
||||
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 ""
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
@@ -146,7 +146,7 @@ uninstall() {
|
||||
}
|
||||
|
||||
reset_user() {
|
||||
confirm "确定要将用户名和密码重置为 admin 吗" "n"
|
||||
confirm "Reset your username and password to admin?" "n"
|
||||
if [[ $? != 0 ]]; then
|
||||
if [[ $# == 0 ]]; then
|
||||
show_menu
|
||||
@@ -154,12 +154,12 @@ reset_user() {
|
||||
return 0
|
||||
fi
|
||||
/usr/local/x-ui/x-ui setting -username admin -password admin
|
||||
echo -e "用户名和密码已重置为 ${green}admin${plain},现在请重启面板"
|
||||
echo -e "Username and password have been reset to ${green}admin${plain},Please restart the panel now."
|
||||
confirm_restart
|
||||
}
|
||||
|
||||
reset_config() {
|
||||
confirm "确定要重置所有面板设置吗,账号数据不会丢失,用户名和密码不会改变" "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
|
||||
show_menu
|
||||
@@ -167,7 +167,7 @@ reset_config() {
|
||||
return 0
|
||||
fi
|
||||
/usr/local/x-ui/x-ui setting -reset
|
||||
echo -e "所有面板设置已重置为默认值,现在请重启面板,并使用默认的 ${green}54321${plain} 端口访问面板"
|
||||
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
|
||||
}
|
||||
|
||||
@@ -181,13 +181,13 @@ check_config() {
|
||||
}
|
||||
|
||||
set_port() {
|
||||
echo && echo -n -e "输入端口号[1-65535]: " && read port
|
||||
echo && echo -n -e "Enter port number[1-65535]: " && read port
|
||||
if [[ -z "${port}" ]]; then
|
||||
LOGD "已取消"
|
||||
LOGD "Cancelled"
|
||||
before_show_menu
|
||||
else
|
||||
/usr/local/x-ui/x-ui setting -port ${port}
|
||||
echo -e "设置端口完毕,现在请重启面板,并使用新设置的端口 ${green}${port}${plain} 访问面板"
|
||||
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
|
||||
fi
|
||||
}
|
||||
@@ -196,15 +196,15 @@ start() {
|
||||
check_status
|
||||
if [[ $? == 0 ]]; then
|
||||
echo ""
|
||||
LOGI "面板已运行,无需再次启动,如需重启请选择重启"
|
||||
LOGI "Panel is running,No need to start again,If you need to restart, please select restart"
|
||||
else
|
||||
systemctl start x-ui
|
||||
sleep 2
|
||||
check_status
|
||||
if [[ $? == 0 ]]; then
|
||||
LOGI "x-ui 启动成功"
|
||||
LOGI "x-ui Started Successfully"
|
||||
else
|
||||
LOGE "面板启动失败,可能是因为启动时间超过了两秒,请稍后查看日志信息"
|
||||
LOGE "panel Failed to start,Probably because it takes longer than two seconds to start,Please check the log information later"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -217,15 +217,15 @@ stop() {
|
||||
check_status
|
||||
if [[ $? == 1 ]]; then
|
||||
echo ""
|
||||
LOGI "面板已停止,无需再次停止"
|
||||
LOGI "Panel stopped,No need to stop again!"
|
||||
else
|
||||
systemctl stop x-ui
|
||||
sleep 2
|
||||
check_status
|
||||
if [[ $? == 1 ]]; then
|
||||
LOGI "x-ui 与 xray 停止成功"
|
||||
LOGI "x-ui and xray stopped successfully"
|
||||
else
|
||||
LOGE "面板停止失败,可能是因为停止时间超过了两秒,请稍后查看日志信息"
|
||||
LOGE "Panel stop failed,Probably because the stop time exceeds two seconds,Please check the log information later"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -239,9 +239,9 @@ restart() {
|
||||
sleep 2
|
||||
check_status
|
||||
if [[ $? == 0 ]]; then
|
||||
LOGI "x-ui 与 xray 重启成功"
|
||||
LOGI "x-ui and xray Restarted successfully"
|
||||
else
|
||||
LOGE "面板重启失败,可能是因为启动时间超过了两秒,请稍后查看日志信息"
|
||||
LOGE "Panel restart failed,Probably because it takes longer than two seconds to start,Please check the log information later"
|
||||
fi
|
||||
if [[ $# == 0 ]]; then
|
||||
before_show_menu
|
||||
@@ -258,9 +258,9 @@ status() {
|
||||
enable() {
|
||||
systemctl enable x-ui
|
||||
if [[ $? == 0 ]]; then
|
||||
LOGI "x-ui 设置开机自启成功"
|
||||
LOGI "x-ui Set to boot automatically on startup successfully"
|
||||
else
|
||||
LOGE "x-ui 设置开机自启失败"
|
||||
LOGE "x-ui Failed to set Autostart"
|
||||
fi
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
@@ -271,9 +271,9 @@ enable() {
|
||||
disable() {
|
||||
systemctl disable x-ui
|
||||
if [[ $? == 0 ]]; then
|
||||
LOGI "x-ui 取消开机自启成功"
|
||||
LOGI "x-ui Autostart Cancelled successfully"
|
||||
else
|
||||
LOGE "x-ui 取消开机自启失败"
|
||||
LOGE "x-ui Failed to cancel autostart"
|
||||
fi
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
@@ -305,11 +305,11 @@ update_shell() {
|
||||
wget -O /usr/bin/x-ui -N --no-check-certificate https://github.com/hossinasaadi/x-ui/raw/main/x-ui.sh
|
||||
if [[ $? != 0 ]]; then
|
||||
echo ""
|
||||
LOGE "下载脚本失败,请检查本机能否连接 Github"
|
||||
LOGE "Failed to download script,Please check whether the machine can connect Github"
|
||||
before_show_menu
|
||||
else
|
||||
chmod +x /usr/bin/x-ui
|
||||
LOGI "升级脚本成功,请重新运行脚本" && exit 0
|
||||
LOGI "Upgrade script succeeded,Please rerun the script" && exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ check_uninstall() {
|
||||
check_status
|
||||
if [[ $? != 2 ]]; then
|
||||
echo ""
|
||||
LOGE "面板已安装,请不要重复安装"
|
||||
LOGE "Panel installed,Please do not reinstall"
|
||||
if [[ $# == 0 ]]; then
|
||||
before_show_menu
|
||||
fi
|
||||
@@ -353,7 +353,7 @@ check_install() {
|
||||
check_status
|
||||
if [[ $? == 2 ]]; then
|
||||
echo ""
|
||||
LOGE "请先安装面板"
|
||||
LOGE "Please install the panel first"
|
||||
if [[ $# == 0 ]]; then
|
||||
before_show_menu
|
||||
fi
|
||||
@@ -367,15 +367,15 @@ show_status() {
|
||||
check_status
|
||||
case $? in
|
||||
0)
|
||||
echo -e "面板状态: ${green}已运行${plain}"
|
||||
echo -e "Panel state: ${green}Runing${plain}"
|
||||
show_enable_status
|
||||
;;
|
||||
1)
|
||||
echo -e "面板状态: ${yellow}未运行${plain}"
|
||||
echo -e "Panel state: ${yellow}Not Running${plain}"
|
||||
show_enable_status
|
||||
;;
|
||||
2)
|
||||
echo -e "面板状态: ${red}未安装${plain}"
|
||||
echo -e "Panel state: ${red}Not Installed${plain}"
|
||||
;;
|
||||
esac
|
||||
show_xray_status
|
||||
@@ -384,9 +384,9 @@ show_status() {
|
||||
show_enable_status() {
|
||||
check_enabled
|
||||
if [[ $? == 0 ]]; then
|
||||
echo -e "是否开机自启: ${green}是${plain}"
|
||||
echo -e "Start automatically: ${green}Yes${plain}"
|
||||
else
|
||||
echo -e "是否开机自启: ${red}否${plain}"
|
||||
echo -e "Start automatically: ${red}No${plain}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -402,27 +402,27 @@ check_xray_status() {
|
||||
show_xray_status() {
|
||||
check_xray_status
|
||||
if [[ $? == 0 ]]; then
|
||||
echo -e "xray 状态: ${green}运行${plain}"
|
||||
echo -e "xray state: ${green}Runing${plain}"
|
||||
else
|
||||
echo -e "xray 状态: ${red}未运行${plain}"
|
||||
echo -e "xray state: ${red}Not Running${plain}"
|
||||
fi
|
||||
}
|
||||
|
||||
ssl_cert_issue() {
|
||||
echo -E ""
|
||||
LOGD "******使用说明******"
|
||||
LOGI "该脚本将使用Acme脚本申请证书,使用时需保证:"
|
||||
LOGI "1.知晓Cloudflare 注册邮箱"
|
||||
LOGI "2.知晓Cloudflare Global API Key"
|
||||
LOGI "3.域名已通过Cloudflare进行解析到当前服务器"
|
||||
LOGI "4.该脚本申请证书默认安装路径为/root/cert目录"
|
||||
confirm "我已确认以上内容[y/n]" "y"
|
||||
LOGD "******Instructions for use******"
|
||||
LOGI "This Acme script requires the following data:"
|
||||
LOGI "1.Cloudflare Registered e-mail"
|
||||
LOGI "2.Cloudflare Global API Key"
|
||||
LOGI "3.The domain name that has been resolved dns to the current server by Cloudflare"
|
||||
LOGI "4.The script applies for a certificate. The default installation path is /root/cert "
|
||||
confirm "Confirmed?[y/n]" "y"
|
||||
if [ $? -eq 0 ]; then
|
||||
cd ~
|
||||
LOGI "安装Acme脚本"
|
||||
LOGI "Install Acme-Script"
|
||||
curl https://get.acme.sh | sh
|
||||
if [ $? -ne 0 ]; then
|
||||
LOGE "安装acme脚本失败"
|
||||
LOGE "Failed to install acme script"
|
||||
exit 1
|
||||
fi
|
||||
CF_Domain=""
|
||||
@@ -435,46 +435,46 @@ ssl_cert_issue() {
|
||||
rm -rf $certPath
|
||||
mkdir $certPath
|
||||
fi
|
||||
LOGD "请设置域名:"
|
||||
LOGD "Please set a domain name:"
|
||||
read -p "Input your domain here:" CF_Domain
|
||||
LOGD "你的域名设置为:${CF_Domain}"
|
||||
LOGD "请设置API密钥:"
|
||||
LOGD "Your domain name is set to:${CF_Domain}"
|
||||
LOGD "Please set the API key:"
|
||||
read -p "Input your key here:" CF_GlobalKey
|
||||
LOGD "你的API密钥为:${CF_GlobalKey}"
|
||||
LOGD "请设置注册邮箱:"
|
||||
LOGD "Your API key is:${CF_GlobalKey}"
|
||||
LOGD "Please set up registered email:"
|
||||
read -p "Input your email here:" CF_AccountEmail
|
||||
LOGD "你的注册邮箱为:${CF_AccountEmail}"
|
||||
LOGD "Your registered email address is:${CF_AccountEmail}"
|
||||
~/.acme.sh/acme.sh --set-default-ca --server letsencrypt
|
||||
if [ $? -ne 0 ]; then
|
||||
LOGE "修改默认CA为Lets'Encrypt失败,脚本退出"
|
||||
LOGE "Default CA, Lets'Encrypt fail, script exiting..."
|
||||
exit 1
|
||||
fi
|
||||
export CF_Key="${CF_GlobalKey}"
|
||||
export CF_Email=${CF_AccountEmail}
|
||||
~/.acme.sh/acme.sh --issue --dns dns_cf -d ${CF_Domain} -d *.${CF_Domain} --log
|
||||
if [ $? -ne 0 ]; then
|
||||
LOGE "证书签发失败,脚本退出"
|
||||
LOGE "Certificate issuance failed, script exiting..."
|
||||
exit 1
|
||||
else
|
||||
LOGI "证书签发成功,安装中..."
|
||||
LOGI "Certificate issued Successfully, Installing..."
|
||||
fi
|
||||
~/.acme.sh/acme.sh --installcert -d ${CF_Domain} -d *.${CF_Domain} --ca-file /root/cert/ca.cer \
|
||||
--cert-file /root/cert/${CF_Domain}.cer --key-file /root/cert/${CF_Domain}.key \
|
||||
--fullchain-file /root/cert/fullchain.cer
|
||||
if [ $? -ne 0 ]; then
|
||||
LOGE "证书安装失败,脚本退出"
|
||||
LOGE "Certificate installation failed, script exiting..."
|
||||
exit 1
|
||||
else
|
||||
LOGI "证书安装成功,开启自动更新..."
|
||||
LOGI "Certificate installed Successfully,Turning on automatic updates..."
|
||||
fi
|
||||
~/.acme.sh/acme.sh --upgrade --auto-upgrade
|
||||
if [ $? -ne 0 ]; then
|
||||
LOGE "自动更新设置失败,脚本退出"
|
||||
LOGE "Auto update setup Failed, script exiting..."
|
||||
ls -lah cert
|
||||
chmod 755 $certPath
|
||||
exit 1
|
||||
else
|
||||
LOGI "证书已安装且已开启自动更新,具体信息如下"
|
||||
LOGI "The certificate is installed and auto-renewal is turned on, Specific information is as follows"
|
||||
ls -lah cert
|
||||
chmod 755 $certPath
|
||||
fi
|
||||
@@ -484,51 +484,51 @@ ssl_cert_issue() {
|
||||
}
|
||||
|
||||
show_usage() {
|
||||
echo "x-ui 管理脚本使用方法: "
|
||||
echo "x-ui control menu usages: "
|
||||
echo "------------------------------------------"
|
||||
echo "x-ui - 显示管理菜单 (功能更多)"
|
||||
echo "x-ui start - 启动 x-ui 面板"
|
||||
echo "x-ui stop - 停止 x-ui 面板"
|
||||
echo "x-ui restart - 重启 x-ui 面板"
|
||||
echo "x-ui status - 查看 x-ui 状态"
|
||||
echo "x-ui enable - 设置 x-ui 开机自启"
|
||||
echo "x-ui disable - 取消 x-ui 开机自启"
|
||||
echo "x-ui log - 查看 x-ui 日志"
|
||||
echo "x-ui v2-ui - 迁移本机器的 v2-ui 账号数据至 x-ui"
|
||||
echo "x-ui update - 更新 x-ui 面板"
|
||||
echo "x-ui install - 安装 x-ui 面板"
|
||||
echo "x-ui uninstall - 卸载 x-ui 面板"
|
||||
echo "x-ui - Enter Admin menu"
|
||||
echo "x-ui start - Start x-ui"
|
||||
echo "x-ui stop - Stop x-ui"
|
||||
echo "x-ui restart - Restart x-ui"
|
||||
echo "x-ui status - Show x-ui status"
|
||||
echo "x-ui enable - Enable x-ui on system startup"
|
||||
echo "x-ui disable - Disable x-ui on system startup"
|
||||
echo "x-ui log - Check x-ui logs"
|
||||
echo "x-ui v2-ui - Migrate v2-ui Account data to x-ui"
|
||||
echo "x-ui update - Update x-ui"
|
||||
echo "x-ui install - Install x-ui"
|
||||
echo "x-ui uninstall - Uninstall x-ui"
|
||||
echo "------------------------------------------"
|
||||
}
|
||||
|
||||
show_menu() {
|
||||
echo -e "
|
||||
${green}x-ui 面板管理脚本${plain}
|
||||
${green}0.${plain} 退出脚本
|
||||
${green}x-ui Panel Management Script${plain}
|
||||
${green}0.${plain} exit script
|
||||
————————————————
|
||||
${green}1.${plain} 安装 x-ui
|
||||
${green}2.${plain} 更新 x-ui
|
||||
${green}3.${plain} 卸载 x-ui
|
||||
${green}1.${plain} Install x-ui
|
||||
${green}2.${plain} Update x-ui
|
||||
${green}3.${plain} Uninstall x-ui
|
||||
————————————————
|
||||
${green}4.${plain} 重置用户名密码
|
||||
${green}5.${plain} 重置面板设置
|
||||
${green}6.${plain} 设置面板端口
|
||||
${green}7.${plain} 查看当前面板设置
|
||||
${green}4.${plain} Reset username and password
|
||||
${green}5.${plain} Reset panel settings
|
||||
${green}6.${plain} Set panel port
|
||||
${green}7.${plain} View current panel settings
|
||||
————————————————
|
||||
${green}8.${plain} 启动 x-ui
|
||||
${green}9.${plain} 停止 x-ui
|
||||
${green}10.${plain} 重启 x-ui
|
||||
${green}11.${plain} 查看 x-ui 状态
|
||||
${green}12.${plain} 查看 x-ui 日志
|
||||
${green}8.${plain} Start x-ui
|
||||
${green}9.${plain} stop x-ui
|
||||
${green}10.${plain} Reboot x-ui
|
||||
${green}11.${plain} Check x-ui state
|
||||
${green}12.${plain} Check x-ui logs
|
||||
————————————————
|
||||
${green}13.${plain} 设置 x-ui 开机自启
|
||||
${green}14.${plain} 取消 x-ui 开机自启
|
||||
${green}13.${plain} set x-ui Autostart
|
||||
${green}14.${plain} Cancel x-ui Autostart
|
||||
————————————————
|
||||
${green}15.${plain} 一键安装 bbr (最新内核)
|
||||
${green}16.${plain} 一键申请SSL证书(acme申请)
|
||||
${green}15.${plain} 一A key installation bbr (latest kernel)
|
||||
${green}16.${plain} 一Apply for an SSL certificate with one click(acme script)
|
||||
"
|
||||
show_status
|
||||
echo && read -p "请输入选择 [0-16]: " num
|
||||
echo && read -p "Please enter your selection [0-16]: " num
|
||||
|
||||
case "${num}" in
|
||||
0)
|
||||
@@ -583,7 +583,7 @@ show_menu() {
|
||||
ssl_cert_issue
|
||||
;;
|
||||
*)
|
||||
LOGE "请输入正确的数字 [0-16]"
|
||||
LOGE "Please enter the correct number [0-16]"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user