Housekeeping

This commit is contained in:
SukkaW
2023-07-24 23:02:22 +08:00
parent 79c761b0db
commit ce7db9693f
5 changed files with 55 additions and 71 deletions

View File

@@ -21,7 +21,7 @@ const { minifyRules } = require('./lib/minify-rules');
}
}
console.timeEnd('* Download bogus-nxdomain-list')
console.timeEnd('* Download bogus-nxdomain-list');
const filePath = path.resolve(__dirname, '../Source/ip/reject.conf');
const resultPath = path.resolve(__dirname, '../List/ip/reject.conf');
@@ -30,12 +30,12 @@ const { minifyRules } = require('./lib/minify-rules');
'# --- [Anti Bogus Domain Replace Me] ---',
res.map(ip => {
if (isIPv4(ip)) {
return `IP-CIDR,${ip}/32,no-resolve`
return `IP-CIDR,${ip}/32,no-resolve`;
}
if (isIPv6(ip)) {
return `IP-CIDR6,${ip}/128,no-resolve`
return `IP-CIDR6,${ip}/128,no-resolve`;
}
return ''
return '';
}).join('\n')
);
@@ -56,7 +56,7 @@ const { minifyRules } = require('./lib/minify-rules');
minifyRules(content.split('\n'))
),
resultPath
)
);
console.timeEnd('Total Time - build-anti-bogus-domain');
})();

View File

@@ -3,8 +3,6 @@ require('chai').should();
const Trie = require('./trie');
const assert = require('assert');
var SENTINEL = Trie.SENTINEL;
describe('Trie', () => {
it('should be possible to add items to a Trie.', () => {
const trie = new Trie();
@@ -57,7 +55,7 @@ describe('Trie', () => {
assert.strictEqual(trie.delete(''), false);
trie.delete('').should.eq(false);
trie.delete('hello').should.eq(false);
trie.delete('rat').should.eq(true);
trie.has('rat').should.eq(false);
trie.has('rate').should.eq(true);
@@ -182,4 +180,4 @@ describe('surge domainset dedupe', () => {
const trie = Trie.from(['skk.moe', 'sukkaskk.moe']);
trie.find('.skk.moe').should.eql([]);
});
})
});

View File

@@ -12,8 +12,8 @@ const withBanner = (title, description, date, content) => {
# ${title}
# Last Updated: ${date.toISOString()}
# Size: ${content.length}
${description.map(line => line ? `# ${line}` : '#').join('\n')}
########################################\n` + content.join('\n') + '\n################# END ###################\n';
${description.map(line => (line ? `# ${line}` : '#')).join('\n')}
########################################\n${content.join('\n')}\n################# END ###################\n`;
};
/**
* @param {string} title
@@ -24,14 +24,14 @@ ${description.map(line => line ? `# ${line}` : '#').join('\n')}
*/
const withBannerArray = (title, description, date, content) => {
return [
`########################################`,
'########################################',
`# ${title}`,
`# Last Updated: ${date.toISOString()}`,
`# Size: ${content.length}`,
...description.map(line => line ? `# ${line}` : '#'),
`########################################`,
...description.map(line => (line ? `# ${line}` : '#')),
'########################################',
...content,
`################# END ###################`,
'################# END ###################',
''
];
};