feat(脚本): sing-box允许添加订阅、修复添加账户失败问题

pull/909/head^2
mack-a 2023-12-27 17:45:13 +08:00
parent fff1e83b03
commit 6f293fb161
1 changed files with 16 additions and 25 deletions

View File

@ -5006,14 +5006,15 @@ customUUID() {
echoContent yellow "uuid${currentCustomUUID}\n" echoContent yellow "uuid${currentCustomUUID}\n"
else else
jq -r -c '.inbounds[0].settings.clients[].id' ${configPath}${frontingType}.json | while read -r line; do local checkUUID=
if [[ "${line}" == "${currentCustomUUID}" ]]; then if [[ "${coreInstallType}" == "1" ]]; then
echo >/tmp/v2ray-agent checkUUID=$(jq -r --arg currentUUID "$currentCustomUUID" ".inbounds[0].settings.clients[] | select(.uuid | index(\$currentUUID) != null) | .name" ${configPath}${frontingType}.json)
elif [[ "${coreInstallType}" == "2" ]]; then
checkUUID=$(jq -r --arg currentUUID "$currentCustomUUID" ".inbounds[0].users[] | select(.uuid | index(\$currentUUID) != null) | .name" ${configPath}${frontingType}.json)
fi fi
done
if [[ -f "/tmp/v2ray-agent" && -n $(cat /tmp/v2ray-agent) ]]; then if [[ -n "${checkUUID}" ]]; then
echoContent red " ---> UUID不可重复" echoContent red " ---> UUID不可重复"
rm /tmp/v2ray-agent
exit 0 exit 0
fi fi
fi fi
@ -5027,24 +5028,18 @@ customUserEmail() {
currentCustomEmail="${currentCustomUUID}" currentCustomEmail="${currentCustomUUID}"
echoContent yellow "email: ${currentCustomEmail}\n" echoContent yellow "email: ${currentCustomEmail}\n"
else else
local defaultConfig=${frontingType} local checkEmail=
if [[ "${coreInstallType}" == "1" ]]; then
if echo "${currentInstallProtocolType}" | grep -q "7" && [[ -z "${frontingType}" ]]; then checkEmail=$(jq -r --arg currentEmail "$currentCustomEmail" ".inbounds[0].settings.clients[] | select(.name | index(\$currentEmail) != null) | .name" ${configPath}${frontingType}.json)
defaultConfig="07_VLESS_vision_reality_inbounds" elif [[ "${coreInstallType}" == "2" ]]; then
checkEmail=$(jq -r --arg currentEmail "$currentCustomEmail" ".inbounds[0].users[] | select(.name | index(\$currentEmail) != null) | .name" ${configPath}${frontingType}.json)
fi fi
jq -r -c '.inbounds[0].settings.clients[].email' ${configPath}${defaultConfig}.json | while read -r line; do if [[ -n "${checkEmail}" ]]; then
if [[ "${line}" == "${currentCustomEmail}" ]]; then
echo >/tmp/v2ray-agent
fi
done
if [[ -f "/tmp/v2ray-agent" && -n $(cat /tmp/v2ray-agent) ]]; then
echoContent red " ---> email不可重复" echoContent red " ---> email不可重复"
rm /tmp/v2ray-agent
exit 0 exit 0
fi fi
fi fi
# fi
} }
# 添加用户 # 添加用户
@ -5177,7 +5172,7 @@ addUser() {
if [[ "${coreInstallType}" == "1" ]]; then if [[ "${coreInstallType}" == "1" ]]; then
clients=$(initXrayClients 6 "${uuid}" "${email}") clients=$(initXrayClients 6 "${uuid}" "${email}")
elif [[ "${coreInstallType}" == "2" ]]; then elif [[ -n "${singBoxConfigPath}" ]]; then
clients=$(initSingBoxClients 6 "${uuid}" "${email}") clients=$(initSingBoxClients 6 "${uuid}" "${email}")
fi fi
@ -7162,10 +7157,6 @@ manageAccount() {
elif [[ "${manageAccountStatus}" == "2" ]]; then elif [[ "${manageAccountStatus}" == "2" ]]; then
subscribe subscribe
elif [[ "${manageAccountStatus}" == "3" ]]; then elif [[ "${manageAccountStatus}" == "3" ]]; then
if [[ "${coreInstallType}" == "2" ]]; then
echoContent red "\n ---> 此功能仅支持Xray-core内核请等待后续更新"
exit 0
fi
addSubscribeMenu 1 addSubscribeMenu 1
elif [[ "${manageAccountStatus}" == "4" ]]; then elif [[ "${manageAccountStatus}" == "4" ]]; then
addUser addUser
@ -8290,7 +8281,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.1.18" echoContent green "当前版本v3.1.19"
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