代码提交

This commit is contained in:
2026-03-03 10:38:37 +08:00
parent e904d7af1d
commit 000d1ef1a8
22 changed files with 7043 additions and 0 deletions

15
electron/preload.js Normal file
View File

@@ -0,0 +1,15 @@
const { contextBridge, ipcRenderer } = require("electron");
contextBridge.exposeInMainWorld("electronAPI", {
getConfig: () => ipcRenderer.invoke("getConfig"),
saveConfig: (config) => ipcRenderer.invoke("saveConfig", config),
selectDirectory: (defaultPath) => ipcRenderer.invoke("selectDirectory", defaultPath),
selectReferenceFiles: () => ipcRenderer.invoke("selectReferenceFiles"),
getImageDataUrl: (filePath) => ipcRenderer.invoke("getImageDataUrl", filePath),
startGeneration: (options) => ipcRenderer.invoke("startGeneration", options),
onGenerationProgress: (cb) => {
const handler = (_e, data) => cb(data);
ipcRenderer.on("generationProgress", handler);
return () => ipcRenderer.removeListener("generationProgress", handler);
},
});