Resplit all/* directory (based on domain) (#2853)

This commit is contained in:
Jaco
2023-01-23 09:27:47 +02:00
committed by GitHub
parent c6fff83004
commit 4464f759f2
+8 -5
View File
@@ -144,18 +144,21 @@ function writeAllList (deny) {
mkdirp.sync('all');
const avail = deny.reduce((avail, url) => {
const firstChar = url[0];
const [top] = url.split('.').reverse();
if (!avail[firstChar]) {
avail[firstChar] = [url];
if (!avail[top]) {
avail[top] = [url];
} else {
avail[firstChar].push(url);
avail[top].push(url);
}
return avail;
}, {});
Object.entries(avail).forEach(([key, urls]) => writeJson(`all/${key}.json`, urls));
Object.entries(avail).forEach(([top, urls]) => {
mkdirp.sync(`all/${top}`);
writeJson(`all/${top}/all.json`, urls);
});
}
const addr = readJson('address.json');