diff --git a/.eslintrc b/.eslintrc
index 5765e85..602bd64 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -8,10 +8,12 @@
"globals": {
"Address": true,
"files": true,
+ "Header": true,
"helpers": true,
"interceptor": true,
"mappings": true,
"requestAnalyzer": true,
+ "requestSanitizer": true,
"Resource": true,
"resources": true,
"Setting": true,
diff --git a/_locales/cs_CZ/messages.json b/_locales/cs_CZ/messages.json
new file mode 100644
index 0000000..4c246ea
--- /dev/null
+++ b/_locales/cs_CZ/messages.json
@@ -0,0 +1,70 @@
+{
+ "extensionDescription": {
+ "message": "Ochrání vás přes sledováním skrze centralizované doručování obsahu.",
+ "description": "Extension description."
+ },
+ "disableProtectionTitle": {
+ "message": "Zakázat ochranu na této stránce",
+ "description": "Disable protection title."
+ },
+ "enableProtectionTitle": {
+ "message": "Zapnout ochranu",
+ "description": "Enable protection title."
+ },
+ "amountInjectedTitle": {
+ "message": "Počítadlo vložených lokálních zdrojů",
+ "description": "Amount injected title."
+ },
+ "amountInjectedDescription": {
+ "message": "Počet lokální uložených zdrojů vložených od instalace.",
+ "description": "Amount injected description."
+ },
+ "optionsTitle": {
+ "message": "Možnosti",
+ "description": "Options title."
+ },
+ "showIconBadgeTitle": {
+ "message": "Zobrazovat počet vložení u ikony",
+ "description": "Show icon badge title."
+ },
+ "showIconBadgeDescription": {
+ "message": "Zobrazit počet vložených zdrojů u ikony rozšíření.",
+ "description": "Show icon badge description."
+ },
+ "blockMissingTitle": {
+ "message": "Blokovat požadavky na chybějící zdroje",
+ "description": "Block requests for missing resources title."
+ },
+ "blockMissingDescription": {
+ "message": "Zrušit požadavky na sledované zdroje, pokud nejsou lokálně dostupné.",
+ "description": "Block requests for missing resources description."
+ },
+ "disablePrefetchTitle": {
+ "message": "Zakázat přednačítání odkazů",
+ "description": "Disable prefetch title."
+ },
+ "disablePrefetchDescription": {
+ "message": "Předejte nepovoleným požadavkům do sítí pro doručování obsahu.",
+ "description": "Disable prefetch description."
+ },
+ "stripMetadataTitle": {
+ "message": "Odstranit metadata z povolených požadavků",
+ "description": "Strip metadata title."
+ },
+ "stripMetadataDescription": {
+ "message": "Pro zlepšení soukromí odstraní citlivá data z povolených požadavků na CDN.",
+ "description": "Strip metadata description."
+ },
+ "whitelistedDomainsTitle": {
+ "message": "Nekontrolovat pro domény",
+ "description": "Whitelisted domains title."
+ },
+ "whitelistedDomainsDescription": {
+ "message": "Zadejte domény pro jejich vynechání z kontroly. Jednotlivé domény oddělujte pomocí středníků (;).",
+ "description": "Whitelisted domains description."
+ },
+ "advancedLabel": {
+ "message": "Rozšířené",
+ "description": "Advanced label."
+ }
+}
\ No newline at end of file
diff --git a/_locales/pt_PT/messages.json b/_locales/pt_PT/messages.json
index 9046c8d..3cac744 100644
--- a/_locales/pt_PT/messages.json
+++ b/_locales/pt_PT/messages.json
@@ -1,70 +1,70 @@
{
- "extensionDescription":{
- "message":"Protege contra monitorização através de entrega de conteúdo centralizado.",
- "description":"Extension description."
+ "extensionDescription": {
+ "message": "Protege contra monitorização através de entrega de conteúdo centralizado.",
+ "description": "Extension description."
},
- "disableProtectionTitle":{
- "message":"Desativar proteção para este site",
- "description":"Disable protection title."
+ "disableProtectionTitle": {
+ "message": "Desativar proteção para este site",
+ "description": "Disable protection title."
},
- "enableProtectionTitle":{
- "message":"Ativar proteção",
- "description":"Enable protection title."
+ "enableProtectionTitle": {
+ "message": "Ativar proteção",
+ "description": "Enable protection title."
},
- "amountInjectedTitle":{
- "message":"Contador para recursos injetados localmente",
- "description":"Amount injected title."
+ "amountInjectedTitle": {
+ "message": "Contador para recursos injetados localmente",
+ "description": "Amount injected title."
},
- "amountInjectedDescription":{
- "message":"Quantidade de injeções de recurso Content Delivery Network locais desde a instalação.",
- "description":"Amount injected description."
+ "amountInjectedDescription": {
+ "message": "Quantidade de injeções de recurso Content Delivery Network locais desde a instalação.",
+ "description": "Amount injected description."
},
- "optionsTitle":{
- "message":"Opções",
- "description":"Options title."
+ "optionsTitle": {
+ "message": "Opções",
+ "description": "Options title."
},
- "showIconBadgeTitle":{
- "message":"Mostrar contagem de injeções no ícone",
- "description":"Show icon badge title."
+ "showIconBadgeTitle": {
+ "message": "Mostrar contagem de injeções no ícone",
+ "description": "Show icon badge title."
},
- "showIconBadgeDescription":{
- "message":"Mostrar o número de recursos injetados no ícone da extensão.",
- "description":"Show icon badge description."
+ "showIconBadgeDescription": {
+ "message": "Mostrar o número de recursos injetados no ícone da extensão.",
+ "description": "Show icon badge description."
},
- "blockMissingTitle":{
- "message":"Bloquear pedidos por falta de recursos",
- "description":"Block requests for missing resources title."
+ "blockMissingTitle": {
+ "message": "Bloquear pedidos por falta de recursos",
+ "description": "Block requests for missing resources title."
},
- "blockMissingDescription":{
- "message":"Cancelar pedido intercetado se o recurso necessário não estiver disponível localmente.",
- "description":"Block requests for missing resources description."
+ "blockMissingDescription": {
+ "message": "Cancelar pedido intercetado se o recurso necessário não estiver disponível localmente.",
+ "description": "Block requests for missing resources description."
},
- "disablePrefetchTitle":{
- "message":"Desativar pré-obtenção de ligações",
- "description":"Disable prefetch title."
+ "disablePrefetchTitle": {
+ "message": "Desativar pré-obtenção de ligações",
+ "description": "Disable prefetch title."
},
- "disablePrefetchDescription":{
- "message":"Impedir recursos não permitidos de vazar para as redes de entrega.",
- "description":"Disable prefetch description."
+ "disablePrefetchDescription": {
+ "message": "Impedir recursos não permitidos de vazar para as redes de entrega.",
+ "description": "Disable prefetch description."
},
- "stripMetadataTitle":{
- "message":"Retirar metadados dos pedidos permitidos",
- "description":"Strip metadata title."
+ "stripMetadataTitle": {
+ "message": "Retirar metadados dos pedidos permitidos",
+ "description": "Strip metadata title."
},
- "stripMetadataDescription":{
- "message":"Limpar dados sensíveis de recursos CDN permitidos para melhoria de privacidade.",
- "description":"Strip metadata description."
+ "stripMetadataDescription": {
+ "message": "Limpar dados sensíveis de recursos CDN permitidos para melhoria de privacidade.",
+ "description": "Strip metadata description."
},
- "whitelistedDomainsTitle":{
- "message":"Excluir domínios de inspeções",
- "description":"Whitelisted domains title."
+ "whitelistedDomainsTitle": {
+ "message": "Excluir domínios de inspeções",
+ "description": "Whitelisted domains title."
},
- "whitelistedDomainsDescription":{
- "message":"Insira domínios para os colocar na lista branca. Separe múltiplas entradas com pontos e vírgulas (;).",
- "description":"Whitelisted domains description."
+ "whitelistedDomainsDescription": {
+ "message": "Insira domínios para os colocar na lista branca. Separe múltiplas entradas com pontos e vírgulas (;).",
+ "description": "Whitelisted domains description."
},
- "advancedLabel":{
- "message":"Avançado",
- "description":"Advanced label."
+ "advancedLabel": {
+ "message": "Avançado",
+ "description": "Advanced label."
}
}
\ No newline at end of file
diff --git a/_locales/ro/messages.json b/_locales/ro/messages.json
index 4022e96..8fc6af9 100644
--- a/_locales/ro/messages.json
+++ b/_locales/ro/messages.json
@@ -1,70 +1,70 @@
{
- "extensionDescription":{
- "message":"Te protejează împotriva urmăririi prin livrare \"gratuită\" de conținut centralizat.",
- "description":"Extension description."
+ "extensionDescription": {
+ "message": "Te protejează împotriva urmăririi prin livrare \"gratuită\" de conținut centralizat.",
+ "description": "Extension description."
},
- "disableProtectionTitle":{
- "message":"Dezactivează protecția pentru acest site",
- "description":"Disable protection title."
+ "disableProtectionTitle": {
+ "message": "Dezactivează protecția pentru acest site",
+ "description": "Disable protection title."
},
- "enableProtectionTitle":{
- "message":"Activează protecția",
- "description":"Enable protection title."
+ "enableProtectionTitle": {
+ "message": "Activează protecția",
+ "description": "Enable protection title."
},
- "amountInjectedTitle":{
- "message":"Contor pentru resursele injectate local",
- "description":"Amount injected title."
+ "amountInjectedTitle": {
+ "message": "Contor pentru resursele injectate local",
+ "description": "Amount injected title."
},
- "amountInjectedDescription":{
- "message":"Cantitatea de resurse locale injectate de Rețelele care Livrează Conținut din momentul instalării.",
- "description":"Amount injected description."
+ "amountInjectedDescription": {
+ "message": "Cantitatea de resurse locale injectate de Rețelele care Livrează Conținut din momentul instalării.",
+ "description": "Amount injected description."
},
- "optionsTitle":{
- "message":"Opțiuni",
- "description":"Options title."
+ "optionsTitle": {
+ "message": "Opțiuni",
+ "description": "Options title."
},
- "showIconBadgeTitle":{
- "message":"Afișează numărul de dependențe înlocuite pe iconiță",
- "description":"Show icon badge title."
+ "showIconBadgeTitle": {
+ "message": "Afișează numărul de dependențe înlocuite pe iconiță",
+ "description": "Show icon badge title."
},
- "showIconBadgeDescription":{
- "message":"Afișează numărul de resurse înlocuite pe iconița extensiei.",
- "description":"Show icon badge description."
+ "showIconBadgeDescription": {
+ "message": "Afișează numărul de resurse înlocuite pe iconița extensiei.",
+ "description": "Show icon badge description."
},
- "blockMissingTitle":{
- "message":"Blochează cererile pentru resursele care lipsesc",
- "description":"Block requests for missing resources title."
+ "blockMissingTitle": {
+ "message": "Blochează cererile pentru resursele care lipsesc",
+ "description": "Block requests for missing resources title."
},
- "blockMissingDescription":{
- "message":"Anulează cererile interceptate dacă resursa solicitată nu este disponibilă local.",
- "description":"Block requests for missing resources description."
+ "blockMissingDescription": {
+ "message": "Anulează cererile interceptate dacă resursa solicitată nu este disponibilă local.",
+ "description": "Block requests for missing resources description."
},
- "disablePrefetchTitle":{
- "message":"Dezactivează pre-încărcarea de linkuri",
- "description":"Disable prefetch title."
+ "disablePrefetchTitle": {
+ "message": "Dezactivează pre-încărcarea de linkuri",
+ "description": "Disable prefetch title."
},
- "disablePrefetchDescription":{
- "message":"Previne scurgerea request-uri nepermise către rețele de livrare.",
- "description":"Disable prefetch description."
+ "disablePrefetchDescription": {
+ "message": "Previne scurgerea request-uri nepermise către rețele de livrare.",
+ "description": "Disable prefetch description."
},
- "stripMetadataTitle":{
- "message":"Scoate metadatele din requesturi permise",
- "description":"Strip metadata title."
+ "stripMetadataTitle": {
+ "message": "Scoate metadatele din requesturi permise",
+ "description": "Strip metadata title."
},
- "stripMetadataDescription":{
- "message":"Șterge date sensibile din requesturi permise pentru îmbunătățirea confidențialității.",
- "description":"Strip metadata description."
+ "stripMetadataDescription": {
+ "message": "Șterge date sensibile din requesturi permise pentru îmbunătățirea confidențialității.",
+ "description": "Strip metadata description."
},
- "whitelistedDomainsTitle":{
- "message":"Exclude domeniile următoare de la inspecții",
- "description":"Whitelisted domains title."
+ "whitelistedDomainsTitle": {
+ "message": "Exclude domeniile următoare de la inspecții",
+ "description": "Whitelisted domains title."
},
- "whitelistedDomainsDescription":{
- "message":"Introduceți domeniile dorite în lista albă. Separați intrările multiple între ele prin punct și virgulă (;).",
- "description":"Whitelisted domains description."
+ "whitelistedDomainsDescription": {
+ "message": "Introduceți domeniile dorite în lista albă. Separați intrările multiple între ele prin punct și virgulă (;).",
+ "description": "Whitelisted domains description."
},
- "advancedLabel":{
- "message":"Avansat",
- "description":"Advanced label."
+ "advancedLabel": {
+ "message": "Avansat",
+ "description": "Advanced label."
}
}
\ No newline at end of file
diff --git a/_locales/sr/messages.json b/_locales/sr/messages.json
index 1248a4e..ac5211e 100644
--- a/_locales/sr/messages.json
+++ b/_locales/sr/messages.json
@@ -60,7 +60,7 @@
"description": "Whitelisted domains title."
},
"whitelistedDomainsDescription": {
- "message": "Унесите домене да их ставите на бели списак. Више одвојених ставки са тачка-запетама (;).",
+ "message": "Унесите домене да их ставите на бели списак. Одвојите више ставки са тачка-запетама (;).",
"description": "Whitelisted domains description."
},
"advancedLabel": {
diff --git a/_locales/tr/messages.json b/_locales/tr/messages.json
index 8864783..eca8fe2 100644
--- a/_locales/tr/messages.json
+++ b/_locales/tr/messages.json
@@ -1,70 +1,70 @@
{
- "extensionDescription":{
- "message":"Sizi, \"ücretsiz\", merkezi, içerik dağıtımı aracılığıyla yapılan takipten korur.",
- "description":"Extension description."
+ "extensionDescription": {
+ "message": "Sizi, \"ücretsiz\", merkezi, içerik dağıtımı aracılığıyla yapılan takipten korur.",
+ "description": "Extension description."
},
- "disableProtectionTitle":{
- "message":"Bu sitede korumayı devre dışı bırak",
- "description":"Disable protection title."
+ "disableProtectionTitle": {
+ "message": "Bu sitede korumayı devre dışı bırak",
+ "description": "Disable protection title."
},
- "enableProtectionTitle":{
- "message":"Korumayı etkinleştir",
- "description":"Enable protection title."
+ "enableProtectionTitle": {
+ "message": "Korumayı etkinleştir",
+ "description": "Enable protection title."
},
- "amountInjectedTitle":{
- "message":"Yerel olarak eklenen kaynaklar için sayaç",
- "description":"Amount injected title."
+ "amountInjectedTitle": {
+ "message": "Yerel olarak eklenen kaynaklar için sayaç",
+ "description": "Amount injected title."
},
- "amountInjectedDescription":{
- "message":"Kurulumdan bu yana yerel İçerik Dağıtım Ağı kaynak eklemelerinin miktarı.",
- "description":"Amount injected description."
+ "amountInjectedDescription": {
+ "message": "Kurulumdan bu yana yerel İçerik Dağıtım Ağı kaynak eklemelerinin miktarı.",
+ "description": "Amount injected description."
},
- "optionsTitle":{
- "message":"Seçenekler",
- "description":"Options title."
+ "optionsTitle": {
+ "message": "Seçenekler",
+ "description": "Options title."
},
- "showIconBadgeTitle":{
- "message":"Simgede enjeksiyon sayaçlarını göster",
- "description":"Show icon badge title."
+ "showIconBadgeTitle": {
+ "message": "Simgede enjeksiyon sayaçlarını göster",
+ "description": "Show icon badge title."
},
- "showIconBadgeDescription":{
- "message":"Enjekte edilen kaynakların sayısını uzantı simgesinde gösterin.",
- "description":"Show icon badge description."
+ "showIconBadgeDescription": {
+ "message": "Enjekte edilen kaynakların sayısını uzantı simgesinde gösterin.",
+ "description": "Show icon badge description."
},
- "blockMissingTitle":{
- "message":"Eksik kaynaklar için gelen istekleri engelle",
- "description":"Block requests for missing resources title."
+ "blockMissingTitle": {
+ "message": "Eksik kaynaklar için gelen istekleri engelle",
+ "description": "Block requests for missing resources title."
},
- "blockMissingDescription":{
- "message":"İstenilen kaynak yerel olarak mevcut değilse, yakalanan isteği iptal et.",
- "description":"Block requests for missing resources description."
+ "blockMissingDescription": {
+ "message": "İstenilen kaynak yerel olarak mevcut değilse, yakalanan isteği iptal et.",
+ "description": "Block requests for missing resources description."
},
- "disablePrefetchTitle":{
- "message":"Bağlantı önalımını devre dışı bırak",
- "description":"Disable prefetch title."
+ "disablePrefetchTitle": {
+ "message": "Bağlantı önalımını devre dışı bırak",
+ "description": "Disable prefetch title."
},
- "disablePrefetchDescription":{
- "message":"İzin verilmeyen isteklerin dağıtım ağlarına sızmasını engelleyin.",
- "description":"Disable prefetch description."
+ "disablePrefetchDescription": {
+ "message": "İzin verilmeyen isteklerin dağıtım ağlarına sızmasını engelleyin.",
+ "description": "Disable prefetch description."
},
- "stripMetadataTitle":{
- "message":"Meta verilerini izin verilen isteklerden ayır",
- "description":"Strip metadata title."
+ "stripMetadataTitle": {
+ "message": "Meta verilerini izin verilen isteklerden ayır",
+ "description": "Strip metadata title."
},
- "stripMetadataDescription":{
- "message":"İzin verilen CDN isteklerine duyarlı verileri gelişmiş gizlilik için silin.",
- "description":"Strip metadata description."
+ "stripMetadataDescription": {
+ "message": "İleri düzey gizlilik için, izin verilen CDN isteklerinden hassas verileri sil.",
+ "description": "Strip metadata description."
},
- "whitelistedDomainsTitle":{
- "message":"Alanları denetimlerden hariç tut",
- "description":"Whitelisted domains title."
+ "whitelistedDomainsTitle": {
+ "message": "Alanları denetimlerden hariç tut",
+ "description": "Whitelisted domains title."
},
- "whitelistedDomainsDescription":{
- "message":"Beyaz listeye eklemek için alan adlarını girin. Birden çok girdiyi noktalı virgül (;) ile ayırın.",
- "description":"Whitelisted domains description."
+ "whitelistedDomainsDescription": {
+ "message": "Beyaz listeye eklemek için alan adlarını girin. Birden çok girdiyi noktalı virgül (;) ile ayırın.",
+ "description": "Whitelisted domains description."
},
- "advancedLabel":{
- "message":"Gelişmiş",
- "description":"Advanced label."
+ "advancedLabel": {
+ "message": "Gelişmiş",
+ "description": "Advanced label."
}
}
\ No newline at end of file
diff --git a/core/constants.js b/core/constants.js
index c3320fd..86e5754 100644
--- a/core/constants.js
+++ b/core/constants.js
@@ -27,6 +27,12 @@ const Address = {
'WWW_PREFIX': 'www.'
};
+const Header = {
+ 'COOKIE': 'Cookie',
+ 'ORIGIN': 'Origin',
+ 'REFERER': 'Referer'
+};
+
const Resource = {
'MAPPING_EXPRESSION': /\.map$/i,
'VERSION_EXPRESSION': /(?:\d{1,2}\.){1,3}\d{1,2}/,
@@ -38,6 +44,7 @@ const Setting = {
'BLOCK_MISSING': 'blockMissing',
'DISABLE_PREFETCH': 'disablePrefetch',
'SHOW_ICON_BADGE': 'showIconBadge',
+ 'SHOW_RELEASE_NOTES': 'showReleaseNotes',
'STRIP_METADATA': 'stripMetadata',
'WHITELISTED_DOMAINS': 'whitelistedDomains'
};
@@ -45,9 +52,7 @@ const Setting = {
const WebRequest = {
'GET': 'GET',
'BLOCKING': 'blocking',
- 'HEADERS': 'requestHeaders',
- 'ORIGIN_HEADER': 'Origin',
- 'REFERER_HEADER': 'Referer'
+ 'HEADERS': 'requestHeaders'
};
const Whitelist = {
diff --git a/core/interceptor.js b/core/interceptor.js
index 288d431..b8a06cb 100644
--- a/core/interceptor.js
+++ b/core/interceptor.js
@@ -45,11 +45,14 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
// Temporary list of undetectable tainted domains.
let undetectableTaintedDomains = {
'10fastfingers.com': true,
+ 'blog.datawrapper.de': true,
+ 'bundleofholding.com': true,
'cdnjs.com': true,
'dropbox.com': true,
'glowing-bear.org': true,
'minigames.mail.ru': true,
'miniquadtestbench.com': true,
+ 'openweathermap.org': true,
'qwertee.com': true,
'report-uri.io': true,
'scotthelme.co.uk': true,
diff --git a/core/main.js b/core/main.js
index 5174c27..6c5557c 100644
--- a/core/main.js
+++ b/core/main.js
@@ -26,11 +26,11 @@ var main = {};
main._initializeOptions = function () {
let optionDefaults = {
- 'showIconBadge': true,
- 'blockMissing': false,
- 'disablePrefetch': true,
- 'stripMetadata': true,
- 'whitelistedDomains': {}
+ [Setting.SHOW_ICON_BADGE]: true,
+ [Setting.BLOCK_MISSING]: false,
+ [Setting.DISABLE_PREFETCH]: true,
+ [Setting.STRIP_METADATA]: true,
+ [Setting.WHITELISTED_DOMAINS]: {}
};
chrome.storage.local.get(optionDefaults, function (options) {
@@ -68,7 +68,7 @@ main._showReleaseNotes = function (details) {
if (details.temporary !== true) {
chrome.storage.local.get({
- 'showReleaseNotes': true
+ [Setting.SHOW_RELEASE_NOTES]: true
}, function (options) {
if (options.showReleaseNotes === true) {
diff --git a/core/request-sanitizer.js b/core/request-sanitizer.js
new file mode 100644
index 0000000..8a76e67
--- /dev/null
+++ b/core/request-sanitizer.js
@@ -0,0 +1,73 @@
+/**
+ * Request Sanitizer
+ * Belongs to Decentraleyes.
+ *
+ * @author Thomas Rientjes
+ * @since 2018-01-10
+ * @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';
+
+/**
+ * Request Sanitizer
+ */
+
+var requestSanitizer = {};
+
+/**
+ * Public Methods
+ */
+
+requestSanitizer.enable = function () {
+
+ let onBeforeSendHeaders = chrome.webRequest.onBeforeSendHeaders;
+
+ onBeforeSendHeaders.addListener(requestSanitizer._stripMetadata, {
+ 'urls': stateManager.validHosts
+ }, [WebRequest.BLOCKING, WebRequest.HEADERS]);
+};
+
+requestSanitizer.disable = function () {
+
+ let onBeforeSendHeaders = chrome.webRequest.onBeforeSendHeaders;
+
+ onBeforeSendHeaders.removeListener(requestSanitizer._stripMetadata, {
+ 'urls': stateManager.validHosts
+ }, [WebRequest.BLOCKING, WebRequest.HEADERS]);
+};
+
+/**
+ * Private Methods
+ */
+
+requestSanitizer._stripMetadata = function (requestDetails) {
+
+ let sensitiveHeaders = [Header.COOKIE, Header.ORIGIN, Header.REFERER];
+
+ for (let i = 0; i < requestDetails.requestHeaders.length; ++i) {
+
+ if (sensitiveHeaders.indexOf(requestDetails.requestHeaders[i].name) > -1) {
+ requestDetails.requestHeaders.splice(i--, 1);
+ }
+ }
+
+ return {
+ [WebRequest.HEADERS]: requestDetails.requestHeaders
+ };
+};
+
+/**
+ * Initializations
+ */
+
+chrome.storage.local.get({[Setting.STRIP_METADATA]: true}, function (options) {
+
+ if (options === null || options.stripMetadata !== false) {
+ requestSanitizer.enable();
+ }
+});
diff --git a/core/state-manager.js b/core/state-manager.js
index 43bf38b..8d4db71 100644
--- a/core/state-manager.js
+++ b/core/state-manager.js
@@ -41,13 +41,6 @@ stateManager.registerInjection = function (tabIdentifier, injection) {
'tabId': tabIdentifier,
'text': injectionCount.toString()
});
-
- } else {
-
- wrappers.setBadgeText({
- 'tabId': tabIdentifier,
- 'text': ''
- });
}
}
@@ -58,14 +51,14 @@ stateManager.registerInjection = function (tabIdentifier, injection) {
interceptor.amountInjected = items.amountInjected;
chrome.storage.local.set({
- 'amountInjected': ++interceptor.amountInjected
+ [Setting.AMOUNT_INJECTED]: ++interceptor.amountInjected
});
});
} else {
chrome.storage.local.set({
- 'amountInjected': ++interceptor.amountInjected
+ [Setting.AMOUNT_INJECTED]: ++interceptor.amountInjected
});
}
};
@@ -148,25 +141,9 @@ stateManager._updateTab = function (details) {
}
};
-stateManager._stripMetadata = function (requestDetails) {
-
- for (let i = 0; i < requestDetails.requestHeaders.length; ++i) {
-
- if (requestDetails.requestHeaders[i].name === WebRequest.ORIGIN_HEADER) {
- requestDetails.requestHeaders.splice(i--, 1);
- } else if (requestDetails.requestHeaders[i].name === WebRequest.REFERER_HEADER) {
- requestDetails.requestHeaders.splice(i--, 1);
- }
- }
-
- return {
- 'requestHeaders': requestDetails.requestHeaders
- };
-};
-
stateManager._handleStorageChanged = function (changes) {
- if ('showIconBadge' in changes) {
+ if (Setting.SHOW_ICON_BADGE in changes) {
stateManager.showIconBadge = changes.showIconBadge.newValue;
@@ -178,21 +155,12 @@ stateManager._handleStorageChanged = function (changes) {
}
}
- if ('stripMetadata' in changes) {
-
- let onBeforeSendHeaders;
-
- onBeforeSendHeaders = chrome.webRequest.onBeforeSendHeaders;
+ if (Setting.STRIP_METADATA in changes) {
- onBeforeSendHeaders.removeListener(stateManager._stripMetadata, {
- 'urls': stateManager.validHosts
- }, [WebRequest.BLOCKING, WebRequest.HEADERS]);
+ requestSanitizer.disable();
if (changes.stripMetadata.newValue !== false) {
-
- onBeforeSendHeaders.addListener(stateManager._stripMetadata, {
- 'urls': stateManager.validHosts
- }, [WebRequest.BLOCKING, WebRequest.HEADERS]);
+ requestSanitizer.enable();
}
}
};
@@ -223,8 +191,13 @@ chrome.tabs.query({}, function (tabs) {
tabs.forEach(stateManager._createTab);
});
-chrome.storage.local.get('showIconBadge', function (items) {
- stateManager.showIconBadge = items.showIconBadge || true;
+chrome.storage.local.get(Setting.SHOW_ICON_BADGE, function (items) {
+
+ if (items.showIconBadge === undefined) {
+ items.showIconBadge = true;
+ }
+
+ stateManager.showIconBadge = items.showIconBadge;
});
/**
@@ -269,14 +242,4 @@ chrome.webRequest.onBeforeRedirect.addListener(function (requestDetails) {
}, {'urls': [Address.ANY]});
-chrome.storage.local.get({'stripMetadata': true}, function (options) {
-
- if (options === null || options.stripMetadata !== false) {
-
- chrome.webRequest.onBeforeSendHeaders.addListener(stateManager._stripMetadata, {
- 'urls': stateManager.validHosts
- }, [WebRequest.BLOCKING, WebRequest.HEADERS]);
- }
-});
-
chrome.storage.onChanged.addListener(stateManager._handleStorageChanged);
diff --git a/modules/internal/helpers.js b/modules/internal/helpers.js
index 54a1ed1..003d8e1 100644
--- a/modules/internal/helpers.js
+++ b/modules/internal/helpers.js
@@ -62,8 +62,8 @@ helpers.languageIsFullySupported = function (language) {
languageSupported = false;
supportedLanguages = [
- 'ar', 'bg', 'zh', 'da', 'nl', 'en', 'et', 'fi', 'fr', 'de', 'el', 'is',
- 'id', 'it', 'ja', 'ko', 'pl', 'pt', 'ro', 'ru', 'es', 'sv', 'tr'
+ 'ar', 'bg', 'zh', 'cs', 'da', 'nl', 'en', 'et', 'fi', 'fr', 'de', 'el',
+ 'is', 'id', 'it', 'ja', 'ko', 'pl', 'pt', 'ro', 'ru', 'es', 'sv', 'tr'
];
for (let supportedLanguage of supportedLanguages) {
@@ -201,6 +201,13 @@ helpers.determineScriptDirection = function (language) {
return scriptDirection;
};
+helpers.formatNumber = function (number) {
+
+ if (typeof number === 'number') {
+ return number.toLocaleString();
+ }
+};
+
helpers.formatVersion = function (version) {
if (version.indexOf('beta') === -1) {
diff --git a/pages/background/background.html b/pages/background/background.html
index 55584b6..ebf75a1 100644
--- a/pages/background/background.html
+++ b/pages/background/background.html
@@ -17,6 +17,7 @@
+
diff --git a/pages/options/options.js b/pages/options/options.js
index 1512b8a..17c403e 100644
--- a/pages/options/options.js
+++ b/pages/options/options.js
@@ -90,11 +90,11 @@ options._getOptionElement = function (optionKey) {
options._getOptionElements = function () {
let optionElements = {
- 'showIconBadge': options._getOptionElement(Setting.SHOW_ICON_BADGE),
- 'blockMissing': options._getOptionElement(Setting.BLOCK_MISSING),
- 'disablePrefetch': options._getOptionElement(Setting.DISABLE_PREFETCH),
- 'stripMetadata': options._getOptionElement(Setting.STRIP_METADATA),
- 'whitelistedDomains': options._getOptionElement(Setting.WHITELISTED_DOMAINS)
+ [Setting.SHOW_ICON_BADGE]: options._getOptionElement(Setting.SHOW_ICON_BADGE),
+ [Setting.BLOCK_MISSING]: options._getOptionElement(Setting.BLOCK_MISSING),
+ [Setting.DISABLE_PREFETCH]: options._getOptionElement(Setting.DISABLE_PREFETCH),
+ [Setting.STRIP_METADATA]: options._getOptionElement(Setting.STRIP_METADATA),
+ [Setting.WHITELISTED_DOMAINS]: options._getOptionElement(Setting.WHITELISTED_DOMAINS)
};
return optionElements;
diff --git a/pages/popup/popup.js b/pages/popup/popup.js
index befa4ac..ac7751b 100644
--- a/pages/popup/popup.js
+++ b/pages/popup/popup.js
@@ -47,7 +47,7 @@ popup._renderNonContextualContents = function () {
optionsButtonElement = document.getElementById('options-button');
versionLabelElement.innerText = popup._version;
- counterElement.innerText = popup._amountInjected;
+ counterElement.innerText = helpers.formatNumber(popup._amountInjected);
testingUtilityLinkElement.addEventListener('mouseup', popup._onTestingUtilityLinkClicked);
optionsButtonElement.addEventListener('mouseup', popup._onOptionsButtonClicked);
@@ -157,7 +157,7 @@ popup._determineAmountInjected = function () {
return new Promise((resolve) => {
- chrome.storage.local.get('amountInjected', function (items) {
+ chrome.storage.local.get(Setting.AMOUNT_INJECTED, function (items) {
popup._amountInjected = items.amountInjected || 0;
resolve();