From fd0fc4e98150a706aa894018bd21d27174adbb2f Mon Sep 17 00:00:00 2001 From: nocci Date: Thu, 8 Jan 2026 15:20:21 +0000 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(code):=20remove?= =?UTF-8?q?=20unused=20code=20and=20clean=20up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove unused screenshot helper function - remove unnecessary empty arguments from launch options - add spacing for readability in async functions --- epic-claimer-new.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/epic-claimer-new.js b/epic-claimer-new.js index de6fa32..694f25a 100644 --- a/epic-claimer-new.js +++ b/epic-claimer-new.js @@ -19,9 +19,6 @@ const URL_CLAIM = 'https://store.epicgames.com/en-US/free-games'; const COOKIES_PATH = path.resolve(cfg.dir.browser, 'epic-cookies.json'); const BEARER_TOKEN_NAME = 'EPIC_BEARER_TOKEN'; -// Screenshot Helper -const screenshot = (...a) => path.resolve(cfg.dir.screenshots, 'epic-games', ...a); - // Fetch Free Games from API const fetchFreeGamesAPI = async () => { const resp = await axios.get('https://store-site-backend-static-ipv4.ak.epicgames.com/freeGamesPromotions', { @@ -94,6 +91,7 @@ const getValidAuth = async ({ otpKey, reuseCookies, cookiesPath }) => { console.log('🔐 Starting fresh OAuth device flow (manual approval required)...'); let deviceResponse; + try { deviceResponse = await axios.post('https://api.epicgames.dev/epic/oauth/deviceCode', { client_id: '34a02cf8f4414e29b159cdd02e6184bd', @@ -137,6 +135,7 @@ const ensureLoggedIn = async (page, context) => { const attemptAutoLogin = async () => { if (!cfg.eg_email || !cfg.eg_password) return false; + try { await page.goto('https://www.epicgames.com/id/login?lang=en-US&noHostRedirect=true&redirectUrl=' + URL_CLAIM, { waitUntil: 'domcontentloaded', @@ -318,7 +317,6 @@ export const claimEpicGamesNew = async () => { recordVideo: cfg.record ? { dir: 'data/record/', size: { width: cfg.width, height: cfg.height } } : undefined, recordHar: cfg.record ? { path: `data/record/eg-${filenamify(datetime())}.har` } : undefined, handleSIGINT: false, - args: [], }); handleSIGINT(context); await stealth(context);