mirror of
https://github.com/Nezumi-2711/cloudflare-gateway-pihole-scripts.git
synced 2026-09-22 13:38:37 +00:00
trim before processing domain
This commit is contained in:
+12
-4
@@ -24,9 +24,13 @@ let duplicateDomainCount = 0;
|
|||||||
// Read allowlist
|
// Read allowlist
|
||||||
console.log(`Processing ${allowlistFilename}`);
|
console.log(`Processing ${allowlistFilename}`);
|
||||||
await readFile(resolve(allowlistFilename), (line) => {
|
await readFile(resolve(allowlistFilename), (line) => {
|
||||||
if (isComment(line)) return;
|
const _line = line.trim();
|
||||||
|
|
||||||
const domain = normalizeDomain(line, true);
|
if (!_line) return;
|
||||||
|
|
||||||
|
if (isComment(_line)) return;
|
||||||
|
|
||||||
|
const domain = normalizeDomain(_line, true);
|
||||||
|
|
||||||
if (!isValidDomain(domain)) return;
|
if (!isValidDomain(domain)) return;
|
||||||
|
|
||||||
@@ -40,9 +44,13 @@ await readFile(resolve(blocklistFilename), (line, rl) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isComment(line)) return;
|
const _line = line.trim();
|
||||||
|
|
||||||
const domain = normalizeDomain(line);
|
if (!_line) return;
|
||||||
|
|
||||||
|
if (isComment(_line)) return;
|
||||||
|
|
||||||
|
const domain = normalizeDomain(_line);
|
||||||
|
|
||||||
if (!isValidDomain(domain)) return;
|
if (!isValidDomain(domain)) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user