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

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
Show changes
Commits on Source (7)
......@@ -25,3 +25,4 @@
/hooks/playstore-config.json
.directory
www/js/config.js
\ No newline at end of file
......@@ -185,7 +185,7 @@
},
"plugins":{
"es": {
"enable": true,
"enable": false,
"askEnable": false,
"host": "localhost",
"port": 9200,
......
......@@ -351,6 +351,7 @@
"WOT_PENDING_INVALID_BLOCK_HASH": "Membership not valid.",
"WALLET_INVALID_BLOCK_HASH": "Your membership application is no longer valid (because it references a block that network nodes are cancelled).<br/>You must <a ng-click=\"doQuickFix('renew')\">renew your application for membership</a> to fix this issue.",
"WALLET_IDENTITY_EXPIRED": "The publication of your identity <b>has expired</b>.<br/>You must <a ng-click=\"doQuickFix('fixIdentity')\">re-issue your identity</a> to resolve this issue.",
"WALLET_HAS_NO_SELF": "Your identity must first have been published, and not expired.",
"IDENTITY_ALREADY_CERTIFY": "You have <b>already certified</b> that identity.<br/><br/>Your certificate is still valid (expires {{expiresIn|formatDuration}}).",
"IDENTITY_ALREADY_CERTIFY_PENDING": "You have <b>already certified</b> that identity.<br/><br/>Your certification is still pending (Deadline for treatment {{expiresIn|formatDuration}}).",
"UNABLE_TO_CERTIFY_TITLE": "Unable to certify",
......@@ -402,7 +403,7 @@
"UNIVERSAL_DIVIDEND_DEF": "(TODO translate)<br/>Le Dividende Universel (DU) est la quantité de monnaie co-créé par chaque membre, suivant la période et le calcul définie dans les <span class=\"text-italic\">règles de la monnaie</span>.<br/>A chaque échéance, les membres recoivent sur leur compte la meme quantité de nouvelle monnaie.<br/><br/>Le DU subit une croissance régulière, pour rester juste entre les membres (actuels et à venir), calculée en fonction de l'espérance de vie moyenne, telle que démontré dans la Thérorie Relative de la Monnaie (TRM).<br/><a href=\"http://trm.creationmonetaire.info\">En savoir plus sur la TRM</a> et les monnaies libres."
},
"TIP": {
"MENU_BTN_CURRENCY": "(TODO translate)<br/>Le menu <b>{{'MENU.CURRENCY'|translate}}</b> permet la consultation des <b>règles de la monnaie</b> et de son état.",
"MENU_BTN_CURRENCY": "Menu <b>{{'MENU.CURRENCY'|translate}}</b> allow to discover <b>currency rules</b> and state.",
"CURRENCY_WOT": "(TODO translate)<br/>Le <b>nombre de membres</b> montre l'importance de la communauté et permet de <b>suivre son évolution</b>.",
"CURRENCY_MASS": "(TODO translate)<br/>Suivez ici la <b>quantité totale de monnaie</b> existante et sa <b>répartition moyenne</b> par membre.<br/><br/>Ceci permet de juger de l'<b>importance d'un montant</b>, vis à vis de ce que <b>possède les autres</b> sur leur compte (en moyenne).",
"CURRENCY_UNIT_RELATIVE": "(TODO translate)<br/>L'unité utilisée (&ldquo;<b>{{'COMMON.UD'|translate}}<sub>{{currency|abbreviate}}</sub></b>&rdquo;) signifie que les montants en {{currency|capitalize}} ont été divisés par le <b>Dividende Universel</b> (DU).<br/><br/><small>Cette unité relative est <b>pertinente</b>, car stable malgré la quantitié de monnaie qui augmente en permanence.</small>",
......
......@@ -351,6 +351,7 @@
"WOT_PENDING_INVALID_BLOCK_HASH": "Adhésion non valide.",
"WALLET_INVALID_BLOCK_HASH": "Votre demande d'adhésion n'est plus valide (car elle référence un bloc que les noeuds du réseau ont annulé).<br/>Vous devez <a ng-click=\"doQuickFix('fixMembership')\">envoyer une nouvelle demande</a> pour résoudre ce problème.",
"WALLET_IDENTITY_EXPIRED": "La publication de <b>votre identité a expirée</b>.<br/>Vous devez <a ng-click=\"doQuickFix('fixIdentity')\">publier à nouveau votre identité</a> pour résoudre ce problème.",
"WALLET_HAS_NO_SELF": "Votre identité doit d'abord avoir été publiée, et ne pas être expirée.",
"IDENTITY_ALREADY_CERTIFY": "Vous avez <b>déjà certifié</b> cette identité.<br/><br/>Cette certification est encore valide (expiration {{expiresIn|formatDurationTo}}).",
"IDENTITY_ALREADY_CERTIFY_PENDING": "Vous avez <b>déjà certifié</b> cette identité.<br/><br/>Cette certification est en attente de traitement (date limite de traitement {{expiresIn|formatDurationTo}}).",
"UNABLE_TO_CERTIFY_TITLE": "Certification impossible",
......
......@@ -5,7 +5,7 @@ angular.module('cesium.wot.controllers', ['cesium.services'])
$stateProvider
.state('app.wot_lookup', {
url: "/wot?q&newcomers",
url: "/wot?q&newcomers&pendings",
views: {
'menuContent': {
templateUrl: "templates/wot/lookup.html",
......@@ -95,7 +95,7 @@ function WotLookupController($scope, BMA, $state, UIUtils, $timeout, csConfig, c
};
$scope.entered = false;
$scope.wotSearchTextId = 'wotSearchText';
$scope.enableFilter = !csConfig.initPhase; // disable filter on init phase
$scope.enableFilter = true;
$scope.$on('$ionicView.enter', function(e, state) {
if (!$scope.entered) {
......@@ -105,9 +105,15 @@ function WotLookupController($scope, BMA, $state, UIUtils, $timeout, csConfig, c
$scope.doSearch();
}, 100);
}
else { // get new comers
else {
$timeout(function() {
// get new comers
if (!csConfig.initPhase || state.stateParams.newcomers) {
$scope.doGetNewcomers(0, state.stateParams.newcomers);
}
else {
$scope.doGetPending(0, state.stateParams.pendings);
}
}, 100);
}
// removeIf(device)
......@@ -165,10 +171,7 @@ function WotLookupController($scope, BMA, $state, UIUtils, $timeout, csConfig, c
$scope.search.loading = (offset === 0);
$scope.search.type = 'newcomers';
var searchFunction = csConfig.initPhase ?
csWot.all :
csWot.newcomers;
return searchFunction(offset, size)
return csWot.newcomers(offset, size)
.then(function(idties){
if ($scope.search.type != 'newcomers') return false; // could have change
$scope.doDisplayResult(idties, offset, size);
......@@ -191,7 +194,11 @@ function WotLookupController($scope, BMA, $state, UIUtils, $timeout, csConfig, c
$scope.search.loading = (offset === 0);
$scope.search.type = 'pending';
return csWot.pending(offset, size)
var searchFunction = csConfig.initPhase ?
csWot.all :
csWot.pending;
return searchFunction(offset, size)
.then(function(idties){
if ($scope.search.type != 'pending') return false; // could have change
$scope.doDisplayResult(idties, offset, size);
......
......@@ -34,8 +34,9 @@ angular.module('cesium.bma.services', ['ngResource', 'cesium.http.services', 'ce
TX_ALREADY_PROCESSED: 2030
},
constants = {
PROTOCOL_VERSION: 10,
ROOT_BLOCK_HASH: 'E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855',
LIMIT_REQUEST_COUNT: 5, // simultaneous async call of on rest request
LIMIT_REQUEST_COUNT: 5, // simultaneous async request to a Duniter node
LIMIT_REQUEST_DELAY: 1000 // time (in second) to wait between to call of a rest request
};
......
......@@ -10,7 +10,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser
var
constants = {
STORAGE_KEY: "CESIUM_DATA"
STORAGE_KEY: 'CESIUM_DATA'
},
data = {},
......@@ -1085,7 +1085,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser
});
}
var tx = 'Version: 3\n' +
var tx = 'Version: '+ BMA.constants.PROTOCOL_VERSION +'\n' +
'Type: Transaction\n' +
'Currency: ' + data.currency + '\n' +
'Blockstamp: ' + block.number + '-' + block.hash + '\n' +
......@@ -1228,18 +1228,39 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser
});
},
getIdentityDocument = function(uid, blockUid) {
uid = uid || data.uid;
blockUid = blockUid || data.blockUid;
if (!uid || !blockUid) {
throw {message: 'ERROR.WALLET_HAS_NO_SELF'};
}
if (data.requirements && data.requirements.expired) {
throw {message: 'ERROR.WALLET_IDENTITY_EXPIRED'};
}
var identity = 'Version: '+ BMA.constants.PROTOCOL_VERSION +'\n' +
'Type: Identity\n' +
'Currency: ' + data.currency + '\n' +
'Issuer: ' + data.pubkey + '\n' +
'UniqueID: ' + uid + '\n' +
'Timestamp: ' + blockUid + '\n';
return CryptoUtils.sign(identity, data.keypair)
.then(function(signature) {
identity += signature + '\n';
console.debug('Has generate an identity document:\n----\n' + identity + '----');
return identity;
});
},
/**
* Send self identity
*/
self = function(uid, needToLoadRequirements) {
return $q(function(resolve, reject) {
if (!BMA.regex.USER_ID.test(uid)){
reject({message:'ERROR.INVALID_USER_ID'}); return;
throw new Error('ERROR.INVALID_USER_ID');
}
var block;
var identity;
$q.all([
return $q.all([
// check uid used by another pubkey
checkUidNotExists(uid, data.pubkey),
......@@ -1261,53 +1282,37 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser
}
})
])
// Create identity document to sign
.then(function() {
identity = 'Version: 2\n' +
'Type: Identity\n' +
'Currency: ' + data.currency + '\n' +
'Issuer: ' + data.pubkey + '\n' +
'UniqueID: ' + uid + '\n' +
'Timestamp: ' + block.number + '-' + block.hash + '\n';
return CryptoUtils.sign(identity, data.keypair);
// Create identity document
.then(function() {
return getIdentityDocument(uid, block.number + '-' + block.hash);
})
// Add signature
.then(function (signature) {
var signedIdentity = identity + signature + '\n';
// Send to node
return BMA.wot.add({identity: signedIdentity})
.then(function (result) {
.then(function (identity) {
return BMA.wot.add({identity: identity});
})
.then(function () {
if (!!needToLoadRequirements) {
// Refresh membership data (if need)
loadRequirements()
.then(function () {
resolve();
}).catch(function (err) {
reject(err);
});
return loadRequirements();
}
else {
data.uid = uid;
data.blockUid = block.number + '-' + block.hash;
resolve();
}
})
.catch(function (err) {
if (err && err.ucode === BMA.errorCodes.IDENTITY_SANDBOX_FULL) {
reject({ucode: BMA.errorCodes.IDENTITY_SANDBOX_FULL, message: 'ERROR.IDENTITY_SANDBOX_FULL'});
return;
throw {ucode: BMA.errorCodes.IDENTITY_SANDBOX_FULL, message: 'ERROR.IDENTITY_SANDBOX_FULL'};
}
reject(err);
});
}).catch(function (err) {
reject(err);
});
throw err;
});
},
/**
* Send membership (in)
* Send membership (in or out)
*/
membership = function(sideIn) {
return function() {
......@@ -1322,7 +1327,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser
})
.then(function(block) {
// Create membership to sign
membership = 'Version: 2\n' +
membership = 'Version: '+ BMA.constants.PROTOCOL_VERSION +'\n' +
'Type: Membership\n' +
'Currency: ' + data.currency + '\n' +
'Issuer: ' + data.pubkey + '\n' +
......@@ -1367,7 +1372,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser
.then(function(block) {
current = block;
// Create the self part to sign
cert = 'Version: 2\n' +
cert = 'Version: '+ BMA.constants.PROTOCOL_VERSION +'\n' +
'Type: Certification\n' +
'Currency: ' + data.currency + '\n' +
'Issuer: ' + data.pubkey + '\n' +
......@@ -1412,6 +1417,82 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser
}
},
getRevocationDocument = function() {
// Get current identity document
return getIdentityDocument()
// Create membership document (unsigned)
.then(function(identity){
var identityLines = identity.trim().split('\n');
var idtySignature = identityLines[identityLines.length-1];
var revocation = 'Version: '+ BMA.constants.PROTOCOL_VERSION +'\n' +
'Type: Revocation\n' +
'Currency: ' + data.currency + '\n' +
'Issuer: ' + data.pubkey + '\n' +
'IdtyUniqueID: ' + data.uid + '\n' +
'IdtyTimestamp: ' + data.blockUid + '\n' +
'IdtySignature: ' + idtySignature + '\n';
// Sign revocation document
return CryptoUtils.sign(revocation, data.keypair)
// Add revocation to document
.then(function(signature) {
revocation += signature + '\n';
console.debug('Has generate an revocation document:\n----\n' + revocation + '----');
return revocation;
});
});
}
/**
* Send a revocation
*/
revocation = function() {
if (!data.uid || !data.blockUid) {
throw {message: 'ERROR.WALLET_TO_REVOKE_HAS_NO_SELF'};
}
var revocation;
// Get identity signature
return getIdentityDocument(data.uid, data.blockUid)
// Create membership document (unsigned)
.then(function(identity){
var identityLines = identity.trim().split('\n');
var idtySignature = identityLines[identityLines.length-1];
revocation = 'Version: '+ BMA.constants.PROTOCOL_VERSION +'\n' +
'Type: Revocation\n' +
'Currency: ' + data.currency + '\n' +
'Issuer: ' + data.pubkey + '\n' +
'IdtyUniqueID: ' + data.uid + '\n' +
'IdtyTimestamp: ' + data.blockUid + '\n' +
'IdtySignature: ' + idtySignature + '\n';
// Sign revocation document
return CryptoUtils.sign(revocation, data.keypair);
})
// Send signed revocation
.then(function(signature) {
var signedRevocation = revocation + signature + '\n';
return BMA.blockchain.membership({membership: signedRevocation});
})
.then(function() {
return $timeout(function() {
return loadRequirements();
}, 1000); // waiting for node to process membership doc
})
.then(function() {
finishLoadRequirements();
});
},
cleanEventsByContext = function(context){
data.events = data.events.reduce(function(res, event) {
if (event.context && event.context == context) return res;
......
......@@ -490,7 +490,7 @@ function ESMessageViewController($scope, $state, $timeout, $translate, $ionicHis
};
}
function PopoverMessageController($scope, $timeout, UIUtils, $state, esNotification, esMessage, esModals) {
function PopoverMessageController($scope, $timeout, UIUtils, $state, csWallet, esNotification, esMessage, esModals) {
'ngInject';
var defaultSearchLimit = 40;
......@@ -571,9 +571,16 @@ function PopoverMessageController($scope, $timeout, UIUtils, $state, esNotificat
$scope.closePopover(notification);
};
if ($scope.search.loading) {
$scope.load();
}
$scope.resetData = function() {
if ($scope.search.loading) return;
console.debug("[ES] [messages] Resetting data (settings or account may have changed)");
$scope.search.hasMore = false;
$scope.search.results = [];
$scope.search.loading = true;
delete $scope.search.limit;
};
csWallet.api.data.on.logout($scope, $scope.resetData);
/* -- Modals -- */
......@@ -586,4 +593,10 @@ function PopoverMessageController($scope, $timeout, UIUtils, $state, esNotificat
};
esNotification.api.data.on.new($scope, $scope.onNewNotification);
/* -- default popover action -- */
if ($scope.search.loading) {
$scope.load();
}
}
......@@ -135,17 +135,16 @@ function NotificationsController($scope, $rootScope, $timeout, UIUtils, $state,
};
esNotification.api.data.on.new($scope, $scope.onNewNotification);
// Listen settings changes
$scope.onSettingsChanged = function() {
$scope.resetData = function() {
if ($scope.search.loading) return;
console.debug("[ES] [notifications] Force to reload (on next enter) as settings changed...");
console.debug("[ES] [notifications] Resetting data (settings or account may have changed)");
$scope.search.hasMore = false;
$scope.search.results = [];
$scope.search.loading = true;
delete $scope.search.limit;
};
csSettings.api.data.on.changed($scope, $scope.onSettingsChanged);
// When logout: force reload
csWallet.api.data.on.logout($scope, $scope.resetData);
}
function PopoverNotificationsController($scope, $rootScope, $timeout, UIUtils, $state, csWallet, esNotification, csSettings) {
......
......@@ -47,11 +47,6 @@
<i ng-if="!formData.avatar" class="item-image" ng-class="{'ion-person': formData.uid, 'ion-email': !formData.uid}"></i>
<i ng-if="formData.avatar" class="item-image avatar" style="background-image: url({{::formData.avatar.src}})"></i>
<i
ng-style="formData.avatarStyle"></i>
<i ng-class="{'item-image ion-person': formData.uid && !formData.avatarStyle, 'item-image ion-email': !formData.uid && !formData.avatarStyle, 'avatar': formData.avatarStyle}"
ng-style="formData.avatarStyle"></i>
<h1 class="title" ng-bind-html="formData.title"></h1>
<h4>
<i class="ion-clock"></i>
......
......@@ -18,12 +18,6 @@
<span class="badge badge-stable">{{difficulty | formatInteger}}</span>
</ion-item>
<ion-item class="item-icon-left">
<i class="icon ion-steam"></i>
<span translate>CURRENCY.VIEW.XPERCENT</span>
<span class="badge badge-stable">{{xpercent}}</span>
</ion-item>
<div id="helptip-currency-peers"
class="item item-divider item-icon-right">
{{'PEER.PEERS'|translate}}
......
......@@ -115,4 +115,10 @@
<span class="badge badge-stable">{{stepMax}}</span>
</ion-item>
<ion-item class="item-icon-left">
<i class="icon ion-pull-request"></i>
<span translate>CURRENCY.VIEW.XPERCENT</span>
<span class="badge badge-stable">{{xpercent}}</span>
</ion-item>
</ion-list>