steamutils 1.3.54 → 1.3.55
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 +16 -18
- package/index.js +34 -14
- package/package.json +2 -2
- package/test_steamclient.js +1 -1
package/SteamClient.js
CHANGED
|
@@ -1696,15 +1696,14 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
|
|
|
1696
1696
|
|
|
1697
1697
|
async function login(reconnect = false) {
|
|
1698
1698
|
function logOn(clientJsToken) {
|
|
1699
|
-
|
|
1700
|
-
|
|
1699
|
+
try {
|
|
1700
|
+
steamClient.logOn({
|
|
1701
|
+
...clientJsToken,
|
|
1701
1702
|
steamId: new SteamID(clientJsToken.steamid),
|
|
1703
|
+
steamID: new SteamID(clientJsToken.steamid),
|
|
1702
1704
|
accountName: clientJsToken.account_name,
|
|
1703
1705
|
webLogonToken: clientJsToken.token,
|
|
1704
1706
|
});
|
|
1705
|
-
}
|
|
1706
|
-
try {
|
|
1707
|
-
steamClient.logOn(clientJsToken);
|
|
1708
1707
|
return true;
|
|
1709
1708
|
} catch (e) {
|
|
1710
1709
|
console.error(e);
|
|
@@ -1714,11 +1713,10 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
|
|
|
1714
1713
|
|
|
1715
1714
|
if (clientJsToken?.logged_in === true) {
|
|
1716
1715
|
log(reconnect ? "reconnect with clientJsToken" : "login with clientJsToken");
|
|
1717
|
-
return logOn(clientJsToken);
|
|
1718
1716
|
setTimeout(function () {
|
|
1719
1717
|
clientJsToken = null;
|
|
1720
1718
|
}, 1000);
|
|
1721
|
-
return
|
|
1719
|
+
return logOn(clientJsToken);
|
|
1722
1720
|
} else if (cookie) {
|
|
1723
1721
|
log(reconnect ? "reconnect with cookie" : "login with cookie");
|
|
1724
1722
|
const _clientJsToken = await new SteamUser(typeof cookie === "function" ? await cookie() : cookie).getClientJsToken();
|
|
@@ -1763,18 +1761,18 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
|
|
|
1763
1761
|
}
|
|
1764
1762
|
}
|
|
1765
1763
|
|
|
1766
|
-
function init() {
|
|
1764
|
+
async function init() {
|
|
1767
1765
|
bindEvent();
|
|
1768
|
-
login()
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
}
|
|
1766
|
+
if (await login()) {
|
|
1767
|
+
steamClient._handlerManager.add(Protos.csgo.EMsg.k_EMsgClientRequestedClientStats, function (payload) {
|
|
1768
|
+
const result = protoDecode(Protos.csgo.CMsgClientRequestedClientStats, payload.toBuffer());
|
|
1769
|
+
// console.log("CMsgClientRequestedClientStats", result);
|
|
1770
|
+
});
|
|
1771
|
+
steamClient._handlerManager.add(Protos.csgo.EMsg.k_EMsgClientMMSLobbyData, function (payload) {
|
|
1772
|
+
const result = protoDecode(Protos.csgo.CMsgClientMMSLobbyData, payload.toBuffer());
|
|
1773
|
+
// console.log("CMsgClientMMSLobbyData", result, result.metadata);
|
|
1774
|
+
});
|
|
1775
|
+
}
|
|
1778
1776
|
}
|
|
1779
1777
|
|
|
1780
1778
|
function partyRegister() {
|
package/index.js
CHANGED
|
@@ -2093,19 +2093,45 @@ export default class SteamUser {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
|
|
2095
2095
|
async getClientJsToken(retry = null) {
|
|
2096
|
+
function returnAlter(userinfo) {
|
|
2097
|
+
return userinfo
|
|
2098
|
+
? {
|
|
2099
|
+
...userinfo,
|
|
2100
|
+
steamId: new SteamID(userinfo.steamid),
|
|
2101
|
+
steamID: new SteamID(userinfo.steamid),
|
|
2102
|
+
accountName: userinfo.account_name,
|
|
2103
|
+
webLogonToken: userinfo.token,
|
|
2104
|
+
}
|
|
2105
|
+
: null;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
const html = (await this._httpRequest("chat"))?.data;
|
|
2109
|
+
const userinfo = cheerio
|
|
2110
|
+
.load(html || "")("#webui_config")
|
|
2111
|
+
.data("userinfo");
|
|
2112
|
+
if (userinfo?.logged_in === true) {
|
|
2113
|
+
return returnAlter(userinfo);
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
const exampleUserinfo = {
|
|
2117
|
+
logged_in: true,
|
|
2118
|
+
steamid: "76561199040402348",
|
|
2119
|
+
accountid: 1080136620,
|
|
2120
|
+
account_name: "henry22230",
|
|
2121
|
+
is_support: false,
|
|
2122
|
+
is_limited: false,
|
|
2123
|
+
is_partner_member: false,
|
|
2124
|
+
country_code: "VN",
|
|
2125
|
+
token: "tpXZZcmhvw4AAAAAAAAAAAAAAAAAAAAAAwCNGElboy44N8CqQzVFAkX4",
|
|
2126
|
+
token_use_id: "432e9779bcc4c2bf39022031",
|
|
2127
|
+
};
|
|
2128
|
+
|
|
2096
2129
|
const result = (await this._httpRequest("chat/clientjstoken"))?.data;
|
|
2097
2130
|
if (result instanceof ResponseError) {
|
|
2098
2131
|
return result;
|
|
2099
2132
|
}
|
|
2100
|
-
if (!result?.steamid) {
|
|
2101
|
-
if (retry !== null && retry !== undefined && retry >= 0) {
|
|
2102
|
-
await sleep(2000);
|
|
2103
|
-
return await this.getClientJsToken(retry - 1);
|
|
2104
|
-
} else {
|
|
2105
|
-
return null;
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
2133
|
|
|
2134
|
+
return returnAlter(result);
|
|
2109
2135
|
const dataExample = {
|
|
2110
2136
|
logged_in: true,
|
|
2111
2137
|
steamid: "76561199040402348",
|
|
@@ -2113,12 +2139,6 @@ export default class SteamUser {
|
|
|
2113
2139
|
account_name: "henry22230",
|
|
2114
2140
|
token: "1o7xYpbcmTsAAAAAAAAAAAAAAAAAAAAAAwCf6fVEGxM9H7Tnk5oW5QPI",
|
|
2115
2141
|
};
|
|
2116
|
-
|
|
2117
|
-
return Object.assign(result, {
|
|
2118
|
-
steamId: new SteamID(result.steamid),
|
|
2119
|
-
accountName: result.account_name,
|
|
2120
|
-
webLogonToken: result.token,
|
|
2121
|
-
});
|
|
2122
2142
|
}
|
|
2123
2143
|
|
|
2124
2144
|
getClientLogonToken = this.getClientJsToken;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "steamutils",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.55",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"alpha-common-utils": "^1.0.6",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"crypto-js": "^4.2.0",
|
|
11
11
|
"csgo-friendcode": "^3.0.3",
|
|
12
12
|
"form-data": "^4.0.0",
|
|
13
|
-
"jimp": "^0.22.
|
|
13
|
+
"jimp": "^0.22.12",
|
|
14
14
|
"lodash": "^4.17.21",
|
|
15
15
|
"moment": "^2.30.1",
|
|
16
16
|
"moment-timezone": "^0.5.45",
|
package/test_steamclient.js
CHANGED
|
@@ -2,7 +2,7 @@ import SteamClient from "./SteamClient.js";
|
|
|
2
2
|
|
|
3
3
|
(async function () {
|
|
4
4
|
const steamClient = new SteamClient({
|
|
5
|
-
cookie: "steamLoginSecure=
|
|
5
|
+
cookie: "timezoneOffset=25200,0; _ga=GA1.2.51100933.1683654836; browserid=2699389310852036147; rgDiscussionPrefs=%7B%22cTopicRepliesPerPage%22%3A50%7D; wants_mature_content_apps=218640|1599340; strInventoryLastContext=730_2; steamLoginSecure=76561199040402348%7C%7CeyAidHlwIjogIkpXVCIsICJhbGciOiAiRWREU0EiIH0.eyAiaXNzIjogInI6MUI0Ql8yM0Y3MUE1MV8wNjRDMSIsICJzdWIiOiAiNzY1NjExOTkwNDA0MDIzNDgiLCAiYXVkIjogWyAid2ViOmNvbW11bml0eSIgXSwgImV4cCI6IDE3MDg3NzcyNTgsICJuYmYiOiAxNzAwMDUwMzkxLCAiaWF0IjogMTcwODY5MDM5MSwgImp0aSI6ICIwRUUxXzIzRkVEN0YxXzczNjVEIiwgIm9hdCI6IDE3MDgyNDUxNjAsICJydF9leHAiOiAxNzI2MTg5NzEyLCAicGVyIjogMCwgImlwX3N1YmplY3QiOiAiMTQuMTkxLjE2Ny4yMDEiLCAiaXBfY29uZmlybWVyIjogIjE0LjE5MS4xNjcuMjAxIiB9.dkeAiPn2YX3S60olBHLL7cbQVAbDvqjgAmKpnLaKiiQIglks6z590YW-4wLPLCKl-uExgf_gtd_JrKk3qZkWAQ; recentlyVisitedAppHubs=218640%2C1568590%2C413850%2C1580960%2C221410%2C346110%2C2529120%2C552540%2C1203220%2C264710%2C1599340%2C439700%2C1085660%2C730%2C440; sessionid=e5fbb58bfa8c18fd51891d24",
|
|
6
6
|
isAutoPlay: true,
|
|
7
7
|
// password: "VitGa_23",
|
|
8
8
|
// twoFactorCode: "99B9G",
|