Browse Source

Chore: minor changes

SukkaW 1 year ago
parent
commit
1899946306
3 changed files with 12 additions and 12 deletions
  1. 8 8
      Build/build-common.ts
  2. 3 3
      Build/build-speedtest-domainset.ts
  3. 1 1
      Build/build-stream-service.ts

+ 8 - 8
Build/build-common.ts

@@ -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();
       }

+ 3 - 3
Build/build-speedtest-domainset.ts

@@ -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));
 

+ 1 - 1
Build/build-stream-service.ts

@@ -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([