diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json index f134785f09bcdb490264ab1b4635c21f18cbf0fd..abffba9492289d1565dd2ed040ff034836c365ca 100644 --- a/www/i18n/locale-en-GB.json +++ b/www/i18n/locale-en-GB.json @@ -285,6 +285,7 @@ "TITLE": "Peer", "OWNER": "Owned by ", "SHOW_RAW_PEERING": "See peering document", + "SHOW_RAW_CURRENT_BLOCK": "See current block (raw format)", "LAST_BLOCKS": "Last blocks", "KNOWN_PEERS": "Known peers :", "GENERAL_DIVIDER": "General information", @@ -705,8 +706,8 @@ "SECTION": "Log in", "PUBKEY": "Account public key", "PUBKEY_DEF": "The public key of the keychain is generated from the entered identifiers (any), but does not correspond to an account already used.<br/><b>Make sure your public key is the same as your account</b>. Otherwise, you will be logged into an account that is probably never used, as the risk of collision with an existing account is very small.<br/><a href=\"https://en.wikipedia.org/wiki/Elliptic_curve_cryptography\" target=\"_ system\">Learn more about cryptography</a> by public key.", - "METHOD": "Méthodes de connexion", - "METHOD_DEF": "Plusieurs options sont disponibles pour vous connecter à un portfeuille :<br/> - La connexion <b>par sallage (simple ou avancé)</b> mélange votre mot de passe grâce à l'identifiant secret, pour limiter les tentatives de piratge par force brute (par exemple à partir de mots connus).<br/> - La connexion <b>par clé publique</b> évite de saisir vos identifiants, qui vous seront demandé seulement le moment venu lors d'une opération sur le compte.<br/> - La connexion <b>par fichier de trousseau</b> va lire les clés (publique et privée) du compte, depuis un fichier, sans besoin de saisir d'identifiants. Plusieurs formats de fichier sont possibles." + "METHOD": "Connection methods", + "METHOD_DEF": "Several options are available to connect to a portfolios: <br/> - The connection <b>with salt (simple or advanced)</b> mixes your password with the secret identifier, to limit the attempts of piracy<br/> - The connection <b>using public key</b> prevents you from entering your credentials, which you will be asked only when an operation need it.<br/> - The connection <b>using keychain file</b> will read the public and private keys of the account from a file without the need to enter credentials. Several file formats are possible." }, "GLOSSARY": { "SECTION": "Glossary", diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index ddc7b0911bea884f17aecd186cbfa80f779eac59..215c7eeb1e7f3e7bc5493063b30661448c1f3af3 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -285,6 +285,7 @@ "TITLE": "Peer", "OWNER": "Owned by ", "SHOW_RAW_PEERING": "See peering document", + "SHOW_RAW_CURRENT_BLOCK": "See current block (raw format)", "LAST_BLOCKS": "Last blocks", "KNOWN_PEERS": "Known peers :", "GENERAL_DIVIDER": "General information", diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 3395f109642ede545d9224ecb426bfbb39a86e49..ebc4acbd5ae69abceeff6e2af0e7868aef413478 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -285,7 +285,8 @@ "TITLE": "Nœud", "OWNER": "Appartient à ", "SHOW_RAW_PEERING": "Voir la fiche de pair", - "LAST_BLOCKS": "Derniers blocs", + "SHOW_RAW_CURRENT_BLOCK": "Voir le dernier bloc (format brut)", + "LAST_BLOCKS": "Derniers blocs connus", "KNOWN_PEERS": "Nœuds connus :", "GENERAL_DIVIDER": "Informations générales", "ERROR": { diff --git a/www/js/controllers/network-controllers.js b/www/js/controllers/network-controllers.js index 9d68c5cff9f1c4521291edd1c0a536af6a729a43..e76ad67abb486ac392e04ec35c8e700915f57b78 100644 --- a/www/js/controllers/network-controllers.js +++ b/www/js/controllers/network-controllers.js @@ -419,11 +419,13 @@ function PeerInfoPopoverController($scope, csSettings, csCurrency, BMA) { $scope.enter(); } -function PeerViewController($scope, $q, UIUtils, csWot, BMA) { +function PeerViewController($scope, $q, $window, $state, UIUtils, csWot, BMA) { 'ngInject'; $scope.node = {}; $scope.loading = true; + $scope.isHttps = ($window.location.protocol === 'https:'); + $scope.isReachable = true; $scope.$on('$ionicView.enter', function(e, state) { var isDefaultNode = !state.stateParams || !state.stateParams.server; @@ -460,6 +462,25 @@ function PeerViewController($scope, $q, UIUtils, csWot, BMA) { BMA.lightInstance(node.host, node.port, node.useSsl), node); + $scope.isReachable = !$scope.isHttps || useSsl; + if (!$scope.isReachable) { + // Get node peer info + return BMA.network.peers() + .then(function(res) { + // find the current peer + var peer = _.find(res && res.peers || [], function(json) { + var peer = new Peer(json); + return (peer.getServer() == node.server); + }); + + if (peer) { + $scope.node.pubkey = peer.pubkey; + $scope.node.currency = peer.currency; + return csWot.extend($scope.node); + } + }); + } + return $q.all([ // Get node peer info @@ -477,6 +498,8 @@ function PeerViewController($scope, $q, UIUtils, csWot, BMA) { peer.online = p.status == 'UP'; peer.blockNumber = peer.block.replace(/-.+$/, ''); peer.dns = peer.getDns(); + peer.id = peer.keyID(); + peer.server = peer.getServer(); return peer; }); @@ -503,4 +526,18 @@ function PeerViewController($scope, $q, UIUtils, csWot, BMA) { ]) .catch(UIUtils.onError(useTor ? "PEER.VIEW.ERROR.LOADING_TOR_NODE_ERROR" : "PEER.VIEW.ERROR.LOADING_NODE_ERROR")); }; + + $scope.selectPeer = function(peer) { + // Skipp offline or WS2P node + if (!peer.online || peer.isWs2p()) return; + + var stateParams = {server: peer.getServer()}; + if (peer.isSsl()) { + stateParams.ssl = true; + } + if (peer.isTor()) { + stateParams.tor = true; + } + $state.go('app.view_peer', stateParams); + }; } diff --git a/www/templates/network/view_peer.html b/www/templates/network/view_peer.html index bb75dabf23b54eca4367243e49a3797a77a40ebf..2b25732c5ee28586ea75acb283d598b610f34645 100644 --- a/www/templates/network/view_peer.html +++ b/www/templates/network/view_peer.html @@ -21,12 +21,14 @@ <h2 class="gray"> <i class="gray icon ion-android-globe"></i> {{node.bma.dns || node.server}} - <span class="gray" ng-if="node.useSsl"> + <span class="gray" ng-if="!loading && node.useSsl"> <i class="gray ion-locked"></i> <small>SSL</small> </span> - <span class="gray" ng-if="node.useTor"> + <span class="gray" ng-if="!loading && node.useTor"> <i class="gray ion-bma-tor-api"></i> </span> + + <span class="assertive" ng-if="!loading && !node.uid">({{'PEER.MIRROR'|translate}})</span> </h2> <!-- node owner --> @@ -43,14 +45,30 @@ ({{node.uid}}) </span> </a> + <span ng-if="!loading && !node.uid"> + <a class="gray" + ui-sref="app.wot_identity({pubkey: node.pubkey})"> + <i class="ion-key"></i> + {{node.pubkey|formatPubkey}} + <span class="gray" ng-if="node.name"> + ({{node.name}}) + </span> + </a> + </span> </h3> <h3> - <a target="_blank" ng-href="{{(node.useSsl ? 'https://' : 'http://') + node.server}}/network/peering"> <i class="icon ion-share"></i> {{'PEER.VIEW.SHOW_RAW_PEERING'|translate}} </a> + + <span class="gray" ng-if="!isReachable"> | </span> + <a ng-if="!isReachable" + target="_blank" + ng-href="{{(node.useSsl ? 'https://' : 'http://') + node.server}}/blockchain/current"> + <i class="icon ion-share"></i> <span translate>PEER.VIEW.SHOW_RAW_CURRENT_BLOCK</span> + </a> </h3> </ion-item> @@ -67,6 +85,7 @@ </ion-item> <a class="item item-icon-left item-icon-right item-text-wrap ink" + ng-if="isReachable" ui-sref="app.view_server_block_hash({server: node.server, ssl: node.useSsl, tor: node.useTor, number: current.number, hash: current.hash})"> <i class="icon ion-cube"></i> <span translate>BLOCKCHAIN.VIEW.TITLE_CURRENT</span> @@ -77,6 +96,7 @@ </a> <a class="item item-icon-left item-icon-right item-text-wrap ink" + ng-if="isReachable" ui-sref="app.server_blockchain({server: node.server, ssl: node.useSsl, tor: node.useTor})"> <i class="icon ion-cube" style="font-size: 25px;"></i> <i class="icon-secondary ion-clock" style="font-size: 18px; left: 33px; top: -12px;"></i> @@ -87,25 +107,28 @@ <!-- Allow extension here --> <cs-extension-point name="general"></cs-extension-point> - <div class="item item-divider" translate> + <div class="item item-divider" ng-hide="loading || !isReachable" translate> PEER.VIEW.KNOWN_PEERS </div> + <ion-item class="item item-text-wrap no-border done in gray no-padding-top no-padding-bottom inline text-italic" + ng-show="!loading && !isReachable"> + <small><i class="icon ion-alert-circled"></i> {{'NETWORK.INFO.ONLY_SSL_PEERS'|translate}}</small> + </ion-item> + <div class="item center" ng-if="loading"> <ion-spinner class="icon" icon="android"></ion-spinner> </div> - <div class="list no-padding {{::motion.ionListClass}}"> - <a class="item-peer item item-icon-left " - ng-repeat="peer in peers" - ng-class="{ assertive: !peer.online, balanced: peer.online}" - ui-sref="app.view_peer({server: peer.getServer(), ssl: peer.isSsl()})"> - <i class="icon ion-android-desktop"></i> - <b class="ion-android-person" ng-if="peer.uid" style="position: absolute; top: 13px; left: 27px;"></b> - <h3><span ng-class="{ positive: peer.uid }">{{peer.uid || peer.pubkey.substr(0,8)}}</span> <span class="gray">{{peer.dns && ' | ' + peer.dns}}</span></h3> - <h4>{{peer.getServer()}} <span class="gray">| {{'PEER.SIGNED_ON_BLOCK' | translate}}</span> #{{peer.blockNumber}}</h4> - <span class="badge" ng-class="{ 'badge-balanced': peer.hasMainConsensusBlock, 'badge-energized': peer.hasConsensusBlock }">{{peer.current.number}}</span> - </a> + <div class="list no-padding {{::motion.ionListClass}}" ng-if="isReachable"> + + <div ng-repeat="peer in :rebind:peers track by peer.id" + class="item item-peer item-icon-left ink" + ng-class="::ionItemClass" + ng-click="selectPeer(peer)" + ng-include="'templates/network/item_content_peer.html'"> + </div> + </div> </div>