diff --git a/app/view/preferences/Preferences.js b/app/view/preferences/Preferences.js index fbbca456..568b5fec 100644 --- a/app/view/preferences/Preferences.js +++ b/app/view/preferences/Preferences.js @@ -260,8 +260,8 @@ Ext.define('Rambox.view.preferences.Preferences',{ ,checkboxName: 'proxy' ,margin: '10 0 0 0' ,padding: 10 - ,layout: 'hbox' - ,defaults: { labelAlign: 'top' } + ,layout: 'vbox' + ,defaults: { labelAlign: 'left' } ,items: [ { xtype: 'textfield' @@ -275,10 +275,25 @@ Ext.define('Rambox.view.preferences.Preferences',{ xtype: 'numberfield' ,fieldLabel: 'Port' ,name: 'proxyPort' - ,width: 100 ,value: config.proxyPort ,margin: '0 0 0 10' } + ,{ + xtype: 'textfield' + ,fieldLabel: 'Login' + ,name: 'proxyLogin' + ,value: config.proxyLogin + ,margin: '0 0 0 10' + ,emptyText: 'optional' + } + ,{ + xtype: 'textfield' + ,fieldLabel: 'Password' + ,name: 'proxyPassword' + ,value: config.proxyPassword + ,margin: '0 0 0 10' + ,emptyText: 'optional' + } ] } ] diff --git a/electron/main.js b/electron/main.js index 61cc952b..8cfc2019 100644 --- a/electron/main.js +++ b/electron/main.js @@ -32,6 +32,8 @@ const config = new Config({ ,proxy: false ,proxyHost: '' ,proxyPort: '' + ,proxyLogin: '' + ,proxyPassword: '' ,locale: 'en' ,enable_hidpi_support: false ,default_service: 'ramboxTab' @@ -461,7 +463,16 @@ ipcMain.on('toggleWin', function(event, allwaysShow) { }); // Proxy -if ( config.get('proxy') ) app.commandLine.appendSwitch('proxy-server', config.get('proxyHost')+':'+config.get('proxyPort')); +if ( config.get('proxy') ) { + app.commandLine.appendSwitch('proxy-server', config.get('proxyHost')+':'+config.get('proxyPort')); + app.on('login', (event, webContents, request, authInfo, callback) => { + if(!authInfo.isProxy) + return; + + event.preventDefault() + callback(config.get('proxyLogin'), config.get('proxyPassword')) + }) +} // Disable GPU Acceleration for Linux // to prevent White Page bug