forked from ESign-khoindvn/dns-khoindvn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cf_list_delete.js
37 lines (30 loc) · 928 Bytes
/
cf_list_delete.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import {
deleteZeroTrustListsAtOnce,
deleteZeroTrustListsOneByOne,
getZeroTrustLists,
} from "./lib/api.js";
import { FAST_MODE } from "./lib/constants.js";
(async () => {
const { result: lists } = await getZeroTrustLists();
if (!lists) {
console.warn(
"No file lists found - this is not an issue if it's your first time running this script. Exiting."
);
return;
}
const cgpsLists = lists.filter(({ name }) => name.startsWith("CGPS List"));
if (!cgpsLists.length) {
console.warn(
"No lists with matching name found - this is not an issue if you haven't created any filter lists before. Exiting."
);
return;
}
console.log(
`Got ${lists.length} lists, ${cgpsLists.length} of which are CGPS lists that will be deleted.`
);
if (FAST_MODE) {
await deleteZeroTrustListsAtOnce(cgpsLists);
return;
}
await deleteZeroTrustListsOneByOne(cgpsLists);
})();