Commit 4a1943c6 authored by Eriksson Monteiro's avatar Eriksson Monteiro

update millix node

parent e497b430
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<br> <br>
<a href="#"><img src="https://github.com/millix/millix-wallet/blob/master/app/icon.png?raw=true" alt="millix node" width="200"></a> <a href="#"><img src="https://github.com/millix/millix-wallet/blob/master/app/icon.png?raw=true" alt="millix node" width="200"></a>
<br> <br>
millix node <small>v1.11.6</small> millix node <small>v1.12.7</small>
<br> <br>
</h1> </h1>
......
import database from '../../database/database';
import Endpoint from '../endpoint';
/**
* api get_config_by_name
*/
class _2wYLWQfWBa6GLPYs extends Endpoint {
constructor() {
super('2wYLWQfWBa6GLPYs');
}
/**
* get config value by name
* @param app
* @param req
* @param res
* @returns {*}
*/
handler(app, req, res) {
const {p0: configName} = req.query;
if (!configName) {
return res.status(400).send({
api_status: 'fail',
api_message: 'p0<config_name> is required'
});
}
const configurationRepository = database.getRepository('config');
configurationRepository.getConfig(configName.toLowerCase())
.then(configuration => res.send(configuration))
.catch(e => res.send({
api_status: 'fail',
api_message: `unexpected generic api error: (${e})`
}));
}
}
export default new _2wYLWQfWBa6GLPYs();
\ No newline at end of file
...@@ -18,21 +18,39 @@ class _LLpSTquu4tZL8Nu5 extends Endpoint { ...@@ -18,21 +18,39 @@ class _LLpSTquu4tZL8Nu5 extends Endpoint {
* @returns {*} * @returns {*}
*/ */
handler(app, req, res) { handler(app, req, res) {
const {p0: configID, p1: value} = req.query; if (req.method === 'POST') {
if (!configID || value === undefined) { if (!req.body.p0 || !req.body.p1) {
return res.status(400).send({ return res.status(400)
api_status : 'fail', .send({
api_message: 'p0<config_id> and p1<value> are required' api_status: 'fail',
}); api_message: `p0<config_id> and p1<config_value> are rquired`
})
} }
let configID = req.body.p0;
let value = req.body.p1;
const configurationRepository = database.getRepository('config'); const configurationRepository = database.getRepository('config');
if (typeof value === 'object') {
value = JSON.stringify(value);
}
configurationRepository.updateConfigByID(configID, value) configurationRepository.updateConfigByID(configID, value)
.then(() => res.send({api_status: 'success'})) .then((row) => res.send({
api_status: 'success',
row: row
}))
.catch(e => res.send({ .catch(e => res.send({
api_status : 'fail', api_status: 'fail',
api_message: `unexpected generic api error: (${e})` api_message: `unexpected generic api error: (${e})`
})); }));
} else {
return res.status(400)
.send({
api_status: 'fail',
api_message: 'POST only'
})
}
} }
} }
......
import database from '../../database/database';
import Endpoint from "../endpoint";
/**
* api remove_address_version
*/
class _XgxHmjINTEqANwtS extends Endpoint {
constructor() {
super('XgxHmjINTEqANwtS');
}
/**
*
* @param app
* @param req
* @param res
* @returns {*}
*/
handler(app, req, res) {
const {p0: version} = req.query;
if (!version) {
return res.status(400).send({
api_status: 'fail',
api_message: 'p0<version> is required'
});
}
database.getRepository('address')
.removeAddressVersion(version)
.then(() => res.send({
app_status: 'success'
}))
.catch(e => res.send({
api_status: 'fail',
api_message: `unexpected generic api error: (${e})`
}));
}
}
export default new _XgxHmjINTEqANwtS();
\ No newline at end of file
import network from "../../net/network";
import Endpoint from "../endpoint";
/**
* api get_node_public_ip
*/
class _qRHogKQ1Bb7OT4N9 extends Endpoint {
constructor() {
super('qRHogKQ1Bb7OT4N9');
}
handler(app, req, res) {
res.send({
node_public_ip: network.nodePublicIp
})
}
}
export default new _qRHogKQ1Bb7OT4N9();
\ No newline at end of file
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
"id": "LLpSTquu4tZL8Nu5", "id": "LLpSTquu4tZL8Nu5",
"name": "update_config_value", "name": "update_config_value",
"description": "updates table config value field for the indicated config_id record", "description": "updates table config value field for the indicated config_id record",
"method": "GET", "method": "POST",
"version_released": "1.2.0", "version_released": "1.2.0",
"permission": "{\"require_identity\": true, \"private\": true}", "permission": "{\"require_identity\": true, \"private\": true}",
"enable": true "enable": true
...@@ -441,6 +441,15 @@ ...@@ -441,6 +441,15 @@
"permission": "{\"require_identity\": true, \"private\": true}", "permission": "{\"require_identity\": true, \"private\": true}",
"enable": true "enable": true
}, },
{
"id": "2wYLWQfWBa6GLPYs",
"name": "get_config_by_name",
"description": "get node config by name",
"method": "GET",
"version_released": "1.11.6",
"permission": "{\"require_identity\": true, \"private\": true}",
"enable": true
},
{ {
"id": "NPCpnfUyPHRH4j29", "id": "NPCpnfUyPHRH4j29",
"name": "get_known_wallet_balance", "name": "get_known_wallet_balance",
...@@ -450,6 +459,24 @@ ...@@ -450,6 +459,24 @@
"permission": "{\"require_identity\": true, \"private\": true}", "permission": "{\"require_identity\": true, \"private\": true}",
"enable": true "enable": true
}, },
{
"id": "qRHogKQ1Bb7OT4N9",
"name": "get_node_public_ip",
"description": "get node public ip",
"method": "GET",
"version_released": "1.11.6",
"permission": "{\"require_identity\": true, \"private\": true}",
"enable": true
},
{
"id": "XgxHmjINTEqANwtS",
"name": "remove_address_version",
"description": "remove wallet address version",
"method": "GET",
"version_released": "1.11.6",
"permission": "{\"require_identity\": true, \"private\": true}",
"enable": true
},
{ {
"id": "xGaf7vbfY15TGsSd", "id": "xGaf7vbfY15TGsSd",
"name": "get_known_address_balance", "name": "get_known_address_balance",
......
...@@ -771,8 +771,8 @@ export const NETWORK_SHORT_TIME_WAIT_MAX = 1500; ...@@ -771,8 +771,8 @@ export const NETWORK_SHORT_TIME_WAIT_MAX = 1500;
export const DATABASE_ENGINE = 'sqlite'; export const DATABASE_ENGINE = 'sqlite';
export const DATABASE_CONNECTION = {}; export const DATABASE_CONNECTION = {};
export const MILLIX_CIRCULATION = 9e15; export const MILLIX_CIRCULATION = 9e15;
export const NODE_MILLIX_BUILD_DATE = 1631097631; export const NODE_MILLIX_BUILD_DATE = 1640009160;
export const NODE_MILLIX_VERSION = '1.12.6-tangled'; export const NODE_MILLIX_VERSION = '1.12.7-tangled';
export const DATA_BASE_DIR_MAIN_NETWORK = './millix-tangled'; export const DATA_BASE_DIR_MAIN_NETWORK = './millix-tangled';
export const DATA_BASE_DIR_TEST_NETWORK = './millix-tangled'; export const DATA_BASE_DIR_TEST_NETWORK = './millix-tangled';
let DATA_BASE_DIR = MODE_TEST_NETWORK ? DATA_BASE_DIR_TEST_NETWORK : DATA_BASE_DIR_MAIN_NETWORK; let DATA_BASE_DIR = MODE_TEST_NETWORK ? DATA_BASE_DIR_TEST_NETWORK : DATA_BASE_DIR_MAIN_NETWORK;
......
...@@ -39,8 +39,7 @@ export default class Config { ...@@ -39,8 +39,7 @@ export default class Config {
], (err, row) => { ], (err, row) => {
if (err) { if (err) {
reject(row); reject(row);
} } else {
else {
resolve(row); resolve(row);
} }
}); });
...@@ -60,11 +59,15 @@ export default class Config { ...@@ -60,11 +59,15 @@ export default class Config {
} }
updateConfigByID(configID, value) { updateConfigByID(configID, value) {
let where = {config_id: configID};
let set = [];
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.database.run('UPDATE config SET value=? WHERE config_id=?', [ set['value'] = value;
configID, const {
value sql,
], (err, row) => { parameters
} = Database.buildUpdate('UPDATE config', set, where);
this.database.run(sql, parameters, (err, row) => {
if (err) { if (err) {
return reject(err.message); return reject(err.message);
} }
......
...@@ -126,6 +126,6 @@ db.initialize() ...@@ -126,6 +126,6 @@ db.initialize()
}); });
} }
}); });
//millix v1.12.6-tangled //millix v1.12.7-tangled
\ No newline at end of file
...@@ -918,6 +918,7 @@ class Network { ...@@ -918,6 +918,7 @@ class Network {
if (!config.NODE_NAT_PMP) { if (!config.NODE_NAT_PMP) {
return Promise.resolve(); return Promise.resolve();
} }
const portMapper = util.promisify(this.natAPI.map.bind(this.natAPI)); const portMapper = util.promisify(this.natAPI.map.bind(this.natAPI));
return portMapper({ return portMapper({
publicPort : config.NODE_PORT, publicPort : config.NODE_PORT,
......
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