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 Post-Standard](https://www.syracuse.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/) -
[Detroit Free Press](https://www.freep.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 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)\
[Arizona Daily Star](https://tucson.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];
if (ext_version > ext_version_old || updatedSites_new.length > 0) {
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)
sites[site_new] = defaultSites[site_new].domain;
ext_api.storage.local.set({
@ -678,7 +678,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
}
// 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'));
if (usa_gannett_domain) {
let gn_domain = urlHost(header_referer).replace(/^(www|eu)\./, '');;
@ -1078,8 +1078,10 @@ function site_switch() {
var sites = items.sites;
for (let key of added_site)
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];
}
ext_api.storage.local.set({
sites: sites
}, 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)));
}
function compareKey(firstStr, secondStr) {
return firstStr.toLowerCase().replace(/\s\(.*\)/, '') === secondStr.toLowerCase().replace(/\s\(.*\)/, '');
}
function isSiteEnabled(details) {
var enabledSite = matchUrlDomain(enabledSites, details.url);
if (!ext_name.startsWith('Bypass Paywalls Clean'))

View file

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

View file

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

View file

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