Skip to content

Commit

Permalink
limit what electron store values to expose
Browse files Browse the repository at this point in the history
  • Loading branch information
philippgitpush committed Dec 5, 2024
1 parent e84ef14 commit 9f64e67
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand All @@ -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'),
Expand Down

0 comments on commit 9f64e67

Please # to comment.