Skip to content

Commit

Permalink
Ensure block/allowlist files exist
Browse files Browse the repository at this point in the history
Enhances user friendliness.
  • Loading branch information
mrrfv committed Nov 29, 2024
1 parent c85eca4 commit a82aafa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cf_list_create.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ let duplicateDomainCount = 0;
let allowedDomainCount = 0;
const memoizedNormalizeDomain = memoize(normalizeDomain);

// Check if the blocklist.txt and allowlist.txt files exist
for (const filename of [allowlistFilename, blocklistFilename]) {
if (!existsSync(filename)) {
console.error(`File not found: ${filename}. Please create a block/allowlist first, or run download_lists.js to download the recommended lists.`);
process.exit(1);
}
}

// Read allowlist
console.log(`Processing ${allowlistFilename}`);
await readFile(resolve(`./${allowlistFilename}`), (line) => {
Expand Down

0 comments on commit a82aafa

Please sign in to comment.