diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index 3d0ccaf82..9413033f6 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -85,6 +85,15 @@ vAPI.browserSettings = { }); break; + case 'webrtcIPAddress': + if ( typeof chrome.privacy.network.webRTCMultipleRoutesEnabled === 'object' ) { + chrome.privacy.network.webRTCMultipleRoutesEnabled.set({ + value: !!details[setting], + scope: 'regular' + }); + } + break; + default: break; } diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 67fa567b1..3d73648b5 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -195,6 +195,16 @@ vAPI.browserSettings = { } break; + case 'webrtcIPAddress': + this.rememberOriginalValue('media.peerconnection', 'enabled'); + value = !!details[setting]; + if ( value === true ) { + this.clear('media.peerconnection', 'enabled'); + } else { + this.setBool('media.peerconnection', 'enabled', false); + } + break; + default: break; } diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 359154a41..a26f4aa9a 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -183,6 +183,10 @@ "message":"Disable hyperlink auditing/beacon", "description":"English: " }, + "settingsWebRTCIPAddressHiddenPrompt":{ + "message":"Prevent WebRTC from leaking local IP address", + "description":"English: " + }, "settingsExperimentalPrompt":{ "message":"Enable experimental features (About<\/a>)", "description":"English: Enable experimental features" diff --git a/src/js/background.js b/src/js/background.js index 5d110c9fb..8c47c2a82 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -65,7 +65,8 @@ return { parseAllABPHideFilters: true, prefetchingDisabled: true, requestLogMaxEntries: 1000, - showIconBadge: true + showIconBadge: true, + webrtcIPAddressHidden: false }, // https://github.com/chrisaljoudi/uBlock/issues/180 diff --git a/src/js/settings.js b/src/js/settings.js index 179a5453a..fdf1c258a 100644 --- a/src/js/settings.js +++ b/src/js/settings.js @@ -204,6 +204,12 @@ var onUserSettingsReceived = function(details) { changeUserSettings('hyperlinkAuditingDisabled', this.checked); }); + uDom('#webrtc-ipaddress-hidden') + .prop('checked', details.webrtcIPAddressHidden === true) + .on('change', function(){ + changeUserSettings('webrtcIPAddressHidden', this.checked); + }); + uDom('#experimental-enabled') .prop('checked', details.experimentalEnabled === true) .on('change', function(){ diff --git a/src/js/start.js b/src/js/start.js index 1e882ca0b..c08d01059 100644 --- a/src/js/start.js +++ b/src/js/start.js @@ -159,7 +159,8 @@ var onUserSettingsReady = function(fetched) { µb.contextMenu.toggle(userSettings.contextMenuEnabled); vAPI.browserSettings.set({ 'hyperlinkAuditing': !userSettings.hyperlinkAuditingDisabled, - 'prefetching': !userSettings.prefetchingDisabled + 'prefetching': !userSettings.prefetchingDisabled, + 'webrtcIPAddress': !userSettings.webrtcIPAddressHidden }); µb.permanentFirewall.fromString(fetched.dynamicFilteringString); diff --git a/src/js/ublock.js b/src/js/ublock.js index aa13d41b0..eeb5e0577 100644 --- a/src/js/ublock.js +++ b/src/js/ublock.js @@ -279,6 +279,9 @@ var matchWhitelistDirective = function(url, hostname, directive) { case 'prefetchingDisabled': vAPI.browserSettings.set({ 'prefetching': !value }); break; + case 'webrtcIPAddressHidden': + vAPI.browserSettings.set({ 'webrtcIPAddress': !value }); + break; default: break; } diff --git a/src/settings.html b/src/settings.html index 07f8ff961..53f108e05 100644 --- a/src/settings.html +++ b/src/settings.html @@ -19,6 +19,7 @@