fix: reduce upload failures on Cloudflare Workers

Optimize zip validation, lower max upload to 25MB, raise CPU limit, and show clear errors when Cloudflare returns HTML error pages.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-06 14:14:43 +08:00
parent 1cfa823a95
commit 8d6e2e00b8
9 changed files with 212 additions and 56 deletions

View File

@@ -1,7 +1,8 @@
import { FormEvent, useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import { createBuild } from "../api/client";
import { assertUploadSize, createBuild } from "../api/client";
import { getDefaultAppVersion } from "../lib/version";
import { formatMaxUploadLabel } from "../lib/upload-limits";
export default function Upload() {
const navigate = useNavigate();
@@ -32,6 +33,13 @@ export default function Upload() {
return;
}
try {
assertUploadSize(file);
} catch (err) {
setError(err instanceof Error ? err.message : "文件过大");
return;
}
setLoading(true);
setError(null);
@@ -67,7 +75,8 @@ export default function Upload() {
<section className="doc-section">
<h2>使</h2>
<p className="prose">
index.html 50MB
index.html{" "}
{formatMaxUploadLabel()}
PNG / JPG / ICO zip
2026.5.29 Bundle ID
</p>