40 Commits

Author SHA1 Message Date
Thomas Rientjes
92f81f06bc Update package.json 2016-04-08 14:47:50 +02:00
Thomas Rientjes
b23a484b4c Update release notes 2016-04-08 14:22:18 +02:00
Thomas Rientjes
445d663d39 Resolve #61 by writing mapping exceptions 2016-04-05 18:00:43 +02:00
Thomas Rientjes
ff6244a311 Resolve #63 by adding shorthands 2016-04-03 19:10:32 +02:00
Thomas Rientjes
1a53d2a39a Resolve #61 by revising mapping system 2016-04-03 18:08:02 +02:00
Thomas
54e293f2b9 Update README.md 2016-04-03 15:36:02 +02:00
Thomas
301546619d Merge pull request #62 from Gitoffthelawn/patch-1
Add testing utility link and SEO term to README.md
2016-04-03 15:29:17 +02:00
Gitoffthelawn
6b510089e9 Add test site, add SEO term
Add the test site, and CDN as an SEO term
2016-04-03 02:07:47 -07:00
Thomas Rientjes
8617873115 Fix typo in release notes 2016-04-02 17:55:42 +02:00
Thomas Rientjes
c95a327363 Bump version to 1.3.0 2016-04-01 21:38:20 +02:00
Thomas Rientjes
bbd9c39a78 Update release notes 2016-04-01 21:35:38 +02:00
Thomas Rientjes
d93155844a Add support for Polish 2016-04-01 18:49:43 +02:00
Thomas Rientjes
16b887ff2e Add support for Japanese 2016-04-01 18:44:39 +02:00
Thomas Rientjes
96b957bb09 Add support for Italian 2016-04-01 18:40:23 +02:00
Thomas Rientjes
2a6a744156 Add support for Indonesian 2016-04-01 18:31:57 +02:00
Thomas
a77cd7f638 Merge pull request #57 from ngksternhagen/master
Remove unwanted whitespace from code
2016-03-31 21:56:15 +02:00
Klaus Sternhagen
feb5b19e2c remove extra whitespace 2016-03-30 11:45:18 -07:00
Thomas Rientjes
d89c22fc26 Add support for Yandex Static 2016-03-14 00:03:51 +01:00
Thomas Rientjes
ffed66c813 Restructure localizations 2016-03-13 23:40:09 +01:00
Thomas Rientjes
488fb1fa83 Add support for European Portuguese 2016-03-13 23:33:45 +01:00
Thomas Rientjes
64a2aefd25 Add support for German 2016-03-13 23:11:23 +01:00
Thomas Rientjes
9ee499620e Add support for Bulgarian 2016-03-06 01:01:19 +01:00
Thomas Rientjes
ac65964995 Add support for Spanish 2016-03-06 00:59:00 +01:00
Thomas Rientjes
14799d2814 Add support for Finnish 2016-03-06 00:57:09 +01:00
Thomas Rientjes
1399bb40fd Add support for French 2016-03-06 00:53:48 +01:00
Thomas Rientjes
e695023bd1 Add support for Simplified Chinese 2016-03-06 00:49:04 +01:00
Thomas Rientjes
685e108905 Resolve #48 by removing locale segments 2016-03-02 14:57:48 +01:00
Thomas
00c253d7cb Correct entry in chrome.manifest 2016-02-20 19:14:42 +01:00
Thomas Rientjes
c87a756533 Clean up unused items 2016-02-16 00:38:08 +01:00
Thomas Rientjes
216c205532 Update chrome.manifest 2016-02-15 22:46:19 +01:00
Thomas Rientjes
bbe5201e6e Update README.md 2016-02-15 22:42:41 +01:00
Thomas Rientjes
35a1563a69 Add localization support 2016-02-15 22:39:16 +01:00
Thomas Rientjes
f5f0154cfd Adjust domain tainting mechanism 2016-02-15 00:13:57 +01:00
Thomas Rientjes
7d8eee8607 Refactor domain tainting code 2016-02-12 03:00:28 +01:00
Thomas Rientjes
d0277c0348 Partial fix for bug #16 2016-02-11 19:47:26 +01:00
Thomas Rientjes
7a76fec2a8 Improve tests and error handling 2016-02-08 04:05:57 +01:00
Thomas Rientjes
2559457d0b Refactor existing code 2016-02-02 20:49:05 +01:00
Thomas
f15778550c Resolve #29 by adding SeaMonkey support 2016-02-02 01:05:47 +01:00
Thomas
7a5e154575 Merge pull request #19 from thegoodthings/releasenotespref
Add release note display preference
2015-12-21 22:45:54 +01:00
thegoodthings
4023d7c8d8 Add preference to allow hiding release notes on upgrade/install 2015-12-21 17:40:03 +00:00
32 changed files with 1003 additions and 416 deletions

View File

@@ -1,7 +1,7 @@
Decentraleyes
=============
A [Firefox add-on](https://addons.mozilla.org/en-US/firefox/addon/decentraleyes) that emulates Content Delivery Networks locally by intercepting requests, finding the required resource and injecting it into the environment. This all happens instantaneously, automatically, and no prior configuration is required.
A [Firefox add-on](https://addons.mozilla.org/firefox/addon/decentraleyes) that emulates Content Delivery Networks (CDNs) locally by intercepting requests, finding the required resource and injecting it into the environment. This all happens instantaneously, automatically, and no prior configuration is required. Feel free to use this [testing utility](https://decentraleyes.org/test) to see if it's properly installed, enabled, and correctly configured.
> **Note:** Decentraleyes is no silver bullet, but it does prevent a lot of websites from making you send these kinds of requests. Ultimately, you can make Decentraleyes block requests for any missing CDN resources, too.
@@ -23,14 +23,18 @@ Now that there's a solid, Mozilla approved, foundation, it's time to move forwar
> **Note:** These long-term goals are subjective to change, and can be discussed. That is, as long as the suggestions do not conflict with the ultimate goal of realizing a free and open standard for exchanging web resource bundles.
## Contributing
## Submitting Translations
Suggestions in the form of **Issues** and contributions in the form of **Pull Requests** are highly welcome. You can also use the contact details and PGP key on the add-on [download page](https://addons.mozilla.org/en-US/firefox/addon/decentraleyes) to get in touch.
Do you master a non-supported language? Please help out by translating this add-on on [Crowdin](https://crowdin.com/project/decentraleyes).
## Contributing Code
Suggestions in the form of **Issues** and contributions in the form of **Pull Requests** are highly welcome. You can also use the contact details and PGP key on the add-on [download page](https://addons.mozilla.org/firefox/addon/decentraleyes) to get in touch.
#### Prerequisites
* Jetpack Manager [jpm](https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/jpm#Installation) (a Node-based replacement for cfx).
* Firefox version 38 or later. *If you need to work with earlier versions of Firefox, you'll need to use the old cfx tool. See instructions for [getting started with cfx](https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Getting_started).
* Jetpack Manager [jpm](https://developer.mozilla.org/Add-ons/SDK/Tools/jpm#Installation) (a Node-based replacement for cfx).
* Firefox version 38 or later. *If you need to work with earlier versions of Firefox, you'll need to use the old cfx tool. See instructions for [getting started with cfx](https://developer.mozilla.org/Add-ons/SDK/Tutorials/Getting_started).
#### Build Instructions (Unix)
@@ -40,4 +44,4 @@ Suggestions in the form of **Issues** and contributions in the form of **Pull Re
## License
[MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0).
[MPL-2.0](https://www.mozilla.org/MPL/2.0).

14
chrome.manifest Normal file
View File

@@ -0,0 +1,14 @@
locale decentraleyes bg locale/bg/
locale decentraleyes de locale/de/
locale decentraleyes en-GB locale/en-GB/
locale decentraleyes en-US locale/en-US/
locale decentraleyes es locale/es/
locale decentraleyes fi locale/fi/
locale decentraleyes fr locale/fr/
locale decentraleyes id locale/id/
locale decentraleyes it locale/it/
locale decentraleyes ja locale/ja/
locale decentraleyes nl locale/nl/
locale decentraleyes pl locale/pl/
locale decentraleyes pt-PT locale/pt-PT/
locale decentraleyes zh-CN locale/zh-CN/

View File

@@ -2,9 +2,9 @@
"name": "decentraleyes-audit",
"version": "1.3.0",
"author": "Thomas Rientjes",
"license": "MPL 2.0",
"license": "MPL-2.0",
"description": "Library audit tool for Decentraleyes.",
"repository": "https://addons.mozilla.org/en-US/firefox/addon/decentraleyes/",
"repository": "https://addons.mozilla.org/firefox/addon/decentraleyes",
"keywords": [
"decentraleyes",
"audit"

View File

@@ -2,3 +2,4 @@ pref('extensions.jid1-BoFifL9Vbdl2zQ@jetpack.addNotice', true);
pref('extensions.jid1-BoFifL9Vbdl2zQ@jetpack.blockMissing', false);
pref('extensions.jid1-BoFifL9Vbdl2zQ@jetpack.domainWhitelist', '');
pref('extensions.jid1-BoFifL9Vbdl2zQ@jetpack.amountInjected', 0);
pref('extensions.jid1-BoFifL9Vbdl2zQ@jetpack.showReleaseNotes', true);

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -18,10 +18,7 @@
*/
var { Cc, Ci } = require('chrome');
var self = require('sdk/self');
var resourceData = self.data;
var version = self.version;
//noinspection JSUnresolvedFunction
var ioService = Cc['@mozilla.org/network/io-service;1']
@@ -33,6 +30,18 @@ var ioService = Cc['@mozilla.org/network/io-service;1']
*/
var files = require('./files');
/**
* Constants
*/
const DELIVERY_NOTICE = '/**\n * Local delivery by Decentraleyes (' + self.version + ').\n */\n\n';
/**
* Variables
*/
var resourceData = self.data;
/**
* Public Methods
*/
@@ -41,8 +50,8 @@ function getRedirectionURI(targetPath, characterSet, type) {
var data, dataURI, redirectionURI;
data = loadResource(targetPath);
dataURI = buildDataURI(type, characterSet, data);
data = _loadResource(targetPath);
dataURI = _buildDataURI(type, characterSet, data);
redirectionURI = ioService.newURI(dataURI, null, null);
return redirectionURI;
@@ -58,39 +67,31 @@ exports.getRedirectionURI = getRedirectionURI;
* Private Methods
*/
function loadResource(targetPath) {
function _loadResource(targetPath) {
var resource;
// Find the result inside a static path index.
if (files.indexOf(targetPath) == -1) {
throw 'The requested resource is missing.';
if (!files[targetPath]) {
throw new Error('The requested resource is missing.');
}
// Attempt to load resource contents.
try {
resource = resourceData.load(targetPath);
} catch (exception) {
throw exception;
}
return resource;
return resource = resourceData.load(targetPath);
}
function buildDataURI(type, characterSet, data) {
function _buildDataURI(type, characterSet, data) {
var addNotice, dataURI, notice;
var addNotice, dataURI;
//noinspection JSUnresolvedVariable
addNotice = require('sdk/simple-prefs').prefs.addNotice;
dataURI = 'data:' + type + ';charset=' + characterSet + ',';
notice = '/**\n * Local delivery by Decentraleyes (' + version + ').\n */\n\n';
if (!addNotice) {
dataURI = dataURI + encodeURIComponent(data);
} else {
dataURI = dataURI + encodeURIComponent(notice + data);
dataURI = dataURI + encodeURIComponent(DELIVERY_NOTICE + data);
}
return dataURI;

View File

@@ -17,244 +17,244 @@
* Files
*/
var files = [
var files = {
// AngularJS
'resources/angularjs/1.0.1/angular.min.js.dec',
'resources/angularjs/1.0.2/angular.min.js.dec',
'resources/angularjs/1.0.3/angular.min.js.dec',
'resources/angularjs/1.0.4/angular.min.js.dec',
'resources/angularjs/1.0.5/angular.min.js.dec',
'resources/angularjs/1.0.6/angular.min.js.dec',
'resources/angularjs/1.0.8/angular.min.js.dec',
'resources/angularjs/1.2.0/angular.min.js.dec',
'resources/angularjs/1.2.1/angular.min.js.dec',
'resources/angularjs/1.2.10/angular.min.js.dec',
'resources/angularjs/1.2.15/angular.min.js.dec',
'resources/angularjs/1.2.16/angular.min.js.dec',
'resources/angularjs/1.2.20/angular.min.js.dec',
'resources/angularjs/1.2.23/angular.min.js.dec',
'resources/angularjs/1.2.26/angular.min.js.dec',
'resources/angularjs/1.2.28/angular.min.js.dec',
'resources/angularjs/1.2.29/angular.min.js.dec',
'resources/angularjs/1.3.0/angular.min.js.dec',
'resources/angularjs/1.3.3/angular.min.js.dec',
'resources/angularjs/1.3.8/angular.min.js.dec',
'resources/angularjs/1.3.10/angular.min.js.dec',
'resources/angularjs/1.3.11/angular.min.js.dec',
'resources/angularjs/1.3.14/angular.min.js.dec',
'resources/angularjs/1.3.15/angular.min.js.dec',
'resources/angularjs/1.4.0/angular.min.js.dec',
'resources/angularjs/1.4.2/angular.min.js.dec',
'resources/angularjs/1.4.8/angular.min.js.dec',
'resources/angularjs/1.0.1/angular.min.js.dec': true,
'resources/angularjs/1.0.2/angular.min.js.dec': true,
'resources/angularjs/1.0.3/angular.min.js.dec': true,
'resources/angularjs/1.0.4/angular.min.js.dec': true,
'resources/angularjs/1.0.5/angular.min.js.dec': true,
'resources/angularjs/1.0.6/angular.min.js.dec': true,
'resources/angularjs/1.0.8/angular.min.js.dec': true,
'resources/angularjs/1.2.0/angular.min.js.dec': true,
'resources/angularjs/1.2.1/angular.min.js.dec': true,
'resources/angularjs/1.2.10/angular.min.js.dec': true,
'resources/angularjs/1.2.15/angular.min.js.dec': true,
'resources/angularjs/1.2.16/angular.min.js.dec': true,
'resources/angularjs/1.2.20/angular.min.js.dec': true,
'resources/angularjs/1.2.23/angular.min.js.dec': true,
'resources/angularjs/1.2.26/angular.min.js.dec': true,
'resources/angularjs/1.2.28/angular.min.js.dec': true,
'resources/angularjs/1.2.29/angular.min.js.dec': true,
'resources/angularjs/1.3.0/angular.min.js.dec': true,
'resources/angularjs/1.3.3/angular.min.js.dec': true,
'resources/angularjs/1.3.8/angular.min.js.dec': true,
'resources/angularjs/1.3.10/angular.min.js.dec': true,
'resources/angularjs/1.3.11/angular.min.js.dec': true,
'resources/angularjs/1.3.14/angular.min.js.dec': true,
'resources/angularjs/1.3.15/angular.min.js.dec': true,
'resources/angularjs/1.4.0/angular.min.js.dec': true,
'resources/angularjs/1.4.2/angular.min.js.dec': true,
'resources/angularjs/1.4.8/angular.min.js.dec': true,
// Backbone.js
'resources/backbone.js/0.9.0/backbone-min.js.dec',
'resources/backbone.js/0.9.1/backbone-min.js.dec',
'resources/backbone.js/0.9.2/backbone-min.js.dec',
'resources/backbone.js/0.9.9/backbone-min.js.dec',
'resources/backbone.js/0.9.10/backbone-min.js.dec',
'resources/backbone.js/1.0.0/backbone-min.js.dec',
'resources/backbone.js/1.1.0/backbone-min.js.dec',
'resources/backbone.js/1.1.1/backbone-min.js.dec',
'resources/backbone.js/1.1.2/backbone-min.js.dec',
'resources/backbone.js/1.2.0/backbone-min.js.dec',
'resources/backbone.js/1.2.1/backbone-min.js.dec',
'resources/backbone.js/1.2.2/backbone-min.js.dec',
'resources/backbone.js/1.2.3/backbone-min.js.dec',
'resources/backbone.js/0.9.0/backbone-min.js.dec': true,
'resources/backbone.js/0.9.1/backbone-min.js.dec': true,
'resources/backbone.js/0.9.2/backbone-min.js.dec': true,
'resources/backbone.js/0.9.9/backbone-min.js.dec': true,
'resources/backbone.js/0.9.10/backbone-min.js.dec': true,
'resources/backbone.js/1.0.0/backbone-min.js.dec': true,
'resources/backbone.js/1.1.0/backbone-min.js.dec': true,
'resources/backbone.js/1.1.1/backbone-min.js.dec': true,
'resources/backbone.js/1.1.2/backbone-min.js.dec': true,
'resources/backbone.js/1.2.0/backbone-min.js.dec': true,
'resources/backbone.js/1.2.1/backbone-min.js.dec': true,
'resources/backbone.js/1.2.2/backbone-min.js.dec': true,
'resources/backbone.js/1.2.3/backbone-min.js.dec': true,
// Dojo
'resources/dojo/1.4.1/dojo/dojo.js.dec',
'resources/dojo/1.4.5/dojo/dojo.js.dec',
'resources/dojo/1.5.0/dojo/dojo.js.dec',
'resources/dojo/1.6.1/dojo/dojo.js.dec',
'resources/dojo/1.7.5/dojo/dojo.js.dec',
'resources/dojo/1.8.3/dojo/dojo.js.dec',
'resources/dojo/1.8.7/dojo/dojo.js.dec',
'resources/dojo/1.8.9/dojo/dojo.js.dec',
'resources/dojo/1.9.1/dojo/dojo.js.dec',
'resources/dojo/1.9.3/dojo/dojo.js.dec',
'resources/dojo/1.9.7/dojo/dojo.js.dec',
'resources/dojo/1.10.4/dojo/dojo.js.dec',
'resources/dojo/1.4.1/dojo/dojo.js.dec': true,
'resources/dojo/1.4.5/dojo/dojo.js.dec': true,
'resources/dojo/1.5.0/dojo/dojo.js.dec': true,
'resources/dojo/1.6.1/dojo/dojo.js.dec': true,
'resources/dojo/1.7.5/dojo/dojo.js.dec': true,
'resources/dojo/1.8.3/dojo/dojo.js.dec': true,
'resources/dojo/1.8.7/dojo/dojo.js.dec': true,
'resources/dojo/1.8.9/dojo/dojo.js.dec': true,
'resources/dojo/1.9.1/dojo/dojo.js.dec': true,
'resources/dojo/1.9.3/dojo/dojo.js.dec': true,
'resources/dojo/1.9.7/dojo/dojo.js.dec': true,
'resources/dojo/1.10.4/dojo/dojo.js.dec': true,
// Ember.js
'resources/ember.js/1.0.1/ember.min.js.dec',
'resources/ember.js/1.1.3/ember.min.js.dec',
'resources/ember.js/1.2.2/ember.min.js.dec',
'resources/ember.js/1.3.2/ember.min.js.dec',
'resources/ember.js/1.4.0/ember.min.js.dec',
'resources/ember.js/1.5.1/ember.min.js.dec',
'resources/ember.js/2.0.0/ember.min.js.dec',
'resources/ember.js/2.0.2/ember.min.js.dec',
'resources/ember.js/2.1.0/ember.min.js.dec',
'resources/ember.js/1.0.1/ember.min.js.dec': true,
'resources/ember.js/1.1.3/ember.min.js.dec': true,
'resources/ember.js/1.2.2/ember.min.js.dec': true,
'resources/ember.js/1.3.2/ember.min.js.dec': true,
'resources/ember.js/1.4.0/ember.min.js.dec': true,
'resources/ember.js/1.5.1/ember.min.js.dec': true,
'resources/ember.js/2.0.0/ember.min.js.dec': true,
'resources/ember.js/2.0.2/ember.min.js.dec': true,
'resources/ember.js/2.1.0/ember.min.js.dec': true,
// Ext Core
'resources/ext-core/3.0.0/ext-core.js.dec',
'resources/ext-core/3.1.0/ext-core.js.dec',
'resources/ext-core/3.0.0/ext-core.js.dec': true,
'resources/ext-core/3.1.0/ext-core.js.dec': true,
// jQuery
'resources/jquery/1.2.3/jquery.min.js.dec',
'resources/jquery/1.2.6/jquery.min.js.dec',
'resources/jquery/1.3.0/jquery.min.js.dec',
'resources/jquery/1.3.1/jquery.min.js.dec',
'resources/jquery/1.3.2/jquery.min.js.dec',
'resources/jquery/1.4.0/jquery.min.js.dec',
'resources/jquery/1.4.1/jquery.min.js.dec',
'resources/jquery/1.4.2/jquery.min.js.dec',
'resources/jquery/1.4.3/jquery.min.js.dec',
'resources/jquery/1.4.4/jquery.min.js.dec',
'resources/jquery/1.5.0/jquery.min.js.dec',
'resources/jquery/1.5.1/jquery.min.js.dec',
'resources/jquery/1.5.2/jquery.min.js.dec',
'resources/jquery/1.6.0/jquery.min.js.dec',
'resources/jquery/1.6.1/jquery.min.js.dec',
'resources/jquery/1.6.2/jquery.min.js.dec',
'resources/jquery/1.6.3/jquery.min.js.dec',
'resources/jquery/1.6.4/jquery.min.js.dec',
'resources/jquery/1.7.0/jquery.min.js.dec',
'resources/jquery/1.7.1/jquery.min.js.dec',
'resources/jquery/1.7.2/jquery.min.js.dec',
'resources/jquery/1.8.0/jquery.min.js.dec',
'resources/jquery/1.8.1/jquery.min.js.dec',
'resources/jquery/1.8.2/jquery.min.js.dec',
'resources/jquery/1.8.3/jquery.min.js.dec',
'resources/jquery/1.9.0/jquery.min.js.dec',
'resources/jquery/1.9.1/jquery.min.js.dec',
'resources/jquery/1.10.0/jquery.min.js.dec',
'resources/jquery/1.10.1/jquery.min.js.dec',
'resources/jquery/1.10.2/jquery.min.js.dec',
'resources/jquery/1.11.0/jquery.min.js.dec',
'resources/jquery/1.11.1/jquery.min.js.dec',
'resources/jquery/1.11.2/jquery.min.js.dec',
'resources/jquery/1.11.3/jquery.min.js.dec',
'resources/jquery/2.0.0/jquery.min.js.dec',
'resources/jquery/2.0.1/jquery.min.js.dec',
'resources/jquery/2.0.2/jquery.min.js.dec',
'resources/jquery/2.0.3/jquery.min.js.dec',
'resources/jquery/2.1.0/jquery.min.js.dec',
'resources/jquery/2.1.1/jquery.min.js.dec',
'resources/jquery/2.1.3/jquery.min.js.dec',
'resources/jquery/2.1.4/jquery.min.js.dec',
'resources/jquery/1.2.3/jquery.min.js.dec': true,
'resources/jquery/1.2.6/jquery.min.js.dec': true,
'resources/jquery/1.3.0/jquery.min.js.dec': true,
'resources/jquery/1.3.1/jquery.min.js.dec': true,
'resources/jquery/1.3.2/jquery.min.js.dec': true,
'resources/jquery/1.4.0/jquery.min.js.dec': true,
'resources/jquery/1.4.1/jquery.min.js.dec': true,
'resources/jquery/1.4.2/jquery.min.js.dec': true,
'resources/jquery/1.4.3/jquery.min.js.dec': true,
'resources/jquery/1.4.4/jquery.min.js.dec': true,
'resources/jquery/1.5.0/jquery.min.js.dec': true,
'resources/jquery/1.5.1/jquery.min.js.dec': true,
'resources/jquery/1.5.2/jquery.min.js.dec': true,
'resources/jquery/1.6.0/jquery.min.js.dec': true,
'resources/jquery/1.6.1/jquery.min.js.dec': true,
'resources/jquery/1.6.2/jquery.min.js.dec': true,
'resources/jquery/1.6.3/jquery.min.js.dec': true,
'resources/jquery/1.6.4/jquery.min.js.dec': true,
'resources/jquery/1.7.0/jquery.min.js.dec': true,
'resources/jquery/1.7.1/jquery.min.js.dec': true,
'resources/jquery/1.7.2/jquery.min.js.dec': true,
'resources/jquery/1.8.0/jquery.min.js.dec': true,
'resources/jquery/1.8.1/jquery.min.js.dec': true,
'resources/jquery/1.8.2/jquery.min.js.dec': true,
'resources/jquery/1.8.3/jquery.min.js.dec': true,
'resources/jquery/1.9.0/jquery.min.js.dec': true,
'resources/jquery/1.9.1/jquery.min.js.dec': true,
'resources/jquery/1.10.0/jquery.min.js.dec': true,
'resources/jquery/1.10.1/jquery.min.js.dec': true,
'resources/jquery/1.10.2/jquery.min.js.dec': true,
'resources/jquery/1.11.0/jquery.min.js.dec': true,
'resources/jquery/1.11.1/jquery.min.js.dec': true,
'resources/jquery/1.11.2/jquery.min.js.dec': true,
'resources/jquery/1.11.3/jquery.min.js.dec': true,
'resources/jquery/2.0.0/jquery.min.js.dec': true,
'resources/jquery/2.0.1/jquery.min.js.dec': true,
'resources/jquery/2.0.2/jquery.min.js.dec': true,
'resources/jquery/2.0.3/jquery.min.js.dec': true,
'resources/jquery/2.1.0/jquery.min.js.dec': true,
'resources/jquery/2.1.1/jquery.min.js.dec': true,
'resources/jquery/2.1.3/jquery.min.js.dec': true,
'resources/jquery/2.1.4/jquery.min.js.dec': true,
// jQuery UI
'resources/jqueryui/1.5.3/jquery-ui.min.js.dec',
'resources/jqueryui/1.6.0/jquery-ui.min.js.dec',
'resources/jqueryui/1.7.3/jquery-ui.min.js.dec',
'resources/jqueryui/1.8.24/jquery-ui.min.js.dec',
'resources/jqueryui/1.9.2/jquery-ui.min.js.dec',
'resources/jqueryui/1.10.4/jquery-ui.min.js.dec',
'resources/jqueryui/1.11.0/jquery-ui.min.js.dec',
'resources/jqueryui/1.11.1/jquery-ui.min.js.dec',
'resources/jqueryui/1.11.2/jquery-ui.min.js.dec',
'resources/jqueryui/1.11.3/jquery-ui.min.js.dec',
'resources/jqueryui/1.11.4/jquery-ui.min.js.dec',
'resources/jqueryui/1.5.3/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.6.0/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.7.3/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.8.24/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.9.2/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.10.4/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.11.0/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.11.1/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.11.2/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.11.3/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.11.4/jquery-ui.min.js.dec': true,
// Modernizr
'resources/modernizr/2.6.2/modernizr.min.js.dec',
'resources/modernizr/2.7.1/modernizr.min.js.dec',
'resources/modernizr/2.7.2/modernizr.min.js.dec',
'resources/modernizr/2.8.2/modernizr.min.js.dec',
'resources/modernizr/2.8.3/modernizr.min.js.dec',
'resources/modernizr/2.6.2/modernizr.min.js.dec': true,
'resources/modernizr/2.7.1/modernizr.min.js.dec': true,
'resources/modernizr/2.7.2/modernizr.min.js.dec': true,
'resources/modernizr/2.8.2/modernizr.min.js.dec': true,
'resources/modernizr/2.8.3/modernizr.min.js.dec': true,
// MooTools
'resources/mootools/1.1.1/mootools-yui-compressed.js.dec',
'resources/mootools/1.1.2/mootools-yui-compressed.js.dec',
'resources/mootools/1.2.1/mootools-yui-compressed.js.dec',
'resources/mootools/1.2.3/mootools-yui-compressed.js.dec',
'resources/mootools/1.2.4/mootools-yui-compressed.js.dec',
'resources/mootools/1.2.5/mootools-yui-compressed.js.dec',
'resources/mootools/1.3.0/mootools-yui-compressed.js.dec',
'resources/mootools/1.3.1/mootools-yui-compressed.js.dec',
'resources/mootools/1.3.2/mootools-yui-compressed.js.dec',
'resources/mootools/1.4.1/mootools-yui-compressed.js.dec',
'resources/mootools/1.4.5/mootools-yui-compressed.js.dec',
'resources/mootools/1.5.0/mootools-yui-compressed.js.dec',
'resources/mootools/1.5.1/mootools-yui-compressed.js.dec',
'resources/mootools/1.1.1/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.1.2/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.2.1/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.2.3/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.2.4/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.2.5/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.3.0/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.3.1/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.3.2/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.4.1/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.4.5/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.5.0/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.5.1/mootools-yui-compressed.js.dec': true,
// Prototype
'resources/prototype/1.6.0.2/prototype.js.dec',
'resources/prototype/1.6.0.3/prototype.js.dec',
'resources/prototype/1.6.1.0/prototype.js.dec',
'resources/prototype/1.7.0.0/prototype.js.dec',
'resources/prototype/1.7.1.0/prototype.js.dec',
'resources/prototype/1.7.2.0/prototype.js.dec',
'resources/prototype/1.7.3.0/prototype.js.dec',
'resources/prototype/1.6.0.2/prototype.js.dec': true,
'resources/prototype/1.6.0.3/prototype.js.dec': true,
'resources/prototype/1.6.1.0/prototype.js.dec': true,
'resources/prototype/1.7.0.0/prototype.js.dec': true,
'resources/prototype/1.7.1.0/prototype.js.dec': true,
'resources/prototype/1.7.2.0/prototype.js.dec': true,
'resources/prototype/1.7.3.0/prototype.js.dec': true,
// Scriptaculous
'resources/scriptaculous/1.8.1/scriptaculous.js.dec',
'resources/scriptaculous/1.8.2/scriptaculous.js.dec',
'resources/scriptaculous/1.8.3/scriptaculous.js.dec',
'resources/scriptaculous/1.9.0/scriptaculous.js.dec',
'resources/scriptaculous/1.8.1/scriptaculous.js.dec': true,
'resources/scriptaculous/1.8.2/scriptaculous.js.dec': true,
'resources/scriptaculous/1.8.3/scriptaculous.js.dec': true,
'resources/scriptaculous/1.9.0/scriptaculous.js.dec': true,
// SWFObject
'resources/swfobject/2.1/swfobject.js.dec',
'resources/swfobject/2.2/swfobject.js.dec',
'resources/swfobject/2.1/swfobject.js.dec': true,
'resources/swfobject/2.2/swfobject.js.dec': true,
// Underscore.js
'resources/underscore.js/1.3.0/underscore-min.js.dec',
'resources/underscore.js/1.3.1/underscore-min.js.dec',
'resources/underscore.js/1.3.3/underscore-min.js.dec',
'resources/underscore.js/1.4.0/underscore-min.js.dec',
'resources/underscore.js/1.4.1/underscore-min.js.dec',
'resources/underscore.js/1.4.2/underscore-min.js.dec',
'resources/underscore.js/1.4.3/underscore-min.js.dec',
'resources/underscore.js/1.4.4/underscore-min.js.dec',
'resources/underscore.js/1.5.0/underscore-min.js.dec',
'resources/underscore.js/1.5.1/underscore-min.js.dec',
'resources/underscore.js/1.5.2/underscore-min.js.dec',
'resources/underscore.js/1.6.0/underscore-min.js.dec',
'resources/underscore.js/1.7.0/underscore-min.js.dec',
'resources/underscore.js/1.8.0/underscore-min.js.dec',
'resources/underscore.js/1.8.1/underscore-min.js.dec',
'resources/underscore.js/1.8.2/underscore-min.js.dec',
'resources/underscore.js/1.8.3/underscore-min.js.dec',
'resources/underscore.js/1.3.0/underscore-min.js.dec': true,
'resources/underscore.js/1.3.1/underscore-min.js.dec': true,
'resources/underscore.js/1.3.3/underscore-min.js.dec': true,
'resources/underscore.js/1.4.0/underscore-min.js.dec': true,
'resources/underscore.js/1.4.1/underscore-min.js.dec': true,
'resources/underscore.js/1.4.2/underscore-min.js.dec': true,
'resources/underscore.js/1.4.3/underscore-min.js.dec': true,
'resources/underscore.js/1.4.4/underscore-min.js.dec': true,
'resources/underscore.js/1.5.0/underscore-min.js.dec': true,
'resources/underscore.js/1.5.1/underscore-min.js.dec': true,
'resources/underscore.js/1.5.2/underscore-min.js.dec': true,
'resources/underscore.js/1.6.0/underscore-min.js.dec': true,
'resources/underscore.js/1.7.0/underscore-min.js.dec': true,
'resources/underscore.js/1.8.0/underscore-min.js.dec': true,
'resources/underscore.js/1.8.1/underscore-min.js.dec': true,
'resources/underscore.js/1.8.2/underscore-min.js.dec': true,
'resources/underscore.js/1.8.3/underscore-min.js.dec': true,
// Web Font Loader
'resources/webfont/1.0.0/webfont.js.dec',
'resources/webfont/1.0.1/webfont.js.dec',
'resources/webfont/1.0.2/webfont.js.dec',
'resources/webfont/1.0.3/webfont.js.dec',
'resources/webfont/1.0.4/webfont.js.dec',
'resources/webfont/1.0.5/webfont.js.dec',
'resources/webfont/1.0.6/webfont.js.dec',
'resources/webfont/1.0.9/webfont.js.dec',
'resources/webfont/1.0.10/webfont.js.dec',
'resources/webfont/1.0.11/webfont.js.dec',
'resources/webfont/1.0.12/webfont.js.dec',
'resources/webfont/1.0.13/webfont.js.dec',
'resources/webfont/1.0.14/webfont.js.dec',
'resources/webfont/1.0.15/webfont.js.dec',
'resources/webfont/1.0.16/webfont.js.dec',
'resources/webfont/1.0.17/webfont.js.dec',
'resources/webfont/1.0.18/webfont.js.dec',
'resources/webfont/1.0.19/webfont.js.dec',
'resources/webfont/1.0.21/webfont.js.dec',
'resources/webfont/1.0.22/webfont.js.dec',
'resources/webfont/1.0.23/webfont.js.dec',
'resources/webfont/1.0.24/webfont.js.dec',
'resources/webfont/1.0.25/webfont.js.dec',
'resources/webfont/1.0.26/webfont.js.dec',
'resources/webfont/1.0.27/webfont.js.dec',
'resources/webfont/1.0.28/webfont.js.dec',
'resources/webfont/1.0.29/webfont.js.dec',
'resources/webfont/1.0.30/webfont.js.dec',
'resources/webfont/1.0.31/webfont.js.dec',
'resources/webfont/1.1.0/webfont.js.dec',
'resources/webfont/1.1.1/webfont.js.dec',
'resources/webfont/1.1.2/webfont.js.dec',
'resources/webfont/1.3.0/webfont.js.dec',
'resources/webfont/1.4.2/webfont.js.dec',
'resources/webfont/1.4.6/webfont.js.dec',
'resources/webfont/1.4.7/webfont.js.dec',
'resources/webfont/1.4.8/webfont.js.dec',
'resources/webfont/1.4.10/webfont.js.dec',
'resources/webfont/1.5.0/webfont.js.dec',
'resources/webfont/1.5.2/webfont.js.dec',
'resources/webfont/1.5.3/webfont.js.dec',
'resources/webfont/1.5.6/webfont.js.dec',
'resources/webfont/1.5.10/webfont.js.dec',
'resources/webfont/1.5.18/webfont.js.dec'
];
'resources/webfont/1.0.0/webfont.js.dec': true,
'resources/webfont/1.0.1/webfont.js.dec': true,
'resources/webfont/1.0.2/webfont.js.dec': true,
'resources/webfont/1.0.3/webfont.js.dec': true,
'resources/webfont/1.0.4/webfont.js.dec': true,
'resources/webfont/1.0.5/webfont.js.dec': true,
'resources/webfont/1.0.6/webfont.js.dec': true,
'resources/webfont/1.0.9/webfont.js.dec': true,
'resources/webfont/1.0.10/webfont.js.dec': true,
'resources/webfont/1.0.11/webfont.js.dec': true,
'resources/webfont/1.0.12/webfont.js.dec': true,
'resources/webfont/1.0.13/webfont.js.dec': true,
'resources/webfont/1.0.14/webfont.js.dec': true,
'resources/webfont/1.0.15/webfont.js.dec': true,
'resources/webfont/1.0.16/webfont.js.dec': true,
'resources/webfont/1.0.17/webfont.js.dec': true,
'resources/webfont/1.0.18/webfont.js.dec': true,
'resources/webfont/1.0.19/webfont.js.dec': true,
'resources/webfont/1.0.21/webfont.js.dec': true,
'resources/webfont/1.0.22/webfont.js.dec': true,
'resources/webfont/1.0.23/webfont.js.dec': true,
'resources/webfont/1.0.24/webfont.js.dec': true,
'resources/webfont/1.0.25/webfont.js.dec': true,
'resources/webfont/1.0.26/webfont.js.dec': true,
'resources/webfont/1.0.27/webfont.js.dec': true,
'resources/webfont/1.0.28/webfont.js.dec': true,
'resources/webfont/1.0.29/webfont.js.dec': true,
'resources/webfont/1.0.30/webfont.js.dec': true,
'resources/webfont/1.0.31/webfont.js.dec': true,
'resources/webfont/1.1.0/webfont.js.dec': true,
'resources/webfont/1.1.1/webfont.js.dec': true,
'resources/webfont/1.1.2/webfont.js.dec': true,
'resources/webfont/1.3.0/webfont.js.dec': true,
'resources/webfont/1.4.2/webfont.js.dec': true,
'resources/webfont/1.4.6/webfont.js.dec': true,
'resources/webfont/1.4.7/webfont.js.dec': true,
'resources/webfont/1.4.8/webfont.js.dec': true,
'resources/webfont/1.4.10/webfont.js.dec': true,
'resources/webfont/1.5.0/webfont.js.dec': true,
'resources/webfont/1.5.2/webfont.js.dec': true,
'resources/webfont/1.5.3/webfont.js.dec': true,
'resources/webfont/1.5.6/webfont.js.dec': true,
'resources/webfont/1.5.10/webfont.js.dec': true,
'resources/webfont/1.5.18/webfont.js.dec': true
};
/**
* Exports

View File

@@ -21,15 +21,32 @@ var { Class } = require('sdk/core/heritage');
var { Unknown } = require('sdk/platform/xpcom');
var { Cc, Ci, Cr } = require('chrome');
/**
* Gets and sets add-on specific preferences.
* @var {object} simplePreferences
*/
var simplePreferences = require('sdk/simple-prefs');
/**
* Retains data across application restarts.
* @var {object} simpleStorage
*/
var simpleStorage = require('sdk/simple-storage');
//noinspection JSUnresolvedFunction
var observerService = Cc['@mozilla.org/observer-service;1']
.getService(Ci.nsIObserverService);
var preferences = require('sdk/simple-prefs').prefs;
var requestAnalyzer = require('./request-analyzer');
var dataHandler = require('./data-handler');
/**
* Variables
*/
var preferences = simplePreferences.prefs;
var storage = simpleStorage.storage;
/**
* Interceptor Class
*/
@@ -48,6 +65,10 @@ var Interceptor = new Class({
observerService.removeObserver(this, this.topic);
},
/**
* Called whenever an HTTP request is made.
* @param httpChannel
*/
observe: function (httpChannel) {
var validCandidate, target, characterSet, redirectionURI;
@@ -65,27 +86,11 @@ var Interceptor = new Class({
// Remove referer header from request.
httpChannel.setRequestHeader('Referer', null, false);
// Temporary fix for reported issues with the Play Store website.
// Temporary fix for reported issues with the Report URI website.
var requestDomain = null;
if (httpChannel.loadInfo && httpChannel.loadInfo.loadingDocument && httpChannel.loadInfo.loadingDocument.domain) {
requestDomain = httpChannel.loadInfo.loadingDocument.domain;
} else if (httpChannel.referrer && httpChannel.referrer.host) {
requestDomain = httpChannel.referrer.host;
}
if (requestDomain === 'play.google.com' || requestDomain === 'report-uri.io') {
this.handleMissingCandidate(httpChannel);
return;
}
// Convert the original request URI to a local target.
target = requestAnalyzer.getLocalTarget(httpChannel.URI.host, httpChannel.URI.path);
if (!target) {
this.handleMissingCandidate(httpChannel);
return;
return this.handleMissingCandidate(httpChannel);
}
characterSet = httpChannel.URI.originCharset;
@@ -94,16 +99,29 @@ var Interceptor = new Class({
try {
redirectionURI = dataHandler.getRedirectionURI(target.path, characterSet, target.type);
} catch (exception) {
this.handleMissingCandidate(httpChannel);
return;
return this.handleMissingCandidate(httpChannel);
}
// Fix for reported edge-case issues with specific websites.
var initiatorDomain =
httpChannel.loadInfo && httpChannel.loadInfo.loadingDocument && httpChannel.loadInfo.loadingDocument.domain ||
httpChannel.referrer && httpChannel.referrer.host;
if (storage.taintedDomains[initiatorDomain]) {
return this.handleMissingCandidate(httpChannel);
}
// Redirect the HTTP channel to the the local destination.
httpChannel.redirectTo(redirectionURI);
//noinspection JSUnresolvedVariable
preferences.amountInjected++;
},
/**
* Called when a valid candidate cannot be injected.
* @param httpChannel
*/
handleMissingCandidate: function (httpChannel) {
//noinspection JSUnresolvedVariable

152
lib/load-watcher.js Normal file
View File

@@ -0,0 +1,152 @@
/**
* Load Watcher
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2016-02-04
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
/**
* Imports
*/
var { Class } = require('sdk/core/heritage');
var { Unknown, Factory } = require('sdk/platform/xpcom');
var { Cc, Ci, Cu } = require('chrome');
var xpcom = require('sdk/platform/xpcom');
/**
* Resource version mappings.
* @var {object} mappings
*/
var mappings = require('./mappings');
/**
* Retains data across application restarts.
* @var {object} simpleStorage
*/
var simpleStorage = require('sdk/simple-storage');
//noinspection JSUnresolvedFunction
var categoryManager = Cc['@mozilla.org/categorymanager;1']
.getService(Ci.nsICategoryManager);
/**
* Constants
*/
const CONTRACT_ID = '@decentraleyes.org/load-watcher;1';
const SCRIPT_CONTENT_TYPE = Ci.nsIContentPolicy.TYPE_SCRIPT;
const SCRIPT_ELEMENT = Ci.nsIDOMHTMLScriptElement;
const REQUEST_ACCEPTATION = Ci.nsIContentPolicy.ACCEPT;
/**
* Variables
*/
var storage = simpleStorage.storage;
/**
* Tainted domains that are not automatically detectable.
* @var {object} undetectableTaintedDomains
*/
var undetectableTaintedDomains = {
'passport.twitch.tv': true,
'minigames.mail.ru': true
};
/**
* Initializations
*/
storage.taintedDomains = storage.taintedDomains || undetectableTaintedDomains;
/**
* Load Watcher Class
*/
var LoadWatcher = new Class({
extends: Unknown,
interfaces: ['nsIContentPolicy'],
get wrappedJSObject() {
return this
},
register: function () {
categoryManager.deleteCategoryEntry('content-policy', CONTRACT_ID, false);
categoryManager.addCategoryEntry('content-policy', CONTRACT_ID, CONTRACT_ID, false, true);
},
shouldLoad: function (contentType, contentLocation, requestOrigin, node) {
if (contentType == SCRIPT_CONTENT_TYPE && mappings[contentLocation.host]) {
if (node instanceof SCRIPT_ELEMENT) {
if (node.hasAttribute('crossorigin') || node.hasAttribute('integrity')) {
// Add corresponding origin domain to the list of tainted domains.
storage.taintedDomains[requestOrigin.host] = true;
}
}
}
// Accept the resource load request.
return REQUEST_ACCEPTATION;
}
});
/**
* Load Watcher Factory
*/
var factory = Factory({
contract: CONTRACT_ID,
Component: LoadWatcher,
unregister: false
});
/**
* Unregister
*/
var unload = require('sdk/system/unload');
unload.when(function () {
function trueUnregister() {
categoryManager.deleteCategoryEntry('content-policy', CONTRACT_ID, false);
try {
xpcom.unregister(factory);
} catch (exception) {
Cu.reportError(exception);
}
}
if ('dispatch' in Cu) {
Cu.dispatch(trueUnregister, trueUnregister);
} else {
Cu.import('resource://gre/modules/Services.jsm');
Services.tm.mainThread.dispatch(trueUnregister, 0);
}
});
/**
* Exports
*/
module.exports = LoadWatcher;

View File

@@ -18,6 +18,8 @@
*/
var Interceptor = require('./interceptor');
var LoadWatcher = require('./load-watcher');
var preferences = require('sdk/simple-prefs').prefs;
var tabs = require("sdk/tabs");
@@ -26,14 +28,16 @@ var tabs = require("sdk/tabs");
*/
var interceptor = new Interceptor();
var loadWatcher = new LoadWatcher();
// Executed as soon as the add-on is loaded.
exports.main = function (options) {
// Initialize add-on state.
interceptor.register();
loadWatcher.register();
if (options.loadReason === 'install' || options.loadReason === 'upgrade') {
if (preferences.showReleaseNotes && (options.loadReason === 'install' || options.loadReason === 'upgrade')) {
if (preferences['sdk.baseURI']) {
tabs.open(preferences['sdk.baseURI'] + 'static/release-notes.html');

View File

@@ -41,7 +41,7 @@ var mappings = {
'swfobject/{version}/swfobject.': resources.swfobject,
'webfont/{version}/webfont.': resources.webfont,
// Common Shorthand Notations
// Common Shorthand Notations [Deprecated]
'dojo/1/dojo/dojo.': {
path: 'resources/dojo/1.6.1/dojo/dojo.js.dec',
type: 'application/javascript'
@@ -84,6 +84,7 @@ var mappings = {
'ajax.aspnetcdn.com': {
'/ajax/': {
'jQuery/jquery-{version}.': resources.jQuery,
'jquery/jquery-{version}.': resources.jQuery,
'modernizr/modernizr-{version}.': resources.modernizr
}
},
@@ -91,6 +92,7 @@ var mappings = {
'ajax.microsoft.com': {
'/ajax/': {
'jQuery/jquery-{version}.': resources.jQuery,
'jquery/jquery-{version}.': resources.jQuery,
'modernizr/modernizr-{version}.': resources.modernizr
}
},
@@ -122,7 +124,7 @@ var mappings = {
'ui/{version}/jquery-ui.js': resources.jQueryUI,
'ui/{version}/jquery-ui.min.js': resources.jQueryUI,
// Common Shorthand Notations
// Common Shorthand Notations [Deprecated]
'jquery-latest.': {
path: 'resources/jquery/1.11.1/jquery.min.js.dec',
type: 'application/javascript'
@@ -130,6 +132,46 @@ var mappings = {
'jquery.': {
path: 'resources/jquery/1.11.1/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.3.min.js': {
path: 'resources/jquery/1.3.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.3.js': {
path: 'resources/jquery/1.3.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.4.min.js': {
path: 'resources/jquery/1.4.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.4.js': {
path: 'resources/jquery/1.4.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.5.min.js': {
path: 'resources/jquery/1.5.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.5.js': {
path: 'resources/jquery/1.5.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.6.min.js': {
path: 'resources/jquery/1.6.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.6.js': {
path: 'resources/jquery/1.6.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.7.min.js': {
path: 'resources/jquery/1.7.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.7.js': {
path: 'resources/jquery/1.7.0/jquery.min.js.dec',
type: 'application/javascript'
}
}
},
@@ -152,6 +194,25 @@ var mappings = {
}
},
// Yandex CDN
'yastatic.net': {
'/': {
'angularjs/{version}/angular.': resources.angular,
'backbone/{version}/backbone.': resources.backbone,
'backbone/{version}/backbone-min.': resources.backbone,
'dojo/{version}/dojo/dojo.': resources.dojo,
'ext-core/{version}/ext-core.': resources.extCore,
'jquery/{version}/jquery.': resources.jQuery,
'jquery-ui/{version}/jquery-ui.js': resources.jQueryUI,
'jquery-ui/{version}/jquery-ui.min.js': resources.jQueryUI,
'modernizr/{version}/modernizr.': resources.modernizr,
'prototype/{version}/prototype.': resources.prototypeJS,
'scriptaculous/{version}/scriptaculous.': resources.scriptaculous,
'swfobject/{version}/swfobject.': resources.swfobject,
'underscore/{version}/underscore.': resources.underscore,
'underscore/{version}/underscore-min.': resources.underscore
}
},
// Yandex CDN [Deprecated]
'yandex.st': {
'/': {
'angularjs/{version}/angular.': resources.angular,

View File

@@ -17,172 +17,167 @@
* Imports
*/
var preferences = require('sdk/simple-prefs').prefs;
/**
* Resource version mappings.
* @var {object} mappings
*/
var mappings = require('./mappings');
/**
* Gets and sets add-on specific preferences.
* @var {object} simplePreferences
*/
var simplePreferences = require('sdk/simple-prefs');
/**
* Constants
*/
const MAPPING_FILE_EXPRESSION = new RegExp('.map$', 'i');
const VERSION_EXPRESSION = /(?:\d{1,2}\.){1,3}\d{1,2}/;
const VERSION_PLACEHOLDER = '{version}';
const WEB_PREFIX_VALUE = 'www.';
const WEB_PREFIX_LENGTH = WEB_PREFIX_VALUE.length;
const VALUE_SEPARATOR = ';';
/**
* Variables
*/
var whitelistedDomains = [];
var preferences = simplePreferences.prefs;
var whitelistedDomains = {};
/**
* Initializations
*/
applyWhitelistPreference();
_applyWhitelistPreference();
/**
* Event Handlers
*/
require('sdk/simple-prefs').on('domainWhitelist', applyWhitelistPreference);
simplePreferences.on('domainWhitelist', _applyWhitelistPreference);
/**
* Public Methods
*/
function isValidCandidate(httpChannel) {
exports.isValidCandidate = function (httpChannel) {
// See if the request is targeted at a Content Delivery Network.
if (mappings[httpChannel.URI.host] === undefined) {
return false;
}
var requestDomain = null;
// Attempt to determine the domain of the request initiator.
var initiatorDomain =
httpChannel.loadInfo && httpChannel.loadInfo.loadingDocument && httpChannel.loadInfo.loadingDocument.domain ||
httpChannel.referrer && httpChannel.referrer.host;
if (httpChannel.loadInfo && httpChannel.loadInfo.loadingDocument && httpChannel.loadInfo.loadingDocument.domain) {
requestDomain = normalizeDomain(httpChannel.loadInfo.loadingDocument.domain);
} else if (httpChannel.referrer && httpChannel.referrer.host) {
requestDomain = normalizeDomain(httpChannel.referrer.host);
}
if (whitelistedDomains.length > 0 && requestDomain !== null) {
for (let domain of whitelistedDomains) {
if (domain === requestDomain) {
// Remove referer header from request.
httpChannel.setRequestHeader('Referer', null, false);
return false;
}
}
// If the request initiator could be determined and is whitelisted.
if (initiatorDomain && whitelistedDomains[_normalizeDomain(initiatorDomain)]) {
// Remove referer header from request.
httpChannel.setRequestHeader('Referer', null, false);
return false;
}
// Only requests of type GET can be valid candidates.
return httpChannel.requestMethod === 'GET';
}
};
function getLocalTarget(channelHost, channelPath) {
exports.getLocalTarget = function (channelHost, channelPath) {
var basePath, hostMappings, resourceMappings, localTarget;
var hostMappings, basePath, resourceMappings;
// Use the proper mappings for the targeted host.
hostMappings = mappings[channelHost];
// Ignore mapping files.
if (channelPath.indexOf('.min.js.map') > -1) {
return false;
}
if (channelPath.indexOf('.min.map') > -1) {
return false;
}
basePath = matchBasePath(hostMappings, channelPath);
if (!basePath) {
// Resource mapping files are never locally available.
if (MAPPING_FILE_EXPRESSION.test(channelPath)) {
return false;
}
basePath = _matchBasePath(hostMappings, channelPath);
resourceMappings = hostMappings[basePath];
localTarget = matchResourcePath(resourceMappings, basePath, channelPath);
if (!localTarget) {
if (!resourceMappings) {
return false;
}
return localTarget;
}
/**
* Exports
*/
exports.isValidCandidate = isValidCandidate;
exports.getLocalTarget = getLocalTarget;
// Return either the local target's path or false.
return _findLocalTarget(resourceMappings, basePath, channelPath);
};
/**
* Private Methods
*/
function matchBasePath(hostMappings, channelPath) {
function _matchBasePath(hostMappings, channelPath) {
for (let basePath in hostMappings) {
for (let basePath of Object.keys(hostMappings)) {
if (hostMappings.hasOwnProperty(basePath)) {
if (channelPath.startsWith(basePath)) {
return basePath;
}
if (channelPath.startsWith(basePath)) {
return basePath;
}
}
return false;
}
function matchResourcePath(resourceMappings, basePath, channelPath) {
function _findLocalTarget(resourceMappings, basePath, channelPath) {
var resourcePath, versionNumber, resourcePattern;
resourcePath = channelPath.replace(basePath, '');
versionNumber = resourcePath.match(/(?:\d{1,2}\.){1,3}\d{1,2}/);
resourcePattern = resourcePath.replace(versionNumber, '{version}');
versionNumber = resourcePath.match(VERSION_EXPRESSION);
resourcePattern = resourcePath.replace(versionNumber, VERSION_PLACEHOLDER);
for (let resourceMold in resourceMappings) {
// Determine if the resource path has a static mapping.
if (resourceMappings[resourcePath]) {
if (resourceMappings.hasOwnProperty(resourceMold)) {
// Prepare and return a local target.
return {
path: resourceMappings[resourcePath].path,
type: resourceMappings[resourcePath].type
};
}
if (resourcePattern.startsWith(resourceMold)) {
// Determine if the resource path fits into a resource mold.
for (let resourceMold of Object.keys(resourceMappings)) {
var localTarget = {
path: resourceMappings[resourceMold].path,
type: resourceMappings[resourceMold].type
};
if (resourcePattern.startsWith(resourceMold)) {
// Fill in the appropriate version number.
localTarget.path = localTarget.path.replace('{version}', versionNumber);
return localTarget;
}
// Prepare and return a local target.
return {
path: resourceMappings[resourceMold].path.replace(VERSION_PLACEHOLDER, versionNumber),
type: resourceMappings[resourceMold].type
};
}
}
return false;
}
function normalizeDomain(domain) {
function _normalizeDomain(domain) {
domain = domain.toLowerCase().trim();
if (domain.startsWith('www.')) {
domain = domain.slice(4);
if (domain.startsWith(WEB_PREFIX_VALUE)) {
domain = domain.slice(WEB_PREFIX_LENGTH);
}
return domain;
}
function applyWhitelistPreference() {
function _applyWhitelistPreference() {
whitelistedDomains = [];
whitelistedDomains = {};
//noinspection JSUnresolvedVariable
preferences.domainWhitelist.split(';').forEach(function(domain, index) {
whitelistedDomains[index] = normalizeDomain(domain);
preferences.domainWhitelist.split(VALUE_SEPARATOR).forEach(function (domain) {
whitelistedDomains[_normalizeDomain(domain)] = true;
});
}

8
locale/bg/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "Добавяне на коментари към местно извлечени файлове">
<!ENTITY options.addNotice.description "Автоматично вмъкване на известие към извлечените документи, за да се сигнализира местна доставка.">
<!ENTITY options.blockMissing.title "Блокиране на заявки за липсващи ресурси">
<!ENTITY options.blockMissing.description "Отмяна на прехванатата заявка, ако изисквания ресурс не е наличен на местно ниво.">
<!ENTITY options.domainWhitelist.title "Изключване на домейните от инспекции">
<!ENTITY options.domainWhitelist.description "Въведете домейни, които да се добавят в белия списък. Отделете стойностите с точка и запетая.">
<!ENTITY options.amountInjected.title "Брояч за местно вмъкнати ресурси">
<!ENTITY options.amountInjected.description "Количество на местни вмъквания на ресурси от началото на инсталацията.">

8
locale/de/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "Kennzeichne lokal abgerufene Dateien">
<!ENTITY options.addNotice.description "Füge automatisch Kommentare an lokal ausgelieferte Bibliotheken hinzu.">
<!ENTITY options.blockMissing.title "Blockiere Anfordern fehlende Inhalte">
<!ENTITY options.blockMissing.description "Abgefangene Anforderung unterbinden, falls angeforderte Datei nicht lokal verfügbar ist.">
<!ENTITY options.domainWhitelist.title "Domains von Prüfung ausschließen">
<!ENTITY options.domainWhitelist.description "Gebe zu ignorierende Domains an. Trenne mehrere Einträge durch Semikolons (;).">
<!ENTITY options.amountInjected.title "Zähler für lokal injizierte Ressourcen">
<!ENTITY options.amountInjected.description "Anzahl der lokalen Injektionen von den CDN-Ressourcen seit der Installation.">

8
locale/en-GB/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "Add comments to locally fetched files">
<!ENTITY options.addNotice.description "Automatically prepend a notice to retrieved documents to signal local delivery.">
<!ENTITY options.blockMissing.title "Block requests for missing resources">
<!ENTITY options.blockMissing.description "Cancel intercepted request if the required resource is not locally available.">
<!ENTITY options.domainWhitelist.title "Exclude domains from inspections">
<!ENTITY options.domainWhitelist.description "Enter domains to whitelist them. Separate multiple entries with semi-colons (;).">
<!ENTITY options.amountInjected.title "Counter for locally injected resources">
<!ENTITY options.amountInjected.description "Amount of local Content Delivery Network resource injections since installation.">

8
locale/en-US/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "Add comments to locally fetched files">
<!ENTITY options.addNotice.description "Automatically prepend a notice to retrieved documents to signal local delivery.">
<!ENTITY options.blockMissing.title "Block requests for missing resources">
<!ENTITY options.blockMissing.description "Cancel intercepted request if the required resource is not locally available.">
<!ENTITY options.domainWhitelist.title "Exclude domains from inspections">
<!ENTITY options.domainWhitelist.description "Enter domains to whitelist them. Separate multiple entries with semi-colons (;).">
<!ENTITY options.amountInjected.title "Counter for locally injected resources">
<!ENTITY options.amountInjected.description "Amount of local Content Delivery Network resource injections since installation.">

8
locale/es/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "Añadir notas a archivos obtenidos localmente">
<!ENTITY options.addNotice.description "Anteponer un aviso a documentos obtenidos para señalar entrega local.">
<!ENTITY options.blockMissing.title "Bloquear peticiones de fuentes faltantes">
<!ENTITY options.blockMissing.description "Cancelar peticiones detenidas si la fuente requerida no se encuentra localmente.">
<!ENTITY options.domainWhitelist.title "Excluir dominios de inspecciones">
<!ENTITY options.domainWhitelist.description "Ingresar dominios a ser ignorados. Separar múltiples entradas con punto y coma (;).">
<!ENTITY options.amountInjected.title "Contador para fuentes inyectadas localmente">
<!ENTITY options.amountInjected.description "Cifra de inyecciones de fuentes de Redes de Entrega de Contenido desde instalación.">

8
locale/fi/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "Merkitse korvatut tiedostot">
<!ENTITY options.addNotice.description "Lisää alkuun ilmoituksen paikallisesti noudetuille tiedostoille.">
<!ENTITY options.blockMissing.title "Estä pyynnöt puuttuviin resursseihin">
<!ENTITY options.blockMissing.description "Estää pyynnöt jos paikallista sisältöä ei ole saatavilla.">
<!ENTITY options.domainWhitelist.title "Poissulje verkkotunnukset">
<!ENTITY options.domainWhitelist.description "Lisää verkkotunnus jottei sitä korvata. Erota rivit puolipisteellä (;).">
<!ENTITY options.amountInjected.title "Korvatut pyynnöt">
<!ENTITY options.amountInjected.description "Korvatut sisältöpyynnöt lisäosan asennuksen jälkeen.">

8
locale/fr/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "Pointer les documents joints localement">
<!ENTITY options.addNotice.description "Accoler une notice aux documents récupérés pour en signaler l'origine locale.">
<!ENTITY options.blockMissing.title "Bloquer les ressources manquantes">
<!ENTITY options.blockMissing.description "Annuler une demande de ressource si elle est indisponible localement.">
<!ENTITY options.domainWhitelist.title "Ne pas inspecter certains domaines">
<!ENTITY options.domainWhitelist.description "Indiquez les domaines à exclure. Séparer les noms par un point-virgule (;).">
<!ENTITY options.amountInjected.title "Compteur des ressources injectées">
<!ENTITY options.amountInjected.description "Total des ressources des CDN injectées localement depuis l'installation.">

8
locale/id/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "Tambahkan komentar ke berkas lokal yang disimpan">
<!ENTITY options.addNotice.description "Secara otomatis menambahkan pemberitahuan untuk mengambil dokumen untuk sinyal pengiriman lokal.">
<!ENTITY options.blockMissing.title "Blokir permintaan untuk sumber daya yang hilang">
<!ENTITY options.blockMissing.description "Batalkan intersep permintaan jika sumber daya yang dibutuhkan tidak tersedia secara lokal.">
<!ENTITY options.domainWhitelist.title "Cegah inspeksi domain">
<!ENTITY options.domainWhitelist.description "Masukkan domain ke daftar putih. Pisahkan entri dengan titik koma (;).">
<!ENTITY options.amountInjected.title "Sumber daya lokal yang disematkan">
<!ENTITY options.amountInjected.description "Jumlah penyematan sumber daya Jaringan Distribusi Konten lokal sejak pemasangan.">

8
locale/it/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "Aggiungere commenti a file raccolti localmente">
<!ENTITY options.addNotice.description "Antepone automaticamente un avviso ai documenti recuperati per segnalare la distribuzione locale.">
<!ENTITY options.blockMissing.title "Bloccare richieste di risorse mancanti">
<!ENTITY options.blockMissing.description "Annullare la richiesta intercettata se la risorsa necessaria non è disponibile localmente.">
<!ENTITY options.domainWhitelist.title "Escludere domini dalle ispezioni">
<!ENTITY options.domainWhitelist.description "Inserire domini nella whitelist per escluderli. Separare voci multiple con punti e virgola (;).">
<!ENTITY options.amountInjected.title "Contatore per risorse iniettate localmente">
<!ENTITY options.amountInjected.description "Quantità di iniezioni di risorse dalla Rete di Distribuzione di Contenuti locale sin dall'installazione.">

8
locale/ja/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "ローカルからのファイルにコメントを追加する">
<!ENTITY options.addNotice.description "ローカルCDNから取得したドキュメントにその旨を記載する。">
<!ENTITY options.blockMissing.title "存在しないリソースへの要求をブロック">
<!ENTITY options.blockMissing.description "必要なリソースがローカルで利用できない場合、リクエストを取り消す。">
<!ENTITY options.domainWhitelist.title "保護から除外するドメイン">
<!ENTITY options.domainWhitelist.description "ホワイト リストにドメインを入力します。複数のエントリをセミコロン (;) で区切ります。">
<!ENTITY options.amountInjected.title "ローカルから挿入されたリソースの数">
<!ENTITY options.amountInjected.description "インストールから起算した、ローカルCDNのリソース使用数。">

8
locale/nl/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "Notities aan lokale bestanden toevoegen">
<!ENTITY options.addNotice.description "Voorzie alle door deze add-on opgehaalde bestanden automatisch van een notitie.">
<!ENTITY options.blockMissing.title "Stop verzoeken voor ontbrekende items">
<!ENTITY options.blockMissing.description "Annuleer een onderschept verzoek wanneer het bestand niet lokaal beschikbaar is.">
<!ENTITY options.domainWhitelist.title "Sluit domeinen uit van inspecties">
<!ENTITY options.domainWhitelist.description "Voer de te negeren domeinen in. Scheid de waarden met puntkomma's (;).">
<!ENTITY options.amountInjected.title "Teller voor lokaal geïnjecteerde bestanden">
<!ENTITY options.amountInjected.description "Aantal lokale Content Delivery Network bestandsinjecties sinds installatie.">

8
locale/pl/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "Dodaj komentarz do plików przechowywanych lokalnie">
<!ENTITY options.addNotice.description "Automatycznie dodawaj powiadomienie do pobranych dokumentów aby zasygnalizować lokalne dostarczanie.">
<!ENTITY options.blockMissing.title "Blokuj żądania brakujących zasobów">
<!ENTITY options.blockMissing.description "Anuluj przechwycone żądania jeśli wymagany zasób nie jest dostępny lokalnie.">
<!ENTITY options.domainWhitelist.title "Wyklucz domeny z analizy">
<!ENTITY options.domainWhitelist.description "Podaj domeny aby dodać je do białej listy. Oddziel wpisy średnikami (;).">
<!ENTITY options.amountInjected.title "Licznik zasobów podanych lokalnie">
<!ENTITY options.amountInjected.description "Ilość wstrzyknięć z lokalnego Content Delivery Network od czasu instalacji.">

8
locale/pt-PT/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "Adicionar comentários aos ficheiros obtidos localmente">
<!ENTITY options.addNotice.description "Preceder automaticamente um aviso aos documentos readquiridos para sinalizar a entrega local.">
<!ENTITY options.blockMissing.title "Bloquear pedidos por falta de recursos">
<!ENTITY options.blockMissing.description "Cancelar pedido intercetado se o recurso necessário não estiver disponível localmente.">
<!ENTITY options.domainWhitelist.title "Excluir domínios de inspeções">
<!ENTITY options.domainWhitelist.description "Insira domínios para os colocar na lista branca. Separe múltiplas entradas com pontos e vírgulas (;).">
<!ENTITY options.amountInjected.title "Contador para recursos injetados localmente">
<!ENTITY options.amountInjected.description "Quantidade de injeções de recurso Content Delivery Network locais desde a instalação.">

8
locale/zh-CN/options.dtd Normal file
View File

@@ -0,0 +1,8 @@
<!ENTITY options.addNotice.title "添加注释到从本地获取的文件">
<!ENTITY options.addNotice.description "自动预置一个通知到获取的文档以标记从本地交付。">
<!ENTITY options.blockMissing.title "阻止缺失资源的请求">
<!ENTITY options.blockMissing.description "取消被拦截的请求,如果请求的资源在本地不可用。">
<!ENTITY options.domainWhitelist.title "排除要检查的域名">
<!ENTITY options.domainWhitelist.description "输入白名单的域名。用分号 (;) 分隔多项。">
<!ENTITY options.amountInjected.title "本地发送资源的计数器">
<!ENTITY options.amountInjected.description "自安装以来,从本地的“内容交付网络”发送的资源总量。">

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" ?>
<!DOCTYPE vbox SYSTEM "chrome://decentraleyes/locale/options.dtd">
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<setting data-jetpack-id="jid1-BoFifL9Vbdl2zQ@jetpack" pref="extensions.jid1-BoFifL9Vbdl2zQ@jetpack.addNotice" pref-name="addNotice" title="Add comments to locally fetched files" type="bool">Automatically prepend a notice to retrieved documents to signal local delivery.</setting>
<setting data-jetpack-id="jid1-BoFifL9Vbdl2zQ@jetpack" pref="extensions.jid1-BoFifL9Vbdl2zQ@jetpack.blockMissing" pref-name="blockMissing" title="Block requests for missing resources" type="bool">Cancel intercepted request if the required resource is not locally available.</setting>
<setting data-jetpack-id="jid1-BoFifL9Vbdl2zQ@jetpack" pref="extensions.jid1-BoFifL9Vbdl2zQ@jetpack.domainWhitelist" pref-name="domainWhitelist" title="Exclude domains from inspections" type="string">Enter domains to whitelist them. Separate multiple entries with semi-colons (;).</setting>
<setting data-jetpack-id="jid1-BoFifL9Vbdl2zQ@jetpack" pref="extensions.jid1-BoFifL9Vbdl2zQ@jetpack.amountInjected" pref-name="amountInjected" title="Counter for locally injected resources" type="integer">Amount of local Content Delivery Network resource injections since installation.</setting>
<setting data-jetpack-id="jid1-BoFifL9Vbdl2zQ@jetpack" pref="extensions.jid1-BoFifL9Vbdl2zQ@jetpack.addNotice" pref-name="addNotice" title="&options.addNotice.title;" type="bool">&options.addNotice.description;</setting>
<setting data-jetpack-id="jid1-BoFifL9Vbdl2zQ@jetpack" pref="extensions.jid1-BoFifL9Vbdl2zQ@jetpack.blockMissing" pref-name="blockMissing" title="&options.blockMissing.title;" type="bool">&options.blockMissing.description;</setting>
<setting data-jetpack-id="jid1-BoFifL9Vbdl2zQ@jetpack" pref="extensions.jid1-BoFifL9Vbdl2zQ@jetpack.domainWhitelist" pref-name="domainWhitelist" title="&options.domainWhitelist.title;" type="string">&options.domainWhitelist.description;</setting>
<setting data-jetpack-id="jid1-BoFifL9Vbdl2zQ@jetpack" pref="extensions.jid1-BoFifL9Vbdl2zQ@jetpack.amountInjected" pref-name="amountInjected" title="&options.amountInjected.title;" type="integer">&options.amountInjected.description;</setting>
</vbox>

View File

@@ -3,13 +3,14 @@
"author": "Thomas Rientjes",
"license": "MPL-2.0",
"title": "Decentraleyes",
"version": "1.2.2",
"version": "1.3.0",
"main": "lib/main.js",
"homepage": "https://addons.mozilla.org/en-US/firefox/addon/decentraleyes",
"homepage": "https://addons.mozilla.org/firefox/addon/decentraleyes",
"name": "decentraleyes",
"id": "jid1-BoFifL9Vbdl2zQ@jetpack",
"engines": {
"firefox": ">=38.0a1",
"fennec": ">=38.0a1"
"fennec": ">=38.0a1",
"seamonkey": ">=2.0a1 <=2.46"
}
}

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -20,13 +20,20 @@
}
header {
height: 128px;
position: relative;
width: 400px;
height: 128px;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Trebuchet MS", Helvetica, sans-serif;
margin-left: auto;
margin-right: auto;
max-width: 750px;
}
h3 {
text-align: left;
}
a {
@@ -38,23 +45,62 @@
}
.notice {
max-width: 750px;
font-family: "Trebuchet MS", Helvetica, sans-serif;
margin-left: auto;
margin-right: auto;
max-width: 750px;
text-align: left;
font-family: "Trebuchet MS", Helvetica, sans-serif;
}
.text-highlight {
font-weight: bold;
color: #4a856d;
}
.logo {
margin-left: auto;
margin-right: auto;
display: block;
height: 128px;
margin-left: auto;
margin-right: auto;
}
.subtle-hint {
color: #777;
font-size: 14px;
font-style: italic;
}
.subtle-text {
color: #777;
}
.topic-label {
color: #4a856d;
font-style: normal;
font-weight: bold;
text-transform: uppercase;
}
.help-panel {
border-bottom: 2px #bbb dotted;
cursor: help;
display: inline-block;
position: relative;
}
.help-panel:before {
background-color: #fef4c5;
border-radius: 2px;
border: 1px solid #d4b943;
box-shadow: 2px 2px 2px rgba(0, 0, 0, .15);
color: #594c16;
content: attr(data-title);
display: none;
font-size: 14px;
margin-top: 22px;
padding: 3px 4px;
position: absolute;
white-space: nowrap;
z-index: 1;
}
.help-panel:hover:before {
display: inline;
}
</style>
@@ -65,25 +111,13 @@
<div class="container">
<h1>Decentraleyes <i>v1.2.2</i></h1>
<h1>Decentraleyes <i>v1.3.0</i></h1>
<br><br>
<div class="notice">
<span class="text-highlight">NEW:</span> <strong>Get a first glimpse of what this add-on actually does for you!</strong> Navigate to the main menu and click <i>"Add-ons" > "Decentraleyes" > "Preferences"</i> to get familiar with the new <i>"local injections"</i> counter. <i>Please note: it's new and will start from <strong>zero</strong> (ignoring prior injections).</i>
<br><br>
<span class="text-highlight">NEW:</span> <strong>Support for Fennec (or Firefox for mobile).</strong> If you're running Firefox on your smartphone, then you might be happy to know that this is the very first release to be fully compatible with mobile versions of Firefox. Take this add-on with you to protect yourself on-the-go!
<br><br>
<span class="text-highlight">EXPERIMENTAL:</span> <strong>Whitelist specific domains to force Decentraleyes to ignore them.</strong> Navigate to the main menu and click <i>"Add-ons" > "Decentraleyes" > "Preferences"</i>. From there, you can add domains to the <i>"whitelist"</i> field. This might come in handy if you run into issues with a certain website.
<br><br><hr><br>
<span class="text-highlight">NOTE:</span> Decentraleyes works right out of the box and no manual configuration is required! You can check if you're properly protected by using the <strong><a href="https://decentraleyes.org/test" target="_blank">testing utility</a></strong>.
<span class="subtle-hint"><span class="topic-label">Pro Tip:</span> Would you rather not see this page after installations or updates? You can disable it by navigating to <strong>about:config</strong> (in a new tab), then searching for <strong>BoFifL9V</strong>, and setting <strong>showReleaseNotes</strong> to false.</span>
<br><br><hr>
@@ -93,9 +127,25 @@
<div class="notice">
<i>General information:</i>
<span class="topic-label">New:</span> <strong>Let there be languages.</strong> This version supports locales and features fourteen <a href="https://github.com/Synzvato/decentraleyes/issues/44" target="_blank">initial translations</a>: <span class="subtle-text"> <span class="help-panel" data-title="Thanks to AdmiralAnimE.">Bulgarian</span>, <span class="help-panel" data-title="Thanks to Louy2 and YFdyh000.">Chinese <i>(Simplified)</i></span>, Dutch, English <i>(United Kingdom)</i>, English <i>(United States)</i>, <span class="help-panel" data-title="Thanks to Semired.">Finnish</span>, <span class="help-panel" data-title="Thanks to Simpson, Thuban, and TraderStf."> French</span>, <span class="help-panel" data-title="Thanks to C4R2T3N, Flysch, Sabajo, and Schnaidar.">German</span>, <span class="help-panel" data-title="Thanks to Zmni.">Indonesian</span>, <span class="help-panel" data-title="Thanks to Mtvento.">Italian</span>, <span class="help-panel" data-title="Thanks to Brindflontia.">Japanese</span>, <span class="help-panel" data-title="Thanks to Marekjm.">Polish</span>, <span class="help-panel" data-title="Thanks to SW1FTmeister.">Portuguese <i>(European)</i></span>, and <span class="help-panel" data-title="Thanks to Adri and Ergotronix.">Spanish</span></span>.
<p>Decentraleyes is a very young project, so expect many improvements in the realms of clear, present, user feedback and ease-of-use as it matures. It does a lot to protect you, but is a tad shy about it.</p>
<br><br>
<span class="topic-label">New:</span> <strong>Official support for SeaMonkey.</strong> If you use SeaMonkey <i>(a free and open-source internet suite consisting of a web browser, an e-mail client, and a news aggregator)</i>, you might be glad to know that this release is fully compatible with all modern versions of the application.
<br><br>
<span class="topic-label">Enhanced:</span> <strong>A large amount of internal changes for improved performance and stability.</strong> A lot of work has gone into making this version as fast and reliable as possible. As a result, this release proudly brings you an even more optimized, carefree, and stable overall experience.
<br><br><hr><br>
<span class="subtle-hint"><span class="topic-label">Getting started:</span> Decentraleyes works right out of the box and no manual configuration is required! You can check if you're properly protected by using the following <strong><a href="https://decentraleyes.org/test" target="_blank">testing utility</a></strong>.</span>
<br><br>
<span class="subtle-hint">To get a glimpse of what this add-on actually does for you, go to this application's main menu, click <strong>"Add-ons" > "Decentraleyes" > "Preferences"</strong>, scroll down, and familiarize yourself with the local injections counter.</span>
<br><br><hr>
</div>
@@ -103,7 +153,34 @@
<div class="notice">
<i>Detailed changelog:</i>
<i>General notice:</i><br><br>
Decentraleyes is a young project. Expect many improvements in the realms of clear user feedback and ease-of-use as it matures. It does a lot to protect you, and is becoming less and less shy about it.
<br><br><hr>
</div>
<br>
<div class="notice">
<i>Detailed v1.3.0 changelog:</i>
<ul>
<li>Decentraleyes now officially supports modern versions of SeaMonkey.</li>
<li>Created mappings for yastatic.net and deprecated its predecessor (yandex.st).</li>
<li>Added test cases, and <span class="help-panel" data-title="With code contributions by Ngksternhagen.">improved existing unit tests</span> and exception handling.</li>
<li>Applied a wide range of performance optimalizations and stability improvements.</li>
<li>Added support for localizations and embedded fourteen initial translations.</li>
<li>Implemented a watcher that keeps pages with specific security policies from breaking.</li>
<li><span class="help-panel" data-title="With code contributions by Thegoodthings.">Added a preference</span> to allow users to hide release notes upon install and upgrade.</li>
<li>Optimized mapping expressions to reveal uncommon injection opportunities.</li>
</ul>
<br>
<i>Detailed v1.2.2 changelog:</i>
<ul>
<li>Decentraleyes now supports Fennec (better known as Firefox for mobile).</li>
@@ -112,7 +189,7 @@
<li>Fixed a rare bug where shorthand mapping notations broke specific websites.</li>
<li>Removed Pale Moon compatibility as it will receive separate, tailored, builds.</li>
<li>Took out rare resources to make room for more common candidates.</li>
<li>Added new AngularJS, Dojo, and jQuery UI scripts to the resource bundle.</li>
<li>Added new AngularJS, Dojo, and <span class="help-panel" data-title="With code contributions by Matthieuy.">jQuery UI</span> scripts to the resource bundle.</li>
</ul>
</div>
@@ -121,7 +198,7 @@
<div class="notice">
<p>
<a href="https://github.com/Synzvato/decentraleyes" target="_blank">Github</a> / <a href="https://addons.mozilla.org/en-US/firefox/addon/decentraleyes" target="_blank">Add-on Listing</a>
<a href="https://github.com/Synzvato/decentraleyes" target="_blank">GitHub</a> / <a href="https://addons.mozilla.org/en-US/firefox/addon/decentraleyes" target="_blank">Add-on Listing</a> / <a href="https://github.com/Synzvato/decentraleyes/issues/44" target="_blank">Help Translate</a>
</p>
</div>

34
test/test-data-handler.js Normal file
View File

@@ -0,0 +1,34 @@
/**
* Imports
*/
var dataHandler = require("../lib/data-handler");
/**
* Get Redirection URI Tests
*/
exports['test get redirection uri for existing file'] = function (assert) {
var result = dataHandler.getRedirectionURI(
'resources/jquery/2.1.4/jquery.min.js.dec', 'UTF-8', 'application/javascript'
);
assert.ok(typeof result === 'object', 'Existing file was handled succesfully.');
};
exports['test get redirection uri for non-existing file'] = function (assert) {
assert.throws(function () {
dataHandler.getRedirectionURI('resources/non-existing/0.5.7/non-existing.js.dec',
'UTF-8', 'application/javascript');
}, Error, 'Non-existing file was handled succesfully.');
};
/**
* Run Tests
*/
require("sdk/test").run(exports);

View File

@@ -1,5 +1,13 @@
/**
* Imports
*/
var requestAnalyzer = require("../lib/request-analyzer");
/**
* Variables
*/
var localPaths = {
angular: 'resources/angularjs/1.2.19/angular.min.js.dec',
backbone: [
@@ -34,7 +42,50 @@ var localPaths = {
};
/**
* Generic Tests
* Is Valid Candidate Tests
*/
exports['test get request to known cdn'] = function (assert) {
var result = requestAnalyzer.isValidCandidate({
requestMethod: 'GET', URI: { host: 'ajax.googleapis.com' }
});
assert.ok(result, 'Valid candidate was successfully identified.');
};
exports['test post request to known cdn'] = function (assert) {
var result = requestAnalyzer.isValidCandidate({
requestMethod: 'POST', URI: { host: 'ajax.googleapis.com' }
});
assert.equal(result, false, 'Invalid candidate was successfully identified.');
};
exports['test get request to unknown domain'] = function (assert) {
var result = requestAnalyzer.isValidCandidate({
requestMethod: 'GET', URI: { host: 'ajax.example.com' }
});
assert.equal(result, false, 'Invalid candidate was successfully identified.');
};
exports['test get request from whitelisted domain'] = function (assert) {
require('sdk/simple-prefs').prefs.domainWhitelist = 'example.com';
var result = requestAnalyzer.isValidCandidate({
requestMethod: 'GET', URI: { host: 'ajax.googleapis.com' },
referrer: { host: 'example.com' }, setRequestHeader: function () { return false; }
});
assert.equal(result, false, 'Whitelisted request was successfully ignored.');
};
/**
* Get Local Target Tests
*/
exports['test regular resource'] = function (assert) {
@@ -77,9 +128,12 @@ exports['test webfont debug library'] = function (assert) {
assert.equal(target.path, localPaths.webfont[0], 'Target was determined.');
};
/**
* Google Hosted Libraries
*/
exports['test case sensitivity rules'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('lib.sinaapp.com', '/js/WebFont/1.0.19/webfont_debug.js');
assert.equal(target, false, 'Case sensitivity rules were properly enforced.');
};
// Google Hosted Libraries
exports['test angular on google hosted libraries'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('ajax.googleapis.com', '/ajax/libs/angularjs/1.2.19/angular.min.js');
@@ -131,15 +185,18 @@ exports['test webfont on google hosted libraries'] = function (assert) {
assert.equal(target.path, localPaths.webfont[1], 'Target was determined.');
};
/**
* Microsoft Ajax CDN
*/
// Microsoft Ajax CDN
exports['test jquery on microsoft ajax cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('ajax.aspnetcdn.com', '/ajax/jQuery/jquery-1.11.1.min.js');
assert.equal(target.path, localPaths.jQuery[1], 'Target was determined.');
};
exports['test lowercase jquery notation on microsoft ajax cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('ajax.aspnetcdn.com', '/ajax/jquery/jquery-1.11.1.min.js');
assert.equal(target.path, localPaths.jQuery[1], 'Target was determined.');
};
exports['test modernizr on microsoft ajax cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('ajax.aspnetcdn.com', '/ajax/modernizr/modernizr-2.6.2.js');
assert.equal(target.path, localPaths.modernizr, 'Target was determined.');
@@ -150,14 +207,17 @@ exports['test jquery on old microsoft ajax cdn'] = function (assert) {
assert.equal(target.path, localPaths.jQuery[1], 'Target was determined.');
};
exports['test lowercase jquery notation on old microsoft ajax cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('ajax.microsoft.com', '/ajax/jquery/jquery-1.11.1.min.js');
assert.equal(target.path, localPaths.jQuery[1], 'Target was determined.');
};
exports['test modernizr on old microsoft ajax cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('ajax.microsoft.com', '/ajax/modernizr/modernizr-2.6.2.js');
assert.equal(target.path, localPaths.modernizr, 'Target was determined.');
};
/**
* CDNJS (Cloudflare)
*/
// CDNJS (Cloudflare)
exports['test angular on cdnjs'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('cdnjs.cloudflare.com', '/ajax/libs/angular.js/1.2.19/angular.min.js');
@@ -224,9 +284,7 @@ exports['test webfont on cdnjs'] = function (assert) {
assert.equal(target.path, localPaths.webfont[1], 'Target was determined.');
};
/**
* jQuery CDN (MaxCDN)
*/
// jQuery CDN (MaxCDN)
exports['test jquery on jquery cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('code.jquery.com', '/jquery-1.11.1.min.js');
@@ -238,9 +296,12 @@ exports['test jquery-ui on jquery cdn'] = function (assert) {
assert.equal(target.path, localPaths.jQueryUI, 'Target was determined.');
};
/**
* jsDelivr (MaxCDN)
*/
exports['test jquery shorthand on jquery cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('code.jquery.com', '/jquery-1.5.min.js');
assert.equal(target.path, 'resources/jquery/1.5.0/jquery.min.js.dec', 'Target found for jquery shorthand on jquery cdn.');
};
// jsDelivr (MaxCDN)
exports['test angular on jsdelivr'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('cdn.jsdelivr.net', '/angularjs/1.2.19/angular.min.js');
@@ -292,68 +353,119 @@ exports['test webfont on jsdelivr'] = function (assert) {
assert.equal(target.path, localPaths.webfont[1], 'Target was determined.');
};
/**
* Yandex CDN
*/
// Yandex CDN
exports['test angular on yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/angularjs/1.2.19/angular.min.js');
var target = requestAnalyzer.getLocalTarget('yastatic.net', '/angularjs/1.2.19/angular.min.js');
assert.equal(target.path, localPaths.angular, 'Target was determined.');
};
exports['test backbone on yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/backbone/1.1.2/backbone-min.js');
var target = requestAnalyzer.getLocalTarget('yastatic.net', '/backbone/1.1.2/backbone-min.js');
assert.equal(target.path, localPaths.backbone[1], 'Target was determined.');
};
exports['test dojo on yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/dojo/1.8.3/dojo/dojo.js');
var target = requestAnalyzer.getLocalTarget('yastatic.net', '/dojo/1.8.3/dojo/dojo.js');
assert.equal(target.path, localPaths.dojo, 'Target was determined.');
};
exports['test ext-core on yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/ext-core/3.1.0/ext-core.min.js');
var target = requestAnalyzer.getLocalTarget('yastatic.net', '/ext-core/3.1.0/ext-core.min.js');
assert.equal(target.path, localPaths.extCore, 'Target was determined.');
};
exports['test jquery on yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/jquery/1.11.1/jquery.js');
var target = requestAnalyzer.getLocalTarget('yastatic.net', '/jquery/1.11.1/jquery.js');
assert.equal(target.path, localPaths.jQuery[1], 'Target was determined.');
};
exports['test jquery-ui on yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/jquery-ui/1.10.2/jquery-ui.min.js');
var target = requestAnalyzer.getLocalTarget('yastatic.net', '/jquery-ui/1.10.2/jquery-ui.min.js');
assert.equal(target.path, localPaths.jQueryUI, 'Target was determined.');
};
exports['test modernizr on yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/modernizr/2.6.2/modernizr.min.js');
var target = requestAnalyzer.getLocalTarget('yastatic.net', '/modernizr/2.6.2/modernizr.min.js');
assert.equal(target.path, localPaths.modernizr, 'Target was determined.');
};
exports['test prototype on yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/prototype/1.6.1.0/prototype.min.js');
var target = requestAnalyzer.getLocalTarget('yastatic.net', '/prototype/1.6.1.0/prototype.min.js');
assert.equal(target.path, localPaths.prototypeJS, 'Target was determined.');
};
exports['test scriptaculous on yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/scriptaculous/1.9.0/scriptaculous.js');
var target = requestAnalyzer.getLocalTarget('yastatic.net', '/scriptaculous/1.9.0/scriptaculous.js');
assert.equal(target.path, localPaths.scriptaculous, 'Target was determined.');
};
exports['test swfobject on yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/swfobject/2.2/swfobject.min.js');
var target = requestAnalyzer.getLocalTarget('yastatic.net', '/swfobject/2.2/swfobject.min.js');
assert.equal(target.path, localPaths.swfobject, 'Target was determined.');
};
exports['test underscore on yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yastatic.net', '/underscore/1.6.0/underscore-min.js');
assert.equal(target.path, localPaths.underscore[2], 'Target was determined.');
};
exports['test angular on old yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/angularjs/1.2.19/angular.min.js');
assert.equal(target.path, localPaths.angular, 'Target was determined.');
};
exports['test backbone on old yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/backbone/1.1.2/backbone-min.js');
assert.equal(target.path, localPaths.backbone[1], 'Target was determined.');
};
exports['test dojo on old yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/dojo/1.8.3/dojo/dojo.js');
assert.equal(target.path, localPaths.dojo, 'Target was determined.');
};
exports['test ext-core on old yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/ext-core/3.1.0/ext-core.min.js');
assert.equal(target.path, localPaths.extCore, 'Target was determined.');
};
exports['test jquery on old yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/jquery/1.11.1/jquery.js');
assert.equal(target.path, localPaths.jQuery[1], 'Target was determined.');
};
exports['test jquery-ui on old yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/jquery-ui/1.10.2/jquery-ui.min.js');
assert.equal(target.path, localPaths.jQueryUI, 'Target was determined.');
};
exports['test modernizr on old yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/modernizr/2.6.2/modernizr.min.js');
assert.equal(target.path, localPaths.modernizr, 'Target was determined.');
};
exports['test prototype on old yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/prototype/1.6.1.0/prototype.min.js');
assert.equal(target.path, localPaths.prototypeJS, 'Target was determined.');
};
exports['test scriptaculous on old yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/scriptaculous/1.9.0/scriptaculous.js');
assert.equal(target.path, localPaths.scriptaculous, 'Target was determined.');
};
exports['test swfobject on old yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/swfobject/2.2/swfobject.min.js');
assert.equal(target.path, localPaths.swfobject, 'Target was determined.');
};
exports['test underscore on old yandex cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('yandex.st', '/underscore/1.6.0/underscore-min.js');
assert.equal(target.path, localPaths.underscore[2], 'Target was determined.');
};
/**
* Baidu CDN
*/
// Baidu CDN
exports['test backbone on baidu cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('libs.baidu.com', '/backbone/0.9.2/backbone-min.js');
@@ -410,9 +522,7 @@ exports['test webfont on baidu cdn'] = function (assert) {
assert.equal(target.path, localPaths.webfont[0], 'Target was determined.');
};
/**
* Sina Public Resources
*/
// Sina Public Resources
exports['test angular on sina public resources'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('lib.sinaapp.com', '/js/angular.js/angular-1.2.19/angular.min.js');
@@ -474,9 +584,7 @@ exports['test webfont on sina public resources'] = function (assert) {
assert.equal(target.path, localPaths.webfont[0], 'Target was determined.');
};
/**
* UpYun Library
*/
// UpYun Library
exports['test dojo on upyun library'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('upcdn.b0.upaiyun.com', '/libs/dojo/dojo-1.8.3.min.js');
@@ -508,4 +616,8 @@ exports['test mootools on upyun library'] = function (assert) {
assert.equal(target.path, localPaths.mootools, 'Target was determined.');
};
/**
* Run Tests
*/
require("sdk/test").run(exports);