Restore real platform uploads
This commit is contained in:
parent
5dd25a3267
commit
e5de2f5dbd
@ -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>;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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>;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user