Update custom sites (block_host_perm_add)

This commit is contained in:
magnolia1234 2024-03-01 17:42:36 +01:00
parent 4693caae92
commit 2bd3237c48
6 changed files with 29 additions and 18 deletions

View File

@ -1038,11 +1038,12 @@ By default sites' cookies/local storage are blocked/removed (for example to bypa
Additional custom options:
* allow/remove cookies (no options selected: cookies are blocked)
* set useragent to Googlebot, Bingbot or Facebookbot
* set referer (to Facebook, Google or Twitter; ignored when Googlebot is set)
* set useragent to Googlebot, Bingbot, Facebookbot or custom
* set referer (to Facebook, Google, Twitter or custom; ignored when Googlebot is set)
* set random ip-address
* disable Javascript for (sub)domain(s), external domains (when host permission) and/or inline scripts
* block regular expression (to block specific script and/or xhr)
* block_host_perm_add: add additinal host permission(s) for blocked content
* unhide text amp-page
* redirect to amp-page when paywall(selector)
* load text from json when paywall|article(selector)

View File

@ -13,6 +13,7 @@ Fix Medscape (js)
Fix Project Syndicate (no article)
Fix Times of India (epaper)
Maintenance updated sites (removed)
Update custom sites (block_host_perm_add)
* v3.5.7.0 (2024-02-25)
Add Canarias7.es (Grupo Vocento)

View File

@ -152,6 +152,11 @@
"Connexionfrance.com": {
"domain": "connexionfrance.com"
},
"Craftscouncil.org.uk": {
"allow_cookies": 1,
"block_regex": "\\/steadyhq\\.com",
"domain": "craftscouncil.org.uk"
},
"Dailyherald.com": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com",
@ -205,11 +210,6 @@
"domain": "endpts.com",
"ld_json_url": "div.epn_limit|div.epn_content"
},
"Energy-storage.news": {
"allow_cookies": 1,
"domain": "energy-storage.news",
"ld_json_url": "div.wkwp-paywall|div.wpwp-non-paywall"
},
"Engineersireland.ie": {
"allow_cookies": 1,
"cs_code": "[{\"cond\":\"div.free-wrapper\", \"rm_elem\":1, \"elems\":[{\"cond\":\"div.article-body[style]\", \"rm_attrib\":\"style\"}]}]",
@ -305,6 +305,12 @@
"domain": "group_nation_media",
"group": "monitor.co.ug,nation.africa,thecitizen.co.tz"
},
"Group_uk_solar_media": {
"allow_cookies": 1,
"domain": "group_uk_solar_media",
"group": "energy-storage.news,pv-tech.org",
"ld_json_url": "div.wkwp-paywall|div.wpwp-non-paywall"
},
"Group_van_magazine": {
"allow_cookies": 1,
"domain": "group_van_magazine",
@ -627,11 +633,6 @@
"domain": "pv-digest.de",
"useragent": "googlebot"
},
"Pv-tech.org": {
"allow_cookies": 1,
"domain": "pv-tech.org",
"ld_json_url": "div.wkwp-paywall|div.wpwp-non-paywall"
},
"Quickmath.com": {
"domain": "quickmath.com"
},

View File

@ -24,7 +24,8 @@
<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 bottom</a></button></small>
</div>
<strong><div id="perm-custom"></div></strong>
<div style="clear:both;"></div>
<strong style="color:red;"><div id="perm-custom"></div></strong>
<div style="clear:both;"></div>
<br>
<div id="status_top"></div>

View File

@ -42,10 +42,12 @@ function renderOptions() {
return !val.nofix
});
var sites_updated_domains_new = Object.values(sites_updated).filter(x => (x.domain && !defaultSites_domains.includes(x.domain) || x.group)).map(x => x.group ? x.group.filter(y => !defaultSites_domains.includes(y)) : x.domain).flat();
var sites_updated_perm_domains_new = Object.values(sites_updated).filter(x => x.block_host_perm_add).map(x => x.block_host_perm_add.split(',').filter(x => x).map(x => x.trim())).flat();
var sites_custom = items.sites_custom;
var sites_custom_domains_new = Object.values(sites_custom).filter(x => x.domain && !defaultSites_domains.includes(x.domain)).map(x => x.group ? x.group.split(',').map(x => x.trim()) : x.domain).flat();
var sites_custom_perm_domains_new = Object.values(sites_custom).filter(x => x.block_host_perm_add).map(x => x.block_host_perm_add.split(',').filter(x => x).map(x => x.trim())).flat();
var perm_origins = sites_custom_domains_new.concat(sites_updated_domains_new).filter(x => !x.includes('###')).map(x => '*://*.' + x + '/*');
var perm_origins = sites_custom_domains_new.concat(sites_updated_domains_new, sites_custom_perm_domains_new, sites_updated_perm_domains_new).filter(x => !x.includes('###')).map(x => '*://*.' + x + '/*');
var perm_custom = document.getElementById('perm-custom');
ext_api.permissions.contains({
origins: perm_origins
@ -53,7 +55,7 @@ function renderOptions() {
if (result) {
perm_custom.innerText = '';
} else {
perm_custom.textContent = ">> check permissions for custom/updated sites";
perm_custom.textContent = ">> check host (domain) permissions for custom/updated sites";
}
});

View File

@ -166,7 +166,7 @@ function add_options() {
if (elem.checked)
sites_custom[title][elem.dataset.key] = parseInt(elem.dataset.value);
} else if (elem.value) {
if (elem.dataset.key === 'group')
if (['block_host_perm_add', 'group'].includes(elem.dataset.key))
elem.value = elem.value.replace(/,{2,}/g, ',').replace(/(\s|www\.|,$)/g, '');
sites_custom[title][elem.dataset.key] = elem.value;
}
@ -281,6 +281,7 @@ function edit_options() {
document.querySelector('input[data-key="block_js_ext"]').checked = (edit_site.block_js_ext > 0 || edit_site.block_javascript_ext > 0);
document.querySelector('input[data-key="block_js_inline"]').value = edit_site.block_js_inline || '';
document.querySelector('input[data-key="block_regex"]').value = edit_site.block_regex || '';
document.querySelector('input[data-key="block_host_perm_add"]').value = edit_site.block_host_perm_add || '';
document.querySelector('input[data-key="amp_unhide"]').checked = (edit_site.amp_unhide > 0);
document.querySelector('input[data-key="amp_redirect"]').value = edit_site.amp_redirect || '';
document.querySelector('input[data-key="ld_json"]').value = edit_site.ld_json || '';
@ -329,10 +330,12 @@ function renderOptions() {
}, function (items) {
var sites_custom = sortJson(items.sites_custom);
var sites_custom_domains_new = Object.values(sites_custom).filter(x => x.domain && !defaultSites_domains.includes(x.domain)).map(x => x.group ? x.group.split(',').filter(x => x).map(x => x.trim()) : x.domain).flat();
var sites_custom_perm_domains_new = Object.values(sites_custom).filter(x => x.block_host_perm_add).map(x => x.block_host_perm_add.split(',').filter(x => x).map(x => x.trim())).flat();
var sites_updated = filterObject(items.sites_updated, function (val, key) {
return !val.nofix
});
var sites_updated_domains_new = Object.values(sites_updated).filter(x => (x.domain && !defaultSites_domains.includes(x.domain) || x.group)).map(x => x.group ? x.group.filter(y => !defaultSites_domains.includes(y)) : x.domain).flat();
var sites_updated_perm_domains_new = Object.values(sites_updated).filter(x => x.block_host_perm_add).map(x => x.block_host_perm_add.split(',').filter(x => x).map(x => x.trim())).flat();
var sitesEl = document.getElementById('bypass_sites');
sitesEl.innerHTML = '';
var labelEl = document.createElement('label');
@ -362,6 +365,7 @@ function renderOptions() {
'block_js_ext': 1,
'block_js_inline': 0,
'block_regex': 0,
'block_host_perm_add': 0,
'amp_unhide': 1,
'amp_redirect': 0,
'ld_json': 0,
@ -408,6 +412,7 @@ function renderOptions() {
group: 'example1.com,example2.com',
block_js_inline: '\\.example\\.com\\/article\\/',
block_regex: '\\.example\\.com\\/js\\/',
block_host_perm_add: 'example1.com,example2.com',
amp_redirect: 'div.paywall',
ld_json: 'div.paywall|div.article',
ld_json_next: 'div.paywall|div.article',
@ -476,11 +481,11 @@ function renderOptions() {
if (sites_updated_domains_new.length > 0) {
labelEl = document.createElement('p');
labelEl.appendChild(document.createElement('label'));
labelEl.appendChild(document.createTextNode('Updated sites: ' + sites_updated_domains_new.join()));
labelEl.appendChild(document.createTextNode('Updated sites: ' + sites_updated_domains_new.concat(sites_updated_perm_domains_new).join(', ')));
custom_sitesEl.appendChild(labelEl);
}
perm_origins = sites_custom_domains_new.concat(sites_updated_domains_new).filter(x => !x.includes('###')).map(x => '*://*.' + x + '/*');
perm_origins = sites_custom_domains_new.concat(sites_updated_domains_new, sites_custom_perm_domains_new, sites_updated_perm_domains_new).filter(x => !x.includes('###')).map(x => '*://*.' + x + '/*');
var perm_custom = document.getElementById('perm-custom');
ext_api.permissions.contains({
origins: perm_origins