Added the ability to specify a proxy for electron to connect through in the config.json file.

This commit is contained in:
TheraNinjaCat 2020-03-31 21:25:51 +13:00
parent c2be98e3df
commit e50281f11c

View File

@ -696,7 +696,17 @@ app.on('ready', async () => {
spellcheck: true,
},
});
mainWindow.loadURL('vector://vector/webapp/');
if (vectorConfig['proxy']) {
console.log(`Starting electron through proxy: ${vectorConfig['proxy']}`);
mainWindow.webContents.session.setProxy({proxyRules: vectorConfig['proxy']})
.then(() => {
mainWindow.loadURL('vector://vector/webapp/');
});
} else {
mainWindow.loadURL('vector://vector/webapp/');
}
Menu.setApplicationMenu(vectorMenu);
// Create trayIcon icon