From 317a804b3625a76a5dcaf370b00eb8f2854a1087 Mon Sep 17 00:00:00 2001 From: xream Date: Fri, 19 Jul 2024 14:33:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20URI=20=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- .../src/core/proxy-utils/producers/v2ray.js | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/backend/package.json b/backend/package.json index 6b8a4f997..f6836f533 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.352", + "version": "2.14.353", "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/v2ray.js b/backend/src/core/proxy-utils/producers/v2ray.js index be3370ae8..bdb3c68d5 100644 --- a/backend/src/core/proxy-utils/producers/v2ray.js +++ b/backend/src/core/proxy-utils/producers/v2ray.js @@ -1,12 +1,30 @@ /* eslint-disable no-case-declarations */ import { Base64 } from 'js-base64'; import URI_Producer from './uri'; +import $ from '@/core/app'; const URI = URI_Producer(); export default function V2Ray_Producer() { const type = 'ALL'; - const produce = (proxies) => - Base64.encode(proxies.map((proxy) => URI.produce(proxy)).join('\n')); + const produce = (proxies) => { + let result = []; + proxies.map((proxy) => { + try { + result.push(URI.produce(proxy)); + } catch (err) { + $.error( + `Cannot produce proxy: ${JSON.stringify( + proxy, + null, + 2, + )}\nReason: ${err}`, + ); + } + }); + + return Base64.encode(result.join('\n')); + }; + return { type, produce }; }