mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 07:19:01 +08:00
feat: 组合订阅支持设置代理/策略, 链接支持传入 proxy
参数指定代理/策略
This commit is contained in:
parent
6d43961e96
commit
8ffb060cb4
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.389",
|
"version": "2.14.390",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -69,6 +69,7 @@ async function downloadSubscription(req, res) {
|
|||||||
produceType,
|
produceType,
|
||||||
includeUnsupportedProxy,
|
includeUnsupportedProxy,
|
||||||
resultFormat,
|
resultFormat,
|
||||||
|
proxy,
|
||||||
} = req.query;
|
} = req.query;
|
||||||
let $options = {};
|
let $options = {};
|
||||||
if (req.query.$options) {
|
if (req.query.$options) {
|
||||||
@ -92,6 +93,10 @@ async function downloadSubscription(req, res) {
|
|||||||
url = decodeURIComponent(url);
|
url = decodeURIComponent(url);
|
||||||
$.info(`指定远程订阅 URL: ${url}`);
|
$.info(`指定远程订阅 URL: ${url}`);
|
||||||
}
|
}
|
||||||
|
if (proxy) {
|
||||||
|
proxy = decodeURIComponent(proxy);
|
||||||
|
$.info(`指定远程订阅使用代理/策略 proxy: ${proxy}`);
|
||||||
|
}
|
||||||
if (ua) {
|
if (ua) {
|
||||||
ua = decodeURIComponent(ua);
|
ua = decodeURIComponent(ua);
|
||||||
$.info(`指定远程订阅 User-Agent: ${ua}`);
|
$.info(`指定远程订阅 User-Agent: ${ua}`);
|
||||||
@ -135,6 +140,7 @@ async function downloadSubscription(req, res) {
|
|||||||
'include-unsupported-proxy': includeUnsupportedProxy,
|
'include-unsupported-proxy': includeUnsupportedProxy,
|
||||||
},
|
},
|
||||||
$options,
|
$options,
|
||||||
|
proxy,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -264,6 +270,7 @@ async function downloadCollection(req, res) {
|
|||||||
produceType,
|
produceType,
|
||||||
includeUnsupportedProxy,
|
includeUnsupportedProxy,
|
||||||
resultFormat,
|
resultFormat,
|
||||||
|
proxy,
|
||||||
} = req.query;
|
} = req.query;
|
||||||
|
|
||||||
let $options = {};
|
let $options = {};
|
||||||
@ -285,6 +292,11 @@ async function downloadCollection(req, res) {
|
|||||||
$.info(`传入 $options: ${JSON.stringify($options)}`);
|
$.info(`传入 $options: ${JSON.stringify($options)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (proxy) {
|
||||||
|
proxy = decodeURIComponent(proxy);
|
||||||
|
$.info(`指定远程订阅使用代理/策略 proxy: ${proxy}`);
|
||||||
|
}
|
||||||
|
|
||||||
if (ignoreFailedRemoteSub != null && ignoreFailedRemoteSub !== '') {
|
if (ignoreFailedRemoteSub != null && ignoreFailedRemoteSub !== '') {
|
||||||
ignoreFailedRemoteSub = decodeURIComponent(ignoreFailedRemoteSub);
|
ignoreFailedRemoteSub = decodeURIComponent(ignoreFailedRemoteSub);
|
||||||
$.info(`指定忽略失败的远程订阅: ${ignoreFailedRemoteSub}`);
|
$.info(`指定忽略失败的远程订阅: ${ignoreFailedRemoteSub}`);
|
||||||
@ -311,6 +323,7 @@ async function downloadCollection(req, res) {
|
|||||||
'include-unsupported-proxy': includeUnsupportedProxy,
|
'include-unsupported-proxy': includeUnsupportedProxy,
|
||||||
},
|
},
|
||||||
$options,
|
$options,
|
||||||
|
proxy,
|
||||||
});
|
});
|
||||||
|
|
||||||
// forward flow header from the first subscription in this collection
|
// forward flow header from the first subscription in this collection
|
||||||
@ -355,7 +368,7 @@ async function downloadCollection(req, res) {
|
|||||||
url,
|
url,
|
||||||
$arguments.flowUserAgent,
|
$arguments.flowUserAgent,
|
||||||
undefined,
|
undefined,
|
||||||
sub.proxy,
|
sub.proxy || collection.proxy || proxy,
|
||||||
$arguments.flowUrl,
|
$arguments.flowUrl,
|
||||||
);
|
);
|
||||||
if (flowInfo) {
|
if (flowInfo) {
|
||||||
|
@ -38,6 +38,7 @@ async function produceArtifact({
|
|||||||
subscription,
|
subscription,
|
||||||
awaitCustomCache,
|
awaitCustomCache,
|
||||||
$options,
|
$options,
|
||||||
|
proxy,
|
||||||
}) {
|
}) {
|
||||||
platform = platform || 'JSON';
|
platform = platform || 'JSON';
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ async function produceArtifact({
|
|||||||
url,
|
url,
|
||||||
ua || sub.ua,
|
ua || sub.ua,
|
||||||
undefined,
|
undefined,
|
||||||
sub.proxy,
|
sub.proxy || proxy,
|
||||||
undefined,
|
undefined,
|
||||||
awaitCustomCache,
|
awaitCustomCache,
|
||||||
);
|
);
|
||||||
@ -115,7 +116,7 @@ async function produceArtifact({
|
|||||||
url,
|
url,
|
||||||
ua || sub.ua,
|
ua || sub.ua,
|
||||||
undefined,
|
undefined,
|
||||||
sub.proxy,
|
sub.proxy || proxy,
|
||||||
undefined,
|
undefined,
|
||||||
awaitCustomCache,
|
awaitCustomCache,
|
||||||
);
|
);
|
||||||
@ -220,7 +221,9 @@ async function produceArtifact({
|
|||||||
url,
|
url,
|
||||||
sub.ua,
|
sub.ua,
|
||||||
undefined,
|
undefined,
|
||||||
sub.proxy,
|
sub.proxy ||
|
||||||
|
collection.proxy ||
|
||||||
|
proxy,
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errors[url] = err;
|
errors[url] = err;
|
||||||
@ -344,7 +347,6 @@ async function produceArtifact({
|
|||||||
}
|
}
|
||||||
exist[proxy.name] = true;
|
exist[proxy.name] = true;
|
||||||
}
|
}
|
||||||
console.log(proxies);
|
|
||||||
return ProxyUtils.produce(proxies, platform, produceType, produceOpts);
|
return ProxyUtils.produce(proxies, platform, produceType, produceOpts);
|
||||||
} else if (type === 'rule') {
|
} else if (type === 'rule') {
|
||||||
const allRules = $.read(RULES_KEY);
|
const allRules = $.read(RULES_KEY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user