mirror of
https://github.com/Ride-The-Lightning/RTL
synced 2024-11-07 15:20:31 +00:00
e45d6d598a
- Package updates Updated docker NodeJS from 10 to 14 Updated Angular from 11 to 12 Updated Material from 11 to 12 Updated Angular cli from 11 to 12 Updated Karma from 5 to 6 Updated rxjs from 6 to 7 Updated ngrx from 10 to 12 Updated angularx-qrcode from 10 to 11 Updated @angular/flex-layout from 11 to 12 Updated angular-user-idle from 2.2.4 to 2.2.5 Updated typescript from 4.0.2 to 4.2.4 Updated zone.js from 0.10.2 to 0.11.4 Migrated from TSLint to ESLint Installed save-dev crypto-browserify & stream-browserify - Mask password with fixed length #689 - CSRF Token (#696) - Route lock default password (#700) - ECL Invoice amount mislabeled #694 - ECL & LND Fee report time zone offset bug fixes #692 & #693 - Loop remove max routing fee validation #690 - Child route refresh bug - Adding Password Blacklist (#704) - Fee rate in percentage #621 (#705) - ECL Adding BaseFee and FeeRate on Channels - LND Invoice and Payment pagination fix (#707) - Keysend missing QR code bug fix - Login page XS layout fix - Reports tables load time improved (#709) - Report initial table load bug fix
56 lines
2.5 KiB
JavaScript
56 lines
2.5 KiB
JavaScript
var request = require('request-promise');
|
|
var common = require('../../routes/common');
|
|
var logger = require('../shared/logger');
|
|
var options = {};
|
|
|
|
exports.getInfo = (req, res, next) => {
|
|
logger.log({level: 'INFO', fileName: 'GetInfo', msg: 'Getting Eclair Node Information..'});
|
|
common.setOptions();
|
|
options = common.getOptions();
|
|
options.url = common.getSelLNServerUrl() + '/getinfo';
|
|
options.form = {};
|
|
logger.log({level: 'DEBUG', fileName:'GetInfo', msg: 'Selected Node', data: common.selectedNode.ln_node});
|
|
logger.log({level: 'DEBUG', fileName: 'GetInfo', msg: 'Calling Info from Eclair server url', data: options.url});
|
|
if (common.read_dummy_data) {
|
|
common.getDummyData('GetInfo').then(function(data) {
|
|
data.currency_unit = 'BTC';
|
|
data.smaller_currency_unit = 'Sats';
|
|
data.lnImplementation = 'Eclair';
|
|
res.status(200).json(data);
|
|
});
|
|
} else {
|
|
if (!options.headers || !options.headers.authorization) {
|
|
logger.log({level: 'ERROR', fileName: 'GetInfo', msg: 'Eclair Get info failed due to missing or wrong password!', error: {error: 'Missing or wrong password.'}});
|
|
res.status(502).json({
|
|
message: "Fetching Info Failed!",
|
|
error: "Missing Or Wrong Password"
|
|
});
|
|
} else {
|
|
request.post(options).then((body) => {
|
|
logger.log({level: 'DEBUG', fileName: 'GetInfo', msg: 'Get Info Response', data: body});
|
|
const body_str = (!body) ? '' : JSON.stringify(body);
|
|
const search_idx = (!body) ? -1 : body_str.search('Not Found');
|
|
body.currency_unit = 'BTC';
|
|
body.smaller_currency_unit = 'Sats';
|
|
body.lnImplementation = 'Eclair';
|
|
logger.log({level: 'INFO', fileName: 'GetInfo', msg: 'Eclair Node Information Received'});
|
|
res.status(200).json(body);
|
|
})
|
|
.catch(errRes => {
|
|
let err = JSON.parse(JSON.stringify(errRes));
|
|
if (err.options && err.options.headers && err.options.headers.authorization) {
|
|
delete err.options.headers.authorization;
|
|
}
|
|
if (err.response && err.response.request && err.response.request.headers && err.response.request.headers.authorization) {
|
|
delete err.response.request.headers.authorization;
|
|
}
|
|
logger.log({level: 'ERROR', fileName: 'GetInfo', msg: 'Get Info Error', error: err});
|
|
return res.status(err.statusCode ? err.statusCode : 500).json({
|
|
message: "Fetching Info failed!",
|
|
error: err.error && err.error.error ? err.error.error : err.error ? err.error : "Unknown Server Error"
|
|
});
|
|
});
|
|
}
|
|
}
|
|
};
|