steamutils 1.4.87 → 1.4.89
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 +22 -8
- package/create_remote_file.js +7 -1
- package/package.json +1 -1
- package/remote.js +27 -113
package/SteamClient.js
CHANGED
|
@@ -2159,7 +2159,7 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2159
2159
|
log("logOff");
|
|
2160
2160
|
isLogOff = true;
|
|
2161
2161
|
|
|
2162
|
-
|
|
2162
|
+
clearMessageQueue();
|
|
2163
2163
|
|
|
2164
2164
|
callEvent(events.logOff);
|
|
2165
2165
|
events.logOff = [];
|
|
@@ -2295,8 +2295,16 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2295
2295
|
|
|
2296
2296
|
const MessageQueue = [];
|
|
2297
2297
|
|
|
2298
|
+
function clearMessageQueue() {
|
|
2299
|
+
while (MessageQueue.length) {
|
|
2300
|
+
const item = MessageQueue.shift();
|
|
2301
|
+
item?.callback?.();
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2298
2305
|
async function _execMessageQueue() {
|
|
2299
2306
|
if (isLogOff) {
|
|
2307
|
+
clearMessageQueue();
|
|
2300
2308
|
return;
|
|
2301
2309
|
}
|
|
2302
2310
|
|
|
@@ -2304,13 +2312,19 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2304
2312
|
return;
|
|
2305
2313
|
}
|
|
2306
2314
|
while (MessageQueue.length) {
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2315
|
+
try {
|
|
2316
|
+
isSendingFriendMessages = true;
|
|
2317
|
+
const item = MessageQueue.shift();
|
|
2318
|
+
const result = await _sendFriendMessage(item.steamId, item.message);
|
|
2319
|
+
if (typeof item.callback === "function") {
|
|
2320
|
+
try {
|
|
2321
|
+
await item.callback(result);
|
|
2322
|
+
} catch (e) {}
|
|
2323
|
+
}
|
|
2324
|
+
if (MessageQueue.length) {
|
|
2325
|
+
await sleep(1000);
|
|
2326
|
+
}
|
|
2327
|
+
} catch (e) {}
|
|
2314
2328
|
}
|
|
2315
2329
|
isSendingFriendMessages = false;
|
|
2316
2330
|
}
|
package/create_remote_file.js
CHANGED
|
@@ -3,13 +3,19 @@ import fs from "fs";
|
|
|
3
3
|
|
|
4
4
|
(async function () {
|
|
5
5
|
let content = "";
|
|
6
|
+
const ignoreMethods = ["constructor", "length", "name", "prototype", "RequestXML_TooManyRequests", "MAX_RETRY", "_httpRequest", "_httpMyRequest", "_httpRequestAjax", "_httpMyRequestAjax"];
|
|
7
|
+
const dupplicateMethods = ["setSteamLanguage", "getCookies", "getSteamIdUser", "getMiniProfileUser", "getSessionid", "getSteamMachineAuth", "getSteamUserProfileURL", "getMyProfileURL"];
|
|
6
8
|
|
|
7
9
|
function doWrite(user, is_static) {
|
|
8
10
|
for (const methodName of Object.getOwnPropertyNames(user)) {
|
|
9
|
-
if (methodName
|
|
11
|
+
if (ignoreMethods.includes(methodName)) {
|
|
10
12
|
continue;
|
|
11
13
|
}
|
|
12
14
|
const fnString = user[methodName].toString().trim();
|
|
15
|
+
if (dupplicateMethods.includes(methodName)) {
|
|
16
|
+
content += `${fnString}\n`;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
13
19
|
const async = "async";
|
|
14
20
|
// const async = fnString.startsWith("async") ? "async" : "";
|
|
15
21
|
let params = fnString.split("(")[1].split(")")[0];
|
package/package.json
CHANGED
package/remote.js
CHANGED
|
@@ -90,85 +90,40 @@ export default class RemoteSteamUser {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
setSteamLanguage(language) {
|
|
94
|
+
language = language?.toLowerCase();
|
|
95
|
+
if (!Object.hasOwn(ELanguage, language)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
this.Steam_Language = language;
|
|
99
|
+
this._cookies.forEach(function (cookie) {
|
|
100
|
+
cookie.setCookie("Steam_Language", language);
|
|
101
|
+
cookie.setCookie("strInventoryLastContext", "730_2");
|
|
102
|
+
});
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const config = {
|
|
106
|
-
method: "getCookies",
|
|
107
|
-
params: __params,
|
|
108
|
-
cookies: __cookies,
|
|
109
|
-
is_static: false,
|
|
110
|
-
};
|
|
111
|
-
return await doRequest(config);
|
|
104
|
+
getCookies(index = 0) {
|
|
105
|
+
return this._cookies[index].toString();
|
|
112
106
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const config = {
|
|
116
|
-
method: "getSteamIdUser",
|
|
117
|
-
params: __params,
|
|
118
|
-
cookies: __cookies,
|
|
119
|
-
is_static: false,
|
|
120
|
-
};
|
|
121
|
-
return await doRequest(config);
|
|
107
|
+
getSteamIdUser() {
|
|
108
|
+
return this._steamIdUser;
|
|
122
109
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const config = {
|
|
126
|
-
method: "getMiniProfileUser",
|
|
127
|
-
params: __params,
|
|
128
|
-
cookies: __cookies,
|
|
129
|
-
is_static: false,
|
|
130
|
-
};
|
|
131
|
-
return await doRequest(config);
|
|
110
|
+
getMiniProfileUser() {
|
|
111
|
+
return this._miniProfileUser;
|
|
132
112
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const config = {
|
|
136
|
-
method: "getSessionid",
|
|
137
|
-
params: __params,
|
|
138
|
-
cookies: __cookies,
|
|
139
|
-
is_static: false,
|
|
140
|
-
};
|
|
141
|
-
return await doRequest(config);
|
|
113
|
+
getSessionid() {
|
|
114
|
+
return this._sessionId;
|
|
142
115
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const config = {
|
|
146
|
-
method: "getSteamMachineAuth",
|
|
147
|
-
params: __params,
|
|
148
|
-
cookies: __cookies,
|
|
149
|
-
is_static: false,
|
|
150
|
-
};
|
|
151
|
-
return await doRequest(config);
|
|
116
|
+
getSteamMachineAuth() {
|
|
117
|
+
return this._steamMachineAuth;
|
|
152
118
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const config = {
|
|
156
|
-
method: "getSteamUserProfileURL",
|
|
157
|
-
params: __params,
|
|
158
|
-
cookies: __cookies,
|
|
159
|
-
is_static: false,
|
|
160
|
-
};
|
|
161
|
-
return await doRequest(config);
|
|
119
|
+
getSteamUserProfileURL(steamId) {
|
|
120
|
+
return `profiles/${steamId}`;
|
|
162
121
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
cookies: __cookies,
|
|
169
|
-
is_static: false,
|
|
170
|
-
};
|
|
171
|
-
return await doRequest(config);
|
|
122
|
+
getMyProfileURL() {
|
|
123
|
+
if (this._customURL) {
|
|
124
|
+
return `id/${this._customURL}`;
|
|
125
|
+
}
|
|
126
|
+
return "my";
|
|
172
127
|
}
|
|
173
128
|
async getUserSummary(steamId) {
|
|
174
129
|
const { __params, __cookies } = formatParams([steamId], this._cookies);
|
|
@@ -190,46 +145,6 @@ export default class RemoteSteamUser {
|
|
|
190
145
|
};
|
|
191
146
|
return await doRequest(config);
|
|
192
147
|
}
|
|
193
|
-
async _httpRequest(params) {
|
|
194
|
-
const { __params, __cookies } = formatParams([params], this._cookies);
|
|
195
|
-
const config = {
|
|
196
|
-
method: "_httpRequest",
|
|
197
|
-
params: __params,
|
|
198
|
-
cookies: __cookies,
|
|
199
|
-
is_static: false,
|
|
200
|
-
};
|
|
201
|
-
return await doRequest(config);
|
|
202
|
-
}
|
|
203
|
-
async _httpMyRequest(params) {
|
|
204
|
-
const { __params, __cookies } = formatParams([params], this._cookies);
|
|
205
|
-
const config = {
|
|
206
|
-
method: "_httpMyRequest",
|
|
207
|
-
params: __params,
|
|
208
|
-
cookies: __cookies,
|
|
209
|
-
is_static: false,
|
|
210
|
-
};
|
|
211
|
-
return await doRequest(config);
|
|
212
|
-
}
|
|
213
|
-
async _httpRequestAjax(params) {
|
|
214
|
-
const { __params, __cookies } = formatParams([params], this._cookies);
|
|
215
|
-
const config = {
|
|
216
|
-
method: "_httpRequestAjax",
|
|
217
|
-
params: __params,
|
|
218
|
-
cookies: __cookies,
|
|
219
|
-
is_static: false,
|
|
220
|
-
};
|
|
221
|
-
return await doRequest(config);
|
|
222
|
-
}
|
|
223
|
-
async _httpMyRequestAjax(params) {
|
|
224
|
-
const { __params, __cookies } = formatParams([params], this._cookies);
|
|
225
|
-
const config = {
|
|
226
|
-
method: "_httpMyRequestAjax",
|
|
227
|
-
params: __params,
|
|
228
|
-
cookies: __cookies,
|
|
229
|
-
is_static: false,
|
|
230
|
-
};
|
|
231
|
-
return await doRequest(config);
|
|
232
|
-
}
|
|
233
148
|
async getQuickInviteData() {
|
|
234
149
|
const { __params, __cookies } = formatParams([], this._cookies);
|
|
235
150
|
const config = {
|
|
@@ -1410,7 +1325,6 @@ export default class RemoteSteamUser {
|
|
|
1410
1325
|
};
|
|
1411
1326
|
return await doRequest(config);
|
|
1412
1327
|
}
|
|
1413
|
-
|
|
1414
1328
|
async deauthorizeAllDevices() {
|
|
1415
1329
|
const { __params, __cookies } = formatParams([], this._cookies);
|
|
1416
1330
|
const config = {
|