Commit b7efe477 authored by Éloïs's avatar Éloïs

[enh] big commit with several new features about wot

parent 2be6b2b3
......@@ -11,8 +11,7 @@ YEARS years
SUBMIT_BUTTON submit
DESCRIPTION1 *Every member automatically becomes a referring member as soon as he has emitted <b><u>and</u></b> received Y[n] certifications. (Y[n] = CEILING(N(t)^(1/5))).
DESCRIPTION2 Currently, Y[n] =
CHART_TITLE Évolution du nombre de membres, de membres référents et de membres écrivains de la blockchain sur la période
Evolution count of members, referring members and of members writers of the blockchain over the period
CHART_TITLE Evolution count of members, referring members and of members writers of the blockchain over the period
SHOW_POW_MIN Show evolution of common difficulty network (proof of work)
Afficher l'évolution de la difficulté commune du réseau (preuve de travail)
MEMBERS_COUNT members
......
......@@ -4,14 +4,37 @@ SORT_BY_EXPIRE_MEMBERSHIP expire membership time
SORT_LAST_RENEWAL last renewal time
SORT_BY_OLDEST_SIG oldest sig time
SORT_BY_LAST_SIG last sig time
SORT_BY_CENTRALITY centrality degree
SORT_BY_SIG_COUNT certifications count
ORDER_BY in the following order
ASC ascending
DESC descending
SUBMIT_BUTTON submit
CHECKBOX_CENTRALITY Recalculate members centrality degree
CHECKBOX_PENDING_SIGS Include pending certifications
CHECKBOX_MODE_SIG Print emitted certifications (Instead of received certifications)
LEGEND Legend
LEGEND_AVAILABILITY [availability : means this certification may already be written in the next block.]
WHAT_IS_CENTRALITY_TITLE What is the centrality degree ?
WHAT_IS_CENTRALITY_TEXT The centrality degree of a member is the number of pairs directed (member->member) for which the member makes left one of the shortest paths.
QUALITY_MEMBER_TITLE What is the certification quality ?
QUALITY_MEMBER_TXT It is the report enters the rate of referring members reachable by a certification of this member and the rate of referring members which needs to achieve to respect the rule of distance.
WOT_TENSION_STATE Wot tension state
CENTRALITY_NOT_CALC The degree of centrality of the members was never calculated
CENTRALITY_CALC_BUSY The centrality data are currently recalculate, to see them, refresh this page by a few minutes
MEAN_CENTRALITY Mean centrality degree
NUMBER_OF_EXIST_PATH Number of pairs directed for which there is a path of 5 steps or less
NUMBER_OF_PAIRS_MEMBER Number of pairs directed (member->member)
PROPORTION_OF_EXIST_PATH Percent of pairs directed for which there is a path of 5 steps or less
MEAN_LENGTH_PATH mean length shortest path
WOT_TENSION_FACTOR Wot tension factor*
DATA_AT Data at
meanMembersReachedByMembersInSingleExtCert Mean members/sentries reached in single member/sentry certification
SENTRIES_REACHED sentries reached
MEMBERS_REACHED members reached
SENTRY_CERT sentry certification
MEMBER_CERT member certification
MEAN_QUALITY mean quality
CURRENT_BLOCKCHAIN_TIME Current blockchain time
TABLE_TITLE Members that will expire in less than
DAYS days
......@@ -26,8 +49,14 @@ COL_LIST_RECEIVED_CERT list received certifications
COL_LIST_EMITTED_CERT list emitted certifications
LAST2OLDEST récentes -> anciennes
OLDEST2LAST anciennes -> récentes
REFERRING_MEMBER referring
YES yes
NO no
QUALITY_EXT quality
CENTRALITY centrality
EMITTED emitted
WRITTEN written
INVALID_BLOCKSTAMP invalid blockstamp
CERT_AVAILABLE available
OVERALL Overall
MEMBERS members
\ No newline at end of file
......@@ -4,14 +4,37 @@ SORT_BY_EXPIRE_MEMBERSHIP date d'expiration du membership
SORT_LAST_RENEWAL date de dernier renouvellement
SORT_BY_OLDEST_SIG date de plus vielle certification
SORT_BY_LAST_SIG date de plus récente certification
SORT_BY_CENTRALITY degré de centralité
SORT_BY_SIG_COUNT nombre de certifications reçues
ORDER_BY dans l'ordre
ASC croissant
DESC décroissant
SUBMIT_BUTTON recharger
CHECKBOX_CENTRALITY Recalculer le degré de centralité des membres
CHECKBOX_PENDING_SIGS Inclure les certifications en piscine
CHECKBOX_MODE_SIG Afficher les certifications émises (à la place des certifications reçus)
LEGEND Légende
LEGEND_AVAILABILITY [disponibilité : date à partir de laquelle cette certification pourra être écrite compte tenu de sigPeriod]
WHAT_IS_CENTRALITY_TITLE Qu'est ce que le degré de centralité ?
WHAT_IS_CENTRALITY_TEXT Le degré de centralité d'un membre est le nombre de couples orientés (membre->membre) pour lesquels il fait parti d'un des plus court chemin reliant ce couple.
QUALITY_MEMBER_TITLE Qu'est ce que la qualité d'un membre ?
QUALITY_MEMBER_TXT C'est le rapport entre le taux de membres référents rendu atteignables par une certification de ce membre et le taux de membres référents qui faut atteindre pour respecter la règle de distance. Si ce nombre est supérieur ou égal à 1 c'est qu'une certification de ce membre suffit à elle seule pour respecter la règle de distance. Si les qualités de plusieurs certifieurs ne se sommes pas c'est tout simplement parce qu'une grande partie des membres référents qu'ils permettent d'atteindre sont les mêmes.
WOT_TENSION_STATE État de tension de la toile
CENTRALITY_NOT_CALC le degré de centralité des membres n'a jamais été calculé
CENTRALITY_CALC_BUSY Les données de centralité sont en cours de mise à jours, pour les voir, rechargez cette page d'ici quelques minutes.
MEAN_CENTRALITY Dégré de centralité moyen
NUMBER_OF_EXIST_PATH Nombre de couples orientés pour lequels il existe un chemin de 5 pas ou moins
NUMBER_OF_PAIRS_MEMBER Nombre de couples orientés (membre->membre)
PROPORTION_OF_EXIST_PATH Proportion de couples orientés pour lequels il existe un chemin de 5 pas ou moins
MEAN_LENGTH_PATH Longueur moyenne d'un plus court chemin
WOT_TENSION_FACTOR Facteur de tension de la toile*
DATA_AT Données au
meanMembersReachedByMembersInSingleExtCert Taux moyen de membres joiniables via une seule certification
MEMBER_CERT certification d'un membre
MEMBERS_REACHED membres joiniables
SENTRY_CERT certification d'un membre référent
SENTRIES_REACHED membres référents joiniables
MEAN_QUALITY Qualité moyenne
CURRENT_BLOCKCHAIN_TIME Temps Blockchain actuel
TABLE_TITLE Membres dont le statut de membre va expirer dans moins de
DAYS jours
......@@ -26,8 +49,14 @@ COL_LIST_RECEIVED_CERT liste des certifications reçues
COL_LIST_EMITTED_CERT liste des certifications émises
LAST2OLDEST récentes -> anciennes
OLDEST2LAST anciennes -> récentes
REFERRING_MEMBER référent
YES oui
NO non
QUALITY_EXT qualité
CENTRALITY centralité
EMITTED émise
WRITTEN écrite
INVALID_BLOCKSTAMP blockstamp incorrect
CERT_AVAILABLE disponible
OVERALL Total
MEMBERS membres
\ No newline at end of file
......@@ -15,14 +15,26 @@ SIG_PERIOD_LEGEND2 green : [available] : means this certification may already be
HOW_TO_BECOME_MEMBER_TITLE When does an identity become a member ?
HOW_TO_BECOME_MEMBER_TEXT An identity becomes a member as soon as it has at least <b>5</b> certifications in the <font color='green'>[available]</font> state <b>at the same time <u>and</u></b> it respects the Distance Rule.<br>You can click directly on an identity to reach the according wotex page to verify if it respects the Distance Rule.
DISTANCE_RULE_TITLE What is the Distance Rule ?
DISTANCE_RULE_TXT It is required that for more than <font color='blue'><b>80% of the referring members</b></font>, a path of at most 5 steps should exist between each of them and the identity about to be certified.<br>Every member automatically becomes a referring member as soon as he has emitted <b><u>and</u></b> received Y[n] certifications. (Y[n] = CEILING(N(t)^(1/5))).
DISTANCE_RULE_TXT It is required that for more than <font color='blue'><b>80% of the referring members</b></font>, a path of at most 5 steps should exist between each of them and the identity about to be certified.<br>Every member automatically becomes a referring member as soon as he has emitted <b><u>and</u></b> received Y[n] certifications. (Y[n] = CEILING(N(t)^(1/5))).<br>Currently, Yn =
WHAT_IS_CENTRALITY_TITLE What is the centrality degree ?
WHAT_IS_CENTRALITY_TEXT The centrality degree of a member is the number of pairs directed (member->member) for which the member makes left one of the shortest paths.
QUALITY_MEMBER_TITLE What is the certification quality ?
QUALITY_MEMBER_TXT It's... wait for traduction !
QUALITY_MEMBER_TXT It is the report enters the rate of referring members reachable by a certification of this member and the rate of referring members which needs to achieve to respect the rule of distance.
BLOCKCHAIN_TIME Current Blockchain Time
TABLE_TITLE1 Identities that will expire in less than
TABLE_TITLE2 days
COUNT_READY_MEMBERS Identities having received 5 valid certifications or more
WOT_TENSION_STATE Wot tension state
CENTRALITY_NOT_CALC The degree of centrality of the members was never calculated
CENTRALITY_CALC_BUSY The centrality data are currently recalculate, to see them, refresh this page by a few minutes
MEAN_CENTRALITY Mean centrality
NUMBER_OF_EXIST_PATH Number of pairs directed for which there is a path of 5 steps or less
NUMBER_OF_PAIRS_MEMBER Number of pairs directed (member->member)
PROPORTION_OF_EXIST_PATH Percent of pairs directed for which there is a path of 5 steps or less
MEAN_LENGTH_PATH mean length shortest path
WOT_TENSION_FACTOR Wot tension factor*
MEMBERS_PAGE_NOT_LOAD Please load members page at least once time for get wot tension data
DATA_AT Data at
meanMembersReachedByMembersInSingleExtCert Mean members/sentries reached in single member/sentry certification
SENTRIES_REACHED sentries reached
MEMBERS_REACHED members reached
......
......@@ -16,13 +16,25 @@ HOW_TO_BECOME_MEMBER_TITLE À quel moment une identité devient membre ?
HOW_TO_BECOME_MEMBER_TEXT Une identité devient membre dès qu'elle bénéficie d'au moins <b>5</b> certifications à l'état <font color='green'>[disponible]</font> <b>au même moment <u>et</u></b> qu'elle respecte la règle de distance.<br>Vous pouvez cliquer directement sur une identité pour arriver sur la page wotex correspondante afin de vérifier si elle respecte la règle de distance.
DISTANCE_RULE_TITLE C'est quoi la règle de distance ?
DISTANCE_RULE_TXT Il faut qu'il existe un chemin de 5 pas maximum d'au moins <font color='blue'><b>80% des membres référents</b></font> vers l'identité qui souhaite devenir membre.<br>Tout membre devient automatiquement référent dès lors qu'il a émis <b><u>et</u></b> reçu Y[n] certifications. (Y[n] = CEILING(N(t)^(1/5))).<br>Actuellement, Yn =
WHAT_IS_CENTRALITY_TITLE Qu'est ce que le degré de centralité ?
WHAT_IS_CENTRALITY_TEXT Le degré de centralité d'un membre est le nombre de couples orientés (membre->membre) pour lesquels il fait parti d'un des plus court chemin reliant ce couple.
QUALITY_MEMBER_TITLE Qu'est ce que la qualité d'un membre ?
QUALITY_MEMBER_TXT C'est le rapport entre le taux de membres référents rendu atteignables par une certification de ce membre et le taux de membres référents qui faut atteindre pour respecter la règle de distance. Si ce nombre est supérieur ou égal à 1 c'est qu'une certification de ce membre suffit à elle seule pour respecter la règle de distance.<br>Si les qualités de plusieurs certifieurs ne se sommes pas c'est tout simplement parce qu'une grande partie des membres référents qu'ils permettent d'atteindre sont les mêmes.
QUALITY_MEMBER_TXT C'est le rapport entre le taux de membres référents rendu atteignables par une certification de ce membre et le taux de membres référents qui faut atteindre pour respecter la règle de distance. Si ce nombre est supérieur ou égal à 1 c'est qu'une certification de ce membre suffit à elle seule pour respecter la règle de distance. Si les qualités de plusieurs certifieurs ne se sommes pas c'est tout simplement parce qu'une grande partie des membres référents qu'ils permettent d'atteindre sont les mêmes.
BLOCKCHAIN_TIME Temps Blockchain actuel
TABLE_TITLE1 Identités qui vont expirer dans moins de
TABLE_TITLE2 jours
COUNT_READY_MEMBERS Identités avec au moins 5 certifications valides reçues
WOT_TENSION_STATE État de tension de la toile
CENTRALITY_NOT_CALC le degré de centralité des membres n'a jamais été calculé
CENTRALITY_CALC_BUSY Les données de centralité sont en cours de mise à jours, pour les voir, rechargez cette page d'ici quelques minutes.
MEAN_CENTRALITY Centralité moyenne
NUMBER_OF_EXIST_PATH Nombre de couples orientés pour lequels il existe un chemin de 5 pas ou moins
NUMBER_OF_PAIRS_MEMBER Nombre de couples orientés (membre->membre)
PROPORTION_OF_EXIST_PATH Proportion de couples orientés pour lequels il existe un chemin de 5 pas ou moins
MEAN_LENGTH_PATH Longueur moyenne d'un plus court chemin
WOT_TENSION_FACTOR Facteur de tension de la toile*
MEMBERS_PAGE_NOT_LOAD Svp veillez charger la page "liste des membres" au moins une fois pour obtenir l'état de tension de la toile
DATA_AT Données au
meanMembersReachedByMembersInSingleExtCert Taux moyen de membres joiniables via une seule certification
MEMBER_CERT certification d'un membre
MEMBERS_REACHED membres joiniables
......
......@@ -14,9 +14,33 @@ module.exports = (duniterServer, host, port, appParente, program) => co(function
// Define cache
var cache = {
// willMembers
lockWillMembers: false,
willMembersLastUptime: 0,
meanSentriesReachedByIdtyPerCert: new Array(),
meanMembersReachedByIdtyPerCert: new Array(),
countIdtiesPerReceiveCert: new Array(),
// members
lockMembers: false,
membersLastUptime: 0,
membersQualityExt: new Array(),
meanSentriesReachedBySentriesInSingleExtCert: 0,
meanMembersReachedBySentriesInSingleExtCert: 0,
meanSentriesReachedByMembersInSingleExtCert: 0,
meanMembersReachedByMembersInSingleExtCert: 0,
// wotCentrality
lockCentralityCalc: false,
membersLastCentralityCalcTime: 0,
membersCentrality: new Array(),
meanCentrality: 0,
meanShortestsPathLength: 0,
nbShortestsPath: 0,
// membersCount
lockMembersCount: false,
lastUptime: 0,
lock : false,
beginBlock: null,
currentBlockNumber : 0,
currentBlockTime: 0,
......@@ -29,17 +53,7 @@ module.exports = (duniterServer, host, port, appParente, program) => co(function
Yn: 0,
pubkeys: new Array(),
pub_index: new Array(),
blockchain: new Array(),
// willMembers
willMembersLastUptime: 0,
meanSentriesReachedByIdtyPerCert: new Array(),
meanMembersReachedByIdtyPerCert: new Array(),
countIdtiesPerReceiveCert: new Array(),
meanSentriesReachedBySentriesInSingleExtCert: 0,
meanMembersReachedBySentriesInSingleExtCert: 0,
meanSentriesReachedByMembersInSingleExtCert: 0,
meanMembersReachedByMembersInSingleExtCert: 0
blockchain: new Array()
};
// Create or open monit database
......
......@@ -17,10 +17,10 @@ module.exports = (req, res, next) => co(function *() {
try {
// if updateCache working, wait
while (cache.lock);
while (cache.lockMembersCount);
// Lock cache
cache.lock = true;
cache.lockMembersCount = true;
// If fork, unstack cache
let reinitBdd = false;
......@@ -50,9 +50,9 @@ module.exports = (req, res, next) => co(function *() {
{*/
// reinitialize cache
cache.lastUptime = 0;
cache.lock = false;
cache.lockMembersCount = false;
cache.beginBlock = null;
cacache.che.currentBlockNumber = 0;
cache.currentBlockNumber = 0;
cache.currentBlockTime = 0;
cache.currentSentries = 0;
cache.endBlock = null;
......@@ -515,8 +515,8 @@ module.exports = (req, res, next) => co(function *() {
cache.lastUptime = Math.floor(Date.now() / 1000);
}
// Unlock cache
cache.lock = false;
// Unlock Members count cache
cache.lockMembersCount = false;
next()
} catch (e) {
......
This diff is collapsed.
......@@ -16,7 +16,6 @@ var countMembersWithSigQtyValidCert = 0;
var sentries = [];
var sentriesIndex = [];
var wotbIdIndex = [];
var issuersPendingCertsQuality = [];
module.exports = (req, res, next) => co(function *() {
......@@ -39,8 +38,6 @@ module.exports = (req, res, next) => co(function *() {
let idtysListOrdered = [];
let sumPercentSentriesReached = 0;
let sumPercentMembersReached = 0;
let countSentriesIssuersOfPendingCerts = 0;
let countMembersIssuersOfPendingCerts = 0;
// Récupérer les paramètres
let days = req.query.d || 65 // Valeur par défaut
......@@ -57,11 +54,15 @@ module.exports = (req, res, next) => co(function *() {
const wotbInstance = wotb.newFileInstance(duniterServer.home + '/wotb.bin');
// Vérifier si le cache doit être Réinitialiser
let reinitCache = (Math.floor(Date.now() / 1000) > (cache.willMembersLastUptime + MIN_WILLMEMBERS_UPDATE_FREQ));
let reinitCache = (!cache.lockWillMembers && Math.floor(Date.now() / 1000) > (cache.willMembersLastUptime + MIN_WILLMEMBERS_UPDATE_FREQ));
// Attendre que les cache willMembers et Members soient déverouillés (même si on ne les modifient pas !)
while(cache.lockWillMembers || cache.lockMembers);
if (reinitCache)
{
// Réinitialiser le cache
cache.lockWillMembers = true;
identitiesList = [];
idtysPendingCertifsList = [];
nbMaxCertifs = 0;
......@@ -169,7 +170,7 @@ module.exports = (req, res, next) => co(function *() {
// Vérifier si le blockstamp est correct
var validBlockStamp = false;
if (emittedBlock[0].hash == tmpQueryPendingCertifsList[j].block_hash)
if (typeof(emittedBlock[0]) != 'undefined' && emittedBlock[0].hash == tmpQueryPendingCertifsList[j].block_hash)
{ validBlockStamp = true; }
// récupérer le timestamp d'enchainement de la dernière certification écrite par l'émetteur
......@@ -224,12 +225,6 @@ module.exports = (req, res, next) => co(function *() {
cache.meanMembersReachedByIdtyPerCert[i] = 0;
cache.countIdtiesPerReceiveCert[i] = 0;
}
// Réinitialiser mean Members/Sentries ReachedBy Members/Sentries InSingleExtCert
cache.meanSentriesReachedBySentriesInSingleExtCert = 0;
cache.meanMembersReachedBySentriesInSingleExtCert = 0;
cache.meanSentriesReachedByMembersInSingleExtCert = 0;
cache.meanMembersReachedByMembersInSingleExtCert = 0;
} // END if (reinitCache)
// Si demandé, retrier les, certifications par date de disponibilité
......@@ -366,27 +361,6 @@ module.exports = (req, res, next) => co(function *() {
{
tmpWot.addLink(cert.wotb_id, pendingIdtyWID);
}
// tmpWotOneCert
if (reinitCache && typeof(issuersPendingCertsQuality[cert.from]) == 'undefined')
{
issuersPendingCertsQuality[cert.from] = true;
let tmpWotOneCert = wotbInstance.memCopy();
let pendingIdtyWID_WotOneCert = tmpWotOneCert.addNode();
tmpWotOneCert.addLink(cert.wotb_id, pendingIdtyWID_WotOneCert);
let detailedDistanceOneCert = tmpWotOneCert.detailedDistance(pendingIdtyWID_WotOneCert, dSen, conf.stepMax, conf.xpercent);
tmpWotOneCert.clear();
if (cert.issuerIsSentry)
{
cache.meanSentriesReachedBySentriesInSingleExtCert += parseFloat(((detailedDistanceOneCert.nbSuccess/detailedDistanceOneCert.nbSentries)*100).toFixed(2));
cache.meanMembersReachedBySentriesInSingleExtCert += parseFloat(((detailedDistanceOneCert.nbReached/currentMembersCount)*100).toFixed(2));
countSentriesIssuersOfPendingCerts++;
}
cache.meanSentriesReachedByMembersInSingleExtCert += parseFloat(((detailedDistanceOneCert.nbSuccess/detailedDistanceOneCert.nbSentries)*100).toFixed(2));
cache.meanMembersReachedByMembersInSingleExtCert += parseFloat(((detailedDistanceOneCert.nbReached/currentMembersCount)*100).toFixed(2));
countMembersIssuersOfPendingCerts++;
issuersPendingCertsQuality[cert.from] = ((detailedDistanceOneCert.nbSuccess/detailedDistanceOneCert.nbSentries)/conf.xpercent).toFixed(2);
}
certIndex++;
}
let detailedDistance = tmpWot.detailedDistance(pendingIdtyWID, dSen, conf.stepMax, conf.xpercent);
......@@ -459,17 +433,8 @@ module.exports = (req, res, next) => co(function *() {
}
}
// Calculate mean Members/Sentries ReachedBy Members/Sentries InSingleExtCert
if (countSentriesIssuersOfPendingCerts > 0)
{
cache.meanSentriesReachedBySentriesInSingleExtCert = parseFloat((cache.meanSentriesReachedBySentriesInSingleExtCert/countSentriesIssuersOfPendingCerts).toFixed(2));
cache.meanMembersReachedBySentriesInSingleExtCert = parseFloat((cache.meanMembersReachedBySentriesInSingleExtCert/countSentriesIssuersOfPendingCerts).toFixed(2));
}
if (countMembersIssuersOfPendingCerts > 0)
{
cache.meanSentriesReachedByMembersInSingleExtCert = parseFloat((cache.meanSentriesReachedByMembersInSingleExtCert/countMembersIssuersOfPendingCerts).toFixed(2));
cache.meanMembersReachedByMembersInSingleExtCert = parseFloat((cache.meanMembersReachedByMembersInSingleExtCert/countMembersIssuersOfPendingCerts).toFixed(2));
}
// Dévérouiller le cache
cache.lockWillMembers = false;
}
// Si le client demande la réponse au format JSON, le faire
......@@ -484,31 +449,46 @@ module.exports = (req, res, next) => co(function *() {
res.locals = {
// Les varibles à passer au template
host: req.headers.host.toString(),
// get parameters
days, sort_by, order, sortSig,
showIdtyWithZeroCert,
// page data
currentBlockNumber,
currentBlockchainTimestamp,
currentMembersCount,
limitTimestamp,
dSen,
nbMaxCertifs,
countMembersWithSigQtyValidCert,
idtysListFiltered: idtysListOrdered.filter( idty=>
idty.expires_on < limitTimestamp
&& idty.expires_on > currentBlockchainTimestamp
&& (showIdtyWithZeroCert == "yes" || idty.pendingCertifications.length > 0)
),
// currency parameters
dSen,
sigQty: conf.sigQty,
sigWindow: conf.sigWindow,
idtyWindow: conf.idtyWindow,
xpercent: conf.xpercent,
nbMaxCertifs,
countMembersWithSigQtyValidCert,
// willMembers cache data
meanSentriesReachedByIdtyPerCert: cache.meanSentriesReachedByIdtyPerCert,
meanMembersReachedByIdtyPerCert: cache.meanMembersReachedByIdtyPerCert,
// members cache data
membersLastUptime: cache.membersLastUptime,
membersQualityExt: cache.membersQualityExt,
meanSentriesReachedBySentriesInSingleExtCert: cache.meanSentriesReachedBySentriesInSingleExtCert,
meanMembersReachedBySentriesInSingleExtCert: cache.meanMembersReachedBySentriesInSingleExtCert,
meanSentriesReachedByMembersInSingleExtCert: cache.meanSentriesReachedByMembersInSingleExtCert,
meanMembersReachedByMembersInSingleExtCert: cache.meanMembersReachedByMembersInSingleExtCert,
issuersPendingCertsQuality,
idtysListFiltered: idtysListOrdered.filter( idty=>
idty.expires_on < limitTimestamp
&& idty.expires_on > currentBlockchainTimestamp
&& (showIdtyWithZeroCert == "yes" || idty.pendingCertifications.length > 0)
),
// centrality cache data
lockCentralityCalc: cache.lockCentralityCalc,
membersLastCentralityCalcTime: cache.membersLastCentralityCalcTime,
membersCentrality: cache.membersCentrality,
meanCentrality: cache.meanCentrality,
meanShortestsPathLength: cache.meanShortestsPathLength,
nbShortestsPath: cache.nbShortestsPath,
// Template helpers
timestampToDatetime,
// Calculer la proportion de temps restant avant l'expiration
......
......@@ -34,6 +34,7 @@ module.exports = (req, res, next) => co(function *() {
}));
let searchResult = '';
let lignes = [];
if (req.query.to) {
let idty;
let pos = 0, search = req.query.to;
......@@ -64,7 +65,6 @@ module.exports = (req, res, next) => co(function *() {
idty = res.idty;
const mapPendingCerts = res.mapPendingCerts;
let lignes = [];
for (const membre of membres) {
if (req.query.mode == "u2w") {
alimenteLignes(wotb, idty, membre, lignes, dicoIdentites, mapPendingCerts);
......@@ -79,26 +79,26 @@ module.exports = (req, res, next) => co(function *() {
// Si le client demande la réponse au format JSON, le faire
if (format == 'JSON')
{
// Send JSON reponse
//res.status(200).jsonp( ? )
// Send JSON reponse
res.status(200).jsonp( lignes )
}
// Sinon, printer la page html
else
{
// write sentriesHTML
let sentriesHTML = sentries
.map((sentry) => `
<div class="sentry isSentry"><a href="wotex?lg=${LANG['LG']}&to=${sentry.uid}">${sentry.uid}</a></div>
`)
.join('');
res.locals = {
// Les varibles à passer au template
host: req.headers.host.toString(),
searchResult,
sentriesHTML
}
next()
// write sentriesHTML
let sentriesHTML = sentries
.map((sentry) => `
<div class="sentry isSentry"><a href="wotex?lg=${LANG['LG']}&to=${sentry.uid}">${sentry.uid}</a></div>
`)
.join('');
res.locals = {
// Les varibles à passer au template
host: req.headers.host.toString(),
searchResult,
sentriesHTML
}
next()
}
} catch (e) {
// En cas d'exception, afficher le message
......
......@@ -31,17 +31,58 @@ ${(host.substr(host.length-6,6) == '.onion') ? HTML_TOR_HEAD:HTML_HEAD}
<option name="sort_by" value ="lastRenewal" ${sort_by == 'lastRenewal' ? 'selected' : ''}>${LANG["SORT_LAST_RENEWAL"]}
<option name="sort_by" value ="oldestSig" ${sort_by == 'oldestSig' ? 'selected' : ''}>${LANG["SORT_BY_OLDEST_SIG"]}
<option name="sort_by" value ="lastSig" ${sort_by == 'lastSig' ? 'selected' : ''}>${LANG["SORT_BY_LAST_SIG"]}
<option name="sort_by" value ="centrality" ${sort_by == 'centrality' ? 'selected' : ''}>${LANG["SORT_BY_CENTRALITY"]}
<option name="sort_by" value ="sigCount" ${sort_by == 'sigCount' ? 'selected' : ''}>${LANG["SORT_BY_SIG_COUNT"]}
</select> ${LANG["ORDER_BY"]} <select name="order">
<option name="order" value ="asc"> ${LANG["ASC"]}
<option name="order" value ="desc" ${order == 'desc' ? 'selected' : ''}> ${LANG["DESC"]}</select>
<input type="submit" value="envoyer"><br>
<input type="submit" value="${LANG['SUBMIT_BUTTON']}"><br>
<input type="checkbox" name="centrality" value="yes">${LANG["CHECKBOX_CENTRALITY"]}.<br>
<input type="checkbox" name="pendingSigs" value="yes" ${pendingSigs == 'yes' ? 'checked' : ''}>${LANG["CHECKBOX_PENDING_SIGS"]}.<br>
<input type="checkbox" name="mode" value="emitted" ${mode == 'emitted' ? 'checked' : ''}>${LANG["CHECKBOX_MODE_SIG"]}.</form><br>
<input type="checkbox" name="mode" value="emitted" ${mode == 'emitted' ? 'checked' : ''}>${LANG["CHECKBOX_MODE_SIG"]}.<br>
</form>
<hr>
<!-- Afficher la légende et l'aide -->
${(help != 'no') ? `
<b>${LANG["LEGEND"]}</b><br>
${(pendingSigs == 'yes') ? ` ${LANG["LEGEND_AVAILABILITY"]}<br>` : ''}
<br>
<b>${LANG["WHAT_IS_CENTRALITY_TITLE"]}</b><br>
${LANG["WHAT_IS_CENTRALITY_TEXT"]}<br>
<br>
<b>${LANG["QUALITY_MEMBER_TITLE"]}</b><br>
${LANG["QUALITY_MEMBER_TXT"]}<br>
<hr>
`:''}
<!-- Afficher la légende -->
<!-- Afficher l'état de tension de la toile de confiance -->
<h3>${LANG["WOT_TENSION_STATE"]}</h3>
${(membersLastCentralityCalcTime==0) ? `
${LANG["CENTRALITY_NOT_CALC"]}.<br>
`:`
${(lockCentralityCalc) ? `
${LANG["CENTRALITY_CALC_BUSY"]}.<br>
`:`
<table border="1">
<tr><td align='center' colspan='2'>${LANG["DATA_AT"]} ${timestampToDatetime(membersLastCentralityCalcTime)}</td></tr>
<tr><td align='center'>${LANG["MEAN_CENTRALITY"]}</td><td align='center'><b>${meanCentrality.toFixed(2)}</b></td></tr>
<tr><td align='center'>${LANG["NUMBER_OF_PAIRS_MEMBER"]}</td><td align='center'>${(membersListFiltered.length*(membersListFiltered.length-1))}</td></tr>
<tr><td align='center'>${LANG["NUMBER_OF_EXIST_PATH"]}</td><td align='center'><b>${nbShortestsPath}</b></td></tr>
<tr><td align='center'><b>${LANG["PROPORTION_OF_EXIST_PATH"]}</b></td><td align='center'><b>${((nbShortestsPath/(membersListFiltered.length*(membersListFiltered.length-1)))*100).toFixed(2)}%</b></td></tr>
<tr><td align='center'><b>${LANG["MEAN_LENGTH_PATH"]}</b></td><td align='center'><b>${(meanShortestsPathLength).toFixed(2)}</b></td></tr>
</table>
`}
`}
<br>
<table border="1">
<tr><td align='center' colspan='3'>${LANG["DATA_AT"]} ${timestampToDatetime(membersLastUptime)}</td></tr>
<tr><td align='center'>${LANG["meanMembersReachedByMembersInSingleExtCert"]}</td><td align='center'>${LANG["SENTRIES_REACHED"]}</td><td align='center'>${LANG["MEMBERS_REACHED"]}</td></tr>
<tr><td align='center'>${LANG["SENTRY_CERT"]}</td><td align='center'>${meanSentriesReachedBySentriesInSingleExtCert}%</td><td align='center'>${meanMembersReachedBySentriesInSingleExtCert}%</td></tr>
<tr><td align='center'>${LANG["MEMBER_CERT"]}</td><td align='center'><font color="${(meanSentriesReachedByMembersInSingleExtCert<xpercent) ? 'DarkRed' : 'blue' }"><b>${meanSentriesReachedByMembersInSingleExtCert}%</b></font></td><td align='center'><b>${meanMembersReachedByMembersInSingleExtCert}%</b></td></tr>
<tr><td align='center'>${LANG["MEAN_QUALITY"]}</td><td align='center'><font color="${(meanSentriesReachedByMembersInSingleExtCert<xpercent) ? 'DarkRed' : 'blue' }"><b>${(meanSentriesReachedByMembersInSingleExtCert/(xpercent*100)).toFixed(2)}</b></font></td><td align='center'><b>${(meanMembersReachedByMembersInSingleExtCert/(xpercent*100)).toFixed(2)}</b></td></tr>
</table>
<br>
${(pendingSigs == 'yes' && help != 'no') ? ` ${LANG["LEGEND_AVAILABILITY"]}<br>` : ''}
<!-- Afficher le currentBlockchainTimestamp -->
<i>${LANG["CURRENT_BLOCKCHAIN_TIME"]} : ${timestampToDatetime(currentBlockchainTimestamp)}.</i><br>
......@@ -67,10 +108,16 @@ ${(pendingSigs == 'yes' && help != 'no') ? ` ${LANG["LEGEND_AVAILABILITY"]}<br>`
<tr>
${(member.proportion = proportion(member.expireMembershipTimestamp,msValidity,0,120),'')}
<td align="center" style="background:hsla(${member.proportion}, 100%, 50%, 1)">
<h3>${member.uid}</h3>
<b>${member.uid}</b><br>
${(member.isSentry) ? `<font color="blue">${LANG['REFERRING_MEMBER']} : ${LANG['YES']}</font>`:`${LANG['REFERRING_MEMBER']} : ${LANG['NO']}`}<br>
${LANG['QUALITY_EXT']} : <b>${(typeof(membersQualityExt[member.uid])=='undefined') ? `0.00`:membersQualityExt[member.uid]}</b><br>
<b>${(membersLastCentralityCalcTime==0) ? `${LANG['CENTRALITY']} : ?`:`
${LANG['CENTRALITY']} : <b>${(typeof(membersCentrality[member.wotb_id])=='undefined') ? `0`:membersCentrality[member.wotb_id]}
`}</b><br>
->${member.certifications.length}
${pendingSigs == "yes" && member.pendingCertifications.length > 0
? `(${member.pendingCertifications.length})`
${pendingSigs == "yes" && typeof(member.pendingCertifications) != 'undefined'
? ` (+${member.pendingCertifications.length})`
: ''}
</td>
<td align="center" style="background:hsla(${member.proportion}, 100%, 50%, 1)">
......@@ -84,33 +131,38 @@ ${(pendingSigs == 'yes' && help != 'no') ? ` ${LANG["LEGEND_AVAILABILITY"]}<br>`
<td align="center" style="background:hsla(${member.proportion}, 100%, 50%, 1)">
${timestampToDatetime(member.expireMembershipTimestamp)}</td>
<td align='center' style="background:hsla(${member.proportion}, 100%, 50%, 1)">
<span style="color: ${member.isOutdistanced ? 'red' : 'blue' }">${member.isOutdistanced ? LANG['COL_DISTANCE_isOutdistanced'] : LANG['COL_DISTANCE_isNotOutdistanced'] }</span>
<font color="${member.detailedDistance.isOutdistanced ? 'red' : 'blue' }">
${member.detailedDistance.isOutdistanced ? LANG['COL_DISTANCE_isOutdistanced'] : LANG['COL_DISTANCE_isNotOutdistanced'] }
<br>${member.percentSentriesReached}% (${member.detailedDistance.nbSuccess}/${member.detailedDistance.nbSentries})
</font>
</td>
<td style="background:#000000">-</td>
<!-- Printer les certifications en piscine -->
${pendingSigs == "yes" ?
member.pendingCertifications.map( certification=> `
${pendingSigs == "yes" && typeof(member.pendingCertifications) != 'undefined' ?
member.pendingCertifications.map( cert=> `
<!-- Printer la certification -->
<td align="center" style="background:${color(certification.timestampExpire,sigWindow,200)})">
${certification.protagonist}<br>
${timestampToDatetime(certification.timestampExpire)}<br>
${LANG["EMITTED"]} #${certification.blockNumber}<br>
${(certification.timestampWritable > currentBlockchainTimestamp) ? `<font color="DarkRed">[${timestampToDatetime(certification.timestampWritable)}
`:`<font color="green">[${LANG["CERT_AVAILABLE"]}`
}]
<td align="center" style="background:${(cert.validBlockStamp) ? cert.colorPending=color(cert.expires_on,idtyWindow,250) : cert.colorPending='#FF8000'}">
<b>${cert.protagonist}</b><br>
${timestampToDatetime(cert.timestampExpire)}<br>
${LANG["EMITTED"]} #${cert.blockNumber}<br>
${ ( !cert.validBlockStamp || cert.timestampWritable > currentBlockchainTimestamp ) ? `
<font color="DarkRed">[${ (cert.validBlockStamp) ? timestampToDatetime(cert.timestampWritable):LANG['INVALID_BLOCKSTAMP']}]</font>
` : `
<font color='green'>[${LANG['CERT_AVAILABLE']}]</font>
`}
</font>
</td>
`).join('')
:''}
<!-- Printer les certifications écrites en blockchain -->
${member.certifications.map( certification=> `
${member.certifications.map( cert=> `
<!-- Printer la certification -->
<td align="center" style="background:hsla(${proportion(certification.timestampExpire,sigValidity,0,120)}, 100%, 50%, 1 )">
${(mode=='emitted') ? certification.receiver:certification.issuer}<br>
${timestampToDatetime(certification.timestampExpire)}<br>
${LANG["WRITTEN"]} #${certification.writtenBloc}
<td align="center" style="background:hsla(${proportion(cert.timestampExpire,sigValidity,0,120)}, 100%, 50%, 1 )">
<b>${(mode=='emitted') ? cert.receiver:cert.issuer}</b><br>
${timestampToDatetime(cert.timestampExpire)}<br>
${LANG["WRITTEN"]} #${cert.writtenBloc}
</td>
`).join('')}
</tr>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment