From c7bc7e0801ec2e51e434d9805b8fe09184634ac7 Mon Sep 17 00:00:00 2001 From: Eng-Shien Wu Date: Mon, 29 Jan 2024 11:43:00 -0800 Subject: [PATCH 1/2] Update cheerio and request npms to fix npm audit warnings --- classes/CSteamUser.js | 2 +- components/helpers.js | 2 +- components/inventoryhistory.js | 3 +-- index.js | 2 +- package.json | 4 ++-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/classes/CSteamUser.js b/classes/CSteamUser.js index 8b26516..af0a5d3 100644 --- a/classes/CSteamUser.js +++ b/classes/CSteamUser.js @@ -13,7 +13,7 @@ SteamCommunity.prototype.getSteamUser = function(id, callback) { } var self = this; - this.httpRequest("http://steamcommunity.com/" + (typeof id === 'string' ? "id/" + id : "profiles/" + id.toString()) + "/?xml=1", function(err, response, body) { + this.httpRequest("https://steamcommunity.com/" + (typeof id === 'string' ? "id/" + id : "profiles/" + id.toString()) + "/?xml=1", function(err, response, body) { if (err) { callback(err); return; diff --git a/components/helpers.js b/components/helpers.js index d56b4f3..7cf9a62 100644 --- a/components/helpers.js +++ b/components/helpers.js @@ -1,4 +1,4 @@ -const request = require('request'); +const request = require('@cypress/request'); const SteamID = require('steamid'); const xml2js = require('xml2js'); diff --git a/components/inventoryhistory.js b/components/inventoryhistory.js index 961d9c1..5c859a8 100644 --- a/components/inventoryhistory.js +++ b/components/inventoryhistory.js @@ -2,7 +2,6 @@ var SteamCommunity = require('../index.js'); var CEconItem = require('../classes/CEconItem.js'); var Helpers = require('./helpers.js'); var SteamID = require('steamid'); -var request = require('request'); var Cheerio = require('cheerio'); var Async = require('async'); @@ -24,7 +23,7 @@ SteamCommunity.prototype.getInventoryHistory = function(options, callback) { callback = options; options = {}; } - + options.direction = options.direction || "past"; var qs = "?l=english"; diff --git a/index.js b/index.js index 0705913..e5404a4 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ const {chrome} = require('@doctormckay/user-agents'); -const Request = require('request'); +const Request = require('@cypress/request'); const SteamID = require('steamid'); const Helpers = require('./components/helpers.js'); diff --git a/package.json b/package.json index 178d650..7c7cb82 100644 --- a/package.json +++ b/package.json @@ -30,9 +30,9 @@ "dependencies": { "@doctormckay/user-agents": "^1.0.0", "async": "^2.6.3", - "cheerio": "0.22.0", + "cheerio": "1.0.0-rc.12", "image-size": "^0.8.2", - "request": "^2.88.0", + "@cypress/request": "^3.0.1", "steam-session": "^1.7.2", "steam-totp": "^1.5.0", "steamid": "^1.1.3", From a2a2f87ba61fd25462e9cb935005ce908b010fcc Mon Sep 17 00:00:00 2001 From: Eng-Shien Wu Date: Mon, 29 Jan 2024 11:47:52 -0800 Subject: [PATCH 2/2] Export CSteamUser so can promisify --- classes/CSteamUser.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/classes/CSteamUser.js b/classes/CSteamUser.js index af0a5d3..24c7cf6 100644 --- a/classes/CSteamUser.js +++ b/classes/CSteamUser.js @@ -223,3 +223,5 @@ CSteamUser.prototype.getProfileBackground = function(callback) { CSteamUser.prototype.sendImage = function(imageContentsBuffer, options, callback) { this._community.sendImageToUser(this.steamID, imageContentsBuffer, options, callback); }; + +module.exports = CSteamUser;