mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 17:20:35 +08:00
Chore: minor changes
This commit is contained in:
parent
ba1485687d
commit
1899946306
@ -113,20 +113,20 @@ function transformDomainset(parentSpan: Span, sourcePath: string) {
|
|||||||
if (res === $skip) return;
|
if (res === $skip) return;
|
||||||
|
|
||||||
const id = basename;
|
const id = basename;
|
||||||
const [title, descriptions, lines] = res;
|
const [title, incomingDescriptions, lines] = res;
|
||||||
|
|
||||||
let description: string[];
|
let finalDescriptions: string[];
|
||||||
if (descriptions.length) {
|
if (incomingDescriptions.length) {
|
||||||
description = SHARED_DESCRIPTION.slice();
|
finalDescriptions = SHARED_DESCRIPTION.slice();
|
||||||
description.push('');
|
finalDescriptions.push('');
|
||||||
appendArrayInPlace(description, descriptions);
|
appendArrayInPlace(finalDescriptions, incomingDescriptions);
|
||||||
} else {
|
} else {
|
||||||
description = SHARED_DESCRIPTION;
|
finalDescriptions = SHARED_DESCRIPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DomainsetOutput(span, id)
|
return new DomainsetOutput(span, id)
|
||||||
.withTitle(title)
|
.withTitle(title)
|
||||||
.withDescription(description)
|
.withDescription(finalDescriptions)
|
||||||
.addFromDomainset(lines)
|
.addFromDomainset(lines)
|
||||||
.write();
|
.write();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import { readFileIntoProcessedArray } from './lib/fetch-text-by-line';
|
|||||||
|
|
||||||
import { DomainsetOutput } from './lib/create-file';
|
import { DomainsetOutput } from './lib/create-file';
|
||||||
import { OUTPUT_SURGE_DIR } from './constants/dir';
|
import { OUTPUT_SURGE_DIR } from './constants/dir';
|
||||||
import { createMemoizedPromise } from './lib/memo-promise';
|
|
||||||
import { newQueue } from '@henrygd/queue';
|
import { newQueue } from '@henrygd/queue';
|
||||||
|
|
||||||
const KEYWORDS = [
|
const KEYWORDS = [
|
||||||
@ -111,6 +110,7 @@ const PREDEFINE_DOMAINS = [
|
|||||||
'.speedtestwnet.com.br',
|
'.speedtestwnet.com.br',
|
||||||
'.speedtest.moack.co.kr',
|
'.speedtest.moack.co.kr',
|
||||||
'speedtest.mtnetworks.mn',
|
'speedtest.mtnetworks.mn',
|
||||||
|
'.speedtest.waicore.com',
|
||||||
// Cloudflare
|
// Cloudflare
|
||||||
'.speed.cloudflare.com',
|
'.speed.cloudflare.com',
|
||||||
// Wi-Fi Man
|
// Wi-Fi Man
|
||||||
@ -187,7 +187,7 @@ async function querySpeedtestApi(keyword: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getSpeedtestHostsGroupsPromise = createMemoizedPromise(() => Promise.all(KEYWORDS.flatMap(querySpeedtestApi)));
|
const getSpeedtestHostsGroupsPromise = Promise.all(KEYWORDS.flatMap(querySpeedtestApi));
|
||||||
|
|
||||||
export const buildSpeedtestDomainSet = task(require.main === module, __filename)(async (span) => {
|
export const buildSpeedtestDomainSet = task(require.main === module, __filename)(async (span) => {
|
||||||
const output = new DomainsetOutput(span, 'speedtest')
|
const output = new DomainsetOutput(span, 'speedtest')
|
||||||
@ -200,7 +200,7 @@ export const buildSpeedtestDomainSet = task(require.main === module, __filename)
|
|||||||
.addFromDomainset(PREDEFINE_DOMAINS)
|
.addFromDomainset(PREDEFINE_DOMAINS)
|
||||||
.addFromDomainset(await readFileIntoProcessedArray(path.resolve(OUTPUT_SURGE_DIR, 'domainset/speedtest.conf')));
|
.addFromDomainset(await readFileIntoProcessedArray(path.resolve(OUTPUT_SURGE_DIR, 'domainset/speedtest.conf')));
|
||||||
|
|
||||||
const hostnameGroup = await span.traceChildPromise('get speedtest hosts groups', getSpeedtestHostsGroupsPromise());
|
const hostnameGroup = await span.traceChildPromise('get speedtest hosts groups', getSpeedtestHostsGroupsPromise);
|
||||||
|
|
||||||
hostnameGroup.forEach(hostname => output.bulkAddDomain(hostname));
|
hostnameGroup.forEach(hostname => output.bulkAddDomain(hostname));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user