re-added coercion to equality comparisons

This commit is contained in:
R. Aidan Campbell 2017-10-08 12:39:45 -07:00
parent ba66f5448d
commit 678d4d038f
2 changed files with 47 additions and 47 deletions

View File

@ -53,14 +53,14 @@ function loadWindowState() {
} }
function onFullscreened() { function onFullscreened() {
if (!isInGame && windowState === 'normal') { if (!isInGame && windowState == 'normal') {
storeData('windowState', 'fullscreen', null); storeData('windowState', 'fullscreen', null);
windowState = 'fullscreen'; windowState = 'fullscreen';
} }
} }
function onBoundsChanged() { function onBoundsChanged() {
if (!isInGame && windowState === 'fullscreen') { if (!isInGame && windowState == 'fullscreen') {
storeData('windowState', 'normal', null); storeData('windowState', 'normal', null);
windowState = 'normal'; windowState = 'normal';
} }
@ -105,7 +105,7 @@ function restoreUiAfterNaClLoad() {
return; return;
} }
if (hosts[returneMdnsDiscoveredHost.serverUid] !== null) { if (hosts[returneMdnsDiscoveredHost.serverUid] != null) {
// if we're seeing a host we've already seen before, update it for the current local IP. // if we're seeing a host we've already seen before, update it for the current local IP.
hosts[returneMdnsDiscoveredHost.serverUid].address = returneMdnsDiscoveredHost.address; hosts[returneMdnsDiscoveredHost.serverUid].address = returneMdnsDiscoveredHost.address;
} else { } else {
@ -255,7 +255,7 @@ function pairTo(nvhttpHost, onSuccess, onFailure) {
console.log('%c[index.js]', 'color: green;', 'Sending pairing request to ' + nvhttpHost.hostname + ' with random number' + randomNumber); console.log('%c[index.js]', 'color: green;', 'Sending pairing request to ' + nvhttpHost.hostname + ' with random number' + randomNumber);
nvhttpHost.pair(randomNumber).then(function (paired) { nvhttpHost.pair(randomNumber).then(function (paired) {
if (!paired) { if (!paired) {
if (nvhttpHost.currentGame !== 0) { if (nvhttpHost.currentGame != 0) {
$('#pairingDialogText').html('Error: ' + nvhttpHost.hostname + ' is busy. Stop streaming to pair.'); $('#pairingDialogText').html('Error: ' + nvhttpHost.hostname + ' is busy. Stop streaming to pair.');
} else { } else {
$('#pairingDialogText').html('Error: failed to pair with ' + nvhttpHost.hostname + '.'); $('#pairingDialogText').html('Error: failed to pair with ' + nvhttpHost.hostname + '.');
@ -322,7 +322,7 @@ function addHost() {
pairTo(_nvhttpHost, function () { pairTo(_nvhttpHost, function () {
// Check if we already have record of this host // Check if we already have record of this host
if (hosts[_nvhttpHost.serverUid] !== undefined) { if (hosts[_nvhttpHost.serverUid] != undefined) {
// Just update the addresses // Just update the addresses
hosts[_nvhttpHost.serverUid].address = _nvhttpHost.address; hosts[_nvhttpHost.serverUid].address = _nvhttpHost.address;
hosts[_nvhttpHost.serverUid].userEnteredAddress = _nvhttpHost.userEnteredAddress; hosts[_nvhttpHost.serverUid].userEnteredAddress = _nvhttpHost.userEnteredAddress;
@ -368,7 +368,7 @@ function addHostToGrid(host, ismDNSDiscovered) {
hostChosen(host); hostChosen(host);
}); });
outerDiv.keypress(function (e) { outerDiv.keypress(function (e) {
if (e.keyCode === 13) { if (e.keyCode == 13) {
hostChosen(host); hostChosen(host);
} }
}); });
@ -411,7 +411,7 @@ function removeClicked(host) {
// not do N*N stylizations of the box art, or make the code not flow very well // not do N*N stylizations of the box art, or make the code not flow very well
function stylizeBoxArt(freshApi, appIdToStylize) { function stylizeBoxArt(freshApi, appIdToStylize) {
let app_selector = $('#game-' + appIdToStylize); let app_selector = $('#game-' + appIdToStylize);
if (freshApi.currentGame === appIdToStylize) { // stylize the currently running game if (freshApi.currentGame == appIdToStylize) { // stylize the currently running game
// destylize it, if it has the not-current-game style // destylize it, if it has the not-current-game style
if (app_selector.hasClass("not-current-game")) $('#game-' + appIdToStylize).removeClass("not-current-game"); if (app_selector.hasClass("not-current-game")) $('#game-' + appIdToStylize).removeClass("not-current-game");
// add the current-game style // add the current-game style
@ -448,7 +448,7 @@ function showApps(host) {
appList.forEach(function (app) { appList.forEach(function (app) {
host.getBoxArt(app.id).then(function (resolvedPromise) { host.getBoxArt(app.id).then(function (resolvedPromise) {
// put the box art into the image holder // put the box art into the image holder
if ($('#game-' + app.id).length === 0) { if ($('#game-' + app.id).length == 0) {
// double clicking the button will cause multiple box arts to appear. // double clicking the button will cause multiple box arts to appear.
// to mitigate this we ensure we don't add a duplicate. // to mitigate this we ensure we don't add a duplicate.
// This isn't perfect: there's lots of RTTs before the logic prevents anything // This isn't perfect: there's lots of RTTs before the logic prevents anything
@ -476,7 +476,7 @@ function showApps(host) {
startGame(host, app.id); startGame(host, app.id);
}); });
$('#game-' + app.id).keypress(function (e) { $('#game-' + app.id).keypress(function (e) {
if (e.keyCode === 13) { if (e.keyCode == 13) {
startGame(host, app.id); startGame(host, app.id);
} }
}); });
@ -488,7 +488,7 @@ function showApps(host) {
}, function (failedPromise) { }, function (failedPromise) {
console.log('%c[index.js, showApps]', 'color: green;', 'Error! Failed to retrieve box art for app ID: ' + app.id + '. Returned value was: ' + failedPromise, '\n Host object:', host, host.toString()); console.log('%c[index.js, showApps]', 'color: green;', 'Error! Failed to retrieve box art for app ID: ' + app.id + '. Returned value was: ' + failedPromise, '\n Host object:', host, host.toString());
if ($('#game-' + app.id).length === 0) { if ($('#game-' + app.id).length == 0) {
// double clicking the button will cause multiple box arts to appear. // double clicking the button will cause multiple box arts to appear.
// to mitigate this we ensure we don't add a duplicate. // to mitigate this we ensure we don't add a duplicate.
// This isn't perfect: there's lots of RTTs before the logic prevents anything // This isn't perfect: there's lots of RTTs before the logic prevents anything
@ -571,7 +571,7 @@ function startGame(host, appID) {
host.refreshServerInfo().then(function (ret) { host.refreshServerInfo().then(function (ret) {
host.getAppById(appID).then(function (appToStart) { host.getAppById(appID).then(function (appToStart) {
if (host.currentGame !== 0 && host.currentGame !== appID) { if (host.currentGame != 0 && host.currentGame != appID) {
host.getAppById(host.currentGame).then(function (currentApp) { host.getAppById(host.currentGame).then(function (currentApp) {
let quitAppDialog = document.querySelector('#quitAppDialog'); let quitAppDialog = document.querySelector('#quitAppDialog');
document.getElementById('quitAppDialogText').innerHTML = document.getElementById('quitAppDialogText').innerHTML =
@ -612,7 +612,7 @@ function startGame(host, appID) {
$('#loadingMessage').text('Starting ' + appToStart.title + '...'); $('#loadingMessage').text('Starting ' + appToStart.title + '...');
playGameMode(); playGameMode();
if (host.currentGame === appID) { // if user wants to launch the already-running app, then we resume it. if (host.currentGame == appID) { // if user wants to launch the already-running app, then we resume it.
return host.resumeApp(rikey, rikeyid).then(function (ret) { return host.resumeApp(rikey, rikeyid).then(function (ret) {
sendMessage('startRequest', [host.address, streamWidth, streamHeight, frameRate, sendMessage('startRequest', [host.address, streamWidth, streamHeight, frameRate,
bitrate.toString(), rikey, rikeyid.toString(), host.appVersion]); bitrate.toString(), rikey, rikeyid.toString(), host.appVersion]);
@ -673,7 +673,7 @@ function fullscreenNaclModule() {
} }
function stopGameWithConfirmation() { function stopGameWithConfirmation() {
if (api.currentGame === 0) { if (api.currentGame == 0) {
snackbarLog('Nothing was running'); snackbarLog('Nothing was running');
} else { } else {
api.getAppById(api.currentGame).then(function (currentGame) { api.getAppById(api.currentGame).then(function (currentGame) {
@ -717,7 +717,7 @@ function stopGame(host, callbackFunction) {
host.refreshServerInfo().then(function (ret3) { // refresh to show no app is currently running. host.refreshServerInfo().then(function (ret3) { // refresh to show no app is currently running.
showAppsMode(); showAppsMode();
stylizeBoxArt(host, runningApp.id); stylizeBoxArt(host, runningApp.id);
if (typeof(callbackFunction) === "function") callbackFunction(); if (typeof(callbackFunction) == "function") callbackFunction();
}, function (failedRefreshInfo2) { }, function (failedRefreshInfo2) {
console.error('%c[index.js, stopGame]', 'color:green;', 'Failed to refresh server info! Returned error was:' + failedRefreshInfo + ' and failed server was:', host, host.toString()); console.error('%c[index.js, stopGame]', 'color:green;', 'Failed to refresh server info! Returned error was:' + failedRefreshInfo + ' and failed server was:', host, host.toString());
}); });
@ -793,20 +793,20 @@ function updateDefaultBitrate() {
let res = $('#selectResolution').data('value'); let res = $('#selectResolution').data('value');
let frameRate = $('#selectFramerate').data('value').toString(); let frameRate = $('#selectFramerate').data('value').toString();
if (res === "1920:1080") { if (res == "1920:1080") {
if (frameRate === "30") { // 1080p, 30fps if (frameRate == "30") { // 1080p, 30fps
$('#bitrateSlider')[0].MaterialSlider.change('10'); $('#bitrateSlider')[0].MaterialSlider.change('10');
} else { // 1080p, 60fps } else { // 1080p, 60fps
$('#bitrateSlider')[0].MaterialSlider.change('20'); $('#bitrateSlider')[0].MaterialSlider.change('20');
} }
} else if (res === "1280:720") { } else if (res == "1280:720") {
if (frameRate === "30") { // 720, 30fps if (frameRate == "30") { // 720, 30fps
$('#bitrateSlider')[0].MaterialSlider.change('5'); $('#bitrateSlider')[0].MaterialSlider.change('5');
} else { // 720, 60fps } else { // 720, 60fps
$('#bitrateSlider')[0].MaterialSlider.change('10'); $('#bitrateSlider')[0].MaterialSlider.change('10');
} }
} else if (res === "3840:2160") { } else if (res == "3840:2160") {
if (frameRate === "30") { // 2160p, 30fps if (frameRate == "30") { // 2160p, 30fps
$('#bitrateSlider')[0].MaterialSlider.change('40'); $('#bitrateSlider')[0].MaterialSlider.change('40');
} else { // 2160p, 60fps } else { // 2160p, 60fps
$('#bitrateSlider')[0].MaterialSlider.change('80'); $('#bitrateSlider')[0].MaterialSlider.change('80');
@ -829,9 +829,9 @@ function onWindowLoad() {
if (chrome.storage) { if (chrome.storage) {
// load stored resolution prefs // load stored resolution prefs
chrome.storage.sync.get('resolution', function (previousValue) { chrome.storage.sync.get('resolution', function (previousValue) {
if (previousValue.resolution !== null) { if (previousValue.resolution != null) {
$('.resolutionMenu li').each(function () { $('.resolutionMenu li').each(function () {
if ($(this).data('value') === previousValue.resolution) { if ($(this).data('value') == previousValue.resolution) {
$('#selectResolution').text($(this).text()).data('value', previousValue.resolution); $('#selectResolution').text($(this).text()).data('value', previousValue.resolution);
} }
}); });
@ -840,9 +840,9 @@ function onWindowLoad() {
// Load stored remote audio prefs // Load stored remote audio prefs
chrome.storage.sync.get('remoteAudio', function (previousValue) { chrome.storage.sync.get('remoteAudio', function (previousValue) {
if (previousValue.remoteAudio === null) { if (previousValue.remoteAudio == null) {
document.querySelector('#externalAudioBtn').MaterialIconToggle.uncheck(); document.querySelector('#externalAudioBtn').MaterialIconToggle.uncheck();
} else if (previousValue.remoteAudio === false) { } else if (previousValue.remoteAudio == false) {
document.querySelector('#externalAudioBtn').MaterialIconToggle.uncheck(); document.querySelector('#externalAudioBtn').MaterialIconToggle.uncheck();
} else { } else {
document.querySelector('#externalAudioBtn').MaterialIconToggle.check(); document.querySelector('#externalAudioBtn').MaterialIconToggle.check();
@ -851,9 +851,9 @@ function onWindowLoad() {
// load stored framerate prefs // load stored framerate prefs
chrome.storage.sync.get('frameRate', function (previousValue) { chrome.storage.sync.get('frameRate', function (previousValue) {
if (previousValue.frameRate !== null) { if (previousValue.frameRate != null) {
$('.framerateMenu li').each(function () { $('.framerateMenu li').each(function () {
if ($(this).data('value') === previousValue.frameRate) { if ($(this).data('value') == previousValue.frameRate) {
$('#selectFramerate').text($(this).text()).data('value', previousValue.frameRate); $('#selectFramerate').text($(this).text()).data('value', previousValue.frameRate);
} }
}); });
@ -862,9 +862,9 @@ function onWindowLoad() {
// load stored optimization prefs // load stored optimization prefs
chrome.storage.sync.get('optimize', function (previousValue) { chrome.storage.sync.get('optimize', function (previousValue) {
if (previousValue.optimize === null) { if (previousValue.optimize == null) {
document.querySelector('#optimizeGamesBtn').MaterialIconToggle.check(); document.querySelector('#optimizeGamesBtn').MaterialIconToggle.check();
} else if (previousValue.optimize === false) { } else if (previousValue.optimize == false) {
document.querySelector('#optimizeGamesBtn').MaterialIconToggle.uncheck(); document.querySelector('#optimizeGamesBtn').MaterialIconToggle.uncheck();
} else { } else {
document.querySelector('#optimizeGamesBtn').MaterialIconToggle.check(); document.querySelector('#optimizeGamesBtn').MaterialIconToggle.check();
@ -873,19 +873,19 @@ function onWindowLoad() {
// load stored bitrate prefs // load stored bitrate prefs
chrome.storage.sync.get('bitrate', function (previousValue) { chrome.storage.sync.get('bitrate', function (previousValue) {
$('#bitrateSlider')[0].MaterialSlider.change(previousValue.bitrate !== null ? previousValue.bitrate : '10'); $('#bitrateSlider')[0].MaterialSlider.change(previousValue.bitrate != null ? previousValue.bitrate : '10');
updateBitrateField(); updateBitrateField();
}); });
// load the HTTP cert if we have one. // load the HTTP cert if we have one.
chrome.storage.sync.get('cert', function (savedCert) { chrome.storage.sync.get('cert', function (savedCert) {
if (savedCert.cert !== null) { // we have a saved cert if (savedCert.cert != null) { // we have a saved cert
pairingCert = savedCert.cert; pairingCert = savedCert.cert;
} }
}); });
chrome.storage.sync.get('uniqueid', function (savedUniqueid) { chrome.storage.sync.get('uniqueid', function (savedUniqueid) {
if (savedUniqueid.uniqueid !== null) { // we have a saved uniqueid if (savedUniqueid.uniqueid != null) { // we have a saved uniqueid
myUniqueid = savedUniqueid.uniqueid; myUniqueid = savedUniqueid.uniqueid;
} else { } else {
myUniqueid = uniqueid(); myUniqueid = uniqueid();
@ -895,7 +895,7 @@ function onWindowLoad() {
// load previously connected hosts, which have been killed into an object, and revive them back into a class // load previously connected hosts, which have been killed into an object, and revive them back into a class
chrome.storage.sync.get('hosts', function (previousValue) { chrome.storage.sync.get('hosts', function (previousValue) {
hosts = previousValue.hosts !== null ? previousValue.hosts : {}; hosts = previousValue.hosts != null ? previousValue.hosts : {};
for (let hostUID in hosts) { // programmatically add each new host. for (let hostUID in hosts) { // programmatically add each new host.
let revivedHost = new NvHTTP(hosts[hostUID].address, myUniqueid, hosts[hostUID].userEnteredAddress); let revivedHost = new NvHTTP(hosts[hostUID].address, myUniqueid, hosts[hostUID].userEnteredAddress);
revivedHost.serverUid = hosts[hostUID].serverUid; revivedHost.serverUid = hosts[hostUID].serverUid;

View File

@ -1,6 +1,6 @@
function guuid() { function guuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
let r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8); let r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16); return v.toString(16);
}); });
} }
@ -117,7 +117,7 @@ NvHTTP.prototype = {
// Poll for the app list every 10 successful serverinfo polls. // Poll for the app list every 10 successful serverinfo polls.
// Not including the first one to avoid PCs taking a while to show // Not including the first one to avoid PCs taking a while to show
// as online initially // as online initially
if (this._pollCount++ % 10 === 1) { if (this._pollCount++ % 10 == 1) {
this.getAppListWithCacheFlush(); this.getAppListWithCacheFlush();
} }
@ -191,18 +191,18 @@ NvHTTP.prototype = {
$xml = this._parseXML(xmlStr); $xml = this._parseXML(xmlStr);
$root = $xml.find('root'); $root = $xml.find('root');
if ($root.attr("status_code") !== '200') { if ($root.attr("status_code") != '200') {
return false; return false;
} }
if (this.serverUid !== $root.find('uniqueid').text().trim() && this.serverUid !== "") { if (this.serverUid != $root.find('uniqueid').text().trim() && this.serverUid != "") {
// if we received a UID that isn't the one we expected, fail. // if we received a UID that isn't the one we expected, fail.
return false; return false;
} }
console.log('%c[utils.js, _parseServerInfo]', 'color:gray;', 'Parsing server info:', $root); console.log('%c[utils.js, _parseServerInfo]', 'color:gray;', 'Parsing server info:', $root);
this.paired = $root.find("PairStatus").text().trim() === '1'; this.paired = $root.find("PairStatus").text().trim() == '1';
this.currentGame = parseInt($root.find("currentgame").text().trim(), 10); this.currentGame = parseInt($root.find("currentgame").text().trim(), 10);
this.appVersion = $root.find("appversion").text().trim(); this.appVersion = $root.find("appversion").text().trim();
this.serverMajorVersion = parseInt(this.appVersion.substring(0, 1), 10); this.serverMajorVersion = parseInt(this.appVersion.substring(0, 1), 10);
@ -245,7 +245,7 @@ NvHTTP.prototype = {
let retApp = null; let retApp = null;
list.some(function (app) { list.some(function (app) {
if (app.id === appId) { if (app.id == appId) {
retApp = app; retApp = app;
return true; return true;
} }
@ -262,7 +262,7 @@ NvHTTP.prototype = {
$xml = this._parseXML(ret); $xml = this._parseXML(ret);
$root = $xml.find("root"); $root = $xml.find("root");
if ($root.attr("status_code") !== '200') { if ($root.attr("status_code") != '200') {
// TODO: Bubble up an error here // TODO: Bubble up an error here
console.error('%c[utils.js, utils.js, getAppListWithCacheFlush]', 'color: gray;', 'Applist request failed', $root.attr("status_code")); console.error('%c[utils.js, utils.js, getAppListWithCacheFlush]', 'color: gray;', 'Applist request failed', $root.attr("status_code"));
return []; return [];
@ -303,7 +303,7 @@ NvHTTP.prototype = {
console.log('%c[utils.js, warmBoxArtCache]', 'color: grey;', 'Not warming box art cache for unpaired host'); console.log('%c[utils.js, warmBoxArtCache]', 'color: grey;', 'Not warming box art cache for unpaired host');
return; return;
} }
if (Object.keys(this._memCachedBoxArtArray).length !== 0) { if (Object.keys(this._memCachedBoxArtArray).length != 0) {
console.log('%c[utils.js, warmBoxArtCache]', 'color: grey;', 'Box art cache already warmed'); console.log('%c[utils.js, warmBoxArtCache]', 'color: grey;', 'Box art cache already warmed');
return; return;
} }
@ -311,7 +311,7 @@ NvHTTP.prototype = {
chrome.storage.local.get('boxArtCache', function (JSONCachedBoxArtArray) { chrome.storage.local.get('boxArtCache', function (JSONCachedBoxArtArray) {
let storedBoxArtArray; // load cached data if it exists let storedBoxArtArray; // load cached data if it exists
if (JSONCachedBoxArtArray.boxArtCache !== undefined) { if (JSONCachedBoxArtArray.boxArtCache != undefined) {
storedBoxArtArray = JSONCachedBoxArtArray.boxArtCache; storedBoxArtArray = JSONCachedBoxArtArray.boxArtCache;
for (let key in storedBoxArtArray) { for (let key in storedBoxArtArray) {
this._memCachedBoxArtArray[key] = _base64ToArrayBuffer(storedBoxArtArray[key]); this._memCachedBoxArtArray[key] = _base64ToArrayBuffer(storedBoxArtArray[key]);
@ -330,13 +330,13 @@ NvHTTP.prototype = {
// TODO: unfortunately we do N lookups from storage cache, each of them filling up the memory cache. // TODO: unfortunately we do N lookups from storage cache, each of them filling up the memory cache.
// once the first round of calls are all made, each subsequent request hits this and returns from memory cache // once the first round of calls are all made, each subsequent request hits this and returns from memory cache
if (this._memCachedBoxArtArray[appId] === null) { if (this._memCachedBoxArtArray[appId] == null) {
// This means a previous box art request failed, don't try again // This means a previous box art request failed, don't try again
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
console.error('%c[utils.js, utils.js, getBoxArt]', 'color: gray;', 'Returning cached box-art failure result'); console.error('%c[utils.js, utils.js, getBoxArt]', 'color: gray;', 'Returning cached box-art failure result');
reject(null); reject(null);
}.bind(this)); }.bind(this));
} else if (this._memCachedBoxArtArray[appId] !== undefined) { } else if (this._memCachedBoxArtArray[appId] != undefined) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
console.log('%c[utils.js, utils.js, getBoxArt]', 'color: gray;', 'Returning memory-cached box-art'); console.log('%c[utils.js, utils.js, getBoxArt]', 'color: gray;', 'Returning memory-cached box-art');
resolve(this._memCachedBoxArtArray[appId]); resolve(this._memCachedBoxArtArray[appId]);
@ -350,7 +350,7 @@ NvHTTP.prototype = {
chrome.storage.local.get('boxArtCache', function (JSONCachedBoxArtArray) { chrome.storage.local.get('boxArtCache', function (JSONCachedBoxArtArray) {
let storedBoxArtArray; // load cached data if it exists let storedBoxArtArray; // load cached data if it exists
if (JSONCachedBoxArtArray.boxArtCache !== undefined && JSONCachedBoxArtArray.boxArtCache[appId] !== undefined) { if (JSONCachedBoxArtArray.boxArtCache != undefined && JSONCachedBoxArtArray.boxArtCache[appId] != undefined) {
storedBoxArtArray = JSONCachedBoxArtArray.boxArtCache; storedBoxArtArray = JSONCachedBoxArtArray.boxArtCache;
storedBoxArtArray[appId] = _base64ToArrayBuffer(storedBoxArtArray[appId]); storedBoxArtArray[appId] = _base64ToArrayBuffer(storedBoxArtArray[appId]);
@ -361,7 +361,7 @@ NvHTTP.prototype = {
} }
// if we already have it, load it. // if we already have it, load it.
if (storedBoxArtArray[appId] !== undefined && Object.keys(storedBoxArtArray).length !== 0 && storedBoxArtArray[appId].constructor !== Object) { if (storedBoxArtArray[appId] != undefined && Object.keys(storedBoxArtArray).length != 0 && storedBoxArtArray[appId].constructor != Object) {
console.log('%c[utils.js, getBoxArt]', 'color: gray;', 'Returning strage-cached box art for app: ', appId); console.log('%c[utils.js, getBoxArt]', 'color: gray;', 'Returning strage-cached box art for app: ', appId);
resolve(storedBoxArtArray[appId]); resolve(storedBoxArtArray[appId]);
return; return;
@ -452,13 +452,13 @@ NvHTTP.prototype = {
if (this.paired) if (this.paired)
return true; return true;
if (this.currentGame !== 0) if (this.currentGame != 0)
return false; return false;
return sendMessage('pair', [this.serverMajorVersion.toString(), this.address, randomNumber]).then(function (pairStatus) { return sendMessage('pair', [this.serverMajorVersion.toString(), this.address, randomNumber]).then(function (pairStatus) {
return sendMessage('openUrl', [this._baseUrlHttps + '/pair?uniqueid=' + this.clientUid + '&devicename=roth&updateState=1&phrase=pairchallenge', false]).then(function (ret) { return sendMessage('openUrl', [this._baseUrlHttps + '/pair?uniqueid=' + this.clientUid + '&devicename=roth&updateState=1&phrase=pairchallenge', false]).then(function (ret) {
$xml = this._parseXML(ret); $xml = this._parseXML(ret);
this.paired = $xml.find('paired').html() === "1"; this.paired = $xml.find('paired').html() == "1";
return this.paired; return this.paired;
}.bind(this)); }.bind(this));
}.bind(this)); }.bind(this));