hasDisplay (services/virtualDisplay.ts)

OmniRoute · open-sse/services/virtualDisplay.ts · typescript · MIT
infra

Manages a virtual Xvfb display for headless browser automation in environments lacking a physical X server, such as Docker containers or bare-metal servers.

// Source: https://github.com/diegosouzapw/OmniRoute | License: MIT | Copyright 2026 diegosouzapw
// Provided via justclaw.it.com; keep this notice with the code.
// #15300: headed Chromium (zai-web needs a real window — Z.ai's CAPTCHA rejects headless)
// exits at launch on a host with no X server (Docker -web image, bare VPS). When a headed launch
// has no DISPLAY/WAYLAND_DISPLAY on Linux we start one private Xvfb per process and hand its
// DISPLAY to Chromium. Hosts that already have a display are left untouched.
import { spawn as nodeSpawn, type ChildProcess } from "node:child_process";

export const MISSING_DISPLAY_MESSAGE =
  "Missing X server or $DISPLAY: a headed browser needs a display. " +
  "Install Xvfb (apt-get install xvfb) or run with xvfb-run / the -web Docker image.";

e

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key