Skip to content
Snippets Groups Projects
Commit 853994c0 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Merge pull request #366 from Insoleet/webmin_preview_pubkey

Webmin preview pubkey
parents f6cb1ef5 f13ad272
Branches
Tags
No related merge requests found
...@@ -69,6 +69,14 @@ function WebAdmin (dbConf, overConf) { ...@@ -69,6 +69,14 @@ function WebAdmin (dbConf, overConf) {
}; };
}); });
this.previewPubkey = (req) => co(function *() {
let conf = http2raw.conf(req);
let pair = yield Q.nbind(crypto.getKeyPair, crypto)(conf.idty_entropy, conf.idty_password);
return {
"pubkey": base58.encode(pair.publicKey)
};
});
this.startHTTP = () => co(function *() { this.startHTTP = () => co(function *() {
yield pluggedDALP; yield pluggedDALP;
return bmapi.openConnections(); return bmapi.openConnections();
...@@ -162,6 +170,7 @@ function WebAdmin (dbConf, overConf) { ...@@ -162,6 +170,7 @@ function WebAdmin (dbConf, overConf) {
}); });
join += crypto.signSync(join, secretKey) + '\n'; join += crypto.signSync(join, secretKey) + '\n';
yield that.pushEntity({ body: { membership: join }}, http2raw.membership, parsers.parseMembership); yield that.pushEntity({ body: { membership: join }}, http2raw.membership, parsers.parseMembership);
yield server.recomputeSelfPeer();
} }
// //
return found; return found;
......
...@@ -354,7 +354,8 @@ dtos.UD = { ...@@ -354,7 +354,8 @@ dtos.UD = {
"block_number": Number, "block_number": Number,
"consumed": Boolean, "consumed": Boolean,
"time": Number, "time": Number,
"amount": Number "amount": Number,
"base": Number
}; };
dtos.UDHistory = { dtos.UDHistory = {
...@@ -409,3 +410,7 @@ dtos.AdminSummary = { ...@@ -409,3 +410,7 @@ dtos.AdminSummary = {
"current": dtos.Block, "current": dtos.Block,
"pubkey": String "pubkey": String
}; };
dtos.PreviewPubkey = {
"pubkey": String
};
...@@ -16,6 +16,7 @@ module.exports = function(dbConf, overConf, interfaces, httpLogs) { ...@@ -16,6 +16,7 @@ module.exports = function(dbConf, overConf, interfaces, httpLogs) {
return network.createServersAndListen('uCoin web admin', interfaces, httpLogs, fullPath, (app, httpMethods) => { return network.createServersAndListen('uCoin web admin', interfaces, httpLogs, fullPath, (app, httpMethods) => {
httpMethods.httpGET( '/webmin/summary', webminCtrl.summary, dtos.AdminSummary); httpMethods.httpGET( '/webmin/summary', webminCtrl.summary, dtos.AdminSummary);
httpMethods.httpPOST( '/webmin/key/preview', webminCtrl.previewPubkey, dtos.PreviewPubkey);
httpMethods.httpGET( '/webmin/server/http/start', webminCtrl.startHTTP, dtos.Boolean); httpMethods.httpGET( '/webmin/server/http/start', webminCtrl.startHTTP, dtos.Boolean);
httpMethods.httpGET( '/webmin/server/http/stop', webminCtrl.stopHTTP, dtos.Boolean); httpMethods.httpGET( '/webmin/server/http/stop', webminCtrl.stopHTTP, dtos.Boolean);
httpMethods.httpGET( '/webmin/server/preview_next', webminCtrl.previewNext, dtos.Block); httpMethods.httpGET( '/webmin/server/preview_next', webminCtrl.previewNext, dtos.Block);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment