From ac222ef8c3f5aa2cdf03af9f2b9456ca355c00a2 Mon Sep 17 00:00:00 2001 From: Alex Corn Date: Wed, 12 Feb 2025 03:04:45 -0500 Subject: [PATCH 1/9] Add origin header to all non-GET requests --- components/http.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/http.js b/components/http.js index 5be5a46..9bf8483 100644 --- a/components/http.js +++ b/components/http.js @@ -1,3 +1,5 @@ +var URL = require('url'); + var SteamCommunity = require('../index.js'); SteamCommunity.prototype.httpRequest = function(uri, options, callback, source) { @@ -19,6 +21,16 @@ SteamCommunity.prototype.httpRequest = function(uri, options, callback, source) delete this._httpRequestConvenienceMethod; } + // Add origin header if necessary + // https://github.com/DoctorMcKay/node-steamcommunity/issues/351 + if ((options.method || 'GET').toUpperCase() != 'GET') { + options.headers = options.headers || {}; + if (!options.headers.origin) { + var parsedUrl = URL.parse(options.url); + options.headers.origin = parsedUrl.protocol + '//' + parsedUrl.host; + } + } + var requestID = ++this._httpRequestID; source = source || ""; From 2868b1f45f7cd1ff62611eef758a415d05674495 Mon Sep 17 00:00:00 2001 From: Alex Corn Date: Wed, 12 Feb 2025 03:05:07 -0500 Subject: [PATCH 2/9] Fixed malformed sessionid returned in login callback --- components/login.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/login.js b/components/login.js index d54df1a..6eceded 100644 --- a/components/login.js +++ b/components/login.js @@ -54,7 +54,7 @@ SteamCommunity.prototype._modernLogin = function(logOnDetails) { let webCookies = await session.getWebCookies(); let sessionIdCookie = webCookies.find(c => c.startsWith('sessionid=')); resolve({ - sessionID: sessionIdCookie.split('=')[1], + sessionID: sessionIdCookie.split('=')[1].split(';')[0].trim(), cookies: webCookies, steamguard: session.steamGuardMachineToken, mobileAccessToken: logOnDetails.disableMobile ? null : session.accessToken From 2f03e09f5045a181f1170b3d4028f6f66f6a9915 Mon Sep 17 00:00:00 2001 From: Alex Corn Date: Wed, 12 Feb 2025 03:05:15 -0500 Subject: [PATCH 3/9] Require steam-session 1.9.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eb6d680..90509eb 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "cheerio": "0.22.0", "image-size": "^0.8.2", "request": "^2.88.0", - "steam-session": "^1.7.2", + "steam-session": "^1.9.1", "steam-totp": "^1.5.0", "steamid": "^1.1.3", "xml2js": "^0.6.2" From 67774f86f767fe21dea03f502bd94fea821b0bc2 Mon Sep 17 00:00:00 2001 From: Alex Corn Date: Wed, 12 Feb 2025 03:15:54 -0500 Subject: [PATCH 4/9] Handle "empty" CS2 inventories that aren't actually empty --- components/users.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/users.js b/components/users.js index 80e4bec..c468452 100644 --- a/components/users.js +++ b/components/users.js @@ -629,6 +629,13 @@ SteamCommunity.prototype.getUserInventoryContents = function(userID, appID, cont return; } + if (appID == 730 && body && body.success && !body.assets) { + // CS inventory has no visible items. We need a special case for this because Valve is incapable of + // doing anything not dumb. + callback(null, [], [], body.total_inventory_count); + return; + } + if (!body || !body.success || !body.assets || !body.descriptions) { if (body) { // Dunno if the error/Error property even exists on this new endpoint From c52533ea06f33b1a4a6f6cfba9ac8c699aea1507 Mon Sep 17 00:00:00 2001 From: Alex Corn Date: Wed, 12 Feb 2025 03:16:04 -0500 Subject: [PATCH 5/9] 3.48.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 90509eb..049e3ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "steamcommunity", - "version": "3.48.4", + "version": "3.48.6", "description": "Provides an interface for logging into and interacting with the Steam Community website", "files": [ "/classes", From ee0cc34512592cb724dda7818a64f20162854b0e Mon Sep 17 00:00:00 2001 From: metzz <54819594+metzz1@users.noreply.github.com> Date: Wed, 28 May 2025 03:08:12 +0300 Subject: [PATCH 6/9] fix: steam now only accepts 1000 < --- components/users.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/users.js b/components/users.js index c468452..c3146a5 100644 --- a/components/users.js +++ b/components/users.js @@ -590,7 +590,7 @@ SteamCommunity.prototype.getUserInventoryContents = function(userID, appID, cont }, "qs": { "l": language, // Default language - "count": 5000, // Max items per 'page' + "count": 1000, // Max items per 'page' "start_assetid": start }, "json": true From c0b8dcf3a272c7bcef317896673fba4355dbc841 Mon Sep 17 00:00:00 2001 From: Alex Corn Date: Tue, 27 May 2025 20:27:10 -0400 Subject: [PATCH 7/9] 3.48.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 049e3ff..41a0ade 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "steamcommunity", - "version": "3.48.6", + "version": "3.48.7", "description": "Provides an interface for logging into and interacting with the Steam Community website", "files": [ "/classes", From 0a307de9b9481b4363c1d9f47297481ddb10a8ae Mon Sep 17 00:00:00 2001 From: Alex Corn Date: Wed, 28 May 2025 05:23:25 -0400 Subject: [PATCH 8/9] Prevent descriptions overwriting base econ item properties --- classes/CEconItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/CEconItem.js b/classes/CEconItem.js index ef9af41..93a852a 100644 --- a/classes/CEconItem.js +++ b/classes/CEconItem.js @@ -28,7 +28,7 @@ function CEconItem(item, description, contextID) { } for (thing in description) { - if (description.hasOwnProperty(thing)) { + if (description.hasOwnProperty(thing) && !this.hasOwnProperty(thing)) { this[thing] = description[thing]; } } From 0d991c265549a1b2bf3e09d248321f36917599a0 Mon Sep 17 00:00:00 2001 From: Alex Corn Date: Wed, 28 May 2025 05:23:39 -0400 Subject: [PATCH 9/9] 3.48.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 41a0ade..1e343f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "steamcommunity", - "version": "3.48.7", + "version": "3.48.8", "description": "Provides an interface for logging into and interacting with the Steam Community website", "files": [ "/classes",