re-added host saving. Looks like it was lost in nacl-pairing

This commit is contained in:
R. Aidan Campbell 2016-03-11 09:40:42 -05:00
parent 255ab97677
commit 265c711da5

View File

@ -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;