mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Chore: Housekeeping
This commit is contained in:
@@ -14,15 +14,11 @@ import { task } from './trace';
|
||||
// tldts-experimental is way faster than tldts, but very little bit inaccurate
|
||||
// (since it is hashes based). But the result is still deterministic, which is
|
||||
// enough when creating a simple stat of reject hosts.
|
||||
import * as tldts from 'tldts-experimental';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { getPhishingDomains } from './lib/get-phishing-domains';
|
||||
|
||||
import { subtract as SetSubstract } from 'mnemonist/set';
|
||||
import { setAddFromArray, setAddFromArrayCurried } from './lib/set-add-from-array';
|
||||
import { sort } from './lib/timsort';
|
||||
import { looseTldtsOpt } from './constants/loose-tldts-opt';
|
||||
import { build } from 'bun';
|
||||
|
||||
const getRejectSukkaConfPromise = readFileIntoProcessedArray(path.resolve(import.meta.dir, '../Source/domainset/reject_sukka.conf'));
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import { processLine } from './lib/process-line';
|
||||
import { TTL, deserializeArray, fsFetchCache, serializeArray } from './lib/cache-filesystem';
|
||||
import { createMemoizedPromise } from './lib/memo-promise';
|
||||
|
||||
import * as SetHelpers from 'mnemonist/set';
|
||||
import { setAddFromArrayCurried } from './lib/set-add-from-array';
|
||||
|
||||
const s = new Sema(2);
|
||||
|
||||
@@ -83,11 +83,11 @@ const querySpeedtestApi = async (keyword: string): Promise<Array<string | null>>
|
||||
};
|
||||
|
||||
const getPreviousSpeedtestDomainsPromise = createMemoizedPromise(async () => {
|
||||
const domains = new Set<string>();
|
||||
const domains: string[] = [];
|
||||
for await (const l of await fetchRemoteTextByLine('https://ruleset.skk.moe/List/domainset/speedtest.conf')) {
|
||||
const line = processLine(l);
|
||||
if (line) {
|
||||
domains.add(line);
|
||||
domains.push(line);
|
||||
}
|
||||
}
|
||||
return domains;
|
||||
@@ -182,9 +182,11 @@ export const buildSpeedtestDomainSet = task(import.meta.path, async (span) => {
|
||||
'mensura.cdn-apple.com' // From netQuality command
|
||||
]);
|
||||
|
||||
await span.traceChildAsync('fetch previous speedtest domainset', async () => {
|
||||
SetHelpers.add(domains, await getPreviousSpeedtestDomainsPromise());
|
||||
});
|
||||
await span.traceChildAsync(
|
||||
'fetch previous speedtest domainset',
|
||||
() => getPreviousSpeedtestDomainsPromise()
|
||||
.then(setAddFromArrayCurried(domains))
|
||||
);
|
||||
|
||||
await new Promise<void>((resolve) => {
|
||||
const pMap = ([
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { PublicSuffixList } from '@gorhill/publicsuffixlist';
|
||||
import picocolors from 'picocolors';
|
||||
import { normalizeDomain } from './normalize-domain';
|
||||
import { fetchAssets } from './fetch-assets';
|
||||
import { deserializeArray, deserializeSet, fsFetchCache, serializeArray, serializeSet } from './cache-filesystem';
|
||||
import { deserializeArray, fsFetchCache, serializeArray } from './cache-filesystem';
|
||||
import type { Span } from '../trace';
|
||||
import createKeywordFilter from './aho-corasick';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user