Add project Export button to Easy Gen

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.
This commit is contained in:
digital-garbage
2026-07-24 11:29:58 +03:00
parent 6a58b35f6f
commit 99c7dd5ba6
2 changed files with 18 additions and 0 deletions
+16
View File
@@ -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);
+2
View File
@@ -56,6 +56,8 @@
<span class="health-chip" id="easy-health-chip"></span>
<div class="menubar-right">
<button class="btn ghost tiny" id="easy-save-btn" type="button">Save</button>
<button class="btn ghost tiny" id="easy-export-btn" type="button"
title="Download this project as a .funpack_project.json file — e.g. to move it off a rental machine">Export…</button>
<button class="btn ghost tiny" id="easy-projects-btn" type="button">Projects…</button>
</div>
</header>