steamutils 1.3.48 → 1.3.50

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.
Files changed (2) hide show
  1. package/SteamClient.js +14 -18
  2. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -2296,20 +2296,16 @@ export function increaseCSGO_VER() {
2296
2296
  }
2297
2297
 
2298
2298
  SteamClient.isAccountPlayable = async function isAccountPlayable(params, timeoutMs) {
2299
- let clientJsToken = params.clientJsToken;
2300
- delete params.clientJsToken;
2301
- if (!clientJsToken && params.cookie) {
2302
- clientJsToken = await new SteamUser(typeof params.cookie === "function" ? await params.cookie() : params.cookie).getClientJsToken();
2299
+ if (!params.clientJsToken && params.cookie) {
2300
+ params.clientJsToken = await new SteamUser(typeof params.cookie === "function" ? await params.cookie() : params.cookie).getClientJsToken();
2303
2301
  }
2304
- if (clientJsToken?.logged_in !== true) {
2305
- return false;
2302
+ if (params.clientJsToken?.logged_in !== true) {
2303
+ return { invalidClientJsToken: true };
2306
2304
  }
2307
- params.clientJsToken = clientJsToken;
2308
-
2309
2305
  return await new Promise((resolve) => {
2310
2306
  const timeouts = [
2311
2307
  setTimeout(() => {
2312
- doResolve();
2308
+ doResolve({ timedOut: true });
2313
2309
  }, timeoutMs || 30000),
2314
2310
  ];
2315
2311
 
@@ -2324,33 +2320,33 @@ SteamClient.isAccountPlayable = async function isAccountPlayable(params, timeout
2324
2320
  });
2325
2321
 
2326
2322
  steamClient.onEvent("error", ({ eresult, msg, error }) => {
2327
- doResolve();
2323
+ doResolve({ eresult, msg, error });
2328
2324
  });
2329
2325
 
2330
2326
  steamClient.onEvent("csgoOnline", (ClientWelcome) => {
2331
- doResolve(ClientWelcome);
2327
+ doResolve({ playable: true });
2332
2328
  });
2333
2329
 
2334
2330
  steamClient.onEvent("csgoClientHello", (ClientHello) => {
2335
- doResolve(ClientHello);
2331
+ doResolve({ playable: true });
2336
2332
  });
2337
2333
 
2338
2334
  steamClient.onEvent("playingState", ({ playing_blocked, playing_app }) => {
2339
2335
  if (playing_blocked) {
2340
- doResolve();
2336
+ doResolve({ playable: false });
2341
2337
  } else {
2342
2338
  timeouts.push(
2343
2339
  setTimeout(function () {
2344
2340
  const isBlocked = steamClient.isPlayingBlocked();
2345
- doResolve(!isBlocked);
2341
+ doResolve({ playable: !isBlocked });
2346
2342
  }, 5000),
2347
2343
  );
2348
2344
  }
2349
2345
  });
2350
2346
 
2351
- steamClient.onEvent("fatalError", () => {
2352
- doResolve();
2353
- });
2347
+ // steamClient.onEvent("fatalError", () => {
2348
+ // doResolve();
2349
+ // });
2354
2350
 
2355
2351
  steamClient.init();
2356
2352
 
@@ -2359,7 +2355,7 @@ SteamClient.isAccountPlayable = async function isAccountPlayable(params, timeout
2359
2355
  steamClient.doClearIntervals();
2360
2356
  steamClient.offAllEvent();
2361
2357
  steamClient.logOff();
2362
- return resolve(!!data);
2358
+ return resolve(data);
2363
2359
  }
2364
2360
  });
2365
2361
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.48",
3
+ "version": "1.3.50",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.5",