Fix The West Australian (regional)

This commit is contained in:
magnolia1234 2022-01-25 18:15:31 +01:00
parent 5d25d1f097
commit d91c909889
6 changed files with 57 additions and 33 deletions

View file

@ -559,7 +559,7 @@ Grouped in options:\
[The Saturday Paper](https://www.thesaturdaypaper.com.au) -
[The Spectator Australia](https://www.spectator.com.au) -
[The Sydney Morning Herald](https://www.smh.com.au) -
[The West Australian (+ regional)](https://thewest.com.au) -
[The West Australian (+ regional/opt-in to custom sites)](https://thewest.com.au) -
[WAtoday](https://www.watoday.com.au)
Grouped in options:\

View file

@ -716,6 +716,56 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
enabledSites.push(mc_domain);
}
let header_referer_hostname = urlHost(header_referer);
if (header_referer_hostname.endsWith('.com.au')) {
// enable regional The West Australian sites (opt-in to custom sites)
var au_thewest_domains = ['thewest.com.au'];
var au_thewest_domain = (details.url.startsWith('https://images.thewest.com.au/') && ['image'].includes(details.type) &&
!matchUrlDomain(au_thewest_domains, header_referer) && enabledSites.includes('thewest.com.au'));
if (au_thewest_domain) {
let thewest_domain = urlHost(header_referer).replace(/^(www|edition)\./, '');
if (!allow_cookies.includes(thewest_domain))
allow_cookies.push(thewest_domain);
au_thewest_domains.push(thewest_domain);
if (!enabledSites.includes(thewest_domain))
enabledSites.push(thewest_domain);
}
} else if (header_referer_hostname.endsWith('.de')) {
// block script for additional Madsack/RND sites (opt-in to custom sites)
var de_madsack_domains = grouped_sites['###_de_madsack'];
var de_rnd_domain = (matchUrlDomain('rndtech.de', details.url) && ['script'].includes(details.type) && !matchUrlDomain(de_madsack_domains.concat(['madsack.de', 'madsack-medien-campus.de', 'rnd.de']), header_referer) && enabledSites.includes('###_de_madsack'));
if (de_rnd_domain) {
let rnd_domain = urlHost(header_referer).replace(/^(www|m)\./, '');
if (!allow_cookies.includes(rnd_domain))
allow_cookies.push(rnd_domain);
blockedRegexes[rnd_domain] = blockedRegexes['haz.de'];
de_madsack_domains.push(rnd_domain);
if (!enabledSites.includes(rnd_domain))
enabledSites.push(rnd_domain);
}
} else if (header_referer_hostname.endsWith('.fi')) {
// set user-agent to GoogleBot for additional Snamoma Media Finland (opt-in to custom sites)
var fi_sanoma_domains = grouped_sites['###_fi_sanoma'];
var fi_sanoma_sndp_domain = (matchUrlDomain('sanoma-sndp.fi', details.url) && ['xmlhttprequest'].includes(details.type) && !matchUrlDomain(fi_sanoma_domains, header_referer) && enabledSites.includes('###_fi_sanoma'));
if (fi_sanoma_sndp_domain) {
let sanoma_domain = urlHost(header_referer).replace(/^www\./, '');
if (!allow_cookies.includes(sanoma_domain))
allow_cookies.push(sanoma_domain);
if (!use_google_bot.includes(sanoma_domain)) {
use_google_bot.push(sanoma_domain);
change_headers.push(sanoma_domain);
}
fi_sanoma_domains.push(sanoma_domain);
if (!enabledSites.includes(sanoma_domain))
enabledSites.push(sanoma_domain);
}
} else if (header_referer_hostname.match(/\.(com|org)$/)) {
// set googlebot-useragent for Gannett sites
var usa_gannett_domains = grouped_sites['###_usa_gannett'];
var usa_gannett_domain = (matchUrlDomain('gannett-cdn.com', details.url) && ['xmlhttprequest'].includes(details.type) && !matchUrlDomain(usa_gannett_domains.concat(['usatoday.com']), header_referer) && enabledSites.includes('###_usa_gannett'));
@ -792,33 +842,6 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
enabledSites.push(mng_domain);
}
// block script for additional Madsack/RND sites (opt-in to custom sites)
var de_madsack_domains = grouped_sites['###_de_madsack'];
var de_rnd_domain = (matchUrlDomain('rndtech.de', details.url) && ['script'].includes(details.type) && !matchUrlDomain(de_madsack_domains.concat(['madsack.de', 'madsack-medien-campus.de', 'rnd.de']), header_referer) && enabledSites.includes('###_de_madsack'));
if (de_rnd_domain) {
let rnd_domain = urlHost(header_referer).replace(/^(www|m)\./, '');
if (!allow_cookies.includes(rnd_domain))
allow_cookies.push(rnd_domain);
blockedRegexes[rnd_domain] = blockedRegexes['haz.de'];
de_madsack_domains.push(rnd_domain);
if (!enabledSites.includes(rnd_domain))
enabledSites.push(rnd_domain);
}
// set user-agent to GoogleBot for additional Snamoma Media Finland (opt-in to custom sites)
var fi_sanoma_domains = grouped_sites['###_fi_sanoma'];
var fi_sanoma_sndp_domain = (matchUrlDomain('sanoma-sndp.fi', details.url) && ['xmlhttprequest'].includes(details.type) && !matchUrlDomain(fi_sanoma_domains, header_referer) && enabledSites.includes('###_fi_sanoma'));
if (fi_sanoma_sndp_domain) {
let sanoma_domain = urlHost(header_referer).replace(/^www\./, '');
if (!allow_cookies.includes(sanoma_domain))
allow_cookies.push(sanoma_domain);
if (!use_google_bot.includes(sanoma_domain)) {
use_google_bot.push(sanoma_domain);
change_headers.push(sanoma_domain);
}
fi_sanoma_domains.push(sanoma_domain);
if (!enabledSites.includes(sanoma_domain))
enabledSites.push(sanoma_domain);
}
// block external javascript for custom sites (optional)
@ -854,7 +877,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
let allow_ext_source = medium_custom_domain;
let bpc_amp_site = false;
let au_swm_site = (header_referer && urlHost(header_referer).endsWith('com.au') && details.url.includes('https://s.thewest.com.au/'));
let au_swm_site = (header_referer && urlHost(header_referer).endsWith('com.au') && details.url.includes('https://images.thewest.com.au/'));
if (isSiteEnabled({url: header_referer})) {
let inkl_site = (matchUrlDomain('cdn.jsdelivr.net', details.url) && matchUrlDomain('inkl.com', header_referer));

View file

@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox
Post-release
Fix Australia News Corp (amp-redirect)
Fix The West Australian (regional)
* v2.5.3.1 (2022-01-23)
Hotfix block inline script

View file

@ -218,8 +218,8 @@ else {
}
} else {
// Australian Seven West Media
let swm_script = document.querySelector('script[src^="https://s.thewest.com.au"]');
if (matchDomain('thewest.com.au') || swm_script) {
let swm_image = document.querySelector('img[src^="https://images.thewest.com.au"]');
if (matchDomain('thewest.com.au') || swm_image) {
window.setTimeout(function () {
let breach_screen = document.querySelector('div[data-testid*="BreachScreen"]');
if (breach_screen) {

View file

@ -603,5 +603,5 @@
"*://*.wsj.net/*",
"*://*.zephr.com/*"
],
"version": "2.5.3.2"
"version": "2.5.3.3"
}

View file

@ -1630,7 +1630,7 @@ var defaultSites = {
allow_cookies: 1,
block_regex: /\.washingtonpost\.com\/pwapiv2\/article/
},
"The West Australian (+ regional)": {
"The West Australian (+ regional/opt-in to custom sites)": {
domain: "thewest.com.au",
allow_cookies: 1
},