From 28e52f37a2ae839de6ef280b28276f99ccd2a456 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Fri, 27 Nov 2020 16:21:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=84=9A=E6=9C=AC):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2CDN=E8=8A=82=E7=82=B9=E6=97=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index 29ae1a3..720fee4 100644 --- a/install.sh +++ b/install.sh @@ -255,11 +255,11 @@ cleanUp(){ elif [[ "$1" = "v2rayDel" ]] then - rm -rf `ls /etc/v2ray-agent/v2ray/*` + rm -rf /etc/v2ray-agent/v2ray/* elif [[ "$1" = "xrayDel" ]] then - rm -rf `ls /etc/v2ray-agent/xray/*` + rm -rf /etc/v2ray-agent/xray/* fi } @@ -2759,8 +2759,16 @@ updateV2RayCDN(){ echoContent skyBlue "\n进度 $1/${totalProgress} : 修改CDN节点" if [[ ! -z "${v2rayAgentInstallType}" ]] 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} ]] then echoContent red "==============================================================" @@ -2790,29 +2798,37 @@ updateV2RayCDN(){ add=`echo ${add}|awk -F '["]' '{print $4}'` if [[ ! -z ${add} ]] then - sed -i "s/${add}/${setDomain}/g" `grep "${add}" -rl ${configPath}` + sed -i "s/\"${add}\"/\"${setDomain}\"/g" `grep "${add}" -rl ${configPath}` 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 echoContent green " ---> V2Ray CDN修改成功" - handleV2Ray stop - handleV2Ray start + if [[ "${coreInstallType}" = "1" ]] + then + handleXray stop + handleXray start + elif [[ "${coreInstallType}" = "2" || "${coreInstallType}" = "3" ]] + then + handleV2Ray stop + handleV2Ray start + fi + else echoContent red " ---> 修改V2Ray CDN失败" fi # 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 - 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} ]] 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 - 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 echoContent green "\n ---> Trojan CDN修改成功" handleTrojanGo stop @@ -3279,8 +3295,8 @@ v2rayCoreInstall(){ # xray-core 安装 xrayCoreInstall(){ - selectCustomInstallType= cleanUp v2rayClean + selectCustomInstallType= totalProgress=17 installTools 2 @@ -3319,7 +3335,7 @@ menu(){ cd echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v2.1.13" + echoContent green "当前版本:v2.1.14" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:七合一共存脚本" echoContent red "=============================================================="