Files
proxy-suite-flake/windows/tools/build-tg-ws-proxy.sh
T
faumarayandClaude Opus 5.5 9b0d7021f9 windows: zapret-discord-youtube and tg-ws-proxy
zapret: Flowseal's release run as its service.bat runs it: the preset's
winws.exe line (continuations, cmd's caret escapes, %BIN%, %LISTS%, the
game filter) as winws's arguments, the user's domains and addresses in
the lists upstream's module puts them in (kept in the service's own run
directory, the verified release untouched), TCP timestamps on, and
zapret's sites in the proxy's direct list. tools/winws-dry-run.sh has
the release's own winws.exe verify every preset's arguments under Wine:
all 22, both game filters.

tg-ws-proxy: Flowseal's headless proxy on the embeddable CPython 3.12
with hash-pinned win_amd64 wheels (tools/build-tg-ws-proxy.sh), run with
upstream's flags; its relay goes direct under the TUN. Runs under Wine.

proxy-ctl: zapret status|on|off|preset|game-filter, components
list|install.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 23:55:45 +03:00

37 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# tg-ws-proxy for Windows: Flowseal's source (the headless proxy, not the tray app) on the
# official embeddable CPython, with its dependencies as pinned win_amd64 wheels. Everything is
# verified: the Python archive and every wheel by hash, the source by its commit.
#
# tools/build-tg-ws-proxy.sh OUT_DIR (needs curl, git, unzip, pip)
set -euo pipefail
cd "$(dirname "$0")"
OUT=${1:?output directory}
PY_VERSION=3.12.10
PY_URL=https://www.python.org/ftp/python/$PY_VERSION/python-$PY_VERSION-embed-amd64.zip
PY_SHA256=4acbed6dd1c744b0376e3b1cf57ce906f9dc9e95e68824584c8099a63025a3c3
TG_TAG=v1.11.2
TG_COMMIT=307a384ab7f522e34bb1a045884d0bd90f40bee5
WORK=$(mktemp -d)
trap 'rm -rf "$WORK"' EXIT
rm -rf "$OUT" && mkdir -p "$OUT/python" "$OUT/app"
curl -sSfL -o "$WORK/python.zip" "$PY_URL"
echo "$PY_SHA256 $WORK/python.zip" | sha256sum -c --quiet
unzip -q "$WORK/python.zip" -d "$OUT/python"
pip download -q --require-hashes --no-deps --only-binary=:all: --platform win_amd64 \
--python-version 3.12 --implementation cp --dest "$WORK/wheels" -r tg-ws-proxy-requirements.txt
mkdir -p "$OUT/python/Lib/site-packages"
for w in "$WORK"/wheels/*.whl; do unzip -q -o "$w" -d "$OUT/python/Lib/site-packages"; done
git clone -q --depth 1 --branch "$TG_TAG" https://github.com/Flowseal/tg-ws-proxy "$WORK/src"
[ "$(git -C "$WORK/src" rev-parse HEAD)" = "$TG_COMMIT" ] || { echo "tag $TG_TAG moved off $TG_COMMIT"; exit 1; }
cp -r "$WORK/src/proxy" "$WORK/src/utils" "$WORK/src/LICENSE" "$OUT/app/"
# The embeddable Python reads its path from this file alone: the standard library, the
# wheels, and the source.
printf 'python312.zip\n.\nLib\\site-packages\n..\\app\nimport site\n' > "$OUT/python/python312._pth"
echo "${TG_TAG#v}+py$PY_VERSION" > "$OUT/.version"
echo "tg-ws-proxy ${TG_TAG#v} on Python $PY_VERSION in $OUT"