steamutils 1.3.61 → 1.3.63
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +71 -2
- package/package.json +2 -1
package/index.js
CHANGED
@@ -21,6 +21,8 @@ import Jimp from "jimp";
|
|
21
21
|
import path from "path";
|
22
22
|
import CookieManager from "./CookieManager.js";
|
23
23
|
import { AppID_CSGO, E1GameBanOnRecord, E1VACBanOnRecord, EActivityType, ECommentPrivacyState, ECurrentlyTradeBanned, EdaySinceLastBanRegExp, EFriendRelationship, ELanguage, EmptyProfileSummary, EMultipleGameBansOnRecord, EMultipleVACBansOnRecord, EPrivacyState, ErrorProcessingRequest, FRIEND_CODE_REPLACEMENTS, NotYetSetupProfileTextList, PrivacySettings, PrivateProfileTextList, SteamcommunityURL, SteamErrorTitle, SteamImageCDN } from "./const.js";
|
24
|
+
import SteamCommunity from "steamcommunity";
|
25
|
+
import SteamTotp from "steam-totp";
|
24
26
|
|
25
27
|
let requestTimestamp = 0;
|
26
28
|
let tooManyRequestTimestamp = 0;
|
@@ -2717,8 +2719,8 @@ export default class SteamUser {
|
|
2717
2719
|
personaName: personaName === null ? profileEdit.strPersonaName : personaName,
|
2718
2720
|
real_name: realName === null ? profileEdit.strRealName : realName,
|
2719
2721
|
customURL: customURL === null ? profileEdit.strCustomURL : customURL,
|
2720
|
-
country: country === null ? profileEdit.LocationData.locCountryCode : country,
|
2721
|
-
state: profileEdit.LocationData.locStateCode,
|
2722
|
+
country: country === null ? profileEdit.LocationData.locCountryCode : country, //VN
|
2723
|
+
state: profileEdit.LocationData.locStateCode, //52 (Ho Chi Minh) | 51 Ha Noi
|
2722
2724
|
city: profileEdit.LocationData.locCityCode,
|
2723
2725
|
summary: summary || profileEdit.strSummary,
|
2724
2726
|
hide_profile_awards: hide_profile_awards === null ? profileEdit.ProfilePreferences.hide_profile_awards : hide_profile_awards ? "1" : "0",
|
@@ -6406,6 +6408,73 @@ export default class SteamUser {
|
|
6406
6408
|
return headerEl[0].children.map((el) => $(el).text().trim()).filter(Boolean);
|
6407
6409
|
} catch (e) {}
|
6408
6410
|
}
|
6411
|
+
|
6412
|
+
async acceptConfirmationForObject(accessToken, identitySecret, objectID) {
|
6413
|
+
let error = null;
|
6414
|
+
for (const cookie of this._cookies) {
|
6415
|
+
try {
|
6416
|
+
const community = new SteamCommunity();
|
6417
|
+
community.setCookies(cookie.toString().split(";"));
|
6418
|
+
community.oAuthToken = accessToken;
|
6419
|
+
error = await new Promise((resolve) => {
|
6420
|
+
community.acceptConfirmationForObject(identitySecret, objectID, resolve);
|
6421
|
+
});
|
6422
|
+
if (!error) {
|
6423
|
+
return {
|
6424
|
+
success: true,
|
6425
|
+
};
|
6426
|
+
}
|
6427
|
+
} catch (e) {}
|
6428
|
+
}
|
6429
|
+
return { error };
|
6430
|
+
}
|
6431
|
+
|
6432
|
+
async getConfirmations(accessToken, identitySecret) {
|
6433
|
+
let error = null;
|
6434
|
+
for (const cookie of this._cookies) {
|
6435
|
+
try {
|
6436
|
+
const community = new SteamCommunity();
|
6437
|
+
community.setCookies(cookie.toString().split(";"));
|
6438
|
+
community.oAuthToken = accessToken;
|
6439
|
+
const time = SteamTotp.time();
|
6440
|
+
const key = SteamTotp.getConfirmationKey(identitySecret, time, "conf");
|
6441
|
+
// err.message === "Not Logged In";
|
6442
|
+
const result = await new Promise((resolve) => {
|
6443
|
+
community.getConfirmations(time, key, function (error, confirmations) {
|
6444
|
+
if (error) {
|
6445
|
+
resolve({ error });
|
6446
|
+
}
|
6447
|
+
resolve({ confirmations });
|
6448
|
+
});
|
6449
|
+
});
|
6450
|
+
if (result?.confirmations) {
|
6451
|
+
return { confirmations: result?.confirmations };
|
6452
|
+
}
|
6453
|
+
if (result?.error) {
|
6454
|
+
error = result.error;
|
6455
|
+
}
|
6456
|
+
} catch (e) {}
|
6457
|
+
}
|
6458
|
+
return { error };
|
6459
|
+
}
|
6460
|
+
|
6461
|
+
async finalizeTwoFactor(accessToken, identitySecret, finalizeTwoFactorCode) {
|
6462
|
+
let error = null;
|
6463
|
+
for (const cookie of this._cookies) {
|
6464
|
+
try {
|
6465
|
+
const community = new SteamCommunity();
|
6466
|
+
community.setCookies(cookie.toString().split(";"));
|
6467
|
+
community.oAuthToken = accessToken;
|
6468
|
+
error = await new Promise((resolve) => {
|
6469
|
+
community.finalizeTwoFactor(identitySecret, finalizeTwoFactorCode, resolve);
|
6470
|
+
});
|
6471
|
+
if (!error) {
|
6472
|
+
return { success: true };
|
6473
|
+
}
|
6474
|
+
} catch (e) {}
|
6475
|
+
}
|
6476
|
+
return { error };
|
6477
|
+
}
|
6409
6478
|
}
|
6410
6479
|
|
6411
6480
|
SteamUser.MAX_RETRY = 10;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "steamutils",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.63",
|
4
4
|
"main": "index.js",
|
5
5
|
"dependencies": {
|
6
6
|
"alpha-common-utils": "^1.0.6",
|
@@ -16,6 +16,7 @@
|
|
16
16
|
"moment-timezone": "^0.5.45",
|
17
17
|
"node-bignumber": "^1.2.2",
|
18
18
|
"steam-session": "^1.7.2",
|
19
|
+
"steam-totp": "^2.1.2",
|
19
20
|
"steam-user": "^5.0.8",
|
20
21
|
"steamcommunity": "^3.48.2",
|
21
22
|
"steamid": "^2.0.0",
|