clancy-chao / Steam-Bundle-Sites-Extension

A simple extension for bundles sites selling Steam games
MIT License
70 stars 5 forks source link

Humble - workaround for some games not supplying Steam IDs #13

Open DragRedSim opened 5 years ago

DragRedSim commented 5 years ago

Some of the recent games in the Humble Great GameMaker Games bundle don't report Steam AppIDs in the JSON, however they are reporting subscription IDs. I've added a line to the definition of d (the game info variable): sub: parseInt(game.steam_package_id, 10)

Further to this, I also modified the Steam Store link adding code to check if there is an invalid (NaN) app ID, and if so to fall back to the provided sub ID page.

// append Steam store link
if (isNaN(d.app)) {
    $keyRedeemer.find('h4 > span').eq(0).after(`<span> | </span><a class="SBSE-link-steam_store" href="https://store.steampowered.com/sub/${d.sub}/" target="_blank">${i18n.get('steamStore')}</a>`);
} else {
    $keyRedeemer.find('h4 > span').eq(0).after(`<span> | </span><a class="SBSE-link-steam_store" href="https://store.steampowered.com/app/${d.app}/" target="_blank">${i18n.get('steamStore')}</a>`);
}

It's not foolproof, for example Cook, Serve, Delicious! is listed as unowned, because I purchased through Steam, however the sub ID given is for a retail key. However, it's an improvement, as it lists games I know I own as being owned, which was not the case previously.

clancy-chao commented 5 years ago

Thank you for reporting.

Added Steam Database link in v2.12.3 for users to check if appID is not available. Don't really have a good solution to check subs, as a game can have tens of subs with same contents in them. One method I can think of is to fetch SteamDB and check if you owned the apps in that sub. But this violates SteamDB's ToS which they will block you from accessing their website.