mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 16:46:31 +00:00
Fix adding a PC that has already been paired
This commit is contained in:
parent
2167a8d94d
commit
fd3d19ca03
@ -106,10 +106,8 @@ function pairTo(host, onSuccess, onFailure) {
|
||||
onFailure();
|
||||
}
|
||||
|
||||
if(!api) {
|
||||
api = new NvHTTP(host, myUniqueid);
|
||||
}
|
||||
|
||||
api.refreshServerInfo().then(function (ret) {
|
||||
if(api.paired) {
|
||||
onSuccess();
|
||||
}
|
||||
@ -135,8 +133,8 @@ function pairTo(host, onSuccess, onFailure) {
|
||||
|
||||
var cell = document.createElement('div');
|
||||
cell.className += 'mdl-cell mdl-cell--3-col';
|
||||
cell.id = 'hostgrid-' + hosts[i];
|
||||
cell.innerHTML = hosts[i];
|
||||
cell.id = 'hostgrid-' + host;
|
||||
cell.innerHTML = host;
|
||||
$('#host-grid').append(cell);
|
||||
cell.onclick = hostChosen;
|
||||
|
||||
@ -148,6 +146,10 @@ function pairTo(host, onSuccess, onFailure) {
|
||||
console.log('pairing failed, and returned ' + failedPairing);
|
||||
onFailure();
|
||||
});
|
||||
}, function (failedRefreshInfo) {
|
||||
snackbarLog('Failed to connect to ' + host + '! Are you sure the host is on?');
|
||||
console.log('Returned error was: ' + failedRefreshInfo);
|
||||
});
|
||||
}
|
||||
|
||||
function hostChosen(sourceEvent) {
|
||||
@ -157,11 +159,7 @@ function hostChosen(sourceEvent) {
|
||||
host = sourceEvent.srcElement.innerText;
|
||||
}
|
||||
|
||||
|
||||
if(!api || api.address != host) {
|
||||
api = new NvHTTP(host, myUniqueid);
|
||||
}
|
||||
|
||||
api.refreshServerInfo().then(function (ret) {
|
||||
if(!api.paired) {
|
||||
pairTo(host);
|
||||
@ -169,8 +167,8 @@ function hostChosen(sourceEvent) {
|
||||
if(hosts.indexOf(host) < 0) { // we don't have this host in our list. add it, and save it.
|
||||
var cell = document.createElement('div');
|
||||
cell.className += 'mdl-cell mdl-cell--3-col';
|
||||
cell.id = 'hostgrid-' + hosts[i];
|
||||
cell.innerHTML = hosts[i];
|
||||
cell.id = 'hostgrid-' + host;
|
||||
cell.innerHTML = host;
|
||||
$('#host-grid').append(cell);
|
||||
cell.onclick = hostChosen;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user