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

update millix node

parent e497b430
......@@ -2,7 +2,7 @@
<br>
<a href="#"><img src="https://github.com/millix/millix-wallet/blob/master/app/icon.png?raw=true" alt="millix node" width="200"></a>
<br>
millix node <small>v1.11.6</small>
millix node <small>v1.12.7</small>
<br>
</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 {
* @returns {*}
*/
handler(app, req, res) {
const {p0: configID, p1: value} = req.query;
if (!configID || value === undefined) {
return res.status(400).send({
api_status : 'fail',
api_message: 'p0<config_id> and p1<value> are required'
});
}
if (req.method === 'POST') {
if (!req.body.p0 || !req.body.p1) {
return res.status(400)
.send({
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');
if (typeof value === 'object') {
value = JSON.stringify(value);
}
const configurationRepository = database.getRepository('config');
configurationRepository.updateConfigByID(configID, value)
.then(() => res.send({api_status: 'success'}))
.catch(e => res.send({
api_status : 'fail',
api_message: `unexpected generic api error: (${e})`
}));
configurationRepository.updateConfigByID(configID, value)
.then((row) => res.send({
api_status: 'success',
row: row
}))
.catch(e => res.send({
api_status: 'fail',
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 @@
"id": "LLpSTquu4tZL8Nu5",
"name": "update_config_value",
"description": "updates table config value field for the indicated config_id record",
"method": "GET",
"method": "POST",
"version_released": "1.2.0",
"permission": "{\"require_identity\": true, \"private\": true}",
"enable": true
......@@ -441,6 +441,15 @@
"permission": "{\"require_identity\": true, \"private\": 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",
"name": "get_known_wallet_balance",
......@@ -450,6 +459,24 @@
"permission": "{\"require_identity\": true, \"private\": 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",
"name": "get_known_address_balance",
......
......@@ -771,8 +771,8 @@ export const NETWORK_SHORT_TIME_WAIT_MAX = 1500;
export const DATABASE_ENGINE = 'sqlite';
export const DATABASE_CONNECTION = {};
export const MILLIX_CIRCULATION = 9e15;
export const NODE_MILLIX_BUILD_DATE = 1631097631;
export const NODE_MILLIX_VERSION = '1.12.6-tangled';
export const NODE_MILLIX_BUILD_DATE = 1640009160;
export const NODE_MILLIX_VERSION = '1.12.7-tangled';
export const DATA_BASE_DIR_MAIN_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;
......
......@@ -39,8 +39,7 @@ export default class Config {
], (err, row) => {
if (err) {
reject(row);
}
else {
} else {
resolve(row);
}
});
......@@ -60,11 +59,15 @@ export default class Config {
}
updateConfigByID(configID, value) {
let where = {config_id: configID};
let set = [];
return new Promise((resolve, reject) => {
this.database.run('UPDATE config SET value=? WHERE config_id=?', [
configID,
value
], (err, row) => {
set['value'] = value;
const {
sql,
parameters
} = Database.buildUpdate('UPDATE config', set, where);
this.database.run(sql, parameters, (err, row) => {
if (err) {
return reject(err.message);
}
......
FROM node:12-alpine
RUN apk update && \
apk add --no-cache --virtual .build-deps-full \
build-base \
python2 \
curl \
wget \
gcc \
git
RUN git clone https://github.com/millix/millix-node.git -b develop
WORKDIR /millix-node
RUN npm install -g @babel/cli@7.8.4 @babel/core@7.8.4 @babel/node@7.8.4 && \
npm install
ENV MILLIX_NODE_PASSWORD="millixpwd"
ENV MILLIX_NODE_PORT=30000
ENV MILLIX_NODE_PORT_API=5500
ENV MILLIX_NODE_DATA_FOLDER="./data/"
COPY run_node.sh run_node.sh
RUN chmod +x run_node.sh
EXPOSE $MILLIX_NODE_PORT
EXPOSE $MILLIX_NODE_PORT_API
ENTRYPOINT [ "/bin/sh" ]
CMD [ "run_node.sh" ]
FROM node:12-alpine
RUN apk update && \
apk add --no-cache --virtual .build-deps-full \
build-base \
python2 \
curl \
wget \
gcc \
git
RUN git clone https://github.com/millix/millix-node.git -b develop
WORKDIR /millix-node
RUN npm install -g @babel/cli@7.8.4 @babel/core@7.8.4 @babel/node@7.8.4 && \
npm install
ENV MILLIX_NODE_PASSWORD="millixpwd"
ENV MILLIX_NODE_PORT=30000
ENV MILLIX_NODE_PORT_API=5500
ENV MILLIX_NODE_DATA_FOLDER="./data/"
COPY run_node.sh run_node.sh
RUN chmod +x run_node.sh
EXPOSE $MILLIX_NODE_PORT
EXPOSE $MILLIX_NODE_PORT_API
ENTRYPOINT [ "/bin/sh" ]
CMD [ "run_node.sh" ]
version: '3'
services:
millix-node:
image: millix/millix-node
build: .
environment:
- MILLIX_NODE_PASSWORD=millixpwd
- MILLIX_NODE_DATA_FOLDER=./data/
- MILLIX_NODE_PORT=${MILLIX_NODE_PORT}
- MILLIX_NODE_PORT_API=${MILLIX_NODE_PORT_API}
ports:
- ${MILLIX_NODE_PORT}
- ${MILLIX_NODE_PORT_API}
version: '3'
services:
millix-node:
image: millix/millix-node
build: .
environment:
- MILLIX_NODE_PASSWORD=millixpwd
- MILLIX_NODE_DATA_FOLDER=./data/
- MILLIX_NODE_PORT=${MILLIX_NODE_PORT}
- MILLIX_NODE_PORT_API=${MILLIX_NODE_PORT_API}
ports:
- ${MILLIX_NODE_PORT}
- ${MILLIX_NODE_PORT_API}
......@@ -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 {
if (!config.NODE_NAT_PMP) {
return Promise.resolve();
}
const portMapper = util.promisify(this.natAPI.map.bind(this.natAPI));
return portMapper({
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