steamutils 1.3.61 → 1.3.62

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.
Files changed (2) hide show
  1. package/index.js +48 -2
  2. package/package.json +2 -1
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;
@@ -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.61",
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",