mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 16:46:31 +00:00
Now with a pretty client side dialog for pairing
This commit is contained in:
parent
fe50bfce25
commit
94cfe26a10
13
index.html
13
index.html
@ -86,5 +86,18 @@
|
||||
<script type="text/javascript" src="static/js/common.js"></script>
|
||||
<script type="text/javascript" src="static/js/index.js"></script>
|
||||
<script type="text/javascript" src="static/js/utils.js"></script>
|
||||
|
||||
<dialog id="pairingDialog" class="mdl-dialog">
|
||||
<h3 class="mdl-dialog__title">Pairing</h3>
|
||||
<div class="mdl-dialog__content">
|
||||
<p id="pairingDialogText">
|
||||
Please enter the number XXXX on the GFE dialog on the computer. This dialog will be dismissed once complete
|
||||
</p>
|
||||
</div>
|
||||
<div class="mdl-dialog__actions">
|
||||
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" id="CancelPairingDialog">Cancel</button>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -4,6 +4,21 @@
|
||||
.mdl-button {
|
||||
color: #fff !important;
|
||||
}
|
||||
.mdl-dialog {
|
||||
border: none;
|
||||
box-shadow: 0 9px 46px 8px rgba(0, 0, 0, 0.14), 0 11px 15px -7px rgba(0, 0, 0, 0.12), 0 24px 38px 3px rgba(0, 0, 0, 0.2);
|
||||
width: 280px;
|
||||
}
|
||||
.mdl-dialog__title {
|
||||
padding: 24px 24px 0;
|
||||
margin: 0;
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
.mdl-dialog__content {
|
||||
padding: 20px 24px 24px 24px;
|
||||
color: rgba(0,0,0, 0.54);
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 50px 100px;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ function attachListeners() {
|
||||
$('#selectFramerate').on('change', saveFramerate);
|
||||
$('#bitrateSlider').on('input', updateBitrateField); // input occurs every notch you slide
|
||||
$('#bitrateSlider').on('change', saveBitrate); // change occurs once the mouse lets go.
|
||||
|
||||
$(window).resize(fullscreenNaclModule);
|
||||
}
|
||||
|
||||
@ -54,6 +55,7 @@ function pairPushed() {
|
||||
console.log("User wants to pair, and we still have no cert. Problem = very yes.")
|
||||
return;
|
||||
}
|
||||
$('#pairButton')[0].innerHTML = 'Pairing...';
|
||||
target = $('#GFEHostIPField')[0].value;
|
||||
if (target == null || target == "") {
|
||||
var e = $("#selectHost")[0];
|
||||
@ -62,8 +64,21 @@ function pairPushed() {
|
||||
console.log("Attempting to pair to: " + target);
|
||||
sendMessage('httpInit', [pairingCert.cert, pairingCert.privateKey, myUniqueid]).then(function (ret) {
|
||||
console.log('httpInit function completed. it returned: ' + ret);
|
||||
var pairingDialog = document.querySelector('#pairingDialog');
|
||||
document.getElementById('pairingDialogText').innerHTML =
|
||||
'Please enter the number 1233 on the GFE dialog on the computer. This dialog will be dismissed once complete';
|
||||
pairingDialog.showModal();
|
||||
pairingDialog.querySelector('#CancelPairingDialog').addEventListener('click', function() {
|
||||
pairingDialog.close();
|
||||
});
|
||||
sendMessage('pair', [target, "1233"]).then(function (ret2) {
|
||||
console.log("pair attempt to to " + target + " has returned.");
|
||||
if (ret2 === 0) {
|
||||
$('#pairButton')[0].innerHTML = 'Paired';
|
||||
pairingDialog.close();
|
||||
} else {
|
||||
$('#pairButton')[0].innerHTML = 'Pairing Failed';
|
||||
document.getElementById('pairingDialogText').innerHTML = 'Error: Pairing failed with code: ' + ret2;
|
||||
}
|
||||
console.log("pairing attempt returned: " + ret2);
|
||||
})
|
||||
});
|
||||
|
@ -88,7 +88,9 @@ NvHTTP.prototype = {
|
||||
},
|
||||
|
||||
getAppList: function () {
|
||||
console.log('Requested app list');
|
||||
return sendMessage('openUrl', [_self._baseUrlHttps+'/applist?'+_self._buildUidStr()]).then(function (ret) {
|
||||
console.log('App list request returned with: ' + ret);
|
||||
$xml = _self._parseXML(ret);
|
||||
|
||||
var rootElement = $xml.find("root")[0];
|
||||
@ -103,6 +105,7 @@ NvHTTP.prototype = {
|
||||
});
|
||||
}
|
||||
|
||||
console.log('Returning app list: ' + appList);
|
||||
return appList;
|
||||
});
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user