From 115f4758f3eb31d688d4794e5c9290a68982ae64 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 22 Mar 2021 21:06:34 +0100 Subject: [PATCH] CI combine of keys from address.json (#183) --- packages/phishing/src/addrcheck.spec.ts | 4 +++- scripts/sortAll.mjs | 13 ++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/phishing/src/addrcheck.spec.ts b/packages/phishing/src/addrcheck.spec.ts index f59664bbd..ef107f48f 100644 --- a/packages/phishing/src/addrcheck.spec.ts +++ b/packages/phishing/src/addrcheck.spec.ts @@ -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/', diff --git a/scripts/sortAll.mjs b/scripts/sortAll.mjs index 2d0c490ab..7ba48b88e 100644 --- a/scripts/sortAll.mjs +++ b/scripts/sortAll.mjs @@ -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);