Skip to content

Commit

Permalink
feat: more domains (#45)
Browse files Browse the repository at this point in the history
* Add more proton related domains

* refactor: better script generation

---------

Co-authored-by: eoin-pledge <eoin@yourpledge.earth>
  • Loading branch information
Kikobeats and eoin-pledge-io authored Jun 21, 2023
1 parent abd1f1f commit 7a2086e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
16 changes: 10 additions & 6 deletions domains.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"6mail.cf",
"6paq.com",
"74.ru",
"74gmail.com",
"7mail.ga",
"7mail.ml",
"88.am",
Expand Down Expand Up @@ -522,8 +523,8 @@
"cia.hu",
"ciaoweb.it",
"cicciociccio.com",
"cincinow.net",
"cinci.rr.com",
"cincinow.net",
"citiz.net",
"citlink.net",
"citromail.hu",
Expand Down Expand Up @@ -1785,7 +1786,6 @@
"magicmail.co.za",
"magspam.net",
"mahmoodweb.com",
"mail.bg",
"mail-awu.de",
"mail-box.cz",
"mail-center.com",
Expand All @@ -1798,6 +1798,7 @@
"mail.austria.com",
"mail.az",
"mail.be",
"mail.bg",
"mail.bulgaria.com",
"mail.by",
"mail.co.za",
Expand Down Expand Up @@ -3298,8 +3299,8 @@
"mttestdriver.com",
"muehlacker.tk",
"muell.icu",
"muellmail.com",
"muellemail.com",
"muellmail.com",
"mundomail.net",
"munich.com",
"music.com",
Expand Down Expand Up @@ -3640,6 +3641,7 @@
"plus.com",
"plus.google.com",
"plusmail.com.br",
"pm.me",
"pmail.net",
"pobox.hu",
"pobox.sk",
Expand Down Expand Up @@ -3706,6 +3708,8 @@
"promessage.com",
"prontomail.com",
"protestant.com",
"proton.me",
"protonmail.ch",
"protonmail.com",
"prydirect.info",
"psv-supporter.com",
Expand Down Expand Up @@ -4002,12 +4006,12 @@
"spacewar.com",
"spainmail.com",
"spam.2012-2016.ru",
"spam.care",
"spamavert.com",
"spambob.com",
"spambob.org",
"spambog.net",
"spambooger.com",
"spam.care",
"spamcero.com",
"spamdecoy.net",
"spameater.com",
Expand Down Expand Up @@ -4368,8 +4372,8 @@
"ukmax.com",
"ukr.net",
"uku.co.uk",
"ultra.fyi",
"ultapulta.com",
"ultra.fyi",
"ultrapostman.com",
"ummah.org",
"umpire.com",
Expand Down Expand Up @@ -4755,4 +4759,4 @@
"zzom.co.uk",
"zzz.com",
"zzz.pl"
]
]
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@
"hubspot",
"mail"
],
"dependencies": {
"got": "~13.0.0",
"json-future": "~2.2.13"
},
"devDependencies": {
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
Expand All @@ -70,7 +66,7 @@
"standard-version": "latest"
},
"engines": {
"node": ">= 6"
"node": ">= 18"
},
"files": [
"domains.js",
Expand Down
17 changes: 10 additions & 7 deletions scripts/postinstall.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import jsonFuture from 'json-future'
import got from 'got'
import { writeFile } from 'node:fs/promises'

/* List of free email domains by HubSpot
https://knowledge.hubspot.com/forms/what-domains-are-blocked-when-using-the-forms-email-domains-to-block-feature */
const URL =
'https://f.hubspotusercontent40.net/hubfs/2832391/Marketing/Lead-Capture/free-domains-2.csv'

/** Additional domains not present in the URL */
const DOMAINS = ['pm.me', 'proton.me', 'protonmail.ch']

const trim = text => text.replace(/^\s+|\s+$/g, '')

const save = async body => {
const result = body.split(/[,\n]/g).map(trim).filter(Boolean)
await jsonFuture.saveAsync('domains.json', result)
}
const sanetize = text => text.split(/[,\n]/g).map(trim).filter(Boolean)

try {
await save(await got(URL).text())
const raw = await fetch(URL).then(res => res.text())
const domains = new Set(sanetize(raw))
for (const domain of DOMAINS) domains.add(domain)
const sorted = Array.from(domains).sort()
await writeFile('domains.json', JSON.stringify(sorted, null, 2))
} catch (error) {
console.error(error)
process.exit(1)
Expand Down

0 comments on commit 7a2086e

Please sign in to comment.