Files
UHD_Media_Tool/packages/adapters/src/qbittorrent/README.md
T
rootandClaude Opus 5.5 fa9221086b feat(adapters,testkit): guarded qB data deletion (B7) and mock qB file materialization (B8)
adapters: assertSafeToDeleteData({contentPath, libraryRoots, importVerified}) rejects
paths inside/equal to/above any library root, relative or root paths, empty roots and
unverified imports; QbClient.delete({deleteFiles:true}) requires a per-hash
SafeDeleteCheck and throws DownloaderError('unsafe_delete') before sending anything.

testkit: mock qB complete(hash, {files, writeFiles}) writes random-content files under
save_path (opt-in, size-capped, traversal-safe); deleteFiles=true removes them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 19:22:56 +08:00

1.4 KiB

qbittorrent

qBittorrent WebUI API v2 适配(QbClient 实现 DownloaderClient,按实例创建,DownloaderRegistry 管多实例):Cookie 登录与会话过期自动重登、API Key(Bearer)、torrents/add(磁力/URL/.torrent,savepath/category/tags/paused+stopped/rename/contentLayout,autoTMM 固定关闭)、torrents/info(hashes/tag/category/filter,多标签子集过滤)、files、filePrio、pause/resume(5.x 自动切到 stop/start)、标签增删与定义删除、delete(deleteFiles 必须显式;deleteFiles:true 必须给每个 hash 附 SafeDeleteCheck,未通过 assertSafeToDeleteData——路径在任何库根内/是库根上级、未验证入库、库根为空——即抛 unsafe_delete 且不发请求)、setForceStart/recheck/setLocation/setCategory/限速与分享限制、只读偏好、sync/maindata、app/version。错误统一为 DownloaderError(auth/network/timeout/notfound/rate/rejected/protocol/unsafe_delete),读请求按配置重试,写请求不自动重试。submit() 本地算 infohash(bencode 自写)→ 预查已存在 → 提交 → 按 hash 或探针标签确认;收单超时/断连时先回查再给结论(added/already_exists/accepted_unconfirmed/rejected/unreachable)。状态映射与完成判定对照 MoviePilot,未知状态不兜底为完成。

仅对 mock 与官方 API 文档验证,未连接真实实例。