From 342a69d7379044f53227e854bd600aab8a336e8c Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Mon, 25 Aug 2014 18:26:26 -0300 Subject: [PATCH] make it work with ssl insight --- config.js | 5 +++-- js/controllers/settings.js | 7 +++---- js/models/network/Async.js | 10 ++++++---- views/settings.html | 16 ---------------- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/config.js b/config.js index 73293528c..5c658ea68 100644 --- a/config.js +++ b/config.js @@ -17,8 +17,9 @@ var defaultConfig = { // network layer config network: { - host: 'localhost', - port: 3001 + host: 'test-insight.bitpay.com', + port: 443, + schema: 'https' }, // wallet default config diff --git a/js/controllers/settings.js b/js/controllers/settings.js index 6ff26a035..c8761aa17 100644 --- a/js/controllers/settings.js +++ b/js/controllers/settings.js @@ -52,10 +52,9 @@ angular.module('copayApp.controllers').controller('SettingsController', function $scope.save = function() { var network = config.network; - network.key = $scope.networkKey; - network.host = $scope.networkHost; - network.port = $scope.networkPort; - network.secure = $scope.networkSecure; + network.host = $scope.insightHost; + network.port = $scope.insightPort; + network.schema = $scope.insightSecure ? 'https' : 'http'; localStorage.setItem('config', JSON.stringify({ networkName: $scope.networkName, diff --git a/js/models/network/Async.js b/js/models/network/Async.js index 55fb8d368..72ef40ace 100644 --- a/js/models/network/Async.js +++ b/js/models/network/Async.js @@ -28,6 +28,7 @@ function Network(opts) { this.maxPeers = opts.maxPeers || 12; this.host = opts.host || 'localhost'; this.port = opts.port || 3001; + this.schema = opts.schema || 'https'; this.cleanUp(); } @@ -293,7 +294,7 @@ Network.prototype.start = function(opts, openCallback) { this.setCopayerId(opts.copayerId); this.maxPeers = opts.maxPeers || this.maxPeers; - this.socket = this.createSocket(this.host, this.port); + this.socket = this.createSocket(); this._setupConnectionHandlers(openCallback); this.socket.emit('subscribe', pubkey); this.socket.emit('sync', opts.lastTimestamp); @@ -301,11 +302,12 @@ Network.prototype.start = function(opts, openCallback) { }; -Network.prototype.createSocket = function(host, port) { - var hostPort = host + ':' + port; +Network.prototype.createSocket = function() { + var hostPort = this.schema + '://' + this.host + ':' + this.port; return io.connect(hostPort, { reconnection: true, - 'force new connection': true + 'force new connection': true, + 'secure': this.schema === 'https', }); }; diff --git a/views/settings.html b/views/settings.html index 47f92935a..2b231322b 100644 --- a/views/settings.html +++ b/views/settings.html @@ -47,22 +47,6 @@ -
- PeerJS server - - - - - - - - - -

- PeerJS Server is open-source software. You can run your own instance, or use PeerJS Server cloud. Check PeerJS Server -

-
-
« Back