Restore real platform uploads

This commit is contained in:
CPTProgrammer 2026-07-17 21:41:27 +08:00
parent 5dd25a3267
commit e5de2f5dbd
No known key found for this signature in database
2 changed files with 26 additions and 36 deletions

View File

@ -79,23 +79,18 @@ export class CurseForgeClient {
if (isPublishDryRun()) {
return interceptUpload("CurseForge", "POST", url, body) as Promise<T>;
}
// ⚠️ 真实上传已暂时禁用,防止调试期间误传。
// 恢复方式:删除下面的 throw并取消注释 fetch 代码块。
throw new Error(
"真实上传已暂时禁用,请设置 PUBLISH_DRY_RUN=1 使用模拟发布",
);
// const res = await fetch(url, {
// method: "POST",
// headers: this.uploadHeaders(),
// body,
// });
// if (!res.ok) {
// const reqBody = summarizeFormData(body);
// const resBody = await readErrorBody(res);
// throw new Error(
// `CurseForge Upload POST ${path} failed: ${res.status} ${res.statusText}\n\n--Request--:\n${reqBody}\n\n--Response--:\n${resBody}`,
// );
// }
// return res.json() as Promise<T>;
const res = await fetch(url, {
method: "POST",
headers: this.uploadHeaders(),
body,
});
if (!res.ok) {
const reqBody = summarizeFormData(body);
const resBody = await readErrorBody(res);
throw new Error(
`CurseForge Upload POST ${path} failed: ${res.status} ${res.statusText}\n\n--Request--:\n${reqBody}\n\n--Response--:\n${resBody}`,
);
}
return res.json() as Promise<T>;
}
}

View File

@ -46,23 +46,18 @@ export class ModrinthClient {
if (isPublishDryRun()) {
return interceptUpload("Modrinth", "POST", url, body) as Promise<T>;
}
// ⚠️ 真实上传已暂时禁用,防止调试期间误传。
// 恢复方式:删除下面的 throw并取消注释 fetch 代码块。
throw new Error(
"真实上传已暂时禁用,请设置 PUBLISH_DRY_RUN=1 使用模拟发布",
);
// const res = await fetch(url, {
// method: "POST",
// headers: this.headers(),
// body,
// });
// if (!res.ok) {
// const reqBody = summarizeFormData(body);
// const resBody = await readErrorBody(res);
// throw new Error(
// `Modrinth API POST ${path} failed: ${res.status} ${res.statusText}\n\n--Request--:\n${reqBody}\n\n--Response--:\n${resBody}`,
// );
// }
// return res.json() as Promise<T>;
const res = await fetch(url, {
method: "POST",
headers: this.headers(),
body,
});
if (!res.ok) {
const reqBody = summarizeFormData(body);
const resBody = await readErrorBody(res);
throw new Error(
`Modrinth API POST ${path} failed: ${res.status} ${res.statusText}\n\n--Request--:\n${reqBody}\n\n--Response--:\n${resBody}`,
);
}
return res.json() as Promise<T>;
}
}