diff --git a/backend/package.json b/backend/package.json index 9aa478d..f3d809d 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.20.0", + "version": "2.20.1", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/parsers/index.js b/backend/src/core/proxy-utils/parsers/index.js index f2d37d2..2e83b0d 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -13,6 +13,7 @@ import getQXParser from './peggy/qx'; import getTrojanURIParser from './peggy/trojan-uri'; import $ from '@/core/app'; import JSON5 from 'json5'; +import YAML from '@/utils/yaml'; import { Base64 } from 'js-base64'; @@ -1130,15 +1131,21 @@ function URI_Trojan() { function Clash_All() { const name = 'Clash Parser'; const test = (line) => { + let proxy; try { - JSON5.parse(line); + proxy = JSON5.parse(line); } catch (e) { - return false; + proxy = YAML.parse(line); } - return true; + return !!proxy?.type; }; const parse = (line) => { - const proxy = JSON5.parse(line); + let proxy; + try { + proxy = JSON5.parse(line); + } catch (e) { + proxy = YAML.parse(line); + } if ( ![ 'anytls',