steamutils 1.3.60 → 1.3.62

Sign up to get free protection for your applications and to get access to all the features.
package/SteamClient.js CHANGED
@@ -849,7 +849,7 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
849
849
  const result = protoDecode(Protos.csgo.CSOPersonaDataPublic, object_data);
850
850
  obj.PersonaDataPublic = result;
851
851
  const example = {
852
- player_level: 4,
852
+ player_level: 4, //CSGO_Profile_Rank
853
853
  commendation: {
854
854
  cmd_friendly: 149,
855
855
  cmd_teaching: 108,
@@ -2318,6 +2318,9 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
2318
2318
  getCurrentLobby() {
2319
2319
  return currentLobby;
2320
2320
  },
2321
+ setGame(_games) {
2322
+ games = _games;
2323
+ },
2321
2324
  };
2322
2325
  }
2323
2326
 
@@ -31,14 +31,23 @@ import _ from "lodash";
31
31
  const __params = [${params}];
32
32
  if(__params.length === 1 && __params[0] === undefined){
33
33
  __params.length = 0
34
- }
34
+ }
35
+ let __cookies = this._cookies;
36
+ if (__cookies) {
37
+ if (!Array.isArray(__cookies)) {
38
+ __cookies = [__cookies];
39
+ }
40
+ __cookies = __cookies.map(function (cookie) {
41
+ return cookie.toString();
42
+ });
43
+ }
35
44
 
36
45
  try {
37
46
  const result = (
38
47
  await axios.post(getAppURL(), {
39
48
  method: "${methodName}",
40
49
  params: __params,
41
- cookies: this._cookies,
50
+ cookies: __cookies,
42
51
  is_static: ${!!is_static}
43
52
  })
44
53
  ).data?.result;
package/index.js CHANGED
@@ -21,6 +21,8 @@ import Jimp from "jimp";
21
21
  import path from "path";
22
22
  import CookieManager from "./CookieManager.js";
23
23
  import { AppID_CSGO, E1GameBanOnRecord, E1VACBanOnRecord, EActivityType, ECommentPrivacyState, ECurrentlyTradeBanned, EdaySinceLastBanRegExp, EFriendRelationship, ELanguage, EmptyProfileSummary, EMultipleGameBansOnRecord, EMultipleVACBansOnRecord, EPrivacyState, ErrorProcessingRequest, FRIEND_CODE_REPLACEMENTS, NotYetSetupProfileTextList, PrivacySettings, PrivateProfileTextList, SteamcommunityURL, SteamErrorTitle, SteamImageCDN } from "./const.js";
24
+ import SteamCommunity from "steamcommunity";
25
+ import SteamTotp from "steam-totp";
24
26
 
25
27
  let requestTimestamp = 0;
26
28
  let tooManyRequestTimestamp = 0;
@@ -2097,8 +2099,8 @@ export default class SteamUser {
2097
2099
  if (result instanceof ResponseError) {
2098
2100
  return result;
2099
2101
  }
2100
- const sentInvites = SteamUser._parsePendingFriendList(result.data, "#search_results_sentinvites > div");
2101
- const receiveInvites = SteamUser._parsePendingFriendList(result.data, "#search_results > div");
2102
+ const sentInvites = SteamUser._parsePendingFriendList(result?.data, "#search_results_sentinvites > div");
2103
+ const receiveInvites = SteamUser._parsePendingFriendList(result?.data, "#search_results > div");
2102
2104
  return {
2103
2105
  sentInvites,
2104
2106
  receiveInvites,
@@ -2717,8 +2719,8 @@ export default class SteamUser {
2717
2719
  personaName: personaName === null ? profileEdit.strPersonaName : personaName,
2718
2720
  real_name: realName === null ? profileEdit.strRealName : realName,
2719
2721
  customURL: customURL === null ? profileEdit.strCustomURL : customURL,
2720
- country: country === null ? profileEdit.LocationData.locCountryCode : country,
2721
- state: profileEdit.LocationData.locStateCode,
2722
+ country: country === null ? profileEdit.LocationData.locCountryCode : country, //VN
2723
+ state: profileEdit.LocationData.locStateCode, //52 (Ho Chi Minh) | 51 Ha Noi
2722
2724
  city: profileEdit.LocationData.locCityCode,
2723
2725
  summary: summary || profileEdit.strSummary,
2724
2726
  hide_profile_awards: hide_profile_awards === null ? profileEdit.ProfilePreferences.hide_profile_awards : hide_profile_awards ? "1" : "0",
@@ -6406,6 +6408,50 @@ export default class SteamUser {
6406
6408
  return headerEl[0].children.map((el) => $(el).text().trim()).filter(Boolean);
6407
6409
  } catch (e) {}
6408
6410
  }
6411
+
6412
+ async acceptConfirmationForObject(accessToken, identitySecret, objectID) {
6413
+ let error = null;
6414
+ for (const cookie of this._cookies) {
6415
+ const community = new SteamCommunity();
6416
+ community.setCookies(cookie.toString().split(";"));
6417
+ community.oAuthToken = accessToken;
6418
+ error = await new Promise((resolve) => {
6419
+ community.acceptConfirmationForObject(identitySecret, objectID, resolve);
6420
+ });
6421
+ if (!error) {
6422
+ return {
6423
+ success: true,
6424
+ };
6425
+ }
6426
+ }
6427
+ return { error };
6428
+ }
6429
+ async getConfirmations(accessToken, identitySecret) {
6430
+ let error = null;
6431
+ for (const cookie of this._cookies) {
6432
+ const community = new SteamCommunity();
6433
+ community.setCookies(cookie.toString().split(";"));
6434
+ community.oAuthToken = accessToken;
6435
+ const time = SteamTotp.time();
6436
+ const key = SteamTotp.getConfirmationKey(identitySecret, time, "conf");
6437
+ // err.message === "Not Logged In";
6438
+ const result = await new Promise((resolve) => {
6439
+ community.getConfirmations(time, key, function (error, confirmations) {
6440
+ if (error) {
6441
+ resolve({ error });
6442
+ }
6443
+ resolve({ confirmations });
6444
+ });
6445
+ });
6446
+ if (result?.confirmations) {
6447
+ return { confirmations: result?.confirmations };
6448
+ }
6449
+ if (result?.error) {
6450
+ error = result.error;
6451
+ }
6452
+ }
6453
+ return { error };
6454
+ }
6409
6455
  }
6410
6456
 
6411
6457
  SteamUser.MAX_RETRY = 10;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.60",
3
+ "version": "1.3.62",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",
@@ -16,6 +16,7 @@
16
16
  "moment-timezone": "^0.5.45",
17
17
  "node-bignumber": "^1.2.2",
18
18
  "steam-session": "^1.7.2",
19
+ "steam-totp": "^2.1.2",
19
20
  "steam-user": "^5.0.8",
20
21
  "steamcommunity": "^3.48.2",
21
22
  "steamid": "^2.0.0",