steamutils 1.0.33 → 1.0.35
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 +25 -6
- package/index.js +13 -0
- package/package.json +2 -1
package/SteamClient.js
CHANGED
@@ -9,6 +9,7 @@ import helpers from "./helpers/protos.js";
|
|
9
9
|
import {fileURLToPath} from "url";
|
10
10
|
import path from "path";
|
11
11
|
import SteamUtils from "./index.js";
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
12
13
|
|
13
14
|
const __filename = fileURLToPath(import.meta.url);
|
14
15
|
const __dirname = path.dirname(__filename);
|
@@ -99,7 +100,26 @@ function SteamClient({
|
|
99
100
|
friendTyping: [],
|
100
101
|
}
|
101
102
|
|
102
|
-
const intervals =
|
103
|
+
const intervals = {}
|
104
|
+
function doSetInterval(cb, timeout, key) {
|
105
|
+
if(!key){
|
106
|
+
key = uuidv4()
|
107
|
+
}
|
108
|
+
if (intervals[key] !== undefined) {
|
109
|
+
try {
|
110
|
+
clearInterval(intervals[key])
|
111
|
+
} catch (e) {
|
112
|
+
}
|
113
|
+
}
|
114
|
+
intervals[key] = setInterval(cb, timeout)
|
115
|
+
}
|
116
|
+
|
117
|
+
function doClearIntervals() {
|
118
|
+
for (const key in intervals) {
|
119
|
+
clearInterval(intervals[key])
|
120
|
+
delete intervals[key]
|
121
|
+
}
|
122
|
+
}
|
103
123
|
|
104
124
|
function getAccountInfoName() {
|
105
125
|
return [steamClient?.accountInfo?.name, steamClient?._logOnDetails?.account_name].filter(Boolean).join(" - ")
|
@@ -202,7 +222,7 @@ function SteamClient({
|
|
202
222
|
function bindEvent() {
|
203
223
|
steamClient.on('disconnected', async (eresult, msg) => {
|
204
224
|
console.log('disconnected', eresult, msg)
|
205
|
-
|
225
|
+
doClearIntervals()
|
206
226
|
})
|
207
227
|
steamClient.on('error', async (e) => {
|
208
228
|
let errorStr = ``
|
@@ -225,7 +245,7 @@ function SteamClient({
|
|
225
245
|
break
|
226
246
|
}
|
227
247
|
console.log('error', e?.message)
|
228
|
-
|
248
|
+
doClearIntervals()
|
229
249
|
})
|
230
250
|
|
231
251
|
steamClient.on('webSession', (sessionID, cookies) => {
|
@@ -790,9 +810,8 @@ function SteamClient({
|
|
790
810
|
getPlayersProfile,
|
791
811
|
autoRequestFreeLicense,
|
792
812
|
playCSGO,
|
793
|
-
|
794
|
-
|
795
|
-
},
|
813
|
+
doSetInterval,
|
814
|
+
doClearIntervals,
|
796
815
|
async gamesPlayed(apps){
|
797
816
|
steamClient.gamesPlayed(apps);
|
798
817
|
await sleep(2000)
|
package/index.js
CHANGED
@@ -1113,6 +1113,13 @@ class SteamUser {
|
|
1113
1113
|
await sleep(60000)
|
1114
1114
|
result = await request(config)
|
1115
1115
|
}
|
1116
|
+
else if (result.status === 401) {
|
1117
|
+
console.log('Unauthorized')
|
1118
|
+
if (params.method.toUpperCase() === 'POST') {
|
1119
|
+
config.headers['Content-Type'] = 'multipart/form-data';
|
1120
|
+
result = await request(config)
|
1121
|
+
}
|
1122
|
+
}
|
1116
1123
|
if(result?.error?.code === 'ERR_FR_TOO_MANY_REDIRECTS') {
|
1117
1124
|
//Maximum number of redirects exceeded
|
1118
1125
|
plsLoginFirst = true
|
@@ -2332,6 +2339,9 @@ class SteamUser {
|
|
2332
2339
|
const {data} = await this._httpRequestAjax({
|
2333
2340
|
url: `${this.getMySteamUserProfileURL()}/ajaxclearaliashistory/`,
|
2334
2341
|
method: 'POST',
|
2342
|
+
headers: {
|
2343
|
+
'Content-Type':'multipart/form-data'
|
2344
|
+
}
|
2335
2345
|
})
|
2336
2346
|
return data
|
2337
2347
|
}
|
@@ -2572,6 +2582,9 @@ class SteamUser {
|
|
2572
2582
|
data: {
|
2573
2583
|
Privacy: JSON.stringify(privacyValue.PrivacySettings),
|
2574
2584
|
eCommentPermission: privacyValue.eCommentPermission
|
2585
|
+
},
|
2586
|
+
headers: {
|
2587
|
+
'Content-Type':'multipart/form-data'
|
2575
2588
|
}
|
2576
2589
|
})
|
2577
2590
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "steamutils",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.35",
|
4
4
|
"dependencies": {
|
5
5
|
"axios": "^1.3.4",
|
6
6
|
"cheerio": "^1.0.0-rc.12",
|
@@ -12,6 +12,7 @@
|
|
12
12
|
"steam-user": "^4.28.1",
|
13
13
|
"steamid": "^2.0.0",
|
14
14
|
"url-parse": "^1.5.10",
|
15
|
+
"uuid": "^9.0.0",
|
15
16
|
"xml-js": "^1.6.11",
|
16
17
|
"xml2js": "^0.4.23"
|
17
18
|
},
|