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.
This commit is contained in:
@@ -8,6 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
freerdp2-x11 \
|
freerdp2-x11 \
|
||||||
novnc \
|
novnc \
|
||||||
websockify \
|
websockify \
|
||||||
|
xdotool \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
fonts-dejavu-core \
|
fonts-dejavu-core \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|||||||
+20
-1
@@ -221,9 +221,28 @@ X11VNC_PID=$!
|
|||||||
websockify --verbose --idle-timeout="$IDLE_TIMEOUT" --web=/opt/portal 6080 localhost:5900 >/tmp/websockify.log 2>&1 &
|
websockify --verbose --idle-timeout="$IDLE_TIMEOUT" --web=/opt/portal 6080 localhost:5900 >/tmp/websockify.log 2>&1 &
|
||||||
WEBSOCKIFY_PID=$!
|
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
|
# Graceful shutdown on docker stop (SIGTERM) — exit 0 so Docker does NOT auto-restart
|
||||||
cleanup() {
|
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
|
exit 0
|
||||||
}
|
}
|
||||||
trap cleanup TERM INT
|
trap cleanup TERM INT
|
||||||
|
|||||||
@@ -236,7 +236,6 @@ def open_web(
|
|||||||
) -> None:
|
) -> None:
|
||||||
safe_w, safe_h = apply_resolution(width, height)
|
safe_w, safe_h = apply_resolution(width, height)
|
||||||
profile_dir = _create_chrome_profile(login, password, url)
|
profile_dir = _create_chrome_profile(login, password, url)
|
||||||
_state["profile_dir"] = profile_dir
|
|
||||||
cmd = [
|
cmd = [
|
||||||
"chromium",
|
"chromium",
|
||||||
"--no-sandbox",
|
"--no-sandbox",
|
||||||
@@ -261,6 +260,7 @@ def open_web(
|
|||||||
url,
|
url,
|
||||||
]
|
]
|
||||||
_start_process(cmd, "web", url)
|
_start_process(cmd, "web", url)
|
||||||
|
_state["profile_dir"] = profile_dir
|
||||||
|
|
||||||
|
|
||||||
def open_rdp(payload: dict) -> None:
|
def open_rdp(payload: dict) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user