From b75f538d8a358e9ee04aef7317712363e8c12935 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Fri, 17 Mar 2023 11:19:38 +0100 Subject: [PATCH] eg: add `EG_PARENTALPIN` to enter Parental Controls PIN, #98 --- README.md | 1 + config.js | 1 + epic-games.js | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 06ca07e..e845c62 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ Available options/variables and their default values: | EG_EMAIL | | Epic Games email for login. Overrides EMAIL. | | EG_PASSWORD | | Epic Games password for login. Overrides PASSWORD. | | EG_OTPKEY | | Epic Games MFA OTP key. | +| EG_PARENTALPIN | | Epic Games Parental Controls PIN. | | PG_EMAIL | | Prime Gaming email for login. Overrides EMAIL. | | PG_PASSWORD | | Prime Gaming password for login. Overrides PASSWORD. | | PG_OTPKEY | | Prime Gaming MFA OTP key. | diff --git a/config.js b/config.js index 3cb8f4e..c667040 100644 --- a/config.js +++ b/config.js @@ -26,6 +26,7 @@ export const cfg = { eg_email: process.env.EG_EMAIL || process.env.EMAIL, eg_password: process.env.EG_PASSWORD || process.env.PASSWORD, eg_otpkey: process.env.EG_OTPKEY, + eg_parentalpin: process.env.EG_PARENTALPIN, // auth prime-gaming pg_email: process.env.PG_EMAIL || process.env.EMAIL, pg_password: process.env.PG_PASSWORD || process.env.PASSWORD, diff --git a/epic-games.js b/epic-games.js index 4aef571..cccb083 100644 --- a/epic-games.js +++ b/epic-games.js @@ -156,8 +156,17 @@ try { continue; } - if (cfg.dryrun) continue; + iframe.locator('.payment-pin-code').waitFor().then(async () => { + if (!cfg.eg_parentalpin) { + console.error(' EG_PARENTALPIN not set. Need to enter Parental Control PIN manually.'); + notify('epic-games: EG_PARENTALPIN not set. Need to enter Parental Control PIN manually.'); + } + await iframe.locator('input.payment-pin-code__input').first().type(cfg.eg_parentalpin); + await iframe.locator('button:has-text("Continue")').click({ delay: 11 }); + }).catch(_ => { }); + if (cfg.debug) await page.pause(); + if (cfg.dryrun) continue; await page.waitForTimeout(2000); await iframe.locator('button:has-text("Place Order")').click({ delay: 11 });