boot, setting: whitelist: try to resolve peer address
This uses NRF.resolveAddress() on newer firmwares, to try to resolve "random private resolvable addresses" of peers that connect, before checking the whitelist.master
parent
656b8a275c
commit
e1692a4dbc
|
|
@ -67,3 +67,4 @@
|
||||||
0.56: Settings.log = 0,1,2,3 for off,display, log, both
|
0.56: Settings.log = 0,1,2,3 for off,display, log, both
|
||||||
0.57: Handle the whitelist being disabled
|
0.57: Handle the whitelist being disabled
|
||||||
0.58: "Make Connectable" temporarily bypasses the whitelist
|
0.58: "Make Connectable" temporarily bypasses the whitelist
|
||||||
|
0.59: Whitelist: Try to resolve peer addresses using NRF.resolveAddress() - for 2v19 or 2v18 cutting edge builds
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ if (global.save) boot += `global.save = function() { throw new Error("You can't
|
||||||
if (s.options) boot+=`Bangle.setOptions(${E.toJS(s.options)});\n`;
|
if (s.options) boot+=`Bangle.setOptions(${E.toJS(s.options)});\n`;
|
||||||
if (s.brightness && s.brightness!=1) boot+=`Bangle.setLCDBrightness(${s.brightness});\n`;
|
if (s.brightness && s.brightness!=1) boot+=`Bangle.setLCDBrightness(${s.brightness});\n`;
|
||||||
if (s.passkey!==undefined && s.passkey.length==6) boot+=`NRF.setSecurity({passkey:${E.toJS(s.passkey.toString())}, mitm:1, display:1});\n`;
|
if (s.passkey!==undefined && s.passkey.length==6) boot+=`NRF.setSecurity({passkey:${E.toJS(s.passkey.toString())}, mitm:1, display:1});\n`;
|
||||||
if (s.whitelist && !s.whitelist_disabled) boot+=`NRF.on('connect', function(addr) { if (!NRF.ignoreWhitelist && !(require('Storage').readJSON('setting.json',1)||{}).whitelist.includes(addr)) NRF.disconnect(); });\n`;
|
if (s.whitelist && !s.whitelist_disabled) boot+=`NRF.on('connect', function(addr) { if (!NRF.ignoreWhitelist) { let whitelist = (require('Storage').readJSON('setting.json',1)||{}).whitelist; if (NRF.resolveAddress !== undefined) { let resolvedAddr = NRF.resolveAddress(addr); if (resolvedAddr !== undefined) addr = resolvedAddr + " (resolved)"; } if (!whitelist.includes(addr)) NRF.disconnect(); }});\n`;
|
||||||
if (s.rotate) boot+=`g.setRotation(${s.rotate&3},${s.rotate>>2});\n` // screen rotation
|
if (s.rotate) boot+=`g.setRotation(${s.rotate&3},${s.rotate>>2});\n` // screen rotation
|
||||||
// ================================================== FIXING OLDER FIRMWARES
|
// ================================================== FIXING OLDER FIRMWARES
|
||||||
if (FWVERSION<215.068) // 2v15.68 and before had compass heading inverted.
|
if (FWVERSION<215.068) // 2v15.68 and before had compass heading inverted.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "boot",
|
"id": "boot",
|
||||||
"name": "Bootloader",
|
"name": "Bootloader",
|
||||||
"version": "0.58",
|
"version": "0.59",
|
||||||
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
|
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
|
||||||
"icon": "bootloader.png",
|
"icon": "bootloader.png",
|
||||||
"type": "bootloader",
|
"type": "bootloader",
|
||||||
|
|
|
||||||
|
|
@ -69,3 +69,4 @@ of 'Select Clock'
|
||||||
LCD calibration will now error if the calibration is obviously wrong
|
LCD calibration will now error if the calibration is obviously wrong
|
||||||
0.61: Permit temporary bypass of the BLE whitelist
|
0.61: Permit temporary bypass of the BLE whitelist
|
||||||
0.62: Fix whitelist showing as 'on' by default when it's not after 0.59
|
0.62: Fix whitelist showing as 'on' by default when it's not after 0.59
|
||||||
|
0.63: Whitelist: Try to resolve peer addresses using NRF.resolveAddress() - for 2v19 or 2v18 cutting edge builds
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "setting",
|
"id": "setting",
|
||||||
"name": "Settings",
|
"name": "Settings",
|
||||||
"version": "0.62",
|
"version": "0.63",
|
||||||
"description": "A menu for setting up Bangle.js",
|
"description": "A menu for setting up Bangle.js",
|
||||||
"icon": "settings.png",
|
"icon": "settings.png",
|
||||||
"tags": "tool,system",
|
"tags": "tool,system",
|
||||||
|
|
|
||||||
|
|
@ -383,6 +383,12 @@ function showWhitelistMenu() {
|
||||||
NRF.on('connect', function(addr) {
|
NRF.on('connect', function(addr) {
|
||||||
if (!settings.whitelist) settings.whitelist=[];
|
if (!settings.whitelist) settings.whitelist=[];
|
||||||
delete settings.whitelist_disabled;
|
delete settings.whitelist_disabled;
|
||||||
|
if (NRF.resolveAddress !== undefined) {
|
||||||
|
let resolvedAddr = NRF.resolveAddress(addr);
|
||||||
|
if (resolvedAddr !== undefined) {
|
||||||
|
addr = resolvedAddr + " (resolved)";
|
||||||
|
}
|
||||||
|
}
|
||||||
settings.whitelist.push(addr);
|
settings.whitelist.push(addr);
|
||||||
updateSettings();
|
updateSettings();
|
||||||
NRF.removeAllListeners('connect');
|
NRF.removeAllListeners('connect');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue