mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2026-09-06 15:24:51 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa8d897590 | ||
|
|
f7fe587312 | ||
|
|
08d14f19e6 | ||
|
|
cfed757eab | ||
|
|
63defbb643 | ||
|
|
6e20fbe299 | ||
|
|
59090242f9 |
@@ -70,19 +70,24 @@ function CEconItem(item, description, contextID, assetProperties) {
|
|||||||
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;
|
||||||
const match = description.value.match(/(\d{1,2}) (\w+) @ (\d{1,2}:\d{2})(am|pm)/i);
|
const match = description.value.match(/(\d{1,2}) (\w+) @ (\d{1,2}:\d{2})(am|pm)/i);
|
||||||
const [, day, month, time, meridian] = match;
|
if (match) {
|
||||||
const now = new Date();
|
// New day-first format, e.g. "Tradable/Marketable After 17 Jul @ 3:00am"
|
||||||
let year = now.getFullYear();
|
const [, day, month, time, meridian] = match;
|
||||||
let date = new Date(`${day} ${month} ${year} ${time} ${meridian}`);
|
const now = new Date();
|
||||||
|
let year = now.getFullYear();
|
||||||
|
date = new Date(`${day} ${month} ${year} ${time} ${meridian}`);
|
||||||
|
|
||||||
if (date.getTime() < now.getTime()) {
|
if (date.getTime() < now.getTime()) {
|
||||||
date = new Date(
|
date = new Date(`${day} ${month} ${year + 1} ${time} ${meridian}`);
|
||||||
`${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) {
|
if (date && !isNaN(date.getTime())) {
|
||||||
this.cache_expiration = date.toISOString();
|
this.cache_expiration = date.toISOString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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') {
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "steamcommunity",
|
"name": "steamcommunity",
|
||||||
"version": "3.50.1",
|
"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