make it work with ssl insight
This commit is contained in:
parent
c07055b012
commit
342a69d737
4 changed files with 12 additions and 26 deletions
|
|
@ -17,8 +17,9 @@ var defaultConfig = {
|
||||||
|
|
||||||
// network layer config
|
// network layer config
|
||||||
network: {
|
network: {
|
||||||
host: 'localhost',
|
host: 'test-insight.bitpay.com',
|
||||||
port: 3001
|
port: 443,
|
||||||
|
schema: 'https'
|
||||||
},
|
},
|
||||||
|
|
||||||
// wallet default config
|
// wallet default config
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,9 @@ angular.module('copayApp.controllers').controller('SettingsController', function
|
||||||
|
|
||||||
$scope.save = function() {
|
$scope.save = function() {
|
||||||
var network = config.network;
|
var network = config.network;
|
||||||
network.key = $scope.networkKey;
|
network.host = $scope.insightHost;
|
||||||
network.host = $scope.networkHost;
|
network.port = $scope.insightPort;
|
||||||
network.port = $scope.networkPort;
|
network.schema = $scope.insightSecure ? 'https' : 'http';
|
||||||
network.secure = $scope.networkSecure;
|
|
||||||
|
|
||||||
localStorage.setItem('config', JSON.stringify({
|
localStorage.setItem('config', JSON.stringify({
|
||||||
networkName: $scope.networkName,
|
networkName: $scope.networkName,
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ function Network(opts) {
|
||||||
this.maxPeers = opts.maxPeers || 12;
|
this.maxPeers = opts.maxPeers || 12;
|
||||||
this.host = opts.host || 'localhost';
|
this.host = opts.host || 'localhost';
|
||||||
this.port = opts.port || 3001;
|
this.port = opts.port || 3001;
|
||||||
|
this.schema = opts.schema || 'https';
|
||||||
this.cleanUp();
|
this.cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -293,7 +294,7 @@ Network.prototype.start = function(opts, openCallback) {
|
||||||
this.setCopayerId(opts.copayerId);
|
this.setCopayerId(opts.copayerId);
|
||||||
this.maxPeers = opts.maxPeers || this.maxPeers;
|
this.maxPeers = opts.maxPeers || this.maxPeers;
|
||||||
|
|
||||||
this.socket = this.createSocket(this.host, this.port);
|
this.socket = this.createSocket();
|
||||||
this._setupConnectionHandlers(openCallback);
|
this._setupConnectionHandlers(openCallback);
|
||||||
this.socket.emit('subscribe', pubkey);
|
this.socket.emit('subscribe', pubkey);
|
||||||
this.socket.emit('sync', opts.lastTimestamp);
|
this.socket.emit('sync', opts.lastTimestamp);
|
||||||
|
|
@ -301,11 +302,12 @@ Network.prototype.start = function(opts, openCallback) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Network.prototype.createSocket = function(host, port) {
|
Network.prototype.createSocket = function() {
|
||||||
var hostPort = host + ':' + port;
|
var hostPort = this.schema + '://' + this.host + ':' + this.port;
|
||||||
return io.connect(hostPort, {
|
return io.connect(hostPort, {
|
||||||
reconnection: true,
|
reconnection: true,
|
||||||
'force new connection': true
|
'force new connection': true,
|
||||||
|
'secure': this.schema === 'https',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,22 +47,6 @@
|
||||||
|
|
||||||
</fieldset>
|
</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">
|
<div class="text-right">
|
||||||
<a class="back-button text-white m20r" href="#!/">« Back</a>
|
<a class="back-button text-white m20r" href="#!/">« Back</a>
|
||||||
<button type="submit" class="button primary m0 ng-binding" ng-disabled="setupForm.$invalid || loading" disabled="disabled" ng-click="save()">
|
<button type="submit" class="button primary m0 ng-binding" ng-disabled="setupForm.$invalid || loading" disabled="disabled" ng-click="save()">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue