Skip to content

Commit 27631e6

Browse files
committed
fix(脚本): 修复sing-box添加用户、删除用户导致的报错问题
1 parent 2ae6724 commit 27631e6

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

install.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6026,7 +6026,7 @@ addUser() {
60266026
realityUserConfig=".inbounds[1].settings.clients"
60276027
elif [[ "${coreInstallType}" == "2" ]]; then
60286028
clients=$(initSingBoxClients 7 "${uuid}" "${email}")
6029-
realityUserConfig=".inbounds[0].settings.clients"
6029+
realityUserConfig=".inbounds[0].users"
60306030
fi
60316031
clients=$(jq -r "${realityUserConfig} = ${clients}" ${configPath}07_VLESS_vision_reality_inbounds.json)
60326032
echo "${clients}" | jq . >${configPath}07_VLESS_vision_reality_inbounds.json
@@ -6139,13 +6139,13 @@ removeUser() {
61396139
fi
61406140
if echo ${currentInstallProtocolType} | grep -q ",1,"; then
61416141
local vlessWSResult
6142-
vlessWSResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])' ${configPath}03_VLESS_WS_inbounds.json)
6142+
vlessWSResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])//.inbounds[0].users['${delUserIndex}'])' ${configPath}03_VLESS_WS_inbounds.json)
61436143
echo "${vlessWSResult}" | jq . >${configPath}03_VLESS_WS_inbounds.json
61446144
fi
61456145

61466146
if echo ${currentInstallProtocolType} | grep -q ",2,"; then
61476147
local trojangRPCUsers
6148-
trojangRPCUsers=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])' ${configPath}04_trojan_gRPC_inbounds.json)
6148+
trojangRPCUsers=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])//.inbounds[0].users['${delUserIndex}'])' ${configPath}04_trojan_gRPC_inbounds.json)
61496149
echo "${trojangRPCUsers}" | jq . >${configPath}04_trojan_gRPC_inbounds.json
61506150
fi
61516151

@@ -6169,7 +6169,7 @@ removeUser() {
61696169

61706170
if echo ${currentInstallProtocolType} | grep -q ",7,"; then
61716171
local vlessRealityResult
6172-
vlessRealityResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}']//.inbounds[1].settings.clients['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' ${configPath}07_VLESS_vision_reality_inbounds.json)
6172+
vlessRealityResult=$(jq -r 'del(.inbounds[1].settings.clients['${delUserIndex}']//.inbounds[0].users['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' ${configPath}07_VLESS_vision_reality_inbounds.json)
61736173
echo "${vlessRealityResult}" | jq . >${configPath}07_VLESS_vision_reality_inbounds.json
61746174
fi
61756175
if echo ${currentInstallProtocolType} | grep -q ",8,"; then
@@ -9191,7 +9191,13 @@ checkRealityDest() {
91919191

91929192
# 初始化客户端可用的ServersName
91939193
initRealityClientServersName() {
9194-
local realityDestDomainList="gateway.icloud.com,itunes.apple.com,swdist.apple.com,swcdn.apple.com,updates.cdn-apple.com,mensura.cdn-apple.com,osxapps.itunes.apple.com,aod.itunes.apple.com,download-installer.cdn.mozilla.net,addons.mozilla.org,s0.awsstatic.com,d1.awsstatic.com,cdn-dynmedia-1.microsoft.com,images-na.ssl-images-amazon.com,m.media-amazon.com,player.live-video.net,one-piece.com,lol.secure.dyn.riotcdn.net,www.lovelive-anime.jp,academy.nvidia.com,software.download.prss.microsoft.com,dl.google.com,www.google-analytics.com,www.caltech.edu,www.calstatela.edu,www.suny.edu,www.suffolk.edu,www.python.org,vuejs-jp.org,vuejs.org,zh-hk.vuejs.org,react.dev,www.java.com,www.oracle.com,www.mysql.com,www.mongodb.com,redis.io,cname.vercel-dns.com,vercel-dns.com,www.swift.com,academy.nvidia.com,www.swift.com,www.cisco.com,www.asus.com,www.samsung.com,www.amd.com,www.umcg.nl,www.fom-international.com,www.u-can.co.jp,github.io"
9194+
local realityDestDomainList=
9195+
if [[ "${coreInstallType}" == "1" ]]; then
9196+
realityDestDomainList="gateway.icloud.com,itunes.apple.com,swdist.apple.com,swcdn.apple.com,updates.cdn-apple.com,mensura.cdn-apple.com,osxapps.itunes.apple.com,aod.itunes.apple.com,download-installer.cdn.mozilla.net,addons.mozilla.org,s0.awsstatic.com,d1.awsstatic.com,cdn-dynmedia-1.microsoft.com,images-na.ssl-images-amazon.com,m.media-amazon.com,player.live-video.net,one-piece.com,lol.secure.dyn.riotcdn.net,www.lovelive-anime.jp,academy.nvidia.com,software.download.prss.microsoft.com,dl.google.com,www.google-analytics.com,www.caltech.edu,www.calstatela.edu,www.suny.edu,www.suffolk.edu,www.python.org,vuejs-jp.org,vuejs.org,zh-hk.vuejs.org,react.dev,www.java.com,www.oracle.com,www.mysql.com,www.mongodb.com,redis.io,cname.vercel-dns.com,vercel-dns.com,www.swift.com,academy.nvidia.com,www.swift.com,www.cisco.com,www.asus.com,www.samsung.com,www.amd.com,www.umcg.nl,www.fom-international.com,www.u-can.co.jp,github.io"
9197+
elif [[ "${coreInstallType}" == "2" ]]; then
9198+
realityDestDomainList="gateway.icloud.com,itunes.apple.com,swdist.apple.com,swcdn.apple.com,updates.cdn-apple.com,mensura.cdn-apple.com,osxapps.itunes.apple.com,aod.itunes.apple.com,download-installer.cdn.mozilla.net,addons.mozilla.org,s0.awsstatic.com,d1.awsstatic.com,cdn-dynmedia-1.microsoft.com,images-na.ssl-images-amazon.com,m.media-amazon.com,player.live-video.net,one-piece.com,lol.secure.dyn.riotcdn.net,www.lovelive-anime.jp,academy.nvidia.com,software.download.prss.microsoft.com,dl.google.com,www.google-analytics.com,www.python.org,vuejs-jp.org,vuejs.org,zh-hk.vuejs.org,react.dev,www.java.com,www.oracle.com,www.mysql.com,www.mongodb.com,cname.vercel-dns.com,vercel-dns.com,www.swift.com,academy.nvidia.com,www.swift.com,www.cisco.com,www.asus.com,www.samsung.com,www.amd.com,www.fom-international.com,github.io"
9199+
fi
9200+
91959201
if [[ -n "${realityServerName}" && -z "${lastInstallationConfig}" ]]; then
91969202
if echo ${realityDestDomainList} | grep -q "${realityServerName}"; then
91979203
read -r -p "读取到上次安装设置的Reality域名,是否使用?[y/n]:" realityServerNameStatus
@@ -9531,7 +9537,7 @@ menu() {
95319537
cd "$HOME" || exit
95329538
echoContent red "\n=============================================================="
95339539
echoContent green "作者:mack-a"
9534-
echoContent green "当前版本:v3.5.3"
9540+
echoContent green "当前版本:v3.5.4"
95359541
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
95369542
echoContent green "描述:八合一共存脚本\c"
95379543
showInstallStatus

0 commit comments

Comments
 (0)