From be65be8fdbd9ab7e1d3d3a38a09f69f2e470bec9 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Thu, 30 Apr 2026 14:05:04 +0000 Subject: [PATCH] Fix Chromium autofill timing bug + RDP anti-idle to prevent lock screen - universal-runtime: set _state[profile_dir] AFTER _start_process so _stop_current does not delete the freshly-created profile before Chromium reads it. Without this, Login Data was being wiped. - rdp-proxy: add xdotool dependency and background anti_idle_loop that sends Shift to the xfreerdp window every 30s, forwarded over RDP to reset the remote idle timer and keep the lock screen from kicking in. --- rdp-proxy/Dockerfile | 1 + rdp-proxy/entrypoint.sh | 21 ++++++++++++++++++++- universal-runtime/manager.py | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/rdp-proxy/Dockerfile b/rdp-proxy/Dockerfile index 9bb6eb0..4c22e10 100644 --- a/rdp-proxy/Dockerfile +++ b/rdp-proxy/Dockerfile @@ -8,6 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ freerdp2-x11 \ novnc \ websockify \ + xdotool \ ca-certificates \ fonts-dejavu-core \ && rm -rf /var/lib/apt/lists/* diff --git a/rdp-proxy/entrypoint.sh b/rdp-proxy/entrypoint.sh index 4da4d44..91fd8c3 100644 --- a/rdp-proxy/entrypoint.sh +++ b/rdp-proxy/entrypoint.sh @@ -221,9 +221,28 @@ X11VNC_PID=$! websockify --verbose --idle-timeout="$IDLE_TIMEOUT" --web=/opt/portal 6080 localhost:5900 >/tmp/websockify.log 2>&1 & WEBSOCKIFY_PID=$! + +# Anti-idle: send Shift key to xfreerdp window every 30s to prevent remote lock screen +anti_idle_loop() { + sleep 5 + while true; do + WID=$(DISPLAY="$DISPLAY_NUM" xdotool search --pid "$XFREERDP_PID" 2>/dev/null | head -1) + if [ -n "$WID" ]; then + DISPLAY="$DISPLAY_NUM" xdotool key --window "$WID" shift 2>/dev/null || true + else + DISPLAY="$DISPLAY_NUM" xdotool mousemove --sync 500 300 2>/dev/null || true + sleep 1 + DISPLAY="$DISPLAY_NUM" xdotool mousemove --sync 600 400 2>/dev/null || true + fi + sleep 30 + done +} +anti_idle_loop & +ANTI_IDLE_PID=$! + # Graceful shutdown on docker stop (SIGTERM) — exit 0 so Docker does NOT auto-restart cleanup() { - kill "$XFREERDP_PID" "$X11VNC_PID" "$WEBSOCKIFY_PID" 2>/dev/null + kill "$XFREERDP_PID" "$X11VNC_PID" "$WEBSOCKIFY_PID" "$ANTI_IDLE_PID" 2>/dev/null exit 0 } trap cleanup TERM INT diff --git a/universal-runtime/manager.py b/universal-runtime/manager.py index bcff40e..219c4c1 100644 --- a/universal-runtime/manager.py +++ b/universal-runtime/manager.py @@ -236,7 +236,6 @@ def open_web( ) -> None: safe_w, safe_h = apply_resolution(width, height) profile_dir = _create_chrome_profile(login, password, url) - _state["profile_dir"] = profile_dir cmd = [ "chromium", "--no-sandbox", @@ -261,6 +260,7 @@ def open_web( url, ] _start_process(cmd, "web", url) + _state["profile_dir"] = profile_dir def open_rdp(payload: dict) -> None: