feat(脚本): 修复安装方式2->1->7无法使用合并订阅问题以及无法添加用户问题

pull/1073/head^2
mack-a 2024-08-06 11:34:27 +08:00
parent a6fb0f1898
commit ee00c667a3
1 changed files with 30 additions and 9 deletions

View File

@ -2852,7 +2852,8 @@ handleSingBox() {
echoContent green " ---> sing-box启动成功" echoContent green " ---> sing-box启动成功"
else else
echoContent red "sing-box启动失败" echoContent red "sing-box启动失败"
echoContent red "请手动执行【/etc/v2ray-agent/sing-box/sing-box run -c /etc/v2ray-agent/sing-box/conf/config.json】查看错误日志" echoContent red "请手动执行【/etc/v2ray-agent/sing-box/sing-box merge config.json -C /etc/v2ray-agent/sing-box/conf/config/ -D /etc/v2ray-agent/sing-box/conf/】,查看错误日志"
echoContent red "如上面命令没有错误,请手动执行【/etc/v2ray-agent/sing-box/sing-box run -c /etc/v2ray-agent/sing-box/conf/config.json】查看错误日志"
exit 0 exit 0
fi fi
elif [[ "$1" == "stop" ]]; then elif [[ "$1" == "stop" ]]; then
@ -5886,8 +5887,15 @@ customUserEmail() {
else else
local checkEmail= local checkEmail=
if [[ "${coreInstallType}" == "1" ]]; then if [[ "${coreInstallType}" == "1" ]]; then
checkEmail=$(jq -r --arg currentEmail "$currentCustomEmail" ".inbounds[0].settings.clients[] | select(.name | index(\$currentEmail) != null) | .name" ${configPath}${frontingType}.json) local frontingTypeConfig="${frontingType}"
elif [[ "${coreInstallType}" == "2" ]]; then if [[ "${currentInstallProtocolType}" == ",7,8," ]]; then
frontingTypeConfig="07_VLESS_vision_reality_inbounds"
fi
checkEmail=$(jq -r --arg currentEmail "$currentCustomEmail" ".inbounds[0].settings.clients[] | select(.name | index(\$currentEmail) != null) | .name" ${configPath}${frontingTypeConfig}.json)
elif
[[ "${coreInstallType}" == "2" ]]
then
checkEmail=$(jq -r --arg currentEmail "$currentCustomEmail" ".inbounds[0].users[] | select(.name | index(\$currentEmail) != null) | .name" ${configPath}${frontingType}.json) checkEmail=$(jq -r --arg currentEmail "$currentCustomEmail" ".inbounds[0].users[] | select(.name | index(\$currentEmail) != null) | .name" ${configPath}${frontingType}.json)
fi fi
@ -5973,7 +5981,6 @@ addUser() {
clients=$(jq -r "${userConfig} = ${clients}" ${configPath}05_VMess_WS_inbounds.json) clients=$(jq -r "${userConfig} = ${clients}" ${configPath}05_VMess_WS_inbounds.json)
echo "${clients}" | jq . >${configPath}05_VMess_WS_inbounds.json echo "${clients}" | jq . >${configPath}05_VMess_WS_inbounds.json
fi fi
# trojan tcp # trojan tcp
if echo "${currentInstallProtocolType}" | grep -q ",4,"; then if echo "${currentInstallProtocolType}" | grep -q ",4,"; then
local clients= local clients=
@ -8419,7 +8426,11 @@ addOtherSubscribe() {
echoContent red " ---> 此订阅已添加" echoContent red " ---> 此订阅已添加"
exit 0 exit 0
fi fi
echo
read -r -p "是否是HTTP订阅[y/n]" httpSubscribeStatus
if [[ "${httpSubscribeStatus}" == "y" ]]; then
remoteSubscribeUrl="${remoteSubscribeUrl}:http"
fi
echo "${remoteSubscribeUrl}" >>/etc/v2ray-agent/subscribe_remote/remoteSubscribeUrl echo "${remoteSubscribeUrl}" >>/etc/v2ray-agent/subscribe_remote/remoteSubscribeUrl
subscribe subscribe
fi fi
@ -8943,14 +8954,24 @@ updateRemoteSubscribe() {
local emailMD5=$1 local emailMD5=$1
local email=$2 local email=$2
while read -r line; do while read -r line; do
local subscribeType=
subscribeType="https"
local serverAlias= local serverAlias=
serverAlias=$(echo "${line}" | awk -F "[:]" '{print $3}') serverAlias=$(echo "${line}" | awk -F "[:]" '{print $3}')
local remoteUrl= local remoteUrl=
remoteUrl=$(echo "${line}" | awk -F "[:]" '{print $1":"$2}') remoteUrl=$(echo "${line}" | awk -F "[:]" '{print $1":"$2}')
local subscribeTypeRemote=
subscribeTypeRemote=$(echo "${line}" | awk -F "[:]" '{print $4}')
if [[ -n "${subscribeTypeRemote}" ]]; then
subscribeType="${subscribeTypeRemote}"
fi
local clashMetaProxies= local clashMetaProxies=
clashMetaProxies=$(curl -s -4 "https://${remoteUrl}/s/clashMeta/${emailMD5}" | sed '/proxies:/d' | sed "s/\"${email}/\"${email}_${serverAlias}/g")
clashMetaProxies=$(curl -s -4 "${subscribeType}://${remoteUrl}/s/clashMeta/${emailMD5}" | sed '/proxies:/d' | sed "s/\"${email}/\"${email}_${serverAlias}/g")
if ! echo "${clashMetaProxies}" | grep -q "nginx" && [[ -n "${clashMetaProxies}" ]]; then if ! echo "${clashMetaProxies}" | grep -q "nginx" && [[ -n "${clashMetaProxies}" ]]; then
echo "${clashMetaProxies}" >>"/etc/v2ray-agent/subscribe/clashMeta/${emailMD5}" echo "${clashMetaProxies}" >>"/etc/v2ray-agent/subscribe/clashMeta/${emailMD5}"
@ -8960,7 +8981,7 @@ updateRemoteSubscribe() {
fi fi
local default= local default=
default=$(curl -s -4 "https://${remoteUrl}/s/default/${emailMD5}") default=$(curl -s -4 "${subscribeType}://${remoteUrl}/s/default/${emailMD5}")
if ! echo "${default}" | grep -q "nginx" && [[ -n "${default}" ]]; then if ! echo "${default}" | grep -q "nginx" && [[ -n "${default}" ]]; then
default=$(echo "${default}" | base64 -d | sed "s/#${email}/#${email}_${serverAlias}/g") default=$(echo "${default}" | base64 -d | sed "s/#${email}/#${email}_${serverAlias}/g")
@ -8972,7 +8993,7 @@ updateRemoteSubscribe() {
fi fi
local singBoxSubscribe= local singBoxSubscribe=
singBoxSubscribe=$(curl -s -4 "https://${remoteUrl}/s/sing-box_profiles/${emailMD5}") singBoxSubscribe=$(curl -s -4 "${subscribeType}://${remoteUrl}/s/sing-box_profiles/${emailMD5}")
if ! echo "${singBoxSubscribe}" | grep -q "nginx" && [[ -n "${singBoxSubscribe}" ]]; then if ! echo "${singBoxSubscribe}" | grep -q "nginx" && [[ -n "${singBoxSubscribe}" ]]; then
singBoxSubscribe=${singBoxSubscribe//tag\": \"${email}/tag\": \"${email}_${serverAlias}} singBoxSubscribe=${singBoxSubscribe//tag\": \"${email}/tag\": \"${email}_${serverAlias}}
@ -9448,7 +9469,7 @@ menu() {
cd "$HOME" || exit cd "$HOME" || exit
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者mack-a" echoContent green "作者mack-a"
echoContent green "当前版本v3.3.12" echoContent green "当前版本v3.3.13"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c" echoContent green "描述:八合一共存脚本\c"
showInstallStatus showInstallStatus