From 265c711da5297c6c24ca0006831ed1a3edb551fe Mon Sep 17 00:00:00 2001 From: "R. Aidan Campbell" Date: Fri, 11 Mar 2016 09:40:42 -0500 Subject: [PATCH] re-added host saving. Looks like it was lost in nacl-pairing --- static/js/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/static/js/index.js b/static/js/index.js index 8d5bef2..3c6ee8f 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -73,9 +73,20 @@ function pairPushed() { pairingDialog.close(); }); sendMessage('pair', [target, randomNumber]).then(function (ret2) { - if (ret2 === 0) { + if (ret2 === 0) { // pairing was successful. save this host. $('#pairButton')[0].innerHTML = 'Paired'; pairingDialog.close(); + var hostSelect = $('#selectHost')[0]; + for(var i = 0; i < hostSelect.length; i++) { + if (hostSelect.options[i].value == target) return; + } + + var opt = document.createElement('option'); + opt.appendChild(document.createTextNode(target)); + opt.value = target; + $('#selectHost')[0].appendChild(opt); + hosts.push(target); + saveHosts(); } else { $('#pairButton')[0].innerHTML = 'Pairing Failed'; document.getElementById('pairingDialogText').innerHTML = 'Error: Pairing failed with code: ' + ret2;