feat(upload): S3 multipart upload with offline resume and wake lock (#391)

* feat(upload): implement S3 multipart upload with offline resume and wake lock

* fix(upload): harden S3 sign and abort authorization, await confirmation, and clean up failed multipart uploads

* fix(webui): resume multipart upload on network recovery and log online event

* fix(webui): remove offline and online toast notifications
This commit is contained in:
Yiling-J
2026-09-07 16:49:00 +08:00
committed by GitHub
parent 62e86b703e
commit 67b767f1e8
23 changed files with 2157 additions and 419 deletions
+28
View File
@@ -36,17 +36,45 @@ export type PresignedUrl = z.infer<typeof presignedUrlSchema>
export const createUploadTaskResponseSchema = z.object({
taskId: z.string(),
presignedUrls: z.array(presignedUrlSchema),
storageBackend: z.enum(['s3', 'local']).default('local'),
createdAssets: z
.array(
z.object({
tempId: z.string(),
assetId: z.string(),
key: z.string().optional(),
}),
)
.optional(),
})
export type CreateUploadTaskResponse = z.infer<typeof createUploadTaskResponseSchema>
export const s3SignRequestSchema = z.object({
key: z.string().min(1),
method: z.enum(['PUT', 'POST', 'GET', 'DELETE']),
uploadId: z.string().optional(),
partNumber: z.number().int().positive().optional(),
fileId: z.string().min(1),
})
export type S3SignRequest = z.infer<typeof s3SignRequestSchema>
export const s3SignResponseSchema = z.object({
url: z.string(),
})
export type S3SignResponse = z.infer<typeof s3SignResponseSchema>
export const abortUploadRequestSchema = z.object({
fileId: z.string().min(1),
uploadId: z.string().optional(),
key: z.string().optional(),
})
export type AbortUploadRequest = z.infer<typeof abortUploadRequestSchema>
export const abortUploadResponseSchema = z.object({
success: z.boolean(),
})
export type AbortUploadResponse = z.infer<typeof abortUploadResponseSchema>
export const confirmFileUploadRequestSchema = z.object({
fileId: z.string(),
errorMessage: z.string().optional(),