mirror of https://github.com/BTCPrivate/copay.git
fix conflict
This commit is contained in:
commit
985551f263
22
index.html
22
index.html
|
@ -192,8 +192,8 @@
|
||||||
<h3>Create a new wallet</h3>
|
<h3>Create a new wallet</h3>
|
||||||
<form name="createForm" ng-submit="create(createForm)" novalidate>
|
<form name="createForm" ng-submit="create(createForm)" novalidate>
|
||||||
<input type="text" class="form-control" ng-model="walletName" name="walletName" placeholder="Wallet name (optional)">
|
<input type="text" class="form-control" ng-model="walletName" name="walletName" placeholder="Wallet name (optional)">
|
||||||
<input type="password" class="form-control" placeholder="Choose your password" name="createPassword" ng-model="createPassword" required>
|
<input type="password" class="form-control" placeholder="Choose your password" name="createPassword" ng-model="createPassword" check-strength="createPassword" required>
|
||||||
<button type="submit" class="button secondary radius" ng-disabled="createForm.$invalid || loading" loading="Creating">Create</button>
|
<button type="submit" class="button secondary radius" ng-disabled="createForm.$invalid || loading" loading="Creating">Create</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -203,7 +203,7 @@
|
||||||
<h3>Join a Wallet in Creation</h3>
|
<h3>Join a Wallet in Creation</h3>
|
||||||
<form name="joinForm" ng-submit="join(joinForm)" novalidate>
|
<form name="joinForm" ng-submit="join(joinForm)" novalidate>
|
||||||
<input type="text" class="form-control" placeholder="Paste wallet secret here" name="connectionId" ng-model="connectionId" wallet-secret required>
|
<input type="text" class="form-control" placeholder="Paste wallet secret here" name="connectionId" ng-model="connectionId" wallet-secret required>
|
||||||
<input type="password" class="form-control" placeholder="Choose your password" name="joinPassword" ng-model="joinPassword" required>
|
<input type="password" class="form-control" placeholder="Choose your password" name="joinPassword" ng-model="joinPassword" check-strength="joinPassword" required>
|
||||||
<input type="text" class="form-control" placeholder="Your name (optional)" name="nickname" ng-model="nickname">
|
<input type="text" class="form-control" placeholder="Your name (optional)" name="nickname" ng-model="nickname">
|
||||||
<button type="submit" class="button primary radius" ng-disabled="joinForm.$invalid || loading" loading="Joining">Join</button>
|
<button type="submit" class="button primary radius" ng-disabled="joinForm.$invalid || loading" loading="Joining">Join</button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -294,7 +294,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
|
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
|
||||||
<h6>Your Wallet Password (you don't need to share this) <small>Required</small></h6>
|
<h6>Your Wallet Password (you don't need to share this) <small>Required</small></h6>
|
||||||
<input type="password" class="form-control" ng-model="walletPassword" required>
|
<input type="password" class="form-control" ng-model="walletPassword" check-strength="walletPassword" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
|
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
|
||||||
<h6>Wallet name <small>Optional</small></h6>
|
<h6>Wallet name <small>Optional</small></h6>
|
||||||
|
@ -488,9 +488,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="large-12 columns">
|
<div class="large-12 columns">
|
||||||
<h4>Last transactions</h4>
|
<h4>Last transactions</h4>
|
||||||
<button ng-click="toogleLast()" ng-disabled="loading" loading="Updating">
|
<button ng-click="toogleLast()" ng-disabled="loading" loading="Updating" ng-hide="lastShowed && !loading">Show</button>
|
||||||
Show
|
<button ng-click="toogleLast()" ng-disabled="loading" loading="Updating" ng-show="lastShowed && !loading">Hide</button>
|
||||||
</button>
|
|
||||||
<div class="btransactions" ng-if="lastShowed">
|
<div class="btransactions" ng-if="lastShowed">
|
||||||
<div ng-if="!blockchain_txs[0].txid && !loading">
|
<div ng-if="!blockchain_txs[0].txid && !loading">
|
||||||
No transactions yet.
|
No transactions yet.
|
||||||
|
@ -510,7 +509,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="tx-copayers">
|
<div class="tx-copayers">
|
||||||
<div class="large-5 small-5 columns">
|
<div class="large-5 small-5 columns">
|
||||||
<div ng-repeat="vin in btx.vin | groupByAddress">
|
<div ng-repeat="vin in btx.vin track by $index | groupByAddress">
|
||||||
<p class="small-8 ellipsis left text-gray size-12"> {{vin.addr}} </p>
|
<p class="small-8 ellipsis left text-gray size-12"> {{vin.addr}} </p>
|
||||||
<small class="small-4 right">{{vin.value}}</small>
|
<small class="small-4 right">{{vin.value}}</small>
|
||||||
</div>
|
</div>
|
||||||
|
@ -564,7 +563,8 @@
|
||||||
not valid</small>
|
not valid</small>
|
||||||
</label>
|
</label>
|
||||||
<div class="small-10 columns">
|
<div class="small-10 columns">
|
||||||
<input type="text" id="address" name="address" placeholder="Send to" ng-model="address" valid-address required>
|
<input type="text" id="address" name="address" ng-disabled="loading"
|
||||||
|
placeholder="Send to" ng-model="address" valid-address required>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-2 columns" ng-hide="showScanner || !isHttp">
|
<div class="small-2 columns" ng-hide="showScanner || !isHttp">
|
||||||
<a class="postfix button secondary" ng-click="openScanner()"><i class="fi-camera"></i></a>
|
<a class="postfix button secondary" ng-click="openScanner()"><i class="fi-camera"></i></a>
|
||||||
|
@ -604,7 +604,9 @@
|
||||||
<small ng-show="notEnoughAmount">{{notEnoughAmount}}</small>
|
<small ng-show="notEnoughAmount">{{notEnoughAmount}}</small>
|
||||||
</label>
|
</label>
|
||||||
<div class="small-9 columns">
|
<div class="small-9 columns">
|
||||||
<input type="number" id="amount" name="amount" placeholder="Amount" ng-model="amount" min="0.0001" max="10000000" enough-amount required>
|
<input type="number" id="amount" ng-disabled="loading"
|
||||||
|
name="amount" placeholder="Amount" ng-model="amount"
|
||||||
|
min="0.0001" max="10000000" enough-amount required>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-3 columns">
|
<div class="small-3 columns">
|
||||||
<span class="postfix">BTC</span>
|
<span class="postfix">BTC</span>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.transactions').controller('TransactionsController',
|
angular.module('copay.transactions').controller('TransactionsController',
|
||||||
function($scope, $rootScope, controllerUtils) {
|
function($scope, $rootScope, $timeout, controllerUtils) {
|
||||||
|
|
||||||
$scope.title = 'Transactions';
|
$scope.title = 'Transactions';
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
|
@ -31,21 +31,21 @@ angular.module('copay.transactions').controller('TransactionsController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.toogleLast = function () {
|
$scope.toogleLast = function () {
|
||||||
console.log('[toogleLast]');
|
$scope.loading = true;
|
||||||
$scope.loading=true;
|
|
||||||
$scope.lastShowed = !$scope.lastShowed;
|
$scope.lastShowed = !$scope.lastShowed;
|
||||||
if ($scope.lastShowed) {
|
if ($scope.lastShowed) {
|
||||||
$scope.getTransactions(function(txs){
|
$scope.getTransactions(function(txs){
|
||||||
$scope.loading=false;
|
$timeout(function() {
|
||||||
$scope.blockchain_txs = txs;
|
$scope.loading = false;
|
||||||
$rootScope.$digest();
|
$scope.blockchain_txs = txs;
|
||||||
|
$scope.$digest();
|
||||||
|
}, 10);
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
$timeout(function(){
|
||||||
setTimeout(function(){
|
$scope.loading = false;
|
||||||
$scope.loading=false;
|
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
});
|
}, 10);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,7 +90,6 @@ angular.module('copay.transactions').controller('TransactionsController',
|
||||||
$scope.getTransactions = function(cb) {
|
$scope.getTransactions = function(cb) {
|
||||||
var w =$rootScope.wallet;
|
var w =$rootScope.wallet;
|
||||||
if (w) {
|
if (w) {
|
||||||
|
|
||||||
console.log('### Querying last transactions...'); //TODO
|
console.log('### Querying last transactions...'); //TODO
|
||||||
var addresses = w.getAddressesStr();
|
var addresses = w.getAddressesStr();
|
||||||
if (addresses.length > 0) {
|
if (addresses.length > 0) {
|
||||||
|
|
|
@ -105,7 +105,8 @@ angular.module('copay.directives')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).directive('avatar', function($rootScope, controllerUtils) {
|
})
|
||||||
|
.directive('avatar', function($rootScope, controllerUtils) {
|
||||||
return {
|
return {
|
||||||
link: function(scope, element, attrs) {
|
link: function(scope, element, attrs) {
|
||||||
var peer = JSON.parse(attrs.peer)
|
var peer = JSON.parse(attrs.peer)
|
||||||
|
@ -118,4 +119,75 @@ angular.module('copay.directives')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.directive('checkStrength', function() {
|
||||||
|
return {
|
||||||
|
replace: false,
|
||||||
|
restrict: 'EACM',
|
||||||
|
scope: { model: '=checkStrength' },
|
||||||
|
link: function(scope, element, attrs) {
|
||||||
|
var _grep = function(elems, callback, invert) {
|
||||||
|
var callbackInverse,
|
||||||
|
matches = [],
|
||||||
|
i = 0,
|
||||||
|
length = elems.length,
|
||||||
|
callbackExpect = !invert;
|
||||||
|
|
||||||
|
// Go through the array, only saving the items
|
||||||
|
// that pass the validator function
|
||||||
|
for (; i < length; i++) {
|
||||||
|
callbackInverse = !callback(elems[i], i);
|
||||||
|
if (callbackInverse !== callbackExpect) {
|
||||||
|
matches.push(elems[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return matches;
|
||||||
|
};
|
||||||
|
|
||||||
|
var strength = {
|
||||||
|
colors: ['#c0392b', '#e74c3c', '#d35400', '#f39c12', '#27ae60'],
|
||||||
|
mesureStrength: function (p) {
|
||||||
|
var _force = 0;
|
||||||
|
var _regex = /[$-/:-?{-~!"^_`\[\]]/g;
|
||||||
|
var _lowerLetters = /[a-z]+/.test(p);
|
||||||
|
var _upperLetters = /[A-Z]+/.test(p);
|
||||||
|
var _numbers = /[0-9]+/.test(p);
|
||||||
|
var _symbols = _regex.test(p);
|
||||||
|
var _flags = [_lowerLetters, _upperLetters, _numbers, _symbols];
|
||||||
|
var _passedMatches = _grep(_flags, function (el) { return el === true; }).length;
|
||||||
|
|
||||||
|
_force += 2 * p.length + ((p.length >= 10) ? 1 : 0);
|
||||||
|
_force += _passedMatches * 10;
|
||||||
|
|
||||||
|
// penality (short password)
|
||||||
|
_force = (p.length <= 6) ? Math.min(_force, 10) : _force;
|
||||||
|
|
||||||
|
// penality (poor variety of characters)
|
||||||
|
_force = (_passedMatches == 1) ? Math.min(_force, 10) : _force;
|
||||||
|
_force = (_passedMatches == 2) ? Math.min(_force, 20) : _force;
|
||||||
|
_force = (_passedMatches == 3) ? Math.min(_force, 40) : _force;
|
||||||
|
return _force;
|
||||||
|
},
|
||||||
|
getColor: function (s) {
|
||||||
|
var idx = 0;
|
||||||
|
|
||||||
|
if (s <= 10) { idx = 0; }
|
||||||
|
else if (s <= 20) { idx = 1; }
|
||||||
|
else if (s <= 30) { idx = 2; }
|
||||||
|
else if (s <= 40) { idx = 3; }
|
||||||
|
else { idx = 4; }
|
||||||
|
|
||||||
|
return { idx: idx + 1, col: this.colors[idx] };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
scope.$watch('model', function (newValue, oldValue) {
|
||||||
|
if (newValue && newValue !== '') {
|
||||||
|
var c = strength.getColor(strength.mesureStrength(newValue));
|
||||||
|
element.css({ 'border-color': c.col })
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,15 +14,22 @@ angular.module('copay.filters', [])
|
||||||
return dic;
|
return dic;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dic = inputs.reduce(reduce, {});
|
var dic;
|
||||||
return Object.keys(dic).map(function(key) {
|
if (inputs) {
|
||||||
return { addr: key, value: dic[key] };
|
dic = inputs.reduce(reduce, {});
|
||||||
});
|
return Object.keys(dic).map(function(key) {
|
||||||
|
return { addr: key, value: dic[key] };
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter('paged', function() {
|
.filter('paged', function() {
|
||||||
return function(elements) {
|
return function(elements) {
|
||||||
return elements.filter(Boolean);
|
if (elements) {
|
||||||
|
return elements.filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter('limitAddress', function() {
|
.filter('limitAddress', function() {
|
||||||
|
|
|
@ -77,19 +77,18 @@ console.log('[Wallet.js.58] connecting'); //TODO
|
||||||
Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
|
Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
|
||||||
this.log('RECV PUBLICKEYRING:', data);
|
this.log('RECV PUBLICKEYRING:', data);
|
||||||
|
|
||||||
var recipients, pkr = this.publicKeyRing;
|
|
||||||
var inPKR = copay.PublicKeyRing.fromObj(data.publicKeyRing);
|
var inPKR = copay.PublicKeyRing.fromObj(data.publicKeyRing);
|
||||||
|
var wasIncomplete = !this.publicKeyRing.isComplete();
|
||||||
|
var hasChanged = this.publicKeyRing.merge(inPKR, true);
|
||||||
|
|
||||||
var hasChanged = pkr.merge(inPKR, true);
|
|
||||||
if (hasChanged) {
|
if (hasChanged) {
|
||||||
this.connectToAll();
|
if (wasIncomplete) {
|
||||||
|
this.sendPublicKeyRing();
|
||||||
|
this.connectToAll();
|
||||||
|
}
|
||||||
if (this.publicKeyRing.isComplete()) {
|
if (this.publicKeyRing.isComplete()) {
|
||||||
this._lockIncomming();
|
this._lockIncomming();
|
||||||
}
|
}
|
||||||
this.log('### BROADCASTING PKR');
|
|
||||||
|
|
||||||
recipients = null;
|
|
||||||
this.sendPublicKeyRing(recipients);
|
|
||||||
}
|
}
|
||||||
this.emit('publicKeyRingUpdated');
|
this.emit('publicKeyRingUpdated');
|
||||||
this.store();
|
this.store();
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
#! /usr/bin/node
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var sys = require('sys')
|
||||||
|
var exec = require('child_process').exec;
|
||||||
|
function puts(error, stdout, stderr) { sys.puts(stdout) }
|
||||||
|
|
||||||
|
function isNumber(n) {
|
||||||
|
return !isNaN(parseInt(n)) && isFinite(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
var args = process.argv.slice(2);
|
||||||
|
var n_str = args[0];
|
||||||
|
if (!isNumber(n_str)) {
|
||||||
|
console.log('Program requires one numeric argument for the amount of copayers');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var N = parseInt(n_str);
|
||||||
|
var DEFAULT_PORT = process.env.DEFAULT_PORT || 3000;
|
||||||
|
|
||||||
|
|
||||||
|
for (var i=0; i<N; i++) {
|
||||||
|
var port =(i+DEFAULT_PORT);
|
||||||
|
console.log('Simulating copayer #'+(i+1)+' at http://localhost:'+port);
|
||||||
|
var command = 'PORT='+port+' node app.js &'
|
||||||
|
exec(command, puts);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue