fix: 修复 Egern 和 Stash 可根据 User-Agent 自动包含官方/商店版/未续费订阅不支持的协议

This commit is contained in:
xream 2025-01-26 20:41:57 +08:00
parent 6afec4f668
commit 14a3488ce2
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
2 changed files with 18 additions and 3 deletions

View File

@ -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": {

View File

@ -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) {