CI combine of keys from address.json (#183)

This commit is contained in:
Jaco Greeff
2021-03-22 21:06:34 +01:00
committed by GitHub
parent 9d6949f8bf
commit 115f4758f3
2 changed files with 15 additions and 2 deletions
+3 -1
View File
@@ -98,8 +98,10 @@ function checkAll (): Promise<[string, string[]][]> {
'https://claimpolkadot.com/claim/index.html',
'https://polkadot-airdrop.org/block/index.html',
'https://polkadot-airdrop.online/block/index.html',
'https://polkadot-airdropevent.network/block/index.html',
'https://polkadot-airdrops.net/block/index.html',
'https://polkadot-bonus.network/block/index.html'
'https://polkadot-bonus.network/block/index.html',
'https://polkadot.deals/claim/index.html'
].map((u) => checkTag(u, 'span', 'class="real-address"')),
...[
'https://polkadot-get.com/',
+12 -1
View File
@@ -3,6 +3,8 @@
import fs from 'fs';
const KNOWN_URLS = ['telegra.ph', 'twitter.com', 'youtube.com'];
function sortSection (values) {
return values.sort((a, b) => a.localeCompare(b));
}
@@ -15,6 +17,15 @@ function sortAddress (values) {
.reduce((all, [key, addresses]) => ({ ...all, [key]: addresses }), {});
}
function addSites (deny, values) {
return Object.keys(values).reduce((deny, url) => {
!deny.includes(url) && !KNOWN_URLS.includes(url) &&
deny.push(url);
return deny;
}, deny);
}
function isUnique (type, list) {
const others = [];
@@ -35,7 +46,7 @@ const meta = JSON.parse(fs.readFileSync('urlmeta.json', 'utf-8'));
// sorted order for all entries
const allow = sortSection(all.allow);
const deny = sortSection(all.deny);
const deny = sortSection(addSites(all.deny, addr));
// check for unique entries
isUnique('all.json/allow', allow);