steamcommunity 3.45.1 → 3.45.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,23 +1,22 @@
1
- # Steam Community for Node.js
2
- [![npm version](https://img.shields.io/npm/v/steamcommunity.svg)](https://npmjs.com/package/steamcommunity)
3
- [![npm downloads](https://img.shields.io/npm/dm/steamcommunity.svg)](https://npmjs.com/package/steamcommunity)
4
- [![dependencies](https://img.shields.io/david/DoctorMcKay/node-steamcommunity.svg)](https://david-dm.org/DoctorMcKay/node-steamcommunity)
5
- [![license](https://img.shields.io/npm/l/steamcommunity.svg)](https://github.com/DoctorMcKay/node-steamcommunity/blob/master/LICENSE)
6
- [![paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=N36YVAT42CZ4G&item_name=node%2dsteamcommunity&currency_code=USD)
7
-
8
- This module provides an easy interface for the Steam Community website. This module can be used to simply login to steamcommunity.com for use with other libraries, or to interact with steamcommunity.com.
9
-
10
- It supports Steam Guard and CAPTCHAs.
11
-
12
- **Have a question about the module or coding in general? *Do not create a GitHub issue.* GitHub issues are for feature
13
- requests and bug reports. Instead, post in the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
14
- Such issues may be ignored!**
15
-
16
- # Documentation
17
-
18
- Documentation is available on the [GitHub wiki](https://github.com/DoctorMcKay/node-steamcommunity/wiki).
19
-
20
- # Support
21
-
22
- Report bugs on the [issue tracker](https://github.com/DoctorMcKay/node-steamcommunity/issues) or ask questions
23
- on the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
1
+ # Steam Community for Node.js
2
+ [![npm version](https://img.shields.io/npm/v/steamcommunity.svg)](https://npmjs.com/package/steamcommunity)
3
+ [![npm downloads](https://img.shields.io/npm/dm/steamcommunity.svg)](https://npmjs.com/package/steamcommunity)
4
+ [![license](https://img.shields.io/npm/l/steamcommunity.svg)](https://github.com/DoctorMcKay/node-steamcommunity/blob/master/LICENSE)
5
+ [![paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=N36YVAT42CZ4G&item_name=node%2dsteamcommunity&currency_code=USD)
6
+
7
+ This module provides an easy interface for the Steam Community website. This module can be used to simply login to steamcommunity.com for use with other libraries, or to interact with steamcommunity.com.
8
+
9
+ It supports Steam Guard and CAPTCHAs.
10
+
11
+ **Have a question about the module or coding in general? *Do not create a GitHub issue.* GitHub issues are for feature
12
+ requests and bug reports. Instead, post in the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
13
+ Such issues may be ignored!**
14
+
15
+ # Documentation
16
+
17
+ Documentation is available on the [GitHub wiki](https://github.com/DoctorMcKay/node-steamcommunity/wiki).
18
+
19
+ # Support
20
+
21
+ Report bugs on the [issue tracker](https://github.com/DoctorMcKay/node-steamcommunity/issues) or ask questions
22
+ on the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
@@ -9,14 +9,21 @@ var EConfirmationType = require('../resources/EConfirmationType.js');
9
9
  /**
10
10
  * Get a list of your account's currently outstanding confirmations.
11
11
  * @param {int} time - The unix timestamp with which the following key was generated
12
- * @param {string} key - The confirmation key that was generated using the preceeding time and the tag "conf" (this key can be reused)
12
+ * @param {string} key - The confirmation key that was generated using the preceeding time and the tag 'conf' (this key can be reused)
13
13
  * @param {SteamCommunity~getConfirmations} callback - Called when the list of confirmations is received
14
14
  */
15
15
  SteamCommunity.prototype.getConfirmations = function(time, key, callback) {
16
16
  var self = this;
17
17
 
18
+ // Ugly hack to maintain backward compatibility
19
+ var tag = 'conf';
20
+ if (typeof key == 'object') {
21
+ tag = key.tag;
22
+ key = key.key;
23
+ }
24
+
18
25
  // The official Steam app uses the tag 'list', but 'conf' still works so let's use that for backward compatibility.
19
- request(this, 'getlist', key, time, 'conf', null, true, function(err, body) {
26
+ request(this, 'getlist', key, time, tag, null, true, function(err, body) {
20
27
  if (err) {
21
28
  callback(err);
22
29
  return;
@@ -30,7 +37,7 @@ SteamCommunity.prototype.getConfirmations = function(time, key, callback) {
30
37
  return;
31
38
  }
32
39
 
33
- callback(new Error('Failed to get confirmation list'));
40
+ callback(new Error(body.message || body.detail || 'Failed to get confirmation list'));
34
41
  return;
35
42
  }
36
43
 
@@ -43,7 +50,7 @@ SteamCommunity.prototype.getConfirmations = function(time, key, callback) {
43
50
  receiving: conf.type == EConfirmationType.Trade ? ((conf.summary || [])[1] || '') : '',
44
51
  sending: (conf.summary || [])[0] || '',
45
52
  time: (new Date(conf.creation_time * 1000)).toISOString(), // for backward compatibility
46
- timestamp: conf.creation_time,
53
+ timestamp: new Date(conf.creation_time * 1000),
47
54
  icon: conf.icon || ''
48
55
  }));
49
56
 
@@ -104,8 +111,15 @@ SteamCommunity.prototype.getConfirmationOfferID = function(confID, time, key, ca
104
111
  * @param {SteamCommunity~genericErrorCallback} callback - Called when the request is complete
105
112
  */
106
113
  SteamCommunity.prototype.respondToConfirmation = function(confID, confKey, time, key, accept, callback) {
114
+ // Ugly hack to maintain backward compatibility
115
+ var tag = accept ? 'allow' : 'cancel';
116
+ if (typeof key == 'object') {
117
+ tag = key.tag;
118
+ key = key.key;
119
+ }
120
+
107
121
  // The official app uses tags reject/accept, but cancel/allow still works so use these for backward compatibility
108
- request(this, (confID instanceof Array) ? 'multiajaxop' : 'ajaxop', key, time, accept ? 'allow' : 'cancel', {
122
+ request(this, (confID instanceof Array) ? 'multiajaxop' : 'ajaxop', key, time, tag, {
109
123
  op: accept ? 'allow' : 'cancel',
110
124
  cid: confID,
111
125
  ck: confKey
@@ -166,7 +180,8 @@ SteamCommunity.prototype.acceptConfirmationForObject = function(identitySecret,
166
180
  function doConfirmation() {
167
181
  var offset = self._timeOffset;
168
182
  var time = SteamTotp.time(offset);
169
- self.getConfirmations(time, SteamTotp.getConfirmationKey(identitySecret, time, "conf"), function(err, confs) {
183
+ var confKey = SteamTotp.getConfirmationKey(identitySecret, time, 'list');
184
+ self.getConfirmations(time, {tag: 'list', key: confKey}, function(err, confs) {
170
185
  if (err) {
171
186
  callback(err);
172
187
  return;
@@ -174,7 +189,7 @@ SteamCommunity.prototype.acceptConfirmationForObject = function(identitySecret,
174
189
 
175
190
  var conf = confs.filter(function(conf) { return conf.creator == objectID; });
176
191
  if (conf.length == 0) {
177
- callback(new Error("Could not find confirmation for object " + objectID));
192
+ callback(new Error('Could not find confirmation for object ' + objectID));
178
193
  return;
179
194
  }
180
195
 
@@ -191,7 +206,8 @@ SteamCommunity.prototype.acceptConfirmationForObject = function(identitySecret,
191
206
  self._usedConfTimes.splice(0, self._usedConfTimes.length - 60); // we don't need to save more than 60 entries
192
207
  }
193
208
 
194
- conf.respond(time, SteamTotp.getConfirmationKey(identitySecret, time, "allow"), true, callback);
209
+ confKey = SteamTotp.getConfirmationKey(identitySecret, time, 'accept');
210
+ conf.respond(time, {tag: 'accept', key: confKey}, true, callback);
195
211
  });
196
212
  }
197
213
  };
@@ -231,7 +247,7 @@ SteamCommunity.prototype.acceptAllConfirmations = function(time, confKey, allowK
231
247
 
232
248
  function request(community, url, key, time, tag, params, json, callback) {
233
249
  if (!community.steamID) {
234
- throw new Error("Must be logged in before trying to do anything with confirmations");
250
+ throw new Error('Must be logged in before trying to do anything with confirmations');
235
251
  }
236
252
 
237
253
  params = params || {};
@@ -239,16 +255,16 @@ function request(community, url, key, time, tag, params, json, callback) {
239
255
  params.a = community.steamID.getSteamID64();
240
256
  params.k = key;
241
257
  params.t = time;
242
- params.m = "react";
258
+ params.m = 'react';
243
259
  params.tag = tag;
244
260
 
245
261
  var req = {
246
- "method": url == 'multiajaxop' ? 'POST' : 'GET',
247
- "uri": "https://steamcommunity.com/mobileconf/" + url,
248
- "json": !!json
262
+ method: url == 'multiajaxop' ? 'POST' : 'GET',
263
+ uri: 'https://steamcommunity.com/mobileconf/' + url,
264
+ json: !!json
249
265
  };
250
266
 
251
- if (req.method == "GET") {
267
+ if (req.method == 'GET') {
252
268
  req.qs = params;
253
269
  } else {
254
270
  req.form = params;
@@ -261,7 +277,7 @@ function request(community, url, key, time, tag, params, json, callback) {
261
277
  }
262
278
 
263
279
  callback(null, body);
264
- }, "steamcommunity");
280
+ }, 'steamcommunity');
265
281
  }
266
282
 
267
283
  // Confirmation checker
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamcommunity",
3
- "version": "3.45.1",
3
+ "version": "3.45.3",
4
4
  "description": "Provides an interface for logging into and interacting with the Steam Community website",
5
5
  "keywords": [
6
6
  "steam",