added lan/loopback whitelist option
This commit is contained in:
parent
7b3fc58f8d
commit
fc96e8daee
@ -66,13 +66,44 @@ let appCode = function (){
|
|||||||
if (e.key.startsWith('Arrow') || e.key.startsWith('Page')){
|
if (e.key.startsWith('Arrow') || e.key.startsWith('Page')){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
pausecomp(down); we
|
pausecomp(down);
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
}, 100)
|
}, 100)
|
||||||
}
|
}
|
||||||
|
function checkForLANThenRun(){
|
||||||
|
|
||||||
|
let lan = browser.storage.sync.get("keyboardprivacylan");
|
||||||
|
lan.then(function(val){
|
||||||
|
|
||||||
|
if (! val['keyboardprivacylan']){
|
||||||
|
mainKeyboardPrivacy()
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
let hostname = document.location.hostname
|
||||||
|
if (/^(10)\.(.*)\.(.*)\.(.*)$/.test(hostname)){
|
||||||
|
//10.x.x.x
|
||||||
|
}else if (/^(172)\.(1[6-9]|2[0-9]|3[0-1])\.(.*)\.(.*)$/.test(hostname)){
|
||||||
|
//172.16.x.x - 172.31.255.255
|
||||||
|
}else if (/^(192)\.(168)\.(.*)\.(.*)$/.test(hostname)){
|
||||||
|
//192.168.x.x
|
||||||
|
}else if (/^(127)\.(.*)\.(.*)\.(.*)$/.test(hostname)){
|
||||||
|
}
|
||||||
|
else if (hostname == '[::1]'){
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mainKeyboardPrivacy()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
console.debug("Not running private keyboard because lan/loopback hostname")
|
||||||
|
}
|
||||||
|
|
||||||
|
}, function(val){mainKeyboardPrivacy()})
|
||||||
|
|
||||||
|
}
|
||||||
function shouldRunKeyboardPrivacy(value){
|
function shouldRunKeyboardPrivacy(value){
|
||||||
if (typeof value.keyboardprivacywhitelist === 'undefined'){
|
if (typeof value.keyboardprivacywhitelist === 'undefined'){
|
||||||
mainKeyboardPrivacy()
|
mainKeyboardPrivacy()
|
||||||
@ -85,7 +116,8 @@ let appCode = function (){
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mainKeyboardPrivacy()
|
checkForLANThenRun()
|
||||||
|
|
||||||
}
|
}
|
||||||
function noKeyboardPrivacySettings(value){
|
function noKeyboardPrivacySettings(value){
|
||||||
mainKeyboardPrivacy()
|
mainKeyboardPrivacy()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Private Keyboard",
|
"name": "Private Keyboard",
|
||||||
"version": "1.6",
|
"version": "1.8",
|
||||||
|
|
||||||
|
|
||||||
"description": "Protect against keyboard biometrics",
|
"description": "Protect against keyboard biometrics",
|
||||||
|
3
settings/options.css
Normal file
3
settings/options.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
body{
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
}
|
@ -3,12 +3,15 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<link rel="stylesheet" href="options.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h1>Trusted domains (comma delimited)</h1>
|
|
||||||
<form>
|
<form>
|
||||||
|
<input type="checkbox" id="whitelistLAN">
|
||||||
|
<label for="whitelistLAN">Whitelist private IP + localhost range hostnames (e.g. routers)</label>
|
||||||
|
<h1>Trusted domains (comma delimited)</h1>
|
||||||
<textarea id="whitelist" cols=50 rows=10></textarea>
|
<textarea id="whitelist" cols=50 rows=10></textarea>
|
||||||
<br><br>
|
<br><br>
|
||||||
<button type="submit">Save</button>
|
<button type="submit">Save</button>
|
||||||
@ -16,6 +19,8 @@
|
|||||||
|
|
||||||
<script src="options.js"></script>
|
<script src="options.js"></script>
|
||||||
|
|
||||||
|
<div id="saved"><br></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -17,27 +17,40 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
function saveOptions(e) {
|
function saveOptions(e) {
|
||||||
e.preventDefault();
|
e.preventDefault()
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
keyboardprivacywhitelist: document.querySelector("#whitelist").value
|
keyboardprivacywhitelist: document.querySelector("#whitelist").value
|
||||||
});
|
})
|
||||||
|
browser.storage.sync.set({
|
||||||
|
keyboardprivacylan: document.querySelector("#whitelistLAN").checked
|
||||||
|
})
|
||||||
|
document.getElementById('saved').innerHTML = '<br><b>Saved</b>'
|
||||||
|
setTimeout(function(){
|
||||||
|
document.getElementById('saved').innerHTML = '<br>'
|
||||||
|
}, 3000)
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreOptions() {
|
function restoreOptions() {
|
||||||
|
|
||||||
function setCurrentChoice(result) {
|
function setCurrentWhitelist(result) {
|
||||||
if (result['keyboardprivacywhitelist']){
|
if (result['keyboardprivacywhitelist']){
|
||||||
document.querySelector("#whitelist").value = result['keyboardprivacywhitelist']
|
document.querySelector("#whitelist").value = result['keyboardprivacywhitelist']
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function setCurrentLAN(result){
|
||||||
|
document.querySelector("#whitelistLAN").checked = result['keyboardprivacylan']
|
||||||
|
}
|
||||||
|
|
||||||
function onError(error) {
|
function onError(error) {
|
||||||
console.log(`Error: ${error}`);
|
console.log(`Error: ${error}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let getting = browser.storage.sync.get("keyboardprivacywhitelist");
|
let getting = browser.storage.sync.get("keyboardprivacywhitelist");
|
||||||
getting.then(setCurrentChoice, onError);
|
getting.then(setCurrentWhitelist, onError);
|
||||||
|
|
||||||
|
let gettingLAN = browser.storage.sync.get("keyboardprivacylan");
|
||||||
|
gettingLAN.then(setCurrentLAN, onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", restoreOptions);
|
document.addEventListener("DOMContentLoaded", restoreOptions);
|
||||||
|
Loading…
Reference in New Issue
Block a user