Merge branch 'master' into reality

dev
mack-a 2023-03-09 15:37:44 +08:00
commit 23f0eac6bb
1 changed files with 54 additions and 29 deletions

View File

@ -194,6 +194,7 @@ initVar() {
btDomain=
# nginx配置文件路径
nginxConfigPath=/etc/nginx/conf.d/
nginxStaticPath=/usr/share/nginx/html/
# 是否为预览版
prereleaseStatus=false
@ -348,6 +349,11 @@ checkBTPanel() {
ln -s "/www/server/panel/vhost/cert/${btDomain}/privkey.pem" "/etc/v2ray-agent/tls/${btDomain}.key"
ln -s "/www/server/panel/vhost/cert/${btDomain}/fullchain.pem" "/etc/v2ray-agent/tls/${btDomain}.crt"
fi
nginxStaticPath="/www/wwwroot/${btDomain}/"
if [[ -f "/www/wwwroot/${btDomain}/.user.ini" ]]; then
chattr -i "/www/wwwroot/${btDomain}/.user.ini"
fi
nginxConfigPath="/www/server/panel/vhost/nginx/"
fi
fi
@ -901,7 +907,7 @@ server {
listen ${port};
listen [::]:${port};
server_name ${domain};
root /usr/share/nginx/html;
root ${nginxStaticPath};
location ~ /.well-known {
allow all;
}
@ -952,7 +958,7 @@ EOF
server {
listen 127.0.0.1:31302 http2 so_keepalive=on;
server_name ${domain};
root /usr/share/nginx/html;
root ${nginxStaticPath};
client_header_timeout 1071906480m;
keepalive_timeout 1071906480m;
@ -993,7 +999,7 @@ EOF
server {
listen 127.0.0.1:31302 http2;
server_name ${domain};
root /usr/share/nginx/html;
root ${nginxStaticPath};
location /s/ {
add_header Content-Type text/plain;
alias /etc/v2ray-agent/subscribe/;
@ -1018,7 +1024,7 @@ EOF
server {
listen 127.0.0.1:31302 http2;
server_name ${domain};
root /usr/share/nginx/html;
root ${nginxStaticPath};
location /s/ {
add_header Content-Type text/plain;
alias /etc/v2ray-agent/subscribe/;
@ -1042,7 +1048,7 @@ EOF
server {
listen 127.0.0.1:31302 http2;
server_name ${domain};
root /usr/share/nginx/html;
root ${nginxStaticPath};
location /s/ {
add_header Content-Type text/plain;
alias /etc/v2ray-agent/subscribe/;
@ -1057,7 +1063,7 @@ EOF
server {
listen 127.0.0.1:31300;
server_name ${domain};
root /usr/share/nginx/html;
root ${nginxStaticPath};
location /s/ {
add_header Content-Type text/plain;
alias /etc/v2ray-agent/subscribe/;
@ -1270,7 +1276,7 @@ customPortFunction() {
if [[ -z "${currentPort}" && -z "${customPort}" ]] || [[ "${historyCustomPortStatus}" == "n" ]]; then
echo
if [[ -n "${btnDomain}" ]]; then
if [[ -n "${btDomain}" ]]; then
echoContent yellow "请输入端口[不可于BT Panel端口相同]"
else
echoContent yellow "请输入端口[默认: 443]如自定义端口只允许使用DNS申请证书[回车使用默认]"
@ -1387,7 +1393,7 @@ server {
listen 80;
listen [::]:80;
server_name ${domain};
root /usr/share/nginx/html;
root ${nginxStaticPath};
location ~ /.well-known {allow all;}
location /test {return 200 'fjkvymb6len';}
}
@ -1439,23 +1445,23 @@ randomPathFunction() {
# Nginx伪装博客
nginxBlog() {
echoContent skyBlue "\n进度 $1/${totalProgress} : 添加伪装站点"
if [[ -d "/usr/share/nginx/html" && -f "/usr/share/nginx/html/check" ]]; then
if [[ -d "${nginxStaticPath}" && -f "${nginxStaticPath}/check" ]]; then
echo
read -r -p "检测到安装伪装站点,是否需要重新安装[y/n]:" nginxBlogInstallStatus
if [[ "${nginxBlogInstallStatus}" == "y" ]]; then
rm -rf /usr/share/nginx/html
rm -rf "${nginxStaticPath}"
randomNum=$((RANDOM % 6 + 1))
wget -q -P /usr/share/nginx https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${randomNum}.zip >/dev/null
unzip -o /usr/share/nginx/html${randomNum}.zip -d /usr/share/nginx/html >/dev/null
rm -f /usr/share/nginx/html${randomNum}.zip*
wget -q -P "${nginxStaticPath}" https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${randomNum}.zip >/dev/null
unzip -o "${nginxStaticPath}html${randomNum}.zip" -d "${nginxStaticPath}" >/dev/null
rm -f "${nginxStaticPath}html${randomNum}.zip*"
echoContent green " ---> 添加伪装站点成功"
fi
else
randomNum=$((RANDOM % 6 + 1))
rm -rf /usr/share/nginx/html
wget -q -P /usr/share/nginx https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${randomNum}.zip >/dev/null
unzip -o /usr/share/nginx/html${randomNum}.zip -d /usr/share/nginx/html >/dev/null
rm -f /usr/share/nginx/html${randomNum}.zip*
rm -rf "${nginxStaticPath}"
wget -q -P "${nginxStaticPath}" https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${randomNum}.zip >/dev/null
unzip -o "${nginxStaticPath}html${randomNum}.zip" -d "${nginxStaticPath}" >/dev/null
rm -f "${nginxStaticPath}html${randomNum}.zip*"
echoContent green " ---> 添加伪装站点成功"
fi
@ -3553,7 +3559,7 @@ addNginx302() {
updateNginxBlog() {
echoContent skyBlue "\n进度 $1/${totalProgress} : 更换伪装站点"
echoContent red "=============================================================="
echoContent yellow "# 如需自定义,请手动复制模版文件到 /usr/share/nginx/html \n"
echoContent yellow "# 如需自定义,请手动复制模版文件到 ${nginxStaticPath} \n"
echoContent yellow "1.新手引导"
echoContent yellow "2.游戏网站"
echoContent yellow "3.个人博客01"
@ -3605,8 +3611,8 @@ updateNginxBlog() {
wget -c -P /usr/share/nginx "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${selectInstallNginxBlogType}.zip" >/dev/null
fi
unzip -o "/usr/share/nginx/html${selectInstallNginxBlogType}.zip" -d /usr/share/nginx/html >/dev/null
rm -f "/usr/share/nginx/html${selectInstallNginxBlogType}.zip*"
unzip -o "${nginxStaticPath}${selectInstallNginxBlogType}.zip" -d "${nginxStaticPath}" >/dev/null
rm -f "${nginxStaticPath}${selectInstallNginxBlogType}.zip*"
echoContent green " ---> 更换伪站成功"
else
echoContent red " ---> 选择错误,请重新选择"
@ -3786,8 +3792,8 @@ unInstall() {
rm -rf /etc/v2ray-agent
rm -rf ${nginxConfigPath}alone.conf
if [[ -d "/usr/share/nginx/html" && -f "/usr/share/nginx/html/check" ]]; then
rm -rf /usr/share/nginx/html
if [[ -d "${nginxStaticPath}" && -f "${nginxStaticPath}/check" ]]; then
rm -rf "${nginxStaticPath}"
echoContent green " ---> 删除伪装网站完成"
fi
@ -5246,7 +5252,18 @@ customXrayInstall() {
randomPathFunction 4
customCDNIP 5
fi
nginxBlog 6
if [[ -n "${btDomain}" ]]; then
echoContent skyBlue "\n进度 6/${totalProgress} : 检测到宝塔面板,是否 安装/重新安装 伪装站点?"
echoContent red "=============================================================="
echoContent yellow "# 注意事项"
echoContent yellow "会清空当前安装网站下面的静态目录,如已自定义安装过请选择 [n]\n"
read -r -p "请选择[y/n]:" nginxBlogBTStatus
if [[ "${nginxBlogBTStatus}" == "y" ]]; then
nginxBlog 6
fi
else
nginxBlog 6
fi
updateRedirectNginxConf
handleNginx start
@ -5352,17 +5369,13 @@ xrayCoreInstall() {
echoContent skyBlue "\n进度 3/${totalProgress} : 检测到宝塔面板跳过申请TLS步骤"
handleXray stop
customPortFunction
else
# 申请tls
initTLSNginxConfig 3
handleXray stop
handleNginx start
checkIP
installTLS 4
fi
handleNginx stop
@ -5375,7 +5388,19 @@ xrayCoreInstall() {
initXrayConfig all 9
cleanUp v2rayDel
installCronTLS 10
nginxBlog 11
if [[ -n "${btDomain}" ]]; then
echoContent skyBlue "\n进度 11/${totalProgress} : 检测到宝塔面板,是否 安装/重新安装 伪装站点?"
echoContent red "=============================================================="
echoContent yellow "# 注意事项"
echoContent yellow "会清空当前安装网站下面的静态目录,如已自定义安装过请选择 [n]\n"
read -r -p "请选择[y/n]:" nginxBlogBTStatus
if [[ "${nginxBlogBTStatus}" == "y" ]]; then
nginxBlog 11
fi
else
nginxBlog 11
fi
updateRedirectNginxConf
handleXray stop
sleep 2
@ -5685,7 +5710,7 @@ menu() {
cd "$HOME" || exit
echoContent red "\n=============================================================="
echoContent green "作者mack-a"
echoContent green "当前版本v2.7.10"
echoContent green "当前版本v2.7.11"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c"
showInstallStatus