steamutils 1.4.15 → 1.4.17
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +1 -1
- package/index.js +25 -4
- package/package.json +1 -1
- package/test_steamclient.js +1 -1
- package/utils.js +13 -0
package/SteamClient.js
CHANGED
@@ -1727,7 +1727,7 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
|
|
1727
1727
|
}
|
1728
1728
|
|
1729
1729
|
if (clientJsToken?.logged_in === true) {
|
1730
|
-
log(reconnect ? "reconnect with clientJsToken" : "login with clientJsToken");
|
1730
|
+
log(`[${clientJsToken.steamid}] ${reconnect ? "reconnect with clientJsToken" : "login with clientJsToken"}`);
|
1731
1731
|
setTimeout(function () {
|
1732
1732
|
clientJsToken = null;
|
1733
1733
|
}, 1000);
|
package/index.js
CHANGED
@@ -3359,7 +3359,7 @@ export default class SteamUser {
|
|
3359
3359
|
return groupList;
|
3360
3360
|
const resultExample = [
|
3361
3361
|
{
|
3362
|
-
id:
|
3362
|
+
id: "54645654",
|
3363
3363
|
avatarHash: "71213b7e643da6216b1f8d8a381fc09b7c1932ef",
|
3364
3364
|
avatar: "https://avatars.cloudflare.steamstatic.com/71213b7e643da6216b1f8d8a381fc09b7c1932ef.jpg",
|
3365
3365
|
name: "♔⌒Natri",
|
@@ -3408,7 +3408,7 @@ export default class SteamUser {
|
|
3408
3408
|
};
|
3409
3409
|
const successExample = {
|
3410
3410
|
results: "OK",
|
3411
|
-
groupId:
|
3411
|
+
groupId: "5464596",
|
3412
3412
|
};
|
3413
3413
|
}
|
3414
3414
|
|
@@ -6052,8 +6052,8 @@ export default class SteamUser {
|
|
6052
6052
|
}
|
6053
6053
|
const $ = cheerio.load(data);
|
6054
6054
|
const text = StringUtils.cleanSpace($(".help_event_limiteduser .help_event_limiteduser_spend").text());
|
6055
|
-
if (text?.startsWith("Amount Spent on Steam")) {
|
6056
|
-
return text;
|
6055
|
+
if (text?.startsWith("Amount Spent on Steam:")) {
|
6056
|
+
return text.replaceAll("Amount Spent on Steam:", "").trim(); //$0.00 / $5.00 USD
|
6057
6057
|
} else {
|
6058
6058
|
return null;
|
6059
6059
|
}
|
@@ -7300,6 +7300,27 @@ export default class SteamUser {
|
|
7300
7300
|
}
|
7301
7301
|
return tokens.some((token) => token.token_id == tokenId);
|
7302
7302
|
}
|
7303
|
+
|
7304
|
+
async enumerateTokenLastSeenMs(accessToken, platform_type) {
|
7305
|
+
const tokens = (await this.enumerateTokens(accessToken))?.response?.refresh_tokens;
|
7306
|
+
if (!Array.isArray(tokens) || !tokens.length) {
|
7307
|
+
return null;
|
7308
|
+
}
|
7309
|
+
const platformTypeToken = tokens.filter(function (token) {
|
7310
|
+
return token.platform_type === platform_type;
|
7311
|
+
});
|
7312
|
+
if (!platformTypeToken.length) {
|
7313
|
+
return 0;
|
7314
|
+
}
|
7315
|
+
return (
|
7316
|
+
Math.max(
|
7317
|
+
...platformTypeToken.map(function (token) {
|
7318
|
+
return token.last_seen?.time || token.first_seen?.time;
|
7319
|
+
}),
|
7320
|
+
) * 1000
|
7321
|
+
);
|
7322
|
+
}
|
7323
|
+
|
7303
7324
|
async queryRefreshTokenByID(accessToken, tokenId) {
|
7304
7325
|
const Protos = helpers([
|
7305
7326
|
{
|
package/package.json
CHANGED
package/test_steamclient.js
CHANGED
@@ -13,7 +13,7 @@ import SteamID from "steamid";
|
|
13
13
|
// console.log(loginResult.cookie);
|
14
14
|
// const user = new SteamUser(loginResult.cookie)
|
15
15
|
|
16
|
-
const cookie = "
|
16
|
+
const cookie = "";
|
17
17
|
const steamClient = new SteamClient({
|
18
18
|
cookie,
|
19
19
|
isAutoPlay: true,
|
package/utils.js
CHANGED
@@ -153,3 +153,16 @@ export const secretAsBuffer = (sharedSecret) => {
|
|
153
153
|
// It must be base64
|
154
154
|
return Buffer.from(sharedSecret, "base64");
|
155
155
|
};
|
156
|
+
|
157
|
+
export function decodeLoginQrUrl(qrUrl) {
|
158
|
+
if (!qrUrl || typeof qrUrl !== "string") {
|
159
|
+
return null;
|
160
|
+
}
|
161
|
+
const match = qrUrl.match(/^https?:\/\/s\.team\/q\/(\d+)\/(\d+)(\?|$)/);
|
162
|
+
if (!match) {
|
163
|
+
console.log("Invalid QR code URL");
|
164
|
+
return null;
|
165
|
+
}
|
166
|
+
|
167
|
+
return { clientId: match[2], version: parseInt(match[1], 10) };
|
168
|
+
}
|