Skip to content

Commit

Permalink
Completely remove the save button
Browse files Browse the repository at this point in the history
  • Loading branch information
aghorler committed May 9, 2018
1 parent 25c0ba9 commit febdaa9
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 194 deletions.
12 changes: 2 additions & 10 deletions html/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,12 @@ <h3>Advanced options</h3>
<p id="incognitoAllowed" style="color:green;">Enabled</p>

<p id="incognitoDisallowed" style="color:red;">
Not enabled. <a style="color:red;" href="https://github.com/aghorler/WebRTC-Leak-Prevent/blob/master/DOCUMENTATION.md#what-is-incognito-protection"><i>Learn more.</i></a>
Not enabled. <a style="color:red;" href="https://github.com/aghorler/WebRTC-Leak-Prevent/blob/master/DOCUMENTATION.md#what-is-incognito-protection"><em>Learn more.</em></a>
</p>
</div>

<p>
<span id="applyButton">
<button id="save">Apply settings</button>
</span>

<span id="status"></span>
</p>

<p style="color:grey; text-align: center;">
Developed by Aaron Horler (aghorler) | <a href="https://github.com/aghorler/WebRTC-Leak-Prevent">GitHub source</a>
Developed by <a href="https://aaronhorler.com">Aaron Horler</a> (aghorler) | <a href="https://github.com/aghorler/WebRTC-Leak-Prevent">GitHub source</a>
</p>

<script src="/js/options.js"></script>
Expand Down
78 changes: 39 additions & 39 deletions js/background.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
/* Function to get version of Chrome. https://stackoverflow.com/a/4900484 */
function getMajorVerison(){
var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
return raw ? parseInt(raw[2], 10) : false;
var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
return raw ? parseInt(raw[2], 10) : false;
}

/* Configure WebRTC leak prevention default setting, depending on Chrome version. */
chrome.storage.local.get(null, function(items){
/* Use webRTCIPHandlingPolicy in newer versions of Chrome. */
if(getMajorVerison() > 47){
if(items.rtcIPHandling == undefined){
try{
chrome.storage.local.set({
rtcIPHandling: 'default_public_interface_only'
}, function(){
chrome.privacy.network.webRTCIPHandlingPolicy.set({
value: 'default_public_interface_only'
});
})
}
catch(e){
console.log("Error: " + e.message);
}
}
/* Use webRTCIPHandlingPolicy in newer versions of Chrome. */
if(getMajorVerison() > 47){
if(items.rtcIPHandling == undefined){
try{
chrome.storage.local.set({
rtcIPHandling: 'default_public_interface_only'
}, function(){
chrome.privacy.network.webRTCIPHandlingPolicy.set({
value: 'default_public_interface_only'
});
})
}
catch(e){
console.log("Error: " + e.message);
}
}
/* Use webRTCMultipleRoutesEnabled in older versions of Chrome. */
else if(getMajorVerison() > 41 && getMajorVerison() < 48){
if(items.rtcMultipleRoutes == undefined){
try{
chrome.storage.local.set({
rtcMultipleRoutes: true
}, function(){
chrome.privacy.network.webRTCMultipleRoutesEnabled.set({
value: false,
scope: 'regular'
});
})
}
catch(e){
console.log("Error: " + e.message);
}
}
}
/* Use webRTCMultipleRoutesEnabled in older versions of Chrome. */
else if(getMajorVerison() > 41 && getMajorVerison() < 48){
if(items.rtcMultipleRoutes == undefined){
try{
chrome.storage.local.set({
rtcMultipleRoutes: true
}, function(){
chrome.privacy.network.webRTCMultipleRoutesEnabled.set({
value: false,
scope: 'regular'
});
})
}
catch(e){
console.log("Error: " + e.message);
}
}
}
});

/* Open options page on install. */
chrome.runtime.onInstalled.addListener(function(details){
if(details.reason == "install"){
chrome.runtime.openOptionsPage();
}
if(details.reason == "install"){
chrome.runtime.openOptionsPage();
}
});

/* Open options page on toolbar icon click. */
chrome.browserAction.onClicked.addListener(function(){
chrome.runtime.openOptionsPage();
chrome.runtime.openOptionsPage();
});
Loading

0 comments on commit febdaa9

Please sign in to comment.