瀏覽代碼

Chore: backward compatible of reject_phishing file

SukkaW 2 年之前
父節點
當前提交
69da11a3b3

+ 1 - 0
Build/build-chn-cidr.ts

@@ -29,6 +29,7 @@ export const buildChnCidr = task(import.meta.path, async () => {
     'Data from https://misaka.io (misakaio @ GitHub)'
   ];
 
+  // Can not use createRuleset here, as Clash support advanced ipset syntax
   return Promise.all([
     compareAndWriteFile(
       withBannerArray(

+ 2 - 4
Build/build-reject-domainset.ts

@@ -207,11 +207,9 @@ export const buildRejectDomainSet = task(import.meta.path, async () => {
       rejectDomainsStats.map(([domain, count]) => `${domain}${' '.repeat(100 - domain.length)}${count}`),
       path.resolve(import.meta.dir, '../List/internal/reject-stats.txt')
     ),
-    // Copy reject_sukka.conf for backward compatibility
-    fsp.cp(
-      path.resolve(import.meta.dir, '../Source/domainset/reject_sukka.conf'),
+    Bun.write(
       path.resolve(import.meta.dir, '../List/domainset/reject_sukka.conf'),
-      { force: true, recursive: true }
+      '# The file has been deprecated, its content has been merged into the main `reject` domainset.\n'
     )
   ]);
 });

+ 3 - 3
Build/lib/create-file.ts

@@ -68,14 +68,14 @@ export async function compareAndWriteFile(linesA: string[], filePath: string) {
 
 export const withBannerArray = (title: string, description: string[], date: Date, content: string[]) => {
   return [
-    '########################################',
+    '#########################################',
     `# ${title}`,
     `# Last Updated: ${date.toISOString()}`,
     `# Size: ${content.length}`,
     ...description.map(line => (line ? `# ${line}` : '#')),
-    '########################################',
+    '#########################################',
     ...content,
-    '################# END ###################'
+    '################## EOF ##################'
   ];
 };
 

+ 1 - 4
Build/lib/get-phishing-domains.ts

@@ -90,10 +90,7 @@ export const getPhishingDomains = () => traceAsync('get phishing domains', async
     //     // 'https://malware-filter.gitlab.io/malware-filter/phishing-filter-agh.txt'
     //   ]
     // ),
-    getGorhillPublicSuffixPromise(),
-    // Remove old files
-    fsp.rm(path.resolve(import.meta.dir, '../../List/domainset/reject_phishing.conf'), { force: true }),
-    fsp.rm(path.resolve(import.meta.dir, '../../Clash/domainset/reject_phishing.txt'), { force: true })
+    getGorhillPublicSuffixPromise()
   ]);
 
   traceSync.skip('* whitelisting phishing domains', () => {

+ 2 - 0
Source/domainset/reject_phishing.conf

@@ -0,0 +1,2 @@
+# $ meta_title Sukka's Ruleset - Reject Phishing
+# $ meta_description The file has been deprecated, its content has been merged into the main `reject` domainset.