fix: URL-encode share link params for v2rayNG SNI parsing

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-27 23:52:17 +08:00
parent 4b3f6a1de2
commit 40d10a846f
2 changed files with 24 additions and 4 deletions
+12 -2
View File
@@ -17,6 +17,16 @@ done
mkdir -p "$OUT_DIR"
urlencode() {
python3 -c "import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1], safe='').replace('.', '%2E'))" "$1"
}
REALITY_SNI_ENC="$(urlencode "$REALITY_SERVER_NAME")"
REALITY_PBK_ENC="$(urlencode "$REALITY_PUBLIC_KEY")"
REALITY_SID_ENC="$(urlencode "$REALITY_SHORT_ID")"
HY2_PASSWORD_ENC="$(urlencode "$HY2_PASSWORD")"
DOMAIN_SNI_ENC="$(urlencode "$DOMAIN")"
sed -e "s|\${VPS_IP}|${VPS_IP}|g" \
-e "s|\${DOMAIN}|${DOMAIN}|g" \
-e "s|\${UUID}|${UUID}|g" \
@@ -28,10 +38,10 @@ sed -e "s|\${VPS_IP}|${VPS_IP}|g" \
cat > "$OUT_DIR/share-links.txt" <<EOF
========== VLESS + Reality (主力) ==========
vless://${UUID}@${VPS_IP}:443?encryption=none&flow=xtls-rprx-vision&security=reality&sni=${REALITY_SERVER_NAME}&fp=chrome&pbk=${REALITY_PUBLIC_KEY}&sid=${REALITY_SHORT_ID}&spx=%2F&type=tcp#Reality-Main
vless://${UUID}@${VPS_IP}:443?encryption=none&flow=xtls-rprx-vision&security=reality&sni=${REALITY_SNI_ENC}&fp=chrome&pbk=${REALITY_PBK_ENC}&sid=${REALITY_SID_ENC}&spx=%2F&type=tcp#Reality-Main
========== Hysteria2 (备用) ==========
hy2://${HY2_PASSWORD}@${DOMAIN}:8443?sni=${DOMAIN}#Hysteria2-Backup
hy2://${HY2_PASSWORD_ENC}@${DOMAIN}:8443?sni=${DOMAIN_SNI_ENC}#Hysteria2-Backup
EOF
echo "已生成:"