steamutils 1.2.90 → 1.2.91
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 +11 -4
- 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
|
|
1382
|
-
if (
|
|
1383
|
-
|
|
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
|