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

fix minor bugs

parent 2d83d311
......@@ -46,7 +46,7 @@ module.exports = {
yield startServices();
// Main Loop
yield main(server, SERVER_HOST, SERVER_PORT, null);
yield main(server, SERVER_HOST, SERVER_PORT, null, program);
// Wait forever, this is a permanent program
yield new Promise(() => null);
......
......@@ -7,7 +7,7 @@
window.uiModules['duniter-currency-monit'] = {
menuIconClass: 'fa-signal',
menuLabel: 'Ğune Monit',
menuLabel: 'Currency Monit',
menuOpen: openCurrencyMonitModule
}
......@@ -16,7 +16,7 @@
var currencyMonitModuleHeight = parseInt(localStorage.getItem('currency_monit_module_height')) || 1000;
var currencyMonitModuleWidth = parseInt(localStorage.getItem('currency_monit_module_width')) || 1400;
openNewTab (window.location.origin + '/currency-monit/', {
window.openModule ('/currency-monit/', {
position: 'center',
height: currencyMonitModuleHeight,
width: currencyMonitModuleWidth,
......
"use strict";
const co = require('co');
const sqlite3 = require('sqlite3').verbose();
const home = require('os').homedir();
const webserver = require(__dirname + '/webserver.js');
const duniter = require(__dirname + '/duniter.js');
/****************************
* Main algorithm
*/
module.exports = (duniterServer, host, port, appParente) => co(function *() {
// Get currency name and parameters
const blockZero = yield duniterServer.dal.peerDAL.query('SELECT `currency`,`parameters` from block where `number`=0');
const tabParameters = blockZero[0].parameters.split(":");
const sigValidity = tabParameters[6];
const msValidity = tabParameters[11];
const sigWindow = tabParameters[5];
const idtyWindow = tabParameters[8];
const sigQty = tabParameters[7];
const stepMax = tabParameters[12];
console.log("module currency-monit started");
module.exports = (duniterServer, host, port, appParente, program) => co(function *() {
/*// Create monit database
const configPath = home+'/.config/duniter/'+program.mdb+'/';
var db = new sqlite3.Database(configPath + 'currency-monit.db');
// Fill monit database
db.serialize(function() {
db.run("CREATE TABLE lorem (info TEXT)");
var stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (var i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
stmt.finalize();
db.each("SELECT rowid AS id, info FROM lorem", function(err, row) {
console.log(row.id + ": " + row.info);
});
});
db.close();
// Read monit database
const db2 = new sqlite3.Database(configPath + 'currency-monit.db');
db2.serialize(function() {
db2.all("SELECT * FROM user_info", function(err, rows) {
if (err) { console.error(err); }
else { for (let i=0;i<rows.length;i++) { console.log("%s:%s", rows[i].id, rows[i].info); } }
});
});
db2.close();*/
// Define cache
var cache = {
......@@ -35,9 +57,12 @@ module.exports = (duniterServer, host, port, appParente) => co(function *() {
pub_index: new Array(),
blockchain: new Array()
};
// Confirm started
console.log("module currency-monit started");
// Specialized node's UI
let httpServer = webserver(host, port, appParente, duniterServer, sigValidity, msValidity, sigWindow, idtyWindow, sigQty, stepMax, cache);
let httpServer = webserver(host, port, appParente, duniterServer, cache);
yield httpServer.openConnection();
})
......
......@@ -13,7 +13,7 @@ const bodyParser = require('body-parser');
const routes = require(__dirname + '/../routes');
const tpl = require(__dirname + '/tplit.js');
module.exports = (host, port, appParente, duniterServer, sigValidity, msValidity, sigWindow, idtyWindow, sigQty, stepMax, cache) => {
module.exports = (host, port, appParente, duniterServer, cache) => {
var app = express();
......@@ -38,12 +38,12 @@ module.exports = (host, port, appParente, duniterServer, sigValidity, msValidity
app.set('view engine', 'html') // register the template engine
app.locals.duniterServer = duniterServer
app.locals.sigValidity = sigValidity
app.locals.msValidity = msValidity
app.locals.sigWindow = sigWindow
app.locals.idtyWindow = idtyWindow
app.locals.sigQty = sigQty
app.locals.stepMax = stepMax
app.locals.sigValidity = duniterServer.conf.sigValidity
app.locals.msValidity = duniterServer.conf.msValidity
app.locals.sigWindow = duniterServer.conf.sigWindow
app.locals.idtyWindow = duniterServer.conf.idtyWindow
app.locals.sigQty = duniterServer.conf.sigQty
app.locals.stepMax = duniterServer.conf.stepMax
app.locals.cache = cache
app.locals.HTML_HEAD = fs.readFileSync(__dirname + '/../views/HEAD.html', 'utf-8')
......
......@@ -18,6 +18,7 @@
"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"
......
......@@ -45,7 +45,7 @@ module.exports = (req, res, next) => co(function *() {
// get all dividend created by pubkey1
var pubkey1Dividends = yield duniterServer.dal.peerDAL.query('SELECT `dividend`,`medianTime`,`number` FROM block WHERE `fork`=0 AND `dividend` > 0 '
+'AND `medianTime` >=\''+joinersTimePubkey1[0].medianTime+'\' AND `medianTime` <=\''+cache.endBlock[0].medianTime+'\' '
+'AND `medianTime` >\''+joinersTimePubkey1[0].medianTime+'\' AND `medianTime` <=\''+cache.endBlock[0].medianTime+'\' '
+'ORDER BY `medianTime` ASC');
}
......
......@@ -74,7 +74,7 @@ ${(help != 'no') ? `
<tr>
<td align="center" style="background:${idty.colorPending=color(idty.expires_on,idtyWindow,250)}">
<!--<td align="center" style="background:\${colorPendingIdty}">-->
<a href="http://wotex.cgeek.fr/?to=${idty['uid']}&pending=on&mode=undefined">${idty['uid'].substring(0, 20)}</a><br>
<a href="https://wotex.cgeek.fr/?to=${idty['uid']}&pending=on&mode=undefined">${idty['uid'].substring(0, 20)}</a><br>
${idty['pubkey'].substring(0, 8)}
<br>->${idty.pendingCertifications.length}
</td>
......
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