Files
proxy-suite-flake/windows/tools/screenshots.sh
T
2026-10-27 18:22:58 +03:00

78 lines
4.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Screenshots of every page of the app, for the README: the service on Linux with a demo
# configuration (a local Shadowsocks exit, zapret's presets from a built release, autoProxy,
# whitelist-bypass, the Telegram proxy), the app on a virtual display (tools/gui-shot.sh).
# In the dev shell, after tools/package.sh:
#
# tools/screenshots.sh [OUT_DIR] (OUT_DIR: docs/screenshots)
set -euo pipefail
cd "$(dirname "$0")/.."
OUT=$(realpath -m "${1:-docs/screenshots}")
mkdir -p "$OUT"
WORK=$(mktemp -d)
STATE=$WORK/state
SOCK=${XDG_RUNTIME_DIR:-/tmp}/proxy-suite-shots.sock
rm -f "$SOCK"
mkdir -p "$STATE/bin"
port() { python3 -c 'import socket;s=socket.socket();s.bind(("127.0.0.1",0));print(s.getsockname()[1])'; }
SS=$(port) PROXY=$(port) CLASH=$(port) TEST=$(port)
KEY=a2tra2tra2tra2tra2traw==
cat >"$WORK/server.json" <<JSON
{ "log": { "level": "warn" },
"inbounds": [{ "type": "shadowsocks", "listen": "127.0.0.1", "listen_port": $SS, "method": "2022-blake3-aes-128-gcm", "password": "$KEY" }],
"dns": { "servers": [{ "type": "https", "tag": "local", "server": "1.1.1.1" }] },
"outbounds": [{ "type": "direct" }], "route": { "default_domain_resolver": "local" } }
JSON
sing-box run -c "$WORK/server.json" >/dev/null 2>&1 &
SERVER=$!
SS_URL="ss://2022-blake3-aes-128-gcm:${KEY//=/%3D}@127.0.0.1:$SS"
cat >"$STATE/config.json" <<JSON
{ "proxy": { "enable": true, "listener": { "port": $PROXY },
"singBox": { "clashApiPort": $CLASH, "testPort": $TEST },
"selection": "urltest",
"routing": { "directRu": false,
"rules": [{ "name": "streaming", "outbound": "Netherlands", "domains": ["youtube.com", "googlevideo.com"] }] },
"autoProxy": { "enable": true, "slowBelowKiBps": 0 },
"outbounds": [{ "tag": "Netherlands", "url": "$SS_URL#Netherlands" },
{ "tag": "Germany", "url": "$SS_URL#Germany" },
{ "tag": "Finland", "url": "$SS_URL#Finland" }] },
"zapret": { "enable": true, "engine": "zapret2",
"zapret2": { "strategySource": "z2k", "strategyLog": true, "cutoff": { "enable": false } },
"zapret-discord-youtube": { "configName": "general (ALT9)", "gameFilter": "all" } },
"tgWsProxy": { "enable": false },
"amneziaWg": { "enable": true, "profiles": {
"home": { "autostart": true, "config": "[Interface]\nPrivateKey = yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=\nAddress = 10.8.0.2/32\nDNS = 1.1.1.1\nJc = 4\nJmin = 40\nJmax = 70\nS1 = 12\nS2 = 34\nH1 = 1\nH2 = 2\nH3 = 3\nH4 = 4\n\n[Peer]\nPublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=\nAllowedIPs = 0.0.0.0/0, ::/0\nEndpoint = 203.0.113.7:51820\n" },
"office": { "asOutbound": "userspace", "config": "[Interface]\nPrivateKey = yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=\nAddress = 10.8.0.2/32\nDNS = 1.1.1.1\nJc = 4\nJmin = 40\nJmax = 70\nS1 = 12\nS2 = 34\nH1 = 1\nH2 = 2\nH3 = 3\nH4 = 4\n\n[Peer]\nPublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=\nAllowedIPs = 0.0.0.0/0, ::/0\nEndpoint = 203.0.113.7:51820\n" } } },
"whitelistBypass": { "enable": true,
"joiners": { "wl": { "platform": "wbstream" } },
"creators": { "office": { "platform": "bitrix" } } } }
JSON
release=$(ls -d dist/ProxySuite-*-windows-x64/components 2>/dev/null | tail -1 || true)
[ -n "$release" ] && cp -r "$release/zapret" "$STATE/bin/" 2>/dev/null || true
cargo build -q -p ps-service -p ps-gui
target/debug/proxy-suite-service --console --state-dir "$STATE" --socket "$SOCK" >"$WORK/service.log" 2>&1 &
SERVICE=$!
trap 'kill $SERVICE $SERVER 2>/dev/null || true; rm -rf "$WORK"' EXIT
for _ in $(seq 60); do target/debug/proxy-ctl --socket "$SOCK" status 2>/dev/null | grep -q 'proxy: active' && break; sleep 0.5; done
# Something for the Logs and Outbounds pages to show: delays, a few lines.
target/debug/proxy-ctl --socket "$SOCK" proxy outbounds test >/dev/null 2>&1 || true
# Sidebar entries, top to bottom (points on a 1280x820 screen).
shot() {
local name=$1 y=$2 extra=${3:-}
SHOT_STEPS="click:197,$y wait:2 $extra" tools/gui-shot.sh "$OUT/$name.png" 8 -- --socket "$SOCK" >/dev/null
# gui-shot keeps the app's log beside the shot: not for the README.
rm -f "$OUT/$name.log"
echo "$OUT/$name.png"
}
shot overview 162
shot dpi-bypass 198
shot telegram 234
shot whitelist-bypass 270
shot outbounds 306
shot autoproxy 342
shot amneziawg 378
shot logs 414
shot settings 450
shot components 486