refactor[epic-games]: migrate to GraphQL API and modularize authentication logic

This commit refactors epic-games.js to use the GraphQL API instead of the legacy promotions endpoint for retrieving free games. Key architectural improvements include:

- Added modular authentication module (device-auths.ts) supporting persistent device auth tokens
- Introduces cookie management module (cookie.ts) for persistent session handling
- Extracts GraphQL query structures and API endpoints into constants.ts
- Implements multiple fallback strategies: device auth login, token exchange, and fallback to standard login
- Adds support for both GraphQL and promotions-based game discovery
- Streamlines claim process with improved tracking and error handling
- Removes legacy selectors and redundant logic

Additionally, updates package.json to include TypeScript and reorganizes dependency order for better maintainability.
This commit is contained in:
nocci 2026-03-06 15:26:26 +00:00
parent 0d35a5ee85
commit 728b0c734b
6 changed files with 626 additions and 137 deletions

View file

@ -20,12 +20,12 @@
"node": ">=17"
},
"dependencies": {
"axios": "^1.7.9",
"chalk": "^5.4.1",
"cross-env": "^7.0.3",
"dotenv": "^16.5.0",
"enquirer": "^2.4.1",
"fingerprint-injector": "^2.1.66",
"axios": "^1.7.9",
"lowdb": "^7.0.1",
"otplib": "^12.0.1",
"playwright-firefox": "^1.52.0",
@ -33,6 +33,7 @@
},
"devDependencies": {
"@stylistic/eslint-plugin-js": "^4.2.0",
"eslint": "^9.26.0"
"eslint": "^9.26.0",
"typescript": "^5.9.3"
}
}