Allow TLD blocking using ABP style (#5240)

This commit is contained in:
Adam Warner 2023-03-29 21:48:15 +01:00 committed by GitHub
commit 56eae4afbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -549,10 +549,15 @@ parseList() {
# define valid domain patterns
# no need to include uppercase letters, as we convert to lowercase in gravity_ParseFileIntoDomains() already
# adapted from https://stackoverflow.com/a/30007882
# supported ABP style: ||subdomain.domain.tlp^
valid_domain_pattern="([a-z0-9]([a-z0-9_-]{0,61}[a-z0-9]){0,1}\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]"
abp_domain_pattern="\|\|${valid_domain_pattern}\^"
TLD_pattern="[a-z0-9][a-z0-9-]{0,61}[a-z0-9]"
subdomain_pattern="([a-z0-9]([a-z0-9_-]{0,61}[a-z0-9]){0,1}\.)"
valid_domain_pattern="${subdomain_pattern}+${TLD_pattern}"
# supported ABP style: ||subdomain.domain.tld^
# ${subdomain_pattern} is optional for ABP style, allowing TLD blocking: ||tld^
abp_domain_pattern="\|\|${subdomain_pattern}*${TLD_pattern}\^"
# A list of items of common local hostnames not to report as unusable
# Some lists (i.e StevenBlack's) contain these as they are supposed to be used as HOST files