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 <hollowman@hollowman.ml>

* Add a shell script for maintaining disposable_email_blocklist.conf

Signed-off-by: Hollow Man <hollowman@hollowman.ml>

* Remove redundant lines in README.md

Signed-off-by: Hollow Man <hollowman@hollowman.ml>
This commit is contained in:
Hollow Man 2021-02-26 13:10:35 +08:00 committed by GitHub
parent d21a575288
commit 717f7f7ab2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions

View File

@ -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. 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: 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.
`$ 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.
Changelog Changelog
============ ============

12
maintain.sh Normal file
View File

@ -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!"