Skip to content

Commit cae5857

Browse files
committed
fix(脚本): 修复xhttp clashverge无法使用问题
1 parent 77a39bd commit cae5857

1 file changed

Lines changed: 37 additions & 24 deletions

File tree

install.sh

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,17 @@ readInstallType() {
393393
if [[ -d "/etc/v2ray-agent" ]]; then
394394
if [[ -f "/etc/v2ray-agent/xray/xray" ]]; then
395395
# 检测xray-core
396-
if [[ -d "/etc/v2ray-agent/xray/conf" ]] && [[ -f "/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json" || -f "/etc/v2ray-agent/xray/conf/02_trojan_TCP_inbounds.json" || -f "/etc/v2ray-agent/xray/conf/07_VLESS_vision_reality_inbounds.json" ]]; then
396+
if [[ -d "/etc/v2ray-agent/xray/conf" ]] && [[ -f "/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json" || -f "/etc/v2ray-agent/xray/conf/02_trojan_TCP_inbounds.json" || -f "/etc/v2ray-agent/xray/conf/07_VLESS_vision_reality_inbounds.json" || -f "/etc/v2ray-agent/xray/conf/12_VLESS_XHTTP_inbounds.json" ]]; then
397397
# xray-core
398398
configPath=/etc/v2ray-agent/xray/conf/
399399
ctlPath=/etc/v2ray-agent/xray/xray
400400
coreInstallType=1
401+
401402
if [[ -f "${configPath}07_VLESS_vision_reality_inbounds.json" ]]; then
402-
realityStatus=1
403+
realityStatus=7
404+
fi
405+
if [[ -f "${configPath}12_VLESS_XHTTP_inbounds.json" ]]; then
406+
realityStatus=12
403407
fi
404408
if [[ -f "/etc/v2ray-agent/sing-box/sing-box" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config/06_hysteria2_inbounds.json" || -f "/etc/v2ray-agent/sing-box/conf/config/09_tuic_inbounds.json" || -f "/etc/v2ray-agent/sing-box/conf/config/20_socks5_inbounds.json" ]]; then
405409
singBoxConfigPath=/etc/v2ray-agent/sing-box/conf/config/
@@ -680,16 +684,6 @@ check1Panel() {
680684
fi
681685
fi
682686
}
683-
# 读取当前alpn的顺序
684-
readInstallAlpn() {
685-
if [[ -n "${currentInstallProtocolType}" && -z "${realityStatus}" ]]; then
686-
local alpn
687-
alpn=$(jq -r .inbounds[0].streamSettings.tlsSettings.alpn[0] ${configPath}${frontingType}.json)
688-
if [[ -n ${alpn} ]]; then
689-
currentAlpn=${alpn}
690-
fi
691-
fi
692-
}
693687

694688
# 检查防火墙
695689
allowPort() {
@@ -878,6 +872,17 @@ readConfigHostPathUUID() {
878872
xrayVLESSRealityVisionPort="${currentDefaultPort}"
879873
fi
880874
fi
875+
# reality xhttp
876+
if echo ${currentInstallProtocolType} | grep -q ",12,"; then
877+
878+
currentClients=$(jq -r .inbounds[0].settings.clients ${configPath}12_VLESS_XHTTP_inbounds.json)
879+
currentUUID=$(jq -r .inbounds[0].settings.clients[0].id ${configPath}12_VLESS_XHTTP_inbounds.json)
880+
xrayVLESSRealityXHTTPort=$(jq -r .inbounds[0].port ${configPath}12_VLESS_XHTTP_inbounds.json)
881+
if [[ "${currentPort}" == "${xrayVLESSRealityXHTTPort}" ]]; then
882+
xrayVLESSRealityXHTTPort="${currentDefaultPort}"
883+
fi
884+
currentPath=$(jq -r .inbounds[0].streamSettings.xhttpSettings.path ${configPath}12_VLESS_XHTTP_inbounds.json | awk -F "[/]" '{print $2}' | awk -F "[x][H][T][T][P]" '{print $1}')
885+
fi
881886
elif [[ "${coreInstallType}" == "2" ]]; then
882887
if [[ -n "${frontingType}" ]]; then
883888
currentHost=$(jq -r .inbounds[0].tls.server_name ${configPath}${frontingType}.json)
@@ -936,7 +941,6 @@ readConfigHostPathUUID() {
936941
if [[ "${coreInstallType}" == "2" && -f "${singBoxConfigPath}11_VMess_HTTPUpgrade_inbounds.json" ]]; then
937942
singBoxVMessHTTPUpgradePath=$(jq -r .inbounds[0].transport.path "${singBoxConfigPath}11_VMess_HTTPUpgrade_inbounds.json")
938943
currentPath=$(jq -r .inbounds[0].transport.path "${singBoxConfigPath}11_VMess_HTTPUpgrade_inbounds.json" | awk -F "[/]" '{print $2}')
939-
# currentPath=${currentPath::-2}
940944
fi
941945
fi
942946
if [[ -f "/etc/v2ray-agent/cdn" ]] && [[ -n "$(head -1 /etc/v2ray-agent/cdn)" ]]; then
@@ -1203,7 +1207,7 @@ installTools() {
12031207
fi
12041208

12051209
# 检测nginx版本,并提供是否卸载的选项
1206-
if echo "${selectCustomInstallType}" | grep -qwE ",7,|,8,|,7,8,"; then
1210+
if echo "${selectCustomInstallType}" | grep -qwE ",7,|,8,|,7,8,|,12,|,7,12,"; then
12071211
echoContent green " ---> 检测到无需依赖Nginx的服务,跳过安装"
12081212
else
12091213
if ! nginx >/dev/null 2>&1; then
@@ -4886,10 +4890,13 @@ EOF
48864890
client-fingerprint: chrome
48874891
alpn:
48884892
- h2
4889-
servername: ${currentHost}
4893+
servername: ${xrayVLESSRealityXHTTPServerName}
48904894
xhttp-opts:
48914895
path: ${path}
4892-
host: ${currentHost}
4896+
host: ${xrayVLESSRealityXHTTPServerName}
4897+
reality-opts:
4898+
public-key: ${currentRealityXHTTPPublicKey}
4899+
short-id: 6ba85179e30d4fc2
48934900
EOF
48944901

48954902
echoContent yellow " ---> 二维码 VLESS(VLESS+reality+XHTTP)"
@@ -5472,6 +5479,9 @@ showAccounts() {
54725479
local count=
54735480
while read -r line; do
54745481
echoContent skyBlue "\n ---> 账号:${email}${count}"
5482+
if [[ -z "${line}" ]]; then
5483+
line=$(getPublicIP)
5484+
fi
54755485
if [[ -n "${line}" ]]; then
54765486
defaultBase64Code vlessXHTTP "${xrayVLESSRealityXHTTPort}" "${email}${count}" "$(echo "${user}" | jq -r .id//.uuid)" "${line}" "${path}"
54775487
count=$((count + 1))
@@ -6348,11 +6358,16 @@ EOF
63486358
EOF
63496359
fi
63506360

6351-
if [[ -n ${realityStatus} ]]; then
6361+
if [[ ${realityStatus} == "7" ]]; then
63526362
local vlessVisionRealityInbounds
63536363
vlessVisionRealityInbounds=$(jq -r ".inbounds[0].streamSettings.realitySettings.show=${realityLogShow}" ${configPath}07_VLESS_vision_reality_inbounds.json)
63546364
echo "${vlessVisionRealityInbounds}" | jq . >${configPath}07_VLESS_vision_reality_inbounds.json
63556365
fi
6366+
if [[ ${realityStatus} == "12" ]]; then
6367+
local vlessVisionRealityXHTTPInbounds
6368+
vlessVisionRealityXHTTPInbounds=$(jq -r ".inbounds[0].streamSettings.realitySettings.show=${realityLogShow}" ${configPath}12_VLESS_XHTTP_inbounds.json)
6369+
echo "${vlessVisionRealityXHTTPInbounds}" | jq . >${configPath}12_VLESS_XHTTP_inbounds.json
6370+
fi
63566371
reloadCore
63576372
checkLog 1
63586373
;;
@@ -8458,8 +8473,7 @@ customXrayInstall() {
84588473
echoContent red " ---> 多选请使用英文逗号分隔"
84598474
exit 0
84608475
fi
8461-
8462-
if [[ "${selectCustomInstallType}" == "7" ]]; then
8476+
if echo "${selectCustomInstallType}" | grep -qE '^(7|7,12|12)$'; then
84638477
selectCustomInstallType=",${selectCustomInstallType},"
84648478
else
84658479
if ! echo "${selectCustomInstallType}" | grep -q "0,"; then
@@ -8468,7 +8482,6 @@ customXrayInstall() {
84688482
selectCustomInstallType=",${selectCustomInstallType},"
84698483
fi
84708484
fi
8471-
84728485
if [[ "${selectCustomInstallType:0:1}" != "," ]]; then
84738486
selectCustomInstallType=",${selectCustomInstallType},"
84748487
fi
@@ -8487,7 +8500,7 @@ customXrayInstall() {
84878500
fi
84888501
else
84898502
# 申请tls
8490-
if [[ "${selectCustomInstallType}" != ",7," ]]; then
8503+
if ! echo "${selectCustomInstallType}" | grep -qE '^(,7,|,7,12,|,12,)$'; then
84918504
initTLSNginxConfig 2
84928505
handleXray stop
84938506
installTLS 3
@@ -8506,7 +8519,7 @@ customXrayInstall() {
85068519
else
85078520
nginxBlog 6
85088521
fi
8509-
if [[ "${selectCustomInstallType}" != ",7," ]]; then
8522+
if ! echo "${selectCustomInstallType}" | grep -qE '^(,7,|,7,12,|,12,)$'; then
85108523
updateRedirectNginxConf
85118524
handleNginx start
85128525
fi
@@ -8516,7 +8529,7 @@ customXrayInstall() {
85168529
installXrayService 8
85178530
initXrayConfig custom 9
85188531
cleanUp singBoxDel
8519-
if [[ "${selectCustomInstallType}" != ",7," ]]; then
8532+
if ! echo "${selectCustomInstallType}" | grep -qE '^(,7,|,7,12,|,12,)$'; then
85208533
installCronTLS 10
85218534
fi
85228535

@@ -9947,7 +9960,7 @@ menu() {
99479960
cd "$HOME" || exit
99489961
echoContent red "\n=============================================================="
99499962
echoContent green "作者:mack-a"
9950-
echoContent green "当前版本:v3.5.13"
9963+
echoContent green "当前版本:v3.5.14"
99519964
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
99529965
echoContent green "描述:八合一共存脚本\c"
99539966
showInstallStatus

0 commit comments

Comments
 (0)