Skip to content
Snippets Groups Projects
Commit 86596274 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

fix jshint

parent 6aa336e5
Branches
Tags
No related merge requests found
Pipeline #
...@@ -296,6 +296,7 @@ function NetworkLookupController($scope, $state, $location, $ionicPopover, $win ...@@ -296,6 +296,7 @@ function NetworkLookupController($scope, $state, $location, $ionicPopover, $win
}; };
$scope.showWs2pPopover = function($event, peer) { $scope.showWs2pPopover = function($event, peer) {
$event.stopPropagation();
return $translate('NETWORK.VIEW.PRIVATE_ACCESS') return $translate('NETWORK.VIEW.PRIVATE_ACCESS')
.then(function(privateAccessMessage) { .then(function(privateAccessMessage) {
...@@ -320,8 +321,6 @@ function NetworkLookupController($scope, $state, $location, $ionicPopover, $win ...@@ -320,8 +321,6 @@ function NetworkLookupController($scope, $state, $location, $ionicPopover, $win
} }
}); });
}); });
$event.stopPropagation();
}; };
......
...@@ -167,7 +167,6 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] ...@@ -167,7 +167,6 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services']
if (latestRelease) { if (latestRelease) {
return csHttp.get(latestRelease.host, latestRelease.protocol == 'https:' ? 443 : latestRelease.port, "/" + latestRelease.pathname)() return csHttp.get(latestRelease.host, latestRelease.protocol == 'https:' ? 443 : latestRelease.port, "/" + latestRelease.pathname)()
.then(function (json) { .then(function (json) {
//console.debug(json);
if (json && json.name && json.tag_name && json.html_url) { if (json && json.name && json.tag_name && json.html_url) {
return { return {
version: json.name, version: json.name,
...@@ -178,7 +177,7 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] ...@@ -178,7 +177,7 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services']
}) })
.catch(function(err) { .catch(function(err) {
// silent (just log it) // 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'] ...@@ -349,11 +348,11 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services']
csPlatform.version.latest() csPlatform.version.latest()
.then(function(release) { .then(function(release) {
if (release && release.isNewer) { 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; $rootScope.newRelease = release;
} }
else { 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));
} }
}); });
......
...@@ -66,6 +66,14 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. ...@@ -66,6 +66,14 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium.
that.started = false; that.started = false;
that.init = init; 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) { if (host) {
init(host, port, useSsl, useCache); init(host, port, useSsl, useCache);
} }
...@@ -76,18 +84,12 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. ...@@ -76,18 +84,12 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium.
that.alive = false; that.alive = false;
that.cache = _emptyCache(); 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 // Use settings as default, if exists
if (csSettings.data && csSettings.data.node) { if (csSettings.data && csSettings.data.node) {
host = host || csSettings.data.node.host; host = host || csSettings.data.node.host;
port = port || csSettings.data.node.port; 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; useCache = angular.isDefined(useCache) ? useCache : true;
} }
...@@ -96,7 +98,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. ...@@ -96,7 +98,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium.
} }
that.host = host; that.host = host;
that.port = port || 80; 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.useCache = angular.isDefined(useCache) ? useCache : false;
that.server = csHttp.getServer(host, port); that.server = csHttp.getServer(host, port);
that.url = csHttp.getUrl(host, port, ''/*path*/, useSsl); that.url = csHttp.getUrl(host, port, ''/*path*/, useSsl);
...@@ -822,22 +824,19 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. ...@@ -822,22 +824,19 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium.
}); });
}; };
// raw get latest release // Define get latest release (or fake function is no URL defined)
var latestRelease = csSettings.data.duniterLatestReleaseUrl && csHttp.uri.parse(csSettings.data.duniterLatestReleaseUrl); var duniterLatestReleaseUrl = csSettings.data.duniterLatestReleaseUrl && csHttp.uri.parse(csSettings.data.duniterLatestReleaseUrl);
if (latestRelease) { exports.raw.getLatestRelease = duniterLatestReleaseUrl ?
var useSsl = latestRelease.protocol == 'https:'; csHttp.getWithCache(duniterLatestReleaseUrl.host,
exports.raw.getLatestRelease = csHttp.getWithCache(latestRelease.host, duniterLatestReleaseUrl.port,
latestRelease.port, "/" + duniterLatestReleaseUrl.pathname,
"/" + latestRelease.pathname, /*useSsl*/ (duniterLatestReleaseUrl.port == 443 || duniterLatestReleaseUrl.protocol == 'https:' || that.forceUseSsl),
useSsl,
csHttp.cache.LONG csHttp.cache.LONG
); ) :
} // No URL define: use a fake function
else { function() {
exports.raw.getLatestRelease = function() {
return $q.when(); return $q.when();
} };
}
exports.version.latest = function() { exports.version.latest = function() {
return exports.raw.getLatestRelease() return exports.raw.getLatestRelease()
...@@ -858,9 +857,9 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. ...@@ -858,9 +857,9 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium.
}) })
.catch(function(err) { .catch(function(err) {
// silent (just log it) // 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 = { exports.websocket = {
block: ws('/ws/block'), block: ws('/ws/block'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment