Implemented: Wildcard support for allowlist (#233)

This commit is contained in:
nobody 2021-01-14 06:42:37 +01:00
parent 12fa6f6700
commit 4e71732c15
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
5 changed files with 21 additions and 4 deletions

View File

@ -29,7 +29,7 @@ var requestAnalyzer = {};
*/
requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) {
let initiatorDomain, isAllowlisted;
let initiatorDomain, isAllowlisted, sDomain;
initiatorDomain = helpers.extractDomainFromUrl(tabDetails.url, true);
@ -37,7 +37,15 @@ requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) {
initiatorDomain = Address.EXAMPLE;
}
sDomain = initiatorDomain.split(".");
if (sDomain.length <= 2) {
isAllowlisted = requestAnalyzer.allowlistedDomains[initiatorDomain];
} else {
sDomain[0] = '*';
sDomain = sDomain.join().replace(/,/g, '.');
isAllowlisted = requestAnalyzer.allowlistedDomains[sDomain];
}
if (isAllowlisted) {
return false;

View File

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "LocalCDN",
"version": "2.5.14",
"version": "2.6.0",
"browser_specific_settings": {
"gecko": {
"id": "{b86e4813-687a-43e6-ab65-0bde4ab75758}",

View File

@ -94,6 +94,11 @@ body {
margin-right: 10px;
}
.monoblock {
font-family: monospace;
font-style: normal;
}
/**
* Fonts
*/

View File

@ -88,7 +88,10 @@
<section class="option">
<div class="title-option without-checkbox" data-i18n-content="allowlistedDomainsTitle">Deactivate LocalCDN for these domains:</div>
<input id="tf-domains-allowlist" class="input-text without-checkbox" data-option="allowlistedDomains" type="text">
<div class="description-option without-checkbox" data-i18n-content="allowlistedDomainsDescription">Enter domains to disable LocalCDN there. Separate multiple entries with semi-colons (;).</div>
<div class="description-option without-checkbox">
<span data-i18n-content="allowlistedDomainsDescription">Enter domains to disable LocalCDN there. Separate multiple entries with semi-colons (;).</span><br><br>
<span class="monoblock">domain.com;<br>sub.domain.com;<br>*.wildcard-domain.com;</span>
</div>
</section>
</div>
</div>

View File

@ -37,6 +37,7 @@
<li>Updated: MDB UI Kit v3.1.0 (<a href="https://codeberg.org/nobody/LocalCDN/issues/230">#230</a>)</li>
<li>Updated: jquery-validate v1.19.2 -> v1.19.3 (<a href="https://codeberg.org/nobody/LocalCDN/issues/231">#231</a>)</li>
<li>Updated: Font Awesome v5.15.1 -> v5.15.2 (<a href="https://codeberg.org/nobody/LocalCDN/issues/232">#232</a>)</li>
<li>Implemented: Wildcard support for allowlist (<a href="https://codeberg.org/nobody/LocalCDN/issues/232">#233</a>)</li>
</ul>
<div id="generator-section">
<div class="topic-label">