补强静态发布安全边界
This commit is contained in:
@@ -135,9 +135,15 @@ export type WorksProjectSourcePublishInput = {
|
||||
project: WorksProjectMetadataInput;
|
||||
};
|
||||
|
||||
export type WorksSubmissionBindingWarning = {
|
||||
code: 'LOCAL_PREVIEW_BINDING_SAVE_FAILED';
|
||||
message: string;
|
||||
};
|
||||
|
||||
export type WorksProjectSourcePublishResult = {
|
||||
package: WorksStaticPackageSummary;
|
||||
upload: WorksProjectVersionUpload;
|
||||
bindingWarning?: WorksSubmissionBindingWarning;
|
||||
};
|
||||
|
||||
export type WorksSpeechTranscription = {
|
||||
@@ -416,6 +422,7 @@ export async function publishWorksProjectSource(
|
||||
error?: string;
|
||||
package?: WorksStaticPackageSummary;
|
||||
upload?: WorksProjectVersionUpload;
|
||||
binding_warning?: unknown;
|
||||
}>('/api/works/projects/publish-source', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
@@ -430,7 +437,18 @@ export async function publishWorksProjectSource(
|
||||
response.code,
|
||||
);
|
||||
}
|
||||
return { package: response.package, upload: response.upload };
|
||||
const bindingWarning = isRecord(response.binding_warning)
|
||||
&& response.binding_warning.code === 'LOCAL_PREVIEW_BINDING_SAVE_FAILED'
|
||||
? {
|
||||
code: 'LOCAL_PREVIEW_BINDING_SAVE_FAILED' as const,
|
||||
message: '已提交云端,但本机预览绑定保存失败;可重新打开项目/重新提交。',
|
||||
}
|
||||
: undefined;
|
||||
return {
|
||||
package: response.package,
|
||||
upload: response.upload,
|
||||
...(bindingWarning ? { bindingWarning } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
export async function fetchWorksProjectVersions(
|
||||
|
||||
Reference in New Issue
Block a user