mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-14 10:10:34 +08:00
Chore: housekeeping
This commit is contained in:
parent
0a45537fdc
commit
e16c318f4c
@ -1 +0,0 @@
|
|||||||
18
|
|
||||||
@ -30,7 +30,8 @@ export const buildAntiBogusDomain = task(import.meta.path, async () => {
|
|||||||
const result = [];
|
const result = [];
|
||||||
for await (const line of readFileByLine(path.resolve(import.meta.dir, '../Source/ip/reject.conf'))) {
|
for await (const line of readFileByLine(path.resolve(import.meta.dir, '../Source/ip/reject.conf'))) {
|
||||||
if (line === '# --- [Anti Bogus Domain Replace Me] ---') {
|
if (line === '# --- [Anti Bogus Domain Replace Me] ---') {
|
||||||
(await bogusIpPromise).forEach(rule => result.push(rule));
|
// bogus ip is less than 200, no need to worry about "Maximum call stack size exceeded"
|
||||||
|
result.push(...(await bogusIpPromise));
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
const l = processLine(line);
|
const l = processLine(line);
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import { createTrie } from './trie';
|
import { createTrie } from './trie';
|
||||||
|
|
||||||
export const domainDeduper = (inputDomains: string[]): string[] => {
|
export function domainDeduper(inputDomains: string[], toArray?: true): string[];
|
||||||
|
export function domainDeduper(inputDomains: string[], toArray: false): Set<string>;
|
||||||
|
export function domainDeduper(inputDomains: string[], toArray = true): string[] | Set<string> {
|
||||||
const trie = createTrie(inputDomains);
|
const trie = createTrie(inputDomains);
|
||||||
const sets = new Set(inputDomains);
|
const sets = new Set(inputDomains);
|
||||||
|
|
||||||
@ -19,7 +21,11 @@ export const domainDeduper = (inputDomains: string[]): string[] => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Array.from(sets);
|
if (toArray) {
|
||||||
};
|
return Array.from(sets);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sets;
|
||||||
|
}
|
||||||
|
|
||||||
export default domainDeduper;
|
export default domainDeduper;
|
||||||
|
|||||||
@ -19,10 +19,9 @@
|
|||||||
"async-retry": "^1.3.3",
|
"async-retry": "^1.3.3",
|
||||||
"async-sema": "^3.1.1",
|
"async-sema": "^3.1.1",
|
||||||
"ci-info": "^4.0.0",
|
"ci-info": "^4.0.0",
|
||||||
"eslint": "^8.54.0",
|
"fast-cidr-tools": "^0.2.2",
|
||||||
"fast-cidr-tools": "^0.1.0",
|
|
||||||
"gorhill-publicsuffixlist": "github:gorhill/publicsuffixlist.js",
|
"gorhill-publicsuffixlist": "github:gorhill/publicsuffixlist.js",
|
||||||
"mnemonist": "^0.39.5",
|
"mnemonist": "^0.39.6",
|
||||||
"path-scurry": "^1.10.1",
|
"path-scurry": "^1.10.1",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"punycode": "^2.3.1",
|
"punycode": "^2.3.1",
|
||||||
@ -34,13 +33,11 @@
|
|||||||
"@eslint-sukka/node": "4.1.10-beta.2",
|
"@eslint-sukka/node": "4.1.10-beta.2",
|
||||||
"@eslint-sukka/ts": "4.1.10-beta.2",
|
"@eslint-sukka/ts": "4.1.10-beta.2",
|
||||||
"@types/async-retry": "^1.4.8",
|
"@types/async-retry": "^1.4.8",
|
||||||
"@types/mocha": "10.0.2",
|
|
||||||
"@types/tar": "^6.1.9",
|
"@types/tar": "^6.1.9",
|
||||||
"bun-types": "^1.0.11",
|
"bun-types": "^1.0.11",
|
||||||
"chai": "4.3.10",
|
"eslint": "^8.55.0",
|
||||||
"eslint-config-sukka": "4.1.10-beta.2",
|
"eslint-config-sukka": "4.1.10-beta.2",
|
||||||
"eslint-formatter-sukka": "4.1.9",
|
"eslint-formatter-sukka": "4.1.9",
|
||||||
"mocha": "^10.2.0",
|
|
||||||
"typescript": "^5.2.2"
|
"typescript": "^5.2.2"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user