fix: reduce size, fix signin redirect
* correct freegames url * skip downloading browsers in docker * remove fluxbox * remove stdout for vnc & xvfb
This commit is contained in:
parent
a8c578bd93
commit
dbf4804dc7
5 changed files with 830 additions and 1316 deletions
13
Dockerfile
13
Dockerfile
|
|
@ -15,6 +15,10 @@ ENV VNC_PASSWORD secret
|
|||
ENV VNC_PORT 5900
|
||||
EXPOSE 5900
|
||||
|
||||
# Playwright
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
|
||||
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD true
|
||||
|
||||
# === INSTALL Node.js ===
|
||||
|
||||
# Taken from https://github.com/microsoft/playwright/blob/main/utils/docker/Dockerfile.focal
|
||||
|
|
@ -36,11 +40,8 @@ RUN apt-get update && \
|
|||
RUN apt-get update \
|
||||
&& apt-get install --no-install-recommends --no-install-suggests -y \
|
||||
xvfb \
|
||||
xauth \
|
||||
ca-certificates \
|
||||
x11vnc \
|
||||
fluxbox \
|
||||
stterm \
|
||||
curl \
|
||||
tini \
|
||||
&& apt-get clean \
|
||||
|
|
@ -55,10 +56,8 @@ RUN apt-get update \
|
|||
WORKDIR /fgc
|
||||
COPY package.json .
|
||||
# Install chromium & dependencies only
|
||||
RUN export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
||||
&& npm install \
|
||||
&& npx playwright install-deps \
|
||||
&& npx playwright install chromium \
|
||||
RUN npm install \
|
||||
&& npx playwright install --with-deps chromium \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$VNC_ENABLED" = true ]; then
|
||||
set -- vnc-start "$@"
|
||||
fi
|
||||
|
||||
if [ "$EXPOSE_X11" = true ]; then
|
||||
set -- --listen-tcp "$@"
|
||||
fi
|
||||
|
||||
# 6000+SERVERNUM is the TCP port Xvfb is listening on:
|
||||
SERVERNUM=$(echo "$DISPLAY" | sed 's/:\([0-9][0-9]*\).*/\1/')
|
||||
# SERVERNUM=$(echo "$DISPLAY" | sed 's/:\([0-9][0-9]*\).*/\1/')
|
||||
|
||||
# Options passed directly to the Xvfb server:
|
||||
# -ac disables host-based access control mechanisms
|
||||
# −screen NUM WxHxD creates the screen and sets its width, height, and depth
|
||||
SERVERARGS="-ac -screen 0 ${SCREEN_WIDTH}x${SCREEN_HEIGHT}x${SCREEN_DEPTH}"
|
||||
Xvfb "$DISPLAY" -ac -screen 0 "${SCREEN_WIDTH}x${SCREEN_HEIGHT}x${SCREEN_DEPTH}" >/dev/null 2>&1 &
|
||||
|
||||
exec tini -g -- \
|
||||
xvfb-run --server-num "$SERVERNUM" --server-args "$SERVERARGS" "$@"
|
||||
if [ "$VNC_ENABLED" = true ]; then
|
||||
vnc-start >/dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
exec tini -g -- "$@"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Disable fbsetbg and start fluxbox in a background process:
|
||||
mkdir -p ~/.fluxbox && echo 'background: unset' >>~/.fluxbox/overlay
|
||||
fluxbox -display "$DISPLAY" &
|
||||
|
||||
# Start VNC in a background process:
|
||||
x11vnc -display "$DISPLAY" -forever -shared -rfbport "${VNC_PORT:-5900}" \
|
||||
-passwd "${VNC_PASSWORD:-secret}" &
|
||||
|
|
|
|||
|
|
@ -3,16 +3,18 @@ import path from 'path';
|
|||
import { __dirname, stealth } from './util.js';
|
||||
const debug = process.env.PWDEBUG == '1'; // runs non-headless and opens https://playwright.dev/docs/inspector
|
||||
|
||||
const URL_CLAIM = 'https://store.epicgames.com/store/en-US/free-games';
|
||||
const URL_CLAIM = 'https://store.epicgames.com/en-US/free-games';
|
||||
const URL_LOGIN = 'https://www.epicgames.com/id/login?lang=en-US&noHostRedirect=true&redirectUrl=' + URL_CLAIM;
|
||||
const TIMEOUT = 20 * 1000; // 20s, default is 30s
|
||||
const SCREEN_WIDTH = Number(process.env.SCREEN_WIDTH) || 1280;
|
||||
const SCREEN_HEIGHT = Number(process.env.SCREEN_HEIGHT) || 1280;
|
||||
|
||||
// https://playwright.dev/docs/auth#multi-factor-authentication
|
||||
const context = await chromium.launchPersistentContext(path.resolve(__dirname, 'userDataDir'), {
|
||||
// chrome will not work in linux arm64, only chromium
|
||||
// channel: 'chrome', // https://playwright.dev/docs/browsers#google-chrome--microsoft-edge
|
||||
headless: false,
|
||||
viewport: { width: 1280, height: 1280 },
|
||||
viewport: { width: SCREEN_WIDTH, height: SCREEN_HEIGHT },
|
||||
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36', // see replace of Headless in util.newStealthContext. TODO update if browser is updated!
|
||||
locale: "en-US", // ignore OS locale to be sure to have english text for locators
|
||||
args: [ // don't want to see bubble 'Restore pages? Chrome didn't shut down correctly.', but flags below don't work.
|
||||
|
|
|
|||
2104
package-lock.json
generated
2104
package-lock.json
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue