Skip to content

Commit

Permalink
feat(脚本): 修改订阅安装时重复启动nginx问题、修复读取域名错误问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mack-a committed Dec 19, 2023
1 parent 7a49fb0 commit bc45844
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ readInstallProtocolType() {
if echo "${row}" | grep -q VLESS_vision_reality_inbounds; then
currentInstallProtocolType=${currentInstallProtocolType}'7'
if [[ "${coreInstallType}" == "2" ]]; then
frontingType=07_VLESS_vision_reality_inbounds
frontingTypeReality=07_VLESS_vision_reality_inbounds
singBoxVLESSRealityVisionPort=$(jq -r .inbounds[0].listen_port "${row}.json")
singBoxVLESSRealityVisionServerName=$(jq -r .inbounds[0].tls.server_name "${row}.json")
if [[ -f "${configPath}reality_key" ]]; then
Expand All @@ -428,7 +428,7 @@ readInstallProtocolType() {
if echo "${row}" | grep -q VLESS_vision_gRPC_inbounds; then
currentInstallProtocolType=${currentInstallProtocolType}'8'
if [[ "${coreInstallType}" == "2" ]]; then
frontingType=08_VLESS_vision_reality_inbounds
frontingTypeReality=08_VLESS_vision_gRPC_inbounds
singBoxVLESSRealityGRPCPort=$(jq -r .inbounds[0].listen_port "${row}.json")
singBoxVLESSRealityGRPCServerName=$(jq -r .inbounds[0].tls.server_name "${row}.json")
if [[ -f "${configPath}reality_key" ]]; then
Expand Down Expand Up @@ -704,17 +704,21 @@ readConfigHostPathUUID() {
fi
fi
elif [[ "${coreInstallType}" == "2" ]]; then

currentHost=$(jq -r .inbounds[0].tls.server_name ${configPath}${frontingType}.json)
if [[ -n "${frontingType}" ]]; then
currentHost=$(jq -r .inbounds[0].tls.server_name ${configPath}${frontingType}.json)
currentUUID=$(jq -r .inbounds[0].users[0].uuid ${configPath}${frontingType}.json)
currentClients=$(jq -r .inbounds[0].users ${configPath}${frontingType}.json)
else
currentUUID=$(jq -r .inbounds[0].users[0].uuid ${configPath}${frontingTypeReality}.json)
currentClients=$(jq -r .inbounds[0].users ${configPath}${frontingTypeReality}.json)
fi

# currentAdd=$(jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType}.json)

if [[ "${currentAdd}" == "null" ]]; then
currentAdd=${currentHost}
fi
currentUUID=$(jq -r .inbounds[0].users[0].uuid ${configPath}${frontingType}.json)
# currentPort=$(jq .inbounds[0].port ${configPath}${frontingType}.json)
currentClients=$(jq -r .inbounds[0].users ${configPath}${frontingType}.json)

fi

# 读取path
Expand Down Expand Up @@ -7160,7 +7164,7 @@ installSubscribe() {

mapfile -t result < <(initSingBoxPort "${subscribePort}")

if (! echo "${selectCustomInstallType}" | grep -q -E "0|1|2|3|4|5|6|9" || ! echo "${currentInstallProtocolType}" | grep -q -E "0|1|2|3|4|5|6|9") && [[ "${selectInstallType}" == "2" ]]; then
if (! echo "${selectCustomInstallType}" | grep -q -E "0|1|2|3|4|5|6|9" || ! echo "${currentInstallProtocolType}" | grep -q -E "0|1|2|3|4|5|6|9") && [[ "${selectInstallType}" == "2" || "${coreInstallType}" == "2" ]]; then
echoContent green "未发现tls证书,使用无加密订阅,可能被运营商拦截。请注意风险"
read -r -p "是否使用[y/n]?" addNginxSubscribeStatus
if [[ "${addNginxSubscribeStatus}" != "y" ]]; then
Expand Down Expand Up @@ -7200,6 +7204,8 @@ server {
}
}
EOF
handleNginx stop
handleNginx start
fi
}
# 卸载订阅
Expand Down Expand Up @@ -7656,10 +7662,9 @@ initRandomSalt() {
# 订阅
subscribe() {
readInstallProtocolType
handleNginx stop

installSubscribe
readNginxSubscribe
handleNginx start
if [[ "${coreInstallType}" == "1" || "${coreInstallType}" == "2" ]]; then

echoContent skyBlue "-------------------------备注---------------------------------"
Expand Down Expand Up @@ -8257,7 +8262,7 @@ menu() {
cd "$HOME" || exit
echoContent red "\n=============================================================="
echoContent green "作者:mack-a"
echoContent green "当前版本:v3.1.9-beta"
echoContent green "当前版本:v3.1.10-beta"
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c"
showInstallStatus
Expand Down

0 comments on commit bc45844

Please sign in to comment.