From 99c7dd5ba662b7dc6ea7df1ccc67832f993c4d66 Mon Sep 17 00:00:00 2001 From: digital-garbage <133010426+digital-garbage@users.noreply.github.com> Date: Fri, 24 Jul 2026 11:29:58 +0300 Subject: [PATCH] Add project Export button to Easy Gen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Easy Gen's "Save" persists into FunPack's own project store on that machine, same as the Editor's autosave — it was never a way to move a project between machines. The backend route for that (download the actual .funpack_project.json, re-importable via "Load Project File...") already existed and easy_gen/frontend/api.js already had the URL helper, but no button anywhere called it, unlike the Editor's File > "Save Project File...". Added an "Export..." button next to Save that flushes a save first, then downloads the project file. --- easy_gen/frontend/app.js | 16 ++++++++++++++++ easy_gen/frontend/index.html | 2 ++ 2 files changed, 18 insertions(+) diff --git a/easy_gen/frontend/app.js b/easy_gen/frontend/app.js index fb14867c..2c2b114e 100644 --- a/easy_gen/frontend/app.js +++ b/easy_gen/frontend/app.js @@ -19,6 +19,7 @@ const advancedBtn = document.getElementById("easy-advanced-btn"); const projectsBtn = document.getElementById("easy-projects-btn"); const saveBtn = document.getElementById("easy-save-btn"); + const exportBtn = document.getElementById("easy-export-btn"); const preview = window.EasyPreview.create(document.getElementById("easy-preview")); @@ -52,6 +53,7 @@ uploadBtn.disabled = !p; galleryBtn.disabled = !p; saveBtn.disabled = !p; + exportBtn.disabled = !p; if (p && !promptFocused) { const text = p.global_prompt || ""; if (promptEl.value !== text) promptEl.value = text; @@ -142,6 +144,20 @@ projectsBtn.onclick = () => window.ProjectMenu.open({ dismissable: !!S.get().project }); galleryBtn.onclick = () => window.EasyGallery.open(); + // "Save" persists into FunPack's own project store on THIS machine — the same mechanism + // as the Editor's autosave. It doesn't help moving a project off a rental GPU box. This + // downloads the actual .funpack_project.json file (re-importable via "Load Project + // File…" on another machine), same as the Editor's File ▸ "Save Project File…". + exportBtn.onclick = async () => { + const st = S.get(); + if (!st.project) return; + try { await S.save(); } catch (_) { /* export the last-saved version anyway */ } + const a = document.createElement("a"); + a.href = API.downloadProjectUrl(st.project.id); + a.download = ""; + document.body.appendChild(a); a.click(); document.body.removeChild(a); + }; + let saveResetTimer = null; saveBtn.onclick = async () => { if (saveResetTimer) clearTimeout(saveResetTimer); diff --git a/easy_gen/frontend/index.html b/easy_gen/frontend/index.html index c46263c6..095ad4a7 100644 --- a/easy_gen/frontend/index.html +++ b/easy_gen/frontend/index.html @@ -56,6 +56,8 @@