style: отформатирован код для улучшения читаемости
All checks were successful
Build and Deploy Gateway / build-and-deploy (push) Successful in 18s
All checks were successful
Build and Deploy Gateway / build-and-deploy (push) Successful in 18s
This commit is contained in:
@@ -36,7 +36,9 @@ function findOutbound(subscriptionConfig, selectedTag) {
|
|||||||
function readCustomRuleSets() {
|
function readCustomRuleSets() {
|
||||||
try {
|
try {
|
||||||
if (!fs.existsSync(settings.customRuleSetsPath)) return [];
|
if (!fs.existsSync(settings.customRuleSetsPath)) return [];
|
||||||
const data = JSON.parse(fs.readFileSync(settings.customRuleSetsPath, "utf8"));
|
const data = JSON.parse(
|
||||||
|
fs.readFileSync(settings.customRuleSetsPath, "utf8"),
|
||||||
|
);
|
||||||
return Array.isArray(data) ? data : [];
|
return Array.isArray(data) ? data : [];
|
||||||
} catch {
|
} catch {
|
||||||
return [];
|
return [];
|
||||||
@@ -75,7 +77,10 @@ function ruleSets(customRuleSets = []) {
|
|||||||
|
|
||||||
// Пользовательские rule-sets не должны дублировать встроенные
|
// Пользовательские rule-sets не должны дублировать встроенные
|
||||||
const builtInTags = new Set(builtIn.map((rs) => rs.tag));
|
const builtInTags = new Set(builtIn.map((rs) => rs.tag));
|
||||||
const merged = [...builtIn, ...custom.filter((rs) => !builtInTags.has(rs.tag))];
|
const merged = [
|
||||||
|
...builtIn,
|
||||||
|
...custom.filter((rs) => !builtInTags.has(rs.tag)),
|
||||||
|
];
|
||||||
return merged;
|
return merged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,10 @@ export const api = {
|
|||||||
ruleSets: {
|
ruleSets: {
|
||||||
get: () => request("/api/rule-sets"),
|
get: () => request("/api/rule-sets"),
|
||||||
save: (ruleSets) =>
|
save: (ruleSets) =>
|
||||||
request("/api/rule-sets", { method: "PUT", body: JSON.stringify({ ruleSets }) }),
|
request("/api/rule-sets", {
|
||||||
|
method: "PUT",
|
||||||
|
body: JSON.stringify({ ruleSets }),
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
subscription: {
|
subscription: {
|
||||||
|
|||||||
Reference in New Issue
Block a user