From a1789ccb70e11105dc5db8e457dd63cb33012760 Mon Sep 17 00:00:00 2001 From: xream Date: Thu, 26 Mar 2026 20:30:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20WireGuard=20URI=20?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/core/proxy-utils/producers/uri.js | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/backend/package.json b/backend/package.json index 11c0ff26..791b149f 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.21.57", + "version": "2.21.58", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/producers/uri.js b/backend/src/core/proxy-utils/producers/uri.js index 52fe4c5d..637eebc9 100644 --- a/backend/src/core/proxy-utils/producers/uri.js +++ b/backend/src/core/proxy-utils/producers/uri.js @@ -807,7 +807,9 @@ export default function URI_Producer() { ].includes(key) ) { if (['public-key'].includes(key)) { - wireguardParams.push(`publickey=${proxy[key]}`); + wireguardParams.push( + `publickey=${encodeURIComponent(proxy[key])}`, + ); } else if (['udp'].includes(key)) { if (proxy[key]) { wireguardParams.push(`${key}=1`); @@ -821,12 +823,18 @@ export default function URI_Producer() { }); if (proxy.ip && proxy.ipv6) { wireguardParams.push( - `address=${proxy.ip}/32,${proxy.ipv6}/128`, + `address=${encodeURIComponent( + `${proxy.ip}/32,${proxy.ipv6}/128`, + )}`, ); } else if (proxy.ip) { - wireguardParams.push(`address=${proxy.ip}/32`); + wireguardParams.push( + `address=${encodeURIComponent(`${proxy.ip}/32`)}`, + ); } else if (proxy.ipv6) { - wireguardParams.push(`address=${proxy.ipv6}/128`); + wireguardParams.push( + `address=${encodeURIComponent(`${proxy.ipv6}/128`)}`, + ); } result = `wireguard://${encodeURIComponent( proxy['private-key'],