added the ability to download both blocklist and allowlist for download script execution without arguments

This commit is contained in:
Viet Huynh
2023-09-18 03:28:35 +07:00
parent 033fe73827
commit 0657dc7e94
+17 -8
View File
@@ -39,20 +39,29 @@ const blocklistUrls = [
]; ];
const listType = process.argv[2]; const listType = process.argv[2];
const downloadAllowlists = async () => {
await downloadFiles(resolve("./allowlist.txt"), allowlistUrls);
console.log(
"Done. The allowlist.txt file contains merged data from recommended whitelists."
);
};
const downloadBlocklists = async () => {
await downloadFiles(resolve("./blocklist.txt"), blocklistUrls);
console.log(
"Done. The blocklist.txt file contains merged data from recommended filter lists."
);
};
switch (listType) { switch (listType) {
case "allowlist": { case "allowlist": {
await downloadFiles(resolve("./allowlist.txt"), allowlistUrls); await downloadAllowlists();
console.log(
"Done. The allowlist.txt file contains merged data from recommended whitelists."
);
break; break;
} }
case "blocklist": { case "blocklist": {
await downloadFiles(resolve("./blocklist.txt"), blocklistUrls); await downloadBlocklists();
console.log(
"Done. The blocklist.txt file contains merged data from recommended filter lists."
);
break; break;
} }
default: default:
await Promise.all([downloadAllowlists(), downloadBlocklists()]);
} }