steamutils 1.4.7 → 1.4.10
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +43 -28
- package/package.json +1 -1
package/index.js
CHANGED
@@ -6881,33 +6881,40 @@ export default class SteamUser {
|
|
6881
6881
|
return result;
|
6882
6882
|
}
|
6883
6883
|
|
6884
|
-
|
6885
|
-
|
6886
|
-
|
6887
|
-
|
6888
|
-
|
6889
|
-
|
6890
|
-
|
6891
|
-
|
6892
|
-
|
6893
|
-
|
6894
|
-
|
6895
|
-
|
6896
|
-
|
6897
|
-
|
6898
|
-
|
6899
|
-
|
6900
|
-
|
6901
|
-
|
6902
|
-
|
6903
|
-
|
6904
|
-
|
6905
|
-
|
6906
|
-
|
6907
|
-
|
6908
|
-
|
6909
|
-
|
6910
|
-
|
6884
|
+
let accounts = [];
|
6885
|
+
try {
|
6886
|
+
accounts = protoDecode(Protos.csgo.CPlayer_GetPlayerLinkDetails_Response, result.data).accounts || [];
|
6887
|
+
} catch (e) {}
|
6888
|
+
|
6889
|
+
return accounts
|
6890
|
+
.map(function ({ public_data: { sha_digest_avatar, steamid, ...public_data }, private_data: { rich_presence_kv, ...private_data } }) {
|
6891
|
+
if (rich_presence_kv.startsWith(`"rp`)) {
|
6892
|
+
try {
|
6893
|
+
rich_presence_kv = JSON.parse("{" + rich_presence_kv.substringAfter("{").trim().replaceAll("\n\t", ",").replaceAll("\t\t", ":").trim());
|
6894
|
+
} catch (e) {}
|
6895
|
+
}
|
6896
|
+
return {
|
6897
|
+
public_data: {
|
6898
|
+
...public_data,
|
6899
|
+
steamId: steamid.toString(),
|
6900
|
+
avatarHash: sha_digest_avatar.toString("hex"),
|
6901
|
+
},
|
6902
|
+
private_data: {
|
6903
|
+
...private_data,
|
6904
|
+
game_id: private_data.game_id.toNumber(),
|
6905
|
+
game_server_steam_id: private_data.game_server_steam_id.toNumber(),
|
6906
|
+
lobby_steam_id: private_data.lobby_steam_id.toNumber(),
|
6907
|
+
broadcast_session_id: private_data.broadcast_session_id.toNumber(),
|
6908
|
+
rich_presence_kv,
|
6909
|
+
},
|
6910
|
+
};
|
6911
|
+
})
|
6912
|
+
.reduce(function (previousValue, currentValue) {
|
6913
|
+
previousValue[currentValue.public_data.steamId] = currentValue;
|
6914
|
+
return previousValue;
|
6915
|
+
}, {});
|
6916
|
+
const example = {
|
6917
|
+
"76561199243542939": {
|
6911
6918
|
public_data: {
|
6912
6919
|
visibility_state: 3,
|
6913
6920
|
privacy_state: 0,
|
@@ -6950,7 +6957,7 @@ export default class SteamUser {
|
|
6950
6957
|
game_is_private: false,
|
6951
6958
|
},
|
6952
6959
|
},
|
6953
|
-
|
6960
|
+
};
|
6954
6961
|
}
|
6955
6962
|
async getFriendsGameplayInfo(accessToken, appId) {
|
6956
6963
|
if (!appId) {
|
@@ -7260,6 +7267,14 @@ export default class SteamUser {
|
|
7260
7267
|
},
|
7261
7268
|
};
|
7262
7269
|
}
|
7270
|
+
|
7271
|
+
async hasToken(accessToken, tokenId) {
|
7272
|
+
const tokens = (await this.enumerateTokens(accessToken))?.response?.refresh_tokens;
|
7273
|
+
if (!Array.isArray(tokens) || !tokens.length) {
|
7274
|
+
return null;
|
7275
|
+
}
|
7276
|
+
return tokens.some((token) => token.token_id == tokenId);
|
7277
|
+
}
|
7263
7278
|
async queryRefreshTokenByID(accessToken, tokenId) {
|
7264
7279
|
const Protos = helpers([
|
7265
7280
|
{
|