From e47e9c3a5c05c5105b9654de93312c81c731cf55 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 20:22:15 +0200 Subject: [PATCH 01/56] update bluebird --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e76e467..872db76 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "dependencies": { "alt": "0.17.3", "autoupdater": "vpnht/autoupdater", - "bluebird": "2.10.1", + "bluebird": "3.4.6", "bugsnag-js": "2.4.7", "classnames": "2.1.3", "exec": "0.2.0", From 348b65d2e04fe8715c3ba35721a1753706a703ae Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 20:24:50 +0200 Subject: [PATCH 02/56] update bugsnag-js --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 872db76..05397b4 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "alt": "0.17.3", "autoupdater": "vpnht/autoupdater", "bluebird": "3.4.6", - "bugsnag-js": "2.4.7", + "bugsnag-js": "3.0.6", "classnames": "2.1.3", "exec": "0.2.0", "get-port": "1.0.0", From 293f8eff27722770ff18d2a3bb4286b39edca696 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 20:26:56 +0200 Subject: [PATCH 03/56] update non-critical modules --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 05397b4..c15598e 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,8 @@ "autoupdater": "vpnht/autoupdater", "bluebird": "3.4.6", "bugsnag-js": "3.0.6", - "classnames": "2.1.3", - "exec": "0.2.0", + "classnames": "2.2.5", + "exec": "0.2.1", "get-port": "1.0.0", "is-running": "1.0.5", "jquery": "2.1.4", @@ -30,20 +30,20 @@ "mixpanel": "kitematic/mixpanel-node", "node-cache": "3.0.0", "node-openvpn": "VPNht/node-openvpn", - "node-uuid": "1.4.3", - "object-assign": "4.0.1", + "node-uuid": "1.4.7", + "object-assign": "4.1.0", "osx-release": "1.1.0", "react": "0.13.3", "react-bootstrap": "^0.20.3", "react-retina-image": "1.3.3", "react-router": "0.13.3", "react-select": "0.6.11", - "request": "2.55.0", + "request": "2.76.0", "validator": "4.0.6", "windows-service-manager": "vpnht/windows-service-manager", "winreg": "0.0.12", "xps": "^1.0.2", - "yargs": "^3.27.0" + "yargs": "6.3.0" }, "devDependencies": { "async": "^1.4.2", From 1a3137dc7c8d356585bd5461e6c57145635b4ba9 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 21:03:02 +0200 Subject: [PATCH 04/56] update alt --- package.json | 2 +- src/actions/VPNActions.js | 145 ++++++++++++++++++++------------------ 2 files changed, 79 insertions(+), 68 deletions(-) diff --git a/package.json b/package.json index c15598e..4414d5e 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "license": "GPL-3.0", "electron-version": "0.33.3", "dependencies": { - "alt": "0.17.3", + "alt": "0.18.6", "autoupdater": "vpnht/autoupdater", "bluebird": "3.4.6", "bugsnag-js": "3.0.6", diff --git a/src/actions/VPNActions.js b/src/actions/VPNActions.js index 52a62ea..35f58b9 100644 --- a/src/actions/VPNActions.js +++ b/src/actions/VPNActions.js @@ -17,96 +17,107 @@ class VPNActions { ); } - connect (args) { - - // set tray in connecting state - ipc.send('vpn.connecting'); - - vpnUtil = require('../utils/VPNUtil'); - this.dispatch(); - - vpnUtil.connect(args) - .then(() => { - log.info('VPNAction.connect() done'); - // update tray - ipc.send('vpn.connected'); - this.actions.connected(); - }) - .catch((error) => { - console.log(error); - log.error('Unable to launch process'); - this.actions.disconnected(); - - }); + connect(args) { + return function(dispatch) { + // set tray in connecting state + ipc.send('vpn.connecting'); + + vpnUtil = require('../utils/VPNUtil'); + dispatch(); + + vpnUtil.connect(args) + .then(() => { + log.info('VPNAction.connect() done'); + // update tray + ipc.send('vpn.connected'); + this.connected(); + }) + .catch((error) => { + console.log(error); + log.error('Unable to launch process'); + this.disconnected(); + + }); + }; } - disconnect () { + disconnect() { + return function(dispatch) { + vpnUtil = require('../utils/VPNUtil'); + dispatch(); + vpnUtil.disconnect() + .then(() => { - vpnUtil = require('../utils/VPNUtil'); - this.dispatch(); - vpnUtil.disconnect() - .then(() => { + log.info('Waiting EXITING state'); - log.info('Waiting EXITING state'); + }) + .catch((error) => { - }) - .catch((error) => { + log.error('Unable to disconnect'); + console.log(error); - log.error('Unable to disconnect'); - console.log(error); - - }); + }); + }; } - checkIp () { - var helpers = require('../utils/VPNHelpers'); - this.dispatch(); - helpers.updateIp() - .then(() => { + checkIp() { + return function(dispatch) { + var helpers = require('../utils/VPNHelpers'); + dispatch(); + helpers.updateIp() + .then(() => { - log.info('IP Updated'); + log.info('IP Updated'); - }) - .catch((error) => { + }) + .catch((error) => { - log.error('Unable to update ip'); - console.log(error); + log.error('Unable to update ip'); + console.log(error); - }); + }); + }; } - invalidCredentials () { - this.dispatch(); - alert("Invalid credentials") + invalidCredentials() { + return function(dispatch) { + dispatch(); + alert("Invalid credentials") + }; } - appReady () { - this.dispatch(); - if (Settings.get('connectLaunch') === 'true' && Credentials._config()) { - log.info('Auto-connect on launch') - this.actions.connect({ - username: Credentials.get().username, - password: Credentials.get().password, - server: Settings.get('server') || 'hub.vpn.ht' - }); - } - + appReady() { + return function(dispatch) { + dispatch(); + if (Settings.get('connectLaunch') === 'true' && Credentials._config()) { + log.info('Auto-connect on launch') + this.connect({ + username: Credentials.get().username, + password: Credentials.get().password, + server: Settings.get('server') || 'hub.vpn.ht' + }); + } + }; } // used by tray disconnected() { - this.dispatch(); - ipc.send('vpn.disconnected'); - - // on windows we need to stop the service - if (process.platform == 'win32') { - require('../utils/Util').exec(['net', 'stop', 'openvpnservice']) - } + return function(dispatch) { + dispatch(); + ipc.send('vpn.disconnected'); + + // on windows we need to stop the service + if (process.platform == 'win32') { + require('../utils/Util').exec(['net', 'stop', 'openvpnservice']) + } + }; } connected() { - this.dispatch(); - ipc.send('vpn.connected'); + return function(dispatch) { + dispatch(); + ipc.send('vpn.connected'); + }; } From c8e04c8e22478c898f863a44c80d3dea8fb52044 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 21:15:04 +0200 Subject: [PATCH 05/56] remove unused module 'validator' --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 4414d5e..aa02f41 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "react-router": "0.13.3", "react-select": "0.6.11", "request": "2.76.0", - "validator": "4.0.6", "windows-service-manager": "vpnht/windows-service-manager", "winreg": "0.0.12", "xps": "^1.0.2", From 42bc1abf614d8fafba93ac11479327d33d7ce08f Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 21:16:37 +0200 Subject: [PATCH 06/56] update lodash --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aa02f41..fc4e8c2 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "get-port": "1.0.0", "is-running": "1.0.5", "jquery": "2.1.4", - "lodash": "3.10.1", + "lodash": "4.16.4", "mixpanel": "kitematic/mixpanel-node", "node-cache": "3.0.0", "node-openvpn": "VPNht/node-openvpn", From 44c9969b9201fe97dd7a3781f764a8526ec2134a Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 21:20:15 +0200 Subject: [PATCH 07/56] update jquery --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc4e8c2..207f4bb 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "exec": "0.2.1", "get-port": "1.0.0", "is-running": "1.0.5", - "jquery": "2.1.4", + "jquery": "3.1.1", "lodash": "4.16.4", "mixpanel": "kitematic/mixpanel-node", "node-cache": "3.0.0", From b5db59a996006eac2fe05b63bfaf180836a8df21 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 21:22:53 +0200 Subject: [PATCH 08/56] update winreg --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 207f4bb..88ca8f5 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "react-select": "0.6.11", "request": "2.76.0", "windows-service-manager": "vpnht/windows-service-manager", - "winreg": "0.0.12", + "winreg": "1.2.2", "xps": "^1.0.2", "yargs": "6.3.0" }, From 436a0cc120f6123cdf16001f74770c07c08cfd46 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 21:30:19 +0200 Subject: [PATCH 09/56] update get-port --- package.json | 2 +- src/utils/VPNHelpers.js | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 88ca8f5..e9eec3f 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "bugsnag-js": "3.0.6", "classnames": "2.2.5", "exec": "0.2.1", - "get-port": "1.0.0", + "get-port": "2.1.0", "is-running": "1.0.5", "jquery": "3.1.1", "lodash": "4.16.4", diff --git a/src/utils/VPNHelpers.js b/src/utils/VPNHelpers.js index 0ee88ff..a097b7c 100644 --- a/src/utils/VPNHelpers.js +++ b/src/utils/VPNHelpers.js @@ -14,15 +14,9 @@ var openvpn; module.exports = { managementPort: function () { - return new Promise((resolve, reject) => { - getPort((err, port) => { - if (err) { - reject(err); - } else { - fs.writeFileSync(path.join(util.supportDir(), 'openvpn.port'), port); - resolve(port); - } - }); + return getPort().then(port => { + fs.writeFileSync(path.join(util.supportDir(), 'openvpn.port'), port); + return port; }); }, From ed67f50bffead8fe18724f2c4e49615b0c978e83 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 21:41:45 +0200 Subject: [PATCH 10/56] update is-running --- package.json | 2 +- src/utils/VPNHelpers.js | 14 +++----------- src/utils/VPNUtilMac.js | 33 +++++++++++---------------------- 3 files changed, 15 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index e9eec3f..eb2de6e 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "classnames": "2.2.5", "exec": "0.2.1", "get-port": "2.1.0", - "is-running": "1.0.5", + "is-running": "2.1.0", "jquery": "3.1.1", "lodash": "4.16.4", "mixpanel": "kitematic/mixpanel-node", diff --git a/src/utils/VPNHelpers.js b/src/utils/VPNHelpers.js index a097b7c..ec4b732 100644 --- a/src/utils/VPNHelpers.js +++ b/src/utils/VPNHelpers.js @@ -75,17 +75,9 @@ module.exports = { pid = fs.readFileSync(path.join(util.supportDir(), 'openvpn.pid')) || false; } catch (err) {} - if (pid) { - log.info('Checking previous openvpn status PID: '+pid); - running(Number(pid), function(err, live) { - if (err) { - log.error('Process error', {err}) - reject(err); - } else { - log.info('Process status : ' + live) - resolve(live); - } - }); + if (pid && running(Number(pid))) { + log.info('Previous openvpn status still running, PID: '+pid); + resolve(true); } else { resolve(false); } diff --git a/src/utils/VPNUtilMac.js b/src/utils/VPNUtilMac.js index 0c49532..77b5ff3 100644 --- a/src/utils/VPNUtilMac.js +++ b/src/utils/VPNUtilMac.js @@ -33,30 +33,19 @@ module.exports = { .then(function() { // checking if process stopped as security - running(Number(pid), function(err, live) { - if (err) { - // weird? - log.info('Process stopped successfully'); - resolve(); - - } else { - if (live) { - // process running - log.info('Process still running running manual kill'); - util.exec(['kill', '-9', Number(pid)]) - .then(function() { - log.info('Process stopped successfully'); - resolve(); - }); - - } else { - // process stopped + if (running(Number(pid))) { + // process running + log.info('Process still running, running manual kill'); + util.exec(['kill', '-9', Number(pid)]) + .then(function() { log.info('Process stopped successfully'); resolve(); - } - } - }); - + }); + } else { + // process stopped + log.info('Process stopped successfully'); + resolve(); + } }) .catch(function() { log.info('We have to kill the process manually'); From 92f80fb5fa4d55aaa55e3f36f16ff35f07064024 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 21:58:22 +0200 Subject: [PATCH 11/56] remove unused module 'node-cache' --- package.json | 1 - src/components/DashboardConnect.react.js | 3 --- 2 files changed, 4 deletions(-) diff --git a/package.json b/package.json index eb2de6e..8fdc5a5 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "jquery": "3.1.1", "lodash": "4.16.4", "mixpanel": "kitematic/mixpanel-node", - "node-cache": "3.0.0", "node-openvpn": "VPNht/node-openvpn", "node-uuid": "1.4.7", "object-assign": "4.1.0", diff --git a/src/components/DashboardConnect.react.js b/src/components/DashboardConnect.react.js index 2daddb4..6b0f194 100644 --- a/src/components/DashboardConnect.react.js +++ b/src/components/DashboardConnect.react.js @@ -14,9 +14,6 @@ import Logs from './DashboardLogs.react'; import Settings from '../utils/SettingsUtil'; import Credentials from '../utils/CredentialsUtil'; -import Cache from 'node-cache'; -let serversCache = new Cache(); - var DashboardConnect = React.createClass({ mixins: [React.addons.LinkedStateMixin], From 5d2c9e18467f59fa130b7b1fbcdb9a8b01fac1f2 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 22:04:28 +0200 Subject: [PATCH 12/56] update dev dependencies --- package.json | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 8fdc5a5..abe0d92 100644 --- a/package.json +++ b/package.json @@ -44,35 +44,35 @@ "yargs": "6.3.0" }, "devDependencies": { - "async": "^1.4.2", - "babel": "^5.1.10", - "grunt": "^0.4.5", - "grunt-babel": "^5.0.1", - "grunt-chmod": "^1.0.3", - "grunt-cli": "^0.1.13", - "grunt-contrib-clean": "^0.6.0", - "grunt-contrib-compress": "^0.13.0", - "grunt-contrib-copy": "^0.8.0", - "grunt-contrib-less": "^1.0.1", + "async": "^2.1.2", + "babel": "^6.5.2", + "grunt": "^1.0.1", + "grunt-babel": "^6.0.0", + "grunt-chmod": "^1.1.1", + "grunt-cli": "^1.2.0", + "grunt-contrib-clean": "^1.0.0", + "grunt-contrib-compress": "^1.3.0", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-less": "^1.4.0", "grunt-contrib-watch-chokidar": "^1.0.0", "grunt-curl": "^2.2.0", - "grunt-download-electron": "^2.1.1", - "grunt-electron": "^2.0.0", - "grunt-electron-installer": "^1.0.3", - "grunt-if-missing": "^1.0.0", - "grunt-newer": "^1.1.1", - "grunt-plistbuddy": "^0.1.1", - "grunt-prompt": "^1.3.0", - "grunt-rcedit": "^0.3.1", + "grunt-download-electron": "^2.1.4", + "grunt-electron": "^5.0.0", + "grunt-electron-installer": "^2.1.0", + "grunt-if-missing": "^1.0.1", + "grunt-newer": "^1.2.0", + "grunt-plistbuddy": "^0.2.0", + "grunt-prompt": "^1.3.3", + "grunt-rcedit": "^0.7.0", "grunt-rename": "^0.1.4", - "grunt-shell": "^1.1.2", - "grunt-shell-spawn": "^0.3.8", - "load-grunt-tasks": "^3.2.0", - "minimist": "^1.1.1", + "grunt-shell": "^2.0.0", + "grunt-shell-spawn": "^0.3.10", + "load-grunt-tasks": "^3.5.2", + "minimist": "^1.2.0", "react-tools": "^0.13.1", - "run-sequence": "^1.0.2", + "run-sequence": "^1.2.2", "shell-escape": "^0.2.0", - "source-map-support": "^0.3.2" + "source-map-support": "^0.4.5" }, "optionalDependencies": { "electron-prebuilt": "^0.33.3" From 12f0535333c9c36d090630e3d8fb38fd232150fc Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 22:26:56 +0200 Subject: [PATCH 13/56] revert back to babel 5.x for now --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index abe0d92..68bab6e 100644 --- a/package.json +++ b/package.json @@ -45,9 +45,9 @@ }, "devDependencies": { "async": "^2.1.2", - "babel": "^6.5.2", + "babel": "^5.0.0", "grunt": "^1.0.1", - "grunt-babel": "^6.0.0", + "grunt-babel": "^5.0.0", "grunt-chmod": "^1.1.1", "grunt-cli": "^1.2.0", "grunt-contrib-clean": "^1.0.0", From 36c8e05a7f9c382bd1a21ac7fc4e6e679e201309 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 28 Oct 2016 23:40:19 +0200 Subject: [PATCH 14/56] bump to electron 1.x --- Gruntfile.js | 2 +- package.json | 2 +- src/actions/VPNActions.js | 10 +++++----- src/app-tray.js | 11 ++++------- src/app.js | 19 +++++++++---------- src/browser.js | 13 ++++++------- src/components/DashboardLogs.react.js | 12 +++++++----- src/components/Framework.react.js | 2 +- src/components/Header.react.js | 15 +++++++-------- src/menutemplate.js | 7 +++---- src/utils/Util.js | 4 ++-- src/utils/VPNUtilWindows.js | 2 +- src/utils/WebUtil.js | 4 ++-- 13 files changed, 49 insertions(+), 54 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 23f0bc1..04fde85 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,7 +1,7 @@ var path = require('path'); var execFile = require('child_process').execFile; var packagejson = require('./package.json'); -var electron = require('electron-prebuilt'); +var electron = require('electron'); module.exports = function (grunt) { require('load-grunt-tasks')(grunt); diff --git a/package.json b/package.json index 68bab6e..48f9a5a 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,6 @@ "source-map-support": "^0.4.5" }, "optionalDependencies": { - "electron-prebuilt": "^0.33.3" + "electron-prebuilt": "^1.3.8" } } diff --git a/src/actions/VPNActions.js b/src/actions/VPNActions.js index 35f58b9..98fefeb 100644 --- a/src/actions/VPNActions.js +++ b/src/actions/VPNActions.js @@ -1,6 +1,6 @@ var vpnUtil; -import ipc from 'ipc'; +import {ipcRenderer} from 'electron'; import alt from '../alt'; import log from '../stores/LogStore'; import Settings from '../utils/SettingsUtil'; @@ -20,7 +20,7 @@ class VPNActions { connect(args) { return function(dispatch) { // set tray in connecting state - ipc.send('vpn.connecting'); + ipcRenderer.send('vpn.connecting'); vpnUtil = require('../utils/VPNUtil'); dispatch(); @@ -29,7 +29,7 @@ class VPNActions { .then(() => { log.info('VPNAction.connect() done'); // update tray - ipc.send('vpn.connected'); + ipcRenderer.send('vpn.connected'); this.connected(); }) .catch((error) => { @@ -104,7 +104,7 @@ class VPNActions { disconnected() { return function(dispatch) { dispatch(); - ipc.send('vpn.disconnected'); + ipcRenderer.send('vpn.disconnected'); // on windows we need to stop the service if (process.platform == 'win32') { @@ -116,7 +116,7 @@ class VPNActions { connected() { return function(dispatch) { dispatch(); - ipc.send('vpn.connected'); + ipcRenderer.send('vpn.connected'); }; } diff --git a/src/app-tray.js b/src/app-tray.js index 62934c6..0370aa8 100644 --- a/src/app-tray.js +++ b/src/app-tray.js @@ -1,7 +1,4 @@ -import Menu from 'menu'; -import MenuItem from 'menu-item'; -import Tray from 'tray'; -import ipc from 'ipc'; +import {Menu, MenuItem, ipcMain, Tray} from 'electron'; var trayMenuDisconnected = null; var trayMenuConnected = null; @@ -91,19 +88,19 @@ exports.init = function(helper) { tray.on('clicked', helper.toggleVisibility); - ipc.on('vpn.connected', function handleConnected() { + ipcMain.on('vpn.connected', function handleConnected() { tray.setContextMenu(trayMenuConnected); tray.setImage(__dirname + '/tray_connected.png'); tray.setToolTip('Connected'); }); - ipc.on('vpn.connecting', function handleConnecting() { + ipcMain.on('vpn.connecting', function handleConnecting() { tray.setContextMenu(trayMenuConnecting); tray.setImage(__dirname + '/tray_connecting.png'); tray.setToolTip('Connecting...'); }); - ipc.on('vpn.disconnected', function handleDisconnected() { + ipcMain.on('vpn.disconnected', function handleDisconnected() { tray.setContextMenu(trayMenuDisconnected); tray.setImage(__dirname + '/tray.png'); tray.setToolTip('Disconnected'); diff --git a/src/app.js b/src/app.js index 5fbca6b..4287348 100755 --- a/src/app.js +++ b/src/app.js @@ -1,7 +1,6 @@ require.main.paths.splice(0, 0, process.env.NODE_PATH); -import remote from 'remote'; +import {remote, ipcRenderer} from 'electron'; import React from 'react'; -import ipc from 'ipc'; import metrics from './utils/MetricsUtil'; import VPN from './utils/VPNUtil'; import vpnActions from './actions/VPNActions'; @@ -19,8 +18,8 @@ import Credentials from './utils/CredentialsUtil'; import Settings from './utils/SettingsUtil'; -var app = remote.require('app'); -var Menu = remote.require('menu'); +var app = require('electron').remote.app; +var Menu = require('electron').remote.Menu; // Init process log.initLogs(app.getVersion()); @@ -43,14 +42,14 @@ routerContainer.set(router); // Default Route router.transitionTo('dashboard'); -ipc.on('application:quitting', () => {}); +ipcRenderer.on('application:quitting', () => {}); // Event fires when the app receives a vpnht:// URL -ipc.on('application:open-url', opts => { +ipcRenderer.on('application:open-url', opts => { console.log('open', opts); }); -ipc.on('application:vpn-connect', () => { +ipcRenderer.on('application:vpn-connect', () => { if (Credentials._config()) { vpnActions.connect({ username: Credentials.get().username, @@ -62,7 +61,7 @@ ipc.on('application:vpn-connect', () => { } }); -ipc.on('application:vpn-check-disconnect', () => { +ipcRenderer.on('application:vpn-check-disconnect', () => { if (accountStore.getState().connecting || accountStore.getState().connected) { log.info('Disconnecting before closing application'); vpnActions.disconnect(); @@ -71,7 +70,7 @@ ipc.on('application:vpn-check-disconnect', () => { } }); -ipc.on('application:vpn-check-sleep', () => { +ipcRenderer.on('application:vpn-check-sleep', () => { if (accountStore.getState().connected) { log.info('Trying to reconnect after sleep'); if (Credentials._config()) { @@ -87,7 +86,7 @@ ipc.on('application:vpn-check-sleep', () => { } }); -ipc.on('application:vpn-disconnect', () => { +ipcRenderer.on('application:vpn-disconnect', () => { vpnActions.disconnect(); }); diff --git a/src/browser.js b/src/browser.js index 3316d78..7b7fdd8 100755 --- a/src/browser.js +++ b/src/browser.js @@ -1,7 +1,5 @@ -import app from 'app'; -import BrowserWindow from 'browser-window'; +import {app, BrowserWindow, ipcMain, screen, powerMonitor} from 'electron'; import os from 'os'; -import ipc from 'ipc'; import net from 'net'; import fs from 'fs'; import path from 'path'; @@ -42,7 +40,6 @@ app.on('ready', function() { var checkingQuit = false; var canQuit = false; - var screen = require('screen'); var size = screen.getPrimaryDisplay().workAreaSize; var autoUpdater = new Updater({ currentVersion: app.getVersion() @@ -67,6 +64,8 @@ app.on('ready', function() { show: false }); + mainWindow.webContents.openDevTools(); + var preventMultipleInstances = function() { var socket = (process.platform === 'win32') ? '\\\\.\\pipe\\vpnht-sock' : path.join(os.tmpdir(), 'vpnht.sock'); var client = net.connect({ @@ -103,7 +102,7 @@ app.on('ready', function() { }); server.listen(socket); - mainWindow.loadUrl(path.normalize('file://' + path.join(__dirname, 'index.html'))); + mainWindow.loadURL(path.normalize('file://' + path.join(__dirname, 'index.html'))); }); } @@ -115,7 +114,7 @@ app.on('ready', function() { if (!checkingQuit) { checkingQuit = true; mainWindow.webContents.send('application:vpn-check-disconnect'); - ipc.on('vpn.disconnected', () => { + ipcMain.on('vpn.disconnected', () => { canQuit = true; app.quit(); }); @@ -123,7 +122,7 @@ app.on('ready', function() { } }); - require('power-monitor').on('resume', function() { + powerMonitor.on('resume', function() { mainWindow.webContents.send('application:vpn-check-sleep'); }); diff --git a/src/components/DashboardLogs.react.js b/src/components/DashboardLogs.react.js index 96418fd..724b1f8 100644 --- a/src/components/DashboardLogs.react.js +++ b/src/components/DashboardLogs.react.js @@ -42,12 +42,14 @@ var DashboardLogs = React.createClass({ handleCopyClipboard: function () { - require('remote') - .require('clipboard') + require('electron') + .remote + .clipboard .writeText(this.state.logs.join("\n")); - require('remote') - .require('dialog') + require('electron') + .remote + .dialog .showMessageBox({ type:'info', title: 'Log Copied', @@ -62,7 +64,7 @@ var DashboardLogs = React.createClass({ filters: [{ name: 'Log files', extensions: ['log'] }] }; - var dialog = require('remote').require('dialog'); + var dialog = require('electron').remote.dialog; var self = this; dialog.showSaveDialog(args,function(filename) { diff --git a/src/components/Framework.react.js b/src/components/Framework.react.js index 6d132b6..ebcd2f1 100644 --- a/src/components/Framework.react.js +++ b/src/components/Framework.react.js @@ -6,7 +6,7 @@ import Sidebar from './Sidebar.react'; import Header from './Header.react'; import SubHeader from './SubHeader.react'; import metrics from '../utils/MetricsUtil'; -import shell from 'shell'; +import {shell} from 'electron'; import RetinaImage from 'react-retina-image'; var Client = React.createClass({ diff --git a/src/components/Header.react.js b/src/components/Header.react.js index 5baeb1e..445f026 100644 --- a/src/components/Header.react.js +++ b/src/components/Header.react.js @@ -1,7 +1,6 @@ import React from 'react/addons'; -import remote from 'remote'; +import {remote, ipcRenderer} from 'electron'; import RetinaImage from 'react-retina-image'; -import ipc from 'ipc'; import util from '../utils/Util'; import metrics from '../utils/MetricsUtil'; import accountStore from '../stores/AccountStore'; @@ -9,10 +8,10 @@ import Router from 'react-router'; import classNames from 'classnames'; import Settings from '../utils/SettingsUtil'; -var autoUpdater = remote.require('auto-updater'); -var app = remote.require('app'); -var Menu = remote.require('menu'); -var MenuItem = remote.require('menu-item'); +var autoUpdater = require('electron').remote.autoUpdater; +var app = require('electron').remote.app; +var Menu = require('electron').remote.menu; +var MenuItem = require('electron').remote.menuItem; var Header = React.createClass({ mixins: [Router.Navigation], @@ -29,7 +28,7 @@ var Header = React.createClass({ accountStore.listen(this.update); - ipc.on('application:update-available', () => { + ipcRenderer.on('application:update-available', () => { this.setState({ updateAvailable: true }); @@ -77,7 +76,7 @@ var Header = React.createClass({ }, handleAutoUpdateClick: function () { metrics.track('Restarted to Update'); - ipc.send('application:quit-install'); + ipcRenderer.send('application:quit-install'); }, renderWindowButtons: function () { let buttons; diff --git a/src/menutemplate.js b/src/menutemplate.js index 444943f..064fa56 100755 --- a/src/menutemplate.js +++ b/src/menutemplate.js @@ -1,11 +1,10 @@ -import remote from 'remote'; -import shell from 'shell'; +import {remote, shell} from 'electron'; import router from './router'; import metrics from './utils/MetricsUtil'; import util from './utils/Util'; -var dialog = remote.require('dialog'); -var app = remote.require('app'); +var dialog = require('electron').remote.app; +var app = require('electron').remote.app; // main.js var MenuTemplate = function () { diff --git a/src/utils/Util.js b/src/utils/Util.js index d744d81..de61869 100755 --- a/src/utils/Util.js +++ b/src/utils/Util.js @@ -86,14 +86,14 @@ module.exports = { return str.replace(/ /g, '\\ ').replace(/\(/g, '\\(').replace(/\)/g, '\\)'); }, home: function() { - return require('remote').require('app').getPath('home'); + return require('electron').remote.app.getPath('home'); }, documents: function() { // TODO: fix me for windows 7 return 'Documents'; }, supportDir: function() { - return require('remote').require('app').getPath('userData'); + return require('electron').remote.app.getPath('userData'); }, CommandOrCtrl: function() { return this.isWindows() ? 'Ctrl' : 'Command'; diff --git a/src/utils/VPNUtilWindows.js b/src/utils/VPNUtilWindows.js index 5b18fcc..f5d9b2b 100644 --- a/src/utils/VPNUtilWindows.js +++ b/src/utils/VPNUtilWindows.js @@ -95,7 +95,7 @@ module.exports = { }, enableStartOnBoot: function(hidden) { return new Promise((resolve) => { - regKey.set('VPNht', Winreg.REG_SZ, "\"" + require('remote').require('app').getPath('exe') + (hidden ? ' --hide' : '') + "\"", function() { + regKey.set('VPNht', Winreg.REG_SZ, "\"" + require('electron').remote.app.getPath('exe') + (hidden ? ' --hide' : '') + "\"", function() { resolve(); }); }); diff --git a/src/utils/WebUtil.js b/src/utils/WebUtil.js index d5444ef..7da11f2 100755 --- a/src/utils/WebUtil.js +++ b/src/utils/WebUtil.js @@ -1,5 +1,5 @@ -import remote from 'remote'; -var app = remote.require('app'); +import {remote} from 'electron'; +var app = require('electron').remote.app; import fs from 'fs'; import util from './Util'; import path from 'path'; From 609ade261824b691fd81e20575a97e3188d46c76 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 16:21:29 +0200 Subject: [PATCH 15/56] app.terminate() is deprecated, using process.exit(0) --- src/browser.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/browser.js b/src/browser.js index 7b7fdd8..9a0ac07 100755 --- a/src/browser.js +++ b/src/browser.js @@ -72,13 +72,13 @@ app.on('ready', function() { path: socket }, function() { var errorMessage = 'Another instance of VPN.ht is already running. Only one instance of the app can be open at a time.' - require('dialog').showMessageBox(mainWindow, { + require('electron').dialog.showMessageBox(mainWindow, { 'type': 'error', message: errorMessage, buttons: ['OK'] }, function() { client.end(); - app.terminate(); + process.exit(0); }) }).on('error', function(err) { @@ -183,7 +183,7 @@ app.on('ready', function() { autoUpdater.on("updateReady", function(updaterPath) { console.log("Launching " + updaterPath); - require('dialog').showMessageBox(mainWindow, { + require('electron').dialog.showMessageBox(mainWindow, { 'type': 'info', message: 'A new version is available, do you want to install now ?', buttons: ['Yes', 'No'] @@ -193,14 +193,14 @@ app.on('ready', function() { if (process.platform == 'win32') { require('./utils/Util').exec('start ' + updaterPath).then(function(stdOut) { console.log(stdOut); - app.terminate(); + process.exit(0); }); } else { child_process.spawn('open', [updaterPath], { detached: true, stdio: ['ignore', 'ignore', 'ignore'] }); - app.terminate(); + process.exit(0); } } From d767c201d1df909372cd178cd1f3c8e21eb31c3e Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 17:11:47 +0200 Subject: [PATCH 16/56] update Util.exec() for node > 6 --- package.json | 1 - src/utils/Util.js | 19 ++++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 48f9a5a..2fc9e44 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "bluebird": "3.4.6", "bugsnag-js": "3.0.6", "classnames": "2.2.5", - "exec": "0.2.1", "get-port": "2.1.0", "is-running": "2.1.0", "jquery": "3.1.1", diff --git a/src/utils/Util.js b/src/utils/Util.js index de61869..6c13c4b 100755 --- a/src/utils/Util.js +++ b/src/utils/Util.js @@ -1,5 +1,4 @@ -import exec from 'exec'; -import child_process from 'child_process'; +import {exec, execFile} from 'child_process'; import Promise from 'bluebird'; import fs from 'fs'; import path from 'path'; @@ -18,16 +17,22 @@ module.exports = { } } - let fn = Array.isArray(args) ? exec : child_process.exec; return new Promise((resolve, reject) => { - fn(args, options, (stderr, stdout, code) => { + let cmd = Array.isArray(args) ? args.join(' ') : args; + let cb = function (stderr, stdout, code) { if (code) { - var cmd = Array.isArray(args) ? args.join(' ') : args; - reject(new Error(cmd + ' returned non zero exit code. Stderr: ' + stderr)); + reject(new Error(cmd + ' returned non-zero exit code. Stderr: ' + stderr)); } else { resolve(stdout); } - }); + }; + + if (Array.isArray(args)) { + let file = args.shift(); + execFile(file, args, options, cb); + } else { + exec(args, options, cb); + } }); }, killTask: function(name) { From e6a060b6559492478e69b209b4eaa461e79b1b3d Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 17:12:21 +0200 Subject: [PATCH 17/56] comment Header.react.js -> autoUpdater - looks like it's not working and does absolutely nothing, as all the required code is in browser.js - throws an error if left as it. --- src/components/Header.react.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Header.react.js b/src/components/Header.react.js index 445f026..f96ce5b 100644 --- a/src/components/Header.react.js +++ b/src/components/Header.react.js @@ -8,10 +8,10 @@ import Router from 'react-router'; import classNames from 'classnames'; import Settings from '../utils/SettingsUtil'; -var autoUpdater = require('electron').remote.autoUpdater; -var app = require('electron').remote.app; -var Menu = require('electron').remote.menu; -var MenuItem = require('electron').remote.menuItem; +/*var autoUpdater = remote.require('autoupdater');*/ +var app = remote.app; +var Menu = remote.menu; +var MenuItem = remote.menuItem; var Header = React.createClass({ mixins: [Router.Navigation], @@ -33,7 +33,7 @@ var Header = React.createClass({ updateAvailable: true }); }); - autoUpdater.checkForUpdates(); + /*autoUpdater.checkForUpdates();*/ }, componentWillUnmount: function () { document.removeEventListener('keyup', this.handleDocumentKeyUp, false); From aaa92cfcfe44fd282c364862e00546265051a76d Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 17:19:36 +0200 Subject: [PATCH 18/56] remove unused font-smoothing vendor prefixes --- styles/main.less | 2 -- 1 file changed, 2 deletions(-) diff --git a/styles/main.less b/styles/main.less index fdda46e..968949b 100755 --- a/styles/main.less +++ b/styles/main.less @@ -24,9 +24,7 @@ html, body { height: 100%; width: 100%; background-color: #edeced; - -webkit-font-smoothing: subpixel-antialiased; text-rendering: optimizelegibility; - //-webkit-font-smoothing: antialiased; img { pointer-events: none; } From 3091c4dddbe5abd19eadc6ff7886f40c6973e610 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 17:38:48 +0200 Subject: [PATCH 19/56] remove autoUpdater refs, turns out it wasn't used --- src/components/Header.react.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/Header.react.js b/src/components/Header.react.js index f96ce5b..7f7c694 100644 --- a/src/components/Header.react.js +++ b/src/components/Header.react.js @@ -8,7 +8,6 @@ import Router from 'react-router'; import classNames from 'classnames'; import Settings from '../utils/SettingsUtil'; -/*var autoUpdater = remote.require('autoupdater');*/ var app = remote.app; var Menu = remote.menu; var MenuItem = remote.menuItem; @@ -33,7 +32,6 @@ var Header = React.createClass({ updateAvailable: true }); }); - /*autoUpdater.checkForUpdates();*/ }, componentWillUnmount: function () { document.removeEventListener('keyup', this.handleDocumentKeyUp, false); From f394a86be10908aeed1aef0c40a836e4b90b7b43 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 17:39:28 +0200 Subject: [PATCH 20/56] better import & require syntax usage --- src/app.js | 4 +-- src/browser.js | 11 ++++---- src/components/DashboardLogs.react.js | 37 +++++++++++++-------------- src/menutemplate.js | 4 +-- src/utils/Util.js | 5 ++-- src/utils/VPNUtilWindows.js | 3 ++- src/utils/WebUtil.js | 3 ++- 7 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/app.js b/src/app.js index 4287348..d0d9a4d 100755 --- a/src/app.js +++ b/src/app.js @@ -18,8 +18,8 @@ import Credentials from './utils/CredentialsUtil'; import Settings from './utils/SettingsUtil'; -var app = require('electron').remote.app; -var Menu = require('electron').remote.Menu; +var app = remote.app; +var Menu = remote.Menu; // Init process log.initLogs(app.getVersion()); diff --git a/src/browser.js b/src/browser.js index 9a0ac07..7ac53f1 100755 --- a/src/browser.js +++ b/src/browser.js @@ -1,4 +1,4 @@ -import {app, BrowserWindow, ipcMain, screen, powerMonitor} from 'electron'; +import {app, BrowserWindow, ipcMain, screen, powerMonitor, dialog} from 'electron'; import os from 'os'; import net from 'net'; import fs from 'fs'; @@ -7,6 +7,7 @@ import child_process from 'child_process'; import trayTemplate from './app-tray' import Updater from 'autoupdater' import yargs from 'yargs'; +import util from './utils/Util'; let args = yargs(process.argv.slice(1)).wrap(100).argv; @@ -42,7 +43,7 @@ app.on('ready', function() { var canQuit = false; var size = screen.getPrimaryDisplay().workAreaSize; var autoUpdater = new Updater({ - currentVersion: app.getVersion() + currentVersion: '0.0.2' }); var windowSize = { @@ -72,7 +73,7 @@ app.on('ready', function() { path: socket }, function() { var errorMessage = 'Another instance of VPN.ht is already running. Only one instance of the app can be open at a time.' - require('electron').dialog.showMessageBox(mainWindow, { + dialog.showMessageBox(mainWindow, { 'type': 'error', message: errorMessage, buttons: ['OK'] @@ -183,7 +184,7 @@ app.on('ready', function() { autoUpdater.on("updateReady", function(updaterPath) { console.log("Launching " + updaterPath); - require('electron').dialog.showMessageBox(mainWindow, { + dialog.showMessageBox(mainWindow, { 'type': 'info', message: 'A new version is available, do you want to install now ?', buttons: ['Yes', 'No'] @@ -191,7 +192,7 @@ app.on('ready', function() { if (response === 0) { if (process.platform == 'win32') { - require('./utils/Util').exec('start ' + updaterPath).then(function(stdOut) { + util.exec('start ' + updaterPath).then(function(stdOut) { console.log(stdOut); process.exit(0); }); diff --git a/src/components/DashboardLogs.react.js b/src/components/DashboardLogs.react.js index 724b1f8..0b36398 100644 --- a/src/components/DashboardLogs.react.js +++ b/src/components/DashboardLogs.react.js @@ -1,5 +1,7 @@ import React from 'react/addons'; import Router from 'react-router'; +import {remote} from 'electron'; +import fs from 'fs'; import LogStore from '../stores/LogStore'; @@ -42,13 +44,11 @@ var DashboardLogs = React.createClass({ handleCopyClipboard: function () { - require('electron') - .remote + remote .clipboard .writeText(this.state.logs.join("\n")); - require('electron') - .remote + remote .dialog .showMessageBox({ type:'info', @@ -64,24 +64,23 @@ var DashboardLogs = React.createClass({ filters: [{ name: 'Log files', extensions: ['log'] }] }; - var dialog = require('electron').remote.dialog; + var dialog = remote.dialog; var self = this; dialog.showSaveDialog(args,function(filename) { - require('fs') - .writeFile(filename, self.state.logs.join("\n"), function (err) { - if (err) { - dialog.showErrorBox('Unable to save log path', 'Looks like we can\'t save the log file. Try again with another path.') - } else { - dialog.showMessageBox({ - type:'info', - title: 'Log saved !', - buttons: ['OK'], - message: 'Your log file has been saved successfully.' - }); - } - - }); + fs.writeFile(filename, self.state.logs.join("\n"), function (err) { + if (err) { + dialog.showErrorBox('Unable to save log path', 'Looks like we can\'t save the log file. Try again with another path.') + } else { + dialog.showMessageBox({ + type:'info', + title: 'Log saved !', + buttons: ['OK'], + message: 'Your log file has been saved successfully.' + }); + } + + }); }) }, diff --git a/src/menutemplate.js b/src/menutemplate.js index 064fa56..4549a4a 100755 --- a/src/menutemplate.js +++ b/src/menutemplate.js @@ -3,8 +3,8 @@ import router from './router'; import metrics from './utils/MetricsUtil'; import util from './utils/Util'; -var dialog = require('electron').remote.app; -var app = require('electron').remote.app; +var dialog = remote.dialog; +var app = remote.app; // main.js var MenuTemplate = function () { diff --git a/src/utils/Util.js b/src/utils/Util.js index 6c13c4b..2d3d7de 100755 --- a/src/utils/Util.js +++ b/src/utils/Util.js @@ -1,4 +1,5 @@ import {exec, execFile} from 'child_process'; +import {remote} from 'electron'; import Promise from 'bluebird'; import fs from 'fs'; import path from 'path'; @@ -91,14 +92,14 @@ module.exports = { return str.replace(/ /g, '\\ ').replace(/\(/g, '\\(').replace(/\)/g, '\\)'); }, home: function() { - return require('electron').remote.app.getPath('home'); + return remote.app.getPath('home'); }, documents: function() { // TODO: fix me for windows 7 return 'Documents'; }, supportDir: function() { - return require('electron').remote.app.getPath('userData'); + return remote.app.getPath('userData'); }, CommandOrCtrl: function() { return this.isWindows() ? 'Ctrl' : 'Command'; diff --git a/src/utils/VPNUtilWindows.js b/src/utils/VPNUtilWindows.js index f5d9b2b..121ed81 100644 --- a/src/utils/VPNUtilWindows.js +++ b/src/utils/VPNUtilWindows.js @@ -7,6 +7,7 @@ import fs from 'fs'; import helpers from './VPNHelpers'; import log from '../stores/LogStore'; import ps from 'xps'; +import {remote} from 'electron'; import serviceManager from 'windows-service-manager'; @@ -95,7 +96,7 @@ module.exports = { }, enableStartOnBoot: function(hidden) { return new Promise((resolve) => { - regKey.set('VPNht', Winreg.REG_SZ, "\"" + require('electron').remote.app.getPath('exe') + (hidden ? ' --hide' : '') + "\"", function() { + regKey.set('VPNht', Winreg.REG_SZ, "\"" + remote.app.getPath('exe') + (hidden ? ' --hide' : '') + "\"", function() { resolve(); }); }); diff --git a/src/utils/WebUtil.js b/src/utils/WebUtil.js index 7da11f2..0ee0b89 100755 --- a/src/utils/WebUtil.js +++ b/src/utils/WebUtil.js @@ -1,11 +1,12 @@ import {remote} from 'electron'; -var app = require('electron').remote.app; import fs from 'fs'; import util from './Util'; import path from 'path'; import bugsnag from 'bugsnag-js'; import metrics from './MetricsUtil'; +var app = remote.app; + var WebUtil = { addLiveReload: function () { if (process.env.NODE_ENV === 'development') { From 71d7d352cba039d3458b3205d0c7f09f3510bd2e Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 17:56:34 +0200 Subject: [PATCH 21/56] fix requiring powerMonitor too early --- src/browser.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/browser.js b/src/browser.js index 7ac53f1..585896e 100755 --- a/src/browser.js +++ b/src/browser.js @@ -1,4 +1,4 @@ -import {app, BrowserWindow, ipcMain, screen, powerMonitor, dialog} from 'electron'; +import {app, BrowserWindow, ipcMain, screen, dialog} from 'electron'; import os from 'os'; import net from 'net'; import fs from 'fs'; @@ -123,7 +123,8 @@ app.on('ready', function() { } }); - powerMonitor.on('resume', function() { + // powerMonitor cannot be required before 'ready' event is fired: https://github.com/electron/electron/blob/master/docs/api/power-monitor.md + require('electron').powerMonitor.on('resume', function() { mainWindow.webContents.send('application:vpn-check-sleep'); }); From 201ef69f8f46cc72ce5ae6ca8dcb7800f653b9a7 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 18:39:16 +0200 Subject: [PATCH 22/56] update to react 0.14 --- index.html | 1 + package.json | 6 ++++-- src/app.js | 3 ++- src/components/About.react.js | 2 +- src/components/Dashboard.react.js | 2 +- src/components/DashboardConnect.react.js | 5 +++-- src/components/DashboardConnectionDetails.react.js | 2 +- src/components/DashboardLogs.react.js | 5 +++-- src/components/Header.react.js | 2 +- src/components/Preferences.react.js | 2 +- src/components/Sidebar.react.js | 2 +- src/components/SubHeader.react.js | 2 +- src/routes.js | 2 +- 13 files changed, 21 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index 7751988..2a60e50 100755 --- a/index.html +++ b/index.html @@ -6,6 +6,7 @@ VPN.ht +
diff --git a/package.json b/package.json index 2fc9e44..f1cbecd 100644 --- a/package.json +++ b/package.json @@ -31,9 +31,11 @@ "node-uuid": "1.4.7", "object-assign": "4.1.0", "osx-release": "1.1.0", - "react": "0.13.3", + "react": "0.14.x", + "react-addons-linked-state-mixin": "0.14.x", "react-bootstrap": "^0.20.3", - "react-retina-image": "1.3.3", + "react-dom": "0.14.x", + "react-retina-image": "2.x.x", "react-router": "0.13.3", "react-select": "0.6.11", "request": "2.76.0", diff --git a/src/app.js b/src/app.js index d0d9a4d..66b1e1f 100755 --- a/src/app.js +++ b/src/app.js @@ -1,6 +1,7 @@ require.main.paths.splice(0, 0, process.env.NODE_PATH); import {remote, ipcRenderer} from 'electron'; import React from 'react'; +import ReactDOM from 'react-dom'; import metrics from './utils/MetricsUtil'; import VPN from './utils/VPNUtil'; import vpnActions from './actions/VPNActions'; @@ -37,7 +38,7 @@ var router = Router.create({ routes: routes }); -router.run(Handler => React.render( < Handler / > , document.body)); +router.run(Handler => ReactDOM.render( < Handler / > , document.getElementById('root'))); routerContainer.set(router); // Default Route diff --git a/src/components/About.react.js b/src/components/About.react.js index e796292..c2f1589 100755 --- a/src/components/About.react.js +++ b/src/components/About.react.js @@ -1,4 +1,4 @@ -import React from 'react/addons'; +import React from 'react'; import metrics from '../utils/MetricsUtil'; import utils from '../utils/Util'; import Router from 'react-router'; diff --git a/src/components/Dashboard.react.js b/src/components/Dashboard.react.js index 1945348..937fc22 100644 --- a/src/components/Dashboard.react.js +++ b/src/components/Dashboard.react.js @@ -1,4 +1,4 @@ -import React from 'react/addons'; +import React from 'react'; import metrics from '../utils/MetricsUtil'; import Router from 'react-router'; diff --git a/src/components/DashboardConnect.react.js b/src/components/DashboardConnect.react.js index 6b0f194..6a1ca5f 100644 --- a/src/components/DashboardConnect.react.js +++ b/src/components/DashboardConnect.react.js @@ -1,4 +1,5 @@ -import React from 'react/addons'; +import React from 'react'; +import LinkedStateMixin from 'react-addons-linked-state-mixin' import Router from 'react-router'; import myip from '../utils/MyipUtil'; @@ -16,7 +17,7 @@ import Credentials from '../utils/CredentialsUtil'; var DashboardConnect = React.createClass({ - mixins: [React.addons.LinkedStateMixin], + mixins: [LinkedStateMixin], getInitialState: function () { return { diff --git a/src/components/DashboardConnectionDetails.react.js b/src/components/DashboardConnectionDetails.react.js index 4ded958..c3937db 100644 --- a/src/components/DashboardConnectionDetails.react.js +++ b/src/components/DashboardConnectionDetails.react.js @@ -1,4 +1,4 @@ -import React from 'react/addons'; +import React from 'react'; import Router from 'react-router'; import VPN from '../actions/VPNActions'; import util from '../utils/Util'; diff --git a/src/components/DashboardLogs.react.js b/src/components/DashboardLogs.react.js index 0b36398..2ba5859 100644 --- a/src/components/DashboardLogs.react.js +++ b/src/components/DashboardLogs.react.js @@ -1,4 +1,5 @@ -import React from 'react/addons'; +import React from 'react'; +import ReactDOM from 'react-dom'; import Router from 'react-router'; import {remote} from 'electron'; import fs from 'fs'; @@ -30,7 +31,7 @@ var DashboardLogs = React.createClass({ }, scrollToBottom: function () { - var textarea = React.findDOMNode(this.refs.logsTextarea); + var textarea = ReactDOM.findDOMNode(this.refs.logsTextarea); textarea.scrollTop = textarea.scrollHeight; }, diff --git a/src/components/Header.react.js b/src/components/Header.react.js index 7f7c694..d63aba9 100644 --- a/src/components/Header.react.js +++ b/src/components/Header.react.js @@ -1,4 +1,4 @@ -import React from 'react/addons'; +import React from 'react'; import {remote, ipcRenderer} from 'electron'; import RetinaImage from 'react-retina-image'; import util from '../utils/Util'; diff --git a/src/components/Preferences.react.js b/src/components/Preferences.react.js index 032bf6b..bbd1647 100755 --- a/src/components/Preferences.react.js +++ b/src/components/Preferences.react.js @@ -1,4 +1,4 @@ -import React from 'react/addons'; +import React from 'react'; import metrics from '../utils/MetricsUtil'; import Router from 'react-router'; import Select from 'react-select'; diff --git a/src/components/Sidebar.react.js b/src/components/Sidebar.react.js index 4773d7e..f7a9d79 100644 --- a/src/components/Sidebar.react.js +++ b/src/components/Sidebar.react.js @@ -1,4 +1,4 @@ -import React from 'react/addons'; +import React from 'react'; import Router from 'react-router'; import RetinaImage from 'react-retina-image'; diff --git a/src/components/SubHeader.react.js b/src/components/SubHeader.react.js index 3554dd4..3b6eb03 100644 --- a/src/components/SubHeader.react.js +++ b/src/components/SubHeader.react.js @@ -1,4 +1,4 @@ -import React from 'react/addons'; +import React from 'react'; import RetinaImage from 'react-retina-image'; import accountStore from '../stores/AccountStore'; diff --git a/src/routes.js b/src/routes.js index 1a3596d..7d05b02 100755 --- a/src/routes.js +++ b/src/routes.js @@ -1,4 +1,4 @@ -import React from 'react/addons'; +import React from 'react'; import Framework from './components/Framework.react'; import Dashboard from './components/Dashboard.react'; From 58182af7ea0159e49981b963bb1aa3bb40e3a52b Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 19:27:28 +0200 Subject: [PATCH 23/56] use cmd+I to open 'about' page - on Windows, there is no menu. --- src/menutemplate.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/menutemplate.js b/src/menutemplate.js index 4549a4a..509f610 100755 --- a/src/menutemplate.js +++ b/src/menutemplate.js @@ -14,6 +14,7 @@ var MenuTemplate = function () { submenu: [ { label: 'About VPN.ht', + accelerator: util.CommandOrCtrl() + '+I', click: function () { metrics.track('Opened About', { from: 'menu' From daa6fc8909495654793c2be32ae4873d796f8216 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 19:29:11 +0200 Subject: [PATCH 24/56] update to react 15.x - react-router is dead in 16.x, needs updating. --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index f1cbecd..c8cd1b1 100644 --- a/package.json +++ b/package.json @@ -31,13 +31,13 @@ "node-uuid": "1.4.7", "object-assign": "4.1.0", "osx-release": "1.1.0", - "react": "0.14.x", - "react-addons-linked-state-mixin": "0.14.x", - "react-bootstrap": "^0.20.3", - "react-dom": "0.14.x", + "react": "15.x.x", + "react-addons-linked-state-mixin": "15.x.x", + "react-bootstrap": "0.30.x", + "react-dom": "15.x.x", "react-retina-image": "2.x.x", - "react-router": "0.13.3", - "react-select": "0.6.11", + "react-router": "0.13.x", + "react-select": "0.9.x", "request": "2.76.0", "windows-service-manager": "vpnht/windows-service-manager", "winreg": "1.2.2", From 53977fda9d598e5f649df223e565a377902ef9f0 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 21:24:34 +0200 Subject: [PATCH 25/56] remove deprecated LinkedStateMixin --- package.json | 1 - src/components/DashboardConnect.react.js | 15 ++++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index c8cd1b1..a51e74d 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "object-assign": "4.1.0", "osx-release": "1.1.0", "react": "15.x.x", - "react-addons-linked-state-mixin": "15.x.x", "react-bootstrap": "0.30.x", "react-dom": "15.x.x", "react-retina-image": "2.x.x", diff --git a/src/components/DashboardConnect.react.js b/src/components/DashboardConnect.react.js index 6a1ca5f..52bda50 100644 --- a/src/components/DashboardConnect.react.js +++ b/src/components/DashboardConnect.react.js @@ -1,5 +1,4 @@ import React from 'react'; -import LinkedStateMixin from 'react-addons-linked-state-mixin' import Router from 'react-router'; import myip from '../utils/MyipUtil'; @@ -17,8 +16,6 @@ import Credentials from '../utils/CredentialsUtil'; var DashboardConnect = React.createClass({ - mixins: [LinkedStateMixin], - getInitialState: function () { return { connecting: accountStore.getState().connecting, @@ -58,6 +55,14 @@ var DashboardConnect = React.createClass({ } }, + handleChange: function (key) { + return function (e) { + var state = {}; + state[key] = e.target.value; + this.setState(state); + }.bind(this); + }, + handleConnect: function (e) { e.preventDefault(); @@ -130,8 +135,8 @@ var DashboardConnect = React.createClass({

Login

- - + +
From 37014cc2d6b8e10b0ae899fffdc56923722846f5 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 21:37:15 +0200 Subject: [PATCH 26/56] use native Promise --- package.json | 1 - src/utils/MyipUtil.js | 1 - src/utils/Util.js | 1 - src/utils/VPNHelpers.js | 1 - src/utils/VPNUtil.js | 1 - src/utils/VPNUtilMac.js | 1 - src/utils/VPNUtilWindows.js | 1 - 7 files changed, 7 deletions(-) diff --git a/package.json b/package.json index a51e74d..35467ab 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "dependencies": { "alt": "0.18.6", "autoupdater": "vpnht/autoupdater", - "bluebird": "3.4.6", "bugsnag-js": "3.0.6", "classnames": "2.2.5", "get-port": "2.1.0", diff --git a/src/utils/MyipUtil.js b/src/utils/MyipUtil.js index 8ba6bd1..e29272e 100644 --- a/src/utils/MyipUtil.js +++ b/src/utils/MyipUtil.js @@ -1,7 +1,6 @@ import _ from 'lodash'; import request from 'request'; import metrics from './MetricsUtil'; -import Promise from 'bluebird'; import log from '../stores/LogStore'; import ServerActions from '../actions/ServerActions'; diff --git a/src/utils/Util.js b/src/utils/Util.js index 2d3d7de..48872dc 100755 --- a/src/utils/Util.js +++ b/src/utils/Util.js @@ -1,6 +1,5 @@ import {exec, execFile} from 'child_process'; import {remote} from 'electron'; -import Promise from 'bluebird'; import fs from 'fs'; import path from 'path'; import crypto from 'crypto'; diff --git a/src/utils/VPNHelpers.js b/src/utils/VPNHelpers.js index ec4b732..8ca393d 100644 --- a/src/utils/VPNHelpers.js +++ b/src/utils/VPNHelpers.js @@ -1,4 +1,3 @@ -import Promise from 'bluebird'; import fs from 'fs'; import log from '../stores/LogStore'; import vpnActions from '../actions/VPNActions'; diff --git a/src/utils/VPNUtil.js b/src/utils/VPNUtil.js index adcc038..24097cc 100644 --- a/src/utils/VPNUtil.js +++ b/src/utils/VPNUtil.js @@ -1,7 +1,6 @@ import _ from 'lodash'; import path from 'path'; import assign from 'object-assign'; -import Promise from 'bluebird'; import request from 'request'; import fs from 'fs'; diff --git a/src/utils/VPNUtilMac.js b/src/utils/VPNUtilMac.js index 77b5ff3..cb7fe84 100644 --- a/src/utils/VPNUtilMac.js +++ b/src/utils/VPNUtilMac.js @@ -1,7 +1,6 @@ import resources from './ResourcesUtil'; import util from './Util'; import path from 'path'; -import Promise from 'bluebird'; import log from '../stores/LogStore'; import fs from 'fs'; import running from 'is-running'; diff --git a/src/utils/VPNUtilWindows.js b/src/utils/VPNUtilWindows.js index 121ed81..3b9debd 100644 --- a/src/utils/VPNUtilWindows.js +++ b/src/utils/VPNUtilWindows.js @@ -2,7 +2,6 @@ import resources from './ResourcesUtil'; import util from './Util'; import path from 'path'; import Winreg from 'winreg'; -import Promise from 'bluebird'; import fs from 'fs'; import helpers from './VPNHelpers'; import log from '../stores/LogStore'; From 481b3ad1c6ff3a545c455403835e90e002286d9e Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 23:21:12 +0200 Subject: [PATCH 27/56] fix react-select --- package.json | 2 +- src/components/DashboardConnect.react.js | 3 +-- src/components/ServerListItem.react.js | 9 +++++++-- src/components/ServerListOption.react.js | 21 ++++++++++++++++----- src/utils/MyipUtil.js | 2 +- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 35467ab..e3bf2cc 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "react-dom": "15.x.x", "react-retina-image": "2.x.x", "react-router": "0.13.x", - "react-select": "0.9.x", + "react-select": "v1.0.0-rc.1", "request": "2.76.0", "windows-service-manager": "vpnht/windows-service-manager", "winreg": "1.2.2", diff --git a/src/components/DashboardConnect.react.js b/src/components/DashboardConnect.react.js index 52bda50..6e4e8c6 100644 --- a/src/components/DashboardConnect.react.js +++ b/src/components/DashboardConnect.react.js @@ -150,12 +150,11 @@ var DashboardConnect = React.createClass({ disabled={!this.state.appReady} name="server" value={this.state.server} - onOptionLabelClick={this.onLabelClick} options={this.state.servers} onChange={this.handleServer} placeholder="Select server" optionComponent={ServerOption} - singleValueComponent={ServerItem} + valueComponent={ServerItem} searchable={false} clearable={false} /> diff --git a/src/components/ServerListItem.react.js b/src/components/ServerListItem.react.js index 28483f8..9a0e604 100644 --- a/src/components/ServerListItem.react.js +++ b/src/components/ServerListItem.react.js @@ -14,8 +14,13 @@ var SingleValue = React.createClass({ marginRight: 10, position: 'relative', top: -2, - verticalAlign: 'middle', + verticalAlign: 'middle' }; + var placeHolderStyle = { + overflow: 'hidden', + textOverflow: 'ellipsis', + whiteSpace: 'nowrap', + } var flag = false; if (obj.value == 'hub.vpn.ht') { @@ -28,7 +33,7 @@ var SingleValue = React.createClass({ return (
{flag ? ( -
+
{obj.label}
diff --git a/src/components/ServerListOption.react.js b/src/components/ServerListOption.react.js index eb4d24e..65192b4 100644 --- a/src/components/ServerListOption.react.js +++ b/src/components/ServerListOption.react.js @@ -3,7 +3,6 @@ import RetinaImage from 'react-retina-image'; var Option = React.createClass({ propTypes: { - addLabelText: React.PropTypes.string, className: React.PropTypes.string, mouseDown: React.PropTypes.func, mouseEnter: React.PropTypes.func, @@ -11,6 +10,18 @@ var Option = React.createClass({ option: React.PropTypes.object.isRequired, renderFunc: React.PropTypes.func }, + handleMouseDown (event) { + event.preventDefault(); + event.stopPropagation(); + this.props.onSelect(this.props.option, event); + }, + handleMouseEnter (event) { + this.props.onFocus(this.props.option, event); + }, + handleMouseMove (event) { + if (this.props.isFocused) return; + this.props.onFocus(this.props.option, event); + }, render () { var obj = this.props.option; var size = 15; @@ -32,10 +43,10 @@ var Option = React.createClass({ return (
+ onMouseEnter={this.handleMouseEnter} + onMouseLeave={this.handleMouseMove} + onMouseDown={this.handleMouseDown} + onClick={this.handleMouseDown}> {obj.label}
diff --git a/src/utils/MyipUtil.js b/src/utils/MyipUtil.js index e29272e..1370c87 100644 --- a/src/utils/MyipUtil.js +++ b/src/utils/MyipUtil.js @@ -47,7 +47,7 @@ var MyipUtil = { _.each(servers, function(server, country) { - serverName = server.countryName + ' - ' + Math.round(server.distance) + ' KM - LOC ' + server.host.toUpperCase().replace( /^\D+/g, ''); + serverName = server.countryName + ' - ' + server.host.toUpperCase().replace( /^\D+/g, '') + ' (' + Math.round(server.distance) + ' KM)'; if (server.regionName) { serverName = server.regionName + ", " + serverName; From cc1f37d52ee36432252029080776930a11a20928 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sat, 29 Oct 2016 23:30:59 +0200 Subject: [PATCH 28/56] user-friendly log - SettingsUtil's `.save()` now has a third (optionnal) argument 'displayValue' just for the displayed logs --- src/components/DashboardConnect.react.js | 6 +++--- src/utils/SettingsUtil.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/DashboardConnect.react.js b/src/components/DashboardConnect.react.js index 6e4e8c6..3751b42 100644 --- a/src/components/DashboardConnect.react.js +++ b/src/components/DashboardConnect.react.js @@ -96,7 +96,7 @@ var DashboardConnect = React.createClass({ }); // save for future use - Settings.save('server', val); + Settings.save('server', val, val.label); }, handleChangeSaveCredentials: function (e) { @@ -135,8 +135,8 @@ var DashboardConnect = React.createClass({

Login

- - + +
diff --git a/src/utils/SettingsUtil.js b/src/utils/SettingsUtil.js index 23824c3..64f5e41 100644 --- a/src/utils/SettingsUtil.js +++ b/src/utils/SettingsUtil.js @@ -33,8 +33,8 @@ module.exports = { return value; }, - save: function (key, value) { - log.info('Preferences | ' + key + ' = ' + value); + save: function (key, value, displayValue) { + log.info('Preferences | ' + key + ' = ' + (displayValue || value)); localStorage.setItem('settings.'+key, JSON.stringify(value)); } } From 05aeac10264bea85751d875605b93e9bdaad8390 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sun, 30 Oct 2016 10:53:42 +0100 Subject: [PATCH 29/56] clear object-assign node-module --- package.json | 1 - src/stores/LogStore.js | 3 +-- src/utils/MetricsUtil.js | 3 +-- src/utils/VPNUtil.js | 3 +-- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index e3bf2cc..a445256 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "mixpanel": "kitematic/mixpanel-node", "node-openvpn": "VPNht/node-openvpn", "node-uuid": "1.4.7", - "object-assign": "4.1.0", "osx-release": "1.1.0", "react": "15.x.x", "react-bootstrap": "0.30.x", diff --git a/src/stores/LogStore.js b/src/stores/LogStore.js index 4d33bb0..081ce93 100755 --- a/src/stores/LogStore.js +++ b/src/stores/LogStore.js @@ -1,12 +1,11 @@ import {EventEmitter} from 'events'; -import assign from 'object-assign'; import _ from 'lodash'; import os from 'os'; var _logs = []; var MAX_LOG_SIZE = 3000; -module.exports = assign(Object.create(EventEmitter.prototype), { +module.exports = Object.assign(Object.create(EventEmitter.prototype), { SERVER_LOGS_EVENT: 'server_logs_event', error: function(line, obj) { diff --git a/src/utils/MetricsUtil.js b/src/utils/MetricsUtil.js index be8be4e..22a2c04 100755 --- a/src/utils/MetricsUtil.js +++ b/src/utils/MetricsUtil.js @@ -1,4 +1,3 @@ -import assign from 'object-assign'; import Mixpanel from 'mixpanel'; import uuid from 'node-uuid'; import fs from 'fs'; @@ -51,7 +50,7 @@ var Metrics = { let osName = os.platform(); let osVersion = util.isWindows() ? os.release() : osxRelease(os.release()).version; - mixpanel.track(name, assign({ + mixpanel.track(name, Object.assign({ distinct_id: id, version: util.packagejson().version, 'Operating System': osName, diff --git a/src/utils/VPNUtil.js b/src/utils/VPNUtil.js index 24097cc..b88cacd 100644 --- a/src/utils/VPNUtil.js +++ b/src/utils/VPNUtil.js @@ -1,6 +1,5 @@ import _ from 'lodash'; import path from 'path'; -import assign from 'object-assign'; import request from 'request'; import fs from 'fs'; @@ -31,7 +30,7 @@ switch (process.platform) { break; }; -module.exports = assign(currentOSLib, { +module.exports = Object.assign(currentOSLib, { generateConfig: function (managementPort) { return new Promise((resolve, reject) => { From 08138319140c55fe2ce28a095e5e2892b335494a Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sun, 30 Oct 2016 10:58:46 +0100 Subject: [PATCH 30/56] correctly log chosen server while connecting --- src/utils/VPNUtil.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/VPNUtil.js b/src/utils/VPNUtil.js index b88cacd..25e9374 100644 --- a/src/utils/VPNUtil.js +++ b/src/utils/VPNUtil.js @@ -163,7 +163,7 @@ module.exports = Object.assign(currentOSLib, { _args = args; - log.info("\n\n----------------------\nConnecting to "+ args.server + "\n"); + log.info("\n\n----------------------\nConnecting to "+ args.server.label + "\n"); return helpers.checkRunning() .then(this.stopProcess) From 01d6604f47c2890e71c535e12013194664548781 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sun, 30 Oct 2016 11:19:42 +0100 Subject: [PATCH 31/56] update package.json to working deps --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a445256..1196492 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,6 @@ "source-map-support": "^0.4.5" }, "optionalDependencies": { - "electron-prebuilt": "^1.3.8" + "electron": "^1.4.4" } } From a749f9d760b9cf87305b451d73d62d0518a22d58 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sun, 30 Oct 2016 11:22:33 +0100 Subject: [PATCH 32/56] remove react-tools (deprecated & unused) --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 1196492..36b69a4 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,6 @@ "grunt-shell-spawn": "^0.3.10", "load-grunt-tasks": "^3.5.2", "minimist": "^1.2.0", - "react-tools": "^0.13.1", "run-sequence": "^1.2.2", "shell-escape": "^0.2.0", "source-map-support": "^0.4.5" From eda611d3250297af41ef9ad5a35020a9e8198346 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sun, 30 Oct 2016 11:24:10 +0100 Subject: [PATCH 33/56] update electron-version for building --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 36b69a4..1a20fb0 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "release": "grunt release" }, "license": "GPL-3.0", - "electron-version": "0.33.3", + "electron-version": "1.4.4", "dependencies": { "alt": "0.18.6", "autoupdater": "vpnht/autoupdater", From f9368647eb863fc7eedb34d2d9a3011de6441e15 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sun, 30 Oct 2016 11:27:21 +0100 Subject: [PATCH 34/56] move grunt escaping to a proper func --- Gruntfile.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 04fde85..00f70aa 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -17,6 +17,10 @@ module.exports = function (grunt) { return match ? match[1] : null; }; + var clear = function (str) { + return str.replace(/ /g, '\\ ').replace(/\(/g,'\\(').replace(/\)/g,'\\)'); + }; + var BASENAME = 'VPN.ht'; var APPNAME = BASENAME; @@ -35,14 +39,14 @@ module.exports = function (grunt) { grunt.initConfig({ IDENTITY: 'Developer ID Application: David Lemarier', APPNAME: APPNAME, - APPNAME_ESCAPED: APPNAME.replace(/ /g, '\\ ').replace(/\(/g,'\\(').replace(/\)/g,'\\)'), + APPNAME_ESCAPED: clear(APPNAME), OSX_OUT: OSX_OUT, - OSX_OUT_ESCAPED: OSX_OUT.replace(/ /g, '\\ ').replace(/\(/g,'\\(').replace(/\)/g,'\\)'), + OSX_OUT_ESCAPED: clear(OSX_OUT), OSX_OUT_X64: OSX_OUT_X64, OSX_FILENAME: OSX_FILENAME, - OSX_FILENAME_ESCAPED: OSX_FILENAME.replace(/ /g, '\\ ').replace(/\(/g,'\\(').replace(/\)/g,'\\)'), + OSX_FILENAME_ESCAPED: clear(OSX_FILENAME), OSX_DIST_X64: OSX_DIST_X64, - OSX_DIST_X64_ESCAPED: OSX_DIST_X64.replace(/ /g, '\\ ').replace(/\(/g,'\\(').replace(/\)/g,'\\)'), + OSX_DIST_X64_ESCAPED: clear(OSX_DIST_X64), // electron electron: { windows: { From 0f77dcf1c0956266804d24a6391790150c739fc1 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sun, 30 Oct 2016 11:37:12 +0100 Subject: [PATCH 35/56] add #root to css lines --- styles/main.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/styles/main.less b/styles/main.less index 968949b..a99e8e3 100755 --- a/styles/main.less +++ b/styles/main.less @@ -11,7 +11,7 @@ @import "flags.less"; @import "fonts.less"; -html, body { +html, body, #root { margin:0px; font-family: 'Roboto', sans-serif; font-smooth: always; From a8834114a299731c4cfdf2d1ab25e328ab69e163 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Sun, 30 Oct 2016 11:43:09 +0100 Subject: [PATCH 36/56] specify engines (node, npm) versions to be used --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index 1a20fb0..b6a0e93 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,10 @@ "start": "grunt", "release": "grunt release" }, + "engines": { + "node": ">=6.0.0", + "npm": ">=3.0.0" + }, "license": "GPL-3.0", "electron-version": "1.4.4", "dependencies": { From ca87d95c52da41730055ce647e519ca36cd76399 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Tue, 1 Nov 2016 11:25:31 +0100 Subject: [PATCH 37/56] update to babel 6 --- Gruntfile.js | 2 +- package.json | 6 ++++-- src/actions/ServerActions.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 00f70aa..42fc429 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -223,7 +223,7 @@ module.exports = function (grunt) { babel: { options: { sourceMap: 'inline', - blacklist: 'regenerator' + presets: ['es2015', 'react'] }, dist: { files: [{ diff --git a/package.json b/package.json index b6a0e93..0c0194a 100644 --- a/package.json +++ b/package.json @@ -47,9 +47,11 @@ }, "devDependencies": { "async": "^2.1.2", - "babel": "^5.0.0", + "babel-core": "^6.0.0", + "babel-preset-es2015": "^6.0.0", + "babel-preset-react": "^6.0.0", "grunt": "^1.0.1", - "grunt-babel": "^5.0.0", + "grunt-babel": "^6.0.0", "grunt-chmod": "^1.1.1", "grunt-cli": "^1.2.0", "grunt-contrib-clean": "^1.0.0", diff --git a/src/actions/ServerActions.js b/src/actions/ServerActions.js index 6801f88..7807a9d 100644 --- a/src/actions/ServerActions.js +++ b/src/actions/ServerActions.js @@ -1,4 +1,4 @@ -var alt = require('../alt') +import alt from '../alt' class ServerActions { constructor() { From e3f4a06f457905a3cc65cc3dd17d80b4f125f977 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Tue, 1 Nov 2016 11:37:15 +0100 Subject: [PATCH 38/56] remove unused & outdated grunt-rename --- Gruntfile.js | 7 ------- package.json | 1 - 2 files changed, 8 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 42fc429..71b7f8b 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -200,13 +200,6 @@ module.exports = function (grunt) { } }, - rename: { - installer: { - src: 'dist/Setup.exe', - dest: 'dist/' + BASENAME + 'Setup-' + packagejson.version + '-Windows-Alpha.exe' - } - }, - // styles less: { options: { diff --git a/package.json b/package.json index 0c0194a..d190681 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,6 @@ "grunt-plistbuddy": "^0.2.0", "grunt-prompt": "^1.3.3", "grunt-rcedit": "^0.7.0", - "grunt-rename": "^0.1.4", "grunt-shell": "^2.0.0", "grunt-shell-spawn": "^0.3.10", "load-grunt-tasks": "^3.5.2", From b2e35f86ced3391fbb6c81f6c058345fa2b28300 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Tue, 1 Nov 2016 12:02:02 +0100 Subject: [PATCH 39/56] prevent resizing logs (textarea) --- styles/content.less | 2 ++ 1 file changed, 2 insertions(+) diff --git a/styles/content.less b/styles/content.less index ca40529..e34b0c1 100644 --- a/styles/content.less +++ b/styles/content.less @@ -136,6 +136,7 @@ section textarea.logs { background-color: #ffffff; padding: 15px 15px;; -webkit-user-select: all; + resize: none; } section .console-output p { @@ -209,6 +210,7 @@ section label { } section .checkbox p { + cursor: pointer; margin-left: 30px; color: #1b1b1b; font-size: 14px; From 3252e84bf96d6e25c96e6dfb68b9c0d93f6a8250 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Tue, 1 Nov 2016 12:16:41 +0100 Subject: [PATCH 40/56] make labels clickable on checkboxes --- src/components/DashboardConnect.react.js | 5 ++-- src/components/Preferences.react.js | 35 ++++++++++++++---------- styles/content.less | 6 ++-- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/components/DashboardConnect.react.js b/src/components/DashboardConnect.react.js index 3751b42..cd518f5 100644 --- a/src/components/DashboardConnect.react.js +++ b/src/components/DashboardConnect.react.js @@ -139,8 +139,9 @@ var DashboardConnect = React.createClass({
- -

Remember my username and password

+
diff --git a/src/components/Preferences.react.js b/src/components/Preferences.react.js index bbd1647..0070d19 100755 --- a/src/components/Preferences.react.js +++ b/src/components/Preferences.react.js @@ -207,33 +207,39 @@ var Preferences = React.createClass({
- -

Report anonymous usage analytics

+
- -

Auto-connect after launch (requires a saved user/pass)

+
- -

Launch on operating system startup

+
- -

Launch on operating system startup hidden

+
- -

Disable SmartDNS

+
- -

Minimize to taskbar

+
@@ -254,8 +260,9 @@ var Preferences = React.createClass({

Auto Path

- -

{this.state.autoPath ? 'Enabled' : 'Disabled'}

+

Feature that tries alternate ports in order to resolve certain types of connections issues.

diff --git a/styles/content.less b/styles/content.less index e34b0c1..4a1609c 100644 --- a/styles/content.less +++ b/styles/content.less @@ -205,12 +205,12 @@ section label { position: absolute; width: 18px; height: 18px; + white-space: nowrap; background-color: white; border: 1px solid #ccc; } section .checkbox p { - cursor: pointer; margin-left: 30px; color: #1b1b1b; font-size: 14px; @@ -228,6 +228,7 @@ section .checkbox p.info { border-left-style: solid; position: relative; border-left-width: 1px; + float: right; } section label:after { @@ -238,7 +239,8 @@ section label:after { color: #1eb7b5; font-size: 38px; margin-left: 2px; - position: relative; + position: absolute; + left: 0; top: -9px; transform: rotate(-10deg); } From 54ee64048defc202d4ed71011005413c22d48458 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Tue, 1 Nov 2016 12:35:10 +0100 Subject: [PATCH 41/56] connect after hitting 'enter' on password input --- src/components/DashboardConnect.react.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/DashboardConnect.react.js b/src/components/DashboardConnect.react.js index cd518f5..24e2262 100644 --- a/src/components/DashboardConnect.react.js +++ b/src/components/DashboardConnect.react.js @@ -105,10 +105,24 @@ var DashboardConnect = React.createClass({ saveCredentials: checked }); + // clear username/pw + if (!checked) { + this.setState({ + username: '', + password: '' + }); + } + // save for future use Settings.save('saveCredentials', !!checked); }, + handleKeyPress: function (e) { + if (e.key === 'Enter') { + this.handleConnect(e); + } + }, + render: function () { var currentStatus = 'Loading...'; if (this.state.appReady) { @@ -136,7 +150,7 @@ var DashboardConnect = React.createClass({

Login

- +