mirror of
https://github.com/SukkaW/Surge.git
synced 2026-06-14 03:31:49 +08:00
Chore: use foxts/counter
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (3.114.12) (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled
Build / Remove Artifacts after Deployment (push) Has been cancelled
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (3.114.12) (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled
Build / Remove Artifacts after Deployment (push) Has been cancelled
This commit is contained in:
@@ -14,6 +14,7 @@ import { processHostsWithPreload } from './parse-filter/hosts';
|
||||
import { processDomainListsWithPreload } from './parse-filter/domainlists';
|
||||
|
||||
import process from 'node:process';
|
||||
import { Counter } from 'foxts/counter';
|
||||
|
||||
export function getPhishingDomains(rawSpan?: RawSpan, isDebug = false): Promise<WorkerJobResult<string[]>> {
|
||||
return workerJob(rawSpan, async (childSpan) => {
|
||||
@@ -29,7 +30,7 @@ export function getPhishingDomains(rawSpan?: RawSpan, isDebug = false): Promise<
|
||||
|
||||
domainGroups.forEach(appendArrayInPlaceCurried(domainArr));
|
||||
|
||||
const domainCountMap = new Map<string, number>();
|
||||
const domainCountMap = new Counter();
|
||||
const domainScoreMap: Record<string, number> = Object.create(null) as Record<string, number>;
|
||||
|
||||
let line: string;
|
||||
@@ -61,12 +62,7 @@ export function getPhishingDomains(rawSpan?: RawSpan, isDebug = false): Promise<
|
||||
continue;
|
||||
}
|
||||
|
||||
domainCountMap.set(
|
||||
apexDomain,
|
||||
domainCountMap.has(apexDomain)
|
||||
? domainCountMap.get(apexDomain)! + 1
|
||||
: 1
|
||||
);
|
||||
domainCountMap.incr(apexDomain);
|
||||
|
||||
let score = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user