feature: add stats api#125
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a788a33ed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| char url[128]; | ||
| std::snprintf(url, sizeof(url), "https://stats.opensteamtool.com/%u", appId); | ||
|
|
||
| auto r = OSTPlatform::Http::Execute(L"GET", url); |
There was a problem hiding this comment.
Avoid blocking stats packet sends on the API call
When an unlocked app has no setStat override and the stats API is enabled by default, this synchronous WinHTTP request runs inside LuaConfig::GetStatSteamId, which is called from the outgoing user-stats packet handlers before forwarding the packet. If stats.opensteamtool.com is slow or unreachable, each uncached app can stall Steam/game networking until the HTTP timeouts expire; failures are not cached, so the stall repeats on later stats requests. Consider resolving this asynchronously, prefetching, or caching failures/using much shorter configurable timeouts.
Useful? React with 👍 / 👎.
feature: add stats api (OpenSteam001#125)
Summary
This PR adds optional Stats SteamID API support for stats and achievements.
Previously, when no Lua
setStat(appid, "steamid")override was configured, OpenSteamTool always fell back to the hardcoded default SteamID. With this change, OpenSteamTool can now query the official stats API to obtain a recommended SteamID for the current AppId.Behavior
The SteamID resolution priority is now:
setStat(appid, "steamid")[stats] enable_api = trueand the API returns a valid SteamID76561198028121353This keeps existing Lua configurations fully compatible while improving the default behavior for games without a manually configured
setStat.New Configuration
Users can set
enable_api = falseto disable the remote API lookup and keep the old fallback-only behavior.Implementation Details
StatsClientfor querying the stats API.LuaConfig::GetStatSteamId.[stats] enable_apiparsing to the main config loader.README.md,README_ES.md, andopensteamtool.example.toml.Compatibility
Existing
setStat()usage is not affected. Manually configured SteamIDs still have the highest priority.