Chore: backward compatible of reject_phishing file

This commit is contained in:
SukkaW 2023-12-10 22:32:37 +08:00
parent 643447ce06
commit 69da11a3b3
5 changed files with 9 additions and 11 deletions

View File

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

View File

@ -207,11 +207,9 @@ export const buildRejectDomainSet = task(import.meta.path, async () => {
rejectDomainsStats.map(([domain, count]) => `${domain}${' '.repeat(100 - domain.length)}${count}`), rejectDomainsStats.map(([domain, count]) => `${domain}${' '.repeat(100 - domain.length)}${count}`),
path.resolve(import.meta.dir, '../List/internal/reject-stats.txt') path.resolve(import.meta.dir, '../List/internal/reject-stats.txt')
), ),
// Copy reject_sukka.conf for backward compatibility Bun.write(
fsp.cp(
path.resolve(import.meta.dir, '../Source/domainset/reject_sukka.conf'),
path.resolve(import.meta.dir, '../List/domainset/reject_sukka.conf'), 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'
) )
]); ]);
}); });

View File

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

View File

@ -90,10 +90,7 @@ export const getPhishingDomains = () => traceAsync('get phishing domains', async
// // 'https://malware-filter.gitlab.io/malware-filter/phishing-filter-agh.txt' // // 'https://malware-filter.gitlab.io/malware-filter/phishing-filter-agh.txt'
// ] // ]
// ), // ),
getGorhillPublicSuffixPromise(), 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 })
]); ]);
traceSync.skip('* whitelisting phishing domains', () => { traceSync.skip('* whitelisting phishing domains', () => {

View File

@ -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.