mirror of
https://github.com/Nezumi-2711/cloudflare-gateway-pihole-scripts.git
synced 2026-09-22 13:38:37 +00:00
fixed last chunk expression
This commit is contained in:
@@ -1,13 +1,11 @@
|
|||||||
import { createZeroTrustRule, getZeroTrustLists } from "./lib/api.js";
|
import { createZeroTrustRule, getZeroTrustLists } from "./lib/api.js";
|
||||||
|
|
||||||
const { result: lists } = await getZeroTrustLists();
|
const { result: lists } = await getZeroTrustLists();
|
||||||
const wirefilterExpression = lists.reduce((previous, current, index) => {
|
const wirefilterExpression = lists.reduce((previous, current) => {
|
||||||
if (!current.name.startsWith("CGPS List")) return previous;
|
if (!current.name.startsWith("CGPS List")) return previous;
|
||||||
|
|
||||||
// Remove the trailing ' or '
|
|
||||||
if (index === lists.length - 1) return previous.slice(0, -4);
|
|
||||||
|
|
||||||
return `${previous} any(dns.domains[*] in \$${current.id}) or `;
|
return `${previous} any(dns.domains[*] in \$${current.id}) or `;
|
||||||
}, "");
|
}, "");
|
||||||
|
|
||||||
await createZeroTrustRule(wirefilterExpression);
|
// Remove the trailing ' or '
|
||||||
|
await createZeroTrustRule(wirefilterExpression.slice(0, -4));
|
||||||
|
|||||||
Reference in New Issue
Block a user