Skip to content
Snippets Groups Projects
Commit 826cfd9f authored by Thomas Rientjes's avatar Thomas Rientjes
Browse files

Improve compatibility with HTTPS Everywhere

parent b7392bca
No related branches found
No related tags found
No related merge requests found
data/_audit/node_modules
data/_audit/report.txt
audit/node_modules
audit/report.txt
*.xpi
*.crx
.idea
data/_audit/node_modules
data/_audit/report.txt
.jpmignore
.gitignore
.idea
*.xpi
test
.git
Decentraleyes (Experimental)
=============
A reimplementation of current features of Decentraleyes. This project will help bring Decentraleyes to WebExtensions (Firefox 57), as well as Chromium-based browsers, Opera, and possibly even Edge.
A reimplementation of current features of Decentraleyes. This project will help bring Decentraleyes to WebExtensions (Firefox 57 and higher), as well as Chromium-based browsers, Opera, and possibly even Edge.
......@@ -14,11 +14,17 @@
'use strict';
/**
* Variables
* Interceptor
*/
var interceptor = {};
/**
* Constants
*/
const HTTP_EXPRESSION = /^http?:\/\//;
/**
* Public Methods
*/
......@@ -56,11 +62,11 @@ interceptor._handleRequest = function (requestDetails, tabIdentifier, tabDetails
targetPath = requestAnalyzer.getLocalTarget(requestDetails);
if (!targetPath) {
return interceptor._handleMissingCandidate();
return interceptor._handleMissingCandidate(requestDetails.url);
}
if (!files[targetPath]) {
return interceptor._handleMissingCandidate();
return interceptor._handleMissingCandidate(requestDetails.url);
}
chrome.storage.local.get('amountInjected', function (items) {
......@@ -79,11 +85,29 @@ interceptor._handleRequest = function (requestDetails, tabIdentifier, tabDetails
};
};
interceptor._handleMissingCandidate = function () {
interceptor._handleMissingCandidate = function (requestUrl) {
return {
'cancel': interceptor.blockMissing
};
if (interceptor.blockMissing === true) {
return {
'cancel': true
};
}
if (requestUrl.match(HTTP_EXPRESSION)) {
requestUrl = requestUrl.replace(HTTP_EXPRESSION, 'https://');
return {
'redirectUrl': requestUrl
};
} else {
return {
'cancel': false
};
}
};
interceptor._applyBlockMissingPreference = function () {
......
{
"manifest_version": 2,
"name": "Decentraleyes",
"version": "1.3.7",
"version": "1.3.7.1",
"author": "Thomas Rientjes",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment