Update custom sites (optional: only permissions for added sites)

merge-requests/1/head
magnolia1234 3 years ago
parent 1b37be288f
commit 67b7cf4fc7

@ -581,7 +581,8 @@ Remember to check the [previous requests](https://gitlab.com/magnolia1234/bypass
### Add custom site
Add your own custom site (also for testing).
Check 'Options'-link in popup-menu and go to custom sites.
\* by default BPC has limited permissions, but you can opt-in to enable custom sites (and also clear cookies for non-listed sites).
\* by default BPC has limited permissions, but you can opt-in to enable custom sites (and also clear cookies for non-listed sites). You can also just request permissions for the custom sites you added yourself.
Make sure the (new) site is checked under Options (or check on/off-button).
By default sites' cookies/local storage are removed after page loads (to bypass article limit).
Also you can enable Googlebot user-agent, disable Javascript for (sub)domain(s)/external sources and/or set the referer (to Facebook, Google or Twitter; ignored when Googlebot is set).

@ -295,7 +295,7 @@ var blockedRegexes = {
'financialpost.com': /\.tinypass\.com\//,
'folha.uol.com.br': /(\.folha\.uol\.com\.br\/paywall\/js\/.+\/publicidade\.ads\.js|paywall\.folha\.uol\.com\.br\/|js\.matheranalytics\.com\/)/,
'foreignaffairs.com': /\.foreignaffairs\.com\/sites\/default\/files\/js\/js_[^y].+\.js/,
'foreignpolicy.com': /\.tinypass\.com\//,
'foreignpolicy.com': /(cdn\.cxense\.com\/|\.tinypass\.com\/)/,
'fortune.com': /\.tinypass\.com\//,
'freiepresse.de': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/,
'ftm.nl': /\.ftm\.nl\/js\/routing\?/,
@ -1190,7 +1190,7 @@ function updateBadge(activeTab) {
let isCustomSite = matchUrlDomain(customSites_domains, currentUrl);
if (!isDefaultSite && isCustomSite) {
ext_api.permissions.contains({
origins: ["<all_urls>"]
origins: ['*://*.' + isCustomSite + '/*']
}, function (result) {
if (!result)
badgeText = '';

@ -4,6 +4,7 @@ Changelog Bypass Paywalls Clean - Firefox
Post-release
Add Levante-EMV (Spain)
Add The New Atlantis
Update custom sites (optional: only permissions for added sites)
* v2.1.8.0 (2021-04-25)
Add Il Giorno (Italy)

@ -504,5 +504,5 @@
"*://*.wallkit.net/*",
"*://*.wsj.net/*"
],
"version": "2.1.8.2"
"version": "2.1.8.3"
}

@ -32,6 +32,7 @@
<button id="custom-enable">Enable</button>
<button id="custom-disable">Disable</button>
</div>
<p>You can also just request permissions for the <a href="../options_custom.html">custom sites</a> you added yourself.</p>
</div>
<p>
<div style='float:left;padding-bottom:50px'>

@ -21,9 +21,10 @@
<div style="width:90%;">
To add a new site, enter an unique title/domain (without www.), select options for Googlebot/block Javascript (block on (sub)domain(s) of site and/or external domains) and/or set referer (ignored when Googlebot is set).<br>
Custom sites are enabled automatically in <small><button><a href="options.html" style="text-decoration:none;color:inherit">Options</a></button></small> (cookies will be removed by default unless you enable allow_cookies).<br>
If you want to use custom sites (for non-listed sites) enable it in <small><button><a href="optin/opt-in.html" style="text-decoration:none;color:inherit">Opt-in</a></button></small><br>
On Android: to enable custom sites you need the 'custom' add-on version (with access to all sites): <a href="https://addons.mozilla.org/en-US/firefox/addon/bypass-paywalls-clean-custom" target="_blank">Bypass Paywalls Clean (custom)</a><br>
<strong>Custom sites enabled: <span id="custom-enabled"></span></strong>
If you want to use custom sites (for non-listed sites) enable it in <small><button><a href="optin/opt-in.html" style="text-decoration:none;color:inherit">Opt-in</a></button></small>
<strong>Custom sites enabled: <span id="custom-enabled"></span></strong><br>
You can also just request permissions for the custom sites you added yourself (below).<br>
On Android: to enable custom sites you need the 'custom' add-on version (with access to all sites): <a href="https://addons.mozilla.org/en-US/firefox/addon/bypass-paywalls-clean-custom" target="_blank">Bypass Paywalls Clean (custom)</a>
<br><br>
</div>
<div id='add_site'></div>
@ -44,6 +45,9 @@
<span style='float:left;padding-bottom:5px'>
<button id="delete">Delete</button>
<button id="edit">Edit (re-Add)</button>
<button id="perm_request">Request<br>permissions</button>
<button id="perm_remove">Remove<br>permissions</button>
permissions granted (for all in custom list): <strong><span id="perm-custom"></span></strong>
</span>
<div style="clear:both;"></div>
<div style="width:90%;">

@ -184,6 +184,38 @@ function edit_options() {
});
}
// request permissions for custom sites (in list only)
function request_permissions() {
var perm_custom = document.getElementById('perm-custom');
ext_api.permissions.request({
origins: perm_origins
}, function (granted) {
if (granted) {
perm_custom.innerText = 'YES';
} else {
perm_custom.innerText = 'NO';
}
});
}
// remove permissions for custom sites
function remove_permissions() {
var perm_custom = document.getElementById('perm-custom');
var custom_enabled = document.getElementById('custom-enabled');
ext_api.permissions.remove({
origins: ["<all_urls>"]
}, function (removed) {
if (removed) {
perm_custom.innerText = 'NO';
custom_enabled.innerText = 'NO';
ext_api.storage.local.set({
"customOptIn": false
});
}
});
}
var perm_origins;
// Restores checkbox input states using the preferences stored in ext_api.storage.
function renderOptions() {
ext_api.storage.local.get({
@ -250,9 +282,11 @@ function renderOptions() {
selectEl.id = 'sites';
selectEl.size = 6;
var optionEl;
perm_origins = [];
for (var key in sites_custom) {
optionEl = document.createElement('option');
let domain = sites_custom[key]['domain'];
perm_origins.push('*://*.' + domain + '/*');
let isDefaultSite = defaultSites_domains.includes(domain);
optionEl.text = isDefaultSite ? '*' : '';
optionEl.text += key + ': ' + domain +
@ -266,6 +300,17 @@ function renderOptions() {
}
labelEl.appendChild(selectEl);
custom_sitesEl.appendChild(labelEl);
var perm_custom = document.getElementById('perm-custom');
ext_api.permissions.contains({
origins: perm_origins
}, function (result) {
if (result) {
perm_custom.innerText = 'YES';
} else {
perm_custom.innerText = 'NO';
}
});
});
var custom_enabled = document.getElementById('custom-enabled');
@ -288,4 +333,6 @@ document.getElementById('import').onclick = function () {importInput.click()}
document.getElementById('importInput').addEventListener("change", import_options, false);
document.getElementById('add').addEventListener('click', add_options);
document.getElementById('delete').addEventListener('click', delete_options);
document.getElementById('edit').addEventListener('click', edit_options);
document.getElementById('edit').addEventListener('click', edit_options);
document.getElementById('perm_request').addEventListener('click', request_permissions);
document.getElementById('perm_remove').addEventListener('click', remove_permissions);

Loading…
Cancel
Save