mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 09:10: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;
|
||||
|
||||
const id = basename;
|
||||
const [title, descriptions, lines] = res;
|
||||
const [title, incomingDescriptions, lines] = res;
|
||||
|
||||
let description: string[];
|
||||
if (descriptions.length) {
|
||||
description = SHARED_DESCRIPTION.slice();
|
||||
description.push('');
|
||||
appendArrayInPlace(description, descriptions);
|
||||
let finalDescriptions: string[];
|
||||
if (incomingDescriptions.length) {
|
||||
finalDescriptions = SHARED_DESCRIPTION.slice();
|
||||
finalDescriptions.push('');
|
||||
appendArrayInPlace(finalDescriptions, incomingDescriptions);
|
||||
} else {
|
||||
description = SHARED_DESCRIPTION;
|
||||
finalDescriptions = SHARED_DESCRIPTION;
|
||||
}
|
||||
|
||||
return new DomainsetOutput(span, id)
|
||||
.withTitle(title)
|
||||
.withDescription(description)
|
||||
.withDescription(finalDescriptions)
|
||||
.addFromDomainset(lines)
|
||||
.write();
|
||||
}
|
||||
|
||||
@ -8,7 +8,6 @@ import { readFileIntoProcessedArray } from './lib/fetch-text-by-line';
|
||||
|
||||
import { DomainsetOutput } from './lib/create-file';
|
||||
import { OUTPUT_SURGE_DIR } from './constants/dir';
|
||||
import { createMemoizedPromise } from './lib/memo-promise';
|
||||
import { newQueue } from '@henrygd/queue';
|
||||
|
||||
const KEYWORDS = [
|
||||
@ -111,6 +110,7 @@ const PREDEFINE_DOMAINS = [
|
||||
'.speedtestwnet.com.br',
|
||||
'.speedtest.moack.co.kr',
|
||||
'speedtest.mtnetworks.mn',
|
||||
'.speedtest.waicore.com',
|
||||
// Cloudflare
|
||||
'.speed.cloudflare.com',
|
||||
// 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) => {
|
||||
const output = new DomainsetOutput(span, 'speedtest')
|
||||
@ -200,7 +200,7 @@ export const buildSpeedtestDomainSet = task(require.main === module, __filename)
|
||||
.addFromDomainset(PREDEFINE_DOMAINS)
|
||||
.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));
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ export function createRulesetForStreamService(span: Span,
|
||||
fileId: string, title: string,
|
||||
streamServices: Array<import('../Source/stream').StreamService>) {
|
||||
return span.traceChildAsync(fileId, async (childSpan) => Promise.all([
|
||||
// Domains
|
||||
// Domains
|
||||
new RulesetOutput(childSpan, fileId, 'non_ip')
|
||||
.withTitle(`Sukka's Ruleset - Stream Services: ${title}`)
|
||||
.withDescription([
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user