diff --git a/modules/internal/helpers.js b/modules/internal/helpers.js index bc321c70..6ea2809b 100644 --- a/modules/internal/helpers.js +++ b/modules/internal/helpers.js @@ -175,11 +175,17 @@ helpers.getWildcard = function (initiatorDomain) { domain = domain.join().replace(/,/g, '.'); return domain; } +}; +helpers.getTopLevelDomain = function (initiatorDomain) { + let domain = initiatorDomain.split('.'); + + domain[domain.length - 2] = '*'; + return `${domain[domain.length - 2]}.${domain[domain.length - 1]}`; }; helpers.checkAllowlisted = function (domain, list) { - let domainWithoutPrefix, wildcard; + let domainWithoutPrefix, wildcard, tld; if (domain === null) { return false; @@ -189,8 +195,13 @@ helpers.checkAllowlisted = function (domain, list) { domainWithoutPrefix = domain.slice(Address.WWW_PREFIX.length); } wildcard = helpers.getWildcard(domain); + tld = helpers.getTopLevelDomain(domain); - return Boolean(list[domain] || list[domainWithoutPrefix] || list[wildcard] || list[domainWithoutPrefix]); + return Boolean(list[domain] || + list[domainWithoutPrefix] || + list[wildcard] || + list[domainWithoutPrefix] || + list[tld]); }; helpers.extractFilenameFromPath = function (path) { diff --git a/pages/options/options.html b/pages/options/options.html index d05e4268..176748f2 100644 --- a/pages/options/options.html +++ b/pages/options/options.html @@ -111,6 +111,7 @@ example.com
sub.example.com
*.example.com
+ *.com
https://example.com
https://*.example.com
https://example.com/page/example.html @@ -163,6 +164,7 @@ example.com
sub.example.com
*.example.com
+ *.com
https://example.com
https://*.example.com
https://example.com/page/example.html @@ -202,6 +204,7 @@ example.com
sub.example.com
*.example.com
+ *.com
https://example.com
https://*.example.com
https://example.com/page/example.html diff --git a/pages/updates/updates.html b/pages/updates/updates.html index 8340e3c6..e55e80cd 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -25,9 +25,9 @@

New in LocalCDN:

-

+

Improved