feat: add VNC toggle to dashboard

- Add x11vnc + noVNC container with Traefik reverse proxy
- Add /api/vnc_status and toggle_vnc action to FastAPI
- Add VNC toggle button to BotVPS dashboard
- VNC off by default, controlled via dashboard
This commit is contained in:
2026-05-03 19:42:00 +00:00
parent 912763b3f1
commit 9762e9b76c
5 changed files with 151 additions and 46 deletions

23
vnc/Dockerfile Normal file
View File

@@ -0,0 +1,23 @@
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
x11vnc xvfb \
novnc websockify \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /VNC && cd /VNC \
&& ln -sf /usr/share/novnc/vnc.html vnc.html \
&& ln -sf /usr/share/novnc/vnc_lite.html vnc_lite.html
# X11 socket from host (display :10)
# Host / is mounted at /host_root by BotVPS compose
VOLUME ["/tmp/.X11-unix:/host_x11/X11-unix:rw"]
ENV DISPLAY=:10
COPY docker-entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 6080
ENTRYPOINT ["/entrypoint.sh"]

26
vnc/docker-entrypoint.sh Normal file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
set -e
# Ensure X11 socket exists and has correct permissions
chmod 1777 /tmp/.X11-unix 2>/dev/null || true
chmod 666 /tmp/.X11-unix/X10 2>/dev/null || true
# Start x11vnc — connects to host XFCE on display :10
x11vnc \
-display :10 \
-nopw \
-bg \
-listen 0.0.0.0 \
-xkb \
-ncache 10 \
-ncache_cr \
-forever \
-shared \
-noshm \
-rfbport 5900
# Start websockify → WebSocket proxy for noVNC
exec websockify \
--web /usr/share/novnc \
0.0.0.0:6080 \
localhost:5900