steamutils 1.0.37 → 1.0.39

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/SteamClient.js CHANGED
@@ -461,7 +461,11 @@ function SteamClient({
461
461
  }
462
462
  }
463
463
 
464
- partySearchCallback.shift()?.(players)
464
+
465
+ let _partySearchCallback = null
466
+ while ((_partySearchCallback = partySearchCallback.shift())) {
467
+ _partySearchCallback?.(players)
468
+ }
465
469
  break
466
470
  }
467
471
  case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_PlayersProfile: {
package/example.js CHANGED
@@ -7,6 +7,7 @@ import SteamUser from "./index.js";
7
7
  })
8
8
  console.log(loginResult.cookie);
9
9
  const user = new SteamUser(loginResult.cookie)
10
- const friendList = await user.getFriendsList()
10
+ const friendList = await user.turningSteamGuardOff()
11
+ // const friendList = await user.turningEmailAuthenticatorCheckOn()
11
12
  console.log(friendList);
12
13
  })()
package/index.js CHANGED
@@ -13,6 +13,7 @@ import './string.js'
13
13
  import {Header, request} from './axios.js'
14
14
  import {getTableHasHeaders, table2json} from './cheerio.js'
15
15
  import {getJSObjectFronXML} from './xml2json.js'
16
+ import axios from "axios";
16
17
 
17
18
  const MAX_RETRY = 10
18
19
  export const MatchHistoryType = {
@@ -4059,6 +4060,110 @@ class SteamUser {
4059
4060
  return list
4060
4061
  }
4061
4062
 
4063
+ async turningSteamGuardOff() {
4064
+ const result = await this._httpRequest({
4065
+ url: `https://store.steampowered.com/twofactor/manage_action`,
4066
+ "headers": {
4067
+ "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
4068
+ "Referer": "https://store.steampowered.com/twofactor/manage_action",
4069
+ 'Content-Type': 'application/x-www-form-urlencoded'
4070
+ },
4071
+ data: {
4072
+ action: 'actuallynone',
4073
+ },
4074
+ method: "POST"
4075
+ })
4076
+ const $ = cheerio.load(result?.data || '')
4077
+ return $('title').text() === `Steam Guard Mobile Authenticator` && !!result?.data?.includes?.(`Turning Steam Guard off requires confirmation. We've sent you an email with a link to confirm disabling Steam Guard.`)
4078
+ }
4079
+
4080
+ async turningEmailAuthenticatorCheckOn() {
4081
+ const result = await this._httpRequest({
4082
+ url: `https://store.steampowered.com/twofactor/manage_action`,
4083
+ "headers": {
4084
+ "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
4085
+ "Referer": "https://store.steampowered.com/twofactor/manage",
4086
+ 'Content-Type': 'application/x-www-form-urlencoded'
4087
+ },
4088
+ data: {
4089
+ action: 'email',
4090
+ email_authenticator_check: 'on',
4091
+ },
4092
+ method: "POST"
4093
+ })
4094
+ const $ = cheerio.load(result?.data || '')
4095
+ return $('title').text() === `Steam Guard Mobile Authenticator` && $('#email_authenticator_check')?.attr('checked') == 'checked'
4096
+ }
4097
+
4098
+ async addPhoneNumber(phone) {//+84 123456789
4099
+ const result = await this._httpRequest({
4100
+ url: `https://store.steampowered.com/phone/add_ajaxop`,
4101
+ "headers": {
4102
+ "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
4103
+ "Referer": "https://store.steampowered.com/phone/add",
4104
+ 'Content-Type': 'application/x-www-form-urlencoded'
4105
+ },
4106
+ data: {
4107
+ op: 'get_phone_number',
4108
+ input: phone,
4109
+ confirmed: '1',
4110
+ checkfortos: '1',
4111
+ bisediting: '0',
4112
+ token: '0',
4113
+ },
4114
+ method: "POST"
4115
+ })
4116
+ return result?.data
4117
+ const responseSuccessExample = {
4118
+ "success": true,
4119
+ "showResend": false,
4120
+ "state": "email_verification",
4121
+ "errorText": "",
4122
+ "token": "0",
4123
+ "phoneNumber": "+84328900017"
4124
+ }
4125
+ }
4126
+
4127
+ static async confirmEmailForAdd(confirmURL) {
4128
+ const result = await axios.request({
4129
+ url: confirmURL
4130
+ })
4131
+ const $ = cheerio.load(result?.data || '')
4132
+ return !!($('title').text() === `Email Verification` && result?.data?.includes?.(`Email Confirmed`) && result?.data?.includes?.(`The phone can now be added to your account.`))
4133
+ }
4134
+
4135
+ async confirmPhoneCodeForAdd(code) {
4136
+ const result = await this._httpRequest({
4137
+ url: `https://store.steampowered.com/phone/add_ajaxop`,
4138
+ "headers": {
4139
+ "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
4140
+ "Referer": "https://store.steampowered.com/phone/add",
4141
+ 'Content-Type': 'application/x-www-form-urlencoded'
4142
+ },
4143
+ data: {
4144
+ op: 'get_sms_code',
4145
+ input: code,
4146
+ confirmed: '1',
4147
+ checkfortos: '1',
4148
+ bisediting: '0',
4149
+ token: '0',
4150
+ },
4151
+ method: "POST"
4152
+ })
4153
+ return result?.data
4154
+ const responseSuccessExample = {
4155
+ "success": true,
4156
+ "showResend": false,
4157
+ "state": "done",
4158
+ "errorText": "",
4159
+ "token": "0",
4160
+ "vac_policy": 0,
4161
+ "tos_policy": 2,
4162
+ "showDone": true,
4163
+ "maxLength": "5"
4164
+ }
4165
+ }
4166
+
4062
4167
  static parseGameBanType(gameBanFull) {
4063
4168
  if(Array.isArray(gameBanFull) && !gameBanFull.length) {
4064
4169
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "dependencies": {
5
5
  "axios": "^1.3.4",
6
6
  "cheerio": "^1.0.0-rc.12",