mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-14 11:15:59 +08:00
feat: 调整规则参数
This commit is contained in:
parent
56626dabc7
commit
b0c1157fe1
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.14.228",
|
||||
"version": "2.14.230",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -30,8 +30,9 @@ 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?.length > 0 ? `,${rule.options.join(',')}` : '';
|
||||
}
|
||||
return output;
|
||||
};
|
||||
@ -44,6 +45,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 +69,17 @@ 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?.length > 0
|
||||
? `,${rule.options.join(',')}`
|
||||
: '';
|
||||
}
|
||||
return output;
|
||||
}),
|
||||
|
Loading…
x
Reference in New Issue
Block a user