mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 00:52:40 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6804c6368a | ||
|
|
9c5d6e9a10 | ||
|
|
ef2d6be8eb | ||
|
|
04e12a4836 | ||
|
|
f94cf7185a | ||
|
|
fa7df51f8c | ||
|
|
18659d1cc8 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.19.41",
|
||||
"version": "2.19.48",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -50,6 +50,26 @@ function Base64Encoded() {
|
||||
return { name, test, parse };
|
||||
}
|
||||
|
||||
function fallbackBase64Encoded() {
|
||||
const name = 'Fallback Base64 Pre-processor';
|
||||
|
||||
const test = function (raw) {
|
||||
return true;
|
||||
};
|
||||
const parse = function (raw) {
|
||||
const decoded = Base64.decode(raw);
|
||||
if (!/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(decoded)) {
|
||||
$.error(
|
||||
`Fallback Base64 Pre-processor error: decoded line does not start with protocol`,
|
||||
);
|
||||
return raw;
|
||||
}
|
||||
|
||||
return decoded;
|
||||
};
|
||||
return { name, test, parse };
|
||||
}
|
||||
|
||||
function Clash() {
|
||||
const name = 'Clash Pre-processor';
|
||||
const test = function (raw) {
|
||||
@@ -163,4 +183,11 @@ function FullConfig() {
|
||||
return { name, test, parse };
|
||||
}
|
||||
|
||||
export default [HTML(), Clash(), Base64Encoded(), SSD(), FullConfig()];
|
||||
export default [
|
||||
HTML(),
|
||||
Clash(),
|
||||
Base64Encoded(),
|
||||
SSD(),
|
||||
FullConfig(),
|
||||
fallbackBase64Encoded(),
|
||||
];
|
||||
|
||||
@@ -405,6 +405,8 @@ function vless(proxy) {
|
||||
else append(`,obfs=ws`);
|
||||
} else if (proxy.network === 'http') {
|
||||
append(`,obfs=http`);
|
||||
} else if (['tcp'].includes(proxy.network)) {
|
||||
if (proxy.tls) append(`,obfs=over-tls`);
|
||||
} else if (!['tcp'].includes(proxy.network)) {
|
||||
throw new Error(`network ${proxy.network} is unsupported`);
|
||||
}
|
||||
|
||||
@@ -11,11 +11,6 @@ export default function Shadowrocket_Producer() {
|
||||
return false;
|
||||
} else if (['mieru', 'anytls'].includes(proxy.type)) {
|
||||
return false;
|
||||
} else if (proxy['underlying-proxy'] || proxy['dialer-proxy']) {
|
||||
$.error(
|
||||
`Shadowrocket 不支持前置代理字段. 已过滤节点 ${proxy.name}. 请使用 App 内的 "代理通过" 功能`,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
|
||||
@@ -33,7 +33,9 @@ export default function URI_Producer() {
|
||||
switch (proxy.type) {
|
||||
case 'socks5':
|
||||
result = `socks://${encodeURIComponent(
|
||||
Base64.encode(`${proxy.username}:${proxy.password}`),
|
||||
Base64.encode(
|
||||
`${proxy.username ?? ''}:${proxy.password ?? ''}`,
|
||||
),
|
||||
)}@${proxy.server}:${proxy.port}#${proxy.name}`;
|
||||
break;
|
||||
case 'ss':
|
||||
|
||||
@@ -49,11 +49,17 @@ export default function register($app) {
|
||||
success(res);
|
||||
});
|
||||
|
||||
// Redirect sub.store to vercel webpage
|
||||
$app.get('/', async (req, res) => {
|
||||
// 302 redirect
|
||||
res.set('location', 'https://sub-store.vercel.app/').status(302).end();
|
||||
});
|
||||
if (ENV().isNode) {
|
||||
$app.get('/', getEnv);
|
||||
} else {
|
||||
// Redirect sub.store to vercel webpage
|
||||
$app.get('/', async (req, res) => {
|
||||
// 302 redirect
|
||||
res.set('location', 'https://sub-store.vercel.app/')
|
||||
.status(302)
|
||||
.end();
|
||||
});
|
||||
}
|
||||
|
||||
// handle preflight request for QX
|
||||
if (ENV().isQX) {
|
||||
|
||||
@@ -174,7 +174,7 @@ async function produceArtifact({
|
||||
}
|
||||
}
|
||||
if (produceType === 'raw') {
|
||||
return (Array.isArray(raw) ? raw : [raw]).flat();
|
||||
return JSON.stringify((Array.isArray(raw) ? raw : [raw]).flat());
|
||||
}
|
||||
// parse proxies
|
||||
let proxies = (Array.isArray(raw) ? raw : [raw])
|
||||
@@ -574,7 +574,7 @@ async function produceArtifact({
|
||||
}
|
||||
}
|
||||
if (produceType === 'raw') {
|
||||
return (Array.isArray(raw) ? raw : [raw]).flat();
|
||||
return JSON.stringify((Array.isArray(raw) ? raw : [raw]).flat());
|
||||
}
|
||||
const files = (Array.isArray(raw) ? raw : [raw]).flat();
|
||||
let filesContent = files
|
||||
|
||||
6
backend/src/vendor/express.js
vendored
6
backend/src/vendor/express.js
vendored
@@ -17,10 +17,12 @@ export default function express({ substore: $, port, host }) {
|
||||
const express_ = eval(`require("express")`);
|
||||
const bodyParser = eval(`require("body-parser")`);
|
||||
const app = express_();
|
||||
const limit = eval('process.env.SUB_STORE_BODY_JSON_LIMIT') || '1mb';
|
||||
$.info(`[BACKEND] body JSON limit: ${limit}`);
|
||||
app.use(
|
||||
bodyParser.json({
|
||||
verify: rawBodySaver,
|
||||
limit: eval('process.env.SUB_STORE_BODY_JSON_LIMIT') || '1mb',
|
||||
limit,
|
||||
}),
|
||||
);
|
||||
app.use(
|
||||
@@ -36,7 +38,7 @@ export default function express({ substore: $, port, host }) {
|
||||
app.start = () => {
|
||||
const listener = app.listen(port, host, () => {
|
||||
const { address, port } = listener.address();
|
||||
$.info(`[BACKEND] ${address}:${port}`);
|
||||
$.info(`[BACKEND] listening on ${address}:${port}`);
|
||||
});
|
||||
};
|
||||
return app;
|
||||
|
||||
@@ -14,10 +14,12 @@ function operator(proxies = [], targetPlatform, context) {
|
||||
// 6. `_collectionName` 为组合订阅名, `_collectionDisplayName` 为组合订阅显示名
|
||||
// 7. `tls-fingerprint` 为 tls 指纹
|
||||
// 8. `underlying-proxy` 为前置代理, 不同平台会自动转换
|
||||
// 例如 $server['underlying-proxy'] = '名称'
|
||||
// 只给 mihomo 输出的话, `dialer-proxy` 也行
|
||||
// 只给 sing-box 输出的话, `detour` 也行
|
||||
// 只给 egern 输出的话, `prev_hop` 也行
|
||||
// 输出到 Clash/Stash/Shadowrocket 时, 会过滤掉配置了前置代理的节点, 并提示使用对应的功能.
|
||||
// 只给 Egern 输出的话, `prev_hop` 也行
|
||||
// 只给 Shadowrocket 输出的话, `chain` 也行
|
||||
// 输出到 Clash/Stash 时, 会过滤掉配置了前置代理的节点, 并提示使用对应的功能.
|
||||
// 9. `trojan`, `tuic`, `hysteria`, `hysteria2`, `juicity` 会在解析时设置 `tls`: true (会使用 tls 类协议的通用逻辑), 输出时删除
|
||||
// 10. `sni` 在某些协议里会自动与 `servername` 转换
|
||||
// 11. 读取节点的 ca-str 和 _ca (后端文件路径) 字段, 自动计算 fingerprint (参考 https://t.me/zhetengsha/1512)
|
||||
|
||||
Reference in New Issue
Block a user