privacy exposure reduction: local mirroring of CDN resources

This commit is contained in:
gorhill 2014-09-30 15:55:18 -04:00
parent ae5b0d424b
commit 5b984855d0
10 changed files with 40 additions and 1 deletions

View File

@ -107,6 +107,10 @@
"message":"Verwende das Kontext-Menü, falls möglich",
"description":"English: Make use of context menu where appropriate"
},
"settingsExperimentalPrompt":{
"message":"Enable experimental features",
"description":"English: Enable experimental features"
},
"3pListsOfBlockedHostsPrompt":{
"message":"{{netFilterCount}} Netzwerkfilter {{cosmeticFilterCount}} kosmetische Filter von:",
"description":"English: {{netFilterCount}} network filters {{cosmeticFilterCount}} cosmetic filters from:"

View File

@ -107,6 +107,10 @@
"message":"Make use of context menu where appropriate",
"description":"English: Make use of context menu where appropriate"
},
"settingsExperimentalPrompt":{
"message":"Enable experimental features",
"description":"English: Enable experimental features"
},
"3pListsOfBlockedHostsPrompt":{
"message":"{{netFilterCount}} network filters {{cosmeticFilterCount}} cosmetic filters from:",
"description":"English: {{netFilterCount}} network filters {{cosmeticFilterCount}} cosmetic filters from:"

View File

@ -107,6 +107,10 @@
"message":"Utiliser le menu contextuel si possible",
"description":"English: Make use of context menu where appropriate"
},
"settingsExperimentalPrompt":{
"message":"Activer les fonctionalités expérimentales",
"description":"English: Enable experimental features"
},
"3pListsOfBlockedHostsPrompt":{
"message":"{{netFilterCount}} filtre(s) réseau et {{cosmeticFilterCount}} filtre(s) esthétique(s) sont actuellement en action :",
"description":"English: {{netFilterCount}} network filters {{cosmeticFilterCount}} cosmetic filters from:"

View File

@ -9,6 +9,7 @@
<script src="lib/publicsuffixlist.min.js"></script>
<script src="lib/yamd5.js"></script>
<script src="js/background.js"></script>
<script src="js/mirrors.js"></script>
<script src="js/xal.js"></script>
<script src="js/async.js"></script>
<script src="js/liquid-dict.js"></script>

View File

@ -55,6 +55,7 @@ return {
autoUpdate: true,
collapseBlocked: true,
contextMenuEnabled: false,
experimentalEnabled: false,
externalLists: defaultExternalLists,
logRequests: false,
parseAllABPHideFilters: true,

View File

@ -61,6 +61,12 @@ var onUserSettingsReceived = function(details) {
.on('change', function(){
changeUserSettings('contextMenuEnabled', this.checked);
});
uDom('#experimental-enabled')
.prop('checked', details.experimentalEnabled === true)
.on('change', function(){
changeUserSettings('experimentalEnabled', this.checked);
});
};
messaging.ask({ what: 'userSettings' }, onUserSettingsReceived);

View File

@ -669,6 +669,7 @@
var onUserSettingsReady = function(settings) {
µb.contextMenu.toggle(settings.contextMenuEnabled);
µb.fromSelfie(onSelfieReady);
µb.mirrors.toggle(settings.experimentalEnabled);
};
this.loadUserSettings(onUserSettingsReady);

View File

@ -104,6 +104,14 @@ var onBeforeRequest = function(details) {
pageStore.addFrame(frameId, requestURL);
}
if ( µb.userSettings.experimentalEnabled ) {
var redirectURL = µb.mirrors.toURL(requestURL, true);
if ( redirectURL !== '' ) {
//console.debug('"%s" redirected to "%s..."', requestURL.slice(0, 50), redirectURL.slice(0, 50));
return { redirectUrl: redirectURL };
}
}
//console.debug('µBlock> onBeforeRequest()> ALLOW "%s" (%o)', details.url, details);
return;
}

View File

@ -213,7 +213,12 @@
// Post-change
switch ( name ) {
case 'contextMenuEnabled':
this.contextMenu.toggle(value === true);
this.contextMenu.toggle(value);
break;
case 'experimentalEnabled':
if ( typeof this.mirrors === 'object' ) {
this.mirrors.toggle(value);
}
break;
default:
break;

View File

@ -9,6 +9,9 @@
ul {
list-style-type: none;
}
#experimental-enabled {
margin-top: 1em;
}
</style>
</head>
@ -18,6 +21,8 @@ ul {
<li><input id="collapse-blocked" type="checkbox"> <label data-i18n="settingsCollapseBlockedPrompt"></label>
<li><input id="icon-badge" type="checkbox"> <label data-i18n="settingsIconBadgePrompt"></label>
<li><input id="context-menu-enabled" type="checkbox"><label data-i18n="settingsContextMenuPrompt"></label>
<li><input id="experimental-enabled" type="checkbox"><label data-i18n="settingsExperimentalPrompt"></label>
(<a href="https://github.com/gorhill/uBlock/wiki/Experimental-features" style="font-style:italic">Experimental features</a>)
</ul>
<script src="js/udom.js"></script>