diff --git a/main.js b/main.js index 272a9c5..1dced18 100644 --- a/main.js +++ b/main.js @@ -204,6 +204,22 @@ app.whenReady().then(async () => { ipcMain.handle("features", () => { return configFeatures; }); + + ipcMain.handle("set-feature", (event, { key, value }) => { + try { + // update mémoire + configFeatures[key] = value; + + // écriture directe sur le JSON + fs.writeFileSync(configFolderPath, JSON.stringify(configFeatures, null, 2), "utf-8"); + + logger.info(`Feature updated: ${key} = ${value}`); + return true; + } catch (err) { + logger.error(`set-feature failed (${key}): ${err.message}`); + return false; + } + }); configFeatures.discordRPC ? startRPC() : ""; diff --git a/preload.js b/preload.js index aacdf74..e9ca875 100644 --- a/preload.js +++ b/preload.js @@ -5,6 +5,7 @@ contextBridge.exposeInMainWorld("electronAPI", { selectDownloadFolder: () => ipcRenderer.invoke("select-download-folder"), setProgress: (percent) => ipcRenderer.send("set-progress", percent), getFeatures: () => ipcRenderer.invoke("features"), + setFeature: (key, value) => ipcRenderer.invoke("set-feature", { key, value }), getVersion: () => ipcRenderer.invoke("version"), getValidatedDownloadPath: (path) => ipcRenderer.invoke("validate-download-path", path) }); diff --git a/public/assets/icon/settings.png b/public/assets/icon/settings.png deleted file mode 100644 index 848e6b1..0000000 Binary files a/public/assets/icon/settings.png and /dev/null differ diff --git a/public/assets/icon/settings.svg b/public/assets/icon/settings.svg new file mode 100644 index 0000000..39ab649 --- /dev/null +++ b/public/assets/icon/settings.svg @@ -0,0 +1,2 @@ + +ionicons-v5-q \ No newline at end of file diff --git a/public/index.html b/public/index.html index f4bfa4f..7050fe2 100644 --- a/public/index.html +++ b/public/index.html @@ -23,7 +23,6 @@ -
@@ -31,18 +30,167 @@
- - - + -