mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-14 19:15:56 +08:00
feat: 调整规则参数
This commit is contained in:
parent
56626dabc7
commit
b0c1157fe1
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.228",
|
"version": "2.14.230",
|
||||||
"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": {
|
||||||
|
@ -40,7 +40,7 @@ function AllRuleParser() {
|
|||||||
rule.type === 'IP-CIDR' ||
|
rule.type === 'IP-CIDR' ||
|
||||||
rule.type === 'IP-CIDR6'
|
rule.type === 'IP-CIDR6'
|
||||||
) {
|
) {
|
||||||
rule.options = params.slice(2).join(",");
|
rule.options = params.slice(2);
|
||||||
}
|
}
|
||||||
result.push(rule);
|
result.push(rule);
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,9 @@ function SurgeRuleSet() {
|
|||||||
const type = 'SINGLE';
|
const type = 'SINGLE';
|
||||||
const func = (rule) => {
|
const func = (rule) => {
|
||||||
let output = `${rule.type},${rule.content}`;
|
let output = `${rule.type},${rule.content}`;
|
||||||
if (rule.type === 'IP-CIDR' || rule.type === 'IP-CIDR6') {
|
if (['IP-CIDR', 'IP-CIDR6'].includes(rule.type)) {
|
||||||
output += rule.options ? `,${rule.options}` : '';
|
output +=
|
||||||
|
rule.options?.length > 0 ? `,${rule.options.join(',')}` : '';
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
@ -44,6 +45,12 @@ function LoonRules() {
|
|||||||
// skip unsupported rules
|
// skip unsupported rules
|
||||||
const UNSUPPORTED = ['DEST-PORT', 'SRC-IP', 'IN-PORT', 'PROTOCOL'];
|
const UNSUPPORTED = ['DEST-PORT', 'SRC-IP', 'IN-PORT', 'PROTOCOL'];
|
||||||
if (UNSUPPORTED.indexOf(rule.type) !== -1) return null;
|
if (UNSUPPORTED.indexOf(rule.type) !== -1) return null;
|
||||||
|
if (['IP-CIDR', 'IP-CIDR6'].includes(rule.type) && rule.options) {
|
||||||
|
// Loon only supports the no-resolve option
|
||||||
|
rule.options = rule.options.filter((option) =>
|
||||||
|
['no-resolve'].includes(option),
|
||||||
|
);
|
||||||
|
}
|
||||||
return SurgeRuleSet().func(rule);
|
return SurgeRuleSet().func(rule);
|
||||||
};
|
};
|
||||||
return { type, func };
|
return { type, func };
|
||||||
@ -62,8 +69,17 @@ function ClashRuleProvider() {
|
|||||||
let output = `${TRANSFORM[rule.type] || rule.type},${
|
let output = `${TRANSFORM[rule.type] || rule.type},${
|
||||||
rule.content
|
rule.content
|
||||||
}`;
|
}`;
|
||||||
if (rule.type === 'IP-CIDR' || rule.type === 'IP-CIDR6') {
|
if (['IP-CIDR', 'IP-CIDR6'].includes(rule.type)) {
|
||||||
output += rule.options ? `,${rule.options}` : '';
|
if (rule.options) {
|
||||||
|
// Clash only supports the no-resolve option
|
||||||
|
rule.options = rule.options.filter((option) =>
|
||||||
|
['no-resolve'].includes(option),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
output +=
|
||||||
|
rule.options?.length > 0
|
||||||
|
? `,${rule.options.join(',')}`
|
||||||
|
: '';
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
}),
|
}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user