Last active
February 25, 2025 23:44
-
-
Save Igloczek/7bfc459109f4a01f7e046b591d2a842a to your computer and use it in GitHub Desktop.
Revisions
-
Igloczek revised this gist
Feb 6, 2025 . 2 changed files with 99 additions and 52 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,52 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,99 @@ import axios from "axios" import TTLCache from "@isaacs/ttlcache" const domainsCache = new TTLCache({ ttl: 1000 * 60 * 60 * 24, }) as TTLCache<string, Set<string>> interface ListConfig { url: string type: "text" | "json" } const lists: ListConfig[] = [ { url: "https://deviceandbrowserinfo.com/api/emails/disposable", type: "json", }, { url: "https://raw.githubusercontent.com/Igloczek/burner-email-providers/master/emails.txt", type: "text", }, { url: "https://raw.githubusercontent.com/wesbos/burner-email-providers/master/emails.txt", type: "text", }, { url: "https://raw.githubusercontent.com/7c/fakefilter/main/txt/data.txt", type: "text", }, { url: "https://raw.githubusercontent.com/unkn0w/disposable-email-domain-list/main/domains.txt", type: "text", }, { url: "https://raw.githubusercontent.com/disposable/disposable-email-domains/master/domains_strict.txt", type: "text", }, { url: "https://raw.githubusercontent.com/disposable-email-domains/disposable-email-domains/master/disposable_email_blocklist.conf", type: "text", }, ] // stuff I want to block, but don't want to put in public lists, because that's paid email providers, just used for spam const customDomains = ["trungtubemedia.com"] async function loadDomains() { const cached = domainsCache.get("domains") if (cached) { return cached } const domains = new Set<string>() await Promise.allSettled( lists.map(async (list) => { const response = await axios.get(list.url) if (list.type === "json") { // Handle JSON response - assuming it's an array of domains const jsonData = Array.isArray(response.data) ? response.data : [] jsonData.forEach((domain) => { if (typeof domain === "string" && domain.trim() !== "") { domains.add(domain.trim()) } }) } else { // Handle text response response.data.split("\n").forEach((item) => { const line = item.trim() if (line !== "" && !line.startsWith("#")) { domains.add(line) } }) } }), ) customDomains.forEach((domain) => { domains.add(domain) }) domainsCache.set("domains", domains) return domains } // warm up the cache await loadDomains() export async function verifyEmail(email) { const domains = await loadDomains() const isDisposable = domains.has(email.split("@")[1]) return !isDisposable } -
Igloczek revised this gist
Apr 30, 2024 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,6 @@ const lists = [ "https://raw.githubusercontent.com/7c/fakefilter/main/txt/data.txt", "https://raw.githubusercontent.com/unkn0w/disposable-email-domain-list/main/domains.txt", "https://raw.githubusercontent.com/disposable/disposable-email-domains/master/domains_strict.txt", "https://raw.githubusercontent.com/disposable-email-domains/disposable-email-domains/master/disposable_email_blocklist.conf", ] -
Igloczek created this gist
Apr 30, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ import TTLCache from "@isaacs/ttlcache" import axios from "axios" const domainsCache = new TTLCache({ ttl: 1000 * 60 * 60 * 24, // cache for 24h }) const lists = [ "https://raw.githubusercontent.com/wesbos/burner-email-providers/master/emails.txt", // submiting my findings here "https://raw.githubusercontent.com/Igloczek/burner-email-providers/master/emails.txt", // adding my fork, as sometime PRs are stuck unmerged "https://raw.githubusercontent.com/7c/fakefilter/main/txt/data.txt", "https://raw.githubusercontent.com/unkn0w/disposable-email-domain-list/main/domains.txt", "https://raw.githubusercontent.com/disposable/disposable-email-domains/master/domains_strict.txt", "https://raw.githubusercontent.com/7c/fakefilter/main/txt/data.txt", "https://raw.githubusercontent.com/disposable-email-domains/disposable-email-domains/master/disposable_email_blocklist.conf", ] async function loadDomains() { const cached = domainsCache.get("domains") if (cached) { return cached } const domains = new Set() await Promise.allSettled( lists.map(async (list) => { const response = await axios.get(list) response.data.split("\n").forEach((item) => { const line = item.trim() if (line !== "" && !line.startsWith("#")) { domains.add(line) } }) }), ) domainsCache.set("domains", domains) return domains } // warm up the cache await loadDomains() // import this function whenever you need to check user email, for example before creating an account export async function verifyEmail(email) { const domains = await loadDomains() return !domains.has(email.split("@")[1]) }