Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • cordeliaze/cesium
  • pfouque06/cesium
  • wellno1/cesium
  • 1000i100/cesium
  • vincentux/cesium
  • calbasi/cesium
  • thomasbromehead/cesium
  • matograine/cesium
  • clients/cesium-grp/cesium
  • cedricmenec/cesium
  • Pamplemousse/cesium
  • etienneleba/cesium
  • tnntwister/cesium
  • scanlegentil/cesium
  • morvanc/cesium
  • yyy/cesium
  • Axce/cesium
  • Bertrandbenj/cesium
  • Lupus/cesium
  • elmau/cesium
  • MartinDelille/cesium
  • tykayn/cesium
  • numeropi/cesium
  • Vivakvo/cesium
  • pokapow/cesium
  • pini-gh/cesium
  • anam/cesium
  • RavanH/cesium
  • bpresles/cesium
  • am97/cesium
  • tuxmain/cesium
  • jytou/cesium
  • oliviermaurice/cesium
  • 666titi999/cesium
  • Yvv/cesium
35 results
Select Git revision
Loading items
Show changes
Showing
with 632 additions and 324 deletions
www/img/logo_512px.png

70.6 KiB

<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<path fill="#444" d="M16 0.5c-8.563 0-15.5 6.938-15.5 15.5s6.938 15.5 15.5 15.5c8.563 0 15.5-6.938 15.5-15.5s-6.938-15.5-15.5-15.5zM23.613 11.119l-2.544 11.988c-0.188 0.85-0.694 1.056-1.4 0.656l-3.875-2.856-1.869 1.8c-0.206 0.206-0.381 0.381-0.781 0.381l0.275-3.944 7.181-6.488c0.313-0.275-0.069-0.431-0.482-0.156l-8.875 5.587-3.825-1.194c-0.831-0.262-0.85-0.831 0.175-1.231l14.944-5.763c0.694-0.25 1.3 0.169 1.075 1.219z"/>
</svg>
www/img/marker-icon-2x.png

3.94 KiB

www/img/marker-icon.png

1.71 KiB

www/img/marker-shadow.png

797 B

www/img/markers-matte.png

14 KiB

www/img/markers-matte@2x.png

30.4 KiB

www/img/markers-plain.png

7.76 KiB

www/img/markers-soft.png

40.3 KiB

www/img/markers-soft@2x.png

64.9 KiB

www/img/search-icon-mobile.png

3.87 KiB

www/img/splash.png

172 KiB

......@@ -10,22 +10,24 @@
<meta name="theme-color" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon" href="img/logo_57px.png">
<link rel="manifest" href="manifest.json">
<!-- build:css dist_css/cesium.css -->
<link rel="stylesheet" type="text/css" href="css/ionic.app.min.css">
<link rel="stylesheet" type="text/css" href="css/ionic.app.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/angular-image-crop.css">
<link rel="stylesheet" type="text/css" href="lib/angular-image-crop/dist/angular-image-crop.min.css">
<!-- removeIf(device) -->
<link rel="stylesheet" type="text/css" href="css/style-no-device.css">
<!-- endRemoveIf(device) -->
<!-- removeIf(no-plugin) -->
<link rel="stylesheet" type="text/css" href="css/leaflet.app.min.css">
<link rel="stylesheet" type="text/css" href="css/leaflet.app.css">
<link rel="stylesheet" type="text/css" href="lib/chart.js/dist/Chart.css">
<link rel="stylesheet" type="text/css" href="dist/dist_css/plugins/es/css/style.css">
<link rel="stylesheet" type="text/css" href="dist/dist_css/plugins/graph/css/style.css">
<link rel="stylesheet" type="text/css" href="dist/dist_css/plugins/graph/css/style.css">
<link rel="stylesheet" type="text/css" href="dist/dist_css/plugins/map/css/style.css">
<!--endRemoveIf(no-plugin)-->
<!-- endbuild -->
......@@ -47,79 +49,77 @@
<meta property="og:locale:alternate" content="fr_FR" />
<meta property="og:locale:alternate" content="it_IT" />
<meta property="og:locale:alternate" content="nl_NL" />
<meta property="og:locale:alternate" content="eo_EO" />
<meta property="og:locale:alternate" content="de_DE" />
<!--endRemoveIf(device)-->
</head>
<body ng-app="cesium" id="cesium" ng-strict-di="true" window-exit-unauth="true"
ng-class="{'nobackdrop': $root.tour, 'expert-mode': $root.settings.expertMode}">
<body id="cesium" ng-strict-di="true" window-exit-unauth="true"
ng-class="{'nobackdrop': $root.tour, 'expert-mode': $root.settings.expertMode, 'demo': $root.config.demo && !$root.config.readonly, 'readonly': $root.config.readonly}"
style="background-color: #1a237e;">
<ion-nav-view>
<div class="loader">
<h3 style="text-align: center; padding-top: 25px; "><b>Cesium</b></h3>
<h4 style="text-align: center;"><i class="icon ion-load-a"></i></h4>
<div class="loader center">
<div class="logo"></div>
</div>
</ion-nav-view>
<!-- build:js dist_js/vendor.js -->
<!-- vendor js -->
<script src="js/vendor/moment.min.js"></script>
<script src="js/vendor/moment.fr.js"></script>
<script src="js/vendor/moment.nl.js"></script>
<script src="js/vendor/moment.es.js"></script>
<script src="js/vendor/numeral.js"></script>
<script src="js/vendor/numeral.fr.js"></script>
<script src="js/vendor/numeral.en.js"></script>
<script src="js/vendor/numeral.nl.js"></script>
<script src="js/vendor/numeral.es.js"></script>
<script src="js/vendor/socket-io.js"></script>
<script src="js/vendor/underscore.js"></script>
<script src="js/vendor/qrcode.min.js"></script>
<script src="js/vendor/aes-js.js"></script>
<script src="js/vendor/Chart.js"></script>
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ionic/js/ionic.material.js"></script>
<script src="lib/ionic/js/angular/angular-resource.js"></script>
<script src="lib/ionic/js/angular/angular-translate.js"></script>
<script src="lib/ionic/js/angular/angular-messages.js"></script>
<script src="lib/ionic/js/angular/angular-api.js"></script>
<script src="lib/ionic/js/angular/angular-cache.js"></script>
<script src="lib/ionic/js/angular/angular-screenmatch.min.js"></script>
<script src="lib/ionic/js/angular/angular-bind-notifier.min.js"></script>
<script src="lib/ionic/js/angular/angular-image-crop.js"></script>
<script src="lib/ionic/js/angular/angular-file-saver.bundle.js"></script>
<script src="lib/ionic/js/angular/angular-idle.js"></script>
<script src="lib/ionic/js/angular/angular-simple-logger.light.js"></script>
<script src="lib/ionic/js/angular/ui-leaflet.js"></script>
<script src="js/vendor/ion-digit-keyboard.min.js"></script>
<script src="lib/ionic/js/angular/angular-chart.min.js"></script>
<script src="lib/ionic/js/angular/angular-fullscreen.js"></script>
<script src="lib/numeral/numeral.js"></script>
<script src="lib/numeral/languages.js"></script>
<script src="js/vendor/numeral.eo.js"></script>
<script src="js/vendor/numeral.ca.js"></script>
<script src="lib/qrcode-generator/js/qrcode.js"></script>
<script src="lib/aes-js/index.js"></script>
<script src="lib/moment/min/moment-with-locales.min.js"></script>
<script src="lib/socket.io-client/dist/socket.io.min.js"></script>
<script src="lib/underscore/underscore-min.js"></script>
<script src="lib/chart.js/dist/Chart.min.js"></script>
<script src="lib/jdenticon/dist/jdenticon.min.js"></script>
<!-- ionic/angular js -->
<script src="lib/ionic/js/ionic.min.js"></script>
<script src="lib/angular/angular.min.js"></script>
<script src="lib/angular-animate/angular-animate.min.js"></script>
<script src="lib/angular-sanitize/angular-sanitize.min.js"></script>
<script src="lib/angular-ui-router/release/angular-ui-router.min.js"></script>
<script src="lib/ionic/js/ionic-angular.min.js"></script>
<script src="lib/ionic-material/dist/ionic.material.min.js"></script>
<script src="lib/angular-resource/angular-resource.min.js"></script>
<script src="lib/angular-translate/angular-translate.min.js"></script>
<script src="lib/angular-messages/angular-messages.min.js"></script>
<script src="lib/angular-expose-api/dist/angular-expose-api.min.js"></script>
<script src="lib/angular-cache/dist/angular-cache.min.js"></script>
<script src="lib/angular-screenmatch/dist/angular-screenmatch.min.js"></script>
<script src="lib/angular-bind-notifier/dist/angular-bind-notifier.min.js"></script>
<script src="lib/angular-image-crop/dist/angular-image-crop.js"></script>
<script src="lib/angular-file-saver/dist/angular-file-saver.bundle.min.js"></script>
<script src="lib/ng-idle/angular-idle.min.js"></script>
<script src="lib/angular-simple-logger/dist/angular-simple-logger.light.min.js"></script>
<script src="lib/ui-leaflet/dist/ui-leaflet.min.no-header.js"></script>
<script src="lib/ion-digit-keyboard/dist/ion-digit-keyboard.min.js"></script>
<script src="lib/angular-chart.js/dist/angular-chart.min.js"></script>
<script src="lib/angular-fullscreen-toggle/dist/angular-fullscreen-toggle.min.js"></script>
<script src="js/vendor/base58.js" async></script>
<!--removeIf(android)-->
<!--removeIf(ios)-->
<script src="js/vendor/nacl_factory.js" async></script>
<script src="js/vendor/scrypt-em.js" async></script>
<script src="lib/js-nacl/lib/nacl_factory.js" async></script>
<script src="lib/js-scrypt/browser/scrypt.js" async></script>
<script src="js/vendor/base64.js" async></script>
<!--endRemoveIf(ios)-->
<!--endRemoveIf(android)-->
<!--removeIf(no-device)-->
<script src="js/vendor/sha256.min.js" async></script>
<script src="js/vendor/ng-cordova.min.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.min.js"></script>
<!--endRemoveIf(no-device)-->
<!--removeIf(no-plugin)-->
<script src="js/vendor/leaflet.js"></script>
<script src="js/vendor/leaflet.awesome-markers.min.js"></script>
<script src="js/vendor/leaflet.search.min.js"></script>
<script src="js/vendor/leaflet.easy-button.js"></script>
<script src="js/vendor/leaflet.loading.js"></script>
<script src="js/vendor/leaflet.markercluster.js"></script>
<script src="js/vendor/leaflet.featuregroup.subgroup-src.js"></script>
<script src="lib/leaflet/dist/leaflet.js"></script>
<script src="lib/Leaflet.awesome-markers/dist/leaflet.awesome-markers.min.js"></script>
<script src="lib/leaflet-search/dist/leaflet-search.min.js"></script>
<script src="lib/Leaflet.EasyButton/src/easy-button.js"></script>
<script src="lib/leaflet.loading/src/Control.Loading.js"></script>
<script src="lib/leaflet.markercluster/dist/leaflet.markercluster.js"></script>
<script src="lib/Leaflet.FeatureGroup.SubGroup/leaflet.featuregroup.subgroup-src.js"></script>
<!--endRemoveIf(no-plugin)-->
<!-- endbuild -->
......@@ -156,9 +156,10 @@
<script src="dist/dist_js/app/entities/block.js"></script>
<script src="dist/dist_js/app/entities/ws2pmessage.js"></script>
<!-- controllers -->
<script src="dist/dist_js/app/controllers/app-controllers.js"></script>
<script src="dist/dist_js/app/controllers/home-controllers.js"></script>
<script src="dist/dist_js/app/controllers/feed-controllers.js"></script>
<script src="dist/dist_js/app/controllers/join-controllers.js"></script>
<script src="dist/dist_js/app/controllers/login-controllers.js"></script>
<script src="dist/dist_js/app/controllers/help-controllers.js"></script>
......@@ -187,6 +188,7 @@
<script src="dist/dist_js/plugins/es/js/entities/notification.js"></script>
<script src="dist/dist_js/plugins/es/js/entities/comment.js"></script>
<script src="dist/dist_js/plugins/es/js/entities/invitation.js"></script>
<script src="dist/dist_js/plugins/es/js/entities/peer.js"></script>
<script src="dist/dist_js/plugins/es/js/services.js"></script>
<script src="dist/dist_js/plugins/es/js/services/comment-services.js"></script>
<script src="dist/dist_js/plugins/es/js/services/http-services.js"></script>
......@@ -207,6 +209,8 @@
<script src="dist/dist_js/plugins/es/js/services/tx-services.js"></script>
<script src="dist/dist_js/plugins/es/js/services/geo-services.js"></script>
<script src="dist/dist_js/plugins/es/js/services/document-services.js"></script>
<script src="dist/dist_js/plugins/es/js/services/network-services.js"></script>
<script src="dist/dist_js/plugins/es/js/services/like-services.js"></script>
<script src="dist/dist_js/plugins/es/js/controllers/common-controllers.js"></script>
<script src="dist/dist_js/plugins/es/js/controllers/app-controllers.js"></script>
<script src="dist/dist_js/plugins/es/js/controllers/settings-controllers.js"></script>
......@@ -223,9 +227,10 @@
<script src="dist/dist_js/plugins/es/js/controllers/invitation-controllers.js"></script>
<script src="dist/dist_js/plugins/es/js/controllers/subscription-controllers.js"></script>
<script src="dist/dist_js/plugins/es/js/controllers/document-controllers.js"></script>
<script src="dist/dist_js/plugins/es/js/controllers/like-controllers.js"></script>
<script src="dist/dist_js/plugins/es/js/controllers/admin-controllers.js"></script>
<!-- Graph plugin -->
<!--removeIf(ubuntu)--> <!-- FIXME: issue #463 -->
<script src="dist/dist_js/plugins/graph/js/plugin.js"></script>
<script src="dist/dist_js/plugins/graph/js/services.js"></script>
<script src="dist/dist_js/plugins/graph/js/services/data-services.js"></script>
......@@ -237,7 +242,6 @@
<script src="dist/dist_js/plugins/graph/js/controllers/account-controllers.js"></script>
<script src="dist/dist_js/plugins/graph/js/controllers/docstats-controllers.js"></script>
<script src="dist/dist_js/plugins/graph/js/controllers/synchro-controllers.js"></script>
<!--endRemoveIf(ubuntu)-->
<!-- Map plugin -->
<script src="dist/dist_js/plugins/map/js/plugin.js"></script>
......@@ -245,6 +249,7 @@
<script src="dist/dist_js/plugins/map/js/services/wot-services.js"></script>
<script src="dist/dist_js/plugins/map/js/services/registry-services.js"></script>
<script src="dist/dist_js/plugins/map/js/services/utils-services.js"></script>
<script src="dist/dist_js/plugins/map/js/controllers/common-controllers.js"></script>
<script src="dist/dist_js/plugins/map/js/controllers/wot-controllers.js"></script>
<script src="dist/dist_js/plugins/map/js/controllers/registry-controllers.js"></script>
<script src="dist/dist_js/plugins/map/js/controllers/network-controllers.js"></script>
......@@ -270,6 +275,7 @@
<script src="dist/dist_js/app/directives.js"></script>
<script src="dist/dist_js/app/filters.js"></script>
<script src="dist/dist_js/app/platform.js"></script>
<script src="dist/dist_js/app/functions.js"></script>
<!-- endbuild -->
<!-- build:js config.js -->
......
......@@ -4,8 +4,8 @@
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.controllers' is found in controllers.js
angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht.translate', 'ngApi', 'angular-cache', 'angular.screenmatch',
'FBAngular', // = angular-fullscreen
angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht.translate', 'ngApi', 'angular-cache',
'angular.screenmatch', 'angular-fullscreen-toggle',
// removeIf(no-device)
'ngCordova',
// endRemoveIf(no-device)
......@@ -57,9 +57,11 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr
$urlRouterProvider.otherwise('/app/home');
})
.controller('ApiCtrl', function ($scope, $state, $translate, $ionicPopover, Modals, csSettings){
.controller('ApiCtrl', function ($scope, $state, $translate, $ionicPopover, UIUtils, Modals, csSettings){
'ngInject';
// Fill locales
$scope.locales = angular.copy(csSettings.locales);
$scope.showAboutModal = function(e) {
e.preventDefault(); // avoid to open link href
......@@ -80,7 +82,7 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr
$scope.showLocalesPopover = function(event) {
UIUtils.popover.show(event, {
templateUrl: 'templates/api/locales_popover.html',
templateUrl: 'templates/api/popover_locales.html',
scope: $scope,
autoremove: true,
afterShow: function(popover) {
......@@ -227,12 +229,20 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr
})
.controller('ApiTransferCtrl', function($scope, $rootScope, $timeout, $controller, $state, $q, $translate, $filter,
$window, $ionicHistory, BMA, CryptoUtils, UIUtils, csSettings, csCurrency,
csPlatform, csTx, csWallet, csDemoWallet){
$window, $ionicHistory, BMA, CryptoUtils, UIUtils, csConfig, csSettings,
csPlatform, csCurrency, csTx, csWallet, csDemoWallet) {
'ngInject';
// WARN: Disable demo mode, on the API (a non-blocking warn message will be display later)
var config = csConfig;
if (config.demo) {
config = angular.copy(config);
config.demo = false;
config.readonly = false;
}
// Initialize the super class and extend it.
angular.extend(this, $controller('AuthCtrl', {$scope: $scope}));
angular.extend(this, $controller('AuthCtrl', {$scope: $scope, csConfig: config}));
$scope.loading = true;
$scope.transferData = {
......@@ -253,9 +263,9 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr
if (state.stateParams && state.stateParams.amount) {
var amountStr = state.stateParams.amount.trim();
var amounts = ((amountStr.indexOf('|') !== -1) && amountStr.split('|'))
|| ((amountStr.indexOf(' ') !== -1) && amountStr.split(' '))
|| ((amountStr.indexOf(';') !== -1) && amountStr.split(';'));
var amounts = ((amountStr.indexOf('|') !== -1) && amountStr.split('|')) ||
((amountStr.indexOf(' ') !== -1) && amountStr.split(' ')) ||
((amountStr.indexOf(';') !== -1) && amountStr.split(';'));
if (amounts) {
$scope.transferData.amounts = amounts.reduce(function(res, amountStr) {
var amount = normalizeAmount(amountStr);
......@@ -338,7 +348,7 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr
$scope.loading = true;
// Set BMA node
if (!$scope.error && $scope.node && !BMA.node.same($scope.node.host, $scope.node.port)) {
if (!$scope.error && $scope.node && !BMA.node.same($scope.node)) {
console.debug("[api] Using preferred node: {0}:{1}".format($scope.node.host, $scope.node.port));
BMA.stop();
BMA.copy($scope.node);
......
......@@ -4,9 +4,8 @@
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.controllers' is found in controllers.js
angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht.translate',
'ngApi', 'angular-cache', 'angular.screenmatch', 'angular.bind.notifier', 'ImageCropper', 'ion-digit-keyboard',
'FBAngular', // = angular-fullscreen
angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'ngSanitize', 'pascalprecht.translate',
'ngApi', 'angular-cache', 'angular.screenmatch', 'angular.bind.notifier', 'ImageCropper', 'ion-digit-keyboard', 'angular-fullscreen-toggle',
// removeIf(no-device)
'ngCordova',
// endRemoveIf(no-device)
......@@ -47,38 +46,45 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht
// removeIf(android)
// removeIf(ios)
// removeIf(firefoxos)
// -- Automatic redirection to large state (if define) (keep this code for platforms web and ubuntu build)
if (next.data.large && !UIUtils.screen.isSmall()) {
event.preventDefault();
$state.go(next.data.large, nextParams);
return;
}
// endRemoveIf(firefoxos)
// endRemoveIf(ios)
// endRemoveIf(android)
var wallet = nextParams.wallet && nextParams.wallet != "default" ? csWallet.children.get(nextParams.wallet) : csWallet;
var wallet = nextParams.wallet && nextParams.wallet !== 'default' ? csWallet.children.get(nextParams.wallet) : csWallet;
if (nextParams.wallet && !wallet) {
console.warn("[app] Unable to find the children wallet: " + nextParams.wallet);
console.warn('[app] Unable to find the children wallet: ' + nextParams.wallet);
}
var goNextState = function() {
preventStateChange = false;
return $state.go(next.name, nextParams);
};
var processError = function(err) {
preventStateChange = false;
// If user cancel
if (err === 'CANCELLED') {
// Redirect to home, if no current state
if (!$state.current.name) {
return $state.go('app.home');
}
return; // Stay on the existing state
}
// Show Error
UIUtils.onError('ERROR.LOAD_WALLET_DATA_ERROR')(err);
};
// If state need auth
if (next.data.auth && !wallet.isAuth()) {
event.preventDefault();
options = next.data.minData ? {minData: true} : undefined;
preventStateChange = true;
console.debug("[app] State need auth...");
return csWallet.auth(options)
.then(function() {
preventStateChange = false;
return $state.go(next.name, nextParams);
})
.catch(function(err) {
preventStateChange = false;
// If cancel, redirect to home, if no current state
if (err === 'CANCELLED' && !$state.current.name) {
return $state.go('app.home');
}
});
.then(goNextState)
.catch(processError);
}
// If state need login
......@@ -86,18 +92,10 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht
event.preventDefault();
options = next.data.minData ? {minData: true} : undefined;
preventStateChange = true;
console.debug('[app] State need login...');
return csWallet.login(options)
.then(function() {
preventStateChange = false;
return $state.go(next.name, nextParams);
})
.catch(function(err) {
preventStateChange = false;
// If cancel, redirect to home, if no current state
if (err === 'CANCELLED' && !$state.current.name) {
return $state.go('app.home');
}
});
.then(goNextState)
.catch(processError);
}
// If state need login or auth, make sure to load wallet data
......@@ -107,11 +105,11 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht
event.preventDefault();
// Show loading message, when full load
if (!options || !options.minData) UIUtils.loading.show();
console.debug('[app] State load wallet data...');
return wallet.loadData(options)
.then(function() {
preventStateChange = false;
return $state.go(next.name, nextParams);
});
.then(goNextState)
.catch(processError);
}
}
});
......@@ -138,5 +136,17 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht
// Start plugins eager services
PluginService.start();
ionicReady().then(function() {
if (ionic.Platform.isIOS()) {
if(window.StatusBar) {
// fix font color not white on iOS 11+
StatusBar.styleLightContent();
}
}
});
})
;
window.ionic.Platform.ready(function() {
angular.bootstrap(document, ['cesium']);
});
/******
* !! WARNING: This is a generated file !!
*
* PLEASE DO NOT MODIFY DIRECTLY
*
* => Changes should be done on file 'app/config.json'.
******/
angular.module("cesium.config", [])
.constant("csConfig", {
"cacheTimeMs": 300000,
"demo": false,
"readonly": false,
"fallbackLanguage": "en",
"rememberMe": true,
"showUDHistory": true,
"timeout": 30000,
"timeWarningExpireMembership": 5184000,
"timeWarningExpire": 7776000,
"minConsensusPeerCount": -1,
"useLocalStorage": true,
"useRelative": false,
"expertMode": true,
"decimalCount": 2,
"httpsMode": false,
"shareBaseUrl": "https://g1-test.cesium.app",
"helptip": {
"enable": false,
"installDocUrl": {
"fr-FR": "https://duniter.fr/wiki/doc/installer/",
"en": "https://duniter.org/wiki/doc/install/"
}
},
"node": {
"host": "g1-test.duniter.org",
"port": 443
},
"fallbackNodes": [
{
"host": "gt.moul.re",
"port": 10902
},
{
"host": "g1-test.duniter.org",
"port": 443
}
],
"developers": [
{
"name": "Benoit Lavenier",
"pubkey": "38MEAZN68Pz1DTvT3tqgxx4yQP6snJCQhPqEFxbDk4aE"
},
{
"name": "Cédric Moreau",
"pubkey": "2ny7YAdmzReQxAayyJZsyVYwYhVyax2thKcGknmQy5nQ"
},
{
"name": "Kapis",
"pubkey": "24jaf8XhYZyDyUb7hMcy5qsanaHBC11AwPefcCQRBQNA"
},
{
"name": "Matograine",
"pubkey": "CmFKubyqbmJWbhyH2eEPVSSs4H4NeXGDfrETzEnRFtPd"
}
],
"plugins": {
"es": {
"enable": false,
"askEnable": false,
"useRemoteStorage": false,
"host": "g1-test.data.e-is.pro",
"port": 443,
"notifications": {
"txSent": true,
"txReceived": true,
"certSent": true,
"certReceived": true
},
"defaultCountry": "France"
}
},
"version": "1.7.13",
"build": "2024-01-03T17:45:14.686Z",
"newIssueUrl": "https://git.duniter.org/clients/cesium-grp/cesium/issues/new"
})
;
\ No newline at end of file
......@@ -10,37 +10,64 @@ angular.module("cesium.config", [])
.constant("csConfig", {
"cacheTimeMs": 300000,
"demo": false,
"readonly": false,
"fallbackLanguage": "en",
"rememberMe": true,
"showUDHistory": true,
"timeout": 30000,
"timeWarningExpireMembership": 5184000,
"timeWarningExpire": 7776000,
"minConsensusPeerCount": 10,
"keepAuthIdle": 600,
"useLocalStorage": true,
"useRelative": false,
"expertMode": false,
"decimalCount": 2,
"httpsMode": false,
"shareBaseUrl": "https://g1.duniter.fr",
"shareBaseUrl": "https://demo.cesium.app/",
"helptip": {
"enable": true,
"installDocUrl": {
"fr-FR": "https://duniter.org/fr/wiki/duniter/installer/",
"en": "https://duniter.org/en/wiki/duniter/install/"
"fr-FR": "https://duniter.fr/wiki/doc/installer/",
"en": "https://duniter.org/wiki/doc/install/"
}
},
"license": {
"ca": "license/license_g1-ca",
"de-DE": "license/license_g1-de-DE",
"en": "license/license_g1-en",
"en-GB": "license/license_g1-en",
"eo-EO": "license/license_g1-eo-EO",
"es-ES": "license/license_g1-es-ES",
"fr-FR": "license/license_g1-fr-FR",
"en": "license/license_g1-en"
"it-IT": "license/license_g1-it-IT",
"pt-PT": "license/license_g1-pt-PT"
},
"node": {
"host": "g1.duniter.org",
"port": 443
"feed": {
"jsonFeed": {
"ca": "https://raw.githubusercontent.com/duniter/cesium/master/doc/feed/1.1/feed-ca.json",
"de-DE": "https://raw.githubusercontent.com/duniter/cesium/master/doc/feed/1.1/feed-de-DE.json",
"en": "https://raw.githubusercontent.com/duniter/cesium/master/doc/feed/1.1/feed-en.json",
"en-GB": "https://raw.githubusercontent.com/duniter/cesium/master/doc/feed/1.1/feed-en-GB.json",
"eo-EO": "https://raw.githubusercontent.com/duniter/cesium/master/doc/feed/1.1/feed-eo-EO.json",
"es-ES": "https://raw.githubusercontent.com/duniter/cesium/master/doc/feed/1.1/feed-es-ES.json",
"fr-FR": "https://raw.githubusercontent.com/duniter/cesium/master/doc/feed/1.1/feed-fr-FR.json",
"it-IT": "https://raw.githubusercontent.com/duniter/cesium/master/doc/feed/1.1/feed-it-IT.json",
"nl-NL": "https://raw.githubusercontent.com/duniter/cesium/master/doc/feed/1.1/feed-nl-NL.json",
"pt-PT": "https://raw.githubusercontent.com/duniter/cesium/master/doc/feed/1.1/feed-pt-PT.json"
},
"maxContentLength": 1300,
"maxAgeInMonths": 3,
"maxCount": 3
},
"fallbackNodes": [
{
"host": "g1.nordstrom.duniter.org",
"host": "g1.e-is.pro",
"port": 443
},
{
"host": "vit.fdn.org",
"port": 443
},
{
......@@ -48,15 +75,15 @@ angular.module("cesium.config", [])
"port": 443
},
{
"host": "g1.monnaielibreoccitanie.org",
"host": "g1.mithril.re",
"port": 443
},
{
"host": "g1.le-sou.org",
"host": "g1.duniter.org",
"port": 443
},
{
"host": "g1.duniter.fr",
"host": "g1.le-sou.org",
"port": 443
}
],
......@@ -64,6 +91,18 @@ angular.module("cesium.config", [])
{
"name": "Benoit Lavenier",
"pubkey": "38MEAZN68Pz1DTvT3tqgxx4yQP6snJCQhPqEFxbDk4aE"
},
{
"name": "Cédric Moreau",
"pubkey": "2ny7YAdmzReQxAayyJZsyVYwYhVyax2thKcGknmQy5nQ"
},
{
"name": "Kapis",
"pubkey": "24jaf8XhYZyDyUb7hMcy5qsanaHBC11AwPefcCQRBQNA"
},
{
"name": "Matograine",
"pubkey": "CmFKubyqbmJWbhyH2eEPVSSs4H4NeXGDfrETzEnRFtPd"
}
],
"plugins": {
......@@ -71,15 +110,31 @@ angular.module("cesium.config", [])
"enable": true,
"askEnable": true,
"useRemoteStorage": true,
"host": "g1.data.duniter.fr",
"host": "g1.data.e-is.pro",
"port": 443,
"fallbackNodes": [
{
"host": "g1.data.presles.fr",
"port": 443
},
{
"host": "g1.data.le-sou.org",
"port": 443
},
{
"host": "g1.data.duniter.fr",
"host": "g1.data.brussels.ovh",
"port": 443
},
{
"host": "g1.data.pini.fr",
"port": 443
},
{
"host": "g1.data.mithril.re",
"port": 443
},
{
"host": "g1.data.e-is.pro",
"port": 443
}
],
......@@ -92,8 +147,8 @@ angular.module("cesium.config", [])
"defaultCountry": "France"
}
},
"version": "1.4.2",
"build": "2019-06-26T15:15:47.816Z",
"version": "1.7.14",
"build": "2024-07-18T16:14:19.519Z",
"newIssueUrl": "https://git.duniter.org/clients/cesium-grp/cesium/issues/new"
})
......
angular.module('cesium.controllers', [
'cesium.app.controllers',
'cesium.home.controllers',
'cesium.feed.controllers',
'cesium.join.controllers',
'cesium.login.controllers',
'cesium.help.controllers',
......@@ -12,5 +14,4 @@ angular.module('cesium.controllers', [
'cesium.settings.controllers',
'cesium.network.controllers',
'cesium.blockchain.controllers'
])
;
]);
......@@ -15,21 +15,11 @@ angular.module('cesium.app.controllers', ['cesium.platform', 'cesium.services'])
}
})
.state('app.home', {
url: "/home?error",
views: {
'menuContent': {
templateUrl: "templates/home/home.html",
controller: 'HomeCtrl'
}
}
})
.state('app.lock', {
cache: false,
url: "/lock",
views: {
'menuContent': {
menuContent: {
templateUrl: "templates/common/view_passcode.html",
controller: 'PassCodeCtrl'
}
......@@ -37,19 +27,12 @@ angular.module('cesium.app.controllers', ['cesium.platform', 'cesium.services'])
})
;
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/app/home');
})
.controller('AppCtrl', AppController)
.controller('HomeCtrl', HomeController)
.controller('PluginExtensionPointCtrl', PluginExtensionPointController)
;
/**
......@@ -64,7 +47,7 @@ function PluginExtensionPointController($scope, PluginService) {
* Abstract controller (inherited by other controllers)
*/
function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $timeout,
$ionicHistory, $controller, $window, csPlatform, CryptoUtils, csCrypto,
$ionicHistory, $controller, $window, csPlatform, csSettings, CryptoUtils, csCrypto,
UIUtils, BMA, csWallet, Device, Modals, csConfig, csHttp
) {
'ngInject';
......@@ -84,96 +67,24 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $
.then(UIUtils.loading.hide);
};
// removeIf(no-device)
////////////////////////////////////////
// Device only methods
// (code removed when NO device)
////////////////////////////////////////
$scope.scanQrCodeAndGo = function() {
if (!Device.barcode.enable) return;
// Run scan cordova plugin, on device
return Device.barcode.scan()
.then(function(data) {
if (!data) return;
// Try to parse as an URI
return BMA.uri.parse(data)
.then(function(res){
if (!res || !res.pubkey) throw {message: 'ERROR.SCAN_UNKNOWN_FORMAT'};
// If pubkey: open the identity
return $state.go('app.wot_identity', {
pubkey: res.pubkey,
node: res.host ? res.host: null}
);
})
// Not an URI: try WIF or EWIF format
.catch(function(err) {
console.debug("[app] Scan data is not an URI (get error: " + (err && err.message || err) + "). Trying to decode as a WIF or EWIF format...");
// Try to read as WIF format
return csCrypto.keyfile.parseData(data)
.then(function(keypair) {
if (!keypair || !keypair.signPk || !keypair.signSk) throw err; // rethrow the first error (e.g. Bad URI)
var pubkey = CryptoUtils.base58.encode(keypair.signPk);
console.debug("[app] Detected WIF/EWIF format. Will login to wallet {" + pubkey.substring(0, 8) + "}");
// Create a new wallet (if default wallet is already used)
var wallet = !csWallet.isLogin() ? csWallet : csWallet.children.create({store: false});
// Login using keypair
return wallet.login({
silent: true,
forceAuth: true,
minData: false,
authData: {
pubkey: pubkey,
keypair: keypair
}
})
.then(function () {
// Open transfer all wallet
$ionicHistory.nextViewOptions({
historyRoot: true
});
return $state.go('app.new_transfer', {
all: true, // transfer all sources
wallet: !wallet.isDefault() ? wallet.id : undefined
});
});
})
// Unknown format (nor URI, nor WIF/EWIF)
.catch(UIUtils.onError('ERROR.SCAN_UNKNOWN_FORMAT'));
});
})
.catch(UIUtils.onError('ERROR.SCAN_FAILED'));
};
////////////////////////////////////////
// End of device only methods
////////////////////////////////////////
// endRemoveIf(no-device)
////////////////////////////////////////
// Show Help tour
////////////////////////////////////////
$scope.createHelptipScope = function(isTour, helpController) {
$scope.createHelptipScope = function(isTour, ctrlName) {
if (!isTour && ($rootScope.tour || !$rootScope.settings.helptip.enable || UIUtils.screen.isSmall())) {
return; // avoid other helptip to be launched (e.g. csWallet)
}
ctrlName = ctrlName || 'HelpTipCtrl';
// Create a new scope for the tour controller
var helptipScope = $scope.$new();
$controller(helpController||'HelpTipCtrl', { '$scope': helptipScope});
$controller(ctrlName, { '$scope': helptipScope});
return helptipScope;
};
$scope.startHelpTour = function(helpController, skipClearCache) {
$scope.startHelpTour = function(event, skipClearCache) {
if (event && event.defaultPrevented) return false; // Event stopped;
$rootScope.tour = true; // to avoid other helptip to be launched (e.g. csWallet)
// Clear cache history
......@@ -181,11 +92,11 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $
$ionicHistory.clearHistory();
return $ionicHistory.clearCache()
.then(function() {
$scope.startHelpTour(helpController, true/*continue*/);
$scope.startHelpTour(null, true/*continue*/);
});
}
var helptipScope = $scope.createHelptipScope(true/*is tour*/, helpController);
var helptipScope = $scope.createHelptipScope(true/*is tour*/);
return helptipScope.startHelpTour()
.then(function() {
helptipScope.$destroy();
......@@ -196,6 +107,19 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $
});
};
$scope.disableHelpTour = function(event) {
if (event) {
event.preventDefault();
event.stopPropagation();
}
if (csSettings.data.helptip && csSettings.data.helptip.enable) {
$rootScope.settings.helptip.enable = false;
csSettings.store();
}
};
////////////////////////////////////////
// Login & wallet
////////////////////////////////////////
......@@ -280,8 +204,8 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $
if (csConfig.httpsMode && $window.location && $window.location.protocol !== 'https:') {
var href = $window.location.href;
var hashIndex = href.indexOf('#');
var rootPath = (hashIndex != -1) ? href.substr(0, hashIndex) : href;
rootPath = 'https' + rootPath.substr(4);
var rootPath = (hashIndex !== -1) ? href.substring(0, hashIndex) : href;
rootPath = 'https' + rootPath.substring(4);
href = rootPath + $state.href(state);
if (csConfig.httpsModeDebug) {
// Debug mode: just log, then continue
......@@ -344,10 +268,10 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $
});
}
else {
UIUtils.loading.hide(10);
}
})
.catch(UIUtils.onError());
.catch(UIUtils.onError('ERROR.LOGOUT'));
};
// Do authentification
$scope.doAuth = function(options) {
......@@ -427,6 +351,7 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $
$timeout(function(){$scope.profilePopover.hide();});
}
};
// Change peer info
$scope.showPeerInfoPopover = function(event) {
return UIUtils.popover.show(event, {
......@@ -437,13 +362,23 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $
};
////////////////////////////////////////
// Link management (fix issue #)
// Link management
////////////////////////////////////////
$scope.openLink = function($event, uri, options) {
// WARN: publish to root scope, to make sure popover (with new scope) can use it
$rootScope.openLink = function($event, uri, options) {
$event.stopPropagation();
$event.preventDefault();
// Read URL like '@UID' (Used by home page, in feed's author url)
if (uri && uri.startsWith('@')) {
var uid = uri.substr(1);
if (BMA.regexp.USER_ID.test(uid)) {
$state.go('app.wot_identity_uid', {uid: uid});
return false;
}
}
options = options || {};
// If unable to open, just copy value
......@@ -456,6 +391,159 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $
return false;
};
/**
* Parse an external URI (see g1lien), and open the expected state
* @param uri
* @param reject optional function, to avoid error to be displayed
* @returns {*}
*/
$scope.handleUri = function(uri, reject) {
if (!uri) return $q.when(); // Skip
console.info('[app] Trying to parse as uri: ', uri);
var fromHomeState = $state.current && $state.current.name === 'app.home';
return (!csPlatform.isStarted() ? csPlatform.ready() : $q.when())
// Parse the URI
.then(function() {
return BMA.uri.parse(uri);
})
.then(function(res) {
if (!res) throw {message: 'ERROR.UNKNOWN_URI_FORMAT'}; // Continue
if (res.pubkey) {
var action = res.params && (angular.isDefined(res.params.amount) || res.params.comment) ? 'transfer' : undefined;
console.info('[app] Redirecting from URI to identity {{0}} {1} {2}'.format(
res.pubkey.substring(0,8),
action ? ('with action ' + action) : '',
res.params ? JSON.stringify(res.params) : ''
), uri);
// Redirect to an owned wallet
if (!action && (csWallet.isUserPubkey(res.pubkey) || csWallet.children.hasPubkey(res.pubkey))) {
var wallet = csWallet.getByPubkey(res.pubkey);
return $state.go('app.view_wallet_by_id', {id: wallet.id});
}
else {
return $state.go('app.wot_identity',
angular.merge({
pubkey: res.pubkey,
action: action
}, res.params),
{reload: true});
}
}
else if (res.uid) {
return $state.go('app.wot_identity_uid',
angular.merge({
uid: res.uid,
action: res.params && res.params.amount ? 'transfer' : undefined
}, res.params),
{reload: true});
}
else if (angular.isDefined(res.block)) {
return $state.go('app.view_block',
angular.merge(res.block, res.params),
{reload: true});
}
// Default: wot lookup
else {
console.warn('[app] TODO implement state redirection from URI result: ', res, uri);
return $state.go('app.wot_lookup.tab_search',
{q: uri},
{reload: true});
}
})
// After state change
.then(function() {
if (fromHomeState) {
// Wait 500ms, then remove /app/home?uri from the history
// to make sure the back button will work fine
return $timeout(function () {
if ($ionicHistory.backView()) $ionicHistory.removeBackView();
}, 500);
}
})
.catch(function(err) {
if (reject) {
reject(err);
return;
}
console.error("[home] Error while handle uri '{0}'".format(uri), JSON.stringify(err));
return UIUtils.onError(uri)(err);
});
};
/**
* Try to parse as auth data (e.g. WIF/EWIF format)
* @param data
* @param reject optional function, to avoid error to be displayed
* @returns {*}
*/
$scope.handleAuthData = function(data, reject) {
console.debug("[app] Trying to parse as a auth data (WIF, EWIF)...");
return csCrypto.keyfile.parseData(data)
.then(function (keypair) {
if (!keypair || !keypair.signPk || !keypair.signSk) throw err; // rethrow the first error (e.g. Bad URI)
var pubkey = CryptoUtils.base58.encode(keypair.signPk);
console.debug("[app] Detected WIF/EWIF format. Will login to wallet {" + pubkey.substring(0, 8) + "}");
// Create a new wallet (if default wallet is already used)
var wallet = !csWallet.isLogin() ? csWallet : csWallet.children.create({store: false});
// Login using keypair
return wallet.login({
silent: true,
forceAuth: true,
minData: false,
authData: {
pubkey: pubkey,
keypair: keypair
}
})
.then(function () {
// Open transfer all wallet
$ionicHistory.nextViewOptions({
historyRoot: true
});
return $state.go('app.new_transfer', {
all: true, // transfer all sources
wallet: !wallet.isDefault() ? wallet.id : undefined
});
});
})
.catch(function(err) {
if (reject) {
reject(err);
return;
}
console.error("[home] Error while handle auth data", err);
return UIUtils.onError('ERROR.AUTH_INVALID_FILE')(err);
});
};
$scope.registerProtocolHandlers = function() {
if (csConfig.demo) return; // Skip if demo
var protocols = ['web+june'];
_.each(protocols, function(protocol) {
console.debug("[app] Registering protocol '{0}'...".format(protocol));
try {
navigator.registerProtocolHandler(protocol, "#/app/home?uri=%s", "Cesium");
}
catch(err) {
console.error("[app] Error while registering protocol '{0}'".format(protocol), err);
}
});
};
////////////////////////////////////////
// Layout Methods
////////////////////////////////////////
......@@ -481,85 +569,122 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $
var skip = $scope.fullscreen || !UIUtils.screen.isSmall() || !Device.isWeb();
if (skip) return;
return UIUtils.alert.confirm('CONFIRM.FULLSCREEN', null, {
// Already ask
if (csSettings.data.useFullscreen === false) {
$scope.toggleFullscreen(false);
return;
}
// User already say 'yes' => need o ask again (chrome will avoid changed if no gesture has been done)
//if (csSettings.data.useFullscreen === true) {
// $scope.toggleFullscreen(true);
// return;
//}
return UIUtils.alert.confirm('CONFIRM.FULLSCREEN', undefined, {
cancelText: 'COMMON.BTN_NO',
okText: 'COMMON.BTN_YES'
})
.then(function(confirm) {
if (!confirm) return;
$scope.toggleFullscreen();
$scope.toggleFullscreen(confirm);
});
};
$scope.toggleFullscreen = function() {
$scope.fullscreen = !UIUtils.screen.fullscreen.isEnabled();
$scope.toggleFullscreen = function(enable, options) {
enable = angular.isDefined(enable) ? enable : !UIUtils.screen.fullscreen.isEnabled();
$scope.fullscreen = enable;
if (enable !== UIUtils.screen.fullscreen.isEnabled()) {
UIUtils.screen.fullscreen.toggleAll();
};
}
// removeIf(device)
// Ask switching fullscreen
$scope.askFullscreen();
// endRemoveIf(device)
// Save into settings
if ((csSettings.data.useFullscreen !== enable) && (!options || options.emitEvent !== false)) {
csSettings.data.useFullscreen = enable;
return $timeout(csSettings.store, 2000);
}
};
// removeIf(no-device)
////////////////////////////////////////
// Device only methods
// (code removed when NO device)
////////////////////////////////////////
function HomeController($scope, $state, $timeout, $ionicHistory, csPlatform, csCurrency) {
'ngInject';
$scope.scanQrCodeAndGo = function() {
$scope.loading = true;
if (!Device.barcode.enable) return;
$scope.enter = function(e, state) {
if (state && state.stateParams && state.stateParams.error) { // Error query parameter
$scope.error = state.stateParams.error;
$scope.node = csCurrency.data.node;
$scope.loading = false;
$ionicHistory.nextViewOptions({
disableAnimate: true,
disableBack: true,
historyRoot: true
});
$state.go('app.home', {error: undefined}, {
reload: false,
inherit: true,
notify: false});
}
else {
// Start platform
csPlatform.ready()
.then(function() {
$scope.loading = false;
})
.catch(function(err) {
$scope.node = csCurrency.data.node;
$scope.loading = false;
$scope.error = err;
});
}
// Run scan cordova plugin, on device
return Device.barcode.scan()
.then(function(data) {
if (!data) return;
var throwIfError = function (err) {
if (err) throw err;
};
$scope.$on('$ionicView.enter', $scope.enter);
$scope.reload = function() {
$scope.loading = true;
delete $scope.error;
// First, try to handle as an URI
var firstError;
return $scope.handleUri(data, throwIfError)
// If failed
.catch(function(e) {
firstError = e;
console.error("[app] Failed to parse as URI: " + (e && e.message || e));
// Try as an auth data
return $scope.handleAuthData(data, throwIfError);
})
$timeout($scope.enter, 200);
// Both failed
.catch(function(e) {
// Log second error, then display the first error
console.error("[app] Failed to parse as Auth data: " + (e && e.message || e));
return UIUtils.onError('ERROR.SCAN_UNKNOWN_FORMAT')(firstError);
});
});
};
/**
* Catch click for quick fix
* @param event
* Process launch intent, as it could have been triggered BEFORE addListeners()
* @returns {*}
*/
$scope.doQuickFix = function(event) {
if (event == 'settings') {
$ionicHistory.nextViewOptions({
historyRoot: true
});
$state.go('app.settings');
$scope.processLaunchUri = function() {
return Device.intent.last()
.then(function(intent) {
if (intent) {
Device.intent.clear();
return $scope.handleUri(intent);
}
});
};
// For DEV ONLY
/*$timeout(function() {
$scope.loginAndGo();
}, 500);*/
// Listen for new intent
Device.api.intent.on.new($scope, $scope.handleUri);
$scope.processLaunchUri();
////////////////////////////////////////
// End of device only methods
////////////////////////////////////////
// endRemoveIf(no-device)
// removeIf(device)
////////////////////////////////////////
// NOT-Device only methods (web or desktop)
// (code removed when build for device - eg. Android, iOS)
////////////////////////////////////////
// Ask switching fullscreen
$scope.askFullscreen();
// Register protocol handlers
$scope.registerProtocolHandlers();
////////////////////////////////////////
// End of NOT-device only methods
////////////////////////////////////////
// endRemoveIf(device)
}
......@@ -30,7 +30,7 @@ angular.module('cesium.blockchain.controllers', ['cesium.services'])
})
.state('app.server_blockchain', {
url: "/network/peer/:server/blockchain?ssl&tor",
url: "/network/peer/:server/blockchain?ssl&tor&path",
views: {
'menuContent': {
templateUrl: "templates/blockchain/lookup.html",
......@@ -43,7 +43,7 @@ angular.module('cesium.blockchain.controllers', ['cesium.services'])
})
.state('app.server_blockchain_lg', {
url: "/network/peer/:server/blockchain/lg?ssl&tor",
url: "/network/peer/:server/blockchain/lg?ssl&tor&path",
views: {
'menuContent': {
templateUrl: "templates/blockchain/lookup_lg.html",
......@@ -73,7 +73,7 @@ angular.module('cesium.blockchain.controllers', ['cesium.services'])
})
.state('app.view_server_block_hash', {
url: "/network/peer/:server/block/:number/:hash?ssl&tor",
url: "/network/peer/:server/block/:number/:hash?ssl&tor&path",
views: {
'menuContent': {
templateUrl: "templates/blockchain/view_block.html",
......@@ -127,27 +127,32 @@ function BlockLookupController($scope, $timeout, $focus, $filter, $state, $ancho
if (state && state.stateParams && state.stateParams.server) {
var useSsl = state.stateParams.ssl == "true";
var useTor = state.stateParams.tor == "true";
var path = state.stateParams.path || '';
var node = {
server: state.stateParams.server,
host: state.stateParams.server,
path: path,
useSsl: useSsl,
useTor: useTor
};
var serverParts = state.stateParams.server.split(':');
if (serverParts.length == 2) {
var serverParts = state.stateParams.server.split(':', 2);
if (serverParts.length === 2) {
node.host = serverParts[0];
node.port = serverParts[1];
}
else {
node.port = node.port || (node.useSsl ? 443 : 80);
}
if (BMA.node.same(node.host, node.port)) {
if (BMA.node.same(node)) {
$scope.node = BMA;
}
else {
$scope.node = useTor ?
// For TOR, use a web2tor to access the endpoint
BMA.instance(node.host + ".to", 443, true/*ssl*/, 600000 /*long timeout*/) :
BMA.instance(node.host, node.port, node.useSsl);
BMA.instance(node.host + ".to", 443, node.path, true/*ssl*/, 600000 /*long timeout*/) :
BMA.instance(node.host, node.port, node.path, node.useSsl);
return $scope.node.blockchain.parameters()
.then(function(json) {
$scope.currency = json.currency;
......@@ -227,7 +232,7 @@ function BlockLookupController($scope, $timeout, $focus, $filter, $state, $ancho
// get blocks
if (from === 0) {
promise = $scope.node.blockchain.current()
promise = $scope.node.blockchain.current(false)
.then(function(current) {
var size = current.number < $scope.defaultSizeLimit ? current.number : $scope.defaultSizeLimit;
return $scope.node.blockchain.blocksSlice({count: size, from: current.number-size})
......@@ -331,12 +336,12 @@ function BlockLookupController($scope, $timeout, $focus, $filter, $state, $ancho
$scope.smallscreen = UIUtils.screen.isSmall();
$scope.$broadcast('$$rebind::rebind'); // notify binder
// Set Motion
if (res && res.length) {
$scope.motion.show({selector: '.list-blocks .item-block'});
}
$scope.$broadcast('$$rebind::rebind'); // notify binder
};
$scope.showMore = function() {
......@@ -391,14 +396,14 @@ function BlockLookupController($scope, $timeout, $focus, $filter, $state, $ancho
$scope.onBlock = function(block) {
// Skip if still loading or if filter/sort is not the default (not last blocks)
if ($scope.search.loading || $scope.search.type != 'last' ||
($scope.search.sort && $scope.search.sort != 'desc')) return; // skip
if ($scope.search.loading || $scope.search.type !== 'last' ||
($scope.search.sort && $scope.search.sort !== 'desc')) return; // skip
// Make sure results is init
$scope.search.results = $scope.search.results || [];
if (!$scope.search.results.length) {
console.debug('[ES] [blockchain] new block #{0} received (by websocket)'.format(block.number));
console.debug('[blockchain] new block #{0} received (by websocket)'.format(block.number));
// add it to result
$scope.search.total++;
$scope.search.results.push(block);
......@@ -415,8 +420,8 @@ function BlockLookupController($scope, $timeout, $focus, $filter, $state, $ancho
// replace existing block (fork could have replaced previous block)
if (existingBlock) {
if (existingBlock.hash != block.hash) {
console.debug('[ES] [blockchain] block #{0} updated (by websocket)'.format(block.number));
if (existingBlock.hash !== block.hash) {
console.debug('[blockchain] block #{0} updated (by websocket)'.format(block.number));
// Replace existing content
angular.copy(block, existingBlock);
// Prepare the new block, then show it
......@@ -427,7 +432,7 @@ function BlockLookupController($scope, $timeout, $focus, $filter, $state, $ancho
}
}
else {
console.debug('[ES] [blockchain] new block #{0} received (by websocket)'.format(block.number));
console.debug('[blockchain] new block #{0} received (by websocket)'.format(block.number));
// Insert at index 0
$scope.search.total++;
$scope.search.results.splice(0, 0, block);
......@@ -454,7 +459,7 @@ function BlockLookupController($scope, $timeout, $focus, $filter, $state, $ancho
$anchorScroll('block-' + block.number);
}, 900);
}
else if (BMA.node.same($scope.node.host, $scope.node.port)) {
else if (BMA.node.same($scope.node)) {
$state.go('app.view_block_hash', {number: block.number, hash: block.hash});
}
else {
......@@ -521,27 +526,32 @@ function BlockViewController($scope, $ionicPopover, $state, UIUtils, BMA, csCurr
if (state.stateParams && state.stateParams.server) {
var useSsl = state.stateParams.ssl == "true";
var useTor = state.stateParams.tor == "true";
var path = state.stateParams.path || '';
var node = {
server: state.stateParams.server,
host: state.stateParams.server,
path: path,
useSsl: useSsl,
useTor: useTor
};
var serverParts = state.stateParams.server.split(':');
var serverParts = state.stateParams.server.split(':', 2);
if (serverParts.length == 2) {
node.host = serverParts[0];
node.port = serverParts[1];
}
else {
node.port = node.port || (node.useSsl ? 443 : 80);
}
if (BMA.node.same(node.host, node.port)) {
if (BMA.node.same(node)) {
$scope.node = BMA;
}
else {
$scope.node = useTor ?
// For TOR, use a web2tor to access the endpoint
BMA.instance(node.host + ".to", 443, true/*ssl*/, 600000 /*long timeout*/) :
BMA.instance(node.host, node.port, node.useSsl);
BMA.instance(node.host + ".to", 443, node.path, true/*ssl*/, 600000 /*long timeout*/) :
BMA.instance(node.host, node.port, node.path, node.useSsl);
return $scope.node.blockchain.parameters()
.then(function (json) {
$scope.currency = json.currency;
......