Fixes for inline css (CSSOM)

This commit is contained in:
2026-05-16 16:05:32 -07:00
parent 422994ad07
commit 40c63dc4e2
10 changed files with 301 additions and 103 deletions

View File

@@ -122,35 +122,51 @@ The current init script is minimal and safe — it only overrides the getter via
### Dockerfile
- Base: `mcr.microsoft.com/playwright:v1.60.0` (must stay in sync with the `playwright` npm version)
- Installs Node 22 (the base image may ship an older Node)
- Runs `npx playwright install chromium` so the browser binary is baked into the image
- Base: `mcr.microsoft.com/playwright:v1.60.0-noble` (must stay in sync with the `playwright` npm version)
- Installs only the worker runtime helpers that are not part of the Playwright image: `dumb-init`, `xvfb`, and `x11vnc`
- Uses `/app/scripts/archive-worker-entrypoint.sh` as the entrypoint. The entrypoint starts Xvfb on `$DISPLAY` and then runs `node src/cli.mjs ...` for `archive`/`help` commands.
- The worker is intended to be ephemeral: one container per archive job, with `/archives` mounted from the host.
### Host-to-worker contract
`src/container-runner.mjs` is the host/backend-facing boundary. It:
1. Picks `podman` or `docker`.
2. Starts `local-page-archiver:latest` with `/archives` mounted from the host.
3. Calls the in-container CLI as `archive <input> --json`.
4. Parses the JSON result and rewrites `/archives/...` paths back to host paths.
This is the integration point a future backend should use instead of shelling out to `podman run` directly.
### `podman-run.sh`
Helper for local runs. Two modes:
Helper for local Podman runs. It delegates to `src/container-runner.mjs`.
1. **`./podman-run.sh archive <URL>`** — headless, mounts `./archives`
2. **`./podman-run.sh headful-archive <URL>`** — headful with internal VNC
1. **`./podman-run.sh build`** — build `local-page-archiver:latest`
2. **`./podman-run.sh archive <URL>`** — run one ephemeral Xvfb/Chromium worker and write to `./archives`
3. **`./podman-run.sh vnc-archive <URL>`** — same worker with x11vnc exposed on `vnc://localhost:5901`
**Headful mode details:**
The container's `ENTRYPOINT` is `node src/cli.mjs`. To run a shell command inside the container (setting up Xvfb + x11vnc) we must override the entrypoint:
The helper builds the image if it is missing. Override with:
```bash
podman run --rm --entrypoint sh <image> -c "...setup Xvfb... && node src/cli.mjs archive <URL>"
```sh
ARCHIVE_WORKER_IMAGE=local-page-archiver:dev ARCHIVE_DIR=/tmp/archives ./podman-run.sh archive https://example.com
```
Port `5900` inside the container maps to `5901` on the host to avoid conflicts with macOS's built-in VNC.
### `docker-compose.yml`
Includes a `headful` profile that can be run with:
Compose is mainly a direct worker smoke test. It runs the same image and command shape as the host runner:
```bash
URL=https://example.com docker compose --profile headful up archiver-headful
URL=https://example.com docker compose up --build archive-worker
```
Unlike `podman-run.sh`, Compose currently maps VNC to host port `5900`.
For visual debugging:
```bash
URL=https://example.com docker compose --profile debug up --build archive-worker-vnc
```
Unlike `podman-run.sh`, Compose maps VNC to host port `5900`.
## Known limitations
@@ -201,10 +217,13 @@ node src/cli.mjs archive https://example.com
# Archive a page (headful on macOS)
node src/cli.mjs archive https://example.com --headful
# Archive inside container (headless)
# Build worker image
./podman-run.sh build
# Archive inside an ephemeral Xvfb/Chromium worker
./podman-run.sh archive https://example.com
# Archive inside container (headful + VNC)
./podman-run.sh headful-archive https://example.com
# Archive inside worker + expose VNC for debugging
./podman-run.sh vnc-archive https://example.com
# Then open vnc://localhost:5901
```