mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-11 17:48:58 +08:00
feat: ProxyUtils.produce
增加第二个参数 type
, 暂时仅支持目标为 ClashMeta
时 internal
输出节点数组供开发者使用
This commit is contained in:
parent
75f802f607
commit
6d11ea0fcc
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.111",
|
"version": "2.14.112",
|
||||||
"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": {
|
||||||
|
@ -139,7 +139,7 @@ async function process(proxies, operators = [], targetPlatform, source) {
|
|||||||
return proxies;
|
return proxies;
|
||||||
}
|
}
|
||||||
|
|
||||||
function produce(proxies, targetPlatform) {
|
function produce(proxies, targetPlatform, type) {
|
||||||
const producer = PROXY_PRODUCERS[targetPlatform];
|
const producer = PROXY_PRODUCERS[targetPlatform];
|
||||||
if (!producer) {
|
if (!producer) {
|
||||||
throw new Error(`Target platform: ${targetPlatform} is not supported!`);
|
throw new Error(`Target platform: ${targetPlatform} is not supported!`);
|
||||||
@ -157,7 +157,7 @@ function produce(proxies, targetPlatform) {
|
|||||||
return proxies
|
return proxies
|
||||||
.map((proxy) => {
|
.map((proxy) => {
|
||||||
try {
|
try {
|
||||||
let line = producer.produce(proxy);
|
let line = producer.produce(proxy, type);
|
||||||
if (
|
if (
|
||||||
line.length > 0 &&
|
line.length > 0 &&
|
||||||
line.includes('__SubStoreLocalPort__')
|
line.includes('__SubStoreLocalPort__')
|
||||||
@ -182,7 +182,7 @@ function produce(proxies, targetPlatform) {
|
|||||||
.filter((line) => line.length > 0)
|
.filter((line) => line.length > 0)
|
||||||
.join('\n');
|
.join('\n');
|
||||||
} else if (producer.type === 'ALL') {
|
} else if (producer.type === 'ALL') {
|
||||||
return producer.produce(proxies);
|
return producer.produce(proxies, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,15 +2,10 @@ import { isPresent } from '@/core/proxy-utils/producers/utils';
|
|||||||
|
|
||||||
export default function ClashMeta_Producer() {
|
export default function ClashMeta_Producer() {
|
||||||
const type = 'ALL';
|
const type = 'ALL';
|
||||||
const produce = (proxies) => {
|
const produce = (proxies, type) => {
|
||||||
return (
|
const list = proxies
|
||||||
'proxies:\n' +
|
|
||||||
proxies
|
|
||||||
.filter((proxy) => {
|
.filter((proxy) => {
|
||||||
if (
|
if (proxy.type === 'snell' && String(proxy.version) === '4') {
|
||||||
proxy.type === 'snell' &&
|
|
||||||
String(proxy.version) === '4'
|
|
||||||
) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -135,10 +130,15 @@ export default function ClashMeta_Producer() {
|
|||||||
) {
|
) {
|
||||||
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
|
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
|
||||||
}
|
}
|
||||||
return ' - ' + JSON.stringify(proxy) + '\n';
|
return proxy;
|
||||||
})
|
});
|
||||||
.join('')
|
|
||||||
);
|
return type === 'internal'
|
||||||
|
? list
|
||||||
|
: 'proxies:\n' +
|
||||||
|
list
|
||||||
|
.map((proxy) => ' - ' + JSON.stringify(proxy) + '\n')
|
||||||
|
.join('');
|
||||||
};
|
};
|
||||||
return { type, produce };
|
return { type, produce };
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user