nautd/webui: scripting, labels, settings, set-location, pause fix

Session checkpoint on webui-plugin:
- engine dump (nautctl dump) + engine endgame integration
- per-file move locations persistence; torrent-level "Set location"
  with reset/keep-relative/leave-separate handling + residual prune
- Lua: naut.get_labels, define_settings/get_setting (script_host struct)
- daemon-owned labels (category+tags) + taxonomy persistence; webui write-through
- fix: pausing a completed/seeding torrent now sticks (stop wins over result)
- automation tab responsive layout; anime_sort label gating + settings

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ookami125 2026-06-21 23:19:41 -04:00
parent 6dc711cf57
commit b633b7d216
40 changed files with 3305 additions and 3267 deletions

View file

@ -1,9 +1,9 @@
/* tracker.h — HTTP and UDP tracker clients (BEP-3/BEP-23, BEP-15).
/* tracker.h — HTTP and UDP tracker announce client.
*
* Split into pure codec (URL building, bencode response parsing, UDP packet
* encode/decode all unit-testable without a socket) and thin blocking fetch
* helpers used by the swarm app. HTTPS/TLS is deferred to a later transport
* backend; the built-ins in this phase are plaintext HTTP and UDP.
* The wire codec (query building, bencode/UDP packet encode+decode) lives in the
* sibling `torrent-tracker` library; the implementation here (src/discovery)
* owns only the socket glue. HTTPS/TLS is deferred to a later transport backend;
* the built-ins are plaintext HTTP and UDP.
*/
#ifndef NAUT_TRACKER_H
#define NAUT_TRACKER_H
@ -37,25 +37,10 @@ typedef struct {
void naut_tracker_response_free(naut_tracker_response *r);
/* --- HTTP --- */
/* Build the full announce GET URL (base?...params) with percent-encoded binary
* info_hash/peer_id. Returns bytes written (excl NUL) or 0 on overflow. */
size_t naut_tracker_http_url(const char *base, const naut_announce_req *req,
char *out, size_t outsz);
/* Parse a bencoded HTTP tracker response body (compact or dict peer list). */
naut_err naut_tracker_parse_http(const uint8_t *body, size_t len,
naut_tracker_response *out);
/* --- UDP (BEP-15): pure packet codec --- */
#define NAUT_UDP_CONNECT_REQ_LEN 16
#define NAUT_UDP_ANNOUNCE_REQ_LEN 98
void naut_udp_build_connect(uint8_t out[16], uint32_t txid);
naut_err naut_udp_parse_connect(const uint8_t *in, size_t len, uint32_t txid,
uint64_t *connection_id);
void naut_udp_build_announce(uint8_t out[98], uint64_t connection_id,
uint32_t txid, const naut_announce_req *req);
naut_err naut_udp_parse_announce(const uint8_t *in, size_t len, uint32_t txid,
naut_tracker_response *out);
/* --- live fetch helpers (blocking) --- */
/* HTTP GET the announce URL; fills out. Only http:// (no TLS yet). */