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:
parent
50a357968a
commit
8dde48c05a
27 changed files with 2706 additions and 403 deletions
|
|
@ -49,6 +49,8 @@ struct naut_download {
|
|||
bool *file_done;
|
||||
naut_file_complete_cb file_cb;
|
||||
void *file_cb_ctx;
|
||||
naut_piece_complete_cb piece_cb;
|
||||
void *piece_cb_ctx;
|
||||
};
|
||||
|
||||
static bool bget(const uint8_t *a, uint32_t i) { return (a[i>>3] >> (i&7)) & 1; }
|
||||
|
|
@ -157,6 +159,11 @@ void naut_download_set_worker_pool(naut_download *d, naut_worker_pool *pool) {
|
|||
void naut_download_set_file_cb(naut_download *d, naut_file_complete_cb cb, void *ctx) {
|
||||
d->file_cb = cb; d->file_cb_ctx = ctx;
|
||||
}
|
||||
void naut_download_set_piece_cb(naut_download *d, naut_piece_complete_cb cb,
|
||||
void *ctx) {
|
||||
d->piece_cb = cb;
|
||||
d->piece_cb_ctx = ctx;
|
||||
}
|
||||
bool naut_download_file_complete(const naut_download *d, uint32_t f) {
|
||||
return f < d->num_files && d->file_done[f];
|
||||
}
|
||||
|
|
@ -300,6 +307,7 @@ static naut_err finish_verified(naut_download *d, uint32_t p,
|
|||
d->bytes_done += ps;
|
||||
free_ps(d, p);
|
||||
*done = true;
|
||||
if (d->piece_cb) d->piece_cb(d->piece_cb_ctx, p);
|
||||
notify_files(d, p);
|
||||
return NAUT_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue