Remove tabs-permission (Chrome 50+)

This commit is contained in:
magnolia1234 2021-12-15 17:44:17 +01:00
parent 3e654de8b7
commit 5a1891aa2f
6 changed files with 29 additions and 12 deletions

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 (Chrome 50+)
* v2.4.7.0 (2021-12-12)
Add Koelner Stadt-Anzeiger & Koelnische Rundschau

View File

@ -34,10 +34,9 @@
"permissions": [
"cookies",
"storage",
"tabs",
"webRequest",
"webRequestBlocking",
"<all_urls>"
],
"version": "2.4.7.2"
"version": "2.4.7.3"
}

View File

@ -37,7 +37,6 @@
"permissions": [
"cookies",
"storage",
"tabs",
"webRequest",
"webRequestBlocking",
"*://*.360dx.com/*",
@ -577,5 +576,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 = {