From d364c4a8f01d125211ea604580307db549b2f4af Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Wed, 22 Dec 2021 20:28:59 +0100 Subject: [PATCH] Update custom sites (amp redirect) --- README.md | 2 +- background.js | 2 +- changelog.txt | 2 +- options/options_custom.html | 2 +- options/options_custom.js | 7 +++++-- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index becaf57..7fb29da 100644 --- a/README.md +++ b/README.md @@ -678,7 +678,7 @@ 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. By default sites' cookies/local storage are removed after page loads (to bypass article limit). -Also you can enable Googlebot/Bingbot user-agent, set the referer (to Facebook, Google or Twitter; ignored when Googlebot is set), disable Javascript for (sub)domain(s)/external sources, block regular expression and/or unhide text on amp-page. +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 and/or unhide text on (or when paywall(selector) redirect to) amp-page. [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) diff --git a/background.js b/background.js index e31721d..e92da8a 100644 --- a/background.js +++ b/background.js @@ -251,7 +251,7 @@ function set_rules(sites, sites_updated, sites_custom) { } // updated if (rule.amp_redirect) - amp_redirect[domain] = rule.amp_redirect; + amp_redirect[domain] = rule.amp_redirect.paywall ? rule.amp_redirect : {paywall: rule.amp_redirect}; if (rule.cs_code) cs_code[domain] = rule.cs_code; // custom diff --git a/changelog.txt b/changelog.txt index d1a5e99..8540f8a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,7 +7,7 @@ Add Les Inrockuptibles (France) Fix Helsingin Sanomat (dynamic) Fix The Diplomat (cookies) Fix Times of India (amp) -Update custom sites (random ip) +Update custom sites (random ip/amp redirect) * v2.4.8.0 (2021-12-19) Add Aachener-Nachrichten.de diff --git a/options/options_custom.html b/options/options_custom.html index 55d6999..7497a3a 100644 --- a/options/options_custom.html +++ b/options/options_custom.html @@ -20,7 +20,7 @@

Custom Sites

To add a new site, enter an unique title/domain (without www.).
- Select options for useragent (like Googlebot), set referer (ignored when Googlebot is set), block Javascript (on (sub)domain(s) of site and/or external domains), block regular expression and/or unhide text on amp-page.
+ Select options for useragent (like Googlebot), set referer (ignored when Googlebot is set), set random ip-address, block Javascript (on (sub)domain(s) of site and/or external domains), block regular expression and/or unhide text on (or when paywall(selector) redirect to) amp-page.
Custom sites (new) are enabled automatically in (cookies will be removed by default unless you enable allow_cookies).
If you want to use custom sites (for non-listed sites) enable it in Custom sites enabled:
diff --git a/options/options_custom.js b/options/options_custom.js index 1a9d0f2..a129c3a 100644 --- a/options/options_custom.js +++ b/options/options_custom.js @@ -191,6 +191,7 @@ function edit_options() { document.querySelector('input[data-key="block_javascript_ext"]').checked = (edit_site.block_javascript_ext > 0); document.querySelector('input[data-key="block_regex"]').value = edit_site.block_regex ? edit_site.block_regex : ''; 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 ? edit_site.amp_redirect : ''; document.querySelector('select[data-key="referer"]').selectedIndex = referer_options.indexOf(edit_site.referer); document.querySelector('select[data-key="random_ip"]').selectedIndex = random_ip_options.indexOf(edit_site.random_ip); }); @@ -253,7 +254,8 @@ function renderOptions() { 'block_javascript': 1, 'block_javascript_ext': 1, 'block_regex': 0, - 'amp_unhide': 1 + 'amp_unhide': 1, + 'amp_redirect': 0 }; for (var key in add_checkboxes) { labelEl = document.createElement('label'); @@ -316,7 +318,8 @@ function renderOptions() { (sites_custom[key]['useragent'] ? ' | useragent: ' + sites_custom[key]['useragent'] : '') + (sites_custom[key]['referer'] ? ' | referer: ' + sites_custom[key]['referer'] : '') + (sites_custom[key]['random_ip'] ? ' | random_ip: ' + sites_custom[key]['random_ip'] : '') + - (sites_custom[key]['amp_unhide'] > 0 ? ' | amp_unhide' : ''); + (sites_custom[key]['amp_unhide'] > 0 ? ' | amp_unhide' : '') + + (sites_custom[key]['amp_redirect'] ? ' | amp_redirect' : ''); optionEl.value = key; selectEl.add(optionEl); }