steamutils 1.4.85 → 1.4.87
Sign up to get free protection for your applications and to get access to all the features.
- package/create_remote_file.js +2 -1
- package/index.js +27 -32
- package/package.json +1 -1
- package/remote.js +3 -1
package/create_remote_file.js
CHANGED
@@ -80,7 +80,8 @@ const MAX_RETRY = 5;
|
|
80
80
|
|
81
81
|
async function doRequest(config){
|
82
82
|
for (let i = 0; i < MAX_RETRY; i++) {
|
83
|
-
|
83
|
+
let url = getAppURL();
|
84
|
+
url = [url.replace(/\\/$/, ""), config.method].join("/");
|
84
85
|
|
85
86
|
try {
|
86
87
|
const response = await axios.post(url, config);
|
package/index.js
CHANGED
@@ -1266,6 +1266,29 @@ export default class SteamUser {
|
|
1266
1266
|
);
|
1267
1267
|
|
1268
1268
|
if (response) {
|
1269
|
+
const html = response?.data;
|
1270
|
+
if (html && typeof html === "string") {
|
1271
|
+
const $ = cheerio.load(html.replaceAll(/[\t\n\r]/gi, "").trim());
|
1272
|
+
const title = $("head > title").text().trim();
|
1273
|
+
const errorMsg = $("#error_msg").text().trim();
|
1274
|
+
const headline = $("#headline").text().trim();
|
1275
|
+
|
1276
|
+
if (title && SteamErrorTitle.includes(title)) {
|
1277
|
+
return new ResponseError({
|
1278
|
+
message: errorMsg || "Steam Community :: Error",
|
1279
|
+
steamId: self._steamIdUser,
|
1280
|
+
originalURL,
|
1281
|
+
});
|
1282
|
+
} else if (title === "Error" && headline === "Something Went Wrong") {
|
1283
|
+
return new ResponseError({
|
1284
|
+
message: headline,
|
1285
|
+
detail: $("#message").text().trim(),
|
1286
|
+
steamId: self._steamIdUser,
|
1287
|
+
originalURL,
|
1288
|
+
});
|
1289
|
+
}
|
1290
|
+
}
|
1291
|
+
|
1269
1292
|
switch (response.status) {
|
1270
1293
|
case 302: {
|
1271
1294
|
if (isRedirect) {
|
@@ -1298,38 +1321,10 @@ export default class SteamUser {
|
|
1298
1321
|
break;
|
1299
1322
|
}
|
1300
1323
|
case 200: {
|
1301
|
-
const
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
const title = $("head > title").text().trim();
|
1306
|
-
const errorMsg = $("#error_msg").text().trim();
|
1307
|
-
const headline = $("#headline").text().trim();
|
1308
|
-
|
1309
|
-
if (title && SteamErrorTitle.includes(title)) {
|
1310
|
-
isError = true;
|
1311
|
-
response = new ResponseError({
|
1312
|
-
message: errorMsg || "Steam Community :: Error",
|
1313
|
-
steamId: self._steamIdUser,
|
1314
|
-
originalURL,
|
1315
|
-
});
|
1316
|
-
} else if (title === "Error" && headline === "Something Went Wrong") {
|
1317
|
-
isError = true;
|
1318
|
-
response = new ResponseError({
|
1319
|
-
message: headline,
|
1320
|
-
detail: $("#message").text().trim(),
|
1321
|
-
steamId: self._steamIdUser,
|
1322
|
-
originalURL,
|
1323
|
-
});
|
1324
|
-
}
|
1325
|
-
}
|
1326
|
-
|
1327
|
-
if (!isError) {
|
1328
|
-
const indexCookie = self._cookies.indexOf(cookie);
|
1329
|
-
if (indexCookie > -1 && indexCookie !== 0) {
|
1330
|
-
self._cookies.splice(indexCookie);
|
1331
|
-
self._cookies.unshift(cookie);
|
1332
|
-
}
|
1324
|
+
const indexCookie = self._cookies.indexOf(cookie);
|
1325
|
+
if (indexCookie > -1 && indexCookie !== 0) {
|
1326
|
+
self._cookies.splice(indexCookie);
|
1327
|
+
self._cookies.unshift(cookie);
|
1333
1328
|
}
|
1334
1329
|
|
1335
1330
|
return response;
|
package/package.json
CHANGED
package/remote.js
CHANGED
@@ -36,7 +36,8 @@ const MAX_RETRY = 5;
|
|
36
36
|
|
37
37
|
async function doRequest(config) {
|
38
38
|
for (let i = 0; i < MAX_RETRY; i++) {
|
39
|
-
|
39
|
+
let url = getAppURL();
|
40
|
+
url = [url.replace(/\/$/, ""), config.method].join("/");
|
40
41
|
|
41
42
|
try {
|
42
43
|
const response = await axios.post(url, config);
|
@@ -1409,6 +1410,7 @@ export default class RemoteSteamUser {
|
|
1409
1410
|
};
|
1410
1411
|
return await doRequest(config);
|
1411
1412
|
}
|
1413
|
+
|
1412
1414
|
async deauthorizeAllDevices() {
|
1413
1415
|
const { __params, __cookies } = formatParams([], this._cookies);
|
1414
1416
|
const config = {
|