[Config] Shorten IPC event names, remove argv filtering on restart as unneeded

This commit is contained in:
Ducko 2022-03-29 14:05:03 +01:00
parent 4e18696b43
commit c20e652eed
2 changed files with 7 additions and 7 deletions

View file

@ -26,19 +26,19 @@ const open = exports.open = () => {
settings.set('openasar', config);
settings.save();
ipcMain.on('config_set', (e, c) => {
ipcMain.on('cs', (e, c) => {
config = c;
settings.set('openasar', config);
settings.save(); // Ensure saving
});
ipcMain.on('config_get', (e) => {
ipcMain.on('cg', (e) => {
e.returnValue = config;
});
ipcMain.on('config_restart', () => {
ipcMain.on('cr', () => {
settings.save();
app.relaunch({ args: process.argv.filter((x) => x !== '--config') });
app.relaunch({ args: process.argv });
app.exit();
});

View file

@ -2,7 +2,7 @@ const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('Native', {
restart: () => ipcRenderer.send('config_restart'),
set: c => ipcRenderer.send('config_set', c),
get: () => ipcRenderer.sendSync('config_get')
restart: () => ipcRenderer.send('cr'),
set: c => ipcRenderer.send('cs', c),
get: () => ipcRenderer.sendSync('cg')
});