mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 00:52:40 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87597f6fc2 | ||
|
|
3462d36c35 | ||
|
|
02946ec81c | ||
|
|
c963c872ff |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.16.9",
|
||||
"version": "2.16.11",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
@@ -33,6 +33,7 @@
|
||||
"ms": "^2.1.3",
|
||||
"nanoid": "^3.3.3",
|
||||
"request": "^2.88.2",
|
||||
"semver": "^7.6.3",
|
||||
"static-js-yaml": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
13502
backend/pnpm-lock.yaml
generated
13502
backend/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ export default function Egern_Producer() {
|
||||
// https://egernapp.com/zh-CN/docs/configuration/proxies
|
||||
const list = proxies
|
||||
.filter((proxy) => {
|
||||
if (opts['include-unsupported-proxy']) return true;
|
||||
// if (opts['include-unsupported-proxy']) return true;
|
||||
if (
|
||||
![
|
||||
'http',
|
||||
@@ -47,6 +47,12 @@ export default function Egern_Producer() {
|
||||
'salsa20',
|
||||
'chacha20',
|
||||
'chacha20-ietf',
|
||||
...(opts['include-unsupported-proxy']
|
||||
? [
|
||||
'2022-blake3-aes-128-gcm',
|
||||
'2022-blake3-aes-256-gcm',
|
||||
]
|
||||
: []),
|
||||
].includes(proxy.cipher))) ||
|
||||
(proxy.type === 'vmess' &&
|
||||
(![
|
||||
|
||||
@@ -53,7 +53,7 @@ export default function Surge_Producer() {
|
||||
return { produce };
|
||||
}
|
||||
|
||||
function shadowsocks(proxy, includeUnsupportedProxy) {
|
||||
function shadowsocks(proxy) {
|
||||
const result = new Result(proxy);
|
||||
result.append(`${proxy.name}=${proxy.type},${proxy.server},${proxy.port}`);
|
||||
if (!proxy.cipher) {
|
||||
@@ -87,9 +87,8 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
|
||||
'chacha20',
|
||||
'chacha20-ietf',
|
||||
'none',
|
||||
...(includeUnsupportedProxy
|
||||
? ['2022-blake3-aes-128-gcm', '2022-blake3-aes-256-gcm']
|
||||
: []),
|
||||
'2022-blake3-aes-128-gcm',
|
||||
'2022-blake3-aes-256-gcm',
|
||||
].includes(proxy.cipher)
|
||||
) {
|
||||
throw new Error(`cipher ${proxy.cipher} is not supported`);
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { getPlatformFromHeaders } from '@/utils/user-agent';
|
||||
import {
|
||||
getPlatformFromHeaders,
|
||||
shouldIncludeUnsupportedProxy,
|
||||
} from '@/utils/user-agent';
|
||||
import { ProxyUtils } from '@/core/proxy-utils';
|
||||
import { COLLECTIONS_KEY, SUBS_KEY } from '@/constants';
|
||||
import { findByName } from '@/utils/database';
|
||||
@@ -161,7 +164,19 @@ async function downloadSubscription(req, res) {
|
||||
}
|
||||
if (includeUnsupportedProxy) {
|
||||
includeUnsupportedProxy = decodeURIComponent(includeUnsupportedProxy);
|
||||
$.info(`包含不支持的节点: ${includeUnsupportedProxy}`);
|
||||
$.info(
|
||||
`包含官方/商店版/未续费订阅不支持的协议: ${includeUnsupportedProxy}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
!includeUnsupportedProxy &&
|
||||
shouldIncludeUnsupportedProxy(platform, reqUA)
|
||||
) {
|
||||
includeUnsupportedProxy = true;
|
||||
$.info(
|
||||
`当前客户端可包含官方/商店版/未续费订阅不支持的协议: ${includeUnsupportedProxy}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (useMihomoExternal) {
|
||||
@@ -342,11 +357,9 @@ async function downloadCollection(req, res) {
|
||||
|
||||
const allCols = $.read(COLLECTIONS_KEY);
|
||||
const collection = findByName(allCols, name);
|
||||
|
||||
const reqUA = req.headers['user-agent'] || req.headers['User-Agent'];
|
||||
$.info(
|
||||
`正在下载组合订阅:${name}\n请求 User-Agent: ${
|
||||
req.headers['user-agent'] || req.headers['User-Agent']
|
||||
}\n请求 target: ${req.query.target}\n实际输出: ${platform}`,
|
||||
`正在下载组合订阅:${name}\n请求 User-Agent: ${reqUA}\n请求 target: ${req.query.target}\n实际输出: ${platform}`,
|
||||
);
|
||||
|
||||
let {
|
||||
@@ -393,7 +406,18 @@ async function downloadCollection(req, res) {
|
||||
|
||||
if (includeUnsupportedProxy) {
|
||||
includeUnsupportedProxy = decodeURIComponent(includeUnsupportedProxy);
|
||||
$.info(`包含不支持的节点: ${includeUnsupportedProxy}`);
|
||||
$.info(
|
||||
`包含官方/商店版/未续费订阅不支持的协议: ${includeUnsupportedProxy}`,
|
||||
);
|
||||
}
|
||||
if (
|
||||
!includeUnsupportedProxy &&
|
||||
shouldIncludeUnsupportedProxy(platform, reqUA)
|
||||
) {
|
||||
includeUnsupportedProxy = true;
|
||||
$.info(
|
||||
`当前客户端可包含官方/商店版/未续费订阅不支持的协议: ${includeUnsupportedProxy}`,
|
||||
);
|
||||
}
|
||||
if (useMihomoExternal) {
|
||||
$.info(`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`);
|
||||
|
||||
@@ -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