Commit graph

754 commits

Author SHA1 Message Date
root
1c16b16889 fix: Robust login detection with multiple confirmation checks
All checks were successful
build-and-push / lint (push) Successful in 7s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
- isLoggedIn(): Wait for egs-navigation element, add timeout
- attemptBrowserLogin(): Multiple login status checks after navigation
- Manual login wait loop: Confirm stable login state before proceeding
- Add delays to let page stabilize before checking login status
- Better logging for debugging login flow

Fixes issue where login succeeded but was reported as failed due to timing
2026-03-08 14:56:51 +00:00
root
5d41b323e5 feat: Final hybrid login implementation (FlareSolverr + Cookie persistence)
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
- epic-claimer-new.js: Complete rewrite with practical approach
  - FlareSolverr integration for Cloudflare solving
  - Cookie persistence (saved to epic-cookies.json)
  - Auto-load cookies on startup (no login needed if valid)
  - Manual login fallback via noVNC if needed
  - Proper 2FA/OTP support
  - Better error handling and logging

- SETUP.md: Complete setup guide
  - Docker Compose examples
  - Environment variable reference
  - Troubleshooting section
  - 2FA setup instructions
  - Volume backup/restore

- README.md: Add reference to SETUP.md

- OAUTH_DEVICE_FLOW_ISSUE.md: Document why OAuth Device Flow doesn't work
  - Epic Games doesn't provide public device auth credentials
  - Client credentials flow requires registered app
  - Hybrid approach is the practical solution

How it works:
1. First run: Login via browser (FlareSolverr helps with Cloudflare)
2. Cookies saved to epic-cookies.json
3. Subsequent runs: Load cookies, no login needed
4. If cookies expire: Auto-fallback to login flow
5. Manual login via noVNC if automation fails

This is the approach used by all successful Epic Games claimer projects.
2026-03-08 14:52:13 +00:00
root
c8ccde9c22 fix: Fallback to browser login when OAuth Device Flow fails
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
- epic-claimer-new.js: Try Device Flow first, fall back to email/password
- Fixes: invalid_client_credentials error when device auth not configured
- Users with EG_EMAIL/EG_PASSWORD can now use browser login as fallback
- Device Flow remains available for users with valid credentials

Behavior:
1. Try OAuth Device Flow (bypasses Cloudflare)
2. On failure (invalid credentials), use browser login
3. Browser login uses EG_EMAIL/EG_PASSWORD/EG_OTPKEY
4. Manual login via noVNC if both methods fail
2026-03-08 14:36:50 +00:00
root
393f70d409 feat: Add OAuth Device Flow login to bypass Cloudflare
All checks were successful
build-and-push / lint (push) Successful in 9s
build-and-push / sonar (push) Successful in 21s
build-and-push / docker (push) Successful in 13s
- src/device-login.js: New module implementing Epic Games OAuth Device Flow
- src/logger.js: Simple logger module for consistent logging
- src/config.js: Add deviceAuthClientId and deviceAuthSecret config
- epic-claimer-new.js: Use OAuth Device Flow instead of browser login
- Cloudflare bypass: Device Flow uses API, user logs in own browser
- Based on: https://github.com/claabs/epicgames-freegames-node

How it works:
1. Get client credentials from Epic OAuth API
2. Get device authorization code with verification URL
3. Send user notification with login link
4. User clicks link and logs in (handles Cloudflare manually)
5. Poll for authorization completion
6. Save and use access/refresh tokens
7. Tokens auto-refresh on expiry

Benefits:
- No Cloudflare issues (no bot detection)
- Persistent tokens (no repeated logins)
- Works in headless mode
- More reliable than browser automation
2026-03-08 14:26:44 +00:00
root
f1d647bcb2 fix: Robust Cloudflare detection to prevent Playwright frame crashes
All checks were successful
build-and-push / lint (push) Successful in 7s
build-and-push / sonar (push) Successful in 19s
build-and-push / docker (push) Successful in 11s
- src/cloudflare.js: Add try-catch around each locator operation in isCloudflareChallenge
- src/cloudflare.js: Add waitForLoadState before checking for Cloudflare
- src/cloudflare.js: Remove redundant outer try-catch (unreachable code)
- epic-claimer-new.js: Add delay after page.goto before checking Cloudflare
- epic-claimer-new.js: Wrap isChallenge() call in try-catch

Fixes: TypeError: Cannot read properties of undefined (reading 'childFrames')
2026-03-08 14:14:55 +00:00
root
23ca522094 docs: Add Cloudflare troubleshooting section to README
All checks were successful
build-and-push / lint (push) Successful in 7s
build-and-push / sonar (push) Successful in 19s
build-and-push / docker (push) Successful in 11s
- Document 'Incorrect response' error and solutions
- Add FlareSolverr usage instructions
- Add common issues table
- Improve Firefox user.js for better Cloudflare compatibility
2026-03-08 14:06:49 +00:00
root
48c861b3de fix: Multiple bug fixes and code cleanup
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 21s
build-and-push / docker (push) Successful in 25s
- package.json: Add missing @eslint/js and globals devDependencies
- docker-entrypoint.sh: Fix X11 lock file name (.X1-lock → .X11-lock)
- epic-claimer-new.js: Use imported solveCloudflare/isCloudflareChallenge instead of duplicate implementations
- src/cloudflare.js: Fix solveCloudflare to use cfg.flaresolverr_url, remove unused imports
- epic-games.js: Remove unused code (getFreeGamesFromGraphQL, exchangeTokenForCookies, FREE_GAMES_QUERY, deviceAuthLoginSuccess variable)
- Run eslint --fix to clean up trailing spaces
2026-03-08 13:58:57 +00:00
nocci
b14530537a refactor(config): add network configuration and dependencies for inter-service communication
Some checks failed
build-and-push / lint (push) Failing after 8s
build-and-push / sonar (push) Has been skipped
build-and-push / docker (push) Has been skipped
- Configure flaresolverr and free-games-claimer to use a shared bridge network
- Explicitly set container name for flaresolverr and declare network dependency
- Define custom bridge network `fgc-network` for isolating service communication

This ensures services can reliably communicate over Docker's internal DNS while maintaining network separation from other containers.
2026-03-08 13:22:01 +00:00
nocci
e0c97f8d7c feat[cloudflare]: integrate FlareSolverr for automated Cloudflare challenge resolution
- Add Cloudflare bypass functionality using FlareSolverr service
- Configure FlareSolverr Docker service with environment options
- Add flaresolverr_url config option with default localhost fallback
- Replace manual Cloudflare challenge notification with automated solving attempt
- Create new cloudflare.js module with health check, challenge detection, and solution application
2026-03-08 13:06:46 +00:00
nocci
1ddcf1d8af refactor(epic): switch from external API calls to in-page browser-based fetching
All checks were successful
build-and-push / lint (push) Successful in 10s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
-removed axios dependency and replaced server-side API calls with in-page fetch() execution
-migrated from OAuth device flow to browser-based authentication using persistent context
-simplified claim flow by removing manual token exchange and cookie management
2026-03-08 12:54:25 +00:00
nocci
bceb642bcb refactor(auth): remove quotes from object keys and trailing commas in device auth flow
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
2026-03-08 12:35:54 +00:00
nocci
52bd469976 refactor(auth): replace client credentials with Basic auth and normalize response fields
Some checks failed
build-and-push / lint (push) Failing after 7s
build-and-push / sonar (push) Has been skipped
build-and-push / docker (push) Has been skipped
2026-03-08 12:32:49 +00:00
nocci
d4acc813bc refactor(api): restructure Epic Games OAuth flow with new client credentials step
Some checks failed
build-and-push / lint (push) Failing after 8s
build-and-push / sonar (push) Has been skipped
build-and-push / docker (push) Has been skipped
The OAuth device flow has been refactored to use the client credentials grant flow as the first step, followed by a proper device authorization request using the obtained client credentials token. This change modernizes the authentication flow to align with current Epic Games OAuth requirements and replaces the previous direct device authorization approach that used client_id and client_secret in the request body with the standardized authorization header pattern.
2026-03-08 12:23:52 +00:00
nocci
e8c28db63d feat(auth): add client_secret to Epic Games OAuth requests
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
2026-03-08 11:57:30 +00:00
nocci
1455963346 fix(api): update Epic Games OAuth endpoints and client ID
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
The changes replace old API endpoints with current Epic Games' Public Account Service URLs and update the client ID across all OAuth requests (device authorization, token exchange, and refresh). This resolves authentication failures caused by deprecated endpoints and credentials.
2026-03-08 11:52:54 +00:00
nocci
e494c1c04e fix(api): switch to URLSearchParams for OAuth device authorization body
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
2026-03-08 11:38:54 +00:00
nocci
84e50f07f2 fix(api): update Epic Games OAuth endpoint and add missing Content-Type header
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
Replace legacy OAuth token endpoint with new Epic Games API endpoint,
and add required Content-Type header for device authorization request
to comply with updated API expectations.
2026-03-08 11:35:07 +00:00
nocci
1cf4c86646 fix(api): update Epic Games OAuth endpoints and response field names
All checks were successful
build-and-push / lint (push) Successful in 7s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
Update OAuth endpoints to new public service URLs and adapt to camelCase
response fields in device authorization response.
2026-03-08 11:30:08 +00:00
nocci
4e95f50bc4 refactor(config): uncomment command for epic-games service
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 7s
2026-03-08 11:22:56 +00:00
nocci
0a5f40341b refactor(auth): add device auth reuse for legacy account migration
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 21s
build-and-push / docker (push) Successful in 11s
- imports device auth utility functions
- adds logic to reuse Epic Games device authentication from legacy mode
- loads device auth cookies (EPIC_SSO_RM, EPIC_DEVICE, EPIC_SESSION_AP) when available
- falls back to regular authentication if device auth is not present

This enables seamless transition for users migrating from legacy authentication while maintaining backward compatibility.
2026-03-08 11:18:28 +00:00
nocci
d55706c5f3 refactor(config): revert default eg_mode back to 'legacy'
All checks were successful
build-and-push / lint (push) Successful in 11s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 8s
The default value for `eg_mode` has been changed from 'new' back to 'legacy'. This reverts the previous commit (726b9bc) that changed the default, likely due to issues or instability with the new API-driven flow.
2026-03-08 11:11:38 +00:00
nocci
726b9bcbd8 refactor(config): change default eg_mode from 'legacy' to 'new'
All checks were successful
build-and-push / lint (push) Successful in 7s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
2026-03-08 11:07:39 +00:00
nocci
99f5432e32 build(deps): add tough-cookie dependency
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 21s
build-and-push / docker (push) Successful in 25s
iff
2026-03-08 10:59:57 +00:00
nocci
c0d148dc8e refactor(style): align template literals and whitespace formatting
All checks were successful
build-and-push / lint (push) Successful in 7s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 19s
- standardize string literals to single quotes in constants.js
- remove unused variable and normalize whitespace in cookie.js
- simplify nullish coalescing expression in device-auths.js

This consistency improvement enhances code readability and enforces uniform style across the codebase.
2026-03-08 10:57:28 +00:00
nocci
22c84a759b refactor: migrate from TypeScript to JavaScript for auth modules
Some checks failed
build-and-push / lint (push) Failing after 11s
build-and-push / sonar (push) Has been skipped
build-and-push / docker (push) Has been skipped
2026-03-08 10:55:46 +00:00
nocci
b72bb3fa4c fix: use JavaScript imports for TypeScript files
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 21s
build-and-push / docker (push) Successful in 8s
2026-03-07 14:54:36 +00:00
nocci
d47bfd7e8e fix: import constants.ts instead of constants.js
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 22s
build-and-push / docker (push) Successful in 11s
2026-03-07 14:51:51 +00:00
nocci
29e17fa057 fix: use separate locators with OR for captcha detection
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 8s
2026-03-07 14:37:00 +00:00
nocci
cc2f370eee fix: remove unnecessary parentheses around expressions
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
2026-03-07 14:33:48 +00:00
nocci
3f241bf400 fix: use separate locators with OR for captcha detection
Some checks failed
build-and-push / lint (push) Failing after 8s
build-and-push / sonar (push) Has been skipped
build-and-push / docker (push) Has been skipped
2026-03-07 14:31:27 +00:00
nocci
6615cf02db fix: use :is() for OR condition in Playwright selector
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s
2026-03-07 14:24:41 +00:00
nocci
6194e3eff3 fix: correct Playwright selector syntax for OR condition
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 12s
2026-03-07 14:19:36 +00:00
nocci
6ec9157a42 fix: add curl to apk add in docker buildx setup
All checks were successful
build-and-push / sonar (push) Successful in 20s
build-and-push / lint (push) Successful in 7s
build-and-push / docker (push) Successful in 1m10s
2026-03-07 14:10:25 +00:00
nocci
618106c2f7 fix: manually install docker buildx plugin
Some checks failed
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Failing after 6s
build-and-push / lint (push) Successful in 8s
2026-03-07 14:09:05 +00:00
nocci
ea627ab703 ci(workflow): simplify docker buildx installation
Some checks failed
build-and-push / docker (push) Failing after 6s
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
Replace separate `docker buildx install` step with installing `docker-buildx` package directly via apk, streamlining the Docker Buildx setup in the CI workflow.
2026-03-07 14:07:31 +00:00
nocci
74d2e92b8d fix: install docker buildx plugin
Some checks failed
build-and-push / docker (push) Failing after 6s
build-and-push / lint (push) Successful in 7s
build-and-push / sonar (push) Successful in 21s
2026-03-07 14:03:59 +00:00
nocci
eb033ee4b9 fix: add git installation to docker job
Some checks failed
build-and-push / lint (push) Successful in 7s
build-and-push / sonar (push) Successful in 21s
build-and-push / docker (push) Failing after 6s
2026-03-07 14:02:18 +00:00
nocci
9c77d64d0f fix: use 127.0.0.1 instead of server in network debugging
Some checks failed
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Failing after 4s
2026-03-07 14:00:17 +00:00
nocci
64b7d0786c fix: add debug output for SonarQube URL
Some checks failed
build-and-push / lint (push) Successful in 7s
build-and-push / sonar (push) Successful in 21s
build-and-push / docker (push) Failing after 9s
2026-03-07 13:33:17 +00:00
nocci
89d8b108cd fix: download and install sonar-scanner
Some checks failed
build-and-push / sonar (push) Failing after 6s
build-and-push / docker (push) Has been skipped
build-and-push / lint (push) Successful in 11s
2026-03-07 13:31:36 +00:00
nocci
555f62d72b fix: use correct sonar-scanner path
Some checks failed
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Failing after 4s
build-and-push / docker (push) Has been skipped
2026-03-07 13:30:54 +00:00
nocci
c4e049fe8c fix: add unzip and debug sonar-scanner installation
Some checks failed
build-and-push / sonar (push) Failing after 5s
build-and-push / docker (push) Has been skipped
build-and-push / lint (push) Successful in 7s
2026-03-07 13:29:39 +00:00
nocci
43405dfce3 fix: use manual SonarQube scanner installation
Some checks failed
build-and-push / lint (push) Successful in 7s
build-and-push / sonar (push) Failing after 5s
build-and-push / docker (push) Has been skipped
2026-03-07 13:28:35 +00:00
nocci
1abd90e256 fix: add Java runtime for SonarQube scanner
Some checks failed
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Failing after 8s
build-and-push / docker (push) Has been skipped
2026-03-07 13:26:54 +00:00
nocci
92f577c70b fix: use github.* variables instead of GITEA_*
Some checks failed
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Failing after 7s
build-and-push / docker (push) Has been skipped
2026-03-07 13:25:36 +00:00
nocci
5969c096bc fix: correct YAML indentation in workflow
Some checks failed
build-and-push / lint (push) Failing after 2s
build-and-push / sonar (push) Has been skipped
build-and-push / docker (push) Has been skipped
2026-03-07 13:24:13 +00:00
nocci
ec3fbbcfa6 fix: correct YAML indentation in workflow 2026-03-07 13:22:06 +00:00
nocci
78f9371831 fix: correct YAML indentation in workflow 2026-03-07 13:20:55 +00:00
nocci
fae3ee2c24 fix: correct YAML indentation in workflow 2026-03-07 13:19:53 +00:00
nocci
40235d62a8 chore(ci): remove outdated Forgejo workflow file 2026-03-07 13:18:43 +00:00