diff --git a/.gitignore b/.gitignore index c8b44e20..7d3771ea 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,6 @@ _config.yml RTL-Config-Docker.json dockerfiles/RTL-Config.json dockerfiles/.env +RTL-Config-Regtest.json +RTL-Config-Signet.json +RTL-Config-Testnet.json diff --git a/backend/controllers/cln/getInfo.js b/backend/controllers/cln/getInfo.js index 266f3f8f..75891f4d 100644 --- a/backend/controllers/cln/getInfo.js +++ b/backend/controllers/cln/getInfo.js @@ -36,27 +36,20 @@ export const getInfo = (req, res, next) => { return res.status(err.statusCode).json({ message: err.message, error: err.error }); } else { + logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'GetInfo', msg: 'Node Information Before Update', data: body }); body.lnImplementation = 'Core Lightning'; const chainObj = { chain: '', network: '' }; - if (body.network === 'testnet') { - chainObj.chain = 'Bitcoin'; - chainObj.network = 'Testnet'; + if (body.network.includes('litecoin') || body.network.includes('feathercoin')) { + chainObj.chain = ''; + chainObj.network = ''; } - else if (body.network === 'bitcoin') { - chainObj.chain = 'Bitcoin'; - chainObj.network = 'Mainnet'; + else if (body.network.includes('liquid')) { + chainObj.chain = 'Liquid'; + chainObj.network = common.titleCase(body.network); } - else if (body.network === 'signet') { + else { chainObj.chain = 'Bitcoin'; - chainObj.network = 'Signet'; - } - else if (body.network === 'litecoin') { - chainObj.chain = 'Litecoin'; - chainObj.network = 'Mainnet'; - } - else if (body.network === 'litecoin-testnet') { - chainObj.chain = 'Litecoin'; - chainObj.network = 'Testnet'; + chainObj.network = common.titleCase(body.network); } body.chains = [chainObj]; body.uris = []; diff --git a/backend/utils/common.js b/backend/utils/common.js index 012ea6d6..487ffc41 100644 --- a/backend/utils/common.js +++ b/backend/utils/common.js @@ -201,6 +201,20 @@ export class CommonService { array.unshift(newlyAddedRecord[0]); return array; }; + this.camelCase = (str) => str.replace(/(?:^\w|[A-Z]|\b\w)/g, (word, index) => (word.toUpperCase())).replace(/\s+/g, '').replace(/-/g, ' '); + this.titleCase = (str) => { + if (str.indexOf('!\n') > 0 || str.indexOf('.\n') > 0) { + return str.split('\n').reduce((accumulator, currentStr) => accumulator + currentStr.charAt(0).toUpperCase() + currentStr.substring(1).toLowerCase() + '\n', ''); + } + else { + if (str.indexOf(' ') > 0) { + return str.split(' ').reduce((accumulator, currentStr) => accumulator + currentStr.charAt(0).toUpperCase() + currentStr.substring(1).toLowerCase() + ' ', ''); + } + else { + return str.charAt(0).toUpperCase() + str.substring(1).toLowerCase(); + } + } + }; this.handleError = (errRes, fileName, errMsg, selectedNode) => { const err = JSON.parse(JSON.stringify(errRes)); if (!selectedNode) { diff --git a/frontend/index.html b/frontend/index.html index 0958c82c..8c30ca33 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -13,6 +13,6 @@