From 14a3488ce227afea21f2923c93b948a2d1a03808 Mon Sep 17 00:00:00 2001 From: xream Date: Sun, 26 Jan 2025 20:41:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Egern=20=E5=92=8C?= =?UTF-8?q?=20Stash=20=E5=8F=AF=E6=A0=B9=E6=8D=AE=20User-Agent=20=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=85=E5=90=AB=E5=AE=98=E6=96=B9/=E5=95=86?= =?UTF-8?q?=E5=BA=97=E7=89=88/=E6=9C=AA=E7=BB=AD=E8=B4=B9=E8=AE=A2?= =?UTF-8?q?=E9=98=85=E4=B8=8D=E6=94=AF=E6=8C=81=E7=9A=84=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/utils/user-agent.js | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/backend/package.json b/backend/package.json index 6571332..3419709 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.16.20", + "version": "2.16.21", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/utils/user-agent.js b/backend/src/utils/user-agent.js index 9674431..a1e10c5 100644 --- a/backend/src/utils/user-agent.js +++ b/backend/src/utils/user-agent.js @@ -62,11 +62,26 @@ export function getPlatformFromHeaders(headers) { } export function shouldIncludeUnsupportedProxy(platform, ua) { try { + const target = getPlatformFromUserAgent({ + UA: ua, + ua: ua.toLowerCase(), + }); + if (!['Stash', 'Egern'].includes(target)) { + return false; + } const version = coerce(ua).version; - if (platform === 'Stash' && gte(version, '2.8.0')) { + if ( + platform === 'Stash' && + target === 'Stash' && + gte(version, '2.8.0') + ) { return true; } - if (platform === 'Egern' && gte(version, '1.29.0')) { + if ( + platform === 'Egern' && + target === 'Egern' && + gte(version, '1.29.0') + ) { return true; } } catch (e) {