Update custom sites (default block cookies)

merge-requests/10/head
magnolia1234 1 year ago
parent 6e1a06dbf0
commit f1493a5c76

@ -867,8 +867,20 @@ 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/block general paywall-scripts for non-listed sites). You can also just request permissions for the custom sites you added yourself (or `clear cookies` (BPC-icon) to ask for permission for current site).
By default sites' cookies/local storage are removed after page loads (to bypass article limit).
Also you can enable Googlebot/Bingbot user-agent, set referer (to Facebook, Google or Twitter; ignored when Googlebot is set), set random ip-address, disable Javascript for (sub)domain(s) and/or external domains, block regular expression, unhide text on (or when paywall(selector) redirect to) amp-page and/or load text from json or Google webcache (paywall|article selector).
By default sites' cookies/local storage are blocked/removed (for example to bypass article limit when metered paywall).
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 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)
* unhide text amp-page
* redirect to amp-page when paywall(selector)
* load text from json when paywall|article(selector)
* load text from Google webcache when paywall|article(selector)
* remove/unhide elements in dom (optional for dev; check examples)
[Example list of custom sites](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/blob/master/custom/sites_custom.json) or [download list (json)](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/raw/master/custom/sites_custom.json)
@ -885,7 +897,7 @@ You can also exclude a specific domain which is grouped in options.
* [Download the latest version](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/releases)
### License
Bypass Paywalls Clean is [MIT-licensed](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/blob/master/LICENSE).
* Bypass Paywalls Clean is [MIT-licensed](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/blob/master/LICENSE).
### Disclaimer
* This software is provided for educational purposes only and is provided "AS IS", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

@ -234,7 +234,7 @@ function set_rules(sites, sites_updated, sites_custom) {
custom = true;
}
}
addCookieRules(rule, custom || custom_in_group);
addCookieRules(rule);
if (rule.allow_cookies > 0 && !allow_cookies.includes(domain))
allow_cookies.push(domain);

@ -7,6 +7,7 @@ Fix LesEchos.fr (investir)
Fix National Review (no amp)
Fix The Athletic (error)
Remove Repubblica.it (fix obsolete)
Update custom sites (default block cookies)
* v3.0.0.0 (2023-01-08)
Add Deutscher Fachverlag Mediengruppe (opt-in to custom sites)

@ -2745,19 +2745,23 @@ else if (matchDomain('bqprime.com')) {
if (window.location.pathname.startsWith('/amp/')) {
amp_unhide_subscr_section('.ad-container');
} else {
if (!window.location.search.startsWith('?rel=geo_block')) {
window.setTimeout(function () {
let geo_block = document.querySelector('div[class*="geotag-container_"]');
window.setTimeout(function () {
let geo_block = document.querySelector('div[class*="geotag-container_"]');
if (!window.location.search.startsWith('?rel=geo_block')) {
if (geo_block) {
removeDOMElement(geo_block);
window.location.href = window.location.pathname + '?rel=geo_block';
}
}, 1000);
} else {
let hidden_images = document.querySelectorAll('img[src^="data:image/"][data-src]');
for (let elem of hidden_images)
elem.setAttribute('src', elem.getAttribute('data-src'));
}
} else {
if (geo_block)
refreshCurrentTab();
else {
let hidden_images = document.querySelectorAll('img[src^="data:image/"][data-src]');
for (let elem of hidden_images)
elem.setAttribute('src', elem.getAttribute('data-src'));
}
}
}, 1000);
}
let ads = document.querySelectorAll('.responsive-ad');
removeDOMElement(...ads);

@ -133,11 +133,15 @@ function getCookieDomain(hostname) {
let n = 0;
let parts = hostname.split('.');
let str = '_gd' + (new Date()).getTime();
try {
while (n < (parts.length - 1) && document.cookie.indexOf(str + '=' + str) == -1) {
domain = parts.slice(-1 - (++n)).join('.');
document.cookie = str + "=" + str + ";domain=" + domain + ";";
}
document.cookie = str + "=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain=" + domain + ";";
} catch (e) {
console.log(e);
}
return domain;
}

@ -1,4 +1,9 @@
{
"Abajournal.com": {
"allow_cookies": 1,
"block_regex": "\\.piano\\.io",
"domain": "abajournal.com"
},
"Arkansasonline.com": {
"domain": "arkansasonline.com"
},
@ -105,6 +110,11 @@
"block_regex": "\\.tinypass\\.com",
"domain": "fastcompany.com"
},
"Finansavisen.no": {
"allow_cookies": 1,
"domain": "finansavisen.no",
"useragent": "googlebot"
},
"Finanz-szene.de": {
"allow_cookies": 1,
"domain": "finanz-szene.de",
@ -185,6 +195,11 @@
"domain": "kaleva.fi",
"useragent": "googlebot"
},
"Kapital.no": {
"allow_cookies": 1,
"domain": "kapital.no",
"useragent": "googlebot"
},
"Lindipendente.online": {
"allow_cookies": 1,
"domain": "lindipendente.online",
@ -219,7 +234,9 @@
"domain": "marketscreener.com"
},
"Medpagetoday.com": {
"domain": "medpagetoday.com"
"allow_cookies": 1,
"domain": "medpagetoday.com",
"remove_cookies": 1
},
"Milesplit.com": {
"allow_cookies": 1,
@ -330,9 +347,6 @@
"amp_redirect": "div#story-notification",
"domain": "swarajyamag.com"
},
"The-japan-news.com": {
"domain": "the-japan-news.com"
},
"The-past.com": {
"domain": "the-past.com"
},

@ -720,5 +720,5 @@
"*://*.wallkit.net/*",
"*://webcache.googleusercontent.com/*"
],
"version": "3.0.0.4"
"version": "3.0.0.5"
}

@ -1,7 +1,11 @@
var ext_api = (typeof browser === 'object') ? browser : chrome;
try {
window.localStorage.clear();
sessionStorage.clear();
} catch (e) {
console.log(e);
}
var cookie_domain = getCookieDomain(document.domain);
@ -18,11 +22,15 @@ function getCookieDomain(hostname) {
let n = 0;
let parts = hostname.split('.');
let str = '_gd' + (new Date()).getTime();
try {
while (n < (parts.length - 1) && document.cookie.indexOf(str + '=' + str) == -1) {
domain = parts.slice(-1 - (++n)).join('.');
document.cookie = str + "=" + str + ";domain=" + domain + ";";
}
document.cookie = str + "=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain=" + domain + ";";
} catch (e) {
console.log(e);
}
return domain;
}

@ -10,8 +10,8 @@
<h2>Custom Sites</h2>
<div style="width:90%;">
To add a new site, enter an unique title/domain (without www.).<br>
Select options for useragent (like Googlebot), set referer (ignored when Googlebot is set), set random ip-address, block Javascript, block regular expression, unhide text on amp-page (or redirect to it) and/or load text from json or Google webcache (paywall|article selector); for examples import from GitLab.<br>
Custom sites (new) 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>
Select options below (<a href="https://gitlab.com/magnolia1234/bypass-paywalls-chrome-clean#add-custom-site" target="_blank">see GitLab help</a>; for examples import from GitLab.<br>
Custom sites (new) are enabled automatically in <small><button><a href="options.html" style="text-decoration:none;color:inherit">Options</a></button></small> (cookies will be blocked 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>
<strong>Custom sites enabled: <span id="custom-enabled"></span></strong><br>
You can also just request permissions for the custom sites & post-release added sites (below).<br>

@ -171,6 +171,8 @@ function delete_options() {
var selectEl = document.querySelector('#custom_sites select');
var sites_custom = {};
var remove_key = selectEl.value;
if (!remove_key)
return false;
// delete site from local storage
ext_api.storage.local.get({
@ -198,6 +200,8 @@ function edit_options() {
var selectEl = document.querySelector('#custom_sites select');
var sites_custom = {};
var title = selectEl.value;
if (!title)
return false;
// copy site to add-fields
ext_api.storage.local.get({
@ -209,6 +213,7 @@ function edit_options() {
document.querySelector('input[data-key="domain"]').value = edit_site.domain;
document.querySelector('select[data-key="useragent"]').selectedIndex = (edit_site.googlebot > 0) ? 1 : useragent_options.indexOf(edit_site.useragent);
document.querySelector('input[data-key="allow_cookies"]').checked = (edit_site.allow_cookies > 0);
document.querySelector('input[data-key="remove_cookies"]').checked = (edit_site.remove_cookies > 0);
document.querySelector('input[data-key="block_js"]').checked = (edit_site.block_js > 0 || edit_site.block_javascript > 0);
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 ? edit_site.block_js_inline : '';
@ -277,6 +282,7 @@ function renderOptions() {
'title': 0,
'domain': 0,
'allow_cookies': 1,
'remove_cookies': 1,
'block_js (domain)': 1,
'block_js_ext': 1,
'block_js_inline': 0,
@ -359,6 +365,7 @@ function renderOptions() {
optionEl.text += key + ': ' + domain +
(sites_custom[key]['googlebot'] > 0 ? ' | googlebot' : '') +
(sites_custom[key]['allow_cookies'] > 0 ? ' | allow_cookies' : '') +
(sites_custom[key]['remove_cookies'] > 0 ? ' | remove_cookies' : '') +
((sites_custom[key]['block_js'] > 0 || sites_custom[key]['block_javascript'] > 0) ? ' | block_js' : '') +
((sites_custom[key]['block_js_ext'] > 0 || sites_custom[key]['block_javascript_ext'] > 0) ? ' | block_js_ext' : '') +
(sites_custom[key]['block_js_inline'] ? ' | block_js_inline' : '') +

@ -2335,8 +2335,8 @@ var defaultSites_groups_domains = [].concat.apply([], Object.values(defaultSites
}).map(x => x.group));
var defaultSites_domains = defaultSites_grouped_domains.concat(defaultSites_groups_domains);
function addCookieRules(rule, custom) {
if (rule.hasOwnProperty('remove_cookies_select_drop') || rule.hasOwnProperty('remove_cookies_select_hold') || (custom && !rule.hasOwnProperty('allow_cookies'))) {
function addCookieRules(rule) {
if (rule.hasOwnProperty('remove_cookies_select_drop') || rule.hasOwnProperty('remove_cookies_select_hold')) {
rule.allow_cookies = 1;
rule.remove_cookies = 1;
}

Loading…
Cancel
Save