feat: 支持 Torrent 解析与数据持久化(v1/v2/Hybrid)
- 实现对 Torrent v1、v2 以及 Hybrid 模式的解析
- 完成 Torrent 元信息的数据库持久化逻辑
- 支持 announce 节点、文件信息的提取与存储
- 构建 BtTorrent 表结构与相关插入逻辑
- 预留 OSS 上传接口,明日补充实际上传实现
Change-Id: I4438da0ab364bc8e0d299e1d57474c190584052a
diff --git a/react-ui/src/pages/Torrent/service.ts b/react-ui/src/pages/Torrent/service.ts
index c1d8e26..8e15618 100644
--- a/react-ui/src/pages/Torrent/service.ts
+++ b/react-ui/src/pages/Torrent/service.ts
@@ -166,7 +166,23 @@
data,
});
}
+/**
+ * 上传并解析种子文件
+ * @param file The .torrent file to upload
+ * @returns The parsed torrent data or error message
+ */
+export async function uploadTorrent(file: File) {
+ const formData = new FormData();
+ formData.append('file', file);
+ return request('/api/system/torrent/uploadTorrent', {
+ method: 'POST',
+ data: formData,
+ headers: {
+ 'Content-Type': 'multipart/form-data',
+ },
+ });
+}
/** 删除标签(支持批量) */
export async function removeBtTorrentTag(ids: number[]) {
return request(`/api/system/tags/${ids.join(',')}`, {