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();
|
onFailure();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!api) {
|
|
||||||
api = new NvHTTP(host, myUniqueid);
|
api = new NvHTTP(host, myUniqueid);
|
||||||
}
|
api.refreshServerInfo().then(function (ret) {
|
||||||
|
|
||||||
if(api.paired) {
|
if(api.paired) {
|
||||||
onSuccess();
|
onSuccess();
|
||||||
}
|
}
|
||||||
@ -135,8 +133,8 @@ function pairTo(host, onSuccess, onFailure) {
|
|||||||
|
|
||||||
var cell = document.createElement('div');
|
var cell = document.createElement('div');
|
||||||
cell.className += 'mdl-cell mdl-cell--3-col';
|
cell.className += 'mdl-cell mdl-cell--3-col';
|
||||||
cell.id = 'hostgrid-' + hosts[i];
|
cell.id = 'hostgrid-' + host;
|
||||||
cell.innerHTML = hosts[i];
|
cell.innerHTML = host;
|
||||||
$('#host-grid').append(cell);
|
$('#host-grid').append(cell);
|
||||||
cell.onclick = hostChosen;
|
cell.onclick = hostChosen;
|
||||||
|
|
||||||
@ -148,6 +146,10 @@ function pairTo(host, onSuccess, onFailure) {
|
|||||||
console.log('pairing failed, and returned ' + failedPairing);
|
console.log('pairing failed, and returned ' + failedPairing);
|
||||||
onFailure();
|
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) {
|
function hostChosen(sourceEvent) {
|
||||||
@ -157,11 +159,7 @@ function hostChosen(sourceEvent) {
|
|||||||
host = sourceEvent.srcElement.innerText;
|
host = sourceEvent.srcElement.innerText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!api || api.address != host) {
|
|
||||||
api = new NvHTTP(host, myUniqueid);
|
api = new NvHTTP(host, myUniqueid);
|
||||||
}
|
|
||||||
|
|
||||||
api.refreshServerInfo().then(function (ret) {
|
api.refreshServerInfo().then(function (ret) {
|
||||||
if(!api.paired) {
|
if(!api.paired) {
|
||||||
pairTo(host);
|
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.
|
if(hosts.indexOf(host) < 0) { // we don't have this host in our list. add it, and save it.
|
||||||
var cell = document.createElement('div');
|
var cell = document.createElement('div');
|
||||||
cell.className += 'mdl-cell mdl-cell--3-col';
|
cell.className += 'mdl-cell mdl-cell--3-col';
|
||||||
cell.id = 'hostgrid-' + hosts[i];
|
cell.id = 'hostgrid-' + host;
|
||||||
cell.innerHTML = hosts[i];
|
cell.innerHTML = host;
|
||||||
$('#host-grid').append(cell);
|
$('#host-grid').append(cell);
|
||||||
cell.onclick = hostChosen;
|
cell.onclick = hostChosen;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user