瀏覽代碼

Update CDN & Global & Download Hosts

SukkaW 1 年之前
父節點
當前提交
53d570e22d
共有 4 個文件被更改,包括 18 次插入13 次删除
  1. 10 13
      Build/lib/stable-sort-domain.ts
  2. 5 0
      Source/domainset/cdn.conf
  3. 2 0
      Source/domainset/download.conf
  4. 1 0
      Source/non_ip/global.conf

+ 10 - 13
Build/lib/stable-sort-domain.ts

@@ -1,5 +1,4 @@
 import type { PublicSuffixList } from '@gorhill/publicsuffixlist';
-import { createCachedGorhillGetDomain } from './cached-tld-parse';
 
 const compare = (a: string | null, b: string | null) => {
   if (a === b) return 0;
@@ -20,9 +19,9 @@ const compare = (a: string | null, b: string | null) => {
   }
 
   for (let i = 0; i < aLen; i++) {
-    if (b[i] == null) {
-      return 1;
-    }
+    // if (b[i] == null) {
+    //   return 1;
+    // }
     if (a[i] < b[i]) {
       return -1;
     }
@@ -34,22 +33,20 @@ const compare = (a: string | null, b: string | null) => {
 };
 
 export const sortDomains = (inputs: string[], gorhill: PublicSuffixList) => {
-  const getDomain = createCachedGorhillGetDomain(gorhill);
-  const domains = inputs.reduce<Map<string, string>>((acc, cur) => {
-    if (!acc.has(cur)) acc.set(cur, getDomain(cur));
+  const domains = inputs.reduce<Map<string, string | null>>((acc, cur) => {
+    if (!acc.has(cur)) {
+      const topD = gorhill.getDomain(cur[0] === '.' ? cur.slice(1) : cur);
+      acc.set(cur, topD === cur ? null : topD);
+    };
     return acc;
   }, new Map());
 
   const sorter = (a: string, b: string) => {
     if (a === b) return 0;
 
-    const $a = domains.get(a)!;
-    const $b = domains.get(b)!;
+    const $a = domains.get(a) || a;
+    const $b = domains.get(b) || b;
 
-    // avoid compare same thing twice
-    if (a === $a && b === $b) {
-      return compare(a, b);
-    }
     return compare($a, $b) || compare(a, b);
   };
 

+ 5 - 0
Source/domainset/cdn.conf

@@ -2015,6 +2015,7 @@ i.mt.lv
 secure-uploads.ui.com
 account-cdn.svc.ui.com
 net-fe-static-assets.network-controller.svc.ui.com
+images.svc.ui.com
 static.ui.com
 # SoftSonic
 .sftcdn.net
@@ -2649,3 +2650,7 @@ cdn.reimu.net
 img.reimu.net
 re.reimu.net
 useruploads.socratic.org
+static.socratic.org
+assets.vogue.com
+.kuaikan-cdn4.com
+.surrit.com

+ 2 - 0
Source/domainset/download.conf

@@ -33,6 +33,8 @@ repo.carbon.sh
 # KDE
 binary-factory.kde.org
 invent.kde.org
+# Raspberry Pi
+downloads.raspberrypi.com
 # Linux Mirrors
 mirror.navercorp.com
 fedorapeople.org

+ 1 - 0
Source/non_ip/global.conf

@@ -327,6 +327,7 @@ DOMAIN-SUFFIX,bwh1.net
 DOMAIN-SUFFIX,castbox.fm
 DOMAIN-SUFFIX,cbc.ca
 DOMAIN,ccmdl.adobe.com
+DOMAIN-SUFFIX,cdpn.io
 DOMAIN-SUFFIX,change.org
 DOMAIN-SUFFIX,character.ai
 DOMAIN-SUFFIX,cloudfront.net