fix(脚本): 修复重置uuid时不兼容个性化安装

pull/534/merge
mack-a 2020-10-14 14:08:56 +08:00
parent 7444481061
commit fa8fa3d640
1 changed files with 19 additions and 2 deletions

View File

@ -1844,7 +1844,7 @@ updateV2RayCDN(){
resetUUID(){
echoContent skyBlue "\n进度 $1/${totalProgress} : 重置UUID"
local resetStatus=false
if [[ -d "/etc/v2ray-agent" ]] && [[ -d "/etc/v2ray-agent/v2ray" ]] && [[ -f "/etc/v2ray-agent/v2ray/config.json" ]]
if [[ -d "/etc/v2ray-agent" ]] && [[ -d "/etc/v2ray-agent/v2ray" ]] && [[ -f "/etc/v2ray-agent/v2ray/config.json" ]] && [[ -z "${customInstallType}" ]]
then
cat /etc/v2ray-agent/v2ray/config.json|jq .inbounds|jq -c '.[].settings.clients'|jq -c '.[].id'|while read row
do
@ -1858,6 +1858,23 @@ resetUUID(){
handleV2Ray stop
handleV2Ray start
resetStatus=true
elif [[ -d "/etc/v2ray-agent" ]] && [[ -d "/etc/v2ray-agent/v2ray" ]] && [[ -d "/etc/v2ray-agent/v2ray/conf" ]] && [[ ! -z "${customInstallType}" ]]
then
ls /etc/v2ray-agent/v2ray/conf|grep inbounds|while read row
do
cat /etc/v2ray-agent/v2ray/conf/${row}|jq .inbounds|jq -c '.[].settings.clients'|jq -c '.[].id'|while read row2
do
oldUUID=`echo ${row2}|awk -F "[\"]" '{print $2}'`
newUUID=`/etc/v2ray-agent/v2ray/v2ctl uuid`
echoContent red "旧:${oldUUID}"
echoContent red "新UUID${newUUID}"
sed -i "s/${oldUUID}/${newUUID}/g" `grep "${oldUUID}" -rl /etc/v2ray-agent/v2ray/conf/${row}`
done
done
echoContent green " ---> V2Ray UUID重置完毕"
handleV2Ray stop
handleV2Ray start
resetStatus=true
else
echoContent red " ---> 未使用脚本安装V2Ray"
menu
@ -1978,7 +1995,7 @@ menu(){
cd
echoContent red "\n=============================================================="
echoContent green "作者mack-a"
echoContent green "当前版本v2.0.17"
echoContent green "当前版本v2.0.18"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:七合一共存脚本"
echoContent red "=============================================================="