fix(脚本): 修改更换CDN节点时的bug

pull/534/merge
mack-a 2020-11-27 16:21:43 +08:00
parent 02a4629b63
commit 28e52f37a2
1 changed files with 29 additions and 13 deletions

View File

@ -255,11 +255,11 @@ cleanUp(){
elif [[ "$1" = "v2rayDel" ]] elif [[ "$1" = "v2rayDel" ]]
then then
rm -rf `ls /etc/v2ray-agent/v2ray/*` rm -rf /etc/v2ray-agent/v2ray/*
elif [[ "$1" = "xrayDel" ]] elif [[ "$1" = "xrayDel" ]]
then then
rm -rf `ls /etc/v2ray-agent/xray/*` rm -rf /etc/v2ray-agent/xray/*
fi fi
} }
@ -2759,8 +2759,16 @@ updateV2RayCDN(){
echoContent skyBlue "\n进度 $1/${totalProgress} : 修改CDN节点" echoContent skyBlue "\n进度 $1/${totalProgress} : 修改CDN节点"
if [[ ! -z "${v2rayAgentInstallType}" ]] if [[ ! -z "${v2rayAgentInstallType}" ]]
then then
local configPath=
if [[ "${coreInstallType}" = "1" ]]
then
configPath=${xrayCoreConfigFilePath}
elif [[ "${coreInstallType}" = "2" || "${coreInstallType}" = "3" ]]
then
configPath=${v2rayCoreConfigFilePath}
fi
local add=`cat ${v2rayCoreConfigFilePath}|grep -v grep|grep add` local add=`cat ${configPath}|grep -v grep|grep add`
if [[ ! -z ${add} ]] if [[ ! -z ${add} ]]
then then
echoContent red "==============================================================" echoContent red "=============================================================="
@ -2790,29 +2798,37 @@ updateV2RayCDN(){
add=`echo ${add}|awk -F '["]' '{print $4}'` add=`echo ${add}|awk -F '["]' '{print $4}'`
if [[ ! -z ${add} ]] if [[ ! -z ${add} ]]
then then
sed -i "s/${add}/${setDomain}/g" `grep "${add}" -rl ${configPath}` sed -i "s/\"${add}\"/\"${setDomain}\"/g" `grep "${add}" -rl ${configPath}`
fi fi
if [[ `cat ${v2rayCoreConfigFilePath}|grep -v grep|grep add|awk -F '["]' '{print $4}'` = ${setDomain} ]] if [[ `cat ${configPath}|grep -v grep|grep add|awk -F '["]' '{print $4}'` = ${setDomain} ]]
then then
echoContent green " ---> V2Ray CDN修改成功" echoContent green " ---> V2Ray CDN修改成功"
handleV2Ray stop if [[ "${coreInstallType}" = "1" ]]
handleV2Ray start then
handleXray stop
handleXray start
elif [[ "${coreInstallType}" = "2" || "${coreInstallType}" = "3" ]]
then
handleV2Ray stop
handleV2Ray start
fi
else else
echoContent red " ---> 修改V2Ray CDN失败" echoContent red " ---> 修改V2Ray CDN失败"
fi fi
# trojan # trojan
if [[ -d "/etc/v2ray-agent/trojan" ]] && [[ -f "/etc/v2ray-agent/trojan/config.json" ]] if [[ -d "/etc/v2ray-agent/trojan" ]] && [[ -f "/etc/v2ray-agent/trojan/config_full.json" ]]
then then
add=`cat /etc/v2ray-agent/trojan/config.json|jq .websocket.add|awk -F '["]' '{print $2}'` add=`cat /etc/v2ray-agent/trojan/config_full.json|jq .websocket.add|awk -F '["]' '{print $2}'`
if [[ ! -z ${add} ]] if [[ ! -z ${add} ]]
then then
sed -i "s/${add}/${setDomain}/g" `grep "${add}" -rl /etc/v2ray-agent/trojan/config.json` sed -i "s/${add}/${setDomain}/g" `grep "${add}" -rl /etc/v2ray-agent/trojan/config_full.json`
fi fi
fi fi
if [[ -d "/etc/v2ray-agent/trojan" ]] && [[ -f "/etc/v2ray-agent/trojan/config.json" ]] && [[ `cat /etc/v2ray-agent/trojan/config.json|jq .websocket.add|awk -F '["]' '{print $2}'` = ${setDomain} ]] if [[ -d "/etc/v2ray-agent/trojan" ]] && [[ -f "/etc/v2ray-agent/trojan/config_full.json" ]] && [[ `cat /etc/v2ray-agent/trojan/config_full.json|jq .websocket.add|awk -F '["]' '{print $2}'` = ${setDomain} ]]
then then
echoContent green "\n ---> Trojan CDN修改成功" echoContent green "\n ---> Trojan CDN修改成功"
handleTrojanGo stop handleTrojanGo stop
@ -3279,8 +3295,8 @@ v2rayCoreInstall(){
# xray-core 安装 # xray-core 安装
xrayCoreInstall(){ xrayCoreInstall(){
selectCustomInstallType=
cleanUp v2rayClean cleanUp v2rayClean
selectCustomInstallType=
totalProgress=17 totalProgress=17
installTools 2 installTools 2
@ -3319,7 +3335,7 @@ menu(){
cd cd
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者mack-a" echoContent green "作者mack-a"
echoContent green "当前版本v2.1.13" echoContent green "当前版本v2.1.14"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:七合一共存脚本" echoContent green "描述:七合一共存脚本"
echoContent red "==============================================================" echoContent red "=============================================================="