Skip to content

Commit

Permalink
Merge pull request vaxilu#148 from FranzKafkaYu/main
Browse files Browse the repository at this point in the history
add ssl issue and require config after install to avoid default config
  • Loading branch information
vaxilu committed Mar 13, 2022
2 parents 5d86891 + b99c0fe commit 60ff490
Show file tree
Hide file tree
Showing 2 changed files with 217 additions and 76 deletions.
47 changes: 35 additions & 12 deletions install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ fi
arch=$(arch)

if [[ $arch == "x86_64" || $arch == "x64" || $arch == "amd64" ]]; then
arch="amd64"
arch="amd64"
elif [[ $arch == "aarch64" || $arch == "arm64" ]]; then
arch="arm64"
arch="arm64"
else
arch="amd64"
echo -e "${red}检测架构失败,使用默认架构: ${arch}${plain}"
arch="amd64"
echo -e "${red}检测架构失败,使用默认架构: ${arch}${plain}"
fi

echo "架构: ${arch}"

if [ $(getconf WORD_BIT) != '32' ] && [ $(getconf LONG_BIT) != '64' ] ; then
if [ $(getconf WORD_BIT) != '32' ] && [ $(getconf LONG_BIT) != '64' ]; then
echo "本软件不支持 32 位系统(x86),请使用 64 位系统(x86_64),如果检测有误,请联系作者"
exit -1
fi
Expand Down Expand Up @@ -79,11 +79,32 @@ install_base() {
fi
}

#This function will be called when user installed x-ui out of sercurity
config_after_install() {
echo -e "${yellow}出于安全考虑,安装完成后需要强制修改端口与账户密码${plain}"
read -p "请设置您的账户名:" config_account
echo -e "${yellow}您的账户名将设定为:${config_account}${plain}"
read -p "请设置您的账户密码:" config_password
echo -e "${yellow}您的账户密码将设定为:${config_password}${plain}"
read -p "请设置面板访问端口:" config_port
echo -e "${yellow}您的面板访问端口将设定为:${config_port}${plain}"
read -p "确认设定完成?[y/n]": config_confirm
if [[ x"${config_confirm}" == x"y" || x"${config_confirm}" == x"Y" ]]; then
echo -e "${yellow}确认设定,设定中${plain}"
/usr/local/x-ui/x-ui setting -username ${config_account} -password ${config_password}
echo -e "${yellow}账户密码设定完成${plain}"
/usr/local/x-ui/x-ui setting -port ${config_port}
echo -e "${yellow}面板端口设定完成${plain}"
else
echo -e "${red}已取消,所有设置项均为默认设置,请及时修改${plain}"
fi
}

install_x-ui() {
systemctl stop x-ui
cd /usr/local/

if [ $# == 0 ] ;then
if [ $# == 0 ]; then
last_version=$(curl -Ls "https://api.github.com/repos/vaxilu/x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [[ ! -n "$last_version" ]]; then
echo -e "${red}检测 x-ui 版本失败,可能是超出 Github API 限制,请稍后再试,或手动指定 x-ui 版本安装${plain}"
Expand Down Expand Up @@ -116,18 +137,20 @@ install_x-ui() {
chmod +x x-ui bin/xray-linux-${arch}
cp -f x-ui.service /etc/systemd/system/
wget --no-check-certificate -O /usr/bin/x-ui https://raw.githubusercontent.com/vaxilu/x-ui/main/x-ui.sh
chmod +x /usr/local/x-ui/x-ui.sh
chmod +x /usr/bin/x-ui
config_after_install
#echo -e "如果是全新安装,默认网页端口为 ${green}54321${plain},用户名和密码默认都是 ${green}admin${plain}"
#echo -e "请自行确保此端口没有被其他程序占用,${yellow}并且确保 54321 端口已放行${plain}"
# echo -e "若想将 54321 修改为其它端口,输入 x-ui 命令进行修改,同样也要确保你修改的端口也是放行的"
#echo -e ""
#echo -e "如果是更新面板,则按你之前的方式访问面板"
#echo -e ""
systemctl daemon-reload
systemctl enable x-ui
systemctl start x-ui
echo -e "${green}x-ui v${last_version}${plain} 安装完成,面板已启动,"
echo -e ""
echo -e "如果是全新安装,默认网页端口为 ${green}54321${plain},用户名和密码默认都是 ${green}admin${plain}"
echo -e "请自行确保此端口没有被其他程序占用,${yellow}并且确保 54321 端口已放行${plain}"
# echo -e "若想将 54321 修改为其它端口,输入 x-ui 命令进行修改,同样也要确保你修改的端口也是放行的"
echo -e ""
echo -e "如果是更新面板,则按你之前的方式访问面板"
echo -e ""
echo -e "x-ui 管理脚本使用方法: "
echo -e "----------------------------------------------"
echo -e "x-ui - 显示管理菜单 (功能更多)"
Expand Down
Loading

0 comments on commit 60ff490

Please sign in to comment.