#!/usr/bin/env bash # Author: cirakg & claude ai # Summary: Run the app in the simulator and show the simulator in your browser through noVNC. # # Usage: sim-vnc.sh DEVICE (the Makefile publishes port 6080 on 127.0.0.1 only) # View: http://127.0.0.1:6080/vnc.html, then "Connect". # # The VNC server listens only inside the container (localhost, no password); # the only way in is the noVNC web socket that the Makefile publishes on your # machine's 127.0.0.1. Stop with Ctrl-C. set -euo pipefail # shellcheck source=ciq-env.sh source "$(dirname "${BASH_SOURCE[0]}")/ciq-env.sh" readonly VNC_PORT=5900 readonly NOVNC_PORT=6080 device="${1:?usage: sim-vnc.sh DEVICE}" ciq_require_sdk ciq_require_key build-app.sh debug "${device}" ciq_start_display ciq_start_simulator x11vnc -display "${DISPLAY}" -localhost -nopw -forever -shared -quiet -rfbport "${VNC_PORT}" \ >/tmp/x11vnc.log 2>&1 & websockify --web /usr/share/novnc "${NOVNC_PORT}" "localhost:${VNC_PORT}" >/tmp/websockify.log 2>&1 & cat >&2 <