Merge pull request #380 from colkito/fix/peerjs-settings

Fix/peerjs settings
This commit is contained in:
Gustavo Maximiliano Cortez 2014-05-15 16:45:09 -03:00
commit 3f2245827e
2 changed files with 29 additions and 18 deletions

View File

@ -598,25 +598,29 @@
<label for="network-name">Livenet</label>
</fieldset>
<fieldset>
<legend>Blockchain</legend>
<legend>Insight API server</legend>
<div class="row">
<label for="blockchain-host">Host</label>
<input type="text" ng-model="blockchainHost">
<label for="insight-host">Host</label>
<input type="text" ng-model="insightHost">
</div>
<div class="row">
<label for="blockchain-port">Port</label>
<input type="number" ng-model="blockchainPort">
<label for="insight-port">Port</label>
<input type="number" ng-model="insightPort">
</div>
</fieldset>
<fieldset>
<legend>Socket</legend>
<legend>PeerJS server</legend>
<div class="row">
<label for="socket-host">Host</label>
<input type="text" ng-model="socketHost">
<label for="peerjs-key">Key</label>
<input type="text" ng-model="networkKey">
</div>
<div class="row">
<label for="peerjs-host">Host</label>
<input type="text" ng-model="networkHost">
</div>
<div class="row">
<label for="socket-port">Port</label>
<input type="number" ng-model="socketPort">
<input type="number" ng-model="networkPort">
</div>
</fieldset>
</div>

View File

@ -5,22 +5,29 @@ angular.module('copay.settings').controller('SettingsController',
$scope.title = 'Settings';
$scope.networkName = config.networkName;
$scope.blockchainHost = config.blockchain.host;
$scope.blockchainPort = config.blockchain.port;
$scope.socketHost = config.socket.host;
$scope.socketPort = config.socket.port;
$scope.insightHost = config.blockchain.host;
$scope.insightPort = config.blockchain.port;
$scope.networkKey = config.network.key;
$scope.networkHost = config.network.host;
$scope.networkPort = config.network.port;
$scope.save = function() {
var network = config.network;
network.key = $scope.networkKey;
network.host = $scope.networkHost;
network.port = $scope.networkPort;
localStorage.setItem('config', JSON.stringify({
networkName: $scope.networkName,
blockchain: {
host: $scope.blockchainHost,
port: $scope.blockchainPort
host: $scope.insightHost,
port: $scope.insightPort
},
socket: {
host: $scope.socketHost,
port: $scope.socketPort
}
host: $scope.insightHost,
port: $scope.insightPort
},
network: network
})
);