steamcommunity 3.48.2 → 3.48.3

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.
@@ -1,143 +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 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
- }
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamcommunity",
3
- "version": "3.48.2",
3
+ "version": "3.48.3",
4
4
  "description": "Provides an interface for logging into and interacting with the Steam Community website",
5
5
  "files": [
6
6
  "/classes",
@@ -1,14 +1,14 @@
1
- /**
2
- * @enum EChatState
3
- */
4
- module.exports = {
5
- "Offline": 0,
6
- "LoggingOn": 1,
7
- "LogOnFailed": 2,
8
- "LoggedOn": 3,
9
-
10
- "0": "Offline",
11
- "1": "LoggingOn",
12
- "2": "LogOnFailed",
13
- "3": "LoggedOn"
14
- };
1
+ /**
2
+ * @enum EChatState
3
+ */
4
+ module.exports = {
5
+ "Offline": 0,
6
+ "LoggingOn": 1,
7
+ "LogOnFailed": 2,
8
+ "LoggedOn": 3,
9
+
10
+ "0": "Offline",
11
+ "1": "LoggingOn",
12
+ "2": "LogOnFailed",
13
+ "3": "LoggedOn"
14
+ };
@@ -1,12 +1,12 @@
1
- /**
2
- * @enum EConfirmationType
3
- */
4
- module.exports = {
5
- // 1 is unknown, possibly "Invalid"
6
- "Trade": 2,
7
- "MarketListing": 3,
8
- // 4 is opt-out or other like account confirmation?
9
-
10
- "2": "Trade",
11
- "3": "MarketListing"
12
- };
1
+ /**
2
+ * @enum EConfirmationType
3
+ */
4
+ module.exports = {
5
+ // 1 is unknown, possibly "Invalid"
6
+ "Trade": 2,
7
+ "MarketListing": 3,
8
+ // 4 is opt-out or other like account confirmation?
9
+
10
+ "2": "Trade",
11
+ "3": "MarketListing"
12
+ };
@@ -1,23 +1,23 @@
1
- /**
2
- * @enum EFriendRelationship
3
- */
4
- module.exports = {
5
- "None": 0,
6
- "Blocked": 1,
7
- "RequestRecipient": 2,
8
- "Friend": 3,
9
- "RequestInitiator": 4,
10
- "Ignored": 5,
11
- "IgnoredFriend": 6,
12
- "SuggestedFriend": 7, // removed "was used by the original implementation of the facebook linking feature; but now unused."
13
-
14
- // Value-to-name mapping for convenience
15
- "0": "None",
16
- "1": "Blocked",
17
- "2": "RequestRecipient",
18
- "3": "Friend",
19
- "4": "RequestInitiator",
20
- "5": "Ignored",
21
- "6": "IgnoredFriend",
22
- "7": "SuggestedFriend",
23
- };
1
+ /**
2
+ * @enum EFriendRelationship
3
+ */
4
+ module.exports = {
5
+ "None": 0,
6
+ "Blocked": 1,
7
+ "RequestRecipient": 2,
8
+ "Friend": 3,
9
+ "RequestInitiator": 4,
10
+ "Ignored": 5,
11
+ "IgnoredFriend": 6,
12
+ "SuggestedFriend": 7, // removed "was used by the original implementation of the facebook linking feature; but now unused."
13
+
14
+ // Value-to-name mapping for convenience
15
+ "0": "None",
16
+ "1": "Blocked",
17
+ "2": "RequestRecipient",
18
+ "3": "Friend",
19
+ "4": "RequestInitiator",
20
+ "5": "Ignored",
21
+ "6": "IgnoredFriend",
22
+ "7": "SuggestedFriend",
23
+ };
@@ -1,23 +1,23 @@
1
- /**
2
- * @enum EPersonaState
3
- */
4
- module.exports = {
5
- "Offline": 0,
6
- "Online": 1,
7
- "Busy": 2,
8
- "Away": 3,
9
- "Snooze": 4,
10
- "LookingToTrade": 5,
11
- "LookingToPlay": 6,
12
- "Invisible": 7,
13
-
14
- // Value-to-name mapping for convenience
15
- "0": "Offline",
16
- "1": "Online",
17
- "2": "Busy",
18
- "3": "Away",
19
- "4": "Snooze",
20
- "5": "LookingToTrade",
21
- "6": "LookingToPlay",
22
- "7": "Invisible",
23
- };
1
+ /**
2
+ * @enum EPersonaState
3
+ */
4
+ module.exports = {
5
+ "Offline": 0,
6
+ "Online": 1,
7
+ "Busy": 2,
8
+ "Away": 3,
9
+ "Snooze": 4,
10
+ "LookingToTrade": 5,
11
+ "LookingToPlay": 6,
12
+ "Invisible": 7,
13
+
14
+ // Value-to-name mapping for convenience
15
+ "0": "Offline",
16
+ "1": "Online",
17
+ "2": "Busy",
18
+ "3": "Away",
19
+ "4": "Snooze",
20
+ "5": "LookingToTrade",
21
+ "6": "LookingToPlay",
22
+ "7": "Invisible",
23
+ };
@@ -1,32 +1,32 @@
1
- /**
2
- * @enum EPersonaStateFlag
3
- */
4
- module.exports = {
5
- "HasRichPresence": 1,
6
- "InJoinableGame": 2,
7
- "Golden": 4,
8
- "RemotePlayTogether": 8,
9
- "OnlineUsingWeb": 256, // removed "renamed to ClientTypeWeb"
10
- "ClientTypeWeb": 256,
11
- "OnlineUsingMobile": 512, // removed "renamed to ClientTypeMobile"
12
- "ClientTypeMobile": 512,
13
- "OnlineUsingBigPicture": 1024, // removed "renamed to ClientTypeTenfoot"
14
- "ClientTypeTenfoot": 1024,
15
- "OnlineUsingVR": 2048, // removed "renamed to ClientTypeVR"
16
- "ClientTypeVR": 2048,
17
- "LaunchTypeGamepad": 4096,
18
- "LaunchTypeCompatTool": 8192,
19
-
20
- // Value-to-name mapping for convenience
21
- "1": "HasRichPresence",
22
- "2": "InJoinableGame",
23
- "4": "Golden",
24
- "8": "RemotePlayTogether",
25
- "256": "ClientTypeWeb",
26
- "512": "ClientTypeMobile",
27
- "1024": "ClientTypeTenfoot",
28
- "2048": "ClientTypeVR",
29
- "4096": "LaunchTypeGamepad",
30
- "8192": "LaunchTypeCompatTool",
31
- };
32
-
1
+ /**
2
+ * @enum EPersonaStateFlag
3
+ */
4
+ module.exports = {
5
+ "HasRichPresence": 1,
6
+ "InJoinableGame": 2,
7
+ "Golden": 4,
8
+ "RemotePlayTogether": 8,
9
+ "OnlineUsingWeb": 256, // removed "renamed to ClientTypeWeb"
10
+ "ClientTypeWeb": 256,
11
+ "OnlineUsingMobile": 512, // removed "renamed to ClientTypeMobile"
12
+ "ClientTypeMobile": 512,
13
+ "OnlineUsingBigPicture": 1024, // removed "renamed to ClientTypeTenfoot"
14
+ "ClientTypeTenfoot": 1024,
15
+ "OnlineUsingVR": 2048, // removed "renamed to ClientTypeVR"
16
+ "ClientTypeVR": 2048,
17
+ "LaunchTypeGamepad": 4096,
18
+ "LaunchTypeCompatTool": 8192,
19
+
20
+ // Value-to-name mapping for convenience
21
+ "1": "HasRichPresence",
22
+ "2": "InJoinableGame",
23
+ "4": "Golden",
24
+ "8": "RemotePlayTogether",
25
+ "256": "ClientTypeWeb",
26
+ "512": "ClientTypeMobile",
27
+ "1024": "ClientTypeTenfoot",
28
+ "2048": "ClientTypeVR",
29
+ "4096": "LaunchTypeGamepad",
30
+ "8192": "LaunchTypeCompatTool",
31
+ };
32
+