Skip to content

Commit

Permalink
Make the list create script less verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
mrrfv committed Mar 21, 2024
1 parent 9f53432 commit 3ef258a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions cf_list_create.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
createZeroTrustListsOneByOne,
} from "./lib/api.js";
import {
DEBUG,
DRY_RUN,
FAST_MODE,
LIST_ITEM_LIMIT,
Expand Down Expand Up @@ -76,13 +77,13 @@ await readFile(resolve(`./${blocklistFilename}`), (line, rl) => {
processedDomainCount++;

if (allowlist.has(domain)) {
console.log(`Found ${domain} in allowlist - Skipping`);
if (DEBUG) console.log(`Found ${domain} in allowlist - Skipping`);
allowedDomainCount++;
return;
}

if (blocklist.has(domain)) {
console.log(`Found ${domain} in blocklist already - Skipping`);
if (DEBUG) console.log(`Found ${domain} in blocklist already - Skipping`);
duplicateDomainCount++;
return;
}
Expand All @@ -95,7 +96,7 @@ await readFile(resolve(`./${blocklistFilename}`), (line, rl) => {

// The higher-level domain is already blocked
// so it's not necessary to block this domain
console.log(`Found ${item} in blocklist already - Skipping ${domain}`);
if (DEBUG) console.log(`Found ${item} in blocklist already - Skipping ${domain}`);
unnecessaryDomainCount++;
return;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export const FAST_MODE = !!parseInt(process.env.FAST_MODE, 10);

export const BLOCK_BASED_ON_SNI = !!parseInt(process.env.BLOCK_BASED_ON_SNI, 10);

export const DEBUG = !!parseInt(process.env.DEBUG, 10);

export const PROCESSING_FILENAME = {
ALLOWLIST: "allowlist.txt",
BLOCKLIST: "blocklist.txt",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3ef258a

Please sign in to comment.