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) { requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) {
let initiatorDomain, isAllowlisted; let initiatorDomain, isAllowlisted, sDomain;
initiatorDomain = helpers.extractDomainFromUrl(tabDetails.url, true); initiatorDomain = helpers.extractDomainFromUrl(tabDetails.url, true);
@ -37,7 +37,15 @@ requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) {
initiatorDomain = Address.EXAMPLE; initiatorDomain = Address.EXAMPLE;
} }
isAllowlisted = requestAnalyzer.allowlistedDomains[initiatorDomain];
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) { if (isAllowlisted) {
return false; return false;

View File

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

View File

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

View File

@ -88,7 +88,10 @@
<section class="option"> <section class="option">
<div class="title-option without-checkbox" data-i18n-content="allowlistedDomainsTitle">Deactivate LocalCDN for these domains:</div> <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"> <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> </section>
</div> </div>
</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: 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: 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>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> </ul>
<div id="generator-section"> <div id="generator-section">
<div class="topic-label"> <div class="topic-label">