mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2026-04-02 04:13:19 +08:00
feat: Egern 和 Stash 可根据 User-Agent 自动包含官方/商店版/未续费订阅不支持的协议
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import gte from 'semver/functions/gte';
|
||||
import coerce from 'semver/functions/coerce';
|
||||
import $ from '@/core/app';
|
||||
|
||||
export function getUserAgentFromHeaders(headers) {
|
||||
const keys = Object.keys(headers);
|
||||
let UA = '';
|
||||
@@ -56,3 +60,17 @@ export function getPlatformFromHeaders(headers) {
|
||||
const { UA, ua, accept } = getUserAgentFromHeaders(headers);
|
||||
return getPlatformFromUserAgent({ ua, UA, accept });
|
||||
}
|
||||
export function shouldIncludeUnsupportedProxy(platform, ua) {
|
||||
try {
|
||||
const version = coerce(ua).version;
|
||||
if (platform === 'Stash' && gte(version, '2.8.0')) {
|
||||
return true;
|
||||
}
|
||||
if (platform === 'Egern' && gte(version, '1.29.0')) {
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
$.error(`获取版本号失败: ${e}`);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user