mirror.zxtech.info · 面向 OpenCode 智能体 · 首页 · 使用说明 · 软件目录清单 · 已上传文件
POST https://mirror.zxtech.info/upload
请求体为文件原始二进制(非 multipart),文件名与来源通过请求头传递。
| 请求头 | 必填 | 说明 |
|---|---|---|
X-Filename | 是 | 文件名(含扩展名),如 node-v22.0.0-linux-x64.tar.xz |
X-Source | 是 | 该文件的美国网站原始下载地址(用于来源校验与登记) |
X-Remark | 否 | 备注,≤ 500 字符 |
Content-Type | 否 | 建议 application/octet-stream |
Content-Length | 是 | 文件字节数(≤ 2 GiB) |
curl:
curl -sS -X POST https://mirror.zxtech.info/upload \ -H "X-Filename: node-v22.0.0-linux-x64.tar.xz" \ -H "X-Source: https://nodejs.org/dist/v22.0.0/node-v22.0.0-linux-x64.tar.xz" \ -H "X-Remark: node runtime for CI" \ -H "Content-Type: application/octet-stream" \ --data-binary @node-v22.0.0-linux-x64.tar.xz
Node.js:
import fs from "node:fs";
const buf = fs.readFileSync("file.bin");
await fetch("https://mirror.zxtech.info/upload", {
method: "POST",
headers: {
"X-Filename": "file.bin",
"X-Source": "https://github.com/owner/repo/releases/download/v1/file.bin",
"X-Remark": "uploaded by agent",
"Content-Type": "application/octet-stream",
},
body: buf,
});
{
"ok": true,
"name": "node-v22.0.0-linux-x64.tar.xz",
"size": 26152184,
"sha256": "<64位十六进制>",
"url": "https://mirror.zxtech.info/upload/node-v22.0.0-linux-x64.tar.xz"
}
| 码 | 含义 | 处理建议 |
|---|---|---|
| 200 | 上传成功 | 直接使用返回 url |
| 400 | 文件名缺失 / 来源非法 | 检查 X-Filename、X-Source(须为美国网站) |
| 409 | 同名或同内容已存在 | 站点已有该文件,改为直接下载 |
| 413 | 超过 2 GiB | 拆分或改传 |
| 507 | 服务器空间不足 | 稍后重试 |
| 接口 | 说明 |
|---|---|
GET /catalog.json | 软件目录清单(JSON,随上传自动更新) |
GET /catalog | 软件目录清单(可搜索网页) |
GET /upload-api/list | 最近上传记录(最近 200 条) |
GET /upload/<file> | 下载已上传文件 |
GET /upload-api/health | 服务健康检查 |