diff --git a/app/config.json b/app/config.json index 0cf7f13f34025098b775b05e4e1f886e13ffba2c..736cce81f37960ac3308b3a5543ca7fa7f62b784 100644 --- a/app/config.json +++ b/app/config.json @@ -16,7 +16,10 @@ "shareBaseUrl": "https://g1.duniter.fr", "helptip": { "enable": true, - "installDocUrl": "https://github.com/duniter/duniter/blob/master/doc/install-a-node.md" + "installDocUrl": { + "fr-FR": "https://duniter.org/fr/wiki/duniter/installer/", + "en": "https://duniter.org/en/wiki/duniter/install/" + } }, "license": { "fr-FR": "license/license_g1-fr-FR", @@ -73,7 +76,10 @@ "shareBaseUrl": "https://g1.duniter.fr", "helptip": { "enable": true, - "installDocUrl": "https://github.com/duniter/duniter/blob/master/doc/install-a-node.md" + "installDocUrl": { + "fr-FR": "https://duniter.org/fr/wiki/duniter/installer/", + "en": "https://duniter.org/en/wiki/duniter/install/" + } }, "license": { "fr-FR": "license/license_g1-fr-FR", @@ -123,7 +129,10 @@ "shareBaseUrl": "https://g1.duniter.fr", "helptip": { "enable": false, - "installDocUrl": "https://github.com/duniter/duniter/blob/master/doc/install-a-node.md" + "installDocUrl": { + "fr-FR": "https://duniter.org/fr/wiki/duniter/installer/", + "en": "https://github.com/duniter/duniter/blob/master/doc/install-a-node.md" + } }, "node": { "host": "g1-test.duniter.org", @@ -168,8 +177,8 @@ "helptip": { "enable": false, "installDocUrl": { - "fr-FR": "http://www.le-sou.org/devenir-noeud/", - "en": "https://github.com/duniter/duniter/blob/master/doc/install-a-node.md" + "fr-FR": "https://duniter.org/fr/wiki/duniter/installer/", + "en": "https://duniter.org/en/wiki/duniter/install/" } }, "license": { diff --git a/www/js/controllers/app-controllers.js b/www/js/controllers/app-controllers.js index a1ed3a63c6363f271535866c884c4f9d456006a9..6c42b1e1d22636c5c968a2aea3fb83a03fdd5d56 100644 --- a/www/js/controllers/app-controllers.js +++ b/www/js/controllers/app-controllers.js @@ -65,7 +65,7 @@ function PluginExtensionPointController($scope, PluginService) { */ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $timeout, $ionicHistory, $controller, $window, csPlatform, - UIUtils, BMA, csWallet, Device, Modals, csConfig + UIUtils, BMA, csWallet, Device, Modals, csConfig, csHttp ) { 'ngInject'; @@ -397,13 +397,15 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $ // Link managment (fix issue #) //////////////////////////////////////// - $scope.openLink = function(event, link, type) { - // If email, do not try to open, but copy value - if (!Device.enable && type && (type == 'email' || type == 'phone')) { - return UIUtils.popover.copy(event, link); - } + $scope.openLink = function(event, uri, options) { + options = options || {}; + + // If unable to open, just copy value + options.onError = function() { + return UIUtils.popover.copy(event, uri); + }; - return UIUtils.link.open(event, link, type); + return csHttp.uri.open(uri, options); }; //////////////////////////////////////// diff --git a/www/js/controllers/network-controllers.js b/www/js/controllers/network-controllers.js index 780c74b073d11549eaab13d5cb5a89eb6e913267..f213b49fe60bfa65d2cceb847a69e2a885db7c7a 100644 --- a/www/js/controllers/network-controllers.js +++ b/www/js/controllers/network-controllers.js @@ -467,20 +467,33 @@ function PeerViewController($scope, $q, $window, $state, UIUtils, csWot, BMA) { $scope.isReachable = !$scope.isHttps || useSsl; if (!$scope.isReachable) { - // Get node peer info + // Get node from the default BMA node return BMA.network.peers() .then(function(res) { // find the current peer - var peer = _.find(res && res.peers || [], function(json) { + var peers = (res && res.peers || []).reduce(function(res, json) { var peer = new Peer(json); - return (peer.getServer() == node.server); - }); + return (peer.getEndpoints('BASIC_MERKLED_API') || []).reduce(function(res, ep) { + var bma = BMA.node.parseEndPoint(ep); + if((bma.dns == node.host || bma.ipv4 == node.host || bma.ipv6 == node.host) && ( + bma.port == node.port)) { + peer.bma = bma; + return res.concat(peer); + } + return res; + }, res); + }, []); + var peer = peers.length && peers[0]; + // Current node found if (peer) { $scope.node.pubkey = peer.pubkey; $scope.node.currency = peer.currency; return csWot.extend($scope.node); } + else { + console.log('Could not get peer from /network/peers'); + } }); } @@ -543,4 +556,18 @@ function PeerViewController($scope, $q, $window, $state, UIUtils, csWot, BMA) { } $state.go('app.view_peer', stateParams); }; + + /* -- manage link to raw document -- */ + + $scope.openRawPeering = function(event) { + return $scope.openLink(event, + ($scope.isHttps ? 'https://' : 'http://') + $scope.node.server + '/network/peering' + ); + }; + + $scope.openRawCurrentBlock = function(event) { + return $scope.openLink(event, + ($scope.isHttps ? 'https://' : 'http://') + $scope.node.server + '/blockchain/current' + ); + }; } diff --git a/www/js/services/http-services.js b/www/js/services/http-services.js index fdc299876fa45aa16d73b93ba0aa66d25c37357a..d626e795762ba6657ac4f2645abb84737de1c0e8 100644 --- a/www/js/services/http-services.js +++ b/www/js/services/http-services.js @@ -1,6 +1,6 @@ angular.module('cesium.http.services', ['cesium.cache.services']) -.factory('csHttp', function($http, $q, csSettings, csCache, $timeout) { +.factory('csHttp', function($http, $q, $timeout, $window, csSettings, csCache, Device) { 'ngInject'; var timeout = csSettings.data.timeout; @@ -267,7 +267,7 @@ angular.module('cesium.http.services', ['cesium.cache.services']) pathname = pathname.substring(1); } - result = { + var result = { protocol: protocol ? protocol : parser.protocol, hostname: parser.hostname, host: parser.host, @@ -282,6 +282,39 @@ angular.module('cesium.http.services', ['cesium.cache.services']) return result; } + /** + * Open a URI (url, email, phone, ...) + * @param event + * @param link + * @param type + */ + function openUri(uri, options) { + options = options || {}; + + if (!uri.startsWith('http://') && !uri.startsWith('https://')) { + var parts = parseUri(uri); + + if (!parts.protocol && options.type) { + parts.protocol = (options.type == 'email') ? 'mailto:' : + ((options.type == 'phone') ? 'tel:' : ''); + uri = parts.protocol + uri; + } + + // Check if device is enable, on spcial tel: or mailto: protocole + var validProtocol = (parts.protocol == 'mailto:' || parts.protocol == 'tel:') && Device.enable; + if (!validProtocol) { + if (options.onError && typeof options.onError == 'function') { + options.onError(uri); + } + return; + } + } + // Note: If device is enable, this will use InAppBrowser cordova plugin (=_system) + $window.open(uri, + (options.target || (Device.enable ? '_system' : '_blank')), + 'location=yes'); + } + // Get time (UTC) function getDateNow() { return Math.floor(moment().utc().valueOf() / 1000); @@ -309,7 +342,8 @@ angular.module('cesium.http.services', ['cesium.cache.services']) getUrl : getUrl, getServer: getServer, uri: { - parse: parseUri + parse: parseUri, + open: openUri }, date: { now: getDateNow diff --git a/www/js/services/utils-services.js b/www/js/services/utils-services.js index 2922c49681e7ed3220b2b48366d26fbe821bff9b..4871f9a33f1d9d19b304c20ea6ca242c979b19f3 100644 --- a/www/js/services/utils-services.js +++ b/www/js/services/utils-services.js @@ -723,21 +723,7 @@ angular.module('cesium.utils.services', []) }, timeout || 900); } - /** - * Open a link (url, email, phone, ...) - * @param event - * @param link - * @param type - */ - function openLink(event, link, type) { - if (!event || !link) return; - - // Open the url - // Note: If device is enable, this will use InAppBrowser cordova plugin - var url = (type == 'email') ? ('mailto:' + link) : - ((type == 'phone') ? ('tel:' + link) : link); - $window.open(url, '_system', 'location=yes'); - } + csSettings.api.data.on.changed($rootScope, function(data) { setEffects(data.uiEffects); @@ -757,9 +743,6 @@ angular.module('cesium.utils.services', []) toast: { show: showToast }, - link: { - open: openLink - }, onError: onError, screen: { isSmall: isSmallScreen diff --git a/www/plugins/es/js/controllers/common-controllers.js b/www/plugins/es/js/controllers/common-controllers.js index 6589cf9c910a13a31f2e734b2845b76afa9f0e5c..b0d5f129e4780f14f807bca1d6126af64bfc5a47 100644 --- a/www/plugins/es/js/controllers/common-controllers.js +++ b/www/plugins/es/js/controllers/common-controllers.js @@ -347,6 +347,13 @@ function ESSocialsEditController($scope, $focus, $filter, UIUtils, SocialUtils) function ESSocialsViewController($scope) { 'ngInject'; + $scope.openSocial = function(event, social) { + return $scope.openLink(event, social.url, { + type: social.type + }); + }; + + $scope.filterFn = function(social) { return !social.recipient || social.valid; }; diff --git a/www/plugins/es/templates/user/items_profile.html b/www/plugins/es/templates/user/items_profile.html index a6d52f369e3c396e3a58cee8b29bf50b5866e3e4..5ef67e24d4428dc36590920c50a43e97432f060c 100644 --- a/www/plugins/es/templates/user/items_profile.html +++ b/www/plugins/es/templates/user/items_profile.html @@ -8,7 +8,7 @@ </div> <!-- About me --> -<div class="item" ng-if="formData.profile.description"> +<div class="item item-text-wrap" ng-if="formData.profile.description"> <span class="gray" translate>PROFILE.DESCRIPTION</span> <h3 trust-as-html="formData.profile.description"></h3> </div> @@ -30,7 +30,7 @@ <ion-item ng-repeat="social in formData.profile.socials track by social.url" id="social-{{::social.url|formatSlug}}" class="item-icon-left item-text-wrap no-padding-bottom ink" - ng-click="openLink($event, social.url, social.type)"> + ng-click="openSocial($event, social)"> <i class="icon ion-social-{{social.type}}" ng-class="{'ion-bookmark': social.type == 'other', 'ion-link': social.type == 'web', 'ion-email': social.type == 'email'}"></i> <p ng-if="social.type && social.type != 'web'">{{social.type}}</p> diff --git a/www/plugins/map/templates/settings/es_settings_extend.html b/www/plugins/map/templates/settings/es_settings_extend.html index 70f41cc53c9b985bbe0d1f34b4b509d1bc8d0006..ff49a5d241e416ee1040899259bade943a4e3f8e 100644 --- a/www/plugins/map/templates/settings/es_settings_extend.html +++ b/www/plugins/map/templates/settings/es_settings_extend.html @@ -18,7 +18,7 @@ <div class="input-label col-33"> <span class="" ng-class="{'gray': !formData.enableGoogleApi}"translate>MAP.SETTINGS.GOOGLE_API_KEY</span> <h4> - <a href="https://console.developers.google.com/apis/credentials/key" target="_system" translate>MAP.SETTINGS.BTN_GOOGLE_API</a> + <a ng-click="openLink($event, 'https://console.developers.google.com/apis/credentials/key')" translate>MAP.SETTINGS.BTN_GOOGLE_API</a> <span class="gray"> ({{'MAP.SETTINGS.BTN_GOOGLE_API_WARNING'|translate}})</span> </h4> </div> diff --git a/www/templates/network/view_peer.html b/www/templates/network/view_peer.html index 7a967cd0a797f748f030a42e558e6f3964d79f9c..29b0646489ea32847999853555d62434d1ae8cf0 100644 --- a/www/templates/network/view_peer.html +++ b/www/templates/network/view_peer.html @@ -58,15 +58,13 @@ </h3> <h3> - <a target="_system" - ng-href="{{(node.useSsl ? 'https://' : 'http://') + node.server}}/network/peering"> + <a ng-click="openRawPeering($event)"> <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="_system" - ng-href="{{(node.useSsl ? 'https://' : 'http://') + node.server}}/blockchain/current"> + ng-click="openRawCurrentBlock($event)"> <i class="icon ion-share"></i> <span translate>PEER.VIEW.SHOW_RAW_CURRENT_BLOCK</span> </a> </h3> diff --git a/www/templates/wallet/view_wallet.html b/www/templates/wallet/view_wallet.html index 587196038055e8b2cfd45fb7aa906f13239b0db4..f5109ce168d145fec6aee7f503098c21d70564fa 100644 --- a/www/templates/wallet/view_wallet.html +++ b/www/templates/wallet/view_wallet.html @@ -152,7 +152,9 @@ <cs-extension-point name="before-technical"></cs-extension-point> - <span class="item item-divider" translate>WOT.TECHNICAL_DIVIDER</span> + <span class="item item-divider" + ng-if=":rebind:formData.uid" + translate>WOT.TECHNICAL_DIVIDER</span> <!-- Uid --> <span class="item item-icon-left item-text-wrap ink" diff --git a/www/templates/wot/view_identity.html b/www/templates/wot/view_identity.html index 221940428a906c30253f7e271b11f5712bd81627..d6d52fdcc75430a589d906199aa48d6d3544cbb2 100644 --- a/www/templates/wot/view_identity.html +++ b/www/templates/wot/view_identity.html @@ -136,12 +136,6 @@ <span class="item item-divider" translate>WOT.TECHNICAL_DIVIDER</span> - <!-- Uid --> - <ion-item class="item-icon-left" ng-if=":rebind:formData.uid"> - <span translate>COMMON.UID</span> - <span class="badge badge-stable">{{:rebind:formData.uid}}</span> - </ion-item> - <!-- Pubkey --> <ion-item class="item-icon-left item-text-wrap ink" copy-on-click="{{:rebind:formData.pubkey}}"> @@ -149,6 +143,12 @@ <span translate>COMMON.PUBKEY</span> <h4 id="pubkey" class="dark text-left">{{:rebind:formData.pubkey}}</h4> </ion-item> + + <!-- Uid --> + <ion-item class="item-icon-left" ng-if=":rebind:formData.uid"> + <span translate>COMMON.UID</span> + <span class="badge badge-stable">{{:rebind:formData.uid}}</span> + </ion-item> </div> <div class="col col-20 hidden-xs hidden-sm"> </div>