Housekeeping [skip ci]

This commit is contained in:
SukkaW
2025-11-10 22:24:23 +08:00
parent 80d31e9cb8
commit dcb02d991e
3 changed files with 232 additions and 211 deletions

View File

@@ -41,38 +41,36 @@ const deadDomains: string[] = [];
const bar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);
bar.start(0, 0);
void Promise.all([
await Promise.all([
...domainRules,
...domainSets
].map(
filepath => runAgainstSourceFile(
filepath,
(domain: string, includeAllSubdomain: boolean) => {
bar.setTotal(bar.getTotal() + 1);
].map(filepath => runAgainstSourceFile(
filepath,
(domain: string, includeAllSubdomain: boolean) => {
bar.setTotal(bar.getTotal() + 1);
return queue.add(async () => {
let registerableDomainAlive, registerableDomain, alive: boolean | undefined;
return queue.add(async () => {
let registerableDomainAlive, registerableDomain, alive: boolean | undefined;
if (includeAllSubdomain) {
// we only need to check apex domain, because we don't know if there is any stripped subdomain
({ alive: registerableDomainAlive, registerableDomain } = await isRegisterableDomainAlive(domain));
} else {
({ alive, registerableDomainAlive, registerableDomain } = await isDomainAlive(domain));
if (includeAllSubdomain) {
// we only need to check apex domain, because we don't know if there is any stripped subdomain
({ alive: registerableDomainAlive, registerableDomain } = await isRegisterableDomainAlive(domain));
} else {
({ alive, registerableDomainAlive, registerableDomain } = await isDomainAlive(domain));
}
bar.increment();
if (!registerableDomainAlive) {
if (registerableDomain) {
deadDomains.push('.' + registerableDomain);
}
bar.increment();
if (!registerableDomainAlive) {
if (registerableDomain) {
deadDomains.push('.' + registerableDomain);
}
} else if (!includeAllSubdomain && alive != null && !alive) {
deadDomains.push(domain);
}
});
}
).then(() => console.log('[crawl]', filepath))
));
} else if (!includeAllSubdomain && alive != null && !alive) {
deadDomains.push(domain);
}
});
}
).then(() => console.log('[crawl]', filepath))));
await queue.done();