steamutils 1.0.68 → 1.0.71
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 +15 -16
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -836,20 +836,27 @@ function SteamClient({
|
|
836
836
|
return false
|
837
837
|
}
|
838
838
|
|
839
|
-
|
839
|
+
async function _getStoreSteamPoweredResponse(cookie) {
|
840
840
|
let response = null
|
841
|
-
for (let i = 0; i <
|
841
|
+
for (let i = 0; i < 50; i++) {
|
842
842
|
if(!response){
|
843
843
|
try {
|
844
844
|
response = (await axios.request({
|
845
845
|
url: 'https://store.steampowered.com/', headers: {
|
846
846
|
cookie,
|
847
|
-
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.
|
847
|
+
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.75',
|
848
848
|
},
|
849
849
|
}))
|
850
|
-
} catch (e) {
|
850
|
+
} catch (e) {
|
851
|
+
await sleep(1000)
|
852
|
+
}
|
851
853
|
}
|
852
854
|
}
|
855
|
+
return response
|
856
|
+
}
|
857
|
+
|
858
|
+
async function getNewCookie(cookie) {
|
859
|
+
let response = await _getStoreSteamPoweredResponse(cookie)
|
853
860
|
if(!response){
|
854
861
|
return
|
855
862
|
}
|
@@ -864,24 +871,14 @@ function SteamClient({
|
|
864
871
|
cookieObj[name] = value
|
865
872
|
}
|
866
873
|
cookie = Object.keys(cookieObj).map(name => `${name}=${cookieObj[name]}`).join(';')
|
867
|
-
|
868
|
-
try {
|
869
|
-
response = (await axios.request({
|
870
|
-
url: 'https://store.steampowered.com/', headers: {
|
871
|
-
cookie,
|
872
|
-
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
873
|
-
},
|
874
|
-
}))
|
875
|
-
break
|
876
|
-
} catch (e) { }
|
877
|
-
}
|
874
|
+
response = await _getStoreSteamPoweredResponse(cookie)
|
878
875
|
}
|
879
876
|
return cookie
|
880
877
|
}
|
881
878
|
|
882
879
|
async function loginWithCookie(cookie, tryNewCookie = false) {
|
883
880
|
let response;
|
884
|
-
for (let i = 0; i <
|
881
|
+
for (let i = 0; i < 20; i++) {
|
885
882
|
try {
|
886
883
|
response = (await axios.request({
|
887
884
|
url: 'https://steamcommunity.com/chat/clientjstoken',
|
@@ -899,12 +896,14 @@ function SteamClient({
|
|
899
896
|
|
900
897
|
const result = response?.data
|
901
898
|
if (result?.logged_in) {
|
899
|
+
console.log(`clientjstoken success`)
|
902
900
|
Object.assign(result, {
|
903
901
|
steamID: new SteamID(result.steamid), accountName: result.account_name, webLogonToken: result.token
|
904
902
|
})
|
905
903
|
steamClient.logOn(result)
|
906
904
|
return cookie
|
907
905
|
} else {
|
906
|
+
console.log(`clientjstoken fail`)
|
908
907
|
if (tryNewCookie) {
|
909
908
|
log('You are not logged in', cookie)
|
910
909
|
return null
|