From 9f64e67d7ac866c269b86cd6e861f60c06280fbc Mon Sep 17 00:00:00 2001 From: philippgitpush Date: Thu, 5 Dec 2024 14:12:35 +0100 Subject: [PATCH] limit what electron store values to expose --- src/electron/main.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/electron/main.js b/src/electron/main.js index a36db0d..40fa870 100644 --- a/src/electron/main.js +++ b/src/electron/main.js @@ -35,7 +35,18 @@ server.get(['/', '/config'], (req, res) => { // Electron store route server.get('/settings', (req, res) => { - const settings = store.store; + const keys = [ + 'option_appPort', + 'option_liveMode', + 'data_worldInfo', + 'data_lastWorldId' + ]; + + const settings = keys.reduce((filtered, key) => { + if (key in store.store) filtered[key] = store.store[key]; + return filtered; + }, {}); + res.json(settings); }); @@ -48,9 +59,9 @@ app.whenReady().then(() => { const win = new BrowserWindow({ autoHideMenuBar: true, - minHeight: 300, + minHeight: 206, minWidth: 500, - height: 300, + height: 206, width: 500, webPreferences: { preload: path.join(app.getAppPath(), './src/electron/preload.js'),