diff --git a/lg/members_en.txt b/lg/members_en.txt index fef7489111f66bba719ebcb5e5fb4a6c9e08ac28..e6f63084e9a7230801eb97249463de2ed78f4aaf 100755 --- a/lg/members_en.txt +++ b/lg/members_en.txt @@ -1 +1,28 @@ -SUBMIT_BUTTON submit \ No newline at end of file +FORM1 days - sort by +SORT_BY_IDTY_WRITTEN identity written time +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_SIG_COUNT certifications count +ORDER_BY in the following order +ASC ascending +DESC descending +SUBMIT_BUTTON submit +CHECKBOX_PENDING_SIGS Include pending certifications. +LEGEND_AVAILABILITY [availability : means this certification may already be written in the next block.] +CURRENT_BLOCKCHAIN_TIME Current blockchain time +TABLE_TITLE Members that will expire in less than +DAYS days +COL_UID uid +COL_IDTY_WRITTEN_TIME identity written time +COL_LAST_RENEWAL last renewal +COL_EXPIRE_MEMBERSHIP expire membership +COL_LIST_RECEIVED_CERT list received certifications +COL_LIST_EMITTED_CERT list emitted certifications +LAST2OLDEST récentes -> anciennes +OLDEST2LAST anciennes -> récentes +EMITTED emitted +WRITTEN written +OVERALL Overall +MEMBERS members \ No newline at end of file diff --git a/lg/members_fr.txt b/lg/members_fr.txt index 5ed9c4264d6b35bc0503f19338397fdb00f4ae95..83798b70d722b115dd79aa89fd4672aef31a6157 100755 --- a/lg/members_fr.txt +++ b/lg/members_fr.txt @@ -1 +1,28 @@ -SUBMIT_BUTTON recharger \ No newline at end of file +FORM1 jours - tri par +SORT_BY_IDTY_WRITTEN date d'obtention du statut de membre +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_SIG_COUNT nombre de certifications reçues +ORDER_BY dans l'ordre +ASC croissant +DESC décroissant +SUBMIT_BUTTON recharger +CHECKBOX_PENDING_SIGS Inclure les certifications en piscine. +LEGEND_AVAILABILITY [disponibilité : date à partir de laquelle cette certification pourra être écrite compte tenu de sigPeriod] +CURRENT_BLOCKCHAIN_TIME Temps Blockchain actuel +TABLE_TITLE Membres dont le statut de membre va expirer dans moins de +DAYS jours +COL_UID uid +COL_IDTY_WRITTEN_TIME obtention statut membre +COL_LAST_RENEWAL dernier renouvellement +COL_EXPIRE_MEMBERSHIP date d'expiration du membre +COL_LIST_RECEIVED_CERT liste des certifications reçues +COL_LIST_EMMITED_CERT liste des certifications émises +LAST2OLDEST récentes -> anciennes +OLDEST2LAST anciennes -> récentes +EMITTED émise +WRITTEN écrite +OVERALL Total +MEMBERS membres \ No newline at end of file diff --git a/package.json b/package.json index 392336ccb369b36ce06a4bf1b67b2d015f551f69..5eb67f1ba8fa46cb04f1853e9552f05919e11cf2 100755 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "request": "^2.81.0", "request-promise": "4.2.0", "rimraf": "^2.6.1", - "sqlite3": "3.1.x", "tmp": "^0.0.31", "underscore": "1.8.3", "ws": "1.1.1" diff --git a/routes/membersCount.js b/routes/membersCount.js index 0bafbcf4f9b9b1b0b700f7b1012145c7c18294b6..1a01b70a5e2bad21ad4b88f98cbf3fb68ad7b67b 100755 --- a/routes/membersCount.js +++ b/routes/membersCount.js @@ -35,9 +35,17 @@ module.exports = (req, res, next) => co(function *() { } // Initialize nextStepTime, stepIssuerCount and bStep - var nextStepTime = blockchain[0].medianTime - (blockchain[0].medianTime % 86400); + var nextStepTime = blockchain[0].medianTime; let stepIssuerCount = 0; let bStep = 0; + + // Adapt nextStepTime initial value + switch (cache.stepUnit) + { + case "hours": nextStepTime -= (blockchain[0].medianTime % 3600); break; + case "days":case "weeks":case "months":case "years": nextStepTime -= (blockchain[0].medianTime % 86400); break; + default: break; + } // fill tabMembersCount var tabMembersCount = []; diff --git a/routes/willMembers.js b/routes/willMembers.js index 52c71a412e0158ee6b0254b42222553492bf2402..6cc14b8ea185e2725d4bc1dc901fb3fb4f29462e 100755 --- a/routes/willMembers.js +++ b/routes/willMembers.js @@ -1,7 +1,9 @@ "use strict"; const co = require('co') -const crypto = require('crypto'); +const crypto = require('crypto') +//const wotb = require('wotb') + const timestampToDatetime = require(__dirname + '/../lib/timestampToDatetime') const MIN_WILLMEMBERS_UPDATE_FREQ = 150; @@ -54,6 +56,9 @@ module.exports = (req, res, next) => co(function *() { countMembersWithSigQtyValidCert = 0; lastUpgradeTime = Math.floor(Date.now() / 1000); + // Alimenter wotb avec la toile Ğ1 + //const wotbInstance = wotb.newFileInstance(duniterServer.home + '/wotb.bin'); + // Récupérer la liste des identités en piscine const resultQueryIdtys = yield duniterServer.dal.peerDAL.query('SELECT `buid`,`pubkey`,`uid`,`hash`,`expires_on` FROM identities_pending WHERE `member`=0'); @@ -277,6 +282,7 @@ module.exports = (req, res, next) => co(function *() { if (!doubloon) { // Tester la distance à l'aide des certifications disponibles + //let wotb = wotbInstance.memCopy(); let wotb = duniterServer.dal.wotb.memCopy(); let pendingIdtyWID = wotb.addNode() @@ -284,7 +290,8 @@ module.exports = (req, res, next) => co(function *() { { wotb.addLink(cert.wid, pendingIdtyWID) } - let isOutdistanced = wotb.isOutdistanced(pendingIdtyWID, dSen, conf.stepMax, conf.xpercent) + let detailedDistance = wotb.detailedDistance(pendingIdtyWID, dSen, conf.stepMax, conf.xpercent) + let isOutdistanced = detailedDistance.isOutdistanced; // Tester la présence de l'adhésion let membership = null diff --git a/views/members.html b/views/members.html index 9efcd53c31600e50134e6ef88ea70aa2451b6fa9..b9472b5f2bbeb6e56d3ccc076207a3fc84036dcd 100755 --- a/views/members.html +++ b/views/members.html @@ -25,38 +25,38 @@ ${(host.substr(host.length-6,6) == '.onion') ? HTML_TOR_HEAD:HTML_HEAD} <hr> <!-- Afficher le formulaire --> -<input type="number" name="d" value="${days}"/>jours - tri par <select name="sort_by"> -<option name="sort_by" value ="idtyWritten">date d\'obtention du statut de membre -<option name="sort_by" value ="expireMembership" ${sort_by == 'expireMembership' ? 'selected' : ''}>date d\'expiration du membership -<option name="sort_by" value ="lastRenewal" ${sort_by == 'lastRenewal' ? 'selected' : ''}>date de dernier renouvellement -<option name="sort_by" value ="oldestSig" ${sort_by == 'oldestSig' ? 'selected' : ''}>date de plus vielle certification -<option name="sort_by" value ="lastSig" ${sort_by == 'lastSig' ? 'selected' : ''}>date de plus récente certification -<option name="sort_by" value ="sigCount" ${sort_by == 'sigCount' ? 'selected' : ''}>nombre de certifications reçues -</select> dans l\'ordre <select name="order"> -<option name="order" value ="asc">croissant -<option name="order" value ="desc" ${order == 'desc' ? 'selected' : ''}>décroissant</select> +<input type="number" name="d" value="${days}"/>${LANG["FORM1"]} <select name="sort_by"> +<option name="sort_by" value ="idtyWritten">${LANG["SORT_BY_IDTY_WRITTEN"]} +<option name="sort_by" value ="expireMembership" ${sort_by == 'expireMembership' ? 'selected' : ''}>${LANG["SORT_BY_EXPIRE_MEMBERSHIP"]} date d\'expiration du membership +<option name="sort_by" value ="lastRenewal" ${sort_by == 'lastRenewal' ? 'selected' : ''}>${LANG["SORT_LAST_RENEWAL"]} date de dernier renouvellement +<option name="sort_by" value ="oldestSig" ${sort_by == 'oldestSig' ? 'selected' : ''}>${LANG["SORT_BY_OLDEST_SIG"]} date de plus vielle certification +<option name="sort_by" value ="lastSig" ${sort_by == 'lastSig' ? 'selected' : ''}>${LANG["SORT_BY_LAST_SIG"]} date de plus récente certification +<option name="sort_by" value ="sigCount" ${sort_by == 'sigCount' ? 'selected' : ''}>${LANG["SORT_BY_SIG_COUNT"]} nombre de certifications reçues +</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="checkbox" name="pendingSigs" value="yes" ${pendingSigs == 'yes' ? 'checked' : ''}>Inclure les certifications en piscine.</form><br> +<input type="checkbox" name="pendingSigs" value="yes" ${pendingSigs == 'yes' ? 'checked' : ''}>${LANG["CHECKBOX_PENDING_SIGS"]}</form><br> <!-- Afficher la légende --> <br> -${(pendingSigs == 'yes' && help != 'no') ? ` [inscriptible : date à partir de laquelle cette certification pourra être écrite compte tenu de sigPeriod]<br>` : ''} +${(pendingSigs == 'yes' && help != 'no') ? ` ${LANG["LEGEND_AVAILABILITY"]}<br>` : ''} <!-- Afficher le currentBlockchainTimestamp --> -<i>Temps Blockchain actuel : ${timestampToDatetime(currentBlockchainTimestamp)}.</i><br> +<i>${LANG["CURRENT_BLOCKCHAIN_TIME"]} : ${timestampToDatetime(currentBlockchainTimestamp)}.</i><br> <br> <!-- On parcour tout les membres pour afficher ceux dont la date d'expiration est dans moins de 'd' jours --> -<b>Membres dont le statut de membre va expirer dans moins de ${days} jours :</b> +<b>${LANG["TABLE_TITLE"]} ${days} ${LANG["DAYS"]} :</b> <table border="1"> <!-- Printer les nom des colonnes --> <tr> - <td align="center">uid</td> - <td align="center">obtention statut membre</td> - <td align="center">dernier renouvellement</td> - <td align="center">date d'expiration du membre</td> + <td align="center">${LANG["COL_UID"]}</td> + <td align="center">${LANG["COL_IDTY_WRITTEN_TIME"]}</td> + <td align="center">${LANG["COL_LAST_RENEWAL"]}</td> + <td align="center">${LANG["COL_EXPIRE_MEMBERSHIP"]}</td> <td style="background:#000000">-</td> - <td align="left" colspan="${nbMaxCertifs}">liste des certifications reçues (${sort_by == 'lastSig' ? 'récentes -> anciennes' : 'anciennes -> récentes'})</td> + <td align="left" colspan="${nbMaxCertifs}">liste des certifications reçues (${sort_by == 'lastSig' ? LANG["LAST2OLDEST"] : LANG["OLDEST2LAST"]})</td> </tr> ${membersListFiltered @@ -95,7 +95,7 @@ ${(pendingSigs == 'yes' && help != 'no') ? ` [inscriptible : date à partir de l <td align="center" style="background:${color(certification.timestampExpire,sigWindow,200)})"> ${certification.from}<br> ${timestampToDatetime(certification.timestampExpire)}<br> - émise #${certification.blockNumber}<br> + ${LANG["EMITTED"]} #${certification.blockNumber}<br> [inscriptible ${timestampToDatetime(certification.timestampWritable)}] </td> `).join('') @@ -107,14 +107,14 @@ ${(pendingSigs == 'yes' && help != 'no') ? ` [inscriptible : date à partir de l <td align="center" style="background:hsla(${proportion(certification.timestampExpire,sigValidity,0,120)}, 100%, 50%, 1 )"> ${certification.issuer}<br> ${timestampToDatetime(certification.timestampExpire)}<br> - écrite #${certification.writtenBloc} + ${LANG["WRITTEN"]} #${certification.writtenBloc} </td> `).join('')} </tr> `).join('') } <tr> - <td colspan="${4+nbMaxCertifs}" align="center"> total : <b>${membersListFiltered.length}</b> membres.</td> + <td colspan="${4+nbMaxCertifs}" align="center"> ${LANG["OVERALL"]} : <b>${membersListFiltered.length}</b> ${LANG["MEMBERS"]}.</td> </tr> </table><br>