diff --git a/scripts/publish-hot.js b/scripts/publish-hot.js index 9e1681c..0bcfcac 100644 --- a/scripts/publish-hot.js +++ b/scripts/publish-hot.js @@ -39,7 +39,9 @@ if (!token) { if (!token) { console.error("缺少 gitea token:设置 GIT_TOKEN 或写入 ~/.tokendun-git-token"); process.exit(1); } const OWNER = "mhgmh", REPO = "codex-market-app", TAG = "hot"; -const API = `https://update.tokendun.cc/api/v1/repos/${OWNER}/${REPO}`; +// Authenticated writes go through the direct upstream host; public download +// URLs must use update.tokendun.cc because that is what clients/users read. +const API = `https://up.tokendun.cc/api/v1/repos/${OWNER}/${REPO}`; const DL = `https://update.tokendun.cc/${OWNER}/${REPO}/releases/download/${TAG}`; const OUT = path.join(ROOT, "dist-hot"); @@ -115,6 +117,10 @@ function upload(file, name) { "-F", `attachment=@${file};type=application/octet-stream`, `${API}/releases/${rel.id}/assets?name=${encodeURIComponent(name)}`], { encoding: "utf8" }); console.log(`上传 ${name} → HTTP ${code}`); + if (code !== "201") { + console.error(`上传 ${name} 失败,HTTP ${code}`); + process.exit(1); + } } upload(bundlePath, bundleName); upload(manifestPath, "hotupdate.json");