From f208e1fc7bebaad350e9948e6b43dd9c94ef5c00 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 24 Apr 2014 17:24:43 -0300 Subject: [PATCH 1/2] add config for bitcore"s server --- config.template.js | 11 ++++++++--- index.html | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config.template.js b/config.template.js index eb8cdcbb8..b4565387b 100644 --- a/config.template.js +++ b/config.template.js @@ -3,14 +3,19 @@ var config = { networkName: 'testnet', network: { - key: 'lwjd5qra8257b9', //Copay API key for public PeerJS server + // key: 'lwjd5qra8257b9', //Copay API key for public PeerJS server // This is for running local peerJs with params: ./peerjs -p 10009 -k 'sdfjhwefh' //key: 'sdfjhwefh', //host: 'localhost', //port: 10009, //path: '/', - maxPeers: 3, - debug: 3, + // + key: 'g23ihfh82h35rf', + host:'162.242.219.26', + port:10009, + path: '/', + maxPeers: 15, + debug: 3 }, limits: { totalCopayers: 10, diff --git a/index.html b/index.html index 5da820527..bf11066d7 100644 --- a/index.html +++ b/index.html @@ -18,7 +18,7 @@
-
Wallet: {{$root.wallet.name}} <{{$root.wallet.id}}>
+
Wallet: escape({{$root.wallet.name}}) <{{$root.wallet.id}}>

From 5fc4ab51017a5a97bfb8e64ecb705089237886fd Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 24 Apr 2014 17:54:43 -0300 Subject: [PATCH 2/2] fix signout --- index.html | 2 +- js/models/network/WebRTC.js | 10 ++++++---- js/services/controllerUtils.js | 2 ++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index bf11066d7..5da820527 100644 --- a/index.html +++ b/index.html @@ -18,7 +18,7 @@
-
Wallet: escape({{$root.wallet.name}}) <{{$root.wallet.id}}>
+
Wallet: {{$root.wallet.name}} <{{$root.wallet.id}}>

diff --git a/js/models/network/WebRTC.js b/js/models/network/WebRTC.js index 2f0aec30b..62e0f566c 100644 --- a/js/models/network/WebRTC.js +++ b/js/models/network/WebRTC.js @@ -258,8 +258,8 @@ Network.prototype._setupPeerHandlers = function(openCallback) { self._checkAnyPeer(); }); - p.on('connection', function(dataConn) { + p.on('connection', function(dataConn) { console.log('### NEW INBOUND CONNECTION %d/%d', self.connectedPeers.length, self.maxPeers); if (self.connectedPeers.length >= self.maxPeers) { console.log('### PEER REJECTED. PEER MAX LIMIT REACHED'); @@ -403,6 +403,7 @@ Network.prototype.connectTo = function(copayerId) { }; Network.prototype._cleanUp = function() { + var self = this; self.connectedPeers = []; self.started = false; self.peerId = null; @@ -421,9 +422,10 @@ Network.prototype._cleanUp = function() { Network.prototype.disconnect = function(cb, forced) { var self = this; self.closing = 1; - this.send(null, { type: 'disconnect' }); - this._cleanUp(); - if (typeof cb === 'function') cb(); + self.send(null, { type: 'disconnect' }, function(){ + self._cleanUp(); + if (typeof cb === 'function') cb(); + }); }; module.exports = require('soop')(Network); diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index db4b095a6..253f02ad6 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -4,6 +4,8 @@ angular.module('copay.controllerUtils').factory('controllerUtils', function ($ro var root = {}; root.logout = function() { + console.log('### DELETING WALLET'); //TODO + $rootScope.wallet = null; delete $rootScope['wallet']; $rootScope.totalBalance = 0; $location.path('signin');