Fix Gannett Group (permissions for listed sites)

This commit is contained in:
magnolia1234 2021-12-04 12:12:43 +01:00
parent 840ebef584
commit 119ef00a1c
5 changed files with 46 additions and 11 deletions

View file

@ -198,13 +198,17 @@ Grouped in options:\
[The Plain Dealer](https://www.cleveland.com) - [The Plain Dealer](https://www.cleveland.com) -
[The Post-Standard](https://www.syracuse.com) - [The Post-Standard](https://www.syracuse.com) -
[The Republican](https://www.masslive.com)\ [The Republican](https://www.masslive.com)\
*Gannett Group (local USA Today)* sites like (opt-in to custom sites)\ *Gannett Group (local USA Today)* sites like (opt-in to custom sites for unlisted)\
[Austin American-Statesman](https://www.statesman.com/) - [Austin American-Statesman](https://www.statesman.com/) -
[Detroit Free Press](https://www.freep.com) - [Detroit Free Press](https://www.freep.com) -
[Milwaukee Journal Sentinel](https://www.jsonline.com) - [Milwaukee Journal Sentinel](https://www.jsonline.com) -
[The Courier-Journal](https://www.courier-journal.com/) - [The Arizona Republic](https://www.azcentral.com) -
[The Cincinnati Enquirer](http://www.cincinnati.com) -
[The Courier-Journal](https://www.courier-journal.com) -
[The Detroit News](https://www.detroitnews.com) -
[The Indianapolis Star](https://www.indystar.com) - [The Indianapolis Star](https://www.indystar.com) -
[The Record (North Jersey)](https://www.northjersey.com)\ [The Record (North Jersey)](https://www.northjersey.com) -
[The Tennessean](http://www.tennessean.com)\
*Lee Enterprises Group* sites like (opt-in to custom sites for unlisted)\ *Lee Enterprises Group* sites like (opt-in to custom sites for unlisted)\
[Arizona Daily Star](https://tucson.com) - [Arizona Daily Star](https://tucson.com) -
[Richmond Times-Dispatch](https://richmond.com) - [Richmond Times-Dispatch](https://richmond.com) -

View file

@ -314,7 +314,7 @@ ext_api.storage.local.get({
defaultSites[site_updated_new] = updatedSites[site_updated_new]; defaultSites[site_updated_new] = updatedSites[site_updated_new];
if (ext_version > ext_version_old || updatedSites_new.length > 0) { if (ext_version > ext_version_old || updatedSites_new.length > 0) {
if (enabledSites.includes('#options_enable_new_sites')) { if (enabledSites.includes('#options_enable_new_sites')) {
let sites_new = Object.keys(defaultSites).filter(x => defaultSites[x].domain && !defaultSites[x].domain.match(/^(#options_|###$)/) && !sites_default.includes(x)); let sites_new = Object.keys(defaultSites).filter(x => defaultSites[x].domain && !defaultSites[x].domain.match(/^(#options_|###$)/) && !sites_default.some(key => compareKey(key, x)));
for (let site_new of sites_new) for (let site_new of sites_new)
sites[site_new] = defaultSites[site_new].domain; sites[site_new] = defaultSites[site_new].domain;
ext_api.storage.local.set({ ext_api.storage.local.set({
@ -678,7 +678,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
} }
// set googlebot-useragent for Gannett sites // set googlebot-useragent for Gannett sites
var usa_gannett_domains = []; 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')); 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'));
if (usa_gannett_domain) { if (usa_gannett_domain) {
let gn_domain = urlHost(header_referer).replace(/^(www|eu)\./, '');; let gn_domain = urlHost(header_referer).replace(/^(www|eu)\./, '');;
@ -1078,8 +1078,10 @@ function site_switch() {
var sites = items.sites; var sites = items.sites;
for (let key of added_site) for (let key of added_site)
sites[key] = domain; sites[key] = domain;
for (let key of removed_site) for (let key of removed_site) {
key = Object.keys(sites).find(sites_key => compareKey(sites_key, key));
delete sites[key]; delete sites[key];
}
ext_api.storage.local.set({ ext_api.storage.local.set({
sites: sites sites: sites
}, function () { }, function () {
@ -1279,6 +1281,10 @@ function filterObject(obj, filterFn, mapFn = function (val, key) {
filter(([key, val]) => filterFn(val, key)).map(([key, val]) => mapFn(val, key))); filter(([key, val]) => filterFn(val, key)).map(([key, val]) => mapFn(val, key)));
} }
function compareKey(firstStr, secondStr) {
return firstStr.toLowerCase().replace(/\s\(.*\)/, '') === secondStr.toLowerCase().replace(/\s\(.*\)/, '');
}
function isSiteEnabled(details) { function isSiteEnabled(details) {
var enabledSite = matchUrlDomain(enabledSites, details.url); var enabledSite = matchUrlDomain(enabledSites, details.url);
if (!ext_name.startsWith('Bypass Paywalls Clean')) if (!ext_name.startsWith('Bypass Paywalls Clean'))

View file

@ -6,6 +6,7 @@ Add Artnet
Add Internazionale.it Add Internazionale.it
Fix The Business of Fashion Fix The Business of Fashion
Fix El Mundo & Groupe EBRA (amp-iframe) Fix El Mundo & Groupe EBRA (amp-iframe)
Fix Gannett Group (permissions for listed sites)
Fix Live Law (permission) Fix Live Law (permission)
Fix The New Yorker (amp) Fix The New Yorker (amp)
Fix TheTimes.co.uk (only link to archive.today) Fix TheTimes.co.uk (only link to archive.today)

View file

@ -78,6 +78,7 @@
"*://*.atlantico.fr/*", "*://*.atlantico.fr/*",
"*://*.augsburger-allgemeine.de/*", "*://*.augsburger-allgemeine.de/*",
"*://*.autonews.com/*", "*://*.autonews.com/*",
"*://*.azcentral.com/*",
"*://*.baltimoresun.com/*", "*://*.baltimoresun.com/*",
"*://*.barrons.com/*", "*://*.barrons.com/*",
"*://*.bd.nl/*", "*://*.bd.nl/*",
@ -115,6 +116,7 @@
"*://*.chicagotribune.com/*", "*://*.chicagotribune.com/*",
"*://*.chronicle.com/*", "*://*.chronicle.com/*",
"*://*.cicero.de/*", "*://*.cicero.de/*",
"*://*.cincinnati.com/*",
"*://*.clarin.com/*", "*://*.clarin.com/*",
"*://*.cleveland.com/*", "*://*.cleveland.com/*",
"*://*.cmjornal.pt/*", "*://*.cmjornal.pt/*",
@ -123,6 +125,7 @@
"*://*.corriere.it/*", "*://*.corriere.it/*",
"*://*.corriereadriatico.it/*", "*://*.corriereadriatico.it/*",
"*://*.courant.com/*", "*://*.courant.com/*",
"*://*.courier-journal.com/*",
"*://*.couriermail.com.au/*", "*://*.couriermail.com.au/*",
"*://*.courrier-picard.fr/*", "*://*.courrier-picard.fr/*",
"*://*.crainscleveland.com/*", "*://*.crainscleveland.com/*",
@ -141,6 +144,7 @@
"*://*.demorgen.be/*", "*://*.demorgen.be/*",
"*://*.denverpost.com/*", "*://*.denverpost.com/*",
"*://*.destentor.nl/*", "*://*.destentor.nl/*",
"*://*.detroitnews.com/*",
"*://*.deutsche-wirtschafts-nachrichten.de/*", "*://*.deutsche-wirtschafts-nachrichten.de/*",
"*://*.df.cl/*", "*://*.df.cl/*",
"*://*.di.se/*", "*://*.di.se/*",
@ -195,6 +199,7 @@
"*://*.foreignaffairs.com/*", "*://*.foreignaffairs.com/*",
"*://*.foreignpolicy.com/*", "*://*.foreignpolicy.com/*",
"*://*.fortune.com/*", "*://*.fortune.com/*",
"*://*.freep.com/*",
"*://*.freiepresse.de/*", "*://*.freiepresse.de/*",
"*://*.fresnobee.com/*", "*://*.fresnobee.com/*",
"*://*.ft.com/*", "*://*.ft.com/*",
@ -245,6 +250,7 @@
"*://*.inc.com/*", "*://*.inc.com/*",
"*://*.inc42.com/*", "*://*.inc42.com/*",
"*://*.independent.ie/*", "*://*.independent.ie/*",
"*://*.indystar.com/*",
"*://*.informacion.es/*", "*://*.informacion.es/*",
"*://*.infzm.com/*", "*://*.infzm.com/*",
"*://*.inkl.com/*", "*://*.inkl.com/*",
@ -257,6 +263,7 @@
"*://*.journaldunet.com/*", "*://*.journaldunet.com/*",
"*://*.journalnow.com/*", "*://*.journalnow.com/*",
"*://*.jpost.com/*", "*://*.jpost.com/*",
"*://*.jsonline.com/*",
"*://*.kansas.com/*", "*://*.kansas.com/*",
"*://*.kansascity.com/*", "*://*.kansascity.com/*",
"*://*.kauppalehti.fi/*", "*://*.kauppalehti.fi/*",
@ -365,6 +372,7 @@
"*://*.nordeclair.fr/*", "*://*.nordeclair.fr/*",
"*://*.nordlittoral.fr/*", "*://*.nordlittoral.fr/*",
"*://*.northerndailyleader.com.au/*", "*://*.northerndailyleader.com.au/*",
"*://*.northjersey.com/*",
"*://*.nouvelobs.com/*", "*://*.nouvelobs.com/*",
"*://*.noz.de/*", "*://*.noz.de/*",
"*://*.nrc.nl/*", "*://*.nrc.nl/*",
@ -438,6 +446,7 @@
"*://*.star-telegram.com/*", "*://*.star-telegram.com/*",
"*://*.staradvertiser.com/*", "*://*.staradvertiser.com/*",
"*://*.startribune.com/*", "*://*.startribune.com/*",
"*://*.statesman.com/*",
"*://*.statista.com/*", "*://*.statista.com/*",
"*://*.stcatharinesstandard.ca/*", "*://*.stcatharinesstandard.ca/*",
"*://*.stocknews.com/*", "*://*.stocknews.com/*",
@ -456,6 +465,7 @@
"*://*.telegraaf.nl/*", "*://*.telegraaf.nl/*",
"*://*.telegraph.co.uk/*", "*://*.telegraph.co.uk/*",
"*://*.telerama.fr/*", "*://*.telerama.fr/*",
"*://*.tennessean.com/*",
"*://*.the-american-interest.com/*", "*://*.the-american-interest.com/*",
"*://*.the-tls.co.uk/*", "*://*.the-tls.co.uk/*",
"*://*.theadvocate.com.au/*", "*://*.theadvocate.com.au/*",
@ -572,5 +582,5 @@
"*://*.wallkit.net/*", "*://*.wallkit.net/*",
"*://*.wsj.net/*" "*://*.wsj.net/*"
], ],
"version": "2.4.5.6" "version": "2.4.5.7"
} }

View file

@ -34,7 +34,7 @@ var defaultSites = {
domain: "adweek.com", domain: "adweek.com",
block_regex: /\.lightboxcdn\.com\// block_regex: /\.lightboxcdn\.com\//
}, },
"Algemeen Dagblad (+ regional)": { "Algemeen Dagblad (+ regional) (free premium articles only)": {
domain: "###_nl_ad_region", domain: "###_nl_ad_region",
group: [ group: [
"ad.nl", "ad.nl",
@ -496,8 +496,22 @@ var defaultSites = {
useragent: "googlebot", useragent: "googlebot",
block_regex: /(cdn\.cxense\.com\/|\.tinypass\.com\/)/ block_regex: /(cdn\.cxense\.com\/|\.tinypass\.com\/)/
}, },
"Gannett Group (local USA Today) (opt-in to custom sites)": { "Gannett Group (local USA Today)": {
domain: "###_usa_gannett" domain: "###_usa_gannett",
group: [
"azcentral.com",
"cincinnati.com",
"courier-journal.com",
"detroitnews.com",
"freep.com",
"indystar.com",
"jsonline.com",
"northjersey.com",
"statesman.com",
"tennessean.com"
],
allow_cookies: 1,
useragent: "googlebot"
}, },
"GElocal.it": { "GElocal.it": {
domain: "gelocal.it", domain: "gelocal.it",
@ -634,7 +648,7 @@ var defaultSites = {
block_regex: /haaretz\.co\.il\/htz\/js\/inter\.js/, block_regex: /haaretz\.co\.il\/htz\/js\/inter\.js/,
useragent: "bingbot" useragent: "bingbot"
}, },
"Handelsblatt (only non-premium articles)": { "Handelsblatt (non-premium articles only)": {
domain: "handelsblatt.com", domain: "handelsblatt.com",
allow_cookies: 1, allow_cookies: 1,
useragent: "googlebot" useragent: "googlebot"