mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 09:10:35 +08:00
Fix: speedtest
This commit is contained in:
parent
f228ff9ac6
commit
801f81f1ef
@ -9,8 +9,7 @@ import { task } from './trace';
|
|||||||
import { fetchWithRetry } from './lib/fetch-retry';
|
import { fetchWithRetry } from './lib/fetch-retry';
|
||||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||||
import picocolors from 'picocolors';
|
import picocolors from 'picocolors';
|
||||||
import { fetchRemoteTextByLine } from './lib/fetch-text-by-line';
|
import { readFileIntoProcessedArray } from './lib/fetch-text-by-line';
|
||||||
import { processLine } from './lib/process-line';
|
|
||||||
import { TTL, deserializeArray, fsFetchCache, serializeArray } from './lib/cache-filesystem';
|
import { TTL, deserializeArray, fsFetchCache, serializeArray } from './lib/cache-filesystem';
|
||||||
import { createMemoizedPromise } from './lib/memo-promise';
|
import { createMemoizedPromise } from './lib/memo-promise';
|
||||||
|
|
||||||
@ -83,14 +82,11 @@ const querySpeedtestApi = async (keyword: string): Promise<Array<string | null>>
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getPreviousSpeedtestDomainsPromise = createMemoizedPromise(async () => {
|
const getPreviousSpeedtestDomainsPromise = createMemoizedPromise(async () => {
|
||||||
const domains: string[] = [];
|
try {
|
||||||
for await (const l of await fetchRemoteTextByLine('https://ruleset.skk.moe/List/domainset/speedtest.conf')) {
|
return await readFileIntoProcessedArray(path.resolve(import.meta.dir, '../List/domainset/speedtest.conf'));
|
||||||
const line = processLine(l);
|
} catch {
|
||||||
if (line) {
|
return [];
|
||||||
domains.push(line);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return domains;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const buildSpeedtestDomainSet = task(import.meta.main, import.meta.path)(async (span) => {
|
export const buildSpeedtestDomainSet = task(import.meta.main, import.meta.path)(async (span) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user