From 4ae549a5bb29fea3b9e544a6c02371514efd63b0 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:13:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=84=9A=E6=9C=AC):=20=E4=BF=AE=E5=A4=8Dsi?= =?UTF-8?q?ng-box=20naive=E6=97=A0=E6=B3=95=E5=88=A0=E9=99=A4=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=97=AE=E9=A2=98=E3=80=81=E4=BF=AE=E5=A4=8Dsing-box?= =?UTF-8?q?=E5=8D=B8=E8=BD=BDdns=E5=88=86=E6=B5=81=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index 49d27bf..997636f 100644 --- a/install.sh +++ b/install.sh @@ -4424,6 +4424,7 @@ EOF removeSingBoxConfig cn_block_route removeSingBoxConfig 01_direct_outbound removeSingBoxConfig block_domain_outbound + removeSingBoxConfig dns } # 初始化 sing-box订阅配置 initSubscribeLocalConfig() { @@ -5590,7 +5591,7 @@ removeUser() { if [[ "${coreInstallType}" == "1" ]]; then jq -r -c .inbounds[0].settings.clients[].email ${configPath}${userConfigType}.json | awk '{print NR""":"$0}' elif [[ "${coreInstallType}" == "2" ]]; then - jq -r -c .inbounds[0].users[].name ${configPath}${userConfigType}.json | awk '{print NR""":"$0}' + jq -r -c .inbounds[0].users[].name//.inbounds[0].users[].username ${configPath}${userConfigType}.json | awk '{print NR""":"$0}' fi read -r -p "请选择要删除的用户编号[仅支持单个删除]:" delUserIndex @@ -5622,19 +5623,19 @@ removeUser() { if echo ${currentInstallProtocolType} | grep -q ",3,"; then local vmessWSResult - vmessWSResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])' ${configPath}05_VMess_WS_inbounds.json) + vmessWSResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' ${configPath}05_VMess_WS_inbounds.json) echo "${vmessWSResult}" | jq . >${configPath}05_VMess_WS_inbounds.json fi if echo ${currentInstallProtocolType} | grep -q ",5,"; then local vlessGRPCResult - vlessGRPCResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])' ${configPath}06_VLESS_gRPC_inbounds.json) + vlessGRPCResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' ${configPath}06_VLESS_gRPC_inbounds.json) echo "${vlessGRPCResult}" | jq . >${configPath}06_VLESS_gRPC_inbounds.json fi if echo ${currentInstallProtocolType} | grep -q ",4,"; then local trojanTCPResult - trojanTCPResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])' ${configPath}04_trojan_TCP_inbounds.json) + trojanTCPResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' ${configPath}04_trojan_TCP_inbounds.json) echo "${trojanTCPResult}" | jq . >${configPath}04_trojan_TCP_inbounds.json fi @@ -5651,14 +5652,19 @@ removeUser() { if echo ${currentInstallProtocolType} | grep -q ",6,"; then local hysteriaResult - hysteriaResult=$(jq -r 'del(.inbounds[0].users['${delUserIndex}'])' "${singBoxConfigPath}06_hysteria2_inbounds.json") + hysteriaResult=$(jq -r 'del(.inbounds[0].users['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' "${singBoxConfigPath}06_hysteria2_inbounds.json") echo "${hysteriaResult}" | jq . >"${singBoxConfigPath}06_hysteria2_inbounds.json" fi if echo ${currentInstallProtocolType} | grep -q ",9,"; then local tuicResult - tuicResult=$(jq -r 'del(.inbounds[0].users['${delUserIndex}'])' "${singBoxConfigPath}09_tuic_inbounds.json") + tuicResult=$(jq -r 'del(.inbounds[0].users['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' "${singBoxConfigPath}09_tuic_inbounds.json") echo "${tuicResult}" | jq . >"${singBoxConfigPath}09_tuic_inbounds.json" fi + if echo ${currentInstallProtocolType} | grep -q ",10,"; then + local naiveResult + naiveResult=$(jq -r 'del(.inbounds[0].users['${delUserIndex}']//.inbounds[0].users['${delUserIndex}'])' "${singBoxConfigPath}10_naive_inbounds.json") + echo "${naiveResult}" | jq . >"${singBoxConfigPath}10_naive_inbounds.json" + fi reloadCore fi manageAccount 1 @@ -7265,7 +7271,8 @@ setUnlockDNS() { # 移除 DNS分流 removeUnlockDNS() { - cat <${configPath}11_dns.json + if [[ "${coreInstallType}" == "1" && -f "${configPath}11_dns.json" ]]; then + cat <${configPath}11_dns.json { "dns": { "servers": [ @@ -7274,6 +7281,22 @@ removeUnlockDNS() { } } EOF + fi + + if [[ "${coreInstallType}" == "2" && -f "${singBoxConfigPath}dns.json" ]]; then + cat <${singBoxConfigPath}dns.json +{ + "dns": { + "servers":[ + { + "address":"local" + } + ] + } +} +EOF + fi + reloadCore echoContent green " ---> 卸载成功" @@ -8801,7 +8824,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v3.2.37" + echoContent green "当前版本:v3.2.38" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:八合一共存脚本\c" showInstallStatus