Skip to content

Commit

Permalink
V1.5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Revadike committed Dec 9, 2021
1 parent b70151f commit 4e3dd58
Show file tree
Hide file tree
Showing 7 changed files with 4,620 additions and 2,997 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ Also, this is a good alternative, in case you don't like using Epic's client or
To which I will say, why not? Most of these games are actually outstanding games! Even if you don't like Epic and their shenanigans, you will be pleased to know that Epic actually funds all the free copies that are given away: ["But we actually found it was more economical to pay developers [a lump sum] to distribute their game free for two weeks..."](https://arstechnica.com/gaming/2019/03/epic-ceo-youre-going-to-see-lower-prices-on-epic-games-store/)

## Changelog
### V1.5.7
* Fixed breaking bug that occured with new offer type: edition (#159)
* Merged Apprise image to main for docker (#157)

### V1.5.6
* Added optional Apprise notifications (#143)
* Improved update checking (#155)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "epicgames-freebies-claimer",
"version": "1.5.6",
"version": "1.5.7",
"description": "Claim free game promotions from the Epic Game Store",
"author": {
"name": "Revadike",
Expand Down
10 changes: 5 additions & 5 deletions src/gamePromotions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ async function getAddonForSlug(client, slug) {

async function getOfferId(client, promo, locale = "en-US") {
let offerId = null;
let slug = promo.productSlug || promo.urlSlug;
let slug = (promo.productSlug || promo.urlSlug).split("/")[0];
let isBundle = (promo) => Boolean(promo.categories.find((cat) => cat.path === "bundles"));
let isAddon = (promo) => Boolean(promo.categories.find((cat) => cat.path === "addons"));
let isAddon = (promo) => promo.offerType === "EDITION" || Boolean(promo.categories.find((cat) => cat.path === "addons"));

if (isAddon(promo)) {
let result = await getAddonForSlug(client, slug.split("/")[0], locale);
let result = await getAddonForSlug(client, slug, locale);
// eslint-disable-next-line prefer-destructuring
offerId = result.data.StorePageMapping.mapping.mappings.offerId;
} else if (isBundle(promo)) {
let result = await client.getBundleForSlug(slug.split("/")[0], locale);
let result = await client.getBundleForSlug(slug, locale);
let page = result.pages ? result.pages.find((p) => p.offer.id === promo.id) || result.pages[0] : result;
offerId = page.offer.id;
} else {
let result = await client.getProductForSlug(slug.split("/")[0], locale);
let result = await client.getProductForSlug(slug, locale);
let page = result.pages ? result.pages.find((p) => p.offer.id === promo.id) || result.pages[0] : result;
offerId = page.offer.id;
}
Expand Down
Loading

0 comments on commit 4e3dd58

Please sign in to comment.