make it work with ssl insight

This commit is contained in:
Manuel Araoz 2014-08-25 18:26:26 -03:00
parent c07055b012
commit 342a69d737
4 changed files with 12 additions and 26 deletions

View File

@ -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

View File

@ -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,

View File

@ -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',
});
};

View File

@ -47,22 +47,6 @@
</fieldset>
<fieldset>
<legend>PeerJS server</legend>
<label for="peerjs-key">Key</label>
<input type="text" ng-model="networkKey" class="form-control" name="peerjs-key">
<label for="peerjs-host">Host</label>
<input type="text" ng-model="networkHost" class="form-control" name="peerjs-host">
<label for="peerjs-port">Port</label>
<input type="number" ng-model="networkPort" class="form-control" name="peerjs-port">
<input id="peerjs-secure" type="checkbox" ng-model="networkSecure" class="form-control">
<label for="peerjs-secure">Use SSL</label>
<p class="small">
PeerJS Server is open-source software. You can run your own instance, or use PeerJS Server cloud. Check <a href="http://peerjs.com" target="_blank">PeerJS Server</a>
</p>
</fieldset>
<div class="text-right">
<a class="back-button text-white m20r" href="#!/">&laquo; Back</a>
<button type="submit" class="button primary m0 ng-binding" ng-disabled="setupForm.$invalid || loading" disabled="disabled" ng-click="save()">