- Articles now carry a `grabbed` flag; manually downloading one (or an
auto/forced rule grab) marks it, persisted across restarts, so the UI
shows it as added and re-runs skip it.
- POST /api/rss/refresh {name?} synchronously re-polls one feed (or all)
for an on-demand repull.
- POST /api/rss/rules/run {name} re-applies a rule to every existing
article (not just newly-seen ones), grabbing ungrabbed matches —
useful after editing a rule. Returns matched/grabbed counts.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add POST /api/rss/download so the UI can grab a torrent from a feed
article or a search result (magnet or .torrent URL) via the same tested
add path as the auto-downloader. Marks ISSUES #6 done.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a real backend behind the RSS and Search tabs:
- nautd gains a generic web-UI blob store (set/get_webui_blob) so the
web layer can persist RSS feeds, auto-download rules and indexer
config under <state_dir>/webui_<key>.json.
- The webui plugin runs a background poller that fetches each feed over
HTTP(S), parses RSS 2.0 / Atom items (title, link, enclosure, size,
pubDate, magnet incl. torrent:magnetURI), dedupes, and stores articles.
- Auto-download rules (substring or POSIX regex, mustContain/
mustNotContain, per-feed scope) fire on newly-seen items and add the
torrent via the daemon — from a magnet, or by fetching a .torrent
enclosure and uploading its bytes — applying category/save path/paused.
- Search queries every enabled Torznab indexer and merges results
(name, size, seeders, leechers, magnet/.torrent), exposed as
searchPlugins in /api/meta.
New endpoints: GET/POST /api/rss(+/delete), /api/rss/rules(+/delete),
/api/indexers(+/delete), GET /api/search?q=.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A small libssl-backed client (naut_http_get) that fetches a URL over
plain HTTP or TLS, follows 3xx redirects, and decodes Content-Length
and chunked bodies. Foundation for the RSS poller and Torznab search.
Built as a PIC static lib so it can link into the webui plugin module.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add POST /api/categories/edit. Renames a category, updating its save
path and reassigning every torrent that referenced the old name; the
empty-named Uncategorized pseudo-category can have its save path set
but not renamed. Changes persist via the daemon taxonomy.
Closes ISSUES #2.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A paused torrent never ran a worker, so it never verified on-disk data
and showed no progress. Add a one-shot check-only swarm mode (open +
resume scan + report, no peers/engine/download). The reconciler runs it
for a paused torrent flagged needs_check (set on paused-add and recheck);
the worker stays paused afterward. New TORRENT_CHECKING state -> webui
checkingDL/UP. Mark #11 done.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
spawn_torrent parses each torrent's file list (at add and restore) and
refuses an add whose files would write where a registered torrent's data
lives (NAUT_ERR_EXIST). Magnets are checked once metadata is known is
out of scope; restore skips the check. webui surfaces it as HTTP 409.
Mark #10 done.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
report_progress now fills peer_stats via engine_peer_list, so the peer
list (ip, progress, dl rate, state) shows again. Mark #12 done.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
api_add forwards tags to the daemon, assigns them to the new torrent,
and registers any new tag names in the persisted taxonomy. Mark #7 done.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
api_add now forwards the chosen category to the daemon (and fixes a
use-after-free reading it from the freed request). Mark issues #3, #8, #9
done in ISSUES.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The daemon segfaulted the moment any torrent existed: map_torrent built
its JSON with one 30-key json_pack whose format string had drifted out of
sync with the argument list, so json_pack misread an int as a char* and
crashed in the next snapshot build (an empty fleet hid it). Rebuild the
object field-by-field with json_object_set_new so it can't drift again.
Add a web-layer category/tag store (in memory, like qBittorrent's own Web
API) so the UI can actually create categories and tags and assign them:
- /api/categories[/delete] and /api/tags[/delete] persist and return them
- /api/meta returns the stored categories/tags
- /api/action handles setCategory/addTags/removeTags (still 501 for
engine-level verbs the daemon can't do)
- map_torrent fills each torrent's category/tags from the store
Uploaded torrents kept their temp upload path as the display name; keep
the name the UI sends at add time and prefer it in the grid.
Fix a use-after-free in api_action that read the action string after
freeing the request, which corrupted the error body into a 500.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Address the review of the webui plugin:
- Live download rates. A background sampler polls the daemon once per
second, derives per-torrent dlspeed from successive byte counts (EWMA
smoothed), and computes a real ETA. dl_info_speed now aggregates the
fleet instead of reporting a hardcoded 0.
- Single shared snapshot. The sampler publishes one cached snapshot that
/api/snapshot, /api/torrents and every SSE stream serve, so N browser
tabs no longer each poll the engine and race the speed table. SSE
waiters block on a condition and wake promptly on shutdown.
- Honest /api/action. The engine has no pause/resume/recheck/queue verbs,
so the endpoint returns 501 with an explanatory message instead of
claiming success.
- Reject oversized uploads with 413 instead of silently truncating a
torrent into garbage.
- Auth hardening: constant-time credential comparison, CSPRNG-only token
generation via getrandom (fail closed, no weak fallback), oldest-session
eviction instead of clobbering slot 0, and a warning when bound to a
non-loopback address.
- Cap concurrent connections (503 beyond the limit) so a client can't
spawn unbounded threads.
- nautd: tear down plugins (joining the webui's threads) before freeing
torrent tasks, closing a shutdown-time use-after-free window where an
in-flight request could touch freed state.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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>
Add a worked nautd scripting example that files each anime episode into a
media-server-friendly library the moment its file finishes verifying:
<SORTED_ROOT>/<Title>/Season NN/<Title> - SNNENN.<ext>
- examples/anitomy.lua: a compact, dependency-free reimplementation of Anitomy
(title/season/episode/release-group/resolution/year) in pure Lua — no
require/io/os, so it embeds in the sandbox.
- examples/anime_sort.lua: on_file_complete hook that parses the filename and
calls naut.move_file(); the embedded parser is a verbatim copy of anitomy.lua.
- examples/test_anitomy.lua, test_anime_sort.lua: parser battery + end-to-end
path-building test with an embedded-vs-module drift guard. Wired into ctest as
example_anitomy / example_anime_sort when a lua interpreter is present.
- docs: examples/README.md plus pointers from README and docs/scripting.md.
Verified end to end against a live nautd: file_complete -> move_file -> on-disk
relocate into the sorted tree.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>