steamutils 1.3.57 → 1.3.59
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +25 -7
- package/create_remote_file.js +57 -55
- package/index.js +6426 -6433
- package/package.json +1 -1
- package/remote.js +1782 -1434
- package/test_steamclient.js +2 -3
package/SteamClient.js
CHANGED
@@ -1741,7 +1741,7 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
|
|
1741
1741
|
}
|
1742
1742
|
}
|
1743
1743
|
|
1744
|
-
|
1744
|
+
function logOff() {
|
1745
1745
|
isLogOff = true;
|
1746
1746
|
logOffEvent?.(true);
|
1747
1747
|
steamClient.logOff();
|
@@ -2327,11 +2327,14 @@ export function increaseCSGO_VER() {
|
|
2327
2327
|
return ++CSGO_VER;
|
2328
2328
|
}
|
2329
2329
|
|
2330
|
-
SteamClient.isAccountPlayable = async function isAccountPlayable(
|
2331
|
-
if (!
|
2332
|
-
|
2330
|
+
SteamClient.isAccountPlayable = async function isAccountPlayable({ cookie, clientJsToken, timeoutMs, onPlayable, onNotPlayable }) {
|
2331
|
+
if (!clientJsToken && cookie) {
|
2332
|
+
clientJsToken = await new SteamUser(typeof cookie === "function" ? await cookie() : cookie).getClientJsToken();
|
2333
2333
|
}
|
2334
|
-
if (
|
2334
|
+
if (clientJsToken?.logged_in !== true) {
|
2335
|
+
if (typeof onNotPlayable === "function") {
|
2336
|
+
await onNotPlayable(null);
|
2337
|
+
}
|
2335
2338
|
return { invalidClientJsToken: true };
|
2336
2339
|
}
|
2337
2340
|
return await new Promise((resolve) => {
|
@@ -2348,7 +2351,7 @@ SteamClient.isAccountPlayable = async function isAccountPlayable(params, timeout
|
|
2348
2351
|
isInvisible: false,
|
2349
2352
|
MAX_GAME_PLAY: 10,
|
2350
2353
|
games: 730,
|
2351
|
-
|
2354
|
+
clientJsToken,
|
2352
2355
|
});
|
2353
2356
|
|
2354
2357
|
steamClient.onEvent("error", ({ eresult, msg, error }) => {
|
@@ -2382,10 +2385,25 @@ SteamClient.isAccountPlayable = async function isAccountPlayable(params, timeout
|
|
2382
2385
|
|
2383
2386
|
steamClient.init();
|
2384
2387
|
|
2385
|
-
function doResolve(data) {
|
2388
|
+
async function doResolve(data) {
|
2386
2389
|
timeouts.forEach((timeout) => clearTimeout(timeout));
|
2387
2390
|
steamClient.doClearIntervals();
|
2388
2391
|
steamClient.offAllEvent();
|
2392
|
+
|
2393
|
+
if (data?.playable === true) {
|
2394
|
+
if (typeof onPlayable === "function") {
|
2395
|
+
try {
|
2396
|
+
await onPlayable(steamClient);
|
2397
|
+
} catch (e) {}
|
2398
|
+
}
|
2399
|
+
} else {
|
2400
|
+
if (typeof onNotPlayable === "function") {
|
2401
|
+
try {
|
2402
|
+
await onNotPlayable(steamClient);
|
2403
|
+
} catch (e) {}
|
2404
|
+
}
|
2405
|
+
}
|
2406
|
+
|
2389
2407
|
steamClient.logOff();
|
2390
2408
|
return resolve(data);
|
2391
2409
|
}
|
package/create_remote_file.js
CHANGED
@@ -1,55 +1,57 @@
|
|
1
|
-
import SteamUser from "./index.js";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
if(
|
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
|
-
|
1
|
+
import SteamUser from "./index.js";
|
2
|
+
import _ from "lodash";
|
3
|
+
|
4
|
+
(async function () {
|
5
|
+
const xx = SteamUser;
|
6
|
+
|
7
|
+
let json = "";
|
8
|
+
|
9
|
+
function doWrite(user, is_static) {
|
10
|
+
for (const methodName of Object.getOwnPropertyNames(user)) {
|
11
|
+
if (methodName === "constructor" || methodName === "length" || methodName === "name" || methodName === "prototype" || methodName === "RequestXML_TooManyRequests" || methodName === "MAX_RETRY") {
|
12
|
+
continue;
|
13
|
+
}
|
14
|
+
const fnString = user[methodName].toString().trim();
|
15
|
+
const async = "async";
|
16
|
+
// const async = fnString.startsWith("async") ? "async" : "";
|
17
|
+
let params = fnString.split("(")[1].split(")")[0];
|
18
|
+
const paramsList = params.split(",");
|
19
|
+
for (let i = 0; i < paramsList.length; i++) {
|
20
|
+
if (paramsList[i].includes("=")) {
|
21
|
+
paramsList[i] = paramsList[i].split("=")[0].trim();
|
22
|
+
}
|
23
|
+
}
|
24
|
+
params = paramsList.join(", ").trim();
|
25
|
+
if (params.startsWith("{") && !params.endsWith("}")) {
|
26
|
+
params = `${params}}`;
|
27
|
+
}
|
28
|
+
|
29
|
+
json += `${`
|
30
|
+
${is_static ? "static " : ""} ${async} ${methodName}(${params}){
|
31
|
+
const __params = [${params}];
|
32
|
+
if(__params.length === 1 && __params[0] === undefined){
|
33
|
+
__params.length = 0
|
34
|
+
}
|
35
|
+
|
36
|
+
try {
|
37
|
+
const result = (
|
38
|
+
await axios.post(getAppURL(), {
|
39
|
+
method: "${methodName}",
|
40
|
+
params: __params,
|
41
|
+
cookies: this._cookies,
|
42
|
+
is_static: ${!!is_static}
|
43
|
+
})
|
44
|
+
).data?.result;
|
45
|
+
return result
|
46
|
+
} catch (e) {
|
47
|
+
/* empty */
|
48
|
+
}
|
49
|
+
}`.trim()}\n`;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
doWrite(SteamUser.prototype, false);
|
54
|
+
doWrite(SteamUser, true);
|
55
|
+
|
56
|
+
console.log("");
|
57
|
+
})();
|