fix: 修复 WireGuard URI 编码问题

This commit is contained in:
xream committed 2026-03-26 20:30:27 +08:00
1 parent 3cd71f9cab
commit a1789ccb70
2 files changed
+13 -5

No files matched your search

+1 -1
View File
@@ -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": {
+12 -4
View File
@@ -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'],