Skip to content

Commit d874f36

Browse files
committed
update install.sh
1 parent 51750be commit d874f36

1 file changed

Lines changed: 6 additions & 19 deletions

File tree

install.sh

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,6 @@ config2Fragment() {
278278
tls=$(echo "$vmess_config" | jq -r '.tls')
279279
sni=$(echo "$vmess_config" | jq -r '.sni')
280280
name=$(echo "$vmess_config" | jq -r '.ps')
281-
alpn=$(echo "$vmess_config" | jq -r '.alpn')
282-
283-
# Check if ALPN is not null or empty
284-
if [ "$alpn" != "null" ] && [ -n "$alpn" ]; then
285-
alpn=$(echo "$alpn" | jq -r 'split(",") | map("\"" + . + "\"") | join(",\n")')
286-
else
287-
alpn=""
288-
fi
289281

290282
# Check if TLS is provided in the VMess config
291283
if [ "$tls" == "tls" ]; then
@@ -367,7 +359,8 @@ config2Fragment() {
367359
"allowInsecure": false,
368360
"serverName": "$sni",
369361
"alpn": [
370-
$alpn
362+
"h2",
363+
"http/1.1"
371364
],
372365
"fingerprint": "$fp",
373366
"show": false
@@ -608,14 +601,7 @@ EOF
608601
conn_type=$(echo "$link" | sed -n 's|.*type=\([^&]*\).*|\1|p')
609602
sni=$(echo "$link" | sed -n 's|.*sni=\([^&]*\).*|\1|p' | sed 's|#.*||')
610603
name=$(echo "$link" | sed -n 's|.*#\([^#]*\)$|\1|p')
611-
alpn=$(echo "$link" | sed -n 's|.*alpn=\([^&]*\).*|\1|p' | sed 's|,|","|g')
612604

613-
if [ "$alpn" != "null" ] && [ -n "$alpn" ]; then
614-
alpn="\"$alpn\""
615-
else
616-
alpn=""
617-
fi
618-
619605
# VLESS TLS
620606
if [ "$security" == "tls" ]; then
621607
# Create the JSON config
@@ -696,7 +682,8 @@ EOF
696682
"allowInsecure": false,
697683
"serverName": "$sni",
698684
"alpn": [
699-
$alpn
685+
"h2",
686+
"http/1.1"
700687
],
701688
"fingerprint": "$fp",
702689
"show": false
@@ -938,7 +925,6 @@ EOF
938925
port=$(echo "$link" | sed -n 's|^trojan://[^@]*@[^:]*:\([^?]*\).*|\1|p')
939926
path=$(echo "$link" | sed -n 's|.*path=\([^&]*\).*|\1|p' | sed 's|%2F|/|g')
940927
security=$(echo "$link" | sed -n 's|.*security=\([^&]*\).*|\1|p')
941-
alpn=$(echo "$link" | grep -oP '(?<=alpn=)[^&]+' | tr ',' '\n' | sed 's/^/"/;s/$/"/' | tr '\n' ',' | sed 's/,$/\n/')
942928
host=$(echo "$link" | sed -n 's|.*host=\([^&]*\).*|\1|p')
943929
fp=$(echo "$link" | sed -n 's|.*fp=\([^&]*\).*|\1|p')
944930
conn_type=$(echo "$link" | sed -n 's|.*type=\([^&]*\).*|\1|p' | sed 's|#.*||')
@@ -1019,7 +1005,8 @@ EOF
10191005
"allowInsecure": false,
10201006
"serverName": "$sni",
10211007
"alpn": [
1022-
$alpn
1008+
"h2",
1009+
"http/1.1"
10231010
],
10241011
"fingerprint": "$fp",
10251012
"show": false

0 commit comments

Comments
 (0)