Skip to content

Commit

Permalink
fix: 修复 Egern 和 Stash 可根据 User-Agent 自动包含官方/商店版/未续费订阅不支持的协议
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jan 26, 2025
1 parent 6afec4f commit 14a3488
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
19 changes: 17 additions & 2 deletions backend/src/utils/user-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 14a3488

Please sign in to comment.