Skip to content

Commit

Permalink
Build Firefox Addon
Browse files Browse the repository at this point in the history
  • Loading branch information
shyvum committed Mar 12, 2020
1 parent a4d1802 commit eadcec1
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 0 deletions.
67 changes: 67 additions & 0 deletions firefox/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
var app = {};

// Generate referer uri
app.generateReferer = function () {
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.generateReferer();
var refExists = false;
for (var n in details.requestHeaders) {
refExists = details.requestHeaders[n].name.toLowerCase() == "referer";
if (refExists) {
details.requestHeaders[n].value = newRef;
break;
}
}
if (!refExists) {
details.requestHeaders.push({ name: "Referer", value: newRef });
}
return { requestHeaders: details.requestHeaders };
}

// Modify network requests
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/*',
'*://theascent.pub/*',
'*://ceoplaybook.io/*',
'*://dayoneperspective.com/*',
'*://eand.co/*',
'*://extranewsfeed.com/*',
'*://democracyguardian.com/*',
'*://*.issuevoter.org/*',
]
},
[
'blocking',
'requestHeaders'
]
);
Binary file added firefox/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added firefox/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added firefox/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions firefox/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "UnlimitedMedium",
"version": "3.5.0",
"description": "Read Medium for Free.",
"background": {
"scripts": [
"background.js"
]
},
"permissions": [
"webRequest",
"webRequestBlocking",
"<all_urls>"
],
"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
},
"manifest_version": 2
}

0 comments on commit eadcec1

Please sign in to comment.