mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2026-08-31 03:47:59 +08:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa8d897590 | ||
|
|
f7fe587312 | ||
|
|
08d14f19e6 | ||
|
|
cfed757eab | ||
|
|
63defbb643 | ||
|
|
6e20fbe299 | ||
|
|
59090242f9 | ||
|
|
00e82f7e79 | ||
|
|
7b901b147b | ||
|
|
0f7fc98ab5 | ||
|
|
2a12174a7c | ||
|
|
caa76ee84b | ||
|
|
bc8893fedd | ||
|
|
d3e90f6fd3 | ||
|
|
a61b50b7a2 | ||
|
|
39fe4a4106 | ||
|
|
0d991c2655 | ||
|
|
0a307de9b9 | ||
|
|
4b8799ddd4 | ||
|
|
f02f85a2aa | ||
|
|
4948cbeac0 | ||
|
|
0fb2798424 |
@@ -1,6 +1,6 @@
|
|||||||
module.exports = CEconItem;
|
module.exports = CEconItem;
|
||||||
|
|
||||||
function CEconItem(item, description, contextID) {
|
function CEconItem(item, description, contextID, assetProperties) {
|
||||||
var thing;
|
var thing;
|
||||||
for (thing in item) {
|
for (thing in item) {
|
||||||
if (item.hasOwnProperty(thing)) {
|
if (item.hasOwnProperty(thing)) {
|
||||||
@@ -28,7 +28,7 @@ function CEconItem(item, description, contextID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (thing in description) {
|
for (thing in description) {
|
||||||
if (description.hasOwnProperty(thing)) {
|
if (description.hasOwnProperty(thing) && !this.hasOwnProperty(thing)) {
|
||||||
this[thing] = description[thing];
|
this[thing] = description[thing];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,10 +68,26 @@ function CEconItem(item, description, contextID) {
|
|||||||
|
|
||||||
// Restore cache_expiration, if we can (for CS:GO items)
|
// Restore cache_expiration, if we can (for CS:GO items)
|
||||||
if (this.appid == 730 && this.contextid == 2 && this.owner_descriptions) {
|
if (this.appid == 730 && this.contextid == 2 && this.owner_descriptions) {
|
||||||
let description = this.owner_descriptions.find(d => d.value && d.value.indexOf('Tradable/Marketable After ') == 0);
|
let description = this.owner_descriptions.find((d) => d.value && d.value.indexOf("Tradable/Marketable After ") == 0);
|
||||||
if (description) {
|
if (description) {
|
||||||
let date = new Date(description.value.substring(26).replace(/[,()]/g, ''));
|
let date;
|
||||||
if (date) {
|
const match = description.value.match(/(\d{1,2}) (\w+) @ (\d{1,2}:\d{2})(am|pm)/i);
|
||||||
|
if (match) {
|
||||||
|
// New day-first format, e.g. "Tradable/Marketable After 17 Jul @ 3:00am"
|
||||||
|
const [, day, month, time, meridian] = match;
|
||||||
|
const now = new Date();
|
||||||
|
let year = now.getFullYear();
|
||||||
|
date = new Date(`${day} ${month} ${year} ${time} ${meridian}`);
|
||||||
|
|
||||||
|
if (date.getTime() < now.getTime()) {
|
||||||
|
date = new Date(`${day} ${month} ${year + 1} ${time} ${meridian}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Legacy month-first format, e.g. "Tradable/Marketable After Jul 11, 2025 (2:00:00)"
|
||||||
|
date = new Date(description.value.substring("Tradable/Marketable After ".length).replace(/[,()]/g, ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (date && !isNaN(date.getTime())) {
|
||||||
this.cache_expiration = date.toISOString();
|
this.cache_expiration = date.toISOString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,6 +102,11 @@ function CEconItem(item, description, contextID) {
|
|||||||
this.actions = [];
|
this.actions = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assign asset_properties if provided
|
||||||
|
if (assetProperties) {
|
||||||
|
this.asset_properties = assetProperties;
|
||||||
|
}
|
||||||
|
|
||||||
// One wouldn't think that we need this if statement, but apparently v8 has a weird bug/quirk where deleting a
|
// One wouldn't think that we need this if statement, but apparently v8 has a weird bug/quirk where deleting a
|
||||||
// property results in greatly increased memory usage. Because that makes sense.
|
// property results in greatly increased memory usage. Because that makes sense.
|
||||||
if (this.currency) {
|
if (this.currency) {
|
||||||
|
|||||||
@@ -261,7 +261,10 @@ function request(community, url, key, time, tag, params, json, callback) {
|
|||||||
var req = {
|
var req = {
|
||||||
method: url == 'multiajaxop' ? 'POST' : 'GET',
|
method: url == 'multiajaxop' ? 'POST' : 'GET',
|
||||||
uri: 'https://steamcommunity.com/mobileconf/' + url,
|
uri: 'https://steamcommunity.com/mobileconf/' + url,
|
||||||
json: !!json
|
json: !!json,
|
||||||
|
headers: {
|
||||||
|
'user-agent': 'okhttp/4.9.2'
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (req.method == 'GET') {
|
if (req.method == 'GET') {
|
||||||
@@ -392,6 +395,22 @@ SteamCommunity.prototype.checkConfirmations = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SteamCommunity.prototype.acknowledgeTradeProtection = function(callback) {
|
||||||
|
this.httpRequestPost({
|
||||||
|
uri: 'https://steamcommunity.com//trade/new/acknowledge',
|
||||||
|
form: {
|
||||||
|
sessionid: this.getSessionID(),
|
||||||
|
message: 1
|
||||||
|
}
|
||||||
|
}, (err, res, body) => {
|
||||||
|
if (err) {
|
||||||
|
return callback && callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
callback && callback(null);
|
||||||
|
}, 'steamcommunity');
|
||||||
|
}
|
||||||
|
|
||||||
SteamCommunity.prototype._confirmationCheckerGetKey = function(tag, callback) {
|
SteamCommunity.prototype._confirmationCheckerGetKey = function(tag, callback) {
|
||||||
if(this._identitySecret) {
|
if(this._identitySecret) {
|
||||||
if(tag == 'details') {
|
if(tag == 'details') {
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ SteamCommunity.prototype._modernLogin = function(logOnDetails) {
|
|||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
session.on('timeout', () => {
|
||||||
|
reject(new Error('Login timed out'));
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let startResult = await session.startWithCredentials({
|
let startResult = await session.startWithCredentials({
|
||||||
accountName: logOnDetails.accountName,
|
accountName: logOnDetails.accountName,
|
||||||
|
|||||||
@@ -647,12 +647,21 @@ SteamCommunity.prototype.getUserInventoryContents = function(userID, appID, cont
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build asset_properties lookup by assetid
|
||||||
|
var assetPropertiesLookup = {};
|
||||||
|
if (body.asset_properties) {
|
||||||
|
for (var j = 0; j < body.asset_properties.length; j++) {
|
||||||
|
assetPropertiesLookup[body.asset_properties[j].assetid] = body.asset_properties[j].asset_properties;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < body.assets.length; i++) {
|
for (var i = 0; i < body.assets.length; i++) {
|
||||||
var description = getDescription(body.descriptions, body.assets[i].classid, body.assets[i].instanceid);
|
var description = getDescription(body.descriptions, body.assets[i].classid, body.assets[i].instanceid);
|
||||||
|
|
||||||
if (!tradableOnly || (description && description.tradable)) {
|
if (!tradableOnly || (description && description.tradable)) {
|
||||||
body.assets[i].pos = pos++;
|
body.assets[i].pos = pos++;
|
||||||
(body.assets[i].currencyid ? currency : inventory).push(new CEconItem(body.assets[i], description, contextID));
|
var assetProperties = assetPropertiesLookup[body.assets[i].assetid] || null;
|
||||||
|
(body.assets[i].currencyid ? currency : inventory).push(new CEconItem(body.assets[i], description, contextID, assetProperties));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "steamcommunity",
|
"name": "steamcommunity",
|
||||||
"version": "3.48.7",
|
"version": "3.50.3",
|
||||||
"description": "Provides an interface for logging into and interacting with the Steam Community website",
|
"description": "Provides an interface for logging into and interacting with the Steam Community website",
|
||||||
"files": [
|
"files": [
|
||||||
"/classes",
|
"/classes",
|
||||||
|
|||||||
Reference in New Issue
Block a user