Fix The Diplomat (magazine)

This commit is contained in:
magnolia1234 2024-01-02 08:58:14 +01:00
parent e1da1fb34e
commit 9ff20121d5
8 changed files with 53 additions and 50 deletions

View File

@ -44,7 +44,7 @@ For new sites you also have to opt-in to custom sites/request host permissions f
Add-on was removed by Mozilla from [add-on store (AMO)](https://addons.mozilla.org).\ Add-on was removed by Mozilla from [add-on store (AMO)](https://addons.mozilla.org).\
Current installations (by custom collection in Firefox Beta/Nightly or Firefox-fork) will stay active, but with no more updates. Current installations (by custom collection in Firefox Beta/Nightly or Firefox-fork) will stay active, but with no more updates.
[Firefox Beta 122+](https://play.google.com/store/apps/details?id=org.mozilla.firefox_beta) and [Firefox Nightly 122+](https://play.google.com/store/apps/details?id=org.mozilla.fenix) can still install/sideload a xpi-file (manual updates) when you enable the debug menu (settings > about > tap Firefox logo 5 times > return to settings). [Firefox Beta 122+](https://play.google.com/store/apps/details?id=org.mozilla.firefox_beta) and [Firefox Nightly 122+](https://play.google.com/store/apps/details?id=org.mozilla.fenix) can still install/sideload a xpi-file (automatic updates) when you enable the debug menu (settings > about > tap Firefox logo 5 times > return to settings).
Or use the Firefox-fork [Iceraven](https://github.com/fork-maintainers/iceraven-browser) v2.13.2+ (manual updates).\ Or use the Firefox-fork [Iceraven](https://github.com/fork-maintainers/iceraven-browser) v2.13.2+ (manual updates).\
You can install/update Iceraven manually or use the app [FFUpdater](https://github.com/Tobi823/ffupdater) You can install/update Iceraven manually or use the app [FFUpdater](https://github.com/Tobi823/ffupdater)

View File

@ -1497,16 +1497,37 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
} }
if (message.request === 'getExtSrc' && message.data) { if (message.request === 'getExtSrc' && message.data) {
message.data.html = ''; message.data.html = '';
if (message.data.url.startsWith('https://archive.')) { function getArticleSrc(message) {
fetch(message.data.url) let url_src = message.data.url_src || message.data.url;
fetch(url_src)
.then(response => { .then(response => {
if (response.ok) { if (response.ok) {
response.text().then(html => { response.text().then(html => {
if (html.includes('<div class="TEXT-BLOCK"')) { let recursive;
let url_src = html.split('<div class="TEXT-BLOCK"')[1].split('</div>')[0].split('href="')[1].split('"')[0]; if (message.data.url.startsWith('https://archive.')) {
message.data.url_src = url_src; if (url_src.includes('/https')) {
getArticleSrc(message); if (html.includes('<div class="TEXT-BLOCK"')) {
} else { message.data.url_src = html.split('<div class="TEXT-BLOCK"')[1].split('</div>')[0].split('href="')[1].split('"')[0];
getArticleSrc(message);
recursive = true;
} else
html = '';
}
}
if (!recursive) {
if (html) {
if (message.data.base64) {
html = decode_utf8(atob(html));
message.data.selector_source = 'body';
}
if (typeof DOMParser === 'function') {
let parser = new DOMParser();
let doc = parser.parseFromString(html, 'text/html');
let article_new = doc.querySelector(message.data.selector_source);
if (article_new)
html = article_new.outerHTML;
}
}
message.data.html = html; message.data.html = html;
ext_api.tabs.sendMessage(sender.tab.id, {msg: "showExtSrc", data: message.data}); ext_api.tabs.sendMessage(sender.tab.id, {msg: "showExtSrc", data: message.data});
} }
@ -1515,33 +1536,8 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
}).catch(function (err) { }).catch(function (err) {
ext_api.tabs.sendMessage(sender.tab.id, {msg: "showExtSrc", data: message.data}); ext_api.tabs.sendMessage(sender.tab.id, {msg: "showExtSrc", data: message.data});
}); });
} else
getArticleSrc(message);
function getArticleSrc(message) {
let url_src = message.data.url_src || message.data.url;
fetch(url_src)
.then(response => {
if (response.ok) {
response.text().then(html => {
if (message.data.base64) {
html = decode_utf8(atob(html));
message.data.selector_source = 'body';
}
message.data.html = html;
if (typeof DOMParser === 'function') {
let parser = new DOMParser();
let doc = parser.parseFromString(html, 'text/html');
let article_new = doc.querySelector(message.data.selector_source);
if (article_new)
message.data.html = article_new.outerHTML;
}
ext_api.tabs.sendMessage(sender.tab.id, {msg: "showExtSrc", data: message.data});
});
}
}).catch(function (err) {
ext_api.tabs.sendMessage(sender.tab.id, {msg: "showExtSrc", data: message.data});
});
} }
getArticleSrc(message);
} }
if (message.scheme && (![chrome_scheme, 'undefined'].includes(message.scheme) || focus_changed)) { if (message.scheme && (![chrome_scheme, 'undefined'].includes(message.scheme) || focus_changed)) {
let icon_path = {path: {'128': 'bypass.png'}}; let icon_path = {path: {'128': 'bypass.png'}};

View File

@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox
Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/releases Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/releases
Post-release Post-release
Fix The Diplomat (magazine)
* v3.4.9.0 (2023-12-31) * v3.4.9.0 (2023-12-31)
Add Business Insider Nederland Add Business Insider Nederland

View File

@ -3139,7 +3139,7 @@ else if (matchDomain('thetimes.co.uk')) {
let paywall = document.querySelector('div#paywall-portal-article-footer'); let paywall = document.querySelector('div#paywall-portal-article-footer');
if (paywall && !url.includes('?shareToken=')) { if (paywall && !url.includes('?shareToken=')) {
removeDOMElement(paywall); removeDOMElement(paywall);
getArchive(url, 'article:not([id])'); getArchive(url, 'article#article-main');
window.setTimeout(function () { window.setTimeout(function () {
let headings = document.querySelectorAll('div > div[role="heading"]'); let headings = document.querySelectorAll('div > div[role="heading"]');
for (let elem of headings) for (let elem of headings)
@ -5022,14 +5022,9 @@ else if (matchDomain('thedailybeast.com')) {
else if (matchDomain('thediplomat.com')) { else if (matchDomain('thediplomat.com')) {
if (matchDomain('magazine.thediplomat.com')) { if (matchDomain('magazine.thediplomat.com')) {
csDoneOnce = true; let preview = document.querySelector('article.dpl-preview');
for (let n = 0; n < 5; n++) { if (preview)
setTimeout(function () { preview.classList.remove('dpl-preview');
let preview = document.querySelector('article.dpl-preview');
if (preview)
preview.classList.remove('dpl-preview');
}, n * 500);
}
} }
} }
@ -5886,13 +5881,13 @@ function clearPaywall(paywall, paywall_action) {
} }
} }
function getGoogleWebcache(url, paywall_sel, paywall_action = '', article_sel, func_post = '', article_new_sel = article_sel) { function getGoogleWebcache(url, paywall_sel, paywall_action = '', selector, func_post = '', selector_source = selector) {
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split(/[#\?]/)[0]; let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split(/[#\?]/)[0];
let paywall = document.querySelectorAll(paywall_sel); let paywall = document.querySelectorAll(paywall_sel);
if (paywall.length) { if (paywall.length) {
clearPaywall(paywall, paywall_action); clearPaywall(paywall, paywall_action);
csDoneOnce = true; csDoneOnce = true;
replaceDomElementExt(url_cache, true, false, article_sel, '', article_new_sel); replaceDomElementExt(url_cache, true, false, selector, '', selector_source);
if (func_post) { if (func_post) {
window.setTimeout(function () { window.setTimeout(function () {
func_post(); func_post();
@ -5907,6 +5902,9 @@ function getArchive(url, selector, text_fail = '', selector_source = selector, s
} }
function replaceDomElementExt(url, proxy, base64, selector, text_fail = '', selector_source = selector, selector_archive = selector) { function replaceDomElementExt(url, proxy, base64, selector, text_fail = '', selector_source = selector, selector_archive = selector) {
let article = document.querySelector(selector);
if (!article)
return;
if (proxy) { if (proxy) {
if (!text_fail) { if (!text_fail) {
if (url.startsWith('https://webcache.googleusercontent.com')) if (url.startsWith('https://webcache.googleusercontent.com'))
@ -5946,7 +5944,7 @@ function getSelectorLevel(selector) {
function replaceDomElementExtSrc(url, url_src, html, proxy, base64, selector, text_fail = '', selector_source = selector, selector_archive = selector) { function replaceDomElementExtSrc(url, url_src, html, proxy, base64, selector, text_fail = '', selector_source = selector, selector_archive = selector) {
let article = document.querySelector(selector); let article = document.querySelector(selector);
if (html) { if (html) {
if (base64) { if (!proxy && base64) {
html = decode_utf8(atob(html)); html = decode_utf8(atob(html));
selector_source = 'body'; selector_source = 'body';
} }
@ -6136,7 +6134,9 @@ function externalLink(domains, ext_url_templ, url, text_fail = 'BPC > Full artic
text_fail_div.id = 'bpc_archive'; text_fail_div.id = 'bpc_archive';
text_fail_div.setAttribute('style', 'margin: 20px; font-size: 20px; font-weight: bold; color: red;'); text_fail_div.setAttribute('style', 'margin: 20px; font-size: 20px; font-weight: bold; color: red;');
let parser = new DOMParser(); let parser = new DOMParser();
text_fail = text_fail.replace(/\[([^\]]+)\]/g, "<a href='$1' target='_blank' style='color: red'>$1</a>"); text_fail = text_fail.replace(/\[(?<url>[^\]]+)\]/g, function (match, url) {
return "<a href='" + url + "' target='_blank' style='color: red'>" + new URL(url).hostname + "</a>";
});
let doc = parser.parseFromString('<span>' + text_fail + '</span>', 'text/html'); let doc = parser.parseFromString('<span>' + text_fail + '</span>', 'text/html');
let elem = doc.querySelector('span'); let elem = doc.querySelector('span');
text_fail_div.appendChild(elem); text_fail_div.appendChild(elem);

View File

@ -51,5 +51,5 @@
"webRequestBlocking", "webRequestBlocking",
"*://*/*" "*://*/*"
], ],
"version": "3.4.9.0" "version": "3.4.9.1"
} }

View File

@ -189,6 +189,12 @@
"block_regex": "\\.eviemagazine\\.com\\/api\\/trpc\\/post\\.paywall", "block_regex": "\\.eviemagazine\\.com\\/api\\/trpc\\/post\\.paywall",
"domain": "eviemagazine.com" "domain": "eviemagazine.com"
}, },
"Ewmagazine.nl": {
"add_ext_link": "div.paywall|div.entry-content",
"add_ext_link_type": "archive.is",
"allow_cookies": 1,
"domain": "ewmagazine.nl"
},
"Faithfullymagazine.com": { "Faithfullymagazine.com": {
"allow_cookies": 1, "allow_cookies": 1,
"domain": "faithfullymagazine.com", "domain": "faithfullymagazine.com",

View File

@ -827,5 +827,5 @@
"*://archive.vn/*", "*://archive.vn/*",
"*://webcache.googleusercontent.com/*" "*://webcache.googleusercontent.com/*"
], ],
"version": "3.4.9.0" "version": "3.4.9.1"
} }

View File

@ -2948,4 +2948,4 @@ var fr_groupe_ebra_nofix_domains = ['bienpublic.com', 'dna.fr', 'estrepublicain.
var fr_indigo_nofix_domains = ['africaintelligence.com', 'africaintelligence.fr', 'glitz.paris', 'intelligenceonline.com', 'intelligenceonline.fr', 'lalettre.fr']; var fr_indigo_nofix_domains = ['africaintelligence.com', 'africaintelligence.fr', 'glitz.paris', 'intelligenceonline.com', 'intelligenceonline.fr', 'lalettre.fr'];
var it_gedi_nofix_domains = ['gelocal.it', 'limesonline.com']; var it_gedi_nofix_domains = ['gelocal.it', 'limesonline.com'];
var nl_mediahuis_region_nofix_domains = ['gooieneemlander.nl', 'haarlemsdagblad.nl', 'ijmuidercourant.nl', 'leidschdagblad.nl', 'noordhollandsdagblad.nl']; var nl_mediahuis_region_nofix_domains = ['gooieneemlander.nl', 'haarlemsdagblad.nl', 'ijmuidercourant.nl', 'leidschdagblad.nl', 'noordhollandsdagblad.nl'];
var nofix_sites = ['11freunde.de', 'aamulehti.fi', 'aftenposten.no', 'aftonbladet.se', 'allgaeuer-zeitung.de', 'asahi.com', 'asiatimes.com', 'autosport.com', 'aviationweek.com', 'badische-zeitung.de', 'bloomberglaw.com', 'bloombergtax.com', 'bnn.de', 'borsen.dk', 'businessinsider.de', 'businessinsider.jp', 'businesslive.co.za', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'catalyst-journal.com', 'chegg.com', 'codesports.com.au', 'compactmag.com', 'courrierinternational.com', 'coursehero.com', 'deutsche-wirtschafts-nachrichten.de', 'die-glocke.de', 'dn.no', 'dn.se', 'elordenmundial.com', 'entrepreneur.com', 'epw.in', 'expresso.pt', 'falter.at', 'finance.si', 'ftchinese.com', 'ftchineselive.com', 'gamestar.de', 'geo.de', 'golem.de', 'gp.se', 'handelsblatt.com', 'hbrchina.org', 'hbrfrance.fr', 'heise.de', 'hln.be', 'hs.fi', 'ilsole24ore.com', 'information.dk', 'investors.com', 'iltalehti.fi', 'jacobin.com', 'jeuneafrique.com', 'jungefreiheit.de', 'kleinezeitung.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.co.uk', 'law360.com', 'le1hebdo.fr', 'leconomiste.com', 'lefilmfrancais.com', 'lequipe.fr', 'lesjours.fr', 'letemps.ch', 'liberation.fr', 'limburger.nl', 'main-echo.de', 'mainpost.de', 'manager-magazin.de', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mittelbayerische.de', 'monde-diplomatique.fr', 'mondediplo.com', 'money.it', 'moneycontrol.com', 'moodys.com', 'morningstar.com', 'moz.de', 'nachrichten.at', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'newslaundry.com', 'nn.de', 'nwzonline.de', 'observador.pt', 'ouest-france.fr', 'philonomist.com', 'pnp.de', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'quillette.com', 'republic.ru', 'rheinpfalz.de', 'risk.net', 'rnz.de', 'saechsische.de', 'schwarzwaelder-bote.de', 'sciencedirect.com', 'springer.com', 'statnews.com', 'stern.de', 'stimme.de', 'straitstimes.com', 'stratfor.com', 'streetinsider.com', 'substack.com', 'suedkurier.de', 'swp.de', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'theinitium.com', 'themorningcontext.com', 'theparisreview.org', 'thestar.com.my', 'thewirechina.com', 'weltwoche.ch', 'weltwoche.de', 'wissenschaft.de', 'wiwo.de', 'worldpoliticsreview.com', 'ynet.co.il'].concat(be_mediahuis_nofix_domains, de_funke_medien_nofix_domains, de_rp_aachen_medien_nofix_domains, fr_groupe_ebra_nofix_domains, fr_indigo_nofix_domains, it_gedi_nofix_domains, nl_mediahuis_region_nofix_domains); var nofix_sites = ['11freunde.de', 'aamulehti.fi', 'aftenposten.no', 'aftonbladet.se', 'allgaeuer-zeitung.de', 'asahi.com', 'asiatimes.com', 'autosport.com', 'aviationweek.com', 'badische-zeitung.de', 'bloomberglaw.com', 'bloombergtax.com', 'bnn.de', 'borsen.dk', 'businessinsider.de', 'businessinsider.jp', 'businesslive.co.za', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'catalyst-journal.com', 'chegg.com', 'codesports.com.au', 'compactmag.com', 'courrierinternational.com', 'coursehero.com', 'deutsche-wirtschafts-nachrichten.de', 'die-glocke.de', 'dn.no', 'dn.se', 'elordenmundial.com', 'entrepreneur.com', 'epw.in', 'expresso.pt', 'falter.at', 'finance.si', 'ftchinese.com', 'ftchineselive.com', 'gamestar.de', 'geo.de', 'golem.de', 'gp.se', 'handelsblatt.com', 'hbrarabic.com', 'hbrchina.org', 'hbrfrance.fr', 'heise.de', 'hln.be', 'hs.fi', 'ilsole24ore.com', 'information.dk', 'investors.com', 'iltalehti.fi', 'jacobin.com', 'jeuneafrique.com', 'jungefreiheit.de', 'kleinezeitung.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.co.uk', 'law360.com', 'le1hebdo.fr', 'leconomiste.com', 'lefilmfrancais.com', 'lequipe.fr', 'lesjours.fr', 'letemps.ch', 'liberation.fr', 'limburger.nl', 'main-echo.de', 'mainpost.de', 'manager-magazin.de', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mittelbayerische.de', 'monde-diplomatique.fr', 'mondediplo.com', 'money.it', 'moneycontrol.com', 'moodys.com', 'morningstar.com', 'moz.de', 'nachrichten.at', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'news24.com', 'newslaundry.com', 'nn.de', 'nwzonline.de', 'observador.pt', 'ouest-france.fr', 'philonomist.com', 'pnp.de', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'quillette.com', 'republic.ru', 'rheinpfalz.de', 'risk.net', 'rnz.de', 'saechsische.de', 'schwarzwaelder-bote.de', 'sciencedirect.com', 'springer.com', 'statnews.com', 'stern.de', 'stimme.de', 'straitstimes.com', 'stratfor.com', 'streetinsider.com', 'substack.com', 'suedkurier.de', 'swp.de', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'theinitium.com', 'themorningcontext.com', 'theparisreview.org', 'thestar.com.my', 'thewirechina.com', 'weltwoche.ch', 'weltwoche.de', 'wissenschaft.de', 'wiwo.de', 'worldpoliticsreview.com', 'ynet.co.il'].concat(be_mediahuis_nofix_domains, de_funke_medien_nofix_domains, de_rp_aachen_medien_nofix_domains, fr_groupe_ebra_nofix_domains, fr_indigo_nofix_domains, it_gedi_nofix_domains, nl_mediahuis_region_nofix_domains);