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
|
ENV VNC_PORT 5900
|
||||||
EXPOSE 5900
|
EXPOSE 5900
|
||||||
|
|
||||||
|
# Playwright
|
||||||
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
|
||||||
|
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD true
|
||||||
|
|
||||||
# === INSTALL Node.js ===
|
# === INSTALL Node.js ===
|
||||||
|
|
||||||
# Taken from https://github.com/microsoft/playwright/blob/main/utils/docker/Dockerfile.focal
|
# 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 \
|
RUN apt-get update \
|
||||||
&& apt-get install --no-install-recommends --no-install-suggests -y \
|
&& apt-get install --no-install-recommends --no-install-suggests -y \
|
||||||
xvfb \
|
xvfb \
|
||||||
xauth \
|
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
x11vnc \
|
x11vnc \
|
||||||
fluxbox \
|
|
||||||
stterm \
|
|
||||||
curl \
|
curl \
|
||||||
tini \
|
tini \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
|
|
@ -55,10 +56,8 @@ RUN apt-get update \
|
||||||
WORKDIR /fgc
|
WORKDIR /fgc
|
||||||
COPY package.json .
|
COPY package.json .
|
||||||
# Install chromium & dependencies only
|
# Install chromium & dependencies only
|
||||||
RUN export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
RUN npm install \
|
||||||
&& npm install \
|
&& npx playwright install --with-deps chromium \
|
||||||
&& npx playwright install-deps \
|
|
||||||
&& npx playwright install chromium \
|
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,15 @@
|
||||||
#!/bin/sh
|
#!/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:
|
# 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:
|
# Options passed directly to the Xvfb server:
|
||||||
# -ac disables host-based access control mechanisms
|
# -ac disables host-based access control mechanisms
|
||||||
# −screen NUM WxHxD creates the screen and sets its width, height, and depth
|
# −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 -- \
|
if [ "$VNC_ENABLED" = true ]; then
|
||||||
xvfb-run --server-num "$SERVERNUM" --server-args "$SERVERARGS" "$@"
|
vnc-start >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec tini -g -- "$@"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
#!/bin/sh
|
#!/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:
|
# Start VNC in a background process:
|
||||||
x11vnc -display "$DISPLAY" -forever -shared -rfbport "${VNC_PORT:-5900}" \
|
x11vnc -display "$DISPLAY" -forever -shared -rfbport "${VNC_PORT:-5900}" \
|
||||||
-passwd "${VNC_PASSWORD:-secret}" &
|
-passwd "${VNC_PASSWORD:-secret}" &
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,18 @@ import path from 'path';
|
||||||
import { __dirname, stealth } from './util.js';
|
import { __dirname, stealth } from './util.js';
|
||||||
const debug = process.env.PWDEBUG == '1'; // runs non-headless and opens https://playwright.dev/docs/inspector
|
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 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 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
|
// https://playwright.dev/docs/auth#multi-factor-authentication
|
||||||
const context = await chromium.launchPersistentContext(path.resolve(__dirname, 'userDataDir'), {
|
const context = await chromium.launchPersistentContext(path.resolve(__dirname, 'userDataDir'), {
|
||||||
// chrome will not work in linux arm64, only chromium
|
// chrome will not work in linux arm64, only chromium
|
||||||
// channel: 'chrome', // https://playwright.dev/docs/browsers#google-chrome--microsoft-edge
|
// channel: 'chrome', // https://playwright.dev/docs/browsers#google-chrome--microsoft-edge
|
||||||
headless: false,
|
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!
|
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
|
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.
|
args: [ // don't want to see bubble 'Restore pages? Chrome didn't shut down correctly.', but flags below don't work.
|
||||||
|
|
|
||||||
2098
package-lock.json
generated
2098
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