Revert "settings: permit temporarily allowing a BLE connection"

This reverts commit 74d91c60a1.
pull/2776/head
Rob Pilling 2023-05-29 10:12:46 +01:00
parent 74d91c60a1
commit 77fd3a0c7d
1 changed files with 11 additions and 24 deletions

View File

@ -363,6 +363,17 @@ function showWhitelistMenu() {
}; };
} }
if (settings.whitelist) settings.whitelist.forEach(function(d){
menu[d.substr(0,17)] = function() {
E.showPrompt(/*LANG*/'Remove\n'+d).then((v) => {
if (v) {
settings.whitelist.splice(settings.whitelist.indexOf(d),1);
updateSettings();
}
setTimeout(showWhitelistMenu, 50);
});
}
});
menu[/*LANG*/'Add Device']=function() { menu[/*LANG*/'Add Device']=function() {
E.showAlert(/*LANG*/"Connect device\nto add to\nwhitelist",/*LANG*/"Whitelist").then(function() { E.showAlert(/*LANG*/"Connect device\nto add to\nwhitelist",/*LANG*/"Whitelist").then(function() {
NRF.removeAllListeners('connect'); NRF.removeAllListeners('connect');
@ -378,30 +389,6 @@ function showWhitelistMenu() {
showWhitelistMenu(); showWhitelistMenu();
}); });
}; };
menu[/*LANG*/'Temporarily Add Device']=function() {
E.showAlert(/*LANG*/"Whitelist disabled\nConnect device",/*LANG*/"Whitelist").then(function() {
NRF.removeAllListeners('connect');
showWhitelistMenu();
});
NRF.removeAllListeners('connect'); // this is sufficient to allow any device to connect
NRF.on('connect', function(addr) {
showWhitelistMenu();
});
};
if (settings.whitelist) settings.whitelist.forEach(function(d){
menu[d.substr(0,17)] = function() {
E.showPrompt(/*LANG*/'Remove\n'+d).then((v) => {
if (v) {
settings.whitelist.splice(settings.whitelist.indexOf(d),1);
updateSettings();
}
setTimeout(showWhitelistMenu, 50);
});
}
});
E.showMenu(menu); E.showMenu(menu);
} }