Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pics Cache Enhancements #409

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1240f7d
Added savePicsCache
Revadike Mar 9, 2022
0321d67
update jsdoc
Revadike Mar 11, 2022
aa2cc26
fix jsdoc
Revadike May 20, 2022
a9bd0cf
issue warning for picsCacheAll+savePicsCache
Revadike May 20, 2022
c0afe04
_saveProductInfo jsdoc
Revadike May 20, 2022
488a74a
savePicsCache functionality
Revadike May 20, 2022
24eb205
current changenumber to disk
Revadike May 20, 2022
3d45029
read changenumber on startup
Revadike May 20, 2022
ec7aa5d
altered warning
Revadike May 21, 2022
84bfec3
spelling
Revadike May 21, 2022
5de1d35
implement product info cache
Revadike May 21, 2022
1a4e46d
a lot of bugfixes
Revadike May 22, 2022
e514b50
corrected cached object
Revadike May 22, 2022
61bf5ca
[email protected]
Revadike May 22, 2022
571b5d3
split product info requests
Revadike Jun 2, 2022
58b0b70
fixed deadlock issue
Revadike Jun 2, 2022
2fd5ee0
bugfixes + small changes
Revadike Jun 3, 2022
3249f29
Prevent any stale data with meta_data_only + sha check
Revadike Jun 17, 2022
ff77442
improve readme
Revadike Jun 19, 2022
fd813a7
fixed anonymous usage
Revadike Jun 19, 2022
395ddeb
Merge branch 'master' into feature-picscache-enhancements
Revadike Jun 19, 2022
b8c3791
small changes
Revadike Jul 4, 2022
2b0fa8a
handle when `sha` is `null`
Revadike Jul 7, 2022
037feac
minor bugfix
Revadike Jul 19, 2022
f3a725e
comments + refactor + handle enablePicsCache disabled
Revadike Jul 22, 2022
134ee79
Changed execution order
Revadike Jul 31, 2022
bfbc033
Merge branch 'DoctorMcKay:master' into feature-picscache-enhancements
Revadike Oct 12, 2022
629ca25
Merge branch 'DoctorMcKay:master' into feature-picscache-enhancements
Revadike Jan 7, 2023
6c44782
Merge branch 'master' of https://github.com/DoctorMcKay/node-steam-us…
Revadike Jun 23, 2023
9c06413
Merge branch 'master' into feature-picscache-enhancements
Revadike Jul 22, 2023
944601a
Merge pull request #3 from DoctorMcKay/v4
Revadike Oct 20, 2023
4055403
Merge branch 'master' into feature-picscache-enhancements
Revadike Sep 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added savePicsCache
Revadike committed Mar 9, 2022
commit 1240f7dc81d78f26ef40a665e1203f05aa9b644c
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -179,6 +179,16 @@ Added in 3.3.0.

Defaults to `false`.

### savePicsCache

If `enablePicsCache` is enabled, save product info to disk. (TODO: Improve description)

Added in 4.24.0

Defaults to `false`.

**Warning:** This will significantly increase the storage space that is needed!

### picsCacheAll

If `picsCacheAll` is enabled, `enablePicsCache` is enabled, and `changelistUpdateInterval` is nonzero, then apps and
27 changes: 27 additions & 0 deletions components/apps.js
Original file line number Diff line number Diff line change
@@ -156,6 +156,30 @@ class SteamUserApps extends SteamUserAppAuth {
});
}

_saveProductInfo({ apps, packages }) {
let toSave = [];

for (let appid in apps) {
if (apps[appid].missingToken) {
continue;
}
let filename = `app_info_${appid}.json`;
let content = JSON.stringify(apps[appid]);
toSave.push({filename, content});
}

for (let packageid in packages) {
if (packages[packageid].missingToken) {
continue;
}
let filename = `package_info_${packageid}.json`;
let content = JSON.stringify(packages[packageid]);
toSave.push({filename, content});
}

return Promise.all(toSave.map(({filename, content}) => this._saveFile(filename, content)));
}

/**
* Get info about some apps and/or packages from Steam.
* @param {int[]|object[]} apps - Array of AppIDs. May be empty. May also contain objects with keys {appid, access_token}
@@ -313,6 +337,7 @@ class SteamUserApps extends SteamUserAppAuth {
// appids and packageids contain the list of IDs that we're still waiting on data for
if (appids.length === 0 && packageids.length === 0) {
if (!inclTokens) {
this._saveProductInfo(response);
return resolve(response);
}

@@ -334,6 +359,7 @@ class SteamUserApps extends SteamUserAppAuth {

if (tokenlessAppids.length == 0 && tokenlessPackages.length == 0) {
// No tokens needed
this._saveProductInfo(response);
return resolve(response);
}

@@ -374,6 +400,7 @@ class SteamUserApps extends SteamUserAppAuth {
}
}

this._saveProductInfo(response);
resolve(response);
} catch (ex) {
return reject(ex);
1 change: 1 addition & 0 deletions resources/default_options.js
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ module.exports = {
machineIdType: EMachineIDType.AccountNameGenerated,
machineIdFormat: ['SteamUser Hash BB3 {account_name}', 'SteamUser Hash FF2 {account_name}', 'SteamUser Hash 3B3 {account_name}'],
enablePicsCache: false,
savePicsCache: false,
picsCacheAll: false,
changelistUpdateInterval: 60000,
additionalHeaders: {},