diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json index aba1233e6203bfe63edd3f43d98dae4ad85d9aef..b93edcbfd98ddd898a4eddce43b98713168a5314 100644 --- a/www/i18n/locale-en-GB.json +++ b/www/i18n/locale-en-GB.json @@ -142,9 +142,10 @@ "EXPERT_MODE_HELP": "Allow to see more details", "POPUP_PEER": { "TITLE" : "Duniter peer", - "HELP" : "Peer address:", - "PEER_HELP": "server.domain.com:port", - "BTN_SHOW_LIST_HELP" : "Enter above in the format <b>{{'SETTINGS.POPUP_PEER.PEER_HELP'|translate}}</b> or click on the button below:", + "HOST" : "Address", + "HOST_HELP": "Address: server:port", + "USE_SSL" : "Secured?", + "USE_SSL_HELP" : "(SSL Encryption)", "BTN_SHOW_LIST" : "Peer's list" } }, diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index bfc40a70254c84838ca93316a8d7ddbd7b35bd57..6b0fc4b81368b2eaca679af3a0e17dfe070eb775 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -142,9 +142,10 @@ "EXPERT_MODE_HELP": "Allow to see more details", "POPUP_PEER": { "TITLE" : "Duniter peer", - "HELP" : "Peer address:", - "PEER_HELP": "server.domain.com:port", - "BTN_SHOW_LIST_HELP" : "Enter above in the format <b>{{'SETTINGS.POPUP_PEER.PEER_HELP'|translate}}</b> or click on the button below:", + "HOST" : "Address", + "HOST_HELP": "Address: server:port", + "USE_SSL" : "Secured?", + "USE_SSL_HELP" : "(SSL Encryption)", "BTN_SHOW_LIST" : "Peer's list" } }, diff --git a/www/i18n/locale-es-ES.json b/www/i18n/locale-es-ES.json index d2fa60c14740d37aaf98607fecd0b67c641081f3..44384d0f2749be6d56f2b31f5be7548696faeb53 100644 --- a/www/i18n/locale-es-ES.json +++ b/www/i18n/locale-es-ES.json @@ -142,10 +142,11 @@ "EXPERT_MODE_HELP": "Permite una visualización más detallada", "POPUP_PEER": { "TITLE" : "Nodo Duniter", - "HELP" : "Dirección del nodo :", - "PEER_HELP": "servidor.dominio.com:puerto", - "BTN_SHOW_LIST_HELP" : "Ingresa más arriba al formato <b>{{'SETTINGS.POPUP_PEER.PEER_HELP'|translate}}</b> o hace un clic sobre el botón más abajo :", - "BTN_SHOW_LIST" : "Lista de los nodos" + "HOST" : "Dirección", + "HOST_HELP": "Dirección : servidor:puerto", + "USE_SSL" : "Segura ?", + "USE_SSL_HELP" : "(Cifrado SSL)", + "BTN_SHOW_LIST" : "Lista de nodos" } }, "BLOCKCHAIN": { diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index f27587955bfa75777fdd3f19ba37ec54c0e57830..4355774aafe63e5ba34913ba373844f257e6c5bc 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -142,9 +142,10 @@ "EXPERT_MODE_HELP": "Permet un affichage plus détaillé", "POPUP_PEER": { "TITLE" : "NÅ“ud Duniter", - "HELP" : "Adresse du nÅ“ud :", - "PEER_HELP": "serveur.domaine.com:port", - "BTN_SHOW_LIST_HELP" : "Saisissez ci-dessus au format <b>{{'SETTINGS.POPUP_PEER.PEER_HELP'|translate}}</b> ou bien cliquez sur le bouton ci-dessous :", + "HOST" : "Adresse", + "HOST_HELP": "Adresse : serveur:port", + "USE_SSL" : "Sécurisé ?", + "USE_SSL_HELP" : "(Chiffrement SSL)", "BTN_SHOW_LIST" : "Liste des noeuds" } }, diff --git a/www/i18n/locale-nl-NL.json b/www/i18n/locale-nl-NL.json index e6a8a45be06ef7573bc941584af9f839bfe2fd7c..4e0071c30c3d5dda23cdb1c4e08c1d69190b88f6 100644 --- a/www/i18n/locale-nl-NL.json +++ b/www/i18n/locale-nl-NL.json @@ -31,6 +31,7 @@ "BTN_ADD": "Toevoegen", "BTN_SEARCH": "Zoeken", "BTN_REFRESH": "Verwezenlijken", + "BTN_START": "Beginnen", "BTN_CONTINUE": "Doorgaan", "BTN_UNDERSTOOD": "Ik heb het begrepen", "BTN_OPTIONS": "Opties", @@ -107,11 +108,12 @@ "MESSAGE_SHORT": "Bekijk je <a href=\"http://duniter.org\" target=\"_blank\">Duniter</a> portefeilles<br/>in real time!", "BTN_REGISTRY": "Register", "BTN_MARKET": "Marktplaats", - "BTN_CURRENCIES": "Verken valuta's", "BTN_CURRENCY": "Verken valuta", "BTN_ABOUT": "over", "BTN_HELP": "Help", - "REPORT_ISSUE": "Meld een probleem" + "REPORT_ISSUE": "Meld een probleem", + "NOT_YOUR_ACCOUNT_QUESTION" : "Je hoeft niet de rekening <b><i class=\"ion-key\"></i> {{pubkey|formatPubkey}}</b> in uw bezit?", + "BTN_CHANGE_ACCOUNT": "Dit account ontkoppelen" }, "SETTINGS": { "TITLE": "Instellingen", @@ -130,9 +132,10 @@ "EXPERT_MODE_HELP": "Toon meer details", "POPUP_PEER": { "TITLE" : "Duniter Knooppunt", - "HELP" : "Stel het adres van het knooppunt in:", - "PEER_HELP": "server.domein.com:poort", - "BTN_SHOW_LIST_HELP" : "Voer bovenstaande bij <b>{{'SETTINGS.POPUP_PEER.PEER_HELP'|translate}}</b> indeling of klik op de knop hieronder:", + "HOST" : "Adres", + "HOST_HELP": "Aadres: server:poort", + "USE_SSL" : "Secure?", + "USE_SSL_HELP" : "(SSL-encryptie)", "BTN_SHOW_LIST" : "Lijst van knooppunten" } }, @@ -425,7 +428,6 @@ "SEND_MEMBERSHIP_OUT_FAILED": "Error while sending membership revocation.", "REFRESH_WALLET_DATA": "Could not refresh wallet.", "GET_CURRENCY_PARAMETER": "Could not get currency parameters.", - "GET_CURRENCIES_FAILED": "Unable to load currencies. Please retry later.", "GET_CURRENCY_FAILED": "Could not load currency.", "SEND_TX_FAILED": "Could not send transaction.", "ALL_SOURCES_USED": "Please wait the next block computation (All transaction sources has been used).", @@ -524,10 +526,10 @@ "CURRENCY_CHANGE_UNIT": "This button allows to <b>switch the unit</b> to show amounts in <b>{{currency|capitalize}}</b>, undevided by the Universal Dividend (instead of in “<b>{{'COMMON.UD'|translate}}<sub>{{currency|abbreviate}}</sub></b>”).", "CURRENCY_CHANGE_UNIT_TO_RELATIVE": "This button allows to <b>switch the unit</b> to show amounts in “<b>{{'COMMON.UD'|translate}}<sub>{{currency|abbreviate}}</sub></b>”, which is relative to the Universal Dividend (the amount co-produced by each member).", "CURRENCY_RULES": "The <b>rules</b> of the currency determine its <b>exact and predictible</b> performance.<br/><br/>As a true DNA of the currency these rules make the monetary code <b>transparent and understandable</b>.", - "CURRENCY_BLOCKCHAIN": "All monetary transactions are recoded in a <b>public and tamper proof</b> ledger, generally referred to as the <b>blockchain</b>.", - "CURRENCY_PEERS": "The <b>peers</b> shown here correspond to <b>computers that update and check</b> the blockchain.<br/><br/>The more active peers there are, the more <b>decentralised</b> and therefore trustworhty the currency becomes.", - "CURRENCY_PEERS_BLOCK_NUMBER": "This <b>number</b> indicates the peer's <b>latest validated block</b> (last page written in the ledger).<br/><br/>Green indicates that the block was equally validated by the <b>majority of other peers</b>.", - "CURRENCY_PEERS_PARTICIPATE": "<b>Each member</b>, equiped with a computer with Internet, <b>can participate, adding a peer</b> simply by <b>installing the Duniter software</b> (free/libre and open source). <a target=\"_new\" href=\"{{installDocUrl}}\">Read the installation manual >></a>.", + "NETWORK_BLOCKCHAIN": "All monetary transactions are recoded in a <b>public and tamper proof</b> ledger, generally referred to as the <b>blockchain</b>.", + "NETWORK_PEERS": "The <b>peers</b> shown here correspond to <b>computers that update and check</b> the blockchain.<br/><br/>The more active peers there are, the more <b>decentralised</b> and therefore trustworhty the currency becomes.", + "NETWORK_PEERS_BLOCK_NUMBER": "This <b>number</b> indicates the peer's <b>latest validated block</b> (last page written in the ledger).<br/><br/>Green indicates that the block was equally validated by the <b>majority of other peers</b>.", + "NETWORK_PEERS_PARTICIPATE": "<b>Each member</b>, equiped with a computer with Internet, <b>can participate, adding a peer</b> simply by <b>installing the Duniter software</b> (free/libre and open source). <a target=\"_new\" href=\"{{installDocUrl}}\">Read the installation manual >></a>.", "MENU_BTN_ACCOUNT": "<b>{{'ACCOUNT.TITLE'|translate}}</b> allows access to your account balance and transaction history.", "MENU_BTN_ACCOUNT_MEMBER": "Here you can consult your account status, transaction history and your certifications.", "WALLET_CERTIFICATIONS": "Click here to reveiw the details of your certifications (given and received).", diff --git a/www/js/controllers/settings-controllers.js b/www/js/controllers/settings-controllers.js index c62153bb876066ed70d7cc86540b6a6fd1efbe86..68b2ce3df95dde106bdd10c77083d7898f4f05b7 100644 --- a/www/js/controllers/settings-controllers.js +++ b/www/js/controllers/settings-controllers.js @@ -102,13 +102,15 @@ function SettingsController($scope, $q, $ionicHistory, $ionicPopup, $timeout, $t $scope.changeNode= function(node) { $scope.showNodePopup(node || $scope.formData.node) .then(function(newNode) { + console.log(newNode); if (newNode.host === $scope.formData.node.host && - newNode.port === $scope.formData.node.port) { + newNode.port === $scope.formData.node.port && + newNode.useSsl === $scope.formData.node.useSsl) { return; // same node = nothing to do } UIUtils.loading.show(); - var nodeBMA = BMA.instance(newNode.host, newNode.port, undefined/*auto detect*/, true /*cache*/); + var nodeBMA = BMA.instance(newNode.host, newNode.port, newNode.useSsl, true /*cache*/); nodeBMA.isAlive() .then(function(alive) { if (!alive) { @@ -139,7 +141,8 @@ function SettingsController($scope, $q, $ionicHistory, $ionicPopup, $timeout, $t return { host: (bma.dns ? bma.dns : (peer.hasValid4(bma) ? bma.ipv4 : bma.ipv6)), - port: bma.port || 80 + port: bma.port || 80, + useSsl: bma.useSsl }; } }) @@ -152,6 +155,7 @@ function SettingsController($scope, $q, $ionicHistory, $ionicPopup, $timeout, $t $scope.showNodePopup = function(node) { return $q(function(resolve, reject) { $scope.popupData.newNode = node.port ? [node.host, node.port].join(':') : node.host; + $scope.popupData.useSsl = node.useSsl; if (!!$scope.popupForm) { $scope.popupForm.$setPristine(); } @@ -173,22 +177,26 @@ function SettingsController($scope, $q, $ionicHistory, $ionicPopup, $timeout, $t //don't allow the user to close unless he enters a node e.preventDefault(); } else { - return $scope.popupData.newNode; + return { + server: $scope.popupData.newNode, + useSsl: $scope.popupData.useSsl + }; } } } ] }) - .then(function(node) { - if (!node) { // user cancel + .then(function(res) { + if (!res) { // user cancel UIUtils.loading.hide(); return; } - var parts = node.split(':'); + var parts = res.server.split(':'); parts[1] = parts[1] ? parts[1] : 80; resolve({ host: parts[0], - port: parts[1] + port: parts[1], + useSsl: res.useSsl }); }); }); diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js index 032124c57756ea2211c02c5366de6096689d01d6..89ab42bc512a8f169b99f339f5a65f2c99b168b8 100644 --- a/www/js/services/bma-services.js +++ b/www/js/services/bma-services.js @@ -235,7 +235,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. }; that.ready = function() { - if (that.started) return $q.when(); + if (that.started) return $q.when(true); return that._startPromise || that.start(); }; @@ -294,14 +294,15 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. that.stop = function() { console.debug('[BMA] Stopping...'); removeListeners(); + csHttp.cache.clear(); that.cleanCache(); that.alive = false; that.started = false; + delete that._startPromise; that.api.node.raise.stop(); }; that.restart = function() { - csHttp.cache.clear(); that.stop(); return $timeout(that.start, 200) .then(function(alive) { @@ -530,8 +531,9 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. }; exports.copy = function(otherNode) { - init(otherNode.host, otherNode.port, otherNode.useSsl, that.useCache/*keep original value*/); - return that.restart(); + if (that.started) that.stop(); + that.init(otherNode.host, otherNode.port, otherNode.useSsl, that.useCache/*keep original value*/); + return that.start(); }; exports.wot.member.uids = function() { @@ -783,6 +785,9 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. }; service.lightInstance = function(host, port, useSsl, timeout) { + if (host && host =='g1.duniter.tednet.fr') { + console.log('TORTUE Node [{0}:{1}] useSsl [{2}]'.format(host, port, useSsl ? 'true': 'false')); + } port = port || 80; useSsl = angular.isDefined(useSsl) ? useSsl : (port == 443); return { diff --git a/www/js/services/http-services.js b/www/js/services/http-services.js index b0c720505ecbdaeafe0588417f13d1345d307ae8..f86f4a33b6f9c783b6606125ac2074474094ca2e 100644 --- a/www/js/services/http-services.js +++ b/www/js/services/http-services.js @@ -121,13 +121,13 @@ angular.module('cesium.http.services', ['cesium.cache.services']) }; } - function postResource(host, port, path) { - var url = getUrl(host, port, path); + function postResource(host, port, path, useSsl, forcedTimeout) { + var url = getUrl(host, port, path, useSsl); return function(data, params) { return $q(function(resolve, reject) { var config = { - timeout: timeout, - headers : {'Content-Type' : 'application/json'} // TODO: test using "application/json;charset=UTF-8" + timeout: forcedTimeout || timeout, + headers : {'Content-Type' : 'application/json;charset=UTF-8'} // TODO: test using "application/json" }; prepare(url, params, config, function(url, config) { diff --git a/www/js/services/network-services.js b/www/js/services/network-services.js index 843db537abd2e4b9b7e75b9ba3a33982bc1c7d20..70c67dcb7bbfb4b89db9182252225a6ad021d4f5 100644 --- a/www/js/services/network-services.js +++ b/www/js/services/network-services.js @@ -335,7 +335,7 @@ angular.module('cesium.network.services', ['ngApi', 'cesium.bma.services', 'cesi return $q.when(peer); } - peer.api = peer.api || BMA.lightInstance(peer.getHost(), peer.getPort()); + peer.api = peer.api || BMA.lightInstance(peer.getHost(), peer.getPort(), peer.isSsl()); // Get current block return peer.api.blockchain.current() @@ -362,7 +362,7 @@ angular.module('cesium.network.services', ['ngApi', 'cesium.bma.services', 'cesi if (bma.dns && peer.server.indexOf(bma.dns) == -1) { // try again, using DNS instead of IPv4 / IPV6 peer.secondTry = true; - peer.api = BMA.lightInstance(bma.dns, bma.port); + peer.api = BMA.lightInstance(bma.dns, bma.port, bma.useSsl); return refreshPeer(peer); // recursive call } } diff --git a/www/js/services/utils-services.js b/www/js/services/utils-services.js index 56509fbfd842bcb4e8ddeea61aeed4e583e5908a..f1e61bd96eae0df512dd4ab29c6f4e5675265b9c 100644 --- a/www/js/services/utils-services.js +++ b/www/js/services/utils-services.js @@ -212,7 +212,6 @@ angular.module('cesium.utils.services', []) // Otherwise, log to console and display error else { - console.error(err); hideLoading(10); // timeout, to avoid bug on transfer (when error on reference) return alertError(fullMsg, subtitle); } diff --git a/www/templates/settings/popup_node.html b/www/templates/settings/popup_node.html index 77756efaae19ef1ff2d745416b72cda93e7e62a0..bfa8bec3ededa8f98e2b660e7109771255447535 100644 --- a/www/templates/settings/popup_node.html +++ b/www/templates/settings/popup_node.html @@ -1,15 +1,14 @@ <form name="popupForm" ng-submit=""> - <span ng-bind-html="'SETTINGS.POPUP_PEER.HELP'|translate"></span> - - <div class="list" ng-init="setPopupForm(popupForm)"> - <label class="item item-input" + <div class="list no-padding" ng-init="setPopupForm(popupForm)"> + <div class="item item-input item-floating-label" ng-class="{'item-input-error': popupForm.$submitted && popupForm.newNode.$invalid}"> - <input name="newNode" type="text" placeholder="{{'SETTINGS.POPUP_PEER.PEER_HELP' | translate}}" + <span class="input-label" ng-bind-html="'SETTINGS.POPUP_PEER.HOST'|translate"></span> + <input name="newNode" type="text" placeholder="{{'SETTINGS.POPUP_PEER.HOST_HELP' | translate}}" ng-model="popupData.newNode" ng-minlength="3" required> - </label> + </div> <div class="form-errors" ng-if="popupForm.$submitted && popupForm.newNode.$error" ng-messages="popupForm.newNode.$error"> @@ -20,15 +19,33 @@ <span translate="ERROR.FIELD_TOO_SHORT"></span> </div> </div> + + + <div class="item item-toggle"> + <span class="input-label"> + {{'SETTINGS.POPUP_PEER.USE_SSL' | translate}} + </span> + <h4> + <small class="gray" ng-bind-html="'SETTINGS.POPUP_PEER.USE_SSL_HELP' | translate"> + </small> + </h4> + <label class="toggle toggle-royal no-padding-right"> + <input type="checkbox" ng-model="popupData.useSsl"> + <div class="track"> + <div class="handle"></div> + </div> + </label> + </div> + + + <a class="button button-positive button-clear positive button-outline button-full button-small-padding icon-left ink no-padding" ng-click="showNodeList()"> + <i class="icon ion-search"></i> + {{'SETTINGS.POPUP_PEER.BTN_SHOW_LIST' | translate}} + </a> </div> <button type="submit" class="hide"></button> </form> -<small ng-bind-html="'SETTINGS.POPUP_PEER.BTN_SHOW_LIST_HELP' | translate"></small> -<button class="button button-positive button-clear positive button-outline button-full button-small-padding icon-left ink" ng-click="showNodeList()"> - <i class="icon ion-wifi "></i> - {{'SETTINGS.POPUP_PEER.BTN_SHOW_LIST' | translate}} -</button>