Upstream's cutoff.nix and cutoff-probe.template.sh: z2k-detect (built from z2k's pinned source for Windows, in zapret2-extras) finds the networks this line cuts after ~16 KB, and with z2k's own strategies a whitelisted name per network; z2k-tcp16.lua inside winws2 reads the maps (Z2K_TCP16_*, their digest in the environment so a new map restarts winws2); what no name fixes goes to the zapret-cutoff rule-set for the proxy (cutoff.proxyFallback). Upstream keeps zapret2 off the probe with an nft cgroup rule. Here z2k-detect is patched to dial from a local port range (Z2K_TCP16_LOCAL_PORTS, 44000-47999, below Windows' dynamic range) and winws2 gets --wf-raw-filter leaving that range alone; under the TUN the probe and the service's own lookups of the line's network go direct. Rounds as upstream's timer: 5 min after start, every 10 min, probing when the line's network (ipinfo.io and ifconfig.co agreeing) changed or a day passed. Request::ZapretCutoff, proxy-ctl zapret cutoff [probe], a card on the DPI page. Verified live on a line that cuts (25 networks, a name for each), the Windows z2k-detect under Wine, winws2 --dry-run and --wf-save with the filter. gui-shot's scroll takes a count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
2.2 KiB
Bash
Executable File
49 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# The app without a display: run on Xvfb with Mesa's software Vulkan (lavapipe), and a
|
|
# screenshot of it once it has drawn. For checking the GUI on Linux, in the dev shell.
|
|
#
|
|
# tools/gui-shot.sh OUT.png [SECONDS] [-- APP ARGS...] (APP=target/debug/proxy-suite)
|
|
#
|
|
# Before the shot, SHOT_STEPS does what it lists, in order, each followed by a moment for the
|
|
# app to answer: "click:X,Y" (screen points), "type:TEXT" (no spaces), "key:NAME" (xdotool's
|
|
# names, e.g. ctrl+a), "scroll:X,Y[,N]" (N steps down, there; ten), "wait:SECONDS".
|
|
set -euo pipefail
|
|
OUT=$(realpath -m "${1:?the screenshot, a .png}"); shift
|
|
WAIT=6
|
|
if [ $# -gt 0 ] && [ "$1" != "--" ]; then WAIT=$1; shift; fi
|
|
[ "${1:-}" = "--" ] && shift
|
|
cd "$(dirname "$0")/.."
|
|
APP=$(realpath "${APP:-target/debug/proxy-suite}")
|
|
GEOMETRY=${GEOMETRY:-1280x820}
|
|
|
|
path() { nix build --no-link --print-out-paths --inputs-from . "nixpkgs#$1.out" | head -1; }
|
|
XVFB=$(path xvfb) MESA=$(path mesa) MAGICK=$(path imagemagick) XDOTOOL=$(path xdotool)
|
|
|
|
n=90
|
|
while [ -e "/tmp/.X11-unix/X$n" ] || [ -e "/tmp/.X$n-lock" ]; do n=$((n + 1)); done
|
|
"$XVFB/bin/Xvfb" ":$n" -screen 0 "${GEOMETRY}x24" -nolisten tcp >/dev/null 2>&1 &
|
|
XPID=$!
|
|
trap 'kill "${APID:-}" "$XPID" 2>/dev/null || true' EXIT
|
|
for _ in $(seq 50); do [ -e "/tmp/.X11-unix/X$n" ] && break; sleep 0.1; done
|
|
|
|
# Not the desktop's session bus: the app's tray icon would appear on the real desktop.
|
|
env -u WAYLAND_DISPLAY -u DBUS_SESSION_BUS_ADDRESS DISPLAY=":$n" VK_ICD_FILENAMES="$MESA/share/vulkan/icd.d/lvp_icd.x86_64.json" \
|
|
"$APP" "$@" >"${OUT%.png}.log" 2>&1 &
|
|
APID=$!
|
|
sleep "$WAIT"
|
|
kill -0 "$APID" 2>/dev/null || { echo "the app exited:"; tail -20 "${OUT%.png}.log"; exit 1; }
|
|
x() { DISPLAY=":$n" "$XDOTOOL/bin/xdotool" "$@"; }
|
|
for step in ${SHOT_STEPS:-}; do
|
|
case $step in
|
|
click:*) p=${step#click:}; x mousemove "${p%,*}" "${p#*,}" click 1 ;;
|
|
scroll:*) IFS=, read -r sx sy sn <<<"${step#scroll:}"; x mousemove "$sx" "$sy" click --repeat "${sn:-10}" 5 ;;
|
|
type:*) x type --delay 40 "${step#type:}" ;;
|
|
key:*) x key "${step#key:}" ;;
|
|
wait:*) sleep "${step#wait:}" ;;
|
|
*) echo "unknown step: $step"; exit 1 ;;
|
|
esac
|
|
sleep 1.2
|
|
done
|
|
DISPLAY=":$n" "$MAGICK/bin/magick" import -window root "$OUT"
|
|
echo "$OUT"
|