diff --git a/gulpfile.js b/gulpfile.js index 88dbd2554dde6224c9bca0b90027b5db093c8b3a..97bce917a71156798e36f6da51d768c01f4b92a9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -172,7 +172,7 @@ function appConfig() { .pipe(gulp.dest('www/js')); } -function appAndPluginLint(done) { +function appAndPluginLint() { log(colors.green('Linting JS files...')); // Copy Js (and remove unused code) @@ -185,8 +185,8 @@ function appAndPluginLint(done) { console.error('jshint failed'); process.exit(1); } - })) - .on('end', done); + cb(); + })); } function appNgTemplate() { diff --git a/www/js/config.js b/www/js/config.js index f994d780f0e02360ab4e1da4f238be32192af4b7..2388dde64efba4d05ad93ffab7e7ab026863fb2b 100644 --- a/www/js/config.js +++ b/www/js/config.js @@ -12,10 +12,10 @@ angular.module("cesium.config", []) "cacheTimeMs": 300000, "demo": false, "readonly": false, - "fallbackLanguage": "en", + "fallbackLanguage": "fr", "rememberMe": true, "showUDHistory": true, - "timeout": 40000, + "timeout": 300000, "timeWarningExpireMembership": 5184000, "timeWarningExpire": 7776000, "keepAuthIdle": 600, @@ -74,14 +74,16 @@ angular.module("cesium.config", []) "port": 443 }, { - "host": "g1.duniter.org", + "host": "g1.le-sou.org", "port": 443 - } - ], - "developers": [ + }, + { + "host": "duniter.normandie-libre.fr", + "port": 443 + }, { - "name": "Benoit Lavenier", - "pubkey": "38MEAZN68Pz1DTvT3tqgxx4yQP6snJCQhPqEFxbDk4aE" + "host": "g1.duniter.org", + "port": 443 } ], "plugins": { @@ -96,6 +98,10 @@ angular.module("cesium.config", []) "host": "g1.data.presles.fr", "port": 443 }, + { + "host": "g1.data.le-sou.org", + "port": 443 + }, { "host": "g1.data.mithril.re", "port": 443 @@ -111,7 +117,7 @@ angular.module("cesium.config", []) } }, "version": "1.7.0-rc1", - "build": "2023-02-25T12:43:28.681Z", + "build": "2023-02-25T14:10:19.689Z", "newIssueUrl": "https://git.duniter.org/clients/cesium-grp/cesium/issues/new" }) diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index 47d82ee1997708bc465eed2e3e29afdb92edf96b..a4d6638da80e2a139fffcb21b1d45569764eea20 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -307,9 +307,9 @@ function WotLookupController($scope, $state, $q, $timeout, $focus, $location, $i var checksum = matches[2]; var expectedChecksum = csCrypto.util.pkChecksum(pubkey); if (checksum === expectedChecksum) { - console.debug("[wot] checksum {" + checksum + "} valid for pubkey {" + pubkey + "}") - text = pubkey - pubkeyWithCk = pubkey + ':' + checksum + console.debug("[wot] checksum {" + checksum + "} valid for pubkey {" + pubkey + "}"); + text = pubkey; + pubkeyWithCk = pubkey + ':' + checksum; } } @@ -788,10 +788,10 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ // Prepare actions after user confirmation var answers_are_right = $q.defer(); answers_are_right.promise.then( function (cert_status) { - return $scope.showLicenseReminderIfNewCert(cert_status) + return $scope.showLicenseReminderIfNewCert(cert_status); }) .then(function(confirm){ - if (! confirm) {return} + if (!confirm) return; UIUtils.loading.show(); wallet.certify($scope.formData.uid, $scope.formData.pubkey, @@ -816,8 +816,7 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ UIUtils.onError('ACCOUNT.CERTIFICATION_MODAL.CHECKLIST_CONDITIONS_NOT_MET') ); - return $scope.displayConfirmationModalOrLicenseQuestions($scope.formData, wallet, answers_are_right ) - + return $scope.displayConfirmationModalOrLicenseQuestions($scope.formData, wallet, answers_are_right); }) .catch(function(err) { if (err === 'CANCELLED') return; @@ -863,7 +862,7 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ } return true; - } + }; $scope.showLicenseReminderIfNewCert = function (cert_status) { if (cert_status === "new_cert") { @@ -875,22 +874,22 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ okText: 'COMMON.BTN_OK', okType: 'button-positive' } - ) + ); } return true; - } + }; $scope.displayConfirmationModalOrLicenseQuestions = function (certified_idty, sender_wallet, answers_are_right) { if (isCertificationRenewal(certified_idty.received_cert, sender_wallet.data.pubkey)) { - return $scope.certRenewalConfirmationModal(answers_are_right) + return $scope.certRenewalConfirmationModal(answers_are_right); } return Modals.showCertificationCheckList({ answers_are_right: answers_are_right, identity: certified_idty, }); - } + }; $scope.certRenewalConfirmationModal = function (answers_are_right) { return UIUtils.alert.confirm('CONFIRM.CERTIFY_RULES', 'CONFIRM.CERTIFY_RULES_TITLE_UID', { @@ -898,12 +897,12 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ okText: 'WOT.BTN_YES_CERTIFY', okType: 'button-assertive' }) - .then(function (confirm) { - if (confirm) { - answers_are_right.resolve("renewal"); - } - }) - } + .then(function (confirm) { + if (confirm) { + answers_are_right.resolve("renewal"); + } + }); + }; // Select an identity and certify $scope.selectAndCertify = function() { @@ -954,11 +953,11 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ // Prepare actions after user confirmation var answers_are_right = $q.defer(); - answers_are_right.promise.then( function (cert_status) { - return $scope.showLicenseReminderIfNewCert(cert_status) + answers_are_right.promise.then(function (cert_status) { + return $scope.showLicenseReminderIfNewCert(cert_status); }) .then(function(confirm){ - if (! confirm) {return} + if (!confirm) return; UIUtils.loading.show(); // Send certification wallet.certify(identity.uid, @@ -979,11 +978,9 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ }) .catch(UIUtils.onError('ERROR.SEND_CERTIFICATION_FAILED')); }) - .catch( - UIUtils.onError('ACCOUNT.CERTIFICATION_MODAL.CHECKLIST_CONDITIONS_NOT_MET') - ); + .catch(UIUtils.onError('ACCOUNT.CERTIFICATION_MODAL.CHECKLIST_CONDITIONS_NOT_MET')); - return $scope.displayConfirmationModalOrLicenseQuestions(identity, wallet, answers_are_right ) + return $scope.displayConfirmationModalOrLicenseQuestions(identity, wallet, answers_are_right); }) .catch(function (err) { @@ -1510,7 +1507,7 @@ function WotCertificationsViewController($scope, $rootScope, $controller, csSett $scope.identity = parameters.identity; $scope.prepare_cert_checklist = function() { - const original_cert_checklist = [ + var original_cert_checklist = [ { question: 'ACCOUNT.CERTIFICATION_MODAL.QUESTIONS.WELL_KNOWN', expected_answer: true, @@ -1554,21 +1551,12 @@ function WotCertificationsViewController($scope, $rootScope, $controller, csSett }, ]; - // Fisher-Yates shuffle - function shuffle(array) { - for (var i = array.length - 1; i > 0; i--) { - var j = Math.floor(Math.random() * (i + 1)); // random index from 0 to i - var t = array[i]; array[i] = array[j]; array[j] = t - } - return array; - } - return shuffle(original_cert_checklist).slice(0, 5); - } + }; $scope.cert_checklist = $scope.prepare_cert_checklist(); $scope.verifyAnswers = function() { - $scope.cert_checklist.map( question => { + $scope.cert_checklist.map(function(question) { if (question.answer !== question.expected_answer) { // TODO message should be changed. answers_are_right.reject(); @@ -1577,7 +1565,7 @@ function WotCertificationsViewController($scope, $rootScope, $controller, csSett answers_are_right.resolve("new_cert"); $scope.closeModal(); - } + }; } /** @@ -1627,5 +1615,15 @@ function WotSelectPubkeyIdentityModalController($scope, $q, csWot, parameters) { function isCertificationRenewal(identity_current_certs, certifier_pubkey) { return _.find(identity_current_certs, function(certification) { return certification.pubkey === certifier_pubkey; - }) + }); +} + + +// Fisher-Yates shuffle +function shuffle(array) { + for (var i = array.length - 1; i > 0; i--) { + var j = Math.floor(Math.random() * (i + 1)); // random index from 0 to i + var t = array[i]; array[i] = array[j]; array[j] = t; + } + return array; } diff --git a/www/js/services/wot-services.js b/www/js/services/wot-services.js index da5e8b73378c0826f302f3d5c5e44061f3023d14..8011f7361971030dbbd5f69898d852022b687d7d 100644 --- a/www/js/services/wot-services.js +++ b/www/js/services/wot-services.js @@ -859,11 +859,11 @@ angular.module('cesium.wot.services', ['ngApi', 'cesium.bma.services', 'cesium.c // remove CS+ ids that match pubkey regex (considered attacks) - fix #959 idties = idties.filter(function(idty) { if (BMA.regexp.PUBKEY.test(text) || BMA.regexp.PUBKEY_WITH_CHECKSUM.test(text)) { - text_pk = text.split(':')[0] - return idty.pubkey == text_pk + text_pk = text.split(':')[0]; + return idty.pubkey === text_pk; } return true; - }) + }); // Make sure to add uid to new results - fix #488 if (idties.length > lookupResultCount) { diff --git a/www/plugins/es/js/controllers/admin-controllers.js b/www/plugins/es/js/controllers/admin-controllers.js index 4431897bd667e57380046803dc32796dd4707f0c..2c50e9e6ccb1624059cf42aaf841d9ca7535aa96 100644 --- a/www/plugins/es/js/controllers/admin-controllers.js +++ b/www/plugins/es/js/controllers/admin-controllers.js @@ -17,7 +17,7 @@ angular.module('cesium.es.admin.controllers', ['cesium.es.services']) data: { silentLocationChange: true } - }) + }); }) .controller('ESAdminViewLogCtrl', ESAdminViewLogController) @@ -94,7 +94,7 @@ function ESAdminViewLogController($scope, $q, $window, $state, UIUtils, csWot, e node); } return $scope.node; - } + }; $scope.load = function(from, size) { diff --git a/www/plugins/es/js/services/http-services.js b/www/plugins/es/js/services/http-services.js index 1b369887c57b2b04ff5cd9146de7295c1a8abc31..f20aa8d1b62e9f0f9d0dda09e5442c2cdebbc71f 100644 --- a/www/plugins/es/js/services/http-services.js +++ b/www/plugins/es/js/services/http-services.js @@ -801,7 +801,7 @@ angular.module('cesium.es.http.services', ['ngResource', 'ngApi', 'cesium.servic ]) .then(function(res) { var signature = res[1]; - return that.post('/auth')({challenge: challenge, signature: signature, pubkey: wallet.data.pubkey}) + return that.post('/auth')({challenge: challenge, signature: signature, pubkey: wallet.data.pubkey}); }) .then(function(token) { console.info('[ES] Authentication to pod succeed. token: ' + token); @@ -823,7 +823,7 @@ angular.module('cesium.es.http.services', ['ngResource', 'ngApi', 'cesium.servic from: options.from || 0, size: options.size || 20, sort: options.sort || {time: 'desc'} - } + }; return that.post('/log/request/_search')(request) .then(function(res) { return _(res && res.hits && res.hits.hits || []).reduce(function(res, hit) { diff --git a/www/plugins/rml9/plugin-final.js b/www/plugins/rml9/plugin-final.js index 17f21d3f28294030cb19022fbcb17e808d399c09..e01c955ae6fd170d6fbd1165e77a54f15ec0f8bb 100644 --- a/www/plugins/rml9/plugin-final.js +++ b/www/plugins/rml9/plugin-final.js @@ -132,7 +132,7 @@ angular.module('cesium.rml9.plugin', ['ngFileSaver', 'cesium.services']) $translate('RML9.FILE_NAME', {pubkey: $scope.pubkey, currentTime : currentTime}) .then(function(result){ FileSaver.saveAs(file, result); - }) + }); }); };