Compare commits

..

2 Commits

8 changed files with 38 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.388",
"version": "2.14.390",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {

View File

@@ -292,6 +292,7 @@ export const ProxyUtils = {
getISO,
MMDB,
Gist,
download,
};
function tryParse(parser, line) {

View File

@@ -69,6 +69,7 @@ async function downloadSubscription(req, res) {
produceType,
includeUnsupportedProxy,
resultFormat,
proxy,
} = req.query;
let $options = {};
if (req.query.$options) {
@@ -92,6 +93,10 @@ async function downloadSubscription(req, res) {
url = decodeURIComponent(url);
$.info(`指定远程订阅 URL: ${url}`);
}
if (proxy) {
proxy = decodeURIComponent(proxy);
$.info(`指定远程订阅使用代理/策略 proxy: ${proxy}`);
}
if (ua) {
ua = decodeURIComponent(ua);
$.info(`指定远程订阅 User-Agent: ${ua}`);
@@ -135,6 +140,7 @@ async function downloadSubscription(req, res) {
'include-unsupported-proxy': includeUnsupportedProxy,
},
$options,
proxy,
});
if (
@@ -264,6 +270,7 @@ async function downloadCollection(req, res) {
produceType,
includeUnsupportedProxy,
resultFormat,
proxy,
} = req.query;
let $options = {};
@@ -285,6 +292,11 @@ async function downloadCollection(req, res) {
$.info(`传入 $options: ${JSON.stringify($options)}`);
}
if (proxy) {
proxy = decodeURIComponent(proxy);
$.info(`指定远程订阅使用代理/策略 proxy: ${proxy}`);
}
if (ignoreFailedRemoteSub != null && ignoreFailedRemoteSub !== '') {
ignoreFailedRemoteSub = decodeURIComponent(ignoreFailedRemoteSub);
$.info(`指定忽略失败的远程订阅: ${ignoreFailedRemoteSub}`);
@@ -311,6 +323,7 @@ async function downloadCollection(req, res) {
'include-unsupported-proxy': includeUnsupportedProxy,
},
$options,
proxy,
});
// forward flow header from the first subscription in this collection
@@ -355,7 +368,7 @@ async function downloadCollection(req, res) {
url,
$arguments.flowUserAgent,
undefined,
sub.proxy,
sub.proxy || collection.proxy || proxy,
$arguments.flowUrl,
);
if (flowInfo) {

View File

@@ -38,6 +38,7 @@ async function produceArtifact({
subscription,
awaitCustomCache,
$options,
proxy,
}) {
platform = platform || 'JSON';
@@ -68,7 +69,7 @@ async function produceArtifact({
url,
ua || sub.ua,
undefined,
sub.proxy,
sub.proxy || proxy,
undefined,
awaitCustomCache,
);
@@ -115,7 +116,7 @@ async function produceArtifact({
url,
ua || sub.ua,
undefined,
sub.proxy,
sub.proxy || proxy,
undefined,
awaitCustomCache,
);
@@ -220,7 +221,9 @@ async function produceArtifact({
url,
sub.ua,
undefined,
sub.proxy,
sub.proxy ||
collection.proxy ||
proxy,
);
} catch (err) {
errors[url] = err;
@@ -344,7 +347,6 @@ async function produceArtifact({
}
exist[proxy.name] = true;
}
console.log(proxies);
return ProxyUtils.produce(proxies, platform, produceType, produceOpts);
} else if (type === 'rule') {
const allRules = $.read(RULES_KEY);

View File

@@ -45,7 +45,10 @@ export default async function download(
const { isNode, isStash, isLoon, isShadowRocket, isQX } = ENV();
const { defaultProxy, defaultUserAgent, defaultTimeout, cacheThreshold } =
$.read(SETTINGS_KEY);
const proxy = customProxy || defaultProxy;
let proxy = customProxy || defaultProxy;
if ($.env.isNode) {
proxy = proxy || eval('process.env.SUB_STORE_BACKEND_DEFAULT_PROXY');
}
const userAgent = ua || defaultUserAgent || 'clash.meta';
const requestTimeout = timeout || defaultTimeout;
const id = hex_md5(userAgent + url);

View File

@@ -49,7 +49,11 @@ export async function getFlowHeaders(
} else {
const { defaultProxy, defaultFlowUserAgent, defaultTimeout } =
$.read(SETTINGS_KEY);
const proxy = customProxy || defaultProxy;
let proxy = customProxy || defaultProxy;
if ($.env.isNode) {
proxy =
proxy || eval('process.env.SUB_STORE_BACKEND_DEFAULT_PROXY');
}
const userAgent =
ua ||
defaultFlowUserAgent ||

View File

@@ -9,8 +9,12 @@ import { SETTINGS_KEY } from '@/constants';
export default class Gist {
constructor({ token, key, syncPlatform }) {
const { isStash, isLoon, isShadowRocket, isQX } = ENV();
const { defaultProxy: proxy, defaultTimeout: timeout } =
$.read(SETTINGS_KEY);
const { defaultProxy, defaultTimeout: timeout } = $.read(SETTINGS_KEY);
let proxy = defaultProxy;
if ($.env.isNode) {
proxy =
proxy || eval('process.env.SUB_STORE_BACKEND_DEFAULT_PROXY');
}
if (syncPlatform === 'gitlab') {
this.headers = {

View File

@@ -66,6 +66,7 @@ function operator(proxies = [], targetPlatform, context) {
// removeFlag, // 移除 emoji 旗帜
// getISO, // 获取 ISO 3166-1 alpha-2 代码
// Gist, // Gist 类
// download, // 内部的下载方法, 见 backend/src/utils/download.js
// }
// 如果只是为了快速修改或者筛选 可以参考 脚本操作支持节点快捷脚本 https://t.me/zhetengsha/970 和 脚本筛选支持节点快捷脚本 https://t.me/zhetengsha/1009