steamcommunity 3.47.1 → 3.48.0
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/LICENSE +21 -21
- package/README.md +22 -22
- package/classes/CConfirmation.js +37 -37
- package/classes/CEconItem.js +120 -120
- package/classes/CSteamSharedFile.js +221 -221
- package/classes/CSteamUser.js +225 -225
- package/components/confirmations.js +428 -428
- package/components/groups.js +798 -798
- package/components/help.js +64 -64
- package/components/helpers.js +128 -128
- package/components/http.js +150 -150
- package/components/inventoryhistory.js +173 -173
- package/components/login.js +110 -110
- package/components/market.js +387 -387
- package/components/profile.js +475 -475
- package/components/sharedfiles.js +158 -158
- package/components/twofactor.js +152 -152
- package/components/users.js +831 -831
- package/components/webapi.js +128 -25
- package/examples/README.md +35 -35
- package/examples/accept_all_confirmations.js +173 -173
- package/examples/disable_twofactor.js +98 -135
- package/examples/enable_twofactor.js +143 -182
- package/index.js +462 -462
- package/package.json +44 -44
- package/resources/EChatState.js +14 -14
- package/resources/EConfirmationType.js +12 -12
- package/resources/EFriendRelationship.js +23 -23
- package/resources/EPersonaState.js +23 -23
- package/resources/EPersonaStateFlag.js +32 -32
- package/resources/EResult.js +254 -254
- package/resources/ESharedFileType.js +13 -13
|
@@ -1,135 +1,98 @@
|
|
|
1
|
-
// If you aren't running this script inside of the repository, replace the following line with:
|
|
2
|
-
// const SteamCommunity = require('steamcommunity');
|
|
3
|
-
const SteamCommunity = require('../index.js');
|
|
4
|
-
const
|
|
5
|
-
const ReadLine = require('readline');
|
|
6
|
-
|
|
7
|
-
let g_AbortPromptFunc = null;
|
|
8
|
-
|
|
9
|
-
let community = new SteamCommunity();
|
|
10
|
-
|
|
11
|
-
main();
|
|
12
|
-
async function main() {
|
|
13
|
-
let accountName = await promptAsync('Username: ');
|
|
14
|
-
let password = await promptAsync('Password (hidden): ', true);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
let rl = ReadLine.createInterface({
|
|
100
|
-
input: process.stdin,
|
|
101
|
-
output: sensitiveInput ? null : process.stdout,
|
|
102
|
-
terminal: true
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
g_AbortPromptFunc = () => {
|
|
106
|
-
rl.close();
|
|
107
|
-
resolve('');
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
if (sensitiveInput) {
|
|
111
|
-
// We have to write the question manually if we didn't give readline an output stream
|
|
112
|
-
process.stdout.write(question);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
rl.question(question, (result) => {
|
|
116
|
-
if (sensitiveInput) {
|
|
117
|
-
// We have to manually print a newline
|
|
118
|
-
process.stdout.write('\n');
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
g_AbortPromptFunc = null;
|
|
122
|
-
rl.close();
|
|
123
|
-
resolve(result);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function abortPrompt() {
|
|
129
|
-
if (!g_AbortPromptFunc) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
g_AbortPromptFunc();
|
|
134
|
-
process.stdout.write('\n');
|
|
135
|
-
}
|
|
1
|
+
// If you aren't running this script inside of the repository, replace the following line with:
|
|
2
|
+
// const SteamCommunity = require('steamcommunity');
|
|
3
|
+
const SteamCommunity = require('../index.js');
|
|
4
|
+
const SteamTotp = require('steam-totp');
|
|
5
|
+
const ReadLine = require('readline');
|
|
6
|
+
|
|
7
|
+
let g_AbortPromptFunc = null;
|
|
8
|
+
|
|
9
|
+
let community = new SteamCommunity();
|
|
10
|
+
|
|
11
|
+
main();
|
|
12
|
+
async function main() {
|
|
13
|
+
let accountName = await promptAsync('Username: ');
|
|
14
|
+
let password = await promptAsync('Password (hidden): ', true);
|
|
15
|
+
|
|
16
|
+
attemptLogin(accountName, password);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function attemptLogin(accountName, password, twoFactorCode) {
|
|
20
|
+
community.login({
|
|
21
|
+
accountName,
|
|
22
|
+
password,
|
|
23
|
+
twoFactorCode,
|
|
24
|
+
disableMobile: false
|
|
25
|
+
}, async (err) => {
|
|
26
|
+
if (err && err.message == 'SteamGuardMobile') {
|
|
27
|
+
let code = await promptAsync('Steam Guard App Code OR Shared Secret: ');
|
|
28
|
+
if (code.length > 5) {
|
|
29
|
+
// If we were provided a shared secret, turn it into a code.
|
|
30
|
+
code = SteamTotp.getAuthCode(code);
|
|
31
|
+
}
|
|
32
|
+
attemptLogin(accountName, password, code);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (err) {
|
|
37
|
+
throw err;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
doRevoke();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function doRevoke() {
|
|
45
|
+
let rCode = await promptAsync('Revocation Code: R');
|
|
46
|
+
community.disableTwoFactor('R' + rCode, (err) => {
|
|
47
|
+
if (err) {
|
|
48
|
+
console.log(err);
|
|
49
|
+
process.exit();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
console.log('Two-factor authentication disabled!');
|
|
54
|
+
process.exit();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Nothing interesting below here, just code for prompting for input from the console.
|
|
59
|
+
|
|
60
|
+
function promptAsync(question, sensitiveInput = false) {
|
|
61
|
+
return new Promise((resolve) => {
|
|
62
|
+
let rl = ReadLine.createInterface({
|
|
63
|
+
input: process.stdin,
|
|
64
|
+
output: sensitiveInput ? null : process.stdout,
|
|
65
|
+
terminal: true
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
g_AbortPromptFunc = () => {
|
|
69
|
+
rl.close();
|
|
70
|
+
resolve('');
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
if (sensitiveInput) {
|
|
74
|
+
// We have to write the question manually if we didn't give readline an output stream
|
|
75
|
+
process.stdout.write(question);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
rl.question(question, (result) => {
|
|
79
|
+
if (sensitiveInput) {
|
|
80
|
+
// We have to manually print a newline
|
|
81
|
+
process.stdout.write('\n');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
g_AbortPromptFunc = null;
|
|
85
|
+
rl.close();
|
|
86
|
+
resolve(result);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function abortPrompt() {
|
|
92
|
+
if (!g_AbortPromptFunc) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
g_AbortPromptFunc();
|
|
97
|
+
process.stdout.write('\n');
|
|
98
|
+
}
|
|
@@ -1,182 +1,143 @@
|
|
|
1
|
-
// If you aren't running this script inside of the repository, replace the following line with:
|
|
2
|
-
// const SteamCommunity = require('steamcommunity');
|
|
3
|
-
const SteamCommunity = require('../index.js');
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
main()
|
|
15
|
-
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
function promptAsync(question, sensitiveInput = false) {
|
|
145
|
-
return new Promise((resolve) => {
|
|
146
|
-
let rl = ReadLine.createInterface({
|
|
147
|
-
input: process.stdin,
|
|
148
|
-
output: sensitiveInput ? null : process.stdout,
|
|
149
|
-
terminal: true
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
g_AbortPromptFunc = () => {
|
|
153
|
-
rl.close();
|
|
154
|
-
resolve('');
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
if (sensitiveInput) {
|
|
158
|
-
// We have to write the question manually if we didn't give readline an output stream
|
|
159
|
-
process.stdout.write(question);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
rl.question(question, (result) => {
|
|
163
|
-
if (sensitiveInput) {
|
|
164
|
-
// We have to manually print a newline
|
|
165
|
-
process.stdout.write('\n');
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
g_AbortPromptFunc = null;
|
|
169
|
-
rl.close();
|
|
170
|
-
resolve(result);
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function abortPrompt() {
|
|
176
|
-
if (!g_AbortPromptFunc) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
g_AbortPromptFunc();
|
|
181
|
-
process.stdout.write('\n');
|
|
182
|
-
}
|
|
1
|
+
// If you aren't running this script inside of the repository, replace the following line with:
|
|
2
|
+
// const SteamCommunity = require('steamcommunity');
|
|
3
|
+
const SteamCommunity = require('../index.js');
|
|
4
|
+
const ReadLine = require('readline');
|
|
5
|
+
const FS = require('fs');
|
|
6
|
+
|
|
7
|
+
const EResult = SteamCommunity.EResult;
|
|
8
|
+
|
|
9
|
+
let g_AbortPromptFunc = null;
|
|
10
|
+
|
|
11
|
+
let community = new SteamCommunity();
|
|
12
|
+
|
|
13
|
+
main();
|
|
14
|
+
async function main() {
|
|
15
|
+
let accountName = await promptAsync('Username: ');
|
|
16
|
+
let password = await promptAsync('Password (hidden): ', true);
|
|
17
|
+
|
|
18
|
+
attemptLogin(accountName, password);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function attemptLogin(accountName, password, authCode) {
|
|
22
|
+
community.login({
|
|
23
|
+
accountName,
|
|
24
|
+
password,
|
|
25
|
+
authCode,
|
|
26
|
+
disableMobile: false
|
|
27
|
+
}, async (err) => {
|
|
28
|
+
if (err && err.message == 'SteamGuard') {
|
|
29
|
+
let code = await promptAsync('Steam Guard Email Code: ');
|
|
30
|
+
attemptLogin(accountName, password, code);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (err) {
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
doSetup();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function doSetup() {
|
|
43
|
+
community.enableTwoFactor((err, response) => {
|
|
44
|
+
if (err) {
|
|
45
|
+
if (err.eresult == EResult.Fail) {
|
|
46
|
+
console.log('Error: Failed to enable two-factor authentication. Do you have a phone number attached to your account?');
|
|
47
|
+
process.exit();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (err.eresult == EResult.RateLimitExceeded) {
|
|
52
|
+
console.log('Error: RateLimitExceeded. Try again later.');
|
|
53
|
+
process.exit();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log(err);
|
|
58
|
+
process.exit();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (response.status != EResult.OK) {
|
|
63
|
+
console.log(`Error: Status ${response.status}`);
|
|
64
|
+
process.exit();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
let filename = `twofactor_${community.steamID.getSteamID64()}.json`;
|
|
69
|
+
console.log(`Writing secrets to ${filename}`);
|
|
70
|
+
console.log(`Revocation code: ${response.revocation_code}`);
|
|
71
|
+
FS.writeFileSync(filename, JSON.stringify(response, null, '\t'));
|
|
72
|
+
|
|
73
|
+
promptActivationCode(response);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async function promptActivationCode(response) {
|
|
78
|
+
if (response.phone_number_hint) {
|
|
79
|
+
console.log(`An activation code has been sent to your phone ending in ${response.phone_number_hint}.`);
|
|
80
|
+
} else if (response.confirm_type == 3) {
|
|
81
|
+
// Exact meaning of confirm_type is unknown, but 3 appears to be email code
|
|
82
|
+
console.log('An activation code has been sent to your email.');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let smsCode = await promptAsync('Activation Code: ');
|
|
86
|
+
community.finalizeTwoFactor(response.shared_secret, smsCode, (err) => {
|
|
87
|
+
if (err) {
|
|
88
|
+
if (err.message == 'Invalid activation code') {
|
|
89
|
+
console.log(err);
|
|
90
|
+
promptActivationCode(response);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
console.log(err);
|
|
95
|
+
} else {
|
|
96
|
+
console.log('Two-factor authentication enabled!');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
process.exit();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Nothing interesting below here, just code for prompting for input from the console.
|
|
104
|
+
|
|
105
|
+
function promptAsync(question, sensitiveInput = false) {
|
|
106
|
+
return new Promise((resolve) => {
|
|
107
|
+
let rl = ReadLine.createInterface({
|
|
108
|
+
input: process.stdin,
|
|
109
|
+
output: sensitiveInput ? null : process.stdout,
|
|
110
|
+
terminal: true
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
g_AbortPromptFunc = () => {
|
|
114
|
+
rl.close();
|
|
115
|
+
resolve('');
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
if (sensitiveInput) {
|
|
119
|
+
// We have to write the question manually if we didn't give readline an output stream
|
|
120
|
+
process.stdout.write(question);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
rl.question(question, (result) => {
|
|
124
|
+
if (sensitiveInput) {
|
|
125
|
+
// We have to manually print a newline
|
|
126
|
+
process.stdout.write('\n');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
g_AbortPromptFunc = null;
|
|
130
|
+
rl.close();
|
|
131
|
+
resolve(result);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function abortPrompt() {
|
|
137
|
+
if (!g_AbortPromptFunc) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
g_AbortPromptFunc();
|
|
142
|
+
process.stdout.write('\n');
|
|
143
|
+
}
|