Incomplete lazy load 8

Incomplete lazy load 8
This commit is contained in:
Shahana Farooqui 2019-09-01 13:01:38 -04:00
parent 700015756b
commit ab54c44b73
104 changed files with 1859 additions and 405 deletions

1309
angular/3rdpartylicenses.txt Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

13
angular/index.html Normal file
View file

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>RTL</title>
<base href="/rtl/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="assets/images/favicon.ico">
<link rel="stylesheet" href="styles.13a9674cdbdfd014a4cf.css"></head>
<body>
<rtl-app></rtl-app>
<script src="runtime-es2015.cfa71c54e15a6c718aca.js" type="module"></script><script src="polyfills-es2015.af35579f5b57e97fcdea.js" type="module"></script><script src="runtime-es5.b86f7586cfa5da780947.js" nomodule></script><script src="polyfills-es5.b0194fb9fe520b48eee4.js" nomodule></script><script src="main-es2015.1904367b2b24393a5789.js" type="module"></script><script src="main-es5.41b2cf8c7f3439ee79ab.js" nomodule></script></body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],f=r[2],p=0,s=[];p<i.length;p++)o[a=i[p]]&&s.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={0:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise(function(r,n){t=o[e]=[r,n]});r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({1:"common"}[e]||e)+"-es2015."+{1:"cdb456591cf77a91637a",5:"1848127f55e861ccca26",6:"1499505a73e708f00bfd"}[e]+".js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var f=setTimeout(function(){u({type:"timeout",target:i})},12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,(function(r){return e[r]}).bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var f=0;f<i.length;f++)r(i[f]);var l=c;t()}([]);

View file

@ -0,0 +1 @@
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],f=r[2],p=0,s=[];p<a.length;p++)o[i=a[p]]&&s.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++)0!==o[t[a]]&&(n=!1);n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={1:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise(function(r,n){t=o[e]=[r,n]});r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({0:"common"}[e]||e)+"-es5."+{0:"8dfc5db376f8ee154780",4:"ded62722867169120cb5",5:"7a7bb46b0a89a5cc9928"}[e]+".js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var f=setTimeout(function(){u({type:"timeout",target:a})},12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,(function(r){return e[r]}).bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var l=c;t()}([]);

File diff suppressed because one or more lines are too long

73
app.js
View file

@ -4,26 +4,30 @@ const bodyParser = require("body-parser");
const cookieParser = require("cookie-parser");
const common = require("./common");
const app = express();
//Declare all Routes here
const authenticateRoutes = require("./routes/authenticate");
const infoRoutes = require("./routes/getInfo");
const channelsRoutes = require("./routes/channels");
const channelsBackupRoutes = require("./routes/channelsBackup");
const peersRoutes = require("./routes/peers");
const feesRoutes = require("./routes/fees");
const balanceRoutes = require("./routes/balance");
const walletRoutes = require("./routes/wallet");
const graphRoutes = require("./routes/graph");
const newAddressRoutes = require("./routes/newAddress");
const transactionsRoutes = require("./routes/transactions");
const payReqRoutes = require("./routes/payReq");
const paymentsRoutes = require("./routes/payments");
const RTLConfRoutes = require("./routes/RTLConf");
const invoiceRoutes = require("./routes/invoices");
const switchRoutes = require("./routes/switch");
const baseHref = "/rtl/";
const apiRoot = baseHref + "api/";
const apiLNDRoot = baseHref + "api/lnd/";
const apiCLRoot = baseHref + "api/cl/";
const authenticateRoutes = require("./routes/authenticate");
const RTLConfRoutes = require("./routes/RTLConf");
const infoRoutes = require("./routes/lnd/getInfo");
const channelsRoutes = require("./routes/lnd/channels");
const channelsBackupRoutes = require("./routes/lnd/channelsBackup");
const peersRoutes = require("./routes/lnd/peers");
const feesRoutes = require("./routes/lnd/fees");
const balanceRoutes = require("./routes/lnd/balance");
const walletRoutes = require("./routes/lnd/wallet");
const graphRoutes = require("./routes/lnd/graph");
const newAddressRoutes = require("./routes/lnd/newAddress");
const transactionsRoutes = require("./routes/lnd/transactions");
const payReqRoutes = require("./routes/lnd/payReq");
const paymentsRoutes = require("./routes/lnd/payments");
const invoiceRoutes = require("./routes/lnd/invoices");
const switchRoutes = require("./routes/lnd/switch");
const infoCLRoutes = require("./routes/c-lightning/getInfo");
const feesCLRoutes = require("./routes/c-lightning/fees");
app.use(cookieParser(common.secret_key));
app.use(bodyParser.json());
@ -45,25 +49,26 @@ app.use((req, res, next) => {
});
// CORS fix, Only required for developement due to separate backend and frontend servers
// Use declared routes here
app.use(apiRoot + "authenticate", authenticateRoutes);
app.use(apiRoot + "getinfo", infoRoutes);
app.use(apiRoot + "channels", channelsRoutes);
app.use(apiRoot + "channels/backup", channelsBackupRoutes);
app.use(apiRoot + "peers", peersRoutes);
app.use(apiRoot + "fees", feesRoutes);
app.use(apiRoot + "balance", balanceRoutes);
app.use(apiRoot + "wallet", walletRoutes);
app.use(apiRoot + "network", graphRoutes);
app.use(apiRoot + "newaddress", newAddressRoutes);
app.use(apiRoot + "transactions", transactionsRoutes);
app.use(apiRoot + "payreq", payReqRoutes);
app.use(apiRoot + "payments", paymentsRoutes);
app.use(apiRoot + "conf", RTLConfRoutes);
app.use(apiRoot + "invoices", invoiceRoutes);
app.use(apiRoot + "switch", switchRoutes);
app.use(apiLNDRoot + "getinfo", infoRoutes);
app.use(apiLNDRoot + "channels", channelsRoutes);
app.use(apiLNDRoot + "channels/backup", channelsBackupRoutes);
app.use(apiLNDRoot + "peers", peersRoutes);
app.use(apiLNDRoot + "fees", feesRoutes);
app.use(apiLNDRoot + "balance", balanceRoutes);
app.use(apiLNDRoot + "wallet", walletRoutes);
app.use(apiLNDRoot + "network", graphRoutes);
app.use(apiLNDRoot + "newaddress", newAddressRoutes);
app.use(apiLNDRoot + "transactions", transactionsRoutes);
app.use(apiLNDRoot + "payreq", payReqRoutes);
app.use(apiLNDRoot + "payments", paymentsRoutes);
app.use(apiLNDRoot + "invoices", invoiceRoutes);
app.use(apiLNDRoot + "switch", switchRoutes);
app.use(apiCLRoot + "getinfo", infoCLRoutes);
app.use(apiCLRoot + "fees", feesCLRoutes);
// sending angular application when route doesn't match
app.use((req, res, next) => {
res.sendFile(path.join(__dirname, "angular", "index.html"));
});

View file

@ -27,7 +27,6 @@ common.setOptions = () => {
if(undefined !== common.nodes[0].options && undefined !== common.nodes[0].options.headers) { return; }
try {
common.nodes.forEach(node => {
console.log(node);
node.options = {
url: '',
rejectUnauthorized: false,
@ -37,7 +36,7 @@ common.setOptions = () => {
if(node.ln_implementation.toLowerCase() !== 'clightning') {
node.options.headers = {'Grpc-Metadata-macaroon': fs.readFileSync(node.macaroon_path + '/admin.macaroon').toString('hex')};
} else {
node.options.headers = {'macaroon': fs.readFileSync(node.macaroon_path + '/access.macaroon').toString('hex')};
node.options.headers = {'macaroon': Buffer.from(fs.readFileSync(node.macaroon_path + '/access.macaroon')).toString("base64")};
}
});
// Options cannot be set before selected node initializes. Updating selected node's options separatly
@ -47,9 +46,11 @@ common.setOptions = () => {
json: true,
form: ''
};
if(common.selectedNode.ln_implementation.toLowerCase() !== 'clightning') {
if (common.selectedNode.ln_implementation.toLowerCase() !== 'clightning') {
common.selectedNode.options.headers = {'Grpc-Metadata-macaroon': fs.readFileSync(common.selectedNode.macaroon_path + '/admin.macaroon').toString('hex')};
}
} else {
node.selectedNode.options.headers = {'macaroon': Buffer.from(fs.readFileSync(node.macaroon_path + '/access.macaroon')).toString("base64")};
}
} catch(err) {
console.error('Common Set Options Error:' + JSON.stringify(err));
common.nodes.forEach(node => {

View file

@ -262,14 +262,10 @@ connect.validateMultiNodeConfig = (config) => {
config.nodes.forEach((node, idx) => {
common.nodes[idx] = {};
if(node.lnImplementation.toString().toLowerCase() === 'clightning') {
common.nodes[idx].macaroon_path = '';
if(node.Authentication.macaroonPath === '' || undefined === node.Authentication.macaroonPath) {
errMsg = 'Please set macaroon path for node index ' + node.index + ' in RTL-Multi-Node-Conf.json!';
} else {
if(node.Authentication.macaroonPath === '' || undefined === node.Authentication.macaroonPath) {
errMsg = 'Please set macaroon path for node index ' + node.index + ' in RTL-Multi-Node-Conf.json!';
} else {
common.nodes[idx].macaroon_path = node.Authentication.macaroonPath;
}
common.nodes[idx].macaroon_path = node.Authentication.macaroonPath;
}
if((node.Settings.lndServerUrl === '' || undefined === node.Settings.lndServerUrl)) {

View file

@ -6,7 +6,7 @@ var common = require('../common');
exports.updateSelectedNode = (req, res, next) => {
const selNodeIndex = req.body.selNodeIndex;
common.selectedNode = common.findNode(selNodeIndex);
logger.info({fileName: 'RTLConf', msg: 'Selected Node Updated!' + JSON.stringify(common.selectedNode.ln_node)});
logger.info({fileName: 'RTLConf', msg: 'Selected Node Updated To: ' + JSON.stringify(common.selectedNode.ln_node)});
res.status(200).json({status: 'Selected Node Updated!'});
};

View file

@ -0,0 +1,50 @@
var request = require('request-promise');
var common = require('../../common');
var logger = require('../logger');
var options = {};
exports.getFees = (req, res, next) => {
options = common.getOptions();
options.url = common.getSelLNDServerUrl() + '/getFees';
request(options).then((body) => {
logger.info({fileName: 'Fees', msg: 'Fee Received: ' + JSON.stringify(body)});
if(undefined === body || body.error) {
res.status(500).json({
message: "Fetching fee failed!",
error: (undefined === body) ? 'Error From Server!' : body.error
});
} else {
if (undefined === body.day_fee_sum) {
body.day_fee_sum = 0;
body.btc_day_fee_sum = 0;
} else {
body.btc_day_fee_sum = common.convertToBTC(body.day_fee_sum);
}
if (undefined === body.week_fee_sum) {
body.week_fee_sum = 0;
body.btc_week_fee_sum = 0;
} else {
body.btc_week_fee_sum = common.convertToBTC(body.week_fee_sum);
}
if (undefined === body.month_fee_sum) {
body.month_fee_sum = 0;
body.btc_month_fee_sum = 0;
} else {
body.btc_month_fee_sum = common.convertToBTC(body.month_fee_sum);
}
if(undefined === body.feeCollected) {
body.feeCollected = 0;
body.btc_feeCollected = 0;
} else {
body.btc_feeCollected = common.convertToBTC(body.feeCollected);
}
res.status(200).json(body);
}
})
.catch(function (err) {
return res.status(500).json({
message: "Fetching fee failed!",
error: err.error
});
});
};

View file

@ -0,0 +1,37 @@
var request = require('request-promise');
var common = require('../../common');
var logger = require('../logger');
var connect = require('../../connect');
var options = {};
exports.getInfo = (req, res, next) => {
common.setOptions();
options = common.getOptions();
options.url = common.getSelLNDServerUrl() + '/getinfo';
if(common.multi_node_setup) {
logger.info({fileName:'GetInfo', msg: 'Selected Node: ' + JSON.stringify(common.selectedNode.ln_node)});
} else {
logger.info({fileName:'GetInfo', msg: 'Single Node Setup!'});
}
common.nodes.map(node => { if (node.lnImplementation === 'LND') { connect.getAllNodeAllChannelBackup(node); }});
logger.info({fileName: 'GetInfo', msg: 'Calling getinfo from c-lightning server url: ' + options.url});
request(options).then((body) => {
logger.info({fileName: 'GetInfo', msg: JSON.stringify(body)});
const body_str = (undefined === body) ? '' : JSON.stringify(body);
const search_idx = (undefined === body) ? -1 : body_str.search('Not Found');
if(undefined === body || search_idx > -1 || body.error) {
res.status(500).json({
message: "Fetching Info failed!",
error: (undefined === body || search_idx > -1) ? 'Error From Server!' : body.error
});
} else {
res.status(200).json(body);
}
})
.catch(function (err) {
return res.status(500).json({
message: "Fetching Info failed!",
error: err.error
});
});
};

View file

@ -1,6 +1,6 @@
var request = require('request-promise');
var common = require('../common');
var logger = require('./logger');
var common = require('../../common');
var logger = require('../logger');
var options = {};
exports.getBalance = (req, res, next) => {

View file

@ -1,6 +1,6 @@
var request = require('request-promise');
var common = require('../common');
var logger = require('./logger');
var common = require('../../common');
var logger = require('../logger');
var options = {};
getAliasForChannel = (channel, channelType) => {

View file

@ -1,7 +1,7 @@
var request = require('request-promise');
var fs = require('fs');
var common = require('../common');
var logger = require('./logger');
var common = require('../../common');
var logger = require('../logger');
var options = {};
exports.getBackup = (req, res, next) => {

View file

@ -1,6 +1,6 @@
var request = require('request-promise');
var common = require('../common');
var logger = require('./logger');
var common = require('../../common');
var logger = require('../logger');
var options = {};
exports.getFees = (req, res, next) => {

View file

@ -1,7 +1,7 @@
var request = require('request-promise');
var common = require('../common');
var logger = require('./logger');
var connect = require('../connect');
var common = require('../../common');
var logger = require('../logger');
var connect = require('../../connect');
var options = {};
exports.getInfo = (req, res, next) => {

View file

@ -1,6 +1,6 @@
var request = require("request-promise");
var common = require('../common');
var logger = require('./logger');
var common = require('../../common');
var logger = require('../logger');
var options = {};
getAliasFromPubkey = (hop) => {

View file

@ -1,6 +1,6 @@
var request = require('request-promise');
var options = require("../connect");
var common = require('../common');
var options = require("../../connect");
var common = require('../../common');
exports.getGraphInfo = (req, res, next) => {
options = common.getOptions();

View file

@ -1,6 +1,6 @@
var request = require('request-promise');
var common = require('../common');
var logger = require('./logger');
var common = require('../../common');
var logger = require('../logger');
var options = {};
exports.getInvoice = (req, res, next) => {

View file

@ -1,6 +1,6 @@
var request = require('request-promise');
var common = require('../common');
var logger = require('./logger');
var common = require('../../common');
var logger = require('../logger');
var options = {};
exports.getNewAddress = (req, res, next) => {

View file

@ -1,6 +1,6 @@
var request = require('request-promise');
var common = require('../common');
var logger = require('./logger');
var common = require('../../common');
var logger = require('../logger');
var options = {};
exports.decodePayment = (req, res, next) => {

View file

@ -1,6 +1,6 @@
var request = require('request-promise');
var common = require('../common');
var logger = require('./logger');
var common = require('../../common');
var logger = require('../logger');
var options = {};
exports.getPayments = (req, res, next) => {

View file

@ -1,6 +1,6 @@
var request = require('request-promise');
var common = require('../common');
var logger = require('./logger');
var common = require('../../common');
var logger = require('../logger');
var options = {};
getAliasForPeers = (peer) => {

View file

@ -1,6 +1,6 @@
var request = require('request-promise');
var common = require('../common');
var logger = require('./logger');
var common = require('../../common');
var logger = require('../logger');
var options = {};
exports.forwardingHistory = (req, res, next) => {

View file

@ -1,6 +1,6 @@
var request = require('request-promise');
var common = require('../common');
var logger = require('./logger');
var common = require('../../common');
var logger = require('../logger');
var options = {};
exports.getTransactions = (req, res, next) => {

View file

@ -1,7 +1,7 @@
var request = require('request-promise');
var common = require('../common');
var common = require('../../common');
var atob = require('atob');
var logger = require('./logger');
var logger = require('../logger');
var options = {};
exports.genSeed = (req, res, next) => {

View file

@ -0,0 +1,8 @@
const FeesController = require("../../controllers/c-lightning/fees");
const express = require("express");
const router = express.Router();
const authCheck = require("../authCheck");
router.get("/", authCheck, FeesController.getFees);
module.exports = router;

View file

@ -0,0 +1,8 @@
const infoController = require("../../controllers/c-lightning/getInfo");
const express = require("express");
const router = express.Router();
const authCheck = require("../authCheck");
router.get("/", authCheck, infoController.getInfo);
module.exports = router;

View file

@ -1,7 +1,7 @@
const BalanceController = require("../controllers/balance");
const BalanceController = require("../../controllers/lnd/balance");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/:source", authCheck, BalanceController.getBalance);

View file

@ -1,7 +1,7 @@
const ChannelsController = require("../controllers/channels");
const ChannelsController = require("../../controllers/lnd/channels");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/", authCheck, ChannelsController.getChannels);
router.post("/", authCheck, ChannelsController.postChannel);

View file

@ -1,7 +1,7 @@
const ChannelsBackupController = require("../controllers/channelsBackup");
const ChannelsBackupController = require("../../controllers/lnd/channelsBackup");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/:channelPoint", authCheck, ChannelsBackupController.getBackup);
router.post("/verify/:channelPoint", authCheck, ChannelsBackupController.postBackupVerify);

View file

@ -1,7 +1,7 @@
const FeesController = require("../controllers/fees");
const FeesController = require("../../controllers/lnd/fees");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/", authCheck, FeesController.getFees);

View file

@ -1,7 +1,7 @@
const infoController = require("../controllers/getInfo");
const infoController = require("../../controllers/lnd/getInfo");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/", authCheck, infoController.getInfo);

View file

@ -1,7 +1,7 @@
const graphController = require("../controllers/graph");
const graphController = require("../../controllers/lnd/graph");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/", authCheck, graphController.getDescribeGraph);
router.get("/info", authCheck, graphController.getGraphInfo);

View file

@ -1,4 +1,4 @@
const graphInfoController = require("../controllers/graphInfo");
const graphInfoController = require("../../controllers/graphInfo");
const express = require("express");
const router = express.Router();

View file

@ -1,7 +1,7 @@
const invoicesController = require("../controllers/invoices");
const invoicesController = require("../../controllers/lnd/invoices");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/", authCheck, invoicesController.listInvoices);
router.get("/:rHashStr", authCheck, invoicesController.getInvoice);

View file

@ -1,4 +1,4 @@
const LNDSettingsController = require("../controllers/lndConfSettings");
const LNDSettingsController = require("../../controllers/lndConfSettings");
const express = require("express");
const router = express.Router();

View file

@ -1,7 +1,7 @@
const NewAddressController = require("../controllers/newAddress");
const NewAddressController = require("../../controllers/lnd/newAddress");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/", authCheck, NewAddressController.getNewAddress);

View file

@ -1,7 +1,7 @@
const PayRequestController = require("../controllers/payReq");
const PayRequestController = require("../../controllers/lnd/payReq");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/:payRequest", authCheck, PayRequestController.decodePayment);

View file

@ -1,7 +1,7 @@
const PaymentsController = require("../controllers/payments");
const PaymentsController = require("../../controllers/lnd/payments");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/", authCheck, PaymentsController.getPayments);

View file

@ -1,7 +1,7 @@
const PeersController = require("../controllers/peers");
const PeersController = require("../../controllers/lnd/peers");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/", authCheck, PeersController.getPeers);
router.post("/", authCheck, PeersController.postPeer);

View file

@ -1,7 +1,7 @@
const SwitchController = require("../controllers/switch");
const SwitchController = require("../../controllers/lnd/switch");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.post("/", authCheck, SwitchController.forwardingHistory);

View file

@ -1,7 +1,7 @@
const TransactionsController = require("../controllers/transactions");
const TransactionsController = require("../../controllers/lnd/transactions");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/", authCheck, TransactionsController.getTransactions);
router.post("/", authCheck, TransactionsController.postTransactions);

View file

@ -1,7 +1,7 @@
const WalletController = require("../controllers/wallet");
const WalletController = require("../../controllers/lnd/wallet");
const express = require("express");
const router = express.Router();
const authCheck = require("./authCheck");
const authCheck = require("../authCheck");
router.get("/genseed/:passphrase?", authCheck, WalletController.genSeed);
router.post("/:operation", authCheck, WalletController.operateWallet);

View file

@ -9,7 +9,7 @@ import * as sha256 from 'sha256';
import { LoggerService } from './shared/services/logger.service';
import { RTLConfiguration, Settings, LightningNode } from './shared/models/RTLconfig';
import { GetInfo } from './shared/models/lndModels';
import { GetInfoRoot } from './shared/models/lndModels';
import * as RTLActions from './store/rtl.actions';
import * as fromRTLReducer from './store/rtl.reducers';
@ -24,7 +24,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild('settingSidenav', { static: true }) settingSidenav: any;
public selNode: LightningNode;
public settings: Settings;
public information: GetInfo = {};
public information: GetInfoRoot = {};
public flgLoading: Array<Boolean | 'error'> = [true]; // 0: Info
public flgCopied = false;
public appConfig: RTLConfiguration;
@ -38,13 +38,13 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
ngOnInit() {
this.store.dispatch(new RTLActions.FetchRTLConfig());
this.accessKey = this.readAccessKey();
this.store.select('rtl')
this.store.select('root')
.pipe(takeUntil(this.unsubs[0]))
.subscribe(rtlStore => {
this.selNode = rtlStore.selNode;
this.settings = this.selNode.settings;
this.appConfig = rtlStore.appConfig;
this.information = rtlStore.information;
this.information = rtlStore.nodeData;
this.flgLoading[0] = (undefined !== this.information.identity_pubkey) ? false : true;
if (window.innerWidth <= 768) {
this.settings.menu = 'Vertical';

View file

@ -30,6 +30,7 @@ import { AuthInterceptor } from './shared/services/auth.interceptor';
import { RTLReducer } from './store/rtl.reducers';
import { RTLEffects } from './store/rtl.effects';
import { CLEffects } from './clightning/store/cl.effects';
@NgModule({
imports: [
@ -39,8 +40,8 @@ import { RTLEffects } from './store/rtl.effects';
PerfectScrollbarModule,
routing,
UserIdleModule.forRoot({idle: 60 * 60, timeout: 1, ping: null}),
StoreModule.forRoot({rtl: RTLReducer}),
EffectsModule.forRoot([RTLEffects]),
StoreModule.forRoot(RTLReducer),
EffectsModule.forRoot([RTLEffects, CLEffects]),
!environment.production ? StoreDevtoolsModule.instrument() : []
],
declarations: [

View file

@ -14,7 +14,6 @@ import * as fromRTLReducer from '../store/rtl.reducers';
styleUrls: ['./cl-root.component.scss']
})
export class CLRootComponent implements OnInit, OnDestroy {
unsubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private store: Store<fromRTLReducer.RTLState>, private actions$: Actions, private router: Router, private activatedRoute: ActivatedRoute) {}
@ -22,17 +21,12 @@ export class CLRootComponent implements OnInit, OnDestroy {
ngOnInit() {
console.warn('CL ROOT')
this.router.navigate(['./home'], {relativeTo: this.activatedRoute});
this.initializeRemainingData();
// this.store.dispatch(new RTLActions.FetchCLInfo());
// this.actions$.pipe(takeUntil(this.unsubs[0]), filter((action) => action.type === RTLActions.SET_CL_INFO || action.type === RTLActions.INIT_APP_DATA))
// .subscribe((infoData: RTLActions.SetCLInfo | RTLActions.InitAppData) => {
// if(infoData.type === RTLActions.SET_CL_INFO && undefined !== infoData.payload.identity_pubkey) {
// this.initializeRemainingData();
// }
// if(infoData.type === RTLActions.INIT_APP_DATA) {
// this.store.dispatch(new RTLActions.FetchCLInfo());
// }
// });
this.actions$.pipe(takeUntil(this.unsubs[0]), filter((action) => action.type === RTLActions.SET_CL_INFO))
.subscribe((infoData: RTLActions.SetCLInfo) => {
if(undefined !== infoData.payload.id) {
this.initializeRemainingData();
}
});
}
initializeRemainingData() {

View file

@ -10,18 +10,8 @@
<mat-card-content>
<div fxLayout="column" class="pl-4">
<mat-list fxFlex="100" fxLayoutAlign="start start">
<mat-list-item fxFlex="65" fxLayoutAlign="start start">Daily ({{information?.smaller_currency_unit}})</mat-list-item>
<mat-list-item fxFlex="25" fxLayoutAlign="end start">{{fees?.day_fee_sum}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxFlex="100" fxLayoutAlign="start start">
<mat-list-item fxFlex="65" fxLayoutAlign="start start">Weekly ({{information?.smaller_currency_unit}})</mat-list-item>
<mat-list-item fxFlex="25" fxLayoutAlign="end start">{{fees?.week_fee_sum}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
<mat-list fxFlex="100" fxLayoutAlign="start start">
<mat-list-item fxFlex="65" fxLayoutAlign="start start">Monthly ({{information?.smaller_currency_unit}})</mat-list-item>
<mat-list-item fxFlex="25" fxLayoutAlign="end start">{{fees?.month_fee_sum}}</mat-list-item>
<mat-list-item fxFlex="65" fxLayoutAlign="start start"> Fee Collected </mat-list-item>
<mat-list-item fxFlex="25" fxLayoutAlign="end start">{{fees?.feeCollected}}</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
</div>

View file

@ -4,10 +4,11 @@ import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { LoggerService } from '../../shared/services/logger.service';
import { GetInfo, Fees } from '../../shared/models/lndModels';
import { GetInfoCL, FeesCL } from '../../shared/models/clModels';
import { LightningNode } from '../../shared/models/RTLconfig';
import * as fromRTLReducer from '../../store/rtl.reducers';
import * as fromCLReducer from '../store/cl.reducers';
@Component({
selector: 'rtl-cl-home',
@ -16,38 +17,43 @@ import * as fromRTLReducer from '../../store/rtl.reducers';
})
export class CLHomeComponent implements OnInit, OnDestroy {
public selNode: LightningNode;
public fees: Fees;
public information: GetInfo = {};
public fees: FeesCL;
public information: GetInfoCL = {};
public flgLoading: Array<Boolean | 'error'> = [true, true, true, true, true, true, true, true]; // 0: Info, 1: Fee, 2: Wallet, 3: Channel, 4: Network
private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>) {}
ngOnInit() {
this.store.select('rtl')
this.store.select('root')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchInfo') {
.subscribe((rootStore: fromRTLReducer.RootState) => {
rootStore.effectErrors.forEach(effectsErr => {
if (effectsErr.action === 'FetchCLInfo') {
this.flgLoading[0] = 'error';
}
if (effectsErr.action === 'FetchFees') {
if (effectsErr.action === 'FetchCLFees') {
this.flgLoading[1] = 'error';
}
});
this.selNode = rtlStore.selNode;
this.information = rtlStore.information;
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== this.information.identity_pubkey) ? false : true;
}
this.fees = rtlStore.fees;
if (this.flgLoading[1] !== 'error') {
this.flgLoading[1] = (undefined !== this.fees.day_fee_sum) ? false : true;
}
this.logger.info(rtlStore);
this.selNode = rootStore.selNode;
this.logger.warn(rootStore);
});
this.store.select('cl')
.pipe(takeUntil(this.unsub[1]))
.subscribe((clStore: fromCLReducer.CLState) => {
this.information = clStore.information;
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== this.information.id) ? false : true;
}
this.fees = clStore.fees;
if (this.flgLoading[1] !== 'error') {
this.flgLoading[1] = (undefined !== this.fees.feeCollected) ? false : true;
}
this.logger.warn(clStore);
});
}
ngOnDestroy() {

View file

@ -0,0 +1,75 @@
import { Injectable, OnDestroy } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Store } from '@ngrx/store';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { map, mergeMap, catchError, withLatestFrom } from 'rxjs/operators';
import { environment, API_URL } from '../../../environments/environment';
import { LoggerService } from '../../shared/services/logger.service';
import { GetInfoCL, FeesCL } from '../../shared/models/clModels';
import * as fromRTLReducer from '../../store/rtl.reducers';
import * as RTLActions from '../../store/rtl.actions';
@Injectable()
export class CLEffects implements OnDestroy {
dialogRef: any;
CHILD_API_URL = API_URL + '/cl';
constructor(
private actions$: Actions,
private httpClient: HttpClient,
private store: Store<fromRTLReducer.RTLState>,
private logger: LoggerService) { }
@Effect()
infoFetchCL = this.actions$.pipe(
ofType(RTLActions.FETCH_CL_INFO),
withLatestFrom(this.store.select('root')),
mergeMap(([action, store]) => {
this.store.dispatch(new RTLActions.ClearEffectError('FetchCLInfo'));
return this.httpClient.get<GetInfoCL>(this.CHILD_API_URL + environment.GETINFO_API)
.pipe(
map((info) => {
this.logger.info(info);
sessionStorage.setItem('clUnlocked', 'true');
return {
type: RTLActions.SET_CL_INFO,
payload: (undefined !== info) ? info : {}
};
}),
catchError((err) => {
this.logger.error(err);
this.store.dispatch(new RTLActions.EffectError({ action: 'FetchCLInfo', code: err.status, message: err.error.error }));
return of();
})
);
}
));
@Effect()
fetchFeesCL = this.actions$.pipe(
ofType(RTLActions.FETCH_CL_FEES),
mergeMap((action: RTLActions.FetchCLFees) => {
this.logger.warn('I AM HERE');
this.store.dispatch(new RTLActions.ClearEffectError('FetchCLFees'));
return this.httpClient.get<FeesCL>(this.CHILD_API_URL + environment.FEES_API);
}),
map((fees) => {
this.logger.info(fees);
return {
type: RTLActions.SET_CL_FEES,
payload: (undefined !== fees) ? fees : {}
};
}),
catchError((err: any) => {
this.logger.error(err);
this.store.dispatch(new RTLActions.EffectError({ action: 'FetchCLFees', code: err.status, message: err.error.error }));
return of();
}
));
ngOnDestroy() {}
}

View file

@ -0,0 +1,30 @@
import { GetInfoCL, FeesCL } from '../../shared/models/clModels';
import * as RTLActions from '../../store/rtl.actions';
export interface CLState {
information: GetInfoCL;
fees: FeesCL;
}
export const initCLState: CLState = {
information: {},
fees: {}
}
export function CLReducer(state = initCLState, action: RTLActions.RTLActions) {
switch (action.type) {
case RTLActions.SET_CL_INFO:
return {
...state,
information: action.payload
};
case RTLActions.SET_CL_FEES:
return {
...state,
fees: action.payload
};
default:
return state;
}
}

View file

@ -27,10 +27,10 @@ export class HorizontalNavigationComponent implements OnInit {
}
ngOnInit() {
this.store.select('rtl')
this.store.select('root')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore) => {
this.numPendingChannels = rtlStore.numberOfPendingChannels;
this.numPendingChannels = rtlStore.nodeData.numberOfPendingChannels;
if(rtlStore.selNode.lnImplementation.toLowerCase() === 'clightning') {
this.menuNodes = MENU_DATA.CLChildren;
} else {

View file

@ -11,7 +11,7 @@ import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'
import { LightningNode, Settings } from '../../../models/RTLconfig';
import { LoggerService } from '../../../services/logger.service';
import { GetInfo, GetInfoChain } from '../../../models/lndModels';
import { GetInfoRoot, GetInfoChain } from '../../../models/lndModels';
import { MenuChildNode, FlatMenuNode, MENU_DATA } from '../../../models/navMenu';
import { RTLEffects } from '../../../../store/rtl.effects';
@ -28,7 +28,7 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
public selNode: LightningNode;
public settings: Settings;
public version = '';
public information: GetInfo = {};
public information: GetInfoRoot = {};
public informationChain: GetInfoChain = {};
public flgLoading = true;
public logoutNode = [{id: 200, parentId: 0, name: 'Logout', icon: 'eject'}];
@ -61,13 +61,13 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtl')
this.store.select('root')
.pipe(takeUntil(this.unSubs[0]))
.subscribe(rtlStore => {
this.selNode = rtlStore.selNode;
this.settings = this.selNode.settings;
this.information = rtlStore.information;
this.numPendingChannels = rtlStore.numberOfPendingChannels;
this.information = rtlStore.nodeData;
this.numPendingChannels = rtlStore.nodeData.numberOfPendingChannels;
if (undefined !== this.information.identity_pubkey) {
if (undefined !== this.information.chains && typeof this.information.chains[0] === 'string') {

View file

@ -6,7 +6,7 @@ import { Actions } from '@ngrx/effects';
import { LightningNode } from '../../../models/RTLconfig';
import { LoggerService } from '../../../services/logger.service';
import { GetInfo, GetInfoChain } from '../../../models/lndModels';
import { GetInfoRoot, GetInfoChain } from '../../../models/lndModels';
import { environment } from '../../../../../environments/environment';
import { RTLEffects } from '../../../../store/rtl.effects';
@ -21,7 +21,7 @@ import * as RTLActions from '../../../../store/rtl.actions';
export class TopMenuComponent implements OnInit, OnDestroy {
public selNode: LightningNode;
public version = '';
public information: GetInfo = {};
public information: GetInfoRoot = {};
public informationChain: GetInfoChain = {};
public flgLoading = true;
public showLogout = false;
@ -32,12 +32,12 @@ export class TopMenuComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select('rtl')
this.store.select('root')
.pipe(takeUntil(this.unSubs[0]))
.subscribe((rtlStore) => {
this.selNode = rtlStore.selNode;
this.information = rtlStore.information;
this.information = rtlStore.nodeData;
this.flgLoading = (undefined !== this.information.identity_pubkey) ? false : true;
if (undefined !== this.information.identity_pubkey) {

View file

@ -4,7 +4,7 @@ import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { LightningNode, RTLConfiguration } from '../../models/RTLconfig';
import { GetInfo } from '../../models/lndModels';
import { GetInfoRoot } from '../../models/lndModels';
import { LoggerService } from '../../services/logger.service';
import * as RTLActions from '../../../store/rtl.actions';
@ -17,7 +17,7 @@ import * as fromRTLReducer from '../../../store/rtl.reducers';
})
export class SettingsNavComponent implements OnInit, OnDestroy {
public selNode: LightningNode;
public information: GetInfo = {};
public information: GetInfoRoot = {};
public menus = ['Vertical', 'Horizontal'];
public menuTypes = ['Regular', 'Compact', 'Mini'];
public selectedMenu: string;
@ -32,7 +32,7 @@ export class SettingsNavComponent implements OnInit, OnDestroy {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>) {}
ngOnInit() {
this.store.select('rtl')
this.store.select('root')
.pipe(takeUntil(this.unsubs[0]))
.subscribe((rtlStore) => {
this.appConfig = rtlStore.appConfig;
@ -45,7 +45,7 @@ export class SettingsNavComponent implements OnInit, OnDestroy {
this.selNode.settings.flgSidenavPinned = false;
this.showSettingOption = false;
}
this.information = rtlStore.information;
this.information = rtlStore.nodeData;
this.currencyUnit = (undefined !== this.information && undefined !== this.information.currency_unit) ? this.information.currency_unit : 'BTC';
this.logger.info(rtlStore);
});

View file

@ -28,7 +28,7 @@ export class SigninComponent implements OnInit, OnDestroy {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>) { }
ngOnInit() {
this.store.select('rtl')
this.store.select('root')
.pipe(takeUntil(this.unsub[0]))
.subscribe((rtlStore) => {
rtlStore.effectErrors.forEach(effectsErr => {

View file

@ -1,52 +1,27 @@
// export interface GetInfoAddress {
// type?: string;
// address?: string;
// port?: number;
// }
// export interface GetInfo {
// id?: string;
// alias?: string;
// color?: string;
// num_peers?: number;
// num_pending_channels?: number;
// num_active_channels?: number;
// num_inactive_channels?: number;
// address?: GetInfoAddress[];
// binding?: GetInfoAddress[];
// version?: string;
// blockheight?: number;
// network?: string;
// msatoshi_fees_collected?: number;
// fees_collected_msat?: string;
// }
export interface GetInfoChain {
chain?: string;
network?: string;
export interface GetInfoAddress {
type?: string;
address?: string;
port?: number;
}
export interface GetInfoCL {
identity_pubkey?: string;
alias?: string;
num_pending_channels?: number;
num_active_channels?: number;
num_inactive_channels?: number;
num_peers?: number;
block_height?: number;
synced_to_chain?: boolean;
testnet?: boolean;
chains?: GetInfoChain[];
id?: string;
alias?: string;
color?: string;
num_peers?: number;
num_pending_channels?: number;
num_active_channels?: number;
num_inactive_channels?: number;
address?: GetInfoAddress[];
binding?: GetInfoAddress[];
version?: string;
currency_unit?: string;
smaller_currency_unit?: string;
blockheight?: number;
network?: string;
msatoshi_fees_collected?: number;
fees_collected_msat?: string;
}
export interface FeesCL {
day_fee_sum?: number;
week_fee_sum?: number;
month_fee_sum?: number;
btc_day_fee_sum?: number;
btc_week_fee_sum?: number;
btc_month_fee_sum?: number;
feeCollected?: number;
btc_feeCollected?: number;
}

View file

@ -1,3 +1,14 @@
export interface GetInfoRoot {
identity_pubkey?: string;
alias?: string;
testnet?: boolean;
chains?: GetInfoChain[] | string[];
version?: string;
currency_unit?: string;
smaller_currency_unit?: string;
numberOfPendingChannels?: number;
}
export interface AddressType {
addressId?: string;
addressTp?: string;

Some files were not shown because too many files have changed in this diff Show more