mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2024-12-28 23:50:17 +08:00
Restore cache_expiration from game-specific data for backwards compatibility
(Fixes #229)
This commit is contained in:
parent
4d4df7c2a5
commit
21c4ba3e27
@ -66,6 +66,22 @@ function CEconItem(item, description, contextID) {
|
||||
this.market_fee_app = parseInt(match[1], 10);
|
||||
}
|
||||
|
||||
// Restore cache_expiration, if we can (for CS:GO items)
|
||||
if (this.appid == 730 && this.contextid == 2 && this.owner_descriptions) {
|
||||
let description = this.owner_descriptions.find(d => d.value && d.value.indexOf('Tradable After ') == 0);
|
||||
if (description) {
|
||||
let date = new Date(description.value.substring(15).replace(/[,()]/g, ''));
|
||||
if (date) {
|
||||
this.cache_expiration = date.toISOString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we have item_expiration, also set cache_expiration to the same value
|
||||
if (this.item_expiration) {
|
||||
this.cache_expiration = this.item_expiration;
|
||||
}
|
||||
|
||||
if (this.actions === "") {
|
||||
this.actions = [];
|
||||
}
|
||||
|
@ -397,6 +397,11 @@ SteamCommunity.prototype.getUserInventory = function(userID, appID, contextID, t
|
||||
* @param {function} callback
|
||||
*/
|
||||
SteamCommunity.prototype.getUserInventoryContents = function(userID, appID, contextID, tradableOnly, language, callback) {
|
||||
if (typeof language === 'function') {
|
||||
callback = language;
|
||||
language = "english";
|
||||
}
|
||||
|
||||
if (!userID) {
|
||||
callback(new Error("The user's SteamID is invalid or missing."));
|
||||
return;
|
||||
@ -408,11 +413,6 @@ SteamCommunity.prototype.getUserInventoryContents = function(userID, appID, cont
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
if (typeof language === 'function') {
|
||||
callback = language;
|
||||
language = "english";
|
||||
}
|
||||
|
||||
var pos = 1;
|
||||
get([], []);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user