Skip to content

fix: software rendering, Stop/Start buttons, VNC browser icon, and watchdog#2

Open
PaoloC68 wants to merge 17 commits into
a0-community-plugins:mainfrom
PaoloC68:main
Open

fix: software rendering, Stop/Start buttons, VNC browser icon, and watchdog#2
PaoloC68 wants to merge 17 commits into
a0-community-plugins:mainfrom
PaoloC68:main

Conversation

@PaoloC68
Copy link
Copy Markdown

@PaoloC68 PaoloC68 commented Apr 8, 2026

Summary

Fixes several issues discovered running CamoFox in Docker + Xvfb virtual display environment.

Changes

  • api/camofox_setup.py: _start_server() now includes software rendering env vars (LIBGL_ALWAYS_SOFTWARE=1, GALLIUM_DRIVER=llvmpipe, MOZ_WEBRENDER=0, MOZ_DISABLE_OOP_COMPOSITING=1, MOZ_DISABLE_RDD_SANDBOX=1). Required for correct popup rendering in Xvfb virtual displays.

  • api/camofox_health.py: _server_control() now falls back to subprocess pkill/node when CamofoxCli is not installed. Adds missing import asyncio.

  • tools/camofox_session.py: Fix browser icon never showing active in virtual mode. Node.js does not return vncUrl in toggle-display response; construct fallback URL from config when mode is virtual.

  • scripts/vnc-watchdog.sh: New watchdog that monitors which display camoufox-bin renders on and auto-restarts x11vnc on the correct display. CamoFox spawns its own Xvfb displays (:100, :101) in virtual mode.

PaoloC68 added 2 commits April 8, 2026 14:54
…tchdog

Changes:
- api/camofox_setup.py: Add software rendering env vars to _start_server()
  (LIBGL_ALWAYS_SOFTWARE=1, GALLIUM_DRIVER=llvmpipe, MOZ_WEBRENDER=0,
   MOZ_DISABLE_OOP_COMPOSITING=1, MOZ_DISABLE_RDD_SANDBOX=1)
  These vars are inherited by camoufox-bin via ...process.env spread.

- api/camofox_health.py: Fix Stop/Start buttons with subprocess fallback
  when CamofoxCli is not installed. Stop uses pkill; Start uses direct
  node subprocess with software rendering env vars. Add asyncio import.

- tools/camofox_session.py: Fix browser icon not showing active in Agent
  Zero UI. Node.js API does not return vncUrl in toggle-display response;
  construct fallback URL from config when mode is virtual.

- scripts/vnc-watchdog.sh: New VNC watchdog script that monitors which
  display camoufox-bin is rendering on and auto-restarts x11vnc on the
  correct display. Handles display changes, crashes, and respawns.
  CamoFox spawns its own Xvfb displays (:100, :101) in virtual mode.
- scripts/user.js.template: Firefox preferences that fix black popup
  rendering in Xvfb virtual displays. Disables GPU/WebRender acceleration
  and forces popup windows to open as tabs (browser.link.open_newwindow=3)
  which prevents Google OAuth and similar popups from opening as separate
  black windows.

- README.md: Expanded with Virtual Display Mode section, Google OAuth fix
  documentation with step-by-step user.js instructions, software rendering
  env vars reference, xdotool popup close command, and Scripts reference.
PaoloC68 added 15 commits April 8, 2026 17:35
…uttons

Replaces patched individual handlers with a complete solution:

- api/camofox_startup.py (NEW): Full CamoFox+VNC stack lifecycle in one
  API handler (action: start/stop/restart/status). Start does everything:
  1. Ensure Xvfb :99 is running
  2. Ensure websockify is running
  3. Start CamoFox Node.js server with software rendering env vars
  4. Toggle browser to virtual display mode
  5. Start VNC watchdog (auto-detects camoufox-bin display, starts x11vnc)
  Stop kills all components (watchdog + x11vnc + camoufox-bin + server).
  Each step returns ok/msg for status display in the UI.

- webui/config.html: Updated Start/Stop/Restart buttons to call the new
  camofox_startup endpoint. Start button now shows step-by-step results
  (e.g. 'xvfb:✓ websockify:✓ server:✓ virtual_mode:✓ watchdog:✓').
  Added Restart button. Status message updates inline so users know what
  is happening without needing to check logs.
Headless was the default, making the VNC panel non-functional out of the
box — extremely counter-intuitive for a plugin whose main feature IS the
visual browser. Virtual mode (VNC viewable) is now the default.

Users who specifically want headless for performance can change it in
the Config screen.
The config dropdown showed the SAVED PREFERENCE (config.default_headless)
but the ACTUAL LIVE RUNTIME MODE can be different (changed by toggle at
runtime). This was deeply confusing — users saw 'Headless' selected even
when the browser was actually running in virtual/VNC mode.

Fix: Add a live mode indicator below the dropdown that reads directly from
the Alpine.js camofox store (store.displayMode), which reflects the actual
running state. Also shows a warning when headless is active (VNC panel
will not show browser content) and a confirmation when virtual is active.

The dropdown is now clearly labeled '(for next startup)' and the description
explains it does not change the current running session.
- Start button: disabled when server is already running
- Stop button: disabled when server is not running, shows 'Stopping...'
- Restart button: always available (handles crash recovery)
- 'Refresh' renamed to 'Check Status' — clear intent: polls current
  stack status and reports all 6 components
- Status description shows 🟢 Stack is running / 🔴 Stack is stopped
  as default text (no more ambiguous empty state)
- Added stopping/checkingStatus state vars for in-progress feedback
…ates

A leftover </div> from a previous patch closed the camofox-config wrapper
div prematurely, placing the Start/Stop/Restart/Check Status buttons outside
the Alpine.js x-data scope. Alpine reactive bindings like :disabled broke
silently — undefined variables evaluate to falsy, so all buttons appeared
permanently enabled regardless of serverRunning/stopping/starting state.
- api/camofox_startup.py: After watchdog starts, opens a configurable home
  URL tab so the VNC panel shows content immediately instead of black screen.
  Defaults to https://www.google.com. Home tab is skipped if default_home_url
  is empty in config.

- default_config.yaml: Added default_home_url: 'https://www.google.com'

- webui/config.html: Added 'Home Page URL' config field (type=url input)
  under Server Management. Users can set any URL or leave empty to disable.
  Also removed a duplicate 'Server Management' section title.
…bsockify

Previously _ensure_websockify checked if any websockify was running and
skipped starting a new one if yes. This caused stale/frozen connections:
the noVNC client would be connected to an old websockify that lost its
x11vnc link after a restart, resulting in a static frozen image with no
mouse/keyboard interaction.

Fix: always pkill existing websockify instances and start a fresh single
one on every startup. This ensures the noVNC client always reconnects to
a clean websockify with an active x11vnc link.
…ing (1s→3s); add fission.autostart=false
@PaoloC68 PaoloC68 mentioned this pull request May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant