Compare commits

...

1 Commits

Author SHA1 Message Date
xream
23bc011306 feat: 调整规则参数 2024-02-28 22:33:06 +08:00
3 changed files with 18 additions and 6 deletions

View File

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

View File

@@ -40,7 +40,7 @@ function AllRuleParser() {
rule.type === 'IP-CIDR' ||
rule.type === 'IP-CIDR6'
) {
rule.options = params.slice(2).join(",");
rule.options = params.slice(2);
}
result.push(rule);
}

View File

@@ -30,8 +30,8 @@ function SurgeRuleSet() {
const type = 'SINGLE';
const func = (rule) => {
let output = `${rule.type},${rule.content}`;
if (rule.type === 'IP-CIDR' || rule.type === 'IP-CIDR6') {
output += rule.options ? `,${rule.options}` : '';
if (['IP-CIDR', 'IP-CIDR6'].includes(rule.type)) {
output += rule.options ? `,${rule.options.join(',')}` : '';
}
return output;
};
@@ -44,6 +44,12 @@ function LoonRules() {
// skip unsupported rules
const UNSUPPORTED = ['DEST-PORT', 'SRC-IP', 'IN-PORT', 'PROTOCOL'];
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 { type, func };
@@ -62,8 +68,14 @@ function ClashRuleProvider() {
let output = `${TRANSFORM[rule.type] || rule.type},${
rule.content
}`;
if (rule.type === 'IP-CIDR' || rule.type === 'IP-CIDR6') {
output += rule.options ? `,${rule.options}` : '';
if (['IP-CIDR', 'IP-CIDR6'].includes(rule.type)) {
if (rule.options) {
// Clash only supports the no-resolve option
rule.options = rule.options.filter((option) =>
['no-resolve'].includes(option),
);
}
output += rule.options ? `,${rule.options.join(',')}` : '';
}
return output;
}),