mirror of
https://github.com/Nezumi-2711/cloudflare-gateway-pihole-scripts.git
synced 2026-09-22 13:38:37 +00:00
refactored rule creation
This commit is contained in:
+19
@@ -126,3 +126,22 @@ export const deleteZeroTrustListsAtOnce = async (lists) => {
|
||||
console.error(`Error occurred while deleting lists - ${err.toString()}`);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a Zero Trust rule.
|
||||
* @param {string} wirefilterExpression The expression to be used for the rule.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export const createZeroTrustRule = (wirefilterExpression) =>
|
||||
requestGateway("/rules", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
name: "CGPS Filter Lists",
|
||||
description:
|
||||
"Filter lists created by Cloudflare Gateway Pi-hole Scripts. Avoid editing this rule. Changing the name of this rule will break the script.",
|
||||
enabled: true,
|
||||
action: "block",
|
||||
filters: ["dns"],
|
||||
traffic: wirefilterExpression,
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user