feat:优化数据

This commit is contained in:
Daniel
2026-04-02 10:53:36 +08:00
parent a5bf2adad9
commit 0304805ce1
44 changed files with 902 additions and 392 deletions

View File

@@ -83,6 +83,22 @@ saveBtn.addEventListener("click", async () => {
if (payload.sourceFormat === "angle-metal-auto-converted") {
alert("已自动解构并转换为 GLSL展示页可直接渲染。");
}
if (payload.id && typeof window.captureShaderThumbnail === "function") {
try {
const dataUrl = await window.captureShaderThumbnail(payload.code, payload.name);
const thumbRes = await fetch(`${API_BASE}/${encodeURIComponent(payload.id)}/thumbnail`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ pngBase64: dataUrl }),
});
if (!thumbRes.ok) {
const t = await thumbRes.json().catch(() => ({}));
console.warn("缩略图上传失败:", t.error || thumbRes.status);
}
} catch (e) {
console.warn("缩略图生成失败:", e);
}
}
nameInput.value = "";
authorInput.value = "";
codeInput.value = "";