npm scripts for docker, update readme

This commit is contained in:
Ralf Vogler 2022-04-30 22:06:57 +02:00
parent f1dd867d39
commit 21311834d9
2 changed files with 11 additions and 15 deletions

View file

@ -14,7 +14,6 @@ Claims free games on
This downloads Chromium (343 MB) to a cache in home ([doc](https://playwright.dev/docs/browsers#managing-browser-binaries)). This downloads Chromium (343 MB) to a cache in home ([doc](https://playwright.dev/docs/browsers#managing-browser-binaries)).
## Usage ## Usage
Both scripts start an automated Chromium instance, either with the browser GUI shown or hidden (*headless mode*). Both scripts start an automated Chromium instance, either with the browser GUI shown or hidden (*headless mode*).
Login has to be done in the browser. It's hard to automate since you usually need to enter some OTP (but you can select 'remember this device'). Login has to be done in the browser. It's hard to automate since you usually need to enter some OTP (but you can select 'remember this device').
@ -23,11 +22,12 @@ After login, the script will just continue, but you can also restart it.
If something goes wrong, use `PWDEBUG=1 node ...` to [inspect](https://playwright.dev/docs/inspector). If something goes wrong, use `PWDEBUG=1 node ...` to [inspect](https://playwright.dev/docs/inspector).
### Epic Games Store ### Epic Games Store
Run `node epic-games` Options:
- Run `node epic-games` (not headless, i.e. browser is visible, [headless leads to captcha](https://github.com/vogler/free-games-claimer/issues/2))
Does not run headless, but can be run quasi-headless inside a Docker container (see below). - Run headless inside Docker:
- [Install Docker](https://docs.docker.com/get-docker/)
They detect headless mode (despite stealth plugin) and it gets stuck with a captcha challenge ([issue](https://github.com/vogler/free-games-claimer/issues/2)). - `npm run docker:build`
- `npm run docker:epic-games`
### Amazon Prime Gaming ### Amazon Prime Gaming
Run `node prime-gaming` Run `node prime-gaming`
@ -35,11 +35,8 @@ Run `node prime-gaming`
Runs headless. Run `node prime-gaming show` to show the GUI (to login). Runs headless. Run `node prime-gaming show` to show the GUI (to login).
Claiming the Amazon Games works, external Epic Games also work if the account is linked. Claiming the Amazon Games works, external Epic Games also work if the account is linked.
Keys for Origin (and GOG?) should be printed to the console and need to be redeemed manually at the moment ([issue](https://github.com/vogler/free-games-claimer/issues/5)). Keys for {Origin, GOG.com, Legacy Games} should be printed to the console and need to be redeemed manually at the URL printed to the terminal ([issue](https://github.com/vogler/free-games-claimer/issues/5)).
Other stores not tested. A screenshot of the page with the code is saved to `screenshots` as well.
### Docker
See https://github.com/vogler/free-games-claimer/pull/11 (TODO).
### Run periodically ### Run periodically
Epic Games releases one (sometimes more) free game *every week*, but around christmas every day. Epic Games releases one (sometimes more) free game *every week*, but around christmas every day.

View file

@ -2,9 +2,8 @@
"scripts": { "scripts": {
"login": "npx playwright open --save-storage=auth.json https://www.epicgames.com/login", "login": "npx playwright open --save-storage=auth.json https://www.epicgames.com/login",
"codegen": "npx playwright codegen --load-storage=auth.json https://www.epicgames.com/store/en-US/free-games", "codegen": "npx playwright codegen --load-storage=auth.json https://www.epicgames.com/store/en-US/free-games",
"test": "npx playwright test --timeout 10000", "docker:build": "docker build --tag free-games-claimer .",
"debug": "npx playwright test --debug", "docker:epic-games": "docker run --rm -it -p 5900:5900 -p 6080:6080 -v \"$(pwd)/userDataDir:/fgc/userDataDir\" --name free-games-claimer free-games-claimer"
"start": "node main.stealth"
}, },
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.20.1", "@playwright/test": "^1.20.1",
@ -12,4 +11,4 @@
"puppeteer-extra-plugin-stealth": "^2.9.0" "puppeteer-extra-plugin-stealth": "^2.9.0"
}, },
"type": "module" "type": "module"
} }