kubestronaut-sim/images/desktop/rootfs/usr/local/bin/start-desktop
vumas3r cf4f5be7ae fix: stop browsers running a cached noVNC against the desktop's own
The desktop failed to start in a browser that had cached noVNC 1.6
from the Debian desktop image: its vnc.html, which has no clipboard
Clear button, ran the Ubuntu image's 1.3 ui.js, which wires one up
and threw "Cannot read properties of null". websockify sends only
Last-Modified, so browsers cache noVNC on a guess, and it answers a
revalidation with 304 when the file on disk is older than the copy.

Serve noVNC through websockify-no-store, which adds Cache-Control:
no-store to every response, and from /novnc/ rather than /, so no
browser holds a stale copy at the paths the desktop now uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 16:45:03 -06:00

15 lines
849 B
Bash

#!/bin/bash
# X server + VNC in one (Xvnc), the XFCE session on it, and noVNC's websocket bridge in front.
# VNC has no password: the container's port is published on 127.0.0.1 only (see sim/desktop.py).
set -u
export DISPLAY=:1 HOME=/home/candidate USER=candidate SHELL=/bin/bash
rm -f /tmp/.X1-lock /tmp/.X11-unix/X1
Xvnc :1 -geometry "${GEOMETRY:-1600x900}" -depth 24 -rfbport 5901 -localhost \
-SecurityTypes None -AlwaysShared -desktop "${DESKTOP_NAME:-exam}" >/tmp/xvnc.log 2>&1 &
for _ in $(seq 50); do [ -S /tmp/.X11-unix/X1 ] && break; sleep 0.1; done
cd "$HOME"
dbus-launch --exit-with-session startxfce4 >/tmp/xfce.log 2>&1 &
# noVNC is at /novnc/ (/srv/novnc), not /: browsers may still hold the Debian image's noVNC 1.6 at
# the old paths, cached before websockify-no-store.
exec websockify-no-store --web /srv 6080 127.0.0.1:5901