离线下载 · API
① 提交任务(code 为你的自定义提取码,任意字符串):
curl -X POST __ORIGIN__/api/offline/submit \
-H 'Content-Type: application/json' \
-d '{"url":"https://example.com/big-file.zip","code":"我的提取码123"}'
→ {"ok":true,"taskId":"a1b2c3d4e5f6","mode":"code"}
② 凭提取码查询进度:
curl '__ORIGIN__/api/offline/status?code=我的提取码123'
→ {"ok":true,"tasks":[{"id":"a1b2c3d4e5f6","status":"downloading","progress":42.3,"speed":1048576,"name":"big-file.zip", ...}]}
③ 完成后凭提取码取回文件:
curl -o big-file.zip '__ORIGIN__/file/a1b2c3d4e5f6?code=我的提取码123'
④ BT 与 eD2K:把 url 换成磁力 / 种子 / ed2k 链接即可,其余流程完全一致:
# 磁力(magnet:?xt=urn:btih:…)
curl -X POST __ORIGIN__/api/offline/submit \
-H 'Content-Type: application/json' \
-d '{"url":"magnet:?xt=urn:btih:dd8255ec...&dn=Big+Buck+Bunny","code":"提取码"}'
# eD2K 链接(ed2k://|file|名称|大小|HASH|/)
curl -X POST __ORIGIN__/api/offline/submit \
-H 'Content-Type: application/json' \
-d '{"url":"ed2k://|file|example.bin|1048576|31D6CFE0D16AE931B73C59D7E0C089C0|/","code":"提取码"}'
# .torrent 种子地址(http 直链到 .torrent 文件)
curl -X POST __ORIGIN__/api/offline/submit \
-H 'Content-Type: application/json' \
-d '{"url":"https://example.com/file.torrent","code":"提取码"}'
BT 引擎为 aria2(DHT + PEX + 公共 Tracker),eD2K 引擎为 aMule(自动连接社区服务器与 KAD);P2P 下载速度取决于资源健康度,冷门资源可能长时间无源。
对象存储 · API
表单上传(multipart):
curl -F "file=@photo.jpg" __ORIGIN__/api/upload
→ {"ok":true,"url":"__ORIGIN__/f/x9y8z7w6v5.jpg"}
原始字节流上传(raw body):
curl -T photo.jpg '__ORIGIN__/api/upload?name=photo.jpg'
→ {"ok":true,"url":"__ORIGIN__/f/x9y8z7w6v5.jpg"}
访问直链:
curl -I __ORIGIN__/f/x9y8z7w6v5.jpg # 任何人可通过此直链访问
# /f/ 直链默认内联预览,加 ?dl=1 强制下载
# /file/ 取件默认触发下载,加 ?inline=1 内联预览
所有接口支持 CORS;不带 code 提交离线任务时按 Cookie 识别身份(适合浏览器 fetch)。