"""sw.py — website-refresh 2026-10-08 screenshot helper. A shim over the catalog's box client (app-catalog-felhom.eu/scripts/box_walk.py, read-only), TARGET 9202, with ONE change: guest() pipes the script into `pct exec 9202 -- bash -s` over `ssh hp`, so nothing is written on the demo-hp host itself (no pct push, no temp file there). SC (0600 scratch with `.ctlpw`) and EV come from the environment. No secret is printed.""" import os, subprocess, sys os.environ.setdefault("TARGET", "9202") sys.path.insert(0, "/mnt/5_hdd/felhom.eu/git/app-catalog-felhom.eu/scripts") import box_walk as b # noqa: E402 def guest(script, timeout=600): r = b.sh(["ssh", "-o", "ConnectTimeout=20", "-o", "BatchMode=yes", "hp", "LC_ALL=C pct exec 9202 -- env LC_ALL=C bash -s"], timeout=timeout, inp=script) return (r.stdout or "") + (("\n[stderr] " + r.stderr.strip()[-800:]) if r.returncode and r.stderr else "") b.guest = guest