From 7144f05a0388e1e1b380dd8a5a6a1db30b1493e1 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Fri, 25 Feb 2022 14:25:53 +0100 Subject: [PATCH] Add Postmedia Network (Canada) --- README.md | 14 +++++++++++--- background.js | 15 ++++++++++++++- changelog.txt | 1 + custom/sites_custom.json | 5 ----- manifest.json | 7 ++++++- sites.js | 23 +++++++++++++---------- 6 files changed, 45 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 9f6b5a5..06884d9 100644 --- a/README.md +++ b/README.md @@ -278,12 +278,20 @@ Grouped in options:\ [The Virginian-Pilot](https://www.pilotonline.com) #### Canada -[Financial Post](https://www.financialpost.com) - [Le Devoir](https://www.ledevoir.com) - -[National Post](https://www.nationalpost.com) - [The Globe and Mail](https://www.theglobeandmail.com) - [The Hill Times](https://www.hilltimes.com)\ -[The Toronto Star](https://www.thestar.com) and regional TorStar sites (grouped in options) like + +Grouped in options:\ +*Postmedia Network* sites like (opt-in to custom sites for unlisted)\ +[Calgary Herald](https://calgaryherald.com) - +[Financial Post](https://www.financialpost.com) - +[National Post](https://www.nationalpost.com) - +[The Province](https://theprovince.com) - +[Toronto Sun](https://torontosun.com) - +[Vancouver Sun](https://vancouversun.com)\ +*TorStar* sites like\ +[The Toronto Star](https://www.thestar.com) and regional sites [Niagara Falls Review](https://www.niagarafallsreview.ca) - [Peterborough Examiner](https://www.thepeterboroughexaminer.com) - [St. Catharines Standard](https://www.stcatharinesstandard.ca) - diff --git a/background.js b/background.js index 8e0bd18..01f2aa4 100644 --- a/background.js +++ b/background.js @@ -781,7 +781,20 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { enabledSites.push(sanoma_domain); } - } else if (header_referer_hostname.match(/\.(com|org)$/)) { + } else if (header_referer_hostname.match(/\.(ca|com|org)$/)) { + + // block TinyPass for Postmedia Network sites + var ca_postmedia_domains = grouped_sites['###_ca_postmedia']; + var ca_postmedia_domain = (matchUrlDomain('postmedia.digital', details.url) && ['image'].includes(details.type) && !matchUrlDomain(ca_postmedia_domains.concat(['canada.com', 'canoe.com', 'driving.ca']), header_referer) && enabledSites.includes('###_ca_postmedia')); + if (ca_postmedia_domain) { + let pm_domain = urlHost(header_referer).replace(/^(www)\./, ''); + if (!allow_cookies.includes(pm_domain)) + allow_cookies.push(pm_domain); + blockedRegexes[pm_domain] = blockedRegexes['nationalpost.com']; + ca_postmedia_domains.push(pm_domain); + if (!enabledSites.includes(pm_domain)) + enabledSites.push(pm_domain); + } // set googlebot-useragent for Gannett sites var usa_gannett_domains = grouped_sites['###_usa_gannett']; diff --git a/changelog.txt b/changelog.txt index 6555830..5f87f5e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Add Postmedia Network (Canada) Fix Westfalen-Blatt (gallery) Fix update check (GitLab CORS issue or BitBucket http error 429) Update custom sites (load text from json) diff --git a/custom/sites_custom.json b/custom/sites_custom.json index 1148399..6029491 100644 --- a/custom/sites_custom.json +++ b/custom/sites_custom.json @@ -33,11 +33,6 @@ "Brainly.com": { "domain": "brainly.com" }, - "Calgaryherald.com": { - "allow_cookies": 1, - "block_regex": "\\.tinypass\\.com\\/", - "domain": "calgaryherald.com" - }, "Capital.bg": { "allow_cookies": 1, "domain": "capital.bg", diff --git a/manifest.json b/manifest.json index cadac4a..0240642 100644 --- a/manifest.json +++ b/manifest.json @@ -106,6 +106,7 @@ "*://*.businessinsider.com/*", "*://*.businessoffashion.com/*", "*://*.cairnspost.com.au/*", + "*://*.calgaryherald.com/*", "*://*.canberratimes.com.au/*", "*://*.capitalgazette.com/*", "*://*.cen.acs.org/*", @@ -518,6 +519,7 @@ "*://*.thenewatlantis.com/*", "*://*.thepeterboroughexaminer.com/*", "*://*.thepointmag.com/*", + "*://*.theprovince.com/*", "*://*.therecord.com/*", "*://*.thesaturdaypaper.com.au/*", "*://*.thespec.com/*", @@ -533,6 +535,7 @@ "*://*.timesofindia.indiatimes.com/*", "*://*.tivi.fi/*", "*://*.tlz.de/*", + "*://*.torontosun.com/*", "*://*.towardsdatascience.com/*", "*://*.townnews.com/*", "*://*.townsvillebulletin.com.au/*", @@ -550,6 +553,7 @@ "*://*.usinenouvelle.com/*", "*://*.uusisuomi.fi/*", "*://*.valeursactuelles.com/*", + "*://*.vancouversun.com/*", "*://*.vanityfair.com/*", "*://*.variety.com/*", "*://*.varmatin.com/*", @@ -613,6 +617,7 @@ "*://*.natgeofe.com/*", "*://*.nyt.com/*", "*://*.pasedigital.cl/*", + "*://*.postmedia.digital/*", "*://*.prcdn.co/*", "*://*.repstatic.it/*", "*://*.rndtech.de/*", @@ -620,5 +625,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.5.7.3" + "version": "2.5.7.4" } diff --git a/sites.js b/sites.js index d91b024..0c451af 100644 --- a/sites.js +++ b/sites.js @@ -427,11 +427,6 @@ var defaultSites = { block_regex: /cdn\.ampproject\.org\/v\d\/amp-(access|ad)-.+\.js/, useragent: "googlebot" }, - "Financial Post": { - domain: "financialpost.com", - allow_cookies: 1, - block_regex: /\.tinypass\.com\// - }, "Financial Times (not Chinese)": { domain: "ft.com", allow_cookies: 1, @@ -1101,11 +1096,6 @@ var defaultSites = { block_regex: /\.blueconic\.net\//, random_ip: "eu" }, - "National Post": { - domain: "nationalpost.com", - allow_cookies: 1, - block_regex: /\.tinypass\.com\// - }, "National Review": { domain: "nationalreview.com", allow_cookies: 1, @@ -1251,6 +1241,19 @@ var defaultSites = { domain: "politicaexterior.com", allow_cookies: 1 }, + "Postmedia Network": { + domain: "###_ca_postmedia", + group: [ + "calgaryherald.com", + "financialpost.com", + "nationalpost.com", + "theprovince.com", + "torontosun.com", + "vancouversun.com" + ], + allow_cookies: 1, + block_regex: /\.tinypass\.com\// + }, "Precision Oncology News": { domain: "precisiononcologynews.com", group_rule: "###_gr_usa_genomeweb_domains"