fixed to count allowed domains correctly

This commit is contained in:
Viet Huynh
2023-09-12 20:19:09 +07:00
parent 811205ccc2
commit 695d7c7f5a
+3 -1
View File
@@ -20,6 +20,7 @@ const blocklist = new Map();
const domains = []; const domains = [];
let processedDomainCount = 0; let processedDomainCount = 0;
let duplicateDomainCount = 0; let duplicateDomainCount = 0;
let allowedDomainCount = 0;
// Read allowlist // Read allowlist
console.log(`Processing ${allowlistFilename}`); console.log(`Processing ${allowlistFilename}`);
@@ -64,6 +65,7 @@ await readFile(resolve(blocklistFilename), (line, rl) => {
if (allowlist.has(domain)) { if (allowlist.has(domain)) {
console.log(`Found ${domain} in allowlist - Skipping...`); console.log(`Found ${domain} in allowlist - Skipping...`);
allowedDomainCount++;
return; return;
} }
@@ -81,7 +83,7 @@ await readFile(resolve(blocklistFilename), (line, rl) => {
console.log("\n\n"); console.log("\n\n");
console.log(`Number of processed domains: ${processedDomainCount}`); console.log(`Number of processed domains: ${processedDomainCount}`);
console.log(`Number of blocked domains: ${domains.length}`); console.log(`Number of blocked domains: ${domains.length}`);
console.log(`Number of allowed domains: ${allowlist.size}`); console.log(`Number of allowed domains: ${allowedDomainCount}`);
console.log(`Number of duplicate domains: ${duplicateDomainCount}`); console.log(`Number of duplicate domains: ${duplicateDomainCount}`);
console.log( console.log(
`Number of lists which will be created: ${Math.ceil( `Number of lists which will be created: ${Math.ceil(