This commit is contained in:
2026-09-20 07:27:29 +01:00
parent dc2cd66b25
commit 8ec44ee0a7
70 changed files with 2657 additions and 128 deletions
@@ -0,0 +1,31 @@
import type { BUN_SQLITE_WGUI_CLIENT_RULES } from "@/db/types/db";
type Params = {
rule: BUN_SQLITE_WGUI_CLIENT_RULES;
};
export default function expandClientRuleDestinations({ rule }: Params) {
if (rule.rule_type == "all") {
return [rule];
}
const destinations = (rule.destination || "")
.split(",")
.map((value) => value.trim())
.filter(Boolean);
if (destinations.length <= 1) {
return [
{
...rule,
destination: destinations[0] || "",
},
];
}
return destinations.map((destination) => ({
...rule,
id: undefined,
destination,
}));
}