steamutils 1.2.90 → 1.2.91

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/SteamClient.js +11 -4
  2. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -1310,11 +1310,15 @@ function SteamClient({
1310
1310
  }
1311
1311
 
1312
1312
  async function getNewCookie(cookie) {
1313
+ if (!cookie) {
1314
+ return
1315
+ }
1313
1316
  let response = await _getStoreSteamPoweredResponse(cookie)
1314
1317
  if (!response) {
1315
1318
  return
1316
1319
  }
1317
1320
  while (Array.isArray(response?.headers?.["set-cookie"])) {
1321
+ console.log(cookie);
1318
1322
  const cookieObj = cookie.split(';').reduce(function (accumulator, currentValue) {
1319
1323
  accumulator[currentValue.trim().split('=')[0].trim()] = currentValue.trim().split('=')[1].trim()
1320
1324
  return accumulator
@@ -1372,15 +1376,18 @@ function SteamClient({
1372
1376
  }
1373
1377
 
1374
1378
  async function login(reconnect = false) {
1375
- if (clientJsToken?.logged_in) {
1379
+ if (clientJsToken?.logged_in === true) {
1376
1380
  log(reconnect ? 'reconnect with clientJsToken' : 'login with clientJsToken')
1377
1381
  steamClient.logOn(clientJsToken)
1382
+ setTimeout(function () {
1383
+ clientJsToken = null
1384
+ }, 1000)
1378
1385
  return true
1379
1386
  } else if (cookie) {
1380
1387
  log(reconnect ? 'reconnect with cookie' : 'login with cookie')
1381
- const newCookie = await loginWithCookie(cookie)
1382
- if (newCookie) {
1383
- cookie = newCookie
1388
+ const _clientJsToken = await new SteamUtils(typeof cookie === "function" ? await cookie() : cookie).getClientJsToken()
1389
+ if (_clientJsToken?.logged_in === true) {
1390
+ steamClient.logOn(_clientJsToken)
1384
1391
  return true
1385
1392
  } else {
1386
1393
  return false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.2.90",
3
+ "version": "1.2.91",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.5.1",