mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2026-08-13 12:33:07 +02:00
Release 0.15.3 (#1467)
* Fix `Unknown command` error when disabling offers on CLN. ([#1443]) (#1451) * Add missing SSO options to config (#1455) * Fix for cln logic screen navigation (#1457) * Transactions destination address display fix (#1458) * cln delexpiredinvoices deprecation fix (#1459) * Read LN_IMPLEMENTATION from environment (#1460) * Add Fee Rate Information on Send Funds Modal (#1461) * Artifact script fix (#1464) * Add AMP toggle for LND Send Payments (#1466) --------- Co-authored-by: Se7enZ <118189041+s373nZ@users.noreply.github.com>
This commit is contained in:
parent
6027167e2a
commit
a594606d27
62 changed files with 4011 additions and 4047 deletions
|
|
@ -9,11 +9,11 @@ export const deleteExpiredInvoice = (req, res, next) => {
|
|||
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Invoices', msg: 'Deleting Expired Invoices..' });
|
||||
options = common.getOptions(req);
|
||||
if (options.error) { return res.status(options.statusCode).json({ message: options.message, error: options.error }); }
|
||||
options.url = req.session.selectedNode.settings.lnServerUrl + '/v1/delexpiredinvoice';
|
||||
options.url = req.session.selectedNode.settings.lnServerUrl + '/v1/autoclean-once';
|
||||
options.body = req.body;
|
||||
request.post(options).then((body) => {
|
||||
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Invoice', msg: 'Invoices Deleted', data: body });
|
||||
res.status(204).json({ status: 'Invoice Deleted Successfully' });
|
||||
res.status(201).json({ status: 'Cleaned Invoices: ' + body.autoclean.expiredinvoices.cleaned + ', Uncleaned Invoices: ' + body.autoclean.expiredinvoices.uncleaned });
|
||||
}).catch((errRes) => {
|
||||
const err = common.handleError(errRes, 'Invoice', 'Delete Invoice Error', req.session.selectedNode);
|
||||
return res.status(err.statusCode).json({ message: err.message, error: err.error });
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ export const disableOffer = (req, res, next) => {
|
|||
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Offers', msg: 'Disabling Offer..' });
|
||||
options = common.getOptions(req);
|
||||
if (options.error) { return res.status(options.statusCode).json({ message: options.message, error: options.error }); }
|
||||
options.url = req.session.selectedNode.settings.lnServerUrl + '/v1/disableOffer';
|
||||
options.url = req.session.selectedNode.settings.lnServerUrl + '/v1/disableoffer';
|
||||
options.body = req.body;
|
||||
request.post(options).then((body) => {
|
||||
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Offers', msg: 'Offer Disabled', data: body });
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export const simplifyAllChannels = (selNode: SelectedNode, channels) => {
|
|||
});
|
||||
channelNodeIds = channelNodeIds.substring(1);
|
||||
options.url = selNode.settings.lnServerUrl + '/nodes';
|
||||
options.form = { nodeIds: channelNodeIds };
|
||||
options.form = channelNodeIds;
|
||||
logger.log({ selectedNode: selNode, level: 'DEBUG', fileName: 'Channels', msg: 'Node Ids to find alias', data: channelNodeIds });
|
||||
return request.post(options).then((nodes) => {
|
||||
logger.log({ selectedNode: selNode, level: 'DEBUG', fileName: 'Channels', msg: 'Filtered Nodes Received', data: nodes });
|
||||
|
|
|
|||
|
|
@ -155,37 +155,6 @@ export const postChannel = (req, res, next) => {
|
|||
});
|
||||
};
|
||||
|
||||
export const postTransactions = (req, res, next) => {
|
||||
const { paymentReq, paymentAmount, feeLimit, outgoingChannel, allowSelfPayment, lastHopPubkey } = req.body;
|
||||
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Sending Payment..' });
|
||||
options = common.getOptions(req);
|
||||
if (options.error) { return res.status(options.statusCode).json({ message: options.message, error: options.error }); }
|
||||
options.url = req.session.selectedNode.settings.lnServerUrl + '/v1/channels/transaction-stream';
|
||||
options.form = { payment_request: paymentReq };
|
||||
if (paymentAmount) {
|
||||
options.form.amt = paymentAmount;
|
||||
}
|
||||
if (feeLimit) { options.form.fee_limit = feeLimit; }
|
||||
if (outgoingChannel) { options.form.outgoing_chan_id = outgoingChannel; }
|
||||
if (allowSelfPayment) { options.form.allow_self_payment = allowSelfPayment; }
|
||||
if (lastHopPubkey) { options.form.last_hop_pubkey = Buffer.from(lastHopPubkey, 'hex').toString('base64'); }
|
||||
options.form = JSON.stringify(options.form);
|
||||
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Send Payment Options', data: options.form });
|
||||
request.post(options).then((body) => {
|
||||
body = body.result ? body.result : body;
|
||||
if (body.payment_error) {
|
||||
const err = common.handleError(body.payment_error, 'Channels', 'Send Payment Error', req.session.selectedNode);
|
||||
return res.status(err.statusCode).json({ message: err.message, error: err.error });
|
||||
} else {
|
||||
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Payment Sent', data: body });
|
||||
res.status(201).json(body);
|
||||
}
|
||||
}).catch((errRes) => {
|
||||
const err = common.handleError(errRes, 'Channels', 'Send Payment Error', req.session.selectedNode);
|
||||
return res.status(err.statusCode).json({ message: err.message, error: err.error });
|
||||
});
|
||||
};
|
||||
|
||||
export const closeChannel = (req, res, next) => {
|
||||
try {
|
||||
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Closing Channel..' });
|
||||
|
|
|
|||
|
|
@ -96,3 +96,32 @@ export const paymentLookup = (req, res, next) => {
|
|||
return res.status(err.statusCode).json({ message: err.message, error: err.error });
|
||||
});
|
||||
};
|
||||
|
||||
export const sendPayment = (req, res, next) => {
|
||||
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Payments', msg: 'Sending Payment..' });
|
||||
options = common.getOptions(req);
|
||||
if (options.error) { return res.status(options.statusCode).json({ message: options.message, error: options.error }); }
|
||||
options.url = req.session.selectedNode.settings.lnServerUrl + '/v2/router/send';
|
||||
if (req.body.last_hop_pubkey) {
|
||||
req.body.last_hop_pubkey = Buffer.from(req.body.last_hop_pubkey, 'hex').toString('base64');
|
||||
}
|
||||
req.body.amp = req.body.amp ?? false;
|
||||
req.body.timeout_seconds = req.body.timeout_seconds || 600;
|
||||
options.form = JSON.stringify(req.body);
|
||||
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Payments', msg: 'Send Payment Options', data: options.form });
|
||||
request.post(options).then((body) => {
|
||||
const results = body.split('\n').filter(Boolean).map((jsonString) => JSON.parse(jsonString));
|
||||
body = results.length > 0 ? results[results.length - 1] : { result: { status: 'UNKNOWN' } };
|
||||
if (body.result.status === 'FAILED') {
|
||||
const err = common.handleError(common.titleCase(body.result.failure_reason.replace(/_/g, ' ').replace('FAILURE REASON ', '')), 'Payments', 'Send Payment Error', req.session.selectedNode);
|
||||
return res.status(err.statusCode).json({ message: err.message, error: err.error });
|
||||
}
|
||||
if (body.result.status === 'SUCCEEDED') {
|
||||
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Payments', msg: 'Payment Sent', data: body.result });
|
||||
res.status(201).json(body.result);
|
||||
}
|
||||
}).catch((errRes) => {
|
||||
const err = common.handleError(errRes, 'Payments', 'Send Payment Error', req.session.selectedNode);
|
||||
return res.status(err.statusCode).json({ message: err.message, error: err.error });
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import exprs from 'express';
|
||||
const { Router } = exprs;
|
||||
import { isAuthenticated } from '../../utils/authCheck.js';
|
||||
import { getAllChannels, getPendingChannels, getClosedChannels, postChannel, postTransactions, closeChannel, postChanPolicy } from '../../controllers/lnd/channels.js';
|
||||
import { getAllChannels, getPendingChannels, getClosedChannels, postChannel, closeChannel, postChanPolicy } from '../../controllers/lnd/channels.js';
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
|
@ -9,7 +9,6 @@ router.get('/', isAuthenticated, getAllChannels);
|
|||
router.get('/pending', isAuthenticated, getPendingChannels);
|
||||
router.get('/closed', isAuthenticated, getClosedChannels);
|
||||
router.post('/', isAuthenticated, postChannel);
|
||||
router.post('/transactions', isAuthenticated, postTransactions);
|
||||
router.delete('/:channelPoint', isAuthenticated, closeChannel);
|
||||
router.post('/chanPolicy', isAuthenticated, postChanPolicy);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import exprs from 'express';
|
||||
const { Router } = exprs;
|
||||
import { isAuthenticated } from '../../utils/authCheck.js';
|
||||
import { decodePayment, decodePayments, getPayments, getAllLightningTransactions, paymentLookup } from '../../controllers/lnd/payments.js';
|
||||
import { decodePayment, decodePayments, getPayments, getAllLightningTransactions, paymentLookup, sendPayment } from '../../controllers/lnd/payments.js';
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
|
@ -10,5 +10,6 @@ router.get('/alltransactions', isAuthenticated, getAllLightningTransactions);
|
|||
router.get('/decode/:payRequest', isAuthenticated, decodePayment);
|
||||
router.get('/lookup/:paymentHash', isAuthenticated, paymentLookup);
|
||||
router.post('/', isAuthenticated, decodePayments);
|
||||
router.post('/send', isAuthenticated, sendPayment);
|
||||
|
||||
export default router;
|
||||
|
|
|
|||
|
|
@ -413,7 +413,8 @@ export class CommonService {
|
|||
});
|
||||
};
|
||||
|
||||
public readCookie = () => {
|
||||
public readCookie = (config) => {
|
||||
this.appConfig.SSO = config.SSO;
|
||||
const exists = fs.existsSync(this.appConfig.SSO.rtlCookiePath);
|
||||
if (exists) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ export class ConfigService {
|
|||
this.common.nodes[idx] = { settings: { blockExplorerUrl: '' }, authentication: {} };
|
||||
this.common.nodes[idx].index = node.index;
|
||||
this.common.nodes[idx].lnNode = node.lnNode;
|
||||
this.common.nodes[idx].lnImplementation = (process?.env?.lnImplementation) ? process?.env?.lnImplementation : node.lnImplementation ? node.lnImplementation : 'LND';
|
||||
this.common.nodes[idx].lnImplementation = (process?.env?.LN_IMPLEMENTATION) ? process?.env?.LN_IMPLEMENTATION : node.lnImplementation ? node.lnImplementation : 'LND';
|
||||
if (this.common.nodes[idx].lnImplementation === 'CLT') { this.common.nodes[idx].lnImplementation = 'CLN'; }
|
||||
switch (this.common.nodes[idx].lnImplementation) {
|
||||
case 'CLN':
|
||||
|
|
@ -321,7 +321,7 @@ export class ConfigService {
|
|||
if (!config.SSO.rtlCookiePath || config.SSO.rtlCookiePath.trim() === '') {
|
||||
this.errMsg = 'Please set rtlCookiePath value for single sign on option!';
|
||||
} else {
|
||||
this.common.readCookie();
|
||||
this.common.readCookie(config);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue