From c78c69509a2b2c92a4fab8163b33230a36b202ef Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Sun, 26 Sep 2021 10:10:19 +0200 Subject: [PATCH] Fix The Australian (option to disable Googlebot; http error 403) --- background.js | 13 +++++++++++++ changelog.txt | 1 + custom/manifest.json | 2 +- manifest.json | 2 +- sites.js | 1 + 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index 5b3292f..1e0f4f5 100755 --- a/background.js +++ b/background.js @@ -959,6 +959,18 @@ ext_api.webRequest.onBeforeRequest.addListener(function (details) { ["blocking"] ); +// theaustralian.com redirect subscribe to amp +ext_api.webRequest.onBeforeRequest.addListener(function (details) { + if (!isSiteEnabled(details)) { + return; + } + var updatedUrl = decodeURIComponent(details.url.split('dest=')[1].split('&')[0]).replace('www.', 'amp.'); + return { redirectUrl: updatedUrl }; +}, +{urls:["*://www.theaustralian.com.au/subscribe/*"], types:["main_frame"]}, +["blocking"] +); + // fix nytimes x-frame-options (hidden iframe content) ext_api.webRequest.onHeadersReceived.addListener(function (details) { if (!isSiteEnabled(details)) { @@ -1206,6 +1218,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { var setReferer = false; var googlebotEnabled = matchUrlDomain(use_google_bot, details.url) && !(matchUrlDomain('barrons.com', details.url) && enabledSites.includes('#options_disable_gb_barrons')) && + !(matchUrlDomain('theaustralian.com.au', details.url) && enabledSites.includes('#options_disable_gb_theaustralian')) && !(matchUrlDomain('wsj.com', details.url) && enabledSites.includes('#options_disable_gb_wsj')); if (matchUrlDomain(change_headers, details.url) && (!['font', 'image', 'stylesheet'].includes(details.type) || matchUrlDomain(['thetimes.co.uk'], details.url))) { diff --git a/changelog.txt b/changelog.txt index 73ffbae..dc35934 100644 --- a/changelog.txt +++ b/changelog.txt @@ -8,6 +8,7 @@ Add Tampa Bay Times (local USA) Fix Challenges.fr (blur) Fix LesEchos.fr (json) Fix Repubblica.it & LaStampa.it (videos on Firefox) +Fix The Australian (option to disable Googlebot; http error 403) Fix WSJ & Barron's (amp) * v2.3.6.0 (2021-09-05) diff --git a/custom/manifest.json b/custom/manifest.json index 9750e81..953d4cc 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -39,5 +39,5 @@ "webRequestBlocking", "" ], - "version": "2.3.6.4" + "version": "2.3.6.5" } \ No newline at end of file diff --git a/manifest.json b/manifest.json index f73c0bb..d15c0e3 100755 --- a/manifest.json +++ b/manifest.json @@ -547,5 +547,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.3.6.4" + "version": "2.3.6.5" } \ No newline at end of file diff --git a/sites.js b/sites.js index ce12194..7ca27dd 100755 --- a/sites.js +++ b/sites.js @@ -317,6 +317,7 @@ var defaultSites = "Show options on update": "#options_on_update", "Restore opt-in for custom sites (on reload; Chrome-only)": "#options_restore_custom", "Barron's - no Googlebot (http error 500)": "#options_disable_gb_barrons", + "The Australian - no Googlebot (http error 403)": "#options_disable_gb_theaustralian", "The Wall Street Journal - no Googlebot (http error 500)": "#options_disable_gb_wsj" }