From 3b337321a6f478e6a3b7af35f3c800f2f4234fb7 Mon Sep 17 00:00:00 2001 From: Daniel Lawhon Date: Mon, 30 Nov 2020 12:18:01 -0600 Subject: [PATCH] Added medium URL --- chrome/background.js | 89 +++++++++++++++++++++---------------------- firefox/background.js | 88 +++++++++++++++++++++--------------------- 2 files changed, 86 insertions(+), 91 deletions(-) diff --git a/chrome/background.js b/chrome/background.js index 728fbfa..84dd10e 100644 --- a/chrome/background.js +++ b/chrome/background.js @@ -1,4 +1,4 @@ -var app = {}; +var app = {} // Looks like the specific Referrer header value: https://t.co/JV5396gd2O is blocked // In order to bypass this, generate "random" header values @@ -6,25 +6,25 @@ var app = {}; // Convert to Base 36 (so it should be alphanumeric) // Get first 10 characters after decimal app.generateReferrer = function () { - var linkId = (1 + Math.random()).toString(36).substring(2, 12); - return `https://t.co/${linkId}`; + var linkId = (1 + Math.random()).toString(36).substring(2, 12) + return `https://t.co/${linkId}` } // Modify the referer to twitter app.modifyHeaders = function (details) { - var newRef = app.generateReferrer(); - var refExists = false; + var newRef = app.generateReferrer() + var refExists = false for (var n in details.requestHeaders) { - refExists = details.requestHeaders[n].name.toLowerCase() == "referer"; + refExists = details.requestHeaders[n].name.toLowerCase() == "referer" if (refExists) { - details.requestHeaders[n].value = newRef; - break; + details.requestHeaders[n].value = newRef + break } } if (!refExists) { - details.requestHeaders.push({ name: "Referer", value: newRef }); + details.requestHeaders.push({ name: "Referer", value: newRef }) } - return { requestHeaders: details.requestHeaders }; + return { requestHeaders: details.requestHeaders } } // Modify network requests @@ -32,40 +32,37 @@ chrome.webRequest.onBeforeSendHeaders.addListener( app.modifyHeaders, { urls: [ - '*://*.medium.com/*', - '*://writingcooperative.com/*', - '*://psiloveyou.xyz/*', - '*://uxplanet.org/*', - '*://towardsdatascience.com/*', - '*://codeburst.io/*', - '*://*.gitconnected.com/*', - '*://itnext.io/*', - '*://entrepreneurshandbook.co/*', - '*://arcdigital.media/*', - '*://femsplain.com/*', - '*://fityourself.club/*', - '*://byrslf.co/*', - '*://blog.qz.com/*', - '*://bullshit.ist/*', - '*://*.pramp.com/*', - '*://uxdesign.cc/*', - '*://medium.muz.li/*', - '*://*.usejournal.com/*', - '*://timeline.com/*', - '*://substance.media/*', - '*://thebolditalic.com/*', - '*://thecreative.cafe/*', - '*://ceoplaybook.io/*', - '*://dayoneperspective.com/*', - '*://eand.co/*', - '*://extranewsfeed.com/*', - '*://democracyguardian.com/*', - '*://*.issuevoter.org/*', - ] + "*://*.medium.com/*", + "*://writingcooperative.com/*", + "*://psiloveyou.xyz/*", + "*://uxplanet.org/*", + "*://towardsdatascience.com/*", + "*://codeburst.io/*", + "*://*.gitconnected.com/*", + "*://itnext.io/*", + "*://entrepreneurshandbook.co/*", + "*://arcdigital.media/*", + "*://femsplain.com/*", + "*://fityourself.club/*", + "*://byrslf.co/*", + "*://blog.qz.com/*", + "*://bullshit.ist/*", + "*://*.pramp.com/*", + "*://uxdesign.cc/*", + "*://medium.muz.li/*", + "*://*.usejournal.com/*", + "*://timeline.com/*", + "*://substance.media/*", + "*://thebolditalic.com/*", + "*://thecreative.cafe/*", + "*://ceoplaybook.io/*", + "*://dayoneperspective.com/*", + "*://towardsdatascience.com/*", + "*://eand.co/*", + "*://extranewsfeed.com/*", + "*://democracyguardian.com/*", + "*://*.issuevoter.org/*", + ], }, - [ - 'blocking', - 'requestHeaders', - 'extraHeaders' - ] -); + ["blocking", "requestHeaders", "extraHeaders"] +) diff --git a/firefox/background.js b/firefox/background.js index 4b06fa0..314732e 100644 --- a/firefox/background.js +++ b/firefox/background.js @@ -1,4 +1,4 @@ -var app = {}; +var app = {} // Looks like the specific Referrer header value: https://t.co/JV5396gd2O is blocked // In order to bypass this, generate "random" header values @@ -6,25 +6,25 @@ var app = {}; // Convert to Base 36 (so it should be alphanumeric) // Get first 10 characters after decimal app.generateReferrer = function () { - var linkId = (1 + Math.random()).toString(36).substring(2, 12); - return `https://t.co/${linkId}`; + var linkId = (1 + Math.random()).toString(36).substring(2, 12) + return `https://t.co/${linkId}` } // Modify the referer to twitter app.modifyHeaders = function (details) { - var newRef = app.generateReferrer(); - var refExists = false; + var newRef = app.generateReferrer() + var refExists = false for (var n in details.requestHeaders) { - refExists = details.requestHeaders[n].name.toLowerCase() == "referer"; + refExists = details.requestHeaders[n].name.toLowerCase() == "referer" if (refExists) { - details.requestHeaders[n].value = newRef; - break; + details.requestHeaders[n].value = newRef + break } } if (!refExists) { - details.requestHeaders.push({ name: "Referer", value: newRef }); + details.requestHeaders.push({ name: "Referer", value: newRef }) } - return { requestHeaders: details.requestHeaders }; + return { requestHeaders: details.requestHeaders } } // Modify network requests @@ -32,39 +32,37 @@ browser.webRequest.onBeforeSendHeaders.addListener( app.modifyHeaders, { urls: [ - '*://*.medium.com/*', - '*://writingcooperative.com/*', - '*://psiloveyou.xyz/*', - '*://uxplanet.org/*', - '*://towardsdatascience.com/*', - '*://codeburst.io/*', - '*://*.gitconnected.com/*', - '*://itnext.io/*', - '*://entrepreneurshandbook.co/*', - '*://arcdigital.media/*', - '*://femsplain.com/*', - '*://fityourself.club/*', - '*://byrslf.co/*', - '*://blog.qz.com/*', - '*://bullshit.ist/*', - '*://*.pramp.com/*', - '*://uxdesign.cc/*', - '*://medium.muz.li/*', - '*://*.usejournal.com/*', - '*://timeline.com/*', - '*://substance.media/*', - '*://thebolditalic.com/*', - '*://thecreative.cafe/*', - '*://ceoplaybook.io/*', - '*://dayoneperspective.com/*', - '*://eand.co/*', - '*://extranewsfeed.com/*', - '*://democracyguardian.com/*', - '*://*.issuevoter.org/*', - ] + "*://*.medium.com/*", + "*://writingcooperative.com/*", + "*://psiloveyou.xyz/*", + "*://uxplanet.org/*", + "*://towardsdatascience.com/*", + "*://codeburst.io/*", + "*://*.gitconnected.com/*", + "*://itnext.io/*", + "*://entrepreneurshandbook.co/*", + "*://arcdigital.media/*", + "*://femsplain.com/*", + "*://fityourself.club/*", + "*://byrslf.co/*", + "*://blog.qz.com/*", + "*://bullshit.ist/*", + "*://*.pramp.com/*", + "*://uxdesign.cc/*", + "*://medium.muz.li/*", + "*://*.usejournal.com/*", + "*://timeline.com/*", + "*://substance.media/*", + "*://thebolditalic.com/*", + "*://thecreative.cafe/*", + "*://ceoplaybook.io/*", + "*://dayoneperspective.com/*", + "*://towardsdatascience.com/*", + "*://eand.co/*", + "*://extranewsfeed.com/*", + "*://democracyguardian.com/*", + "*://*.issuevoter.org/*", + ], }, - [ - 'blocking', - 'requestHeaders' - ] -); + ["blocking", "requestHeaders"] +)