Files
cloudflare-gateway-pihole-s…/cf_gateway_rule_create.js
T
2023-09-12 17:04:28 +07:00

14 lines
484 B
JavaScript

import { createZeroTrustRule, getZeroTrustLists } from "./lib/api.js";
const { result: lists } = await getZeroTrustLists();
const wirefilterExpression = lists.reduce((previous, current, index) => {
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 `;
}, "");
await createZeroTrustRule(wirefilterExpression);