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
+14 -5
View File
@@ -39,20 +39,29 @@ const blocklistUrls = [
];
const listType = process.argv[2];
switch (listType) {
case "allowlist": {
const downloadAllowlists = async () => {
await downloadFiles(resolve("./allowlist.txt"), allowlistUrls);
console.log(
"Done. The allowlist.txt file contains merged data from recommended whitelists."
);
break;
}
case "blocklist": {
};
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) {
case "allowlist": {
await downloadAllowlists();
break;
}
case "blocklist": {
await downloadBlocklists();
break;
}
default:
await Promise.all([downloadAllowlists(), downloadBlocklists()]);
}