diff --git a/backend/package.json b/backend/package.json index cf86473..b425b74 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.114", + "version": "2.14.115", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/index.js b/backend/src/core/proxy-utils/index.js index af549e5..af93c12 100644 --- a/backend/src/core/proxy-utils/index.js +++ b/backend/src/core/proxy-utils/index.js @@ -214,6 +214,12 @@ function safeMatch(parser, line) { } function lastParse(proxy) { + if (proxy.server) { + proxy.server = proxy.server + .trim() + .replace(/^\[/, '') + .replace(/\]$/, ''); + } if (proxy.type === 'trojan') { if (proxy.network === 'tcp') { delete proxy.network; diff --git a/backend/src/core/proxy-utils/producers/uri.js b/backend/src/core/proxy-utils/producers/uri.js index b996362..a806302 100644 --- a/backend/src/core/proxy-utils/producers/uri.js +++ b/backend/src/core/proxy-utils/producers/uri.js @@ -1,10 +1,14 @@ /* eslint-disable no-case-declarations */ import { Base64 } from 'js-base64'; +import { isIPv6 } from '@/utils'; export default function URI_Producer() { const type = 'SINGLE'; const produce = (proxy) => { let result = ''; + if (proxy.server && isIPv6(proxy.server)) { + proxy.server = `[${proxy.server}]`; + } switch (proxy.type) { case 'ss': const userinfo = `${proxy.cipher}:${proxy.password}`; @@ -246,7 +250,9 @@ export default function URI_Producer() { } if (proxy['tls-fingerprint']) { hysteria2params.push( - `pinSHA256=${encodeURIComponent(proxy['tls-fingerprint'])}`, + `pinSHA256=${encodeURIComponent( + proxy['tls-fingerprint'], + )}`, ); } if (proxy.tfo) {