steamutils 1.0.38 → 1.0.40

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 (3) hide show
  1. package/example.js +2 -1
  2. package/index.js +129 -0
  3. package/package.json +1 -1
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,134 @@ class SteamUser {
4059
4060
  return list
4060
4061
  }
4061
4062
 
4063
+ async getSteamGuardStatus() {
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
+ })
4072
+ const $ = cheerio.load(result?.data || '')
4073
+
4074
+ if($('#steam_authenticator_form #steam_authenticator_check[checked]')){
4075
+ return 'steam_authenticator'
4076
+ }
4077
+
4078
+ if($('#email_authenticator_form #email_authenticator_check[checked]')){
4079
+ return 'email_authenticator'
4080
+ }
4081
+
4082
+ if($('#none_authenticator_form #none_authenticator_check[checked]')){
4083
+ return 'none_authenticator'
4084
+ }
4085
+ }
4086
+
4087
+ async turningSteamGuardOff() {
4088
+ const result = await this._httpRequest({
4089
+ url: `https://store.steampowered.com/twofactor/manage_action`,
4090
+ "headers": {
4091
+ "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",
4092
+ "Referer": "https://store.steampowered.com/twofactor/manage_action",
4093
+ 'Content-Type': 'application/x-www-form-urlencoded'
4094
+ },
4095
+ data: {
4096
+ action: 'actuallynone',
4097
+ },
4098
+ method: "POST"
4099
+ })
4100
+ const $ = cheerio.load(result?.data || '')
4101
+ 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.`)
4102
+ }
4103
+
4104
+ async turningEmailAuthenticatorCheckOn() {
4105
+ const result = await this._httpRequest({
4106
+ url: `https://store.steampowered.com/twofactor/manage_action`,
4107
+ "headers": {
4108
+ "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",
4109
+ "Referer": "https://store.steampowered.com/twofactor/manage",
4110
+ 'Content-Type': 'application/x-www-form-urlencoded'
4111
+ },
4112
+ data: {
4113
+ action: 'email',
4114
+ email_authenticator_check: 'on',
4115
+ },
4116
+ method: "POST"
4117
+ })
4118
+ const $ = cheerio.load(result?.data || '')
4119
+ return $('title').text() === `Steam Guard Mobile Authenticator` && $('#email_authenticator_check')?.attr('checked') == 'checked'
4120
+ }
4121
+
4122
+ async addPhoneNumber(phone) {//+84 123456789
4123
+ const result = await this._httpRequest({
4124
+ url: `https://store.steampowered.com/phone/add_ajaxop`,
4125
+ "headers": {
4126
+ "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",
4127
+ "Referer": "https://store.steampowered.com/phone/add",
4128
+ 'Content-Type': 'application/x-www-form-urlencoded'
4129
+ },
4130
+ data: {
4131
+ op: 'get_phone_number',
4132
+ input: phone,
4133
+ confirmed: '1',
4134
+ checkfortos: '1',
4135
+ bisediting: '0',
4136
+ token: '0',
4137
+ },
4138
+ method: "POST"
4139
+ })
4140
+ return result?.data
4141
+ const responseSuccessExample = {
4142
+ "success": true,
4143
+ "showResend": false,
4144
+ "state": "email_verification",
4145
+ "errorText": "",
4146
+ "token": "0",
4147
+ "phoneNumber": "+84328900017"
4148
+ }
4149
+ }
4150
+
4151
+ static async confirmEmailForAdd(confirmURL) {
4152
+ const result = await axios.request({
4153
+ url: confirmURL
4154
+ })
4155
+ const $ = cheerio.load(result?.data || '')
4156
+ return !!($('title').text() === `Email Verification` && result?.data?.includes?.(`Email Confirmed`) && result?.data?.includes?.(`The phone can now be added to your account.`))
4157
+ }
4158
+
4159
+ async confirmPhoneCodeForAdd(code) {
4160
+ const result = await this._httpRequest({
4161
+ url: `https://store.steampowered.com/phone/add_ajaxop`,
4162
+ "headers": {
4163
+ "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",
4164
+ "Referer": "https://store.steampowered.com/phone/add",
4165
+ 'Content-Type': 'application/x-www-form-urlencoded'
4166
+ },
4167
+ data: {
4168
+ op: 'get_sms_code',
4169
+ input: code,
4170
+ confirmed: '1',
4171
+ checkfortos: '1',
4172
+ bisediting: '0',
4173
+ token: '0',
4174
+ },
4175
+ method: "POST"
4176
+ })
4177
+ return result?.data
4178
+ const responseSuccessExample = {
4179
+ "success": true,
4180
+ "showResend": false,
4181
+ "state": "done",
4182
+ "errorText": "",
4183
+ "token": "0",
4184
+ "vac_policy": 0,
4185
+ "tos_policy": 2,
4186
+ "showDone": true,
4187
+ "maxLength": "5"
4188
+ }
4189
+ }
4190
+
4062
4191
  static parseGameBanType(gameBanFull) {
4063
4192
  if(Array.isArray(gameBanFull) && !gameBanFull.length) {
4064
4193
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "dependencies": {
5
5
  "axios": "^1.3.4",
6
6
  "cheerio": "^1.0.0-rc.12",