mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 16:46:31 +00:00
Gracefully handle case where no box art can be fetched
This commit is contained in:
parent
497b450054
commit
a69b475244
@ -425,6 +425,19 @@ function showApps(host) {
|
|||||||
console.log('Error! Failed to retrieve box art for app ID: ' + app.id + '. Returned value was: ' + failedPromise)
|
console.log('Error! Failed to retrieve box art for app ID: ' + app.id + '. Returned value was: ' + failedPromise)
|
||||||
console.log('failed host object: ');
|
console.log('failed host object: ');
|
||||||
console.log(host.toString());
|
console.log(host.toString());
|
||||||
|
|
||||||
|
if ($('#game-' + app.id).length === 0) {
|
||||||
|
// double clicking the button will cause multiple box arts to appear.
|
||||||
|
// 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
|
||||||
|
$("#game-grid").append($("<div>", {html:$("<img \>", {src: "static/res/no_app_image.png", id: 'game-'+app.id, name: app.title }), class: 'box-art mdl-cell mdl-cell--3-col'}).append($("<span>", {html: app.title, class:"game-title"})));
|
||||||
|
$('#game-'+app.id).on('click', function () {
|
||||||
|
startGame(host, app.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
// apply CSS stylization to indicate whether the app is active
|
||||||
|
stylizeBoxArt(host, app.id);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, function (failedAppList) {
|
}, function (failedAppList) {
|
||||||
|
@ -338,7 +338,14 @@ 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] !== undefined) {
|
if (this._memCachedBoxArtArray[appId] === null) {
|
||||||
|
// This means a previous box art request failed, don't try again
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
console.log('returning cached box art failure result');
|
||||||
|
reject(null);
|
||||||
|
return;
|
||||||
|
}.bind(this));
|
||||||
|
} else if (this._memCachedBoxArtArray[appId] !== undefined) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
console.log('returning memory cached box art');
|
console.log('returning memory cached box art');
|
||||||
resolve(this._memCachedBoxArtArray[appId]);
|
resolve(this._memCachedBoxArtArray[appId]);
|
||||||
@ -392,9 +399,13 @@ NvHTTP.prototype = {
|
|||||||
console.log('returning streamed box art');
|
console.log('returning streamed box art');
|
||||||
resolve(streamedBoxArt);
|
resolve(streamedBoxArt);
|
||||||
return;
|
return;
|
||||||
|
}.bind(this), function(error) {
|
||||||
|
// Cache the failure but not persistently
|
||||||
|
this._memCachedBoxArtArray[appId] = null;
|
||||||
|
console.log('box art request failed');
|
||||||
|
reject(error);
|
||||||
|
return;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
BIN
static/res/no_app_image.png
Executable file
BIN
static/res/no_app_image.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Loading…
x
Reference in New Issue
Block a user