steamutils 1.0.51 → 1.0.52
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 +24 -14
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -819,32 +819,42 @@ function SteamClient({
|
|
819
819
|
async function autoRequestFreeLicense(shouldLog = false, max = 10) {
|
820
820
|
const steamUtils = new SteamUtils(getCookie())
|
821
821
|
|
822
|
-
const
|
822
|
+
const userData = await steamUtils.getDynamicStoreUserData()
|
823
|
+
const ownedApps = userData?.rgOwnedApps || []
|
823
824
|
const ownedAppsCount = shouldLog ? (ownedApps?.length || 0) : 0
|
824
|
-
let recommendedApps = Math.random() > 0.5 ? _.shuffle(
|
825
|
+
let recommendedApps = Math.random() > 0.5 ? _.shuffle(userData?.rgRecommendedApps || []) : []
|
825
826
|
if (!recommendedApps?.length) {
|
826
827
|
recommendedApps = (await axios.request({url: 'https://raw.githubusercontent.com/5x/easy-steam-free-packages/master/src/script/packages_db.json'}))?.data?.packages || []
|
827
828
|
}
|
828
829
|
_.remove(recommendedApps, app => ownedApps.includes(app))
|
829
|
-
|
830
|
+
recommendedApps = _.shuffle(recommendedApps)
|
830
831
|
if (max) {
|
831
832
|
recommendedApps.length = Math.min(recommendedApps.length, max)
|
832
833
|
}
|
833
|
-
for (const recommendedApp of recommendedApps) {
|
834
|
-
if (Math.random() > 0.5) {
|
835
|
-
try {
|
836
|
-
await steamUtils.requestFreeLicense(recommendedApp)
|
837
|
-
} catch (e) {
|
838
|
-
}
|
839
|
-
} else {
|
840
834
|
try {
|
841
|
-
|
835
|
+
const response = await steamClient.requestFreeLicense(recommendedApps)
|
836
|
+
if (shouldLog) {
|
837
|
+
log(response)
|
838
|
+
}
|
842
839
|
} catch (e) {
|
843
840
|
log(e);
|
844
841
|
}
|
845
|
-
|
846
|
-
|
847
|
-
|
842
|
+
// if (Math.random() > 0.7) {
|
843
|
+
// for (const recommendedApp of recommendedApps) {
|
844
|
+
// try {
|
845
|
+
// await steamUtils.requestFreeLicense(recommendedApp)
|
846
|
+
// } catch (e) {
|
847
|
+
// }
|
848
|
+
// await sleep(2000)
|
849
|
+
// }
|
850
|
+
// } else {
|
851
|
+
// try {
|
852
|
+
// await steamClient.requestFreeLicense(recommendedApps)
|
853
|
+
// } catch (e) {
|
854
|
+
// log(e);
|
855
|
+
// }
|
856
|
+
// }
|
857
|
+
|
848
858
|
if (shouldLog) {
|
849
859
|
await sleep(20000)
|
850
860
|
const ownedAppsCount2 = (await steamUtils.getDynamicStoreUserData())?.rgOwnedApps?.length || 0
|