steamutils 1.3.56 → 1.3.58
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 +21 -7
- package/index.js +6433 -6393
- package/package.json +1 -1
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,21 @@ 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
|
+
await onPlayable(steamClient);
|
|
2396
|
+
}
|
|
2397
|
+
} else {
|
|
2398
|
+
if (typeof onNotPlayable === "function") {
|
|
2399
|
+
await onNotPlayable(steamClient);
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2389
2403
|
steamClient.logOff();
|
|
2390
2404
|
return resolve(data);
|
|
2391
2405
|
}
|