Remove tabs-permission (amo - Firefox 86+)

This commit is contained in:
magnolia1234 2021-12-15 17:44:52 +01:00
parent 3cec5729b9
commit d81a4f928b
6 changed files with 30 additions and 10 deletions

View file

@ -18,6 +18,7 @@ Weekly updates are released for fixes and new sites.
### Installation
You can install the add-on from Mozilla add-ons (AMO): [Bypass Paywalls Clean](https://addons.mozilla.org/en-US/firefox/addon/bypass-paywalls-clean)\
Latest add-on versions (2.4.8.0+) require a browser based on Firefox 86+ (else use the non-amo version below).\
Or download and install the latest xpi-version from [GitLab](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/releases)\
By default BPC has limited permissions, but you can opt-in to enable custom sites (and also clear cookies/block general paywall-scripts for non-listed sites).

View file

@ -34,6 +34,7 @@ const restrictions = {
'seekingalpha.com': /.+\/seekingalpha\.com\/($|(amp\/)?(article|news)\/|samw\/)/,
'statista.com': /^((?!\.statista\.com\/(outlook|study)\/).)*$/,
'techinasia.com': /\.techinasia\.com\/.+/,
'theaustralian.com.au': /^((?!todayspaper\.theaustralian\.com\.au\/).)*$/,
'theglobeandmail.com': /\.theglobeandmail\.com\/.+\//,
'timeshighereducation.com': /.+\.timeshighereducation\.com\/((features|news|people)\/|.+((\w)+(\-)+){3,}.+|sites\/default\/files\/)/
}
@ -795,7 +796,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
active: true,
currentWindow: true
}, function (tabs) {
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
ext_api.tabs.executeScript({
file: 'options/toggleIcon.js',
runAt: 'document_start'
@ -972,7 +973,7 @@ if (matchUrlDomain(change_headers, details.url) && !['font', 'image', 'styleshee
active: true,
currentWindow: true
}, function (tabs) {
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
if (isSiteEnabled({url: tabs[0].url})) {
ext_api.tabs.executeScript({
file: 'contentScript.js',
@ -1033,7 +1034,8 @@ function updateBadge(activeTab) {
ext_api.browserAction.setBadgeBackgroundColor({color: color});
ext_api.browserAction.setBadgeText({text: badgeText});
}
}
} else
ext_api.browserAction.setBadgeText({text: badgeText});
}
var ext_version_new;
@ -1066,7 +1068,7 @@ function site_switch() {
active: true,
currentWindow: true
}, function (tabs) {
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
let currentUrl = tabs[0].url;
let isDefaultSite = matchUrlDomain(defaultSites_grouped_domains, currentUrl);
if (!isDefaultSite) {
@ -1119,7 +1121,7 @@ function remove_cookies_fn(domainVar, exclusions = false) {
active: true,
currentWindow: true
}, function (tabs) {
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
if (ext_api.runtime.lastError)
return;
let tabId = tabs[0].id;
@ -1187,7 +1189,7 @@ function clear_cookies() {
active: true,
currentWindow: true
}, function (tabs) {
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
ext_api.tabs.executeScript({
file: 'options/clearCookies.js',
runAt: 'document_start'
@ -1223,7 +1225,7 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
active: true,
currentWindow: true
}, function (tabs) {
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
let currentUrl = tabs[0].url;
let domain;
let isExcludedSite = matchUrlDomain(excludedSites, currentUrl);
@ -1371,7 +1373,7 @@ function refreshCurrentTab() {
active: true,
currentWindow: true
}, function (tabs) {
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
if (ext_api.runtime.lastError)
return;
ext_api.tabs.update(tabs[0].id, {

View file

@ -5,6 +5,7 @@ Post-release
Add LaLibre.be
Add LeVif.be
Fix Bloomberg (permission block js)
Remove tabs-permission (amo - Firefox 86+)
* v2.4.7.0 (2021-12-12)
Add Koelner Stadt-Anzeiger & Koelnische Rundschau

View file

@ -3,7 +3,7 @@
"scripts": ["sites.js", "bpc_count_daily_users.js", "background.js"]
},
"content_security_policy": "script-src 'self'; object-src 'self'",
"applications": {
"browser_specific_settings": {
"gecko": {
"id": "magnolia@12.34",
"update_url": "https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/raw/master/updates.json"
@ -589,5 +589,5 @@
"*://*.wallkit.net/*",
"*://*.wsj.net/*"
],
"version": "2.4.7.2"
"version": "2.4.7.3"
}

View file

@ -33,6 +33,7 @@
<small><button><a href="options_excluded.html" style="text-decoration:none;color:inherit">Excluded sites</a></button></small>
<small><button><a href="#save" style="text-decoration:none;color:inherit">Go to save</a></button></small>
</div>
<strong><div id="perm-custom"></div></strong>
<div style="clear:both;"></div>
<br>
<div id='bypass_sites'></div>

View file

@ -38,7 +38,22 @@ function renderOptions() {
}, function (items) {
var sites = items.sites;
var sites_updated = items.sites_updated;
var sites_updated_domains = Object.values(sites_updated).filter(x => x.domain && !defaultSites_domains.includes(x.domain)).map(x => x.domain);
var sites_custom = items.sites_custom;
var sites_custom_domains = Object.values(sites_custom).filter(x => x.domain).map(x => x.domain);
var perm_origins = sites_custom_domains.concat(sites_updated_domains).map(x => '*://*.' + x + '/*');
var perm_custom = document.getElementById('perm-custom');
ext_api.permissions.contains({
origins: perm_origins
}, function (result) {
if (result) {
perm_custom.innerText = '';
} else {
perm_custom.textContent = ">> check permissions for custom/updated sites";
}
});
var sites_excluded = items.sites_excluded;
var sitesEl = document.getElementById('bypass_sites');
var site_types = {