diff --git a/background.js b/background.js index 6167584c..3efdf81f 100644 --- a/background.js +++ b/background.js @@ -489,6 +489,20 @@ ext_api.webRequest.onBeforeRequest.addListener(function (details) { ["blocking"] ); +// Google AMP cache redirect +ext_api.webRequest.onBeforeRequest.addListener(function (details) { + var url = details.url.split('?')[0]; + var updatedUrl; + if (matchUrlDomain('cdn.ampproject.org', url)) + updatedUrl = 'https://' + url.split(/cdn\.ampproject\.org\/[a-z]\/s\//)[1]; + else if (matchUrlDomain('google.com', url)) + updatedUrl = 'https://' + url.split(/\.google\.com\/amp\/s\//)[1]; + return { redirectUrl: decodeURIComponent(updatedUrl) }; +}, +{urls:["*://*.cdn.ampproject.org/*/s/*", "*://*.google.com/amp/s/*"], types:["main_frame"]}, +["blocking"] +); + // inkl bypass ext_api.webRequest.onBeforeRequest.addListener(function (details) { if (!isSiteEnabled(details)) { diff --git a/changelog.txt b/changelog.txt index a910459d..d0f63a41 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release Add Tagesspiegel.de +Redirect Google AMP cache (opt-in to custom sites) * v2.7.8.0 (2022-07-31) Add Crusoe (Brazil)