diff --git a/www/js/controllers/network-controllers.js b/www/js/controllers/network-controllers.js index 6f6c2e831d5e332828a8046b9a848608b559c561..a381b096572658f89253a4d6041ef1764a1fe131 100644 --- a/www/js/controllers/network-controllers.js +++ b/www/js/controllers/network-controllers.js @@ -296,6 +296,7 @@ function NetworkLookupController($scope, $state, $location, $ionicPopover, $win }; $scope.showWs2pPopover = function($event, peer) { + $event.stopPropagation(); return $translate('NETWORK.VIEW.PRIVATE_ACCESS') .then(function(privateAccessMessage) { @@ -320,8 +321,6 @@ function NetworkLookupController($scope, $state, $location, $ionicPopover, $win } }); }); - - $event.stopPropagation(); }; diff --git a/www/js/platform.js b/www/js/platform.js index d9da34804110e23b2cd1f8a5d16a1e697ebcd91e..2271ad05d6d8ab29cd60e159d83506851134b5c1 100644 --- a/www/js/platform.js +++ b/www/js/platform.js @@ -167,7 +167,6 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] if (latestRelease) { return csHttp.get(latestRelease.host, latestRelease.protocol == 'https:' ? 443 : latestRelease.port, "/" + latestRelease.pathname)() .then(function (json) { - //console.debug(json); if (json && json.name && json.tag_name && json.html_url) { return { version: json.name, @@ -178,7 +177,7 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] }) .catch(function(err) { // silent (just log it) - console.error('[platform] Failed to get latest version', err); + console.error('[platform] Failed to get Cesium latest version', err); }) ; } @@ -349,11 +348,11 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] csPlatform.version.latest() .then(function(release) { if (release && release.isNewer) { - console.info('[app] New release detected: {0}'.format(release.version)); + console.info('[app] New release detected [{0}]'.format(release.version)); $rootScope.newRelease = release; } else { - console.info('[app] Already use latest release {0}'.format(csConfig.version)); + console.info('[app] Current version [{0}] is the latest release'.format(csConfig.version)); } }); diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js index 733d215f29bd4114c38d8a6d163677f9d223c83a..72f03763723adfbbd462ddec41686066495dfce6 100644 --- a/www/js/services/bma-services.js +++ b/www/js/services/bma-services.js @@ -66,6 +66,14 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. that.started = false; that.init = init; + // Allow to force SSL connection with port different from 443 + that.forceUseSsl = (csConfig.httpsMode === 'true' || csConfig.httpsMode === true || csConfig.httpsMode === 'force') || + ($window.location && $window.location.protocol === 'https:') ? true : false; + if (that.forceUseSsl) { + console.debug('[BMA] Enable SSL (forced by config or detected in URL)'); + } + + if (host) { init(host, port, useSsl, useCache); } @@ -76,18 +84,12 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. that.alive = false; that.cache = _emptyCache(); - // Allow to force SSL connection with port different from 443 - var forceUseSsl = (csConfig.httpsMode === 'true' || csConfig.httpsMode === true || csConfig.httpsMode === 'force') || - ($window.location && $window.location.protocol === 'https:') ? true : false; - if (forceUseSsl) { - console.debug('[BMA] Enable SSL (forced by config or detected in URL)'); - } // Use settings as default, if exists if (csSettings.data && csSettings.data.node) { host = host || csSettings.data.node.host; port = port || csSettings.data.node.port; - useSsl = angular.isDefined(useSsl) ? useSsl : (port == 443 || csSettings.data.node.useSsl || forceUseSsl); + useSsl = angular.isDefined(useSsl) ? useSsl : (port == 443 || csSettings.data.node.useSsl || that.forceUseSsl); useCache = angular.isDefined(useCache) ? useCache : true; } @@ -96,7 +98,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. } that.host = host; that.port = port || 80; - that.useSsl = angular.isDefined(useSsl) ? useSsl : (that.port == 443 || forceUseSsl); + that.useSsl = angular.isDefined(useSsl) ? useSsl : (that.port == 443 || that.forceUseSsl); that.useCache = angular.isDefined(useCache) ? useCache : false; that.server = csHttp.getServer(host, port); that.url = csHttp.getUrl(host, port, ''/*path*/, useSsl); @@ -822,22 +824,19 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. }); }; - // raw get latest release - var latestRelease = csSettings.data.duniterLatestReleaseUrl && csHttp.uri.parse(csSettings.data.duniterLatestReleaseUrl); - if (latestRelease) { - var useSsl = latestRelease.protocol == 'https:'; - exports.raw.getLatestRelease = csHttp.getWithCache(latestRelease.host, - latestRelease.port, - "/" + latestRelease.pathname, - useSsl, + // Define get latest release (or fake function is no URL defined) + var duniterLatestReleaseUrl = csSettings.data.duniterLatestReleaseUrl && csHttp.uri.parse(csSettings.data.duniterLatestReleaseUrl); + exports.raw.getLatestRelease = duniterLatestReleaseUrl ? + csHttp.getWithCache(duniterLatestReleaseUrl.host, + duniterLatestReleaseUrl.port, + "/" + duniterLatestReleaseUrl.pathname, + /*useSsl*/ (duniterLatestReleaseUrl.port == 443 || duniterLatestReleaseUrl.protocol == 'https:' || that.forceUseSsl), csHttp.cache.LONG - ); - } - else { - exports.raw.getLatestRelease = function() { + ) : + // No URL define: use a fake function + function() { return $q.when(); - } - } + }; exports.version.latest = function() { return exports.raw.getLatestRelease() @@ -858,9 +857,9 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. }) .catch(function(err) { // silent (just log it) - console.error('[platform] Failed to get latest version', err); + console.error('[BMA] Failed to get Duniter latest version', err); }); - } + }; exports.websocket = { block: ws('/ws/block'),