webui: replace nautctl web server with a loadable plugin

Drop the web UI that was compiled into nautctl and serve the
torrent-ui front end (../torrent-ui/public) from a native plugin
(plugins/webui) loaded via `nautd --plugin`. The plugin talks to the
engine only through the host call_rpc ABI and adapts the daemon's RPC
surface to the qBittorrent-style contract the UI expects (snapshot/SSE,
torrent detail tabs, add/delete, cookie auth).

Also folds in the daemon refactor that owns per-torrent worker threads
and the swarm engine (naut_swarm) used by the plugin's data source.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ookami125 2026-06-17 00:21:48 -04:00
parent 50a357968a
commit 8dde48c05a
27 changed files with 2706 additions and 403 deletions

View file

@ -70,7 +70,8 @@ if [ "$MODE" = "udp" ]; then
else
announce="http://127.0.0.1:$tracker_port/announce"
fi
python3 - "$SOURCE_TOR" "$tor" "$announce" <<'PY'
backup="http://127.0.0.1:1/lower-tier-should-not-be-contacted"
python3 - "$SOURCE_TOR" "$tor" "$announce" "$backup" <<'PY'
import sys
@ -90,7 +91,8 @@ def skip(data, pos):
return colon + 1 + size
source, target, announce = sys.argv[1], sys.argv[2], sys.argv[3].encode()
source, target = sys.argv[1], sys.argv[2]
announce, backup = sys.argv[3].encode(), sys.argv[4].encode()
data = open(source, "rb").read()
pos = 1
raw_info = None
@ -107,6 +109,8 @@ while data[pos] != ord("e"):
assert raw_info is not None
rewritten = (
b"d8:announce" + str(len(announce)).encode() + b":" + announce
+ b"13:announce-listll" + str(len(announce)).encode() + b":" + announce
+ b"el" + str(len(backup)).encode() + b":" + backup + b"ee"
+ b"4:info" + raw_info + b"e"
)
open(target, "wb").write(rewritten)
@ -125,5 +129,10 @@ if ! grep -q "REQUEST" "$tracker_log"; then
echo "FAIL: tracker received no announce"
exit 1
fi
if grep -q "$backup" "$swarm_log"; then
echo "FAIL: lower tracker tier was contacted after primary success"
cat "$swarm_log"
exit 1
fi
echo "PASS: $MODE tracker discovery produced byte-identical output"