Compare commits

...

4 Commits

Author SHA1 Message Date
xream
25a232190d feat: Loon 排除 XTLS; 切换使用 esbuild 打包 2025-01-13 16:02:45 +08:00
xream
87597f6fc2 ci: pnpm
Some checks are pending
build / build (push) Waiting to run
2025-01-13 14:44:34 +08:00
xream
3462d36c35 feat: Egern 和 Stash 可根据 User-Agent 自动包含官方/商店版/未续费订阅不支持的协议 2025-01-13 14:27:08 +08:00
xream
02946ec81c feat: Surge 默认开启 Shadowsocks 2022 2025-01-13 14:00:38 +08:00
9 changed files with 6382 additions and 7210 deletions

View File

@@ -27,18 +27,18 @@ jobs:
run: |
npm install -g pnpm
cd backend && pnpm i --no-frozen-lockfile
- name: Test
run: |
cd backend
pnpm test
- name: Build
run: |
cd backend
pnpm run build
# - name: Test
# run: |
# cd backend
# pnpm test
# - name: Build
# run: |
# cd backend
# pnpm run build
- name: Bundle
run: |
cd backend
pnpm run bundle
pnpm bundle:esbuild
- id: tag
name: Generate release tag
run: |

View File

View File

@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.16.10",
"version": "2.16.12",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {
@@ -12,6 +12,7 @@
"dev:run": "nodemon -w sub-store.min.js sub-store.min.js",
"build": "gulp",
"bundle": "node bundle.js",
"bundle:esbuild": "node bundle-esbuild.js",
"changelog": "conventional-changelog -p cli -i CHANGELOG.md -s"
},
"author": "Peng-YM",
@@ -33,6 +34,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

File diff suppressed because it is too large Load Diff

View File

@@ -120,7 +120,6 @@ socks5_tls = tag equals "socks5-tls" address (username password)? (usernamek pas
direct = tag equals "direct" (udp_relay/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/block_quic/others)* {
proxy.type = "direct";
}
address = comma server:server comma port:port {
proxy.server = server;
proxy.port = port;

View File

@@ -350,8 +350,8 @@ function vmess(proxy) {
}
function vless(proxy) {
if (proxy['reality-opts']) {
throw new Error(`VLESS REALITY is unsupported`);
if (typeof proxy.flow !== 'undefined' || proxy['reality-opts']) {
throw new Error(`VLESS XTLS/REALITY is not supported`);
}
const result = new Result(proxy);
result.append(

View File

@@ -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`);

View File

@@ -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`);

View File

@@ -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;
}