From 717f7f7ab2e074d3ef532f390478d8fd49012945 Mon Sep 17 00:00:00 2001 From: Hollow Man Date: Fri, 26 Feb 2021 13:10:35 +0800 Subject: [PATCH] Add a shell script for maintaining disposable_email_blocklist.conf (#263) * Add more instructions for contributing so that the right order can always be achieved. LC_ALL=C; export LC_ALL Signed-off-by: Hollow Man * Add a shell script for maintaining disposable_email_blocklist.conf Signed-off-by: Hollow Man * Remove redundant lines in README.md Signed-off-by: Hollow Man --- README.md | 8 +------- maintain.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 maintain.sh diff --git a/README.md b/README.md index ac1cf6d..d3b6a06 100644 --- a/README.md +++ b/README.md @@ -113,13 +113,7 @@ Feel free to create PR with additions or request removal of some domain (with re Specifically, if adding more than one new domain, please cite in your PR where one can generate a disposable email address which uses that domain, so the maintainers can verify it. -Use: - -`$ cat disposable_email_blocklist.conf your_file | tr '[:upper:]' '[:lower:]' | sort -f | uniq -i > new_file.conf` - -`$ comm -23 new_file.conf allowlist.conf > disposable_email_blocklist.conf` - -to add contents of another file in the same format (only second level domains on new line without @). It also converts uppercase to lowercase, sorts, removes duplicates and removes allowlisted domains. +Please add new disposable domains directly into [disposable_email_blocklist.conf](disposable_email_blocklist.conf) in the same format (only second level domains on new line without @), then run [maintain.sh](maintain.sh). The shell script will help you convert uppercase to lowercase, sort, remove duplicates and remove allowlisted domains. Changelog ============ diff --git a/maintain.sh b/maintain.sh new file mode 100644 index 0000000..10f2019 --- /dev/null +++ b/maintain.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Unify locale settings temporarily to make sort produce the same order +LC_ALL=C +export LC_ALL + +# Converts uppercase to lowercase, sorts, removes duplicates and removes allowlisted domains +cat disposable_email_blocklist.conf | tr '[:upper:]' '[:lower:]' | sort -f | uniq -i > temp.conf +comm -23 temp.conf allowlist.conf > disposable_email_blocklist.conf + +rm temp.conf +echo "Done!"