feat: migrate to Cloudflare Workers with icon and version upload

Replace Express/SQLite and web/ with frontend/, worker/, and wrangler deploy. Add optional app icon upload, date-based app_version, and build-app workflow input.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-29 13:30:05 +08:00
parent 0921e5f7a1
commit b69dfc4813
55 changed files with 3285 additions and 3411 deletions

View File

@@ -0,0 +1,150 @@
import { useEffect, useState } from "react";
import { Link, useParams } from "react-router-dom";
import { fetchBuild, statusLabel, type Build } from "../api/client";
export default function JobStatus() {
const { id } = useParams<{ id: string }>();
const [build, setBuild] = useState<Build | null>(null);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
if (!id) return;
let cancelled = false;
async function poll() {
try {
const data = await fetchBuild(id!);
if (cancelled) return;
setBuild(data);
setError(null);
if (data.status === "completed" || data.status === "failed") {
return;
}
window.setTimeout(poll, 5000);
} catch (err) {
if (cancelled) return;
setError(err instanceof Error ? err.message : "加载失败");
window.setTimeout(poll, 5000);
}
}
poll();
return () => {
cancelled = true;
};
}, [id]);
if (!id) {
return <p className="error-text"> ID</p>;
}
return (
<>
<div className="status-toolbar">
<h1 className="page-title" style={{ margin: 0 }}>
</h1>
<Link to="/"></Link>
</div>
{error ? <p className="error-text">{error}</p> : null}
<section className="doc-section">
{build ? (
<>
<dl className="meta-list">
<div>
<dt> ID</dt>
<dd>
<code>{build.id}</code>
</dd>
</div>
<div>
<dt></dt>
<dd>{build.appName}</dd>
</div>
<div>
<dt></dt>
<dd>{build.appNameEn}</dd>
</div>
<div>
<dt>Bundle ID</dt>
<dd>
<code>{build.appIdentifier}</code>
</dd>
</div>
<div>
<dt></dt>
<dd>
<code>{build.appVersion}</code>
</dd>
</div>
<div>
<dt></dt>
<dd>
<span className={`badge badge-${build.status}`}>
{statusLabel(build.status)}
</span>
</dd>
</div>
</dl>
{build.status === "completed" ? (
<>
<h3></h3>
<div className="download-row">
{build.windowsUrl ? (
<a
className="btn btn-primary"
href={build.windowsUrl}
target="_blank"
rel="noreferrer"
>
Windows
</a>
) : (
<span className="muted">Windows </span>
)}
{build.androidUrl ? (
<a
className="btn btn-secondary"
href={build.androidUrl}
target="_blank"
rel="noreferrer"
>
Android
</a>
) : (
<span className="muted">Android </span>
)}
</div>
</>
) : null}
{build.status === "failed" ? (
<div className="error-box">
<p>{build.error ?? "构建失败,请查看 GitHub Actions 日志。"}</p>
{build.actionsUrl ? (
<a href={build.actionsUrl} target="_blank" rel="noreferrer">
Actions
</a>
) : null}
</div>
) : null}
{build.status !== "completed" && build.status !== "failed" ? (
<p className="prose" style={{ marginTop: "1rem" }}>
GitHub Actions
</p>
) : null}
</>
) : (
<p className="prose"></p>
)}
</section>
</>
);
}